This module contains essential stuff that should've come with Python itself ;)
Class |
|
Similar to MutableChain but for async iterables |
Class |
|
Thin wrapper around itertools.chain, allowing to add iterables "in-place" |
Function | binary |
Returns ``True`` if the given ``data`` argument (a ``bytes`` object) does not contain unprintable control characters. |
Function | equal |
Compare two objects attributes |
Function | flatten |
flatten(sequence) -> list |
Function | garbage |
Undocumented |
Function | get |
Return the argument name list of a callable |
Function | get |
Returns (args, kwargs) tuple for a function >>> import re >>> get_spec(re.match) (['pattern', 'string'], {'flags': 0}) |
Function | global |
Return full name of a global object. |
Function | iflatten |
iflatten(sequence) -> iterator |
Function | is |
>>> is_listlike("foo") False >>> is_listlike(5) False >>> is_listlike(b"foo") False >>> is_listlike([b"foo"]) True >>> is_listlike((b"foo",)) True >>> is_listlike({}) True >>> is_listlike(set()) True >>> is_listlike((x for x in range(3))) True >>> is_listlike(range(5)) True... |
Function | memoizemethod |
Decorator to cache the result of a method (without arguments) using a weak reference to its object |
Function | re |
This function does a reverse search in a text using a regular expression given in the attribute 'pattern'. Since the re module does not provide this functionality, we have to find for the expression into chunks of text extracted from the end (for the sake of efficiency)... |
Function | to |
Return the binary representation of ``text``. If ``text`` is already a bytes object, return it as-is. |
Function | to |
Return the unicode representation of a bytes object ``text``. If ``text`` is already an unicode object, return it as-is. |
Function | unique |
efficient function to uniquify a list preserving item order |
Function | without |
Return a copy of ``iterable`` with all ``None`` entries removed. |
Async Function | _async |
Undocumented |
Constant | _BINARYCHARS |
Undocumented |
Returns ``True`` if the given ``data`` argument (a ``bytes`` object) does not contain unprintable control characters.
flatten(sequence) -> list Returns a single, flat list which contains all elements retrieved from the sequence and all recursively contained sub-sequences (iterables). Examples: >>> [1, 2, [3,4], (5,6)] [1, 2, [3, 4], (5, 6)] >>> flatten([[[1,2,3], (42,None)], [4,5], [6], 7, (8,9,10)]) [1, 2, 3, 42, None, 4, 5, 6, 7, 8, 9, 10] >>> flatten(["foo", "bar"]) ['foo', 'bar'] >>> flatten(["foo", ["baz", 42], "bar"]) ['foo', 'baz', 42, 'bar']
Returns (args, kwargs) tuple for a function >>> import re >>> get_spec(re.match) (['pattern', 'string'], {'flags': 0}) >>> class Test: ... def __call__(self, val): ... pass ... def method(self, val, flags=0): ... pass >>> get_spec(Test) (['self', 'val'], {}) >>> get_spec(Test.method) (['self', 'val'], {'flags': 0}) >>> get_spec(Test().method) (['self', 'val'], {'flags': 0})
Return full name of a global object. >>> from scrapy import Request >>> global_object_name(Request) 'scrapy.http.request.Request'
>>> is_listlike("foo") False >>> is_listlike(5) False >>> is_listlike(b"foo") False >>> is_listlike([b"foo"]) True >>> is_listlike((b"foo",)) True >>> is_listlike({}) True >>> is_listlike(set()) True >>> is_listlike((x for x in range(3))) True >>> is_listlike(range(5)) True
This function does a reverse search in a text using a regular expression given in the attribute 'pattern'. Since the re module does not provide this functionality, we have to find for the expression into chunks of text extracted from the end (for the sake of efficiency). At first, a chunk of 'chunk_size' kilobytes is extracted from the end, and searched for the pattern. If the pattern is not found, another chunk is extracted, and another search is performed. This process continues until a match is found, or until the whole file is read. In case the pattern wasn't found, None is returned, otherwise it returns a tuple containing the start position of the match, and the ending (regarding the entire text).
Return the binary representation of ``text``. If ``text`` is already a bytes object, return it as-is.
Return the unicode representation of a bytes object ``text``. If ``text`` is already an unicode object, return it as-is.
Return a copy of ``iterable`` with all ``None`` entries removed. If ``iterable`` is a mapping, return a dictionary where all pairs that have value ``None`` have been removed.