Search is not available for this dataset
identifier
stringlengths
1
155
parameters
stringlengths
2
6.09k
docstring
stringlengths
11
63.4k
docstring_summary
stringlengths
0
63.4k
function
stringlengths
29
99.8k
function_tokens
list
start_point
list
end_point
list
language
stringclasses
1 value
docstring_language
stringlengths
2
7
docstring_language_predictions
stringlengths
18
23
is_langid_reliable
stringclasses
2 values
TestNoselikeTestAttribute.test_class_with_nasty_getattr
(self, testdir)
Make sure we handle classes with a custom nasty __getattr__ right. With a custom __getattr__ which e.g. returns a function (like with a RPC wrapper), we shouldn't assume this meant "__test__ = True".
Make sure we handle classes with a custom nasty __getattr__ right.
def test_class_with_nasty_getattr(self, testdir): """Make sure we handle classes with a custom nasty __getattr__ right. With a custom __getattr__ which e.g. returns a function (like with a RPC wrapper), we shouldn't assume this meant "__test__ = True". """ # https://github.com/p...
[ "def", "test_class_with_nasty_getattr", "(", "self", ",", "testdir", ")", ":", "# https://github.com/pytest-dev/pytest/issues/1204", "testdir", ".", "makepyfile", "(", "\"\"\"\n class MetaModel(type):\n\n def __getattr__(cls, key):\n return lamb...
[ 323, 4 ]
[ 350, 29 ]
python
en
['en', 'en', 'en']
True
BaseWebObject._wait_until
(self, predicate, timeout=None, poll_frequency=0.5)
Wait until the value returned by predicate is not False. It also returns when the timeout is elapsed. 'predicate' takes the driver as argument.
Wait until the value returned by predicate is not False.
def _wait_until(self, predicate, timeout=None, poll_frequency=0.5): """Wait until the value returned by predicate is not False. It also returns when the timeout is elapsed. 'predicate' takes the driver as argument. """ if not timeout: timeout = self.explicit_wait ...
[ "def", "_wait_until", "(", "self", ",", "predicate", ",", "timeout", "=", "None", ",", "poll_frequency", "=", "0.5", ")", ":", "if", "not", "timeout", ":", "timeout", "=", "self", ".", "explicit_wait", "return", "wait", ".", "WebDriverWait", "(", "self", ...
[ 94, 4 ]
[ 103, 22 ]
python
en
['en', 'en', 'en']
True
BaseWebObject._wait_till_text_present_in_element
(self, element, texts, timeout=None)
Waiting for a text to appear in a certain element. Most frequent usage is actually to wait for a _different_ element with a different text to appear in place of an old element. So a way to avoid capturing stale element reference should be provided for this use case. Better to w...
Waiting for a text to appear in a certain element.
def _wait_till_text_present_in_element(self, element, texts, timeout=None): """Waiting for a text to appear in a certain element. Most frequent usage is actually to wait for a _different_ element with a different text to appear in place of an old element. So a way to avoid capturing sta...
[ "def", "_wait_till_text_present_in_element", "(", "self", ",", "element", ",", "texts", ",", "timeout", "=", "None", ")", ":", "if", "not", "isinstance", "(", "texts", ",", "(", "list", ",", "tuple", ")", ")", ":", "texts", "=", "(", "texts", ",", ")",...
[ 105, 4 ]
[ 127, 51 ]
python
en
['en', 'en', 'en']
True
Coroutine.send
(self, value)
Send a value into the coroutine. Return next yielded value or raise StopIteration.
Send a value into the coroutine. Return next yielded value or raise StopIteration.
def send(self, value): """Send a value into the coroutine. Return next yielded value or raise StopIteration. """ raise StopIteration
[ "def", "send", "(", "self", ",", "value", ")", ":", "raise", "StopIteration" ]
[ 118, 4 ]
[ 122, 27 ]
python
en
['en', 'it', 'en']
True
Coroutine.throw
(self, typ, val=None, tb=None)
Raise an exception in the coroutine. Return next yielded value or raise StopIteration.
Raise an exception in the coroutine. Return next yielded value or raise StopIteration.
def throw(self, typ, val=None, tb=None): """Raise an exception in the coroutine. Return next yielded value or raise StopIteration. """ if val is None: if tb is None: raise typ val = typ() if tb is not None: val = val.with_traceb...
[ "def", "throw", "(", "self", ",", "typ", ",", "val", "=", "None", ",", "tb", "=", "None", ")", ":", "if", "val", "is", "None", ":", "if", "tb", "is", "None", ":", "raise", "typ", "val", "=", "typ", "(", ")", "if", "tb", "is", "not", "None", ...
[ 125, 4 ]
[ 135, 17 ]
python
en
['en', 'en', 'en']
True
Coroutine.close
(self)
Raise GeneratorExit inside coroutine.
Raise GeneratorExit inside coroutine.
def close(self): """Raise GeneratorExit inside coroutine. """ try: self.throw(GeneratorExit) except (GeneratorExit, StopIteration): pass else: raise RuntimeError("coroutine ignored GeneratorExit")
[ "def", "close", "(", "self", ")", ":", "try", ":", "self", ".", "throw", "(", "GeneratorExit", ")", "except", "(", "GeneratorExit", ",", "StopIteration", ")", ":", "pass", "else", ":", "raise", "RuntimeError", "(", "\"coroutine ignored GeneratorExit\"", ")" ]
[ 137, 4 ]
[ 145, 65 ]
python
en
['fr', 'it', 'en']
False
AsyncIterator.__anext__
(self)
Return the next item or raise StopAsyncIteration when exhausted.
Return the next item or raise StopAsyncIteration when exhausted.
async def __anext__(self): """Return the next item or raise StopAsyncIteration when exhausted.""" raise StopAsyncIteration
[ "async", "def", "__anext__", "(", "self", ")", ":", "raise", "StopAsyncIteration" ]
[ 177, 4 ]
[ 179, 32 ]
python
en
['en', 'en', 'en']
True
AsyncGenerator.__anext__
(self)
Return the next item from the asynchronous generator. When exhausted, raise StopAsyncIteration.
Return the next item from the asynchronous generator. When exhausted, raise StopAsyncIteration.
async def __anext__(self): """Return the next item from the asynchronous generator. When exhausted, raise StopAsyncIteration. """ return await self.asend(None)
[ "async", "def", "__anext__", "(", "self", ")", ":", "return", "await", "self", ".", "asend", "(", "None", ")" ]
[ 195, 4 ]
[ 199, 37 ]
python
en
['en', 'en', 'en']
True
AsyncGenerator.asend
(self, value)
Send a value into the asynchronous generator. Return next yielded value or raise StopAsyncIteration.
Send a value into the asynchronous generator. Return next yielded value or raise StopAsyncIteration.
async def asend(self, value): """Send a value into the asynchronous generator. Return next yielded value or raise StopAsyncIteration. """ raise StopAsyncIteration
[ "async", "def", "asend", "(", "self", ",", "value", ")", ":", "raise", "StopAsyncIteration" ]
[ 202, 4 ]
[ 206, 32 ]
python
en
['en', 'en', 'en']
True
AsyncGenerator.athrow
(self, typ, val=None, tb=None)
Raise an exception in the asynchronous generator. Return next yielded value or raise StopAsyncIteration.
Raise an exception in the asynchronous generator. Return next yielded value or raise StopAsyncIteration.
async def athrow(self, typ, val=None, tb=None): """Raise an exception in the asynchronous generator. Return next yielded value or raise StopAsyncIteration. """ if val is None: if tb is None: raise typ val = typ() if tb is not None: ...
[ "async", "def", "athrow", "(", "self", ",", "typ", ",", "val", "=", "None", ",", "tb", "=", "None", ")", ":", "if", "val", "is", "None", ":", "if", "tb", "is", "None", ":", "raise", "typ", "val", "=", "typ", "(", ")", "if", "tb", "is", "not",...
[ 209, 4 ]
[ 219, 17 ]
python
en
['en', 'en', 'en']
True
AsyncGenerator.aclose
(self)
Raise GeneratorExit inside coroutine.
Raise GeneratorExit inside coroutine.
async def aclose(self): """Raise GeneratorExit inside coroutine. """ try: await self.athrow(GeneratorExit) except (GeneratorExit, StopAsyncIteration): pass else: raise RuntimeError("asynchronous generator ignored GeneratorExit")
[ "async", "def", "aclose", "(", "self", ")", ":", "try", ":", "await", "self", ".", "athrow", "(", "GeneratorExit", ")", "except", "(", "GeneratorExit", ",", "StopAsyncIteration", ")", ":", "pass", "else", ":", "raise", "RuntimeError", "(", "\"asynchronous ge...
[ 221, 4 ]
[ 229, 78 ]
python
en
['fr', 'it', 'en']
False
Iterator.__next__
(self)
Return the next item from the iterator. When exhausted, raise StopIteration
Return the next item from the iterator. When exhausted, raise StopIteration
def __next__(self): 'Return the next item from the iterator. When exhausted, raise StopIteration' raise StopIteration
[ "def", "__next__", "(", "self", ")", ":", "raise", "StopIteration" ]
[ 263, 4 ]
[ 265, 27 ]
python
en
['en', 'en', 'en']
True
Generator.__next__
(self)
Return the next item from the generator. When exhausted, raise StopIteration.
Return the next item from the generator. When exhausted, raise StopIteration.
def __next__(self): """Return the next item from the generator. When exhausted, raise StopIteration. """ return self.send(None)
[ "def", "__next__", "(", "self", ")", ":", "return", "self", ".", "send", "(", "None", ")" ]
[ 312, 4 ]
[ 316, 30 ]
python
en
['en', 'en', 'en']
True
Generator.send
(self, value)
Send a value into the generator. Return next yielded value or raise StopIteration.
Send a value into the generator. Return next yielded value or raise StopIteration.
def send(self, value): """Send a value into the generator. Return next yielded value or raise StopIteration. """ raise StopIteration
[ "def", "send", "(", "self", ",", "value", ")", ":", "raise", "StopIteration" ]
[ 319, 4 ]
[ 323, 27 ]
python
en
['en', 'it', 'en']
True
Generator.throw
(self, typ, val=None, tb=None)
Raise an exception in the generator. Return next yielded value or raise StopIteration.
Raise an exception in the generator. Return next yielded value or raise StopIteration.
def throw(self, typ, val=None, tb=None): """Raise an exception in the generator. Return next yielded value or raise StopIteration. """ if val is None: if tb is None: raise typ val = typ() if tb is not None: val = val.with_traceb...
[ "def", "throw", "(", "self", ",", "typ", ",", "val", "=", "None", ",", "tb", "=", "None", ")", ":", "if", "val", "is", "None", ":", "if", "tb", "is", "None", ":", "raise", "typ", "val", "=", "typ", "(", ")", "if", "tb", "is", "not", "None", ...
[ 326, 4 ]
[ 336, 17 ]
python
en
['en', 'en', 'en']
True
Generator.close
(self)
Raise GeneratorExit inside generator.
Raise GeneratorExit inside generator.
def close(self): """Raise GeneratorExit inside generator. """ try: self.throw(GeneratorExit) except (GeneratorExit, StopIteration): pass else: raise RuntimeError("generator ignored GeneratorExit")
[ "def", "close", "(", "self", ")", ":", "try", ":", "self", ".", "throw", "(", "GeneratorExit", ")", "except", "(", "GeneratorExit", ",", "StopIteration", ")", ":", "pass", "else", ":", "raise", "RuntimeError", "(", "\"generator ignored GeneratorExit\"", ")" ]
[ 338, 4 ]
[ 346, 65 ]
python
en
['fr', 'la', 'en']
False
Set._from_iterable
(cls, it)
Construct an instance of the class from any iterable input. Must override this method if the class constructor signature does not accept an iterable for an input.
Construct an instance of the class from any iterable input.
def _from_iterable(cls, it): '''Construct an instance of the class from any iterable input. Must override this method if the class constructor signature does not accept an iterable for an input. ''' return cls(it)
[ "def", "_from_iterable", "(", "cls", ",", "it", ")", ":", "return", "cls", "(", "it", ")" ]
[ 465, 4 ]
[ 471, 22 ]
python
en
['en', 'en', 'en']
True
Set.isdisjoint
(self, other)
Return True if two sets have a null intersection.
Return True if two sets have a null intersection.
def isdisjoint(self, other): 'Return True if two sets have a null intersection.' for value in other: if value in self: return False return True
[ "def", "isdisjoint", "(", "self", ",", "other", ")", ":", "for", "value", "in", "other", ":", "if", "value", "in", "self", ":", "return", "False", "return", "True" ]
[ 480, 4 ]
[ 485, 19 ]
python
en
['en', 'en', 'en']
True
Set._hash
(self)
Compute the hash value of a set. Note that we don't define __hash__: not all sets are hashable. But if you define a hashable set type, its __hash__ should call this function. This must be compatible __eq__. All sets ought to compare equal if they contain the same eleme...
Compute the hash value of a set.
def _hash(self): """Compute the hash value of a set. Note that we don't define __hash__: not all sets are hashable. But if you define a hashable set type, its __hash__ should call this function. This must be compatible __eq__. All sets ought to compare equal if they co...
[ "def", "_hash", "(", "self", ")", ":", "MAX", "=", "sys", ".", "maxsize", "MASK", "=", "2", "*", "MAX", "+", "1", "n", "=", "len", "(", "self", ")", "h", "=", "1927868237", "*", "(", "n", "+", "1", ")", "h", "&=", "MASK", "for", "x", "in", ...
[ 520, 4 ]
[ 550, 16 ]
python
en
['en', 'en', 'en']
True
MutableSet.add
(self, value)
Add an element.
Add an element.
def add(self, value): """Add an element.""" raise NotImplementedError
[ "def", "add", "(", "self", ",", "value", ")", ":", "raise", "NotImplementedError" ]
[ 570, 4 ]
[ 572, 33 ]
python
br
['br', 'lb', 'en']
False
MutableSet.discard
(self, value)
Remove an element. Do not raise an exception if absent.
Remove an element. Do not raise an exception if absent.
def discard(self, value): """Remove an element. Do not raise an exception if absent.""" raise NotImplementedError
[ "def", "discard", "(", "self", ",", "value", ")", ":", "raise", "NotImplementedError" ]
[ 575, 4 ]
[ 577, 33 ]
python
en
['en', 'en', 'en']
True
MutableSet.remove
(self, value)
Remove an element. If not a member, raise a KeyError.
Remove an element. If not a member, raise a KeyError.
def remove(self, value): """Remove an element. If not a member, raise a KeyError.""" if value not in self: raise KeyError(value) self.discard(value)
[ "def", "remove", "(", "self", ",", "value", ")", ":", "if", "value", "not", "in", "self", ":", "raise", "KeyError", "(", "value", ")", "self", ".", "discard", "(", "value", ")" ]
[ 579, 4 ]
[ 583, 27 ]
python
en
['en', 'lb', 'en']
True
MutableSet.pop
(self)
Return the popped value. Raise KeyError if empty.
Return the popped value. Raise KeyError if empty.
def pop(self): """Return the popped value. Raise KeyError if empty.""" it = iter(self) try: value = next(it) except StopIteration: raise KeyError self.discard(value) return value
[ "def", "pop", "(", "self", ")", ":", "it", "=", "iter", "(", "self", ")", "try", ":", "value", "=", "next", "(", "it", ")", "except", "StopIteration", ":", "raise", "KeyError", "self", ".", "discard", "(", "value", ")", "return", "value" ]
[ 585, 4 ]
[ 593, 20 ]
python
en
['en', 'ru-Latn', 'en']
True
MutableSet.clear
(self)
This is slow (creates N new iterators!) but effective.
This is slow (creates N new iterators!) but effective.
def clear(self): """This is slow (creates N new iterators!) but effective.""" try: while True: self.pop() except KeyError: pass
[ "def", "clear", "(", "self", ")", ":", "try", ":", "while", "True", ":", "self", ".", "pop", "(", ")", "except", "KeyError", ":", "pass" ]
[ 595, 4 ]
[ 601, 16 ]
python
en
['en', 'en', 'en']
True
Mapping.get
(self, key, default=None)
D.get(k[,d]) -> D[k] if k in D, else d. d defaults to None.
D.get(k[,d]) -> D[k] if k in D, else d. d defaults to None.
def get(self, key, default=None): 'D.get(k[,d]) -> D[k] if k in D, else d. d defaults to None.' try: return self[key] except KeyError: return default
[ "def", "get", "(", "self", ",", "key", ",", "default", "=", "None", ")", ":", "try", ":", "return", "self", "[", "key", "]", "except", "KeyError", ":", "return", "default" ]
[ 656, 4 ]
[ 661, 26 ]
python
en
['en', 'ja', 'sw']
False
Mapping.keys
(self)
D.keys() -> a set-like object providing a view on D's keys
D.keys() -> a set-like object providing a view on D's keys
def keys(self): "D.keys() -> a set-like object providing a view on D's keys" return KeysView(self)
[ "def", "keys", "(", "self", ")", ":", "return", "KeysView", "(", "self", ")" ]
[ 671, 4 ]
[ 673, 29 ]
python
en
['en', 'cs', 'en']
True
Mapping.items
(self)
D.items() -> a set-like object providing a view on D's items
D.items() -> a set-like object providing a view on D's items
def items(self): "D.items() -> a set-like object providing a view on D's items" return ItemsView(self)
[ "def", "items", "(", "self", ")", ":", "return", "ItemsView", "(", "self", ")" ]
[ 675, 4 ]
[ 677, 30 ]
python
en
['en', 'en', 'en']
True
Mapping.values
(self)
D.values() -> an object providing a view on D's values
D.values() -> an object providing a view on D's values
def values(self): "D.values() -> an object providing a view on D's values" return ValuesView(self)
[ "def", "values", "(", "self", ")", ":", "return", "ValuesView", "(", "self", ")" ]
[ 679, 4 ]
[ 681, 31 ]
python
en
['en', 'en', 'en']
True
MutableMapping.pop
(self, key, default=__marker)
D.pop(k[,d]) -> v, remove specified key and return the corresponding value. If key is not found, d is returned if given, otherwise KeyError is raised.
D.pop(k[,d]) -> v, remove specified key and return the corresponding value. If key is not found, d is returned if given, otherwise KeyError is raised.
def pop(self, key, default=__marker): '''D.pop(k[,d]) -> v, remove specified key and return the corresponding value. If key is not found, d is returned if given, otherwise KeyError is raised. ''' try: value = self[key] except KeyError: if default is self...
[ "def", "pop", "(", "self", ",", "key", ",", "default", "=", "__marker", ")", ":", "try", ":", "value", "=", "self", "[", "key", "]", "except", "KeyError", ":", "if", "default", "is", "self", ".", "__marker", ":", "raise", "return", "default", "else",...
[ 789, 4 ]
[ 801, 24 ]
python
en
['en', 'en', 'en']
True
MutableMapping.popitem
(self)
D.popitem() -> (k, v), remove and return some (key, value) pair as a 2-tuple; but raise KeyError if D is empty.
D.popitem() -> (k, v), remove and return some (key, value) pair as a 2-tuple; but raise KeyError if D is empty.
def popitem(self): '''D.popitem() -> (k, v), remove and return some (key, value) pair as a 2-tuple; but raise KeyError if D is empty. ''' try: key = next(iter(self)) except StopIteration: raise KeyError value = self[key] del self[key] ...
[ "def", "popitem", "(", "self", ")", ":", "try", ":", "key", "=", "next", "(", "iter", "(", "self", ")", ")", "except", "StopIteration", ":", "raise", "KeyError", "value", "=", "self", "[", "key", "]", "del", "self", "[", "key", "]", "return", "key"...
[ 803, 4 ]
[ 813, 25 ]
python
en
['en', 'no', 'en']
True
MutableMapping.clear
(self)
D.clear() -> None. Remove all items from D.
D.clear() -> None. Remove all items from D.
def clear(self): 'D.clear() -> None. Remove all items from D.' try: while True: self.popitem() except KeyError: pass
[ "def", "clear", "(", "self", ")", ":", "try", ":", "while", "True", ":", "self", ".", "popitem", "(", ")", "except", "KeyError", ":", "pass" ]
[ 815, 4 ]
[ 821, 16 ]
python
en
['en', 'en', 'en']
True
MutableMapping.update
(*args, **kwds)
D.update([E, ]**F) -> None. Update D from mapping/iterable E and F. If E present and has a .keys() method, does: for k in E: D[k] = E[k] If E present and lacks .keys() method, does: for (k, v) in E: D[k] = v In either case, this is followed by: for k, v in F.items(): D[k] =...
D.update([E, ]**F) -> None. Update D from mapping/iterable E and F. If E present and has a .keys() method, does: for k in E: D[k] = E[k] If E present and lacks .keys() method, does: for (k, v) in E: D[k] = v In either case, this is followed by: for k, v in F.items(): D[k] =...
def update(*args, **kwds): ''' D.update([E, ]**F) -> None. Update D from mapping/iterable E and F. If E present and has a .keys() method, does: for k in E: D[k] = E[k] If E present and lacks .keys() method, does: for (k, v) in E: D[k] = v In either case, this is foll...
[ "def", "update", "(", "*", "args", ",", "*", "*", "kwds", ")", ":", "if", "not", "args", ":", "raise", "TypeError", "(", "\"descriptor 'update' of 'MutableMapping' object \"", "\"needs an argument\"", ")", "self", ",", "", "*", "args", "=", "args", "if", "le...
[ 823, 4 ]
[ 848, 29 ]
python
en
['en', 'en', 'en']
True
MutableMapping.setdefault
(self, key, default=None)
D.setdefault(k[,d]) -> D.get(k,d), also set D[k]=d if k not in D
D.setdefault(k[,d]) -> D.get(k,d), also set D[k]=d if k not in D
def setdefault(self, key, default=None): 'D.setdefault(k[,d]) -> D.get(k,d), also set D[k]=d if k not in D' try: return self[key] except KeyError: self[key] = default return default
[ "def", "setdefault", "(", "self", ",", "key", ",", "default", "=", "None", ")", ":", "try", ":", "return", "self", "[", "key", "]", "except", "KeyError", ":", "self", "[", "key", "]", "=", "default", "return", "default" ]
[ 850, 4 ]
[ 856, 22 ]
python
en
['en', 'sl', 'en']
True
Sequence.index
(self, value, start=0, stop=None)
S.index(value, [start, [stop]]) -> integer -- return first index of value. Raises ValueError if the value is not present. Supporting start and stop arguments is optional, but recommended.
S.index(value, [start, [stop]]) -> integer -- return first index of value. Raises ValueError if the value is not present.
def index(self, value, start=0, stop=None): '''S.index(value, [start, [stop]]) -> integer -- return first index of value. Raises ValueError if the value is not present. Supporting start and stop arguments is optional, but recommended. ''' if start is not None an...
[ "def", "index", "(", "self", ",", "value", ",", "start", "=", "0", ",", "stop", "=", "None", ")", ":", "if", "start", "is", "not", "None", "and", "start", "<", "0", ":", "start", "=", "max", "(", "len", "(", "self", ")", "+", "start", ",", "0...
[ 898, 4 ]
[ 919, 24 ]
python
en
['en', 'da', 'en']
True
Sequence.count
(self, value)
S.count(value) -> integer -- return number of occurrences of value
S.count(value) -> integer -- return number of occurrences of value
def count(self, value): 'S.count(value) -> integer -- return number of occurrences of value' return sum(1 for v in self if v is value or v == value)
[ "def", "count", "(", "self", ",", "value", ")", ":", "return", "sum", "(", "1", "for", "v", "in", "self", "if", "v", "is", "value", "or", "v", "==", "value", ")" ]
[ 921, 4 ]
[ 923, 63 ]
python
en
['en', 'en', 'en']
True
MutableSequence.insert
(self, index, value)
S.insert(index, value) -- insert value before index
S.insert(index, value) -- insert value before index
def insert(self, index, value): 'S.insert(index, value) -- insert value before index' raise IndexError
[ "def", "insert", "(", "self", ",", "index", ",", "value", ")", ":", "raise", "IndexError" ]
[ 964, 4 ]
[ 966, 24 ]
python
en
['en', 'la', 'en']
True
MutableSequence.append
(self, value)
S.append(value) -- append value to the end of the sequence
S.append(value) -- append value to the end of the sequence
def append(self, value): 'S.append(value) -- append value to the end of the sequence' self.insert(len(self), value)
[ "def", "append", "(", "self", ",", "value", ")", ":", "self", ".", "insert", "(", "len", "(", "self", ")", ",", "value", ")" ]
[ 968, 4 ]
[ 970, 37 ]
python
en
['en', 'en', 'en']
True
MutableSequence.clear
(self)
S.clear() -> None -- remove all items from S
S.clear() -> None -- remove all items from S
def clear(self): 'S.clear() -> None -- remove all items from S' try: while True: self.pop() except IndexError: pass
[ "def", "clear", "(", "self", ")", ":", "try", ":", "while", "True", ":", "self", ".", "pop", "(", ")", "except", "IndexError", ":", "pass" ]
[ 972, 4 ]
[ 978, 16 ]
python
en
['en', 'en', 'en']
True
MutableSequence.reverse
(self)
S.reverse() -- reverse *IN PLACE*
S.reverse() -- reverse *IN PLACE*
def reverse(self): 'S.reverse() -- reverse *IN PLACE*' n = len(self) for i in range(n//2): self[i], self[n-i-1] = self[n-i-1], self[i]
[ "def", "reverse", "(", "self", ")", ":", "n", "=", "len", "(", "self", ")", "for", "i", "in", "range", "(", "n", "//", "2", ")", ":", "self", "[", "i", "]", ",", "self", "[", "n", "-", "i", "-", "1", "]", "=", "self", "[", "n", "-", "i"...
[ 980, 4 ]
[ 984, 55 ]
python
en
['en', 'en', 'it']
True
MutableSequence.extend
(self, values)
S.extend(iterable) -- extend sequence by appending elements from the iterable
S.extend(iterable) -- extend sequence by appending elements from the iterable
def extend(self, values): 'S.extend(iterable) -- extend sequence by appending elements from the iterable' for v in values: self.append(v)
[ "def", "extend", "(", "self", ",", "values", ")", ":", "for", "v", "in", "values", ":", "self", ".", "append", "(", "v", ")" ]
[ 986, 4 ]
[ 989, 26 ]
python
en
['en', 'en', 'en']
True
MutableSequence.pop
(self, index=-1)
S.pop([index]) -> item -- remove and return item at index (default last). Raise IndexError if list is empty or index is out of range.
S.pop([index]) -> item -- remove and return item at index (default last). Raise IndexError if list is empty or index is out of range.
def pop(self, index=-1): '''S.pop([index]) -> item -- remove and return item at index (default last). Raise IndexError if list is empty or index is out of range. ''' v = self[index] del self[index] return v
[ "def", "pop", "(", "self", ",", "index", "=", "-", "1", ")", ":", "v", "=", "self", "[", "index", "]", "del", "self", "[", "index", "]", "return", "v" ]
[ 991, 4 ]
[ 997, 16 ]
python
en
['en', 'la', 'en']
True
MutableSequence.remove
(self, value)
S.remove(value) -- remove first occurrence of value. Raise ValueError if the value is not present.
S.remove(value) -- remove first occurrence of value. Raise ValueError if the value is not present.
def remove(self, value): '''S.remove(value) -- remove first occurrence of value. Raise ValueError if the value is not present. ''' del self[self.index(value)]
[ "def", "remove", "(", "self", ",", "value", ")", ":", "del", "self", "[", "self", ".", "index", "(", "value", ")", "]" ]
[ 999, 4 ]
[ 1003, 35 ]
python
en
['en', 'en', 'en']
True
Subversion.get_revision
(cls, location)
Return the maximum revision for all files under a given location
Return the maximum revision for all files under a given location
def get_revision(cls, location): """ Return the maximum revision for all files under a given location """ # Note: taken from setuptools.command.egg_info revision = 0 for base, dirs, _ in os.walk(location): if cls.dirname not in dirs: dirs[:] =...
[ "def", "get_revision", "(", "cls", ",", "location", ")", ":", "# Note: taken from setuptools.command.egg_info", "revision", "=", "0", "for", "base", ",", "dirs", ",", "_", "in", "os", ".", "walk", "(", "location", ")", ":", "if", "cls", ".", "dirname", "no...
[ 51, 4 ]
[ 76, 23 ]
python
en
['en', 'error', 'th']
False
Subversion.get_netloc_and_auth
(cls, netloc, scheme)
This override allows the auth information to be passed to svn via the --username and --password options instead of via the URL.
This override allows the auth information to be passed to svn via the --username and --password options instead of via the URL.
def get_netloc_and_auth(cls, netloc, scheme): """ This override allows the auth information to be passed to svn via the --username and --password options instead of via the URL. """ if scheme == 'ssh': # The --username and --password options can't be used for ...
[ "def", "get_netloc_and_auth", "(", "cls", ",", "netloc", ",", "scheme", ")", ":", "if", "scheme", "==", "'ssh'", ":", "# The --username and --password options can't be used for", "# svn+ssh URLs, so keep the auth information in the URL.", "return", "super", "(", "Subversion",...
[ 79, 4 ]
[ 89, 45 ]
python
en
['en', 'error', 'th']
False
Subversion.is_commit_id_equal
(cls, dest, name)
Always assume the versions don't match
Always assume the versions don't match
def is_commit_id_equal(cls, dest, name): """Always assume the versions don't match""" return False
[ "def", "is_commit_id_equal", "(", "cls", ",", "dest", ",", "name", ")", ":", "return", "False" ]
[ 183, 4 ]
[ 185, 20 ]
python
en
['en', 'en', 'en']
True
Subversion.call_vcs_version
(self)
Query the version of the currently installed Subversion client. :return: A tuple containing the parts of the version information or ``()`` if the version returned from ``svn`` could not be parsed. :raises: BadCommand: If ``svn`` is not installed.
Query the version of the currently installed Subversion client.
def call_vcs_version(self): # type: () -> Tuple[int, ...] """Query the version of the currently installed Subversion client. :return: A tuple containing the parts of the version information or ``()`` if the version returned from ``svn`` could not be parsed. :raises: BadComma...
[ "def", "call_vcs_version", "(", "self", ")", ":", "# type: () -> Tuple[int, ...]", "# Example versions:", "# svn, version 1.10.3 (r1842928)", "# compiled Feb 25 2019, 14:20:39 on x86_64-apple-darwin17.0.0", "# svn, version 1.7.14 (r1542130)", "# compiled Mar 28 2018, 08:49:13 on ...
[ 202, 4 ]
[ 230, 29 ]
python
en
['en', 'en', 'en']
True
Subversion.get_vcs_version
(self)
Return the version of the currently installed Subversion client. If the version of the Subversion client has already been queried, a cached value will be used. :return: A tuple containing the parts of the version information or ``()`` if the version returned from ``svn`` could not ...
Return the version of the currently installed Subversion client.
def get_vcs_version(self): # type: () -> Tuple[int, ...] """Return the version of the currently installed Subversion client. If the version of the Subversion client has already been queried, a cached value will be used. :return: A tuple containing the parts of the version infor...
[ "def", "get_vcs_version", "(", "self", ")", ":", "# type: () -> Tuple[int, ...]", "if", "self", ".", "_vcs_version", "is", "not", "None", ":", "# Use cached version, if available.", "# If parsing the version failed previously (empty tuple),", "# do not attempt to parse it again.", ...
[ 232, 4 ]
[ 251, 26 ]
python
en
['en', 'en', 'en']
True
Subversion.get_remote_call_options
(self)
Return options to be used on calls to Subversion that contact the server. These options are applicable for the following ``svn`` subcommands used in this class. - checkout - export - switch - update :return: A list of command line arguments to p...
Return options to be used on calls to Subversion that contact the server.
def get_remote_call_options(self): # type: () -> CommandArgs """Return options to be used on calls to Subversion that contact the server. These options are applicable for the following ``svn`` subcommands used in this class. - checkout - export - swi...
[ "def", "get_remote_call_options", "(", "self", ")", ":", "# type: () -> CommandArgs", "if", "not", "self", ".", "use_interactive", ":", "# --non-interactive switch is available since Subversion 0.14.4.", "# Subversion < 1.8 runs in interactive mode by default.", "return", "[", "'--...
[ 253, 4 ]
[ 284, 17 ]
python
en
['en', 'en', 'en']
True
Subversion.export
(self, location, url)
Export the svn repository at the url to the destination location
Export the svn repository at the url to the destination location
def export(self, location, url): # type: (str, HiddenText) -> None """Export the svn repository at the url to the destination location""" url, rev_options = self.get_url_rev_options(url) logger.info('Exporting svn repository %s to %s', url, location) with indent_log(): ...
[ "def", "export", "(", "self", ",", "location", ",", "url", ")", ":", "# type: (str, HiddenText) -> None", "url", ",", "rev_options", "=", "self", ".", "get_url_rev_options", "(", "url", ")", "logger", ".", "info", "(", "'Exporting svn repository %s to %s'", ",", ...
[ 286, 4 ]
[ 301, 38 ]
python
en
['en', 'en', 'en']
True
test_show_fixtures_and_execute_test
(testdir)
Verifies that setups are shown and tests are executed.
Verifies that setups are shown and tests are executed.
def test_show_fixtures_and_execute_test(testdir): """ Verifies that setups are shown and tests are executed. """ p = testdir.makepyfile(''' import pytest @pytest.fixture def arg(): assert True def test_arg(arg): assert False ''') result = testdir....
[ "def", "test_show_fixtures_and_execute_test", "(", "testdir", ")", ":", "p", "=", "testdir", ".", "makepyfile", "(", "'''\n import pytest\n @pytest.fixture\n def arg():\n assert True\n def test_arg(arg):\n assert False\n '''", ")", "re...
[ 224, 0 ]
[ 242, 6 ]
python
en
['en', 'en', 'en']
True
SincConv.forward
(self, waveforms)
Parameters ---------- waveforms : `torch.Tensor` (batch_size, 1, n_samples) Batch of waveforms. Returns ------- features : `torch.Tensor` (batch_size, out_channels, n_samples_out) Batch of sinc filters activations.
Parameters ---------- waveforms : `torch.Tensor` (batch_size, 1, n_samples) Batch of waveforms. Returns ------- features : `torch.Tensor` (batch_size, out_channels, n_samples_out) Batch of sinc filters activations.
def forward(self, waveforms): """ Parameters ---------- waveforms : `torch.Tensor` (batch_size, 1, n_samples) Batch of waveforms. Returns ------- features : `torch.Tensor` (batch_size, out_channels, n_samples_out) Batch of sinc filters acti...
[ "def", "forward", "(", "self", ",", "waveforms", ")", ":", "self", ".", "n_", "=", "self", ".", "n_", ".", "to", "(", "waveforms", ".", "device", ")", "self", ".", "window_", "=", "self", ".", "window_", ".", "to", "(", "waveforms", ".", "device", ...
[ 114, 4 ]
[ 164, 9 ]
python
en
['en', 'error', 'th']
False
SincNet.__init__
( self, # number of samples, the default is 200ms worth of samples at 16kHz input_dim=3200, # sampling frequency fs=16000, # number of filters for each layer num_filters=[80, 60, 60], # size of filter for each layer filter_sizes=[251, 5, 5], ...
conv -> max pool -> [layer_norm | batch_norm] -> activation -> drop
conv -> max pool -> [layer_norm | batch_norm] -> activation -> drop
def __init__( self, # number of samples, the default is 200ms worth of samples at 16kHz input_dim=3200, # sampling frequency fs=16000, # number of filters for each layer num_filters=[80, 60, 60], # size of filter for each layer filter_sizes=[251...
[ "def", "__init__", "(", "self", ",", "# number of samples, the default is 200ms worth of samples at 16kHz", "input_dim", "=", "3200", ",", "# sampling frequency", "fs", "=", "16000", ",", "# number of filters for each layer", "num_filters", "=", "[", "80", ",", "60", ",",...
[ 311, 4 ]
[ 424, 47 ]
python
en
['en', 'error', 'th']
False
RequirementSet.__init__
(self, check_supported_wheels=True)
Create a RequirementSet.
Create a RequirementSet.
def __init__(self, check_supported_wheels=True): # type: (bool) -> None """Create a RequirementSet. """ self.requirements = OrderedDict() # type: Dict[str, InstallRequirement] # noqa: E501 self.check_supported_wheels = check_supported_wheels self.unnamed_requirements ...
[ "def", "__init__", "(", "self", ",", "check_supported_wheels", "=", "True", ")", ":", "# type: (bool) -> None", "self", ".", "requirements", "=", "OrderedDict", "(", ")", "# type: Dict[str, InstallRequirement] # noqa: E501", "self", ".", "check_supported_wheels", "=", ...
[ 22, 4 ]
[ 30, 38 ]
python
en
['en', 'en', 'en']
True
RequirementSet.add_requirement
( self, install_req, # type: InstallRequirement parent_req_name=None, # type: Optional[str] extras_requested=None # type: Optional[Iterable[str]] )
Add install_req as a requirement to install. :param parent_req_name: The name of the requirement that needed this added. The name is used because when multiple unnamed requirements resolve to the same name, we could otherwise end up with dependency links that point outside t...
Add install_req as a requirement to install.
def add_requirement( self, install_req, # type: InstallRequirement parent_req_name=None, # type: Optional[str] extras_requested=None # type: Optional[Iterable[str]] ): # type: (...) -> Tuple[List[InstallRequirement], Optional[InstallRequirement]] # noqa: E501 """A...
[ "def", "add_requirement", "(", "self", ",", "install_req", ",", "# type: InstallRequirement", "parent_req_name", "=", "None", ",", "# type: Optional[str]", "extras_requested", "=", "None", "# type: Optional[Iterable[str]]", ")", ":", "# type: (...) -> Tuple[List[InstallRequirem...
[ 66, 4 ]
[ 179, 43 ]
python
en
['en', 'en', 'en']
True
main
()
Script entry point.
Script entry point.
def main(): """Script entry point.""" cfg = parse_args(evaluation=True) status, avg_reward = enjoy(cfg) return status
[ "def", "main", "(", ")", ":", "cfg", "=", "parse_args", "(", "evaluation", "=", "True", ")", "status", ",", "avg_reward", "=", "enjoy", "(", "cfg", ")", "return", "status" ]
[ 163, 0 ]
[ 167, 17 ]
python
en
['en', 'en', 'en']
True
generate_django_secretkey
()
Secret key generation taken from Django's startproject.py
Secret key generation taken from Django's startproject.py
def generate_django_secretkey() -> str: """Secret key generation taken from Django's startproject.py""" # We do in-function imports so that we only do the expensive work # of importing cryptography modules when necessary. # # This helps optimize noop provision performance. from django.utils.cry...
[ "def", "generate_django_secretkey", "(", ")", "->", "str", ":", "# We do in-function imports so that we only do the expensive work", "# of importing cryptography modules when necessary.", "#", "# This helps optimize noop provision performance.", "from", "django", ".", "utils", ".", "...
[ 48, 0 ]
[ 58, 39 ]
python
en
['en', 'fy', 'en']
True
get_old_and_new_values
(change_type: str, message: Mapping[str, Any])
Parses the payload and finds previous and current value of change_type.
Parses the payload and finds previous and current value of change_type.
def get_old_and_new_values(change_type: str, message: Mapping[str, Any]) -> return_type: """Parses the payload and finds previous and current value of change_type.""" old = message["change"]["diff"][change_type].get("from") new = message["change"]["diff"][change_type].get("to") return old, new
[ "def", "get_old_and_new_values", "(", "change_type", ":", "str", ",", "message", ":", "Mapping", "[", "str", ",", "Any", "]", ")", "->", "return_type", ":", "old", "=", "message", "[", "\"change\"", "]", "[", "\"diff\"", "]", "[", "change_type", "]", "."...
[ 158, 0 ]
[ 162, 19 ]
python
en
['en', 'en', 'en']
True
parse_comment
(message: Mapping[str, Any])
Parses the comment to issue, task or US.
Parses the comment to issue, task or US.
def parse_comment(message: Mapping[str, Any]) -> Dict[str, Any]: """Parses the comment to issue, task or US.""" return { "event": "commented", "type": message["type"], "values": { "user": get_owner_name(message), "user_link": get_owner_link(message), "...
[ "def", "parse_comment", "(", "message", ":", "Mapping", "[", "str", ",", "Any", "]", ")", "->", "Dict", "[", "str", ",", "Any", "]", ":", "return", "{", "\"event\"", ":", "\"commented\"", ",", "\"type\"", ":", "message", "[", "\"type\"", "]", ",", "\...
[ 165, 0 ]
[ 175, 5 ]
python
en
['en', 'en', 'en']
True
parse_create_or_delete
(message: Mapping[str, Any])
Parses create or delete event.
Parses create or delete event.
def parse_create_or_delete(message: Mapping[str, Any]) -> Dict[str, Any]: """Parses create or delete event.""" if message["type"] == "relateduserstory": return { "type": message["type"], "event": message["action"], "values": { "user": get_owner_name(me...
[ "def", "parse_create_or_delete", "(", "message", ":", "Mapping", "[", "str", ",", "Any", "]", ")", "->", "Dict", "[", "str", ",", "Any", "]", ":", "if", "message", "[", "\"type\"", "]", "==", "\"relateduserstory\"", ":", "return", "{", "\"type\"", ":", ...
[ 178, 0 ]
[ 200, 5 ]
python
en
['es', 'la', 'en']
False
parse_change_event
(change_type: str, message: Mapping[str, Any])
Parses change event.
Parses change event.
def parse_change_event(change_type: str, message: Mapping[str, Any]) -> Optional[Dict[str, Any]]: """Parses change event.""" evt: Dict[str, Any] = {} values: Dict[str, Any] = { "user": get_owner_name(message), "user_link": get_owner_link(message), "subject": get_subject(message), ...
[ "def", "parse_change_event", "(", "change_type", ":", "str", ",", "message", ":", "Mapping", "[", "str", ",", "Any", "]", ")", "->", "Optional", "[", "Dict", "[", "str", ",", "Any", "]", "]", ":", "evt", ":", "Dict", "[", "str", ",", "Any", "]", ...
[ 203, 0 ]
[ 271, 14 ]
python
en
['es', 'fr', 'en']
False
parse_message
(message: Mapping[str, Any])
Parses the payload by delegating to specialized functions.
Parses the payload by delegating to specialized functions.
def parse_message(message: Mapping[str, Any]) -> List[Dict[str, Any]]: """Parses the payload by delegating to specialized functions.""" events = [] if message["action"] in ["create", "delete"]: events.append(parse_create_or_delete(message)) elif message["action"] == "change": if message[...
[ "def", "parse_message", "(", "message", ":", "Mapping", "[", "str", ",", "Any", "]", ")", "->", "List", "[", "Dict", "[", "str", ",", "Any", "]", "]", ":", "events", "=", "[", "]", "if", "message", "[", "\"action\"", "]", "in", "[", "\"create\"", ...
[ 286, 0 ]
[ 302, 17 ]
python
en
['en', 'en', 'en']
True
generate_content
(data: Mapping[str, Any])
Gets the template string and formats it with parsed data.
Gets the template string and formats it with parsed data.
def generate_content(data: Mapping[str, Any]) -> str: """Gets the template string and formats it with parsed data.""" template = templates[data["type"]][data["event"]] content = template.format(**data["values"]) return content
[ "def", "generate_content", "(", "data", ":", "Mapping", "[", "str", ",", "Any", "]", ")", "->", "str", ":", "template", "=", "templates", "[", "data", "[", "\"type\"", "]", "]", "[", "data", "[", "\"event\"", "]", "]", "content", "=", "template", "."...
[ 305, 0 ]
[ 309, 18 ]
python
en
['en', 'en', 'en']
True
check.initialize_options
(self)
Sets default values for options.
Sets default values for options.
def initialize_options(self): """Sets default values for options.""" self.restructuredtext = 0 self.metadata = 1 self.strict = 0 self._warnings = 0
[ "def", "initialize_options", "(", "self", ")", ":", "self", ".", "restructuredtext", "=", "0", "self", ".", "metadata", "=", "1", "self", ".", "strict", "=", "0", "self", ".", "_warnings", "=", "0" ]
[ 47, 4 ]
[ 52, 26 ]
python
fr
['fr', 'fr', 'en']
True
check.warn
(self, msg)
Counts the number of warnings that occurs.
Counts the number of warnings that occurs.
def warn(self, msg): """Counts the number of warnings that occurs.""" self._warnings += 1 return Command.warn(self, msg)
[ "def", "warn", "(", "self", ",", "msg", ")", ":", "self", ".", "_warnings", "+=", "1", "return", "Command", ".", "warn", "(", "self", ",", "msg", ")" ]
[ 57, 4 ]
[ 60, 38 ]
python
en
['en', 'en', 'en']
True
check.run
(self)
Runs the command.
Runs the command.
def run(self): """Runs the command.""" # perform the various tests if self.metadata: self.check_metadata() if self.restructuredtext: if HAS_DOCUTILS: self.check_restructuredtext() elif self.strict: raise DistutilsSetupEr...
[ "def", "run", "(", "self", ")", ":", "# perform the various tests", "if", "self", ".", "metadata", ":", "self", ".", "check_metadata", "(", ")", "if", "self", ".", "restructuredtext", ":", "if", "HAS_DOCUTILS", ":", "self", ".", "check_restructuredtext", "(", ...
[ 62, 4 ]
[ 76, 69 ]
python
en
['en', 'it', 'en']
True
check.check_metadata
(self)
Ensures that all required elements of meta-data are supplied. Required fields: name, version, URL Recommended fields: (author and author_email) or (maintainer and maintainer_email)) Warns if any are missing.
Ensures that all required elements of meta-data are supplied.
def check_metadata(self): """Ensures that all required elements of meta-data are supplied. Required fields: name, version, URL Recommended fields: (author and author_email) or (maintainer and maintainer_email)) Warns if any are missing. """ meta...
[ "def", "check_metadata", "(", "self", ")", ":", "metadata", "=", "self", ".", "distribution", ".", "metadata", "missing", "=", "[", "]", "for", "attr", "in", "(", "'name'", ",", "'version'", ",", "'url'", ")", ":", "if", "not", "(", "hasattr", "(", "...
[ 78, 4 ]
[ 109, 43 ]
python
en
['en', 'en', 'en']
True
check.check_restructuredtext
(self)
Checks if the long string fields are reST-compliant.
Checks if the long string fields are reST-compliant.
def check_restructuredtext(self): """Checks if the long string fields are reST-compliant.""" data = self.distribution.get_long_description() for warning in self._check_rst_data(data): line = warning[-1].get('line') if line is None: warning = warning[1] ...
[ "def", "check_restructuredtext", "(", "self", ")", ":", "data", "=", "self", ".", "distribution", ".", "get_long_description", "(", ")", "for", "warning", "in", "self", ".", "_check_rst_data", "(", "data", ")", ":", "line", "=", "warning", "[", "-", "1", ...
[ 111, 4 ]
[ 120, 30 ]
python
en
['en', 'en', 'en']
True
check._check_rst_data
(self, data)
Returns warnings when the provided data doesn't compile.
Returns warnings when the provided data doesn't compile.
def _check_rst_data(self, data): """Returns warnings when the provided data doesn't compile.""" # the include and csv_table directives need this to be a path source_path = self.distribution.script_name or 'setup.py' parser = Parser() settings = frontend.OptionParser(components=(P...
[ "def", "_check_rst_data", "(", "self", ",", "data", ")", ":", "# the include and csv_table directives need this to be a path", "source_path", "=", "self", ".", "distribution", ".", "script_name", "or", "'setup.py'", "parser", "=", "Parser", "(", ")", "settings", "=", ...
[ 122, 4 ]
[ 147, 32 ]
python
en
['en', 'en', 'en']
True
user_data_dir
(appname=None, appauthor=None, version=None, roaming=False)
r"""Return full path to the user-specific data dir for this application. "appname" is the name of application. If None, just the system directory is returned. "appauthor" (only used on Windows) is the name of the appauthor or distributing body for this application. Typically ...
r"""Return full path to the user-specific data dir for this application.
def user_data_dir(appname=None, appauthor=None, version=None, roaming=False): r"""Return full path to the user-specific data dir for this application. "appname" is the name of application. If None, just the system directory is returned. "appauthor" (only used on Windows) is the name of ...
[ "def", "user_data_dir", "(", "appname", "=", "None", ",", "appauthor", "=", "None", ",", "version", "=", "None", ",", "roaming", "=", "False", ")", ":", "if", "system", "==", "\"win32\"", ":", "if", "appauthor", "is", "None", ":", "appauthor", "=", "ap...
[ 44, 0 ]
[ 96, 15 ]
python
en
['en', 'en', 'en']
True
site_data_dir
(appname=None, appauthor=None, version=None, multipath=False)
r"""Return full path to the user-shared data dir for this application. "appname" is the name of application. If None, just the system directory is returned. "appauthor" (only used on Windows) is the name of the appauthor or distributing body for this application. Typically ...
r"""Return full path to the user-shared data dir for this application.
def site_data_dir(appname=None, appauthor=None, version=None, multipath=False): r"""Return full path to the user-shared data dir for this application. "appname" is the name of application. If None, just the system directory is returned. "appauthor" (only used on Windows) is the name of ...
[ "def", "site_data_dir", "(", "appname", "=", "None", ",", "appauthor", "=", "None", ",", "version", "=", "None", ",", "multipath", "=", "False", ")", ":", "if", "system", "==", "\"win32\"", ":", "if", "appauthor", "is", "None", ":", "appauthor", "=", "...
[ 99, 0 ]
[ 162, 15 ]
python
en
['en', 'en', 'en']
True
user_config_dir
(appname=None, appauthor=None, version=None, roaming=False)
r"""Return full path to the user-specific config dir for this application. "appname" is the name of application. If None, just the system directory is returned. "appauthor" (only used on Windows) is the name of the appauthor or distributing body for this application. Typically ...
r"""Return full path to the user-specific config dir for this application.
def user_config_dir(appname=None, appauthor=None, version=None, roaming=False): r"""Return full path to the user-specific config dir for this application. "appname" is the name of application. If None, just the system directory is returned. "appauthor" (only used on Windows) is the name...
[ "def", "user_config_dir", "(", "appname", "=", "None", ",", "appauthor", "=", "None", ",", "version", "=", "None", ",", "roaming", "=", "False", ")", ":", "if", "system", "in", "[", "\"win32\"", ",", "\"darwin\"", "]", ":", "path", "=", "user_data_dir", ...
[ 165, 0 ]
[ 202, 15 ]
python
en
['en', 'en', 'en']
True
site_config_dir
(appname=None, appauthor=None, version=None, multipath=False)
r"""Return full path to the user-shared data dir for this application. "appname" is the name of application. If None, just the system directory is returned. "appauthor" (only used on Windows) is the name of the appauthor or distributing body for this application. Typically ...
r"""Return full path to the user-shared data dir for this application.
def site_config_dir(appname=None, appauthor=None, version=None, multipath=False): r"""Return full path to the user-shared data dir for this application. "appname" is the name of application. If None, just the system directory is returned. "appauthor" (only used on Windows) is the name o...
[ "def", "site_config_dir", "(", "appname", "=", "None", ",", "appauthor", "=", "None", ",", "version", "=", "None", ",", "multipath", "=", "False", ")", ":", "if", "system", "in", "[", "\"win32\"", ",", "\"darwin\"", "]", ":", "path", "=", "site_data_dir"...
[ 205, 0 ]
[ 253, 15 ]
python
en
['en', 'en', 'en']
True
user_cache_dir
(appname=None, appauthor=None, version=None, opinion=True)
r"""Return full path to the user-specific cache dir for this application. "appname" is the name of application. If None, just the system directory is returned. "appauthor" (only used on Windows) is the name of the appauthor or distributing body for this application. Typically ...
r"""Return full path to the user-specific cache dir for this application.
def user_cache_dir(appname=None, appauthor=None, version=None, opinion=True): r"""Return full path to the user-specific cache dir for this application. "appname" is the name of application. If None, just the system directory is returned. "appauthor" (only used on Windows) is the name of...
[ "def", "user_cache_dir", "(", "appname", "=", "None", ",", "appauthor", "=", "None", ",", "version", "=", "None", ",", "opinion", "=", "True", ")", ":", "if", "system", "==", "\"win32\"", ":", "if", "appauthor", "is", "None", ":", "appauthor", "=", "ap...
[ 256, 0 ]
[ 310, 15 ]
python
en
['en', 'en', 'en']
True
user_state_dir
(appname=None, appauthor=None, version=None, roaming=False)
r"""Return full path to the user-specific state dir for this application. "appname" is the name of application. If None, just the system directory is returned. "appauthor" (only used on Windows) is the name of the appauthor or distributing body for this application. Typically ...
r"""Return full path to the user-specific state dir for this application.
def user_state_dir(appname=None, appauthor=None, version=None, roaming=False): r"""Return full path to the user-specific state dir for this application. "appname" is the name of application. If None, just the system directory is returned. "appauthor" (only used on Windows) is the name o...
[ "def", "user_state_dir", "(", "appname", "=", "None", ",", "appauthor", "=", "None", ",", "version", "=", "None", ",", "roaming", "=", "False", ")", ":", "if", "system", "in", "[", "\"win32\"", ",", "\"darwin\"", "]", ":", "path", "=", "user_data_dir", ...
[ 313, 0 ]
[ 352, 15 ]
python
en
['en', 'en', 'en']
True
user_log_dir
(appname=None, appauthor=None, version=None, opinion=True)
r"""Return full path to the user-specific log dir for this application. "appname" is the name of application. If None, just the system directory is returned. "appauthor" (only used on Windows) is the name of the appauthor or distributing body for this application. Typically ...
r"""Return full path to the user-specific log dir for this application.
def user_log_dir(appname=None, appauthor=None, version=None, opinion=True): r"""Return full path to the user-specific log dir for this application. "appname" is the name of application. If None, just the system directory is returned. "appauthor" (only used on Windows) is the name of the...
[ "def", "user_log_dir", "(", "appname", "=", "None", ",", "appauthor", "=", "None", ",", "version", "=", "None", ",", "opinion", "=", "True", ")", ":", "if", "system", "==", "\"darwin\"", ":", "path", "=", "os", ".", "path", ".", "join", "(", "os", ...
[ 355, 0 ]
[ 403, 15 ]
python
en
['en', 'en', 'en']
True
_get_win_folder_from_registry
(csidl_name)
This is a fallback technique at best. I'm not sure if using the registry for this guarantees us the correct answer for all CSIDL_* names.
This is a fallback technique at best. I'm not sure if using the registry for this guarantees us the correct answer for all CSIDL_* names.
def _get_win_folder_from_registry(csidl_name): """This is a fallback technique at best. I'm not sure if using the registry for this guarantees us the correct answer for all CSIDL_* names. """ if PY3: import winreg as _winreg else: import _winreg shell_folder_name = { "CS...
[ "def", "_get_win_folder_from_registry", "(", "csidl_name", ")", ":", "if", "PY3", ":", "import", "winreg", "as", "_winreg", "else", ":", "import", "_winreg", "shell_folder_name", "=", "{", "\"CSIDL_APPDATA\"", ":", "\"AppData\"", ",", "\"CSIDL_COMMON_APPDATA\"", ":"...
[ 454, 0 ]
[ 475, 14 ]
python
en
['en', 'en', 'en']
True
MissedMessageNotificationsTest.test_stream_watchers
(self)
We used to have a bug with stream_watchers, where we set their flags to None.
We used to have a bug with stream_watchers, where we set their flags to None.
def test_stream_watchers(self) -> None: """ We used to have a bug with stream_watchers, where we set their flags to None. """ cordelia = self.example_user("cordelia") hamlet = self.example_user("hamlet") realm = hamlet.realm stream_name = "Denmark" ...
[ "def", "test_stream_watchers", "(", "self", ")", "->", "None", ":", "cordelia", "=", "self", ".", "example_user", "(", "\"cordelia\"", ")", "hamlet", "=", "self", ".", "example_user", "(", "\"hamlet\"", ")", "realm", "=", "hamlet", ".", "realm", "stream_name...
[ 293, 4 ]
[ 330, 9 ]
python
en
['en', 'error', 'th']
False
MissedMessageNotificationsTest.test_end_to_end_missedmessage_hook
(self)
Tests what arguments missedmessage_hook passes into maybe_enqueue_notifications. Combined with the previous test, this ensures that the missedmessage_hook is correct
Tests what arguments missedmessage_hook passes into maybe_enqueue_notifications. Combined with the previous test, this ensures that the missedmessage_hook is correct
def test_end_to_end_missedmessage_hook(self) -> None: """Tests what arguments missedmessage_hook passes into maybe_enqueue_notifications. Combined with the previous test, this ensures that the missedmessage_hook is correct""" user_profile = self.example_user("hamlet") user_profile.enabl...
[ "def", "test_end_to_end_missedmessage_hook", "(", "self", ")", "->", "None", ":", "user_profile", "=", "self", ".", "example_user", "(", "\"hamlet\"", ")", "user_profile", ".", "enable_online_push_notifications", "=", "False", "user_profile", ".", "save", "(", ")", ...
[ 332, 4 ]
[ 774, 9 ]
python
en
['en', 'en', 'en']
True
EventQueueTest.test_event_collapsing
(self)
The update_message_flags events are special, because they can be collapsed together. Given two umfe's, we: * use the latest timestamp * concatenate the messages
The update_message_flags events are special, because they can be collapsed together. Given two umfe's, we: * use the latest timestamp * concatenate the messages
def test_event_collapsing(self) -> None: client = self.get_client_descriptor() queue = client.event_queue """ The update_message_flags events are special, because they can be collapsed together. Given two umfe's, we: * use the latest timestamp * concaten...
[ "def", "test_event_collapsing", "(", "self", ")", "->", "None", ":", "client", "=", "self", ".", "get_client_descriptor", "(", ")", "queue", "=", "client", ".", "event_queue", "def", "umfe", "(", "timestamp", ":", "int", ",", "messages", ":", "List", "[", ...
[ 888, 4 ]
[ 974, 9 ]
python
en
['en', 'error', 'th']
False
EventQueueTest.test_collapse_event
(self)
This mostly focues on the internals of how we store "virtual_events" that we can collapse if subsequent events are of the same form. See the code in EventQueue.push for more context.
This mostly focues on the internals of how we store "virtual_events" that we can collapse if subsequent events are of the same form. See the code in EventQueue.push for more context.
def test_collapse_event(self) -> None: """ This mostly focues on the internals of how we store "virtual_events" that we can collapse if subsequent events are of the same form. See the code in EventQueue.push for more context. """ client = self.get_client_...
[ "def", "test_collapse_event", "(", "self", ")", "->", "None", ":", "client", "=", "self", ".", "get_client_descriptor", "(", ")", "queue", "=", "client", ".", "event_queue", "queue", ".", "push", "(", "{", "\"type\"", ":", "\"restart\"", ",", "\"server_gener...
[ 1058, 4 ]
[ 1100, 46 ]
python
en
['en', 'error', 'th']
False
get_topological_weights
(graph)
Assign weights to each node based on how "deep" they are. This implementation may change at any point in the future without prior notice. We take the length for the longest path to any node from root, ignoring any paths that contain a single node twice (i.e. cycles). This is done through a depth-f...
Assign weights to each node based on how "deep" they are.
def get_topological_weights(graph): # type: (Graph) -> Dict[Optional[str], int] """Assign weights to each node based on how "deep" they are. This implementation may change at any point in the future without prior notice. We take the length for the longest path to any node from root, ignoring any ...
[ "def", "get_topological_weights", "(", "graph", ")", ":", "# type: (Graph) -> Dict[Optional[str], int]", "path", "=", "set", "(", ")", "# type: Set[Optional[str]]", "weights", "=", "{", "}", "# type: Dict[Optional[str], int]", "def", "visit", "(", "node", ")", ":", "#...
[ 200, 0 ]
[ 243, 18 ]
python
en
['en', 'en', 'en']
True
_req_set_item_sorter
( item, # type: Tuple[str, InstallRequirement] weights, # type: Dict[Optional[str], int] )
Key function used to sort install requirements for installation. Based on the "weight" mapping calculated in ``get_installation_order()``. The canonical package name is returned as the second member as a tie- breaker to ensure the result is predictable, which is useful in tests.
Key function used to sort install requirements for installation.
def _req_set_item_sorter( item, # type: Tuple[str, InstallRequirement] weights, # type: Dict[Optional[str], int] ): # type: (...) -> Tuple[int, str] """Key function used to sort install requirements for installation. Based on the "weight" mapping calculated in ``get_installation_order()``. ...
[ "def", "_req_set_item_sorter", "(", "item", ",", "# type: Tuple[str, InstallRequirement]", "weights", ",", "# type: Dict[Optional[str], int]", ")", ":", "# type: (...) -> Tuple[int, str]", "name", "=", "canonicalize_name", "(", "item", "[", "0", "]", ")", "return", "weigh...
[ 246, 0 ]
[ 258, 30 ]
python
en
['en', 'en', 'en']
True
Resolver.get_installation_order
(self, req_set)
Get order for installation of requirements in RequirementSet. The returned list contains a requirement before another that depends on it. This helps ensure that the environment is kept consistent as they get installed one-by-one. The current implementation creates a topological orderin...
Get order for installation of requirements in RequirementSet.
def get_installation_order(self, req_set): # type: (RequirementSet) -> List[InstallRequirement] """Get order for installation of requirements in RequirementSet. The returned list contains a requirement before another that depends on it. This helps ensure that the environment is kept con...
[ "def", "get_installation_order", "(", "self", ",", "req_set", ")", ":", "# type: (RequirementSet) -> List[InstallRequirement]", "assert", "self", ".", "_result", "is", "not", "None", ",", "\"must call resolve() first\"", "graph", "=", "self", ".", "_result", ".", "gra...
[ 174, 4 ]
[ 197, 49 ]
python
en
['en', 'en', 'en']
True
dump_file
(filename, head=None)
Dumps a file content into log.info. If head is not None, will be dumped before the file content.
Dumps a file content into log.info.
def dump_file(filename, head=None): """Dumps a file content into log.info. If head is not None, will be dumped before the file content. """ if head is None: log.info('%s', filename) else: log.info(head) file = open(filename) try: log.info(file.read()) finally: ...
[ "def", "dump_file", "(", "filename", ",", "head", "=", "None", ")", ":", "if", "head", "is", "None", ":", "log", ".", "info", "(", "'%s'", ",", "filename", ")", "else", ":", "log", ".", "info", "(", "head", ")", "file", "=", "open", "(", "filenam...
[ 330, 0 ]
[ 343, 20 ]
python
en
['en', 'fr', 'en']
True
config._check_compiler
(self)
Check that 'self.compiler' really is a CCompiler object; if not, make it one.
Check that 'self.compiler' really is a CCompiler object; if not, make it one.
def _check_compiler(self): """Check that 'self.compiler' really is a CCompiler object; if not, make it one. """ # We do this late, and only on-demand, because this is an expensive # import. from distutils.ccompiler import CCompiler, new_compiler if not isinstance(...
[ "def", "_check_compiler", "(", "self", ")", ":", "# We do this late, and only on-demand, because this is an expensive", "# import.", "from", "distutils", ".", "ccompiler", "import", "CCompiler", ",", "new_compiler", "if", "not", "isinstance", "(", "self", ".", "compiler",...
[ 88, 4 ]
[ 104, 65 ]
python
en
['en', 'en', 'en']
True
config.try_cpp
(self, body=None, headers=None, include_dirs=None, lang="c")
Construct a source file from 'body' (a string containing lines of C/C++ code) and 'headers' (a list of header files to include) and run it through the preprocessor. Return true if the preprocessor succeeded, false if there were any errors. ('body' probably isn't of much use, but what th...
Construct a source file from 'body' (a string containing lines of C/C++ code) and 'headers' (a list of header files to include) and run it through the preprocessor. Return true if the preprocessor succeeded, false if there were any errors. ('body' probably isn't of much use, but what th...
def try_cpp(self, body=None, headers=None, include_dirs=None, lang="c"): """Construct a source file from 'body' (a string containing lines of C/C++ code) and 'headers' (a list of header files to include) and run it through the preprocessor. Return true if the preprocessor succeeded, fal...
[ "def", "try_cpp", "(", "self", ",", "body", "=", "None", ",", "headers", "=", "None", ",", "include_dirs", "=", "None", ",", "lang", "=", "\"c\"", ")", ":", "from", "distutils", ".", "ccompiler", "import", "CompileError", "self", ".", "_check_compiler", ...
[ 171, 4 ]
[ 187, 17 ]
python
en
['en', 'en', 'en']
True
config.search_cpp
(self, pattern, body=None, headers=None, include_dirs=None, lang="c")
Construct a source file (just like 'try_cpp()'), run it through the preprocessor, and return true if any line of the output matches 'pattern'. 'pattern' should either be a compiled regex object or a string containing a regex. If both 'body' and 'headers' are None, preprocesses an empty...
Construct a source file (just like 'try_cpp()'), run it through the preprocessor, and return true if any line of the output matches 'pattern'. 'pattern' should either be a compiled regex object or a string containing a regex. If both 'body' and 'headers' are None, preprocesses an empty...
def search_cpp(self, pattern, body=None, headers=None, include_dirs=None, lang="c"): """Construct a source file (just like 'try_cpp()'), run it through the preprocessor, and return true if any line of the output matches 'pattern'. 'pattern' should either be a compiled regex o...
[ "def", "search_cpp", "(", "self", ",", "pattern", ",", "body", "=", "None", ",", "headers", "=", "None", ",", "include_dirs", "=", "None", ",", "lang", "=", "\"c\"", ")", ":", "self", ".", "_check_compiler", "(", ")", "src", ",", "out", "=", "self", ...
[ 189, 4 ]
[ 215, 20 ]
python
en
['en', 'en', 'en']
True
config.try_compile
(self, body, headers=None, include_dirs=None, lang="c")
Try to compile a source file built from 'body' and 'headers'. Return true on success, false otherwise.
Try to compile a source file built from 'body' and 'headers'. Return true on success, false otherwise.
def try_compile(self, body, headers=None, include_dirs=None, lang="c"): """Try to compile a source file built from 'body' and 'headers'. Return true on success, false otherwise. """ from distutils.ccompiler import CompileError self._check_compiler() try: self....
[ "def", "try_compile", "(", "self", ",", "body", ",", "headers", "=", "None", ",", "include_dirs", "=", "None", ",", "lang", "=", "\"c\"", ")", ":", "from", "distutils", ".", "ccompiler", "import", "CompileError", "self", ".", "_check_compiler", "(", ")", ...
[ 217, 4 ]
[ 231, 17 ]
python
en
['en', 'en', 'en']
True
config.try_link
(self, body, headers=None, include_dirs=None, libraries=None, library_dirs=None, lang="c")
Try to compile and link a source file, built from 'body' and 'headers', to executable form. Return true on success, false otherwise.
Try to compile and link a source file, built from 'body' and 'headers', to executable form. Return true on success, false otherwise.
def try_link(self, body, headers=None, include_dirs=None, libraries=None, library_dirs=None, lang="c"): """Try to compile and link a source file, built from 'body' and 'headers', to executable form. Return true on success, false otherwise. """ from distutils.cco...
[ "def", "try_link", "(", "self", ",", "body", ",", "headers", "=", "None", ",", "include_dirs", "=", "None", ",", "libraries", "=", "None", ",", "library_dirs", "=", "None", ",", "lang", "=", "\"c\"", ")", ":", "from", "distutils", ".", "ccompiler", "im...
[ 233, 4 ]
[ 250, 17 ]
python
en
['en', 'en', 'en']
True
config.try_run
(self, body, headers=None, include_dirs=None, libraries=None, library_dirs=None, lang="c")
Try to compile, link to an executable, and run a program built from 'body' and 'headers'. Return true on success, false otherwise.
Try to compile, link to an executable, and run a program built from 'body' and 'headers'. Return true on success, false otherwise.
def try_run(self, body, headers=None, include_dirs=None, libraries=None, library_dirs=None, lang="c"): """Try to compile, link to an executable, and run a program built from 'body' and 'headers'. Return true on success, false otherwise. """ from distutils.ccompil...
[ "def", "try_run", "(", "self", ",", "body", ",", "headers", "=", "None", ",", "include_dirs", "=", "None", ",", "libraries", "=", "None", ",", "library_dirs", "=", "None", ",", "lang", "=", "\"c\"", ")", ":", "from", "distutils", ".", "ccompiler", "imp...
[ 252, 4 ]
[ 270, 17 ]
python
en
['en', 'en', 'en']
True
config.check_func
(self, func, headers=None, include_dirs=None, libraries=None, library_dirs=None, decl=0, call=0)
Determine if function 'func' is available by constructing a source file that refers to 'func', and compiles and links it. If everything succeeds, returns true; otherwise returns false. The constructed source file starts out by including the header files listed in 'headers'. If 'decl' i...
Determine if function 'func' is available by constructing a source file that refers to 'func', and compiles and links it. If everything succeeds, returns true; otherwise returns false.
def check_func(self, func, headers=None, include_dirs=None, libraries=None, library_dirs=None, decl=0, call=0): """Determine if function 'func' is available by constructing a source file that refers to 'func', and compiles and links it. If everything succeeds, returns true; ot...
[ "def", "check_func", "(", "self", ",", "func", ",", "headers", "=", "None", ",", "include_dirs", "=", "None", ",", "libraries", "=", "None", ",", "library_dirs", "=", "None", ",", "decl", "=", "0", ",", "call", "=", "0", ")", ":", "self", ".", "_ch...
[ 277, 4 ]
[ 305, 53 ]
python
en
['en', 'en', 'en']
True
config.check_lib
(self, library, library_dirs=None, headers=None, include_dirs=None, other_libraries=[])
Determine if 'library' is available to be linked against, without actually checking that any particular symbols are provided by it. 'headers' will be used in constructing the source file to be compiled, but the only effect of this is to check if all the header files listed are available...
Determine if 'library' is available to be linked against, without actually checking that any particular symbols are provided by it. 'headers' will be used in constructing the source file to be compiled, but the only effect of this is to check if all the header files listed are available...
def check_lib(self, library, library_dirs=None, headers=None, include_dirs=None, other_libraries=[]): """Determine if 'library' is available to be linked against, without actually checking that any particular symbols are provided by it. 'headers' will be used in constructing t...
[ "def", "check_lib", "(", "self", ",", "library", ",", "library_dirs", "=", "None", ",", "headers", "=", "None", ",", "include_dirs", "=", "None", ",", "other_libraries", "=", "[", "]", ")", ":", "self", ".", "_check_compiler", "(", ")", "return", "self",...
[ 307, 4 ]
[ 319, 71 ]
python
en
['en', 'en', 'en']
True
config.check_header
(self, header, include_dirs=None, library_dirs=None, lang="c")
Determine if the system header file named by 'header_file' exists and can be found by the preprocessor; return true if so, false otherwise.
Determine if the system header file named by 'header_file' exists and can be found by the preprocessor; return true if so, false otherwise.
def check_header(self, header, include_dirs=None, library_dirs=None, lang="c"): """Determine if the system header file named by 'header_file' exists and can be found by the preprocessor; return true if so, false otherwise. """ return self.try_cpp(body="/* No ...
[ "def", "check_header", "(", "self", ",", "header", ",", "include_dirs", "=", "None", ",", "library_dirs", "=", "None", ",", "lang", "=", "\"c\"", ")", ":", "return", "self", ".", "try_cpp", "(", "body", "=", "\"/* No body */\"", ",", "headers", "=", "[",...
[ 321, 4 ]
[ 328, 54 ]
python
en
['en', 'en', 'en']
True
Filter.__init__
(self, source, encoding)
Creates a Filter :arg source: the source token stream :arg encoding: the encoding to set
Creates a Filter
def __init__(self, source, encoding): """Creates a Filter :arg source: the source token stream :arg encoding: the encoding to set """ base.Filter.__init__(self, source) self.encoding = encoding
[ "def", "__init__", "(", "self", ",", "source", ",", "encoding", ")", ":", "base", ".", "Filter", ".", "__init__", "(", "self", ",", "source", ")", "self", ".", "encoding", "=", "encoding" ]
[ 7, 4 ]
[ 16, 32 ]
python
en
['en', 'gl', 'en']
True
patch_path
(path)
Add path to front of sys.path for the duration of the context.
Add path to front of sys.path for the duration of the context.
def patch_path(path): """ Add path to front of sys.path for the duration of the context. """ try: sys.path.insert(0, path) yield finally: sys.path.remove(path)
[ "def", "patch_path", "(", "path", ")", ":", "try", ":", "sys", ".", "path", ".", "insert", "(", "0", ",", "path", ")", "yield", "finally", ":", "sys", ".", "path", ".", "remove", "(", "path", ")" ]
[ 46, 0 ]
[ 54, 29 ]
python
en
['en', 'error', 'th']
False
read_configuration
( filepath, find_others=False, ignore_option_errors=False)
Read given configuration file and returns options from it as a dict. :param str|unicode filepath: Path to configuration file to get options from. :param bool find_others: Whether to search for other configuration files which could be on in various places. :param bool ignore_option_errors:...
Read given configuration file and returns options from it as a dict.
def read_configuration( filepath, find_others=False, ignore_option_errors=False): """Read given configuration file and returns options from it as a dict. :param str|unicode filepath: Path to configuration file to get options from. :param bool find_others: Whether to search for other config...
[ "def", "read_configuration", "(", "filepath", ",", "find_others", "=", "False", ",", "ignore_option_errors", "=", "False", ")", ":", "from", "setuptools", ".", "dist", "import", "Distribution", ",", "_Distribution", "filepath", "=", "os", ".", "path", ".", "ab...
[ 57, 0 ]
[ 101, 42 ]
python
en
['en', 'en', 'en']
True
_get_option
(target_obj, key)
Given a target object and option key, get that option from the target object, either through a get_{key} method or from an attribute directly.
Given a target object and option key, get that option from the target object, either through a get_{key} method or from an attribute directly.
def _get_option(target_obj, key): """ Given a target object and option key, get that option from the target object, either through a get_{key} method or from an attribute directly. """ getter_name = 'get_{key}'.format(**locals()) by_attribute = functools.partial(getattr, target_obj, key) ...
[ "def", "_get_option", "(", "target_obj", ",", "key", ")", ":", "getter_name", "=", "'get_{key}'", ".", "format", "(", "*", "*", "locals", "(", ")", ")", "by_attribute", "=", "functools", ".", "partial", "(", "getattr", ",", "target_obj", ",", "key", ")",...
[ 104, 0 ]
[ 113, 19 ]
python
en
['en', 'error', 'th']
False
configuration_to_dict
(handlers)
Returns configuration data gathered by given handlers as a dict. :param list[ConfigHandler] handlers: Handlers list, usually from parse_configuration() :rtype: dict
Returns configuration data gathered by given handlers as a dict.
def configuration_to_dict(handlers): """Returns configuration data gathered by given handlers as a dict. :param list[ConfigHandler] handlers: Handlers list, usually from parse_configuration() :rtype: dict """ config_dict = defaultdict(dict) for handler in handlers: for option ...
[ "def", "configuration_to_dict", "(", "handlers", ")", ":", "config_dict", "=", "defaultdict", "(", "dict", ")", "for", "handler", "in", "handlers", ":", "for", "option", "in", "handler", ".", "set_options", ":", "value", "=", "_get_option", "(", "handler", "...
[ 116, 0 ]
[ 131, 22 ]
python
en
['en', 'en', 'en']
True
parse_configuration
( distribution, command_options, ignore_option_errors=False)
Performs additional parsing of configuration options for a distribution. Returns a list of used option handlers. :param Distribution distribution: :param dict command_options: :param bool ignore_option_errors: Whether to silently ignore options, values of which could not be resolved (e.g. ...
Performs additional parsing of configuration options for a distribution.
def parse_configuration( distribution, command_options, ignore_option_errors=False): """Performs additional parsing of configuration options for a distribution. Returns a list of used option handlers. :param Distribution distribution: :param dict command_options: :param bool ignore_opt...
[ "def", "parse_configuration", "(", "distribution", ",", "command_options", ",", "ignore_option_errors", "=", "False", ")", ":", "options", "=", "ConfigOptionsHandler", "(", "distribution", ",", "command_options", ",", "ignore_option_errors", ")", "options", ".", "pars...
[ 134, 0 ]
[ 158, 24 ]
python
en
['en', 'en', 'en']
True
ConfigHandler.parsers
(self)
Metadata item name to parser function mapping.
Metadata item name to parser function mapping.
def parsers(self): """Metadata item name to parser function mapping.""" raise NotImplementedError( '%s must provide .parsers property' % self.__class__.__name__)
[ "def", "parsers", "(", "self", ")", ":", "raise", "NotImplementedError", "(", "'%s must provide .parsers property'", "%", "self", ".", "__class__", ".", "__name__", ")" ]
[ 194, 4 ]
[ 197, 74 ]
python
en
['en', 'jv', 'en']
True