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
first
(value)
Returns the first item in a list.
Returns the first item in a list.
def first(value): """Returns the first item in a list.""" try: return value[0] except IndexError: return ''
[ "def", "first", "(", "value", ")", ":", "try", ":", "return", "value", "[", "0", "]", "except", "IndexError", ":", "return", "''" ]
[ 569, 0 ]
[ 574, 17 ]
python
en
['en', 'en', 'en']
True
join
(value, arg, autoescape=True)
Joins a list with a string, like Python's ``str.join(list)``.
Joins a list with a string, like Python's ``str.join(list)``.
def join(value, arg, autoescape=True): """ Joins a list with a string, like Python's ``str.join(list)``. """ value = map(force_text, value) if autoescape: value = [conditional_escape(v) for v in value] try: data = conditional_escape(arg).join(value) except AttributeError: # ...
[ "def", "join", "(", "value", ",", "arg", ",", "autoescape", "=", "True", ")", ":", "value", "=", "map", "(", "force_text", ",", "value", ")", "if", "autoescape", ":", "value", "=", "[", "conditional_escape", "(", "v", ")", "for", "v", "in", "value", ...
[ 578, 0 ]
[ 589, 26 ]
python
en
['en', 'error', 'th']
False
last
(value)
Returns the last item in a list
Returns the last item in a list
def last(value): "Returns the last item in a list" try: return value[-1] except IndexError: return ''
[ "def", "last", "(", "value", ")", ":", "try", ":", "return", "value", "[", "-", "1", "]", "except", "IndexError", ":", "return", "''" ]
[ 593, 0 ]
[ 598, 17 ]
python
en
['en', 'en', 'en']
True
length
(value)
Returns the length of the value - useful for lists.
Returns the length of the value - useful for lists.
def length(value): """Returns the length of the value - useful for lists.""" try: return len(value) except (ValueError, TypeError): return 0
[ "def", "length", "(", "value", ")", ":", "try", ":", "return", "len", "(", "value", ")", "except", "(", "ValueError", ",", "TypeError", ")", ":", "return", "0" ]
[ 602, 0 ]
[ 607, 16 ]
python
en
['en', 'en', 'en']
True
length_is
(value, arg)
Returns a boolean of whether the value's length is the argument.
Returns a boolean of whether the value's length is the argument.
def length_is(value, arg): """Returns a boolean of whether the value's length is the argument.""" try: return len(value) == int(arg) except (ValueError, TypeError): return ''
[ "def", "length_is", "(", "value", ",", "arg", ")", ":", "try", ":", "return", "len", "(", "value", ")", "==", "int", "(", "arg", ")", "except", "(", "ValueError", ",", "TypeError", ")", ":", "return", "''" ]
[ 611, 0 ]
[ 616, 17 ]
python
en
['en', 'en', 'en']
True
random
(value)
Returns a random item from the list.
Returns a random item from the list.
def random(value): """Returns a random item from the list.""" return random_module.choice(value)
[ "def", "random", "(", "value", ")", ":", "return", "random_module", ".", "choice", "(", "value", ")" ]
[ 620, 0 ]
[ 622, 38 ]
python
en
['en', 'en', 'en']
True
slice_filter
(value, arg)
Returns a slice of the list. Uses the same syntax as Python's list slicing; see http://www.diveintopython3.net/native-datatypes.html#slicinglists for an introduction.
Returns a slice of the list.
def slice_filter(value, arg): """ Returns a slice of the list. Uses the same syntax as Python's list slicing; see http://www.diveintopython3.net/native-datatypes.html#slicinglists for an introduction. """ try: bits = [] for x in arg.split(':'): if len(x) == 0: ...
[ "def", "slice_filter", "(", "value", ",", "arg", ")", ":", "try", ":", "bits", "=", "[", "]", "for", "x", "in", "arg", ".", "split", "(", "':'", ")", ":", "if", "len", "(", "x", ")", "==", "0", ":", "bits", ".", "append", "(", "None", ")", ...
[ 626, 0 ]
[ 644, 20 ]
python
en
['en', 'error', 'th']
False
unordered_list
(value, autoescape=True)
Recursively takes a self-nested list and returns an HTML unordered list -- WITHOUT opening and closing <ul> tags. The list is assumed to be in the proper format. For example, if ``var`` contains: ``['States', ['Kansas', ['Lawrence', 'Topeka'], 'Illinois']]``, then ``{{ var|unordered_list }}`` woul...
Recursively takes a self-nested list and returns an HTML unordered list -- WITHOUT opening and closing <ul> tags.
def unordered_list(value, autoescape=True): """ Recursively takes a self-nested list and returns an HTML unordered list -- WITHOUT opening and closing <ul> tags. The list is assumed to be in the proper format. For example, if ``var`` contains: ``['States', ['Kansas', ['Lawrence', 'Topeka'], 'Illino...
[ "def", "unordered_list", "(", "value", ",", "autoescape", "=", "True", ")", ":", "if", "autoescape", ":", "escaper", "=", "conditional_escape", "else", ":", "def", "escaper", "(", "x", ")", ":", "return", "x", "def", "walk_items", "(", "item_list", ")", ...
[ 648, 0 ]
[ 711, 43 ]
python
en
['en', 'error', 'th']
False
add
(value, arg)
Adds the arg to the value.
Adds the arg to the value.
def add(value, arg): """Adds the arg to the value.""" try: return int(value) + int(arg) except (ValueError, TypeError): try: return value + arg except Exception: return ''
[ "def", "add", "(", "value", ",", "arg", ")", ":", "try", ":", "return", "int", "(", "value", ")", "+", "int", "(", "arg", ")", "except", "(", "ValueError", ",", "TypeError", ")", ":", "try", ":", "return", "value", "+", "arg", "except", "Exception"...
[ 719, 0 ]
[ 727, 21 ]
python
en
['en', 'en', 'en']
True
get_digit
(value, arg)
Given a whole number, returns the requested digit of it, where 1 is the right-most digit, 2 is the second-right-most digit, etc. Returns the original value for invalid input (if input or argument is not an integer, or if argument is less than 1). Otherwise, output is always an integer.
Given a whole number, returns the requested digit of it, where 1 is the right-most digit, 2 is the second-right-most digit, etc. Returns the original value for invalid input (if input or argument is not an integer, or if argument is less than 1). Otherwise, output is always an integer.
def get_digit(value, arg): """ Given a whole number, returns the requested digit of it, where 1 is the right-most digit, 2 is the second-right-most digit, etc. Returns the original value for invalid input (if input or argument is not an integer, or if argument is less than 1). Otherwise, output is a...
[ "def", "get_digit", "(", "value", ",", "arg", ")", ":", "try", ":", "arg", "=", "int", "(", "arg", ")", "value", "=", "int", "(", "value", ")", "except", "ValueError", ":", "return", "value", "# Fail silently for an invalid argument", "if", "arg", "<", "...
[ 731, 0 ]
[ 748, 16 ]
python
en
['en', 'error', 'th']
False
date
(value, arg=None)
Formats a date according to the given format.
Formats a date according to the given format.
def date(value, arg=None): """Formats a date according to the given format.""" if value in (None, ''): return '' try: return formats.date_format(value, arg) except AttributeError: try: return format(value, arg) except AttributeError: return ''
[ "def", "date", "(", "value", ",", "arg", "=", "None", ")", ":", "if", "value", "in", "(", "None", ",", "''", ")", ":", "return", "''", "try", ":", "return", "formats", ".", "date_format", "(", "value", ",", "arg", ")", "except", "AttributeError", "...
[ 756, 0 ]
[ 766, 21 ]
python
en
['en', 'en', 'en']
True
time
(value, arg=None)
Formats a time according to the given format.
Formats a time according to the given format.
def time(value, arg=None): """Formats a time according to the given format.""" if value in (None, ''): return '' try: return formats.time_format(value, arg) except (AttributeError, TypeError): try: return time_format(value, arg) except (AttributeError, TypeErr...
[ "def", "time", "(", "value", ",", "arg", "=", "None", ")", ":", "if", "value", "in", "(", "None", ",", "''", ")", ":", "return", "''", "try", ":", "return", "formats", ".", "time_format", "(", "value", ",", "arg", ")", "except", "(", "AttributeErro...
[ 770, 0 ]
[ 780, 21 ]
python
en
['en', 'en', 'en']
True
timesince_filter
(value, arg=None)
Formats a date as the time since that date (i.e. "4 days, 6 hours").
Formats a date as the time since that date (i.e. "4 days, 6 hours").
def timesince_filter(value, arg=None): """Formats a date as the time since that date (i.e. "4 days, 6 hours").""" if not value: return '' try: if arg: return timesince(value, arg) return timesince(value) except (ValueError, TypeError): return ''
[ "def", "timesince_filter", "(", "value", ",", "arg", "=", "None", ")", ":", "if", "not", "value", ":", "return", "''", "try", ":", "if", "arg", ":", "return", "timesince", "(", "value", ",", "arg", ")", "return", "timesince", "(", "value", ")", "exce...
[ 784, 0 ]
[ 793, 17 ]
python
en
['en', 'en', 'en']
True
timeuntil_filter
(value, arg=None)
Formats a date as the time until that date (i.e. "4 days, 6 hours").
Formats a date as the time until that date (i.e. "4 days, 6 hours").
def timeuntil_filter(value, arg=None): """Formats a date as the time until that date (i.e. "4 days, 6 hours").""" if not value: return '' try: return timeuntil(value, arg) except (ValueError, TypeError): return ''
[ "def", "timeuntil_filter", "(", "value", ",", "arg", "=", "None", ")", ":", "if", "not", "value", ":", "return", "''", "try", ":", "return", "timeuntil", "(", "value", ",", "arg", ")", "except", "(", "ValueError", ",", "TypeError", ")", ":", "return", ...
[ 797, 0 ]
[ 804, 17 ]
python
en
['en', 'en', 'en']
True
default
(value, arg)
If value is unavailable, use given default.
If value is unavailable, use given default.
def default(value, arg): """If value is unavailable, use given default.""" return value or arg
[ "def", "default", "(", "value", ",", "arg", ")", ":", "return", "value", "or", "arg" ]
[ 812, 0 ]
[ 814, 23 ]
python
en
['en', 'en', 'en']
True
default_if_none
(value, arg)
If value is None, use given default.
If value is None, use given default.
def default_if_none(value, arg): """If value is None, use given default.""" if value is None: return arg return value
[ "def", "default_if_none", "(", "value", ",", "arg", ")", ":", "if", "value", "is", "None", ":", "return", "arg", "return", "value" ]
[ 818, 0 ]
[ 822, 16 ]
python
en
['en', 'en', 'en']
True
divisibleby
(value, arg)
Returns True if the value is divisible by the argument.
Returns True if the value is divisible by the argument.
def divisibleby(value, arg): """Returns True if the value is divisible by the argument.""" return int(value) % int(arg) == 0
[ "def", "divisibleby", "(", "value", ",", "arg", ")", ":", "return", "int", "(", "value", ")", "%", "int", "(", "arg", ")", "==", "0" ]
[ 826, 0 ]
[ 828, 37 ]
python
en
['en', 'en', 'en']
True
yesno
(value, arg=None)
Given a string mapping values for true, false and (optionally) None, returns one of those strings according to the value: ========== ====================== ================================== Value Argument Outputs ========== ====================== =========================...
Given a string mapping values for true, false and (optionally) None, returns one of those strings according to the value:
def yesno(value, arg=None): """ Given a string mapping values for true, false and (optionally) None, returns one of those strings according to the value: ========== ====================== ================================== Value Argument Outputs ========== ==============...
[ "def", "yesno", "(", "value", ",", "arg", "=", "None", ")", ":", "if", "arg", "is", "None", ":", "arg", "=", "ugettext", "(", "'yes,no,maybe'", ")", "bits", "=", "arg", ".", "split", "(", "','", ")", "if", "len", "(", "bits", ")", "<", "2", ":"...
[ 832, 0 ]
[ 861, 13 ]
python
en
['en', 'error', 'th']
False
filesizeformat
(bytes_)
Formats the value like a 'human-readable' file size (i.e. 13 KB, 4.1 MB, 102 bytes, etc.).
Formats the value like a 'human-readable' file size (i.e. 13 KB, 4.1 MB, 102 bytes, etc.).
def filesizeformat(bytes_): """ Formats the value like a 'human-readable' file size (i.e. 13 KB, 4.1 MB, 102 bytes, etc.). """ try: bytes_ = float(bytes_) except (TypeError, ValueError, UnicodeDecodeError): value = ungettext("%(size)d byte", "%(size)d bytes", 0) % {'size': 0} ...
[ "def", "filesizeformat", "(", "bytes_", ")", ":", "try", ":", "bytes_", "=", "float", "(", "bytes_", ")", "except", "(", "TypeError", ",", "ValueError", ",", "UnicodeDecodeError", ")", ":", "value", "=", "ungettext", "(", "\"%(size)d byte\"", ",", "\"%(size)...
[ 869, 0 ]
[ 908, 32 ]
python
en
['en', 'error', 'th']
False
pluralize
(value, arg='s')
Returns a plural suffix if the value is not 1. By default, 's' is used as the suffix: * If value is 0, vote{{ value|pluralize }} displays "0 votes". * If value is 1, vote{{ value|pluralize }} displays "1 vote". * If value is 2, vote{{ value|pluralize }} displays "2 votes". If an argument is p...
Returns a plural suffix if the value is not 1. By default, 's' is used as the suffix:
def pluralize(value, arg='s'): """ Returns a plural suffix if the value is not 1. By default, 's' is used as the suffix: * If value is 0, vote{{ value|pluralize }} displays "0 votes". * If value is 1, vote{{ value|pluralize }} displays "1 vote". * If value is 2, vote{{ value|pluralize }} displa...
[ "def", "pluralize", "(", "value", ",", "arg", "=", "'s'", ")", ":", "if", "','", "not", "in", "arg", ":", "arg", "=", "','", "+", "arg", "bits", "=", "arg", ".", "split", "(", "','", ")", "if", "len", "(", "bits", ")", ">", "2", ":", "return"...
[ 912, 0 ]
[ 953, 26 ]
python
en
['en', 'error', 'th']
False
phone2numeric_filter
(value)
Takes a phone number and converts it in to its numerical equivalent.
Takes a phone number and converts it in to its numerical equivalent.
def phone2numeric_filter(value): """Takes a phone number and converts it in to its numerical equivalent.""" return phone2numeric(value)
[ "def", "phone2numeric_filter", "(", "value", ")", ":", "return", "phone2numeric", "(", "value", ")" ]
[ 957, 0 ]
[ 959, 31 ]
python
en
['en', 'en', 'en']
True
pprint
(value)
A wrapper around pprint.pprint -- for debugging, really.
A wrapper around pprint.pprint -- for debugging, really.
def pprint(value): """A wrapper around pprint.pprint -- for debugging, really.""" try: return pformat(value) except Exception as e: return "Error in formatting: %s: %s" % (e.__class__.__name__, force_text(e, errors="replace"))
[ "def", "pprint", "(", "value", ")", ":", "try", ":", "return", "pformat", "(", "value", ")", "except", "Exception", "as", "e", ":", "return", "\"Error in formatting: %s: %s\"", "%", "(", "e", ".", "__class__", ".", "__name__", ",", "force_text", "(", "e", ...
[ 963, 0 ]
[ 968, 102 ]
python
en
['en', 'en', 'en']
True
Keyboard.down
(self, key: str, options: dict = None, **kwargs: Any )
Dispatch a ``keydown`` event with ``key``. If ``key`` is a single character and no modifier keys besides ``Shift`` are being held down, and a ``keypress``/``input`` event will also generated. The ``text`` option can be specified to force an ``input`` event to be generated. If `...
Dispatch a ``keydown`` event with ``key``.
async def down(self, key: str, options: dict = None, **kwargs: Any ) -> None: """Dispatch a ``keydown`` event with ``key``. If ``key`` is a single character and no modifier keys besides ``Shift`` are being held down, and a ``keypress``/``input`` event will also genera...
[ "async", "def", "down", "(", "self", ",", "key", ":", "str", ",", "options", ":", "dict", "=", "None", ",", "*", "*", "kwargs", ":", "Any", ")", "->", "None", ":", "options", "=", "merge_dict", "(", "options", ",", "kwargs", ")", "description", "="...
[ 57, 4 ]
[ 100, 10 ]
python
en
['en', 'en', 'en']
True
Keyboard.up
(self, key: str)
Dispatch a ``keyup`` event of the ``key``. :arg str key: Name of key to release, such as ``ArrowLeft``.
Dispatch a ``keyup`` event of the ``key``.
async def up(self, key: str) -> None: """Dispatch a ``keyup`` event of the ``key``. :arg str key: Name of key to release, such as ``ArrowLeft``. """ description = self._keyDescriptionForString(key) self._modifiers &= ~self._modifierBit(description['key']) if description...
[ "async", "def", "up", "(", "self", ",", "key", ":", "str", ")", "->", "None", ":", "description", "=", "self", ".", "_keyDescriptionForString", "(", "key", ")", "self", ".", "_modifiers", "&=", "~", "self", ".", "_modifierBit", "(", "description", "[", ...
[ 156, 4 ]
[ 173, 10 ]
python
en
['en', 'en', 'en']
True
Keyboard.sendCharacter
(self, char: str)
Send character into the page. This method dispatches a ``keypress`` and ``input`` event. This does not send a ``keydown`` or ``keyup`` event. .. note:: Modifier keys DO NOT effect :meth:`sendCharacter`. Holding down ``shift`` will not type the text in upper case. ...
Send character into the page.
async def sendCharacter(self, char: str) -> None: """Send character into the page. This method dispatches a ``keypress`` and ``input`` event. This does not send a ``keydown`` or ``keyup`` event. .. note:: Modifier keys DO NOT effect :meth:`sendCharacter`. Holding down ...
[ "async", "def", "sendCharacter", "(", "self", ",", "char", ":", "str", ")", "->", "None", ":", "await", "self", ".", "_client", ".", "send", "(", "'Input.insertText'", ",", "{", "'text'", ":", "char", "}", ")" ]
[ 175, 4 ]
[ 185, 67 ]
python
en
['en', 'en', 'en']
True
Keyboard.type
(self, text: str, options: Dict = None, **kwargs: Any )
Type characters into a focused element. This method sends ``keydown``, ``keypress``/``input``, and ``keyup`` event for each character in the ``text``. To press a special key, like ``Control`` or ``ArrowDown``, use :meth:`press` method. :arg str text: Text to type into a focuse...
Type characters into a focused element.
async def type(self, text: str, options: Dict = None, **kwargs: Any ) -> None: """Type characters into a focused element. This method sends ``keydown``, ``keypress``/``input``, and ``keyup`` event for each character in the ``text``. To press a special key, like ``Con...
[ "async", "def", "type", "(", "self", ",", "text", ":", "str", ",", "options", ":", "Dict", "=", "None", ",", "*", "*", "kwargs", ":", "Any", ")", "->", "None", ":", "options", "=", "merge_dict", "(", "options", ",", "kwargs", ")", "delay", "=", "...
[ 187, 4 ]
[ 214, 49 ]
python
en
['en', 'en', 'en']
True
Keyboard.press
(self, key: str, options: Dict = None, **kwargs: Any )
Press ``key``. If ``key`` is a single character and no modifier keys besides ``Shift`` are being held down, a ``keypress``/``input`` event will also generated. The ``text`` option can be specified to force an input event to be generated. :arg str key: Name of key to press, such...
Press ``key``.
async def press(self, key: str, options: Dict = None, **kwargs: Any ) -> None: """Press ``key``. If ``key`` is a single character and no modifier keys besides ``Shift`` are being held down, a ``keypress``/``input`` event will also generated. The ``text`` option can b...
[ "async", "def", "press", "(", "self", ",", "key", ":", "str", ",", "options", ":", "Dict", "=", "None", ",", "*", "*", "kwargs", ":", "Any", ")", "->", "None", ":", "options", "=", "merge_dict", "(", "options", ",", "kwargs", ")", "await", "self", ...
[ 216, 4 ]
[ 243, 26 ]
python
en
['en', 'uk', 'en']
False
Mouse.move
(self, x: float, y: float, options: dict = None, **kwargs: Any)
Move mouse cursor (dispatches a ``mousemove`` event). Options can accepts ``steps`` (int) field. If this ``steps`` option specified, Sends intermediate ``mousemove`` events. Defaults to 1.
Move mouse cursor (dispatches a ``mousemove`` event).
async def move(self, x: float, y: float, options: dict = None, **kwargs: Any) -> None: """Move mouse cursor (dispatches a ``mousemove`` event). Options can accepts ``steps`` (int) field. If this ``steps`` option specified, Sends intermediate ``mousemove`` events. Defaults to ...
[ "async", "def", "move", "(", "self", ",", "x", ":", "float", ",", "y", ":", "float", ",", "options", ":", "dict", "=", "None", ",", "*", "*", "kwargs", ":", "Any", ")", "->", "None", ":", "options", "=", "merge_dict", "(", "options", ",", "kwargs...
[ 260, 4 ]
[ 282, 14 ]
python
en
['en', 'fr', 'it']
False
Mouse.click
(self, x: float, y: float, options: dict = None, **kwargs: Any)
Click button at (``x``, ``y``). Shortcut to :meth:`move`, :meth:`down`, and :meth:`up`. This method accepts the following options: * ``button`` (str): ``left``, ``right``, or ``middle``, defaults to ``left``. * ``clickCount`` (int): defaults to 1. * ``delay`` (int|fl...
Click button at (``x``, ``y``).
async def click(self, x: float, y: float, options: dict = None, **kwargs: Any) -> None: """Click button at (``x``, ``y``). Shortcut to :meth:`move`, :meth:`down`, and :meth:`up`. This method accepts the following options: * ``button`` (str): ``left``, ``right``, or...
[ "async", "def", "click", "(", "self", ",", "x", ":", "float", ",", "y", ":", "float", ",", "options", ":", "dict", "=", "None", ",", "*", "*", "kwargs", ":", "Any", ")", "->", "None", ":", "options", "=", "merge_dict", "(", "options", ",", "kwarg...
[ 284, 4 ]
[ 303, 30 ]
python
en
['en', 'en', 'en']
True
Mouse.down
(self, options: dict = None, **kwargs: Any)
Press down button (dispatches ``mousedown`` event). This method accepts the following options: * ``button`` (str): ``left``, ``right``, or ``middle``, defaults to ``left``. * ``clickCount`` (int): defaults to 1.
Press down button (dispatches ``mousedown`` event).
async def down(self, options: dict = None, **kwargs: Any) -> None: """Press down button (dispatches ``mousedown`` event). This method accepts the following options: * ``button`` (str): ``left``, ``right``, or ``middle``, defaults to ``left``. * ``clickCount`` (int): defaults ...
[ "async", "def", "down", "(", "self", ",", "options", ":", "dict", "=", "None", ",", "*", "*", "kwargs", ":", "Any", ")", "->", "None", ":", "options", "=", "merge_dict", "(", "options", ",", "kwargs", ")", "self", ".", "_button", "=", "options", "....
[ 305, 4 ]
[ 323, 10 ]
python
en
['en', 'fr', 'en']
True
Mouse.up
(self, options: dict = None, **kwargs: Any)
Release pressed button (dispatches ``mouseup`` event). This method accepts the following options: * ``button`` (str): ``left``, ``right``, or ``middle``, defaults to ``left``. * ``clickCount`` (int): defaults to 1.
Release pressed button (dispatches ``mouseup`` event).
async def up(self, options: dict = None, **kwargs: Any) -> None: """Release pressed button (dispatches ``mouseup`` event). This method accepts the following options: * ``button`` (str): ``left``, ``right``, or ``middle``, defaults to ``left``. * ``clickCount`` (int): defaults...
[ "async", "def", "up", "(", "self", ",", "options", ":", "dict", "=", "None", ",", "*", "*", "kwargs", ":", "Any", ")", "->", "None", ":", "options", "=", "merge_dict", "(", "options", ",", "kwargs", ")", "self", ".", "_button", "=", "'none'", "awai...
[ 325, 4 ]
[ 343, 10 ]
python
en
['en', 'en', 'en']
True
Touchscreen.__init__
(self, client: CDPSession, keyboard: Keyboard)
Make new touchscreen object.
Make new touchscreen object.
def __init__(self, client: CDPSession, keyboard: Keyboard) -> None: """Make new touchscreen object.""" self._client = client self._keyboard = keyboard
[ "def", "__init__", "(", "self", ",", "client", ":", "CDPSession", ",", "keyboard", ":", "Keyboard", ")", "->", "None", ":", "self", ".", "_client", "=", "client", "self", ".", "_keyboard", "=", "keyboard" ]
[ 349, 4 ]
[ 352, 33 ]
python
en
['en', 'en', 'en']
True
Touchscreen.tap
(self, x: float, y: float)
Tap (``x``, ``y``). Dispatches a ``touchstart`` and ``touchend`` event.
Tap (``x``, ``y``).
async def tap(self, x: float, y: float) -> None: """Tap (``x``, ``y``). Dispatches a ``touchstart`` and ``touchend`` event. """ touchPoints = [{'x': round(x), 'y': round(y)}] await self._client.send('Input.dispatchTouchEvent', { 'type': 'touchStart', 'tou...
[ "async", "def", "tap", "(", "self", ",", "x", ":", "float", ",", "y", ":", "float", ")", "->", "None", ":", "touchPoints", "=", "[", "{", "'x'", ":", "round", "(", "x", ")", ",", "'y'", ":", "round", "(", "y", ")", "}", "]", "await", "self", ...
[ 354, 4 ]
[ 369, 10 ]
python
en
['en', 'es', 'hi']
False
SGDW.step
(self, closure: OptLossClosure = None)
Performs a single optimization step. Arguments: closure: A closure that reevaluates the model and returns the loss.
Performs a single optimization step.
def step(self, closure: OptLossClosure = None) -> OptFloat: """Performs a single optimization step. Arguments: closure: A closure that reevaluates the model and returns the loss. """ loss = None if closure is not None: loss = closure() for group ...
[ "def", "step", "(", "self", ",", "closure", ":", "OptLossClosure", "=", "None", ")", "->", "OptFloat", ":", "loss", "=", "None", "if", "closure", "is", "not", "None", ":", "loss", "=", "closure", "(", ")", "for", "group", "in", "self", ".", "param_gr...
[ 73, 4 ]
[ 121, 19 ]
python
en
['en', 'en', 'en']
True
create_generic_related_manager
(superclass, rel)
Factory function to create a manager that subclasses another manager (generally the default manager of a given model) and adds behaviors specific to generic relations.
Factory function to create a manager that subclasses another manager (generally the default manager of a given model) and adds behaviors specific to generic relations.
def create_generic_related_manager(superclass, rel): """ Factory function to create a manager that subclasses another manager (generally the default manager of a given model) and adds behaviors specific to generic relations. """ class GenericRelatedObjectManager(superclass): def __init_...
[ "def", "create_generic_related_manager", "(", "superclass", ",", "rel", ")", ":", "class", "GenericRelatedObjectManager", "(", "superclass", ")", ":", "def", "__init__", "(", "self", ",", "instance", "=", "None", ")", ":", "super", "(", "GenericRelatedObjectManage...
[ 476, 0 ]
[ 656, 38 ]
python
en
['en', 'error', 'th']
False
GenericRelation._is_matching_generic_foreign_key
(self, field)
Return True if field is a GenericForeignKey whose content type and object id fields correspond to the equivalent attributes on this GenericRelation.
Return True if field is a GenericForeignKey whose content type and object id fields correspond to the equivalent attributes on this GenericRelation.
def _is_matching_generic_foreign_key(self, field): """ Return True if field is a GenericForeignKey whose content type and object id fields correspond to the equivalent attributes on this GenericRelation. """ return ( isinstance(field, GenericForeignKey) and ...
[ "def", "_is_matching_generic_foreign_key", "(", "self", ",", "field", ")", ":", "return", "(", "isinstance", "(", "field", ",", "GenericForeignKey", ")", "and", "field", ".", "ct_field", "==", "self", ".", "content_type_field_name", "and", "field", ".", "fk_fiel...
[ 320, 4 ]
[ 330, 9 ]
python
en
['en', 'error', 'th']
False
GenericRelation._get_path_info_with_parent
(self)
Return the path that joins the current model through any parent models. The idea is that if you have a GFK defined on a parent model then we need to join the parent model first, then the child model.
Return the path that joins the current model through any parent models. The idea is that if you have a GFK defined on a parent model then we need to join the parent model first, then the child model.
def _get_path_info_with_parent(self): """ Return the path that joins the current model through any parent models. The idea is that if you have a GFK defined on a parent model then we need to join the parent model first, then the child model. """ # With an inheritance chai...
[ "def", "_get_path_info_with_parent", "(", "self", ")", ":", "# With an inheritance chain ChildTag -> Tag and Tag defines the", "# GenericForeignKey, and a TaggedItem model has a GenericRelation to", "# ChildTag, then we need to generate a join from TaggedItem to Tag", "# (as Tag.object_id == Tagge...
[ 356, 4 ]
[ 386, 19 ]
python
en
['en', 'error', 'th']
False
GenericRelation.get_content_type
(self)
Return the content type associated with this field's model.
Return the content type associated with this field's model.
def get_content_type(self): """ Return the content type associated with this field's model. """ return ContentType.objects.get_for_model(self.model, for_concrete_model=self.for_concrete_model)
[ "def", "get_content_type", "(", "self", ")", ":", "return", "ContentType", ".", "objects", ".", "get_for_model", "(", "self", ".", "model", ",", "for_concrete_model", "=", "self", ".", "for_concrete_model", ")" ]
[ 429, 4 ]
[ 434, 92 ]
python
en
['en', 'error', 'th']
False
GenericRelation.bulk_related_objects
(self, objs, using=DEFAULT_DB_ALIAS)
Return all objects related to ``objs`` via this ``GenericRelation``.
Return all objects related to ``objs`` via this ``GenericRelation``.
def bulk_related_objects(self, objs, using=DEFAULT_DB_ALIAS): """ Return all objects related to ``objs`` via this ``GenericRelation``. """ return self.remote_field.model._base_manager.db_manager(using).filter(**{ "%s__pk" % self.content_type_field_name: ContentType.objects.db...
[ "def", "bulk_related_objects", "(", "self", ",", "objs", ",", "using", "=", "DEFAULT_DB_ALIAS", ")", ":", "return", "self", ".", "remote_field", ".", "model", ".", "_base_manager", ".", "db_manager", "(", "using", ")", ".", "filter", "(", "*", "*", "{", ...
[ 444, 4 ]
[ 452, 10 ]
python
en
['en', 'error', 'th']
False
VGG.__init__
(self, args)
TODO: Write Comment
TODO: Write Comment
def __init__(self, args): """ TODO: Write Comment """ CifarModel.__init__(self, args)
[ "def", "__init__", "(", "self", ",", "args", ")", ":", "CifarModel", ".", "__init__", "(", "self", ",", "args", ")" ]
[ 10, 4 ]
[ 15, 39 ]
python
en
['en', 'error', 'th']
False
VGG.network
(self, img_input)
TODO: Write Comment
TODO: Write Comment
def network(self, img_input): """ TODO: Write Comment """ from tensorflow.keras import initializers, layers, regularizers weight_decay = 0.0005 if self.vgg_type == 16: stack = [2,2,3,3,3] else: stack = [2,2,4,4,4] filters = [64,...
[ "def", "network", "(", "self", ",", "img_input", ")", ":", "from", "tensorflow", ".", "keras", "import", "initializers", ",", "layers", ",", "regularizers", "weight_decay", "=", "0.0005", "if", "self", ".", "vgg_type", "==", "16", ":", "stack", "=", "[", ...
[ 17, 4 ]
[ 66, 16 ]
python
en
['en', 'error', 'th']
False
VGG.scheduler
(self, epoch)
TODO: Write Comment
TODO: Write Comment
def scheduler(self, epoch): """ TODO: Write Comment """ if epoch < 80: return 0.1 if epoch < 160: return 0.01 return 0.001
[ "def", "scheduler", "(", "self", ",", "epoch", ")", ":", "if", "epoch", "<", "80", ":", "return", "0.1", "if", "epoch", "<", "160", ":", "return", "0.01", "return", "0.001" ]
[ 68, 4 ]
[ 76, 20 ]
python
en
['en', 'error', 'th']
False
VGG16.__init__
(self, args)
TODO: Write Comment
TODO: Write Comment
def __init__(self, args): """ TODO: Write Comment """ self.name = 'VGG-16' self.vgg_type = 16 VGG.__init__(self, args)
[ "def", "__init__", "(", "self", ",", "args", ")", ":", "self", ".", "name", "=", "'VGG-16'", "self", ".", "vgg_type", "=", "16", "VGG", ".", "__init__", "(", "self", ",", "args", ")" ]
[ 84, 4 ]
[ 92, 32 ]
python
en
['en', 'error', 'th']
False
VGG19.__init__
(self, args)
TODO: Write Comment
TODO: Write Comment
def __init__(self, args): """ TODO: Write Comment """ self.name = 'VGG-19' self.vgg_type = 19 VGG.__init__(self, args)
[ "def", "__init__", "(", "self", ",", "args", ")", ":", "self", ".", "name", "=", "'VGG-19'", "self", ".", "vgg_type", "=", "19", "VGG", ".", "__init__", "(", "self", ",", "args", ")" ]
[ 99, 4 ]
[ 107, 32 ]
python
en
['en', 'error', 'th']
False
prefix_validation_error
(error, prefix, code, params)
Prefix a validation error message while maintaining the existing validation data structure.
Prefix a validation error message while maintaining the existing validation data structure.
def prefix_validation_error(error, prefix, code, params): """ Prefix a validation error message while maintaining the existing validation data structure. """ if error.error_list == [error]: error_params = error.params or {} return ValidationError( # We can't simply concat...
[ "def", "prefix_validation_error", "(", "error", ",", "prefix", ",", "code", ",", "params", ")", ":", "if", "error", ".", "error_list", "==", "[", "error", "]", ":", "error_params", "=", "error", ".", "params", "or", "{", "}", "return", "ValidationError", ...
[ 7, 0 ]
[ 30, 6 ]
python
en
['en', 'error', 'th']
False
GrinderExecutor.__write_base_props
(self, fds)
write base properties and base properties file contents to fds :param fds: fds :return:
write base properties and base properties file contents to fds :param fds: fds :return:
def __write_base_props(self, fds): """ write base properties and base properties file contents to fds :param fds: fds :return: """ base_props_file = self.settings.get("properties-file") if base_props_file: fds.write("# Base Properies File Start: %s\n" ...
[ "def", "__write_base_props", "(", "self", ",", "fds", ")", ":", "base_props_file", "=", "self", ".", "settings", ".", "get", "(", "\"properties-file\"", ")", "if", "base_props_file", ":", "fds", ".", "write", "(", "\"# Base Properies File Start: %s\\n\"", "%", "...
[ 48, 4 ]
[ 67, 49 ]
python
en
['en', 'error', 'th']
False
GrinderExecutor.__write_scenario_props
(self, fds, scenario)
Write scenario props and scenario file props to fds :param fds: :param scenario: dict :return:
Write scenario props and scenario file props to fds :param fds: :param scenario: dict :return:
def __write_scenario_props(self, fds, scenario): """ Write scenario props and scenario file props to fds :param fds: :param scenario: dict :return: """ script_props_file = scenario.get("properties-file") if script_props_file: fds.write("# Scrip...
[ "def", "__write_scenario_props", "(", "self", ",", "fds", ",", "scenario", ")", ":", "script_props_file", "=", "scenario", ".", "get", "(", "\"properties-file\"", ")", "if", "script_props_file", ":", "fds", ".", "write", "(", "\"# Script Properies File Start: %s\\n\...
[ 69, 4 ]
[ 89, 53 ]
python
en
['en', 'error', 'th']
False
GrinderExecutor.__write_bzt_props
(self, fds)
Write bzt properties to fds :param fds: :return:
Write bzt properties to fds :param fds: :return:
def __write_bzt_props(self, fds): """ Write bzt properties to fds :param fds: :return: """ fds.write("# BZT Properies Start\n") fds.write("grinder.hostID=%s\n" % self.exec_id) fds.write("grinder.script=%s\n" % self.script.replace(os.path.sep, "/")) ...
[ "def", "__write_bzt_props", "(", "self", ",", "fds", ")", ":", "fds", ".", "write", "(", "\"# BZT Properies Start\\n\"", ")", "fds", ".", "write", "(", "\"grinder.hostID=%s\\n\"", "%", "self", ".", "exec_id", ")", "fds", ".", "write", "(", "\"grinder.script=%s...
[ 91, 4 ]
[ 120, 42 ]
python
en
['en', 'error', 'th']
False
GrinderExecutor.startup
(self)
Should start the tool as fast as possible.
Should start the tool as fast as possible.
def startup(self): """ Should start the tool as fast as possible. """ self.env.set({"T_GRINDER_PREFIX": self.exec_id}) self.process = self._execute(self.cmd_line)
[ "def", "startup", "(", "self", ")", ":", "self", ".", "env", ".", "set", "(", "{", "\"T_GRINDER_PREFIX\"", ":", "self", ".", "exec_id", "}", ")", "self", ".", "process", "=", "self", ".", "_execute", "(", "self", ".", "cmd_line", ")" ]
[ 160, 4 ]
[ 165, 51 ]
python
en
['en', 'error', 'th']
False
GrinderExecutor.check
(self)
Checks if tool is still running. Also checks if resulting logs contains any data and throws exception otherwise. :return: bool :raise TaurusToolError:
Checks if tool is still running. Also checks if resulting logs contains any data and throws exception otherwise.
def check(self): """ Checks if tool is still running. Also checks if resulting logs contains any data and throws exception otherwise. :return: bool :raise TaurusToolError: """ self.retcode = self.process.poll() if self.retcode is not None: if ...
[ "def", "check", "(", "self", ")", ":", "self", ".", "retcode", "=", "self", ".", "process", ".", "poll", "(", ")", "if", "self", ".", "retcode", "is", "not", "None", ":", "if", "self", ".", "retcode", "!=", "0", ":", "raise", "ToolError", "(", "\...
[ 167, 4 ]
[ 182, 20 ]
python
en
['en', 'error', 'th']
False
GrinderExecutor.shutdown
(self)
If tool is still running - let's stop it.
If tool is still running - let's stop it.
def shutdown(self): """ If tool is still running - let's stop it. """ shutdown_process(self.process, self.log) if self.start_time: self.end_time = time.time() self.log.debug("Grinder worked for %s seconds", self.end_time - self.start_time)
[ "def", "shutdown", "(", "self", ")", ":", "shutdown_process", "(", "self", ".", "process", ",", "self", ".", "log", ")", "if", "self", ".", "start_time", ":", "self", ".", "end_time", "=", "time", ".", "time", "(", ")", "self", ".", "log", ".", "de...
[ 184, 4 ]
[ 191, 92 ]
python
en
['en', 'error', 'th']
False
GrinderExecutor.post_process
(self)
Collect data file artifact
Collect data file artifact
def post_process(self): """ Collect data file artifact """ if self.kpi_file: self.engine.existing_artifact(self.kpi_file) super(GrinderExecutor, self).post_process()
[ "def", "post_process", "(", "self", ")", ":", "if", "self", ".", "kpi_file", ":", "self", ".", "engine", ".", "existing_artifact", "(", "self", ".", "kpi_file", ")", "super", "(", "GrinderExecutor", ",", "self", ")", ".", "post_process", "(", ")" ]
[ 193, 4 ]
[ 199, 51 ]
python
en
['en', 'error', 'th']
False
GrinderExecutor.__scenario_from_requests
(self)
Generate grinder scenario from requests :return: script
Generate grinder scenario from requests :return: script
def __scenario_from_requests(self): """ Generate grinder scenario from requests :return: script """ script = self.engine.create_artifact("grinder_requests", ".py") builder = GrinderScriptBuilder(self.get_scenario()) builder.label = self.label builder.build...
[ "def", "__scenario_from_requests", "(", "self", ")", ":", "script", "=", "self", ".", "engine", ".", "create_artifact", "(", "\"grinder_requests\"", ",", "\".py\"", ")", "builder", "=", "GrinderScriptBuilder", "(", "self", ".", "get_scenario", "(", ")", ")", "...
[ 201, 4 ]
[ 211, 21 ]
python
en
['en', 'error', 'th']
False
DataLogReader._read
(self, last_pass=False)
Generator method that returns next portion of data :param last_pass:
Generator method that returns next portion of data
def _read(self, last_pass=False): """ Generator method that returns next portion of data :param last_pass: """ self.log.debug("Reading grinder results...") self.lines = list(self.file.get_lines(size=1024 * 1024, last_pass=last_pass)) lnum = None start =...
[ "def", "_read", "(", "self", ",", "last_pass", "=", "False", ")", ":", "self", ".", "log", ".", "debug", "(", "\"Reading grinder results...\"", ")", "self", ".", "lines", "=", "list", "(", "self", ".", "file", ".", "get_lines", "(", "size", "=", "1024"...
[ 284, 4 ]
[ 321, 82 ]
python
en
['en', 'error', 'th']
False
BaseStorage._loaded_messages
(self)
Returns a list of loaded messages, retrieving them first if they have not been loaded yet.
Returns a list of loaded messages, retrieving them first if they have not been loaded yet.
def _loaded_messages(self): """ Returns a list of loaded messages, retrieving them first if they have not been loaded yet. """ if not hasattr(self, '_loaded_data'): messages, all_retrieved = self._get() self._loaded_data = messages or [] return sel...
[ "def", "_loaded_messages", "(", "self", ")", ":", "if", "not", "hasattr", "(", "self", ",", "'_loaded_data'", ")", ":", "messages", ",", "all_retrieved", "=", "self", ".", "_get", "(", ")", "self", ".", "_loaded_data", "=", "messages", "or", "[", "]", ...
[ 85, 4 ]
[ 93, 32 ]
python
en
['en', 'error', 'th']
False
BaseStorage._get
(self, *args, **kwargs)
Retrieves a list of stored messages. Returns a tuple of the messages and a flag indicating whether or not all the messages originally intended to be stored in this storage were, in fact, stored and retrieved; e.g., ``(messages, all_retrieved)``. **This method must be implemente...
Retrieves a list of stored messages. Returns a tuple of the messages and a flag indicating whether or not all the messages originally intended to be stored in this storage were, in fact, stored and retrieved; e.g., ``(messages, all_retrieved)``.
def _get(self, *args, **kwargs): """ Retrieves a list of stored messages. Returns a tuple of the messages and a flag indicating whether or not all the messages originally intended to be stored in this storage were, in fact, stored and retrieved; e.g., ``(messages, all_retrieved)`...
[ "def", "_get", "(", "self", ",", "*", "args", ",", "*", "*", "kwargs", ")", ":", "raise", "NotImplementedError", "(", "'subclasses of BaseStorage must provide a _get() method'", ")" ]
[ 95, 4 ]
[ 108, 91 ]
python
en
['en', 'error', 'th']
False
BaseStorage._store
(self, messages, response, *args, **kwargs)
Stores a list of messages, returning a list of any messages which could not be stored. One type of object must be able to be stored, ``Message``. **This method must be implemented by a subclass.**
Stores a list of messages, returning a list of any messages which could not be stored.
def _store(self, messages, response, *args, **kwargs): """ Stores a list of messages, returning a list of any messages which could not be stored. One type of object must be able to be stored, ``Message``. **This method must be implemented by a subclass.** """ ra...
[ "def", "_store", "(", "self", ",", "messages", ",", "response", ",", "*", "args", ",", "*", "*", "kwargs", ")", ":", "raise", "NotImplementedError", "(", "'subclasses of BaseStorage must provide a _store() method'", ")" ]
[ 110, 4 ]
[ 119, 93 ]
python
en
['en', 'error', 'th']
False
BaseStorage._prepare_messages
(self, messages)
Prepares a list of messages for storage.
Prepares a list of messages for storage.
def _prepare_messages(self, messages): """ Prepares a list of messages for storage. """ for message in messages: message._prepare()
[ "def", "_prepare_messages", "(", "self", ",", "messages", ")", ":", "for", "message", "in", "messages", ":", "message", ".", "_prepare", "(", ")" ]
[ 121, 4 ]
[ 126, 30 ]
python
en
['en', 'error', 'th']
False
BaseStorage.update
(self, response)
Stores all unread messages. If the backend has yet to be iterated, previously stored messages will be stored again. Otherwise, only messages added after the last iteration will be stored.
Stores all unread messages.
def update(self, response): """ Stores all unread messages. If the backend has yet to be iterated, previously stored messages will be stored again. Otherwise, only messages added after the last iteration will be stored. """ self._prepare_messages(self._queued_mes...
[ "def", "update", "(", "self", ",", "response", ")", ":", "self", ".", "_prepare_messages", "(", "self", ".", "_queued_messages", ")", "if", "self", ".", "used", ":", "return", "self", ".", "_store", "(", "self", ".", "_queued_messages", ",", "response", ...
[ 128, 4 ]
[ 141, 50 ]
python
en
['en', 'error', 'th']
False
BaseStorage.add
(self, level, message, extra_tags='')
Queues a message to be stored. The message is only queued if it contained something and its level is not less than the recording level (``self.level``).
Queues a message to be stored.
def add(self, level, message, extra_tags=''): """ Queues a message to be stored. The message is only queued if it contained something and its level is not less than the recording level (``self.level``). """ if not message: return # Check that the mess...
[ "def", "add", "(", "self", ",", "level", ",", "message", ",", "extra_tags", "=", "''", ")", ":", "if", "not", "message", ":", "return", "# Check that the message level is not less than the recording level.", "level", "=", "int", "(", "level", ")", "if", "level",...
[ 143, 4 ]
[ 159, 45 ]
python
en
['en', 'error', 'th']
False
BaseStorage._get_level
(self)
Returns the minimum recorded level. The default level is the ``MESSAGE_LEVEL`` setting. If this is not found, the ``INFO`` level is used.
Returns the minimum recorded level.
def _get_level(self): """ Returns the minimum recorded level. The default level is the ``MESSAGE_LEVEL`` setting. If this is not found, the ``INFO`` level is used. """ if not hasattr(self, '_level'): self._level = getattr(settings, 'MESSAGE_LEVEL', constants....
[ "def", "_get_level", "(", "self", ")", ":", "if", "not", "hasattr", "(", "self", ",", "'_level'", ")", ":", "self", ".", "_level", "=", "getattr", "(", "settings", ",", "'MESSAGE_LEVEL'", ",", "constants", ".", "INFO", ")", "return", "self", ".", "_lev...
[ 161, 4 ]
[ 170, 26 ]
python
en
['en', 'error', 'th']
False
BaseStorage._set_level
(self, value=None)
Sets a custom minimum recorded level. If set to ``None``, the default level will be used (see the ``_get_level`` method).
Sets a custom minimum recorded level.
def _set_level(self, value=None): """ Sets a custom minimum recorded level. If set to ``None``, the default level will be used (see the ``_get_level`` method). """ if value is None and hasattr(self, '_level'): del self._level else: self._l...
[ "def", "_set_level", "(", "self", ",", "value", "=", "None", ")", ":", "if", "value", "is", "None", "and", "hasattr", "(", "self", ",", "'_level'", ")", ":", "del", "self", ".", "_level", "else", ":", "self", ".", "_level", "=", "int", "(", "value"...
[ 172, 4 ]
[ 182, 36 ]
python
en
['en', 'error', 'th']
False
KMLSitemap._build_kml_sources
(self, sources)
Goes through the given sources and returns a 3-tuple of the application label, module name, and field name of every GeometryField encountered in the sources. If no sources are provided, then all models.
Goes through the given sources and returns a 3-tuple of the application label, module name, and field name of every GeometryField encountered in the sources.
def _build_kml_sources(self, sources): """ Goes through the given sources and returns a 3-tuple of the application label, module name, and field name of every GeometryField encountered in the sources. If no sources are provided, then all models. """ kml_sources =...
[ "def", "_build_kml_sources", "(", "self", ",", "sources", ")", ":", "kml_sources", "=", "[", "]", "if", "sources", "is", "None", ":", "sources", "=", "apps", ".", "get_models", "(", ")", "for", "source", "in", "sources", ":", "if", "isinstance", "(", "...
[ 18, 4 ]
[ 42, 26 ]
python
en
['en', 'error', 'th']
False
KMLSitemap.get_urls
(self, page=1, site=None, protocol=None)
This method is overridden so the appropriate `geo_format` attribute is placed on each URL element.
This method is overridden so the appropriate `geo_format` attribute is placed on each URL element.
def get_urls(self, page=1, site=None, protocol=None): """ This method is overridden so the appropriate `geo_format` attribute is placed on each URL element. """ urls = Sitemap.get_urls(self, page=page, site=site, protocol=protocol) for url in urls: url['geo_fo...
[ "def", "get_urls", "(", "self", ",", "page", "=", "1", ",", "site", "=", "None", ",", "protocol", "=", "None", ")", ":", "urls", "=", "Sitemap", ".", "get_urls", "(", "self", ",", "page", "=", "page", ",", "site", "=", "site", ",", "protocol", "=...
[ 44, 4 ]
[ 52, 19 ]
python
en
['en', 'error', 'th']
False
worker_exit
(server, worker)
:param server: :param worker: :return:
:param server: :param worker: :return:
def worker_exit(server, worker): """ :param server: :param worker: :return: """ multiprocess.mark_process_dead(worker.pid)
[ "def", "worker_exit", "(", "server", ",", "worker", ")", ":", "multiprocess", ".", "mark_process_dead", "(", "worker", ".", "pid", ")" ]
[ 6, 0 ]
[ 12, 46 ]
python
en
['en', 'error', 'th']
False
ConnectionTwoPhaseTests.clear_test_xacts
(self)
Rollback all the prepared transaction in the testing db.
Rollback all the prepared transaction in the testing db.
def clear_test_xacts(self): """Rollback all the prepared transaction in the testing db.""" cnn = self.connect() cnn.set_isolation_level(0) cur = cnn.cursor() try: cur.execute( "select gid from pg_prepared_xacts where database = %s", (db...
[ "def", "clear_test_xacts", "(", "self", ")", ":", "cnn", "=", "self", ".", "connect", "(", ")", "cnn", ".", "set_isolation_level", "(", "0", ")", "cur", "=", "cnn", ".", "cursor", "(", ")", "try", ":", "cur", ".", "execute", "(", "\"select gid from pg_...
[ 818, 4 ]
[ 835, 19 ]
python
en
['en', 'en', 'en']
True
ConnectionTwoPhaseTests.count_xacts
(self)
Return the number of prepared xacts currently in the test db.
Return the number of prepared xacts currently in the test db.
def count_xacts(self): """Return the number of prepared xacts currently in the test db.""" cnn = self.connect() cur = cnn.cursor() cur.execute(""" select count(*) from pg_prepared_xacts where database = %s;""", (dbname,)) rv = cur.fetchone()[0]...
[ "def", "count_xacts", "(", "self", ")", ":", "cnn", "=", "self", ".", "connect", "(", ")", "cur", "=", "cnn", ".", "cursor", "(", ")", "cur", ".", "execute", "(", "\"\"\"\n select count(*) from pg_prepared_xacts\n where database = %s;\"\"\"", "...
[ 848, 4 ]
[ 858, 17 ]
python
en
['en', 'en', 'en']
True
ConnectionTwoPhaseTests.count_test_records
(self)
Return the number of records in the test table.
Return the number of records in the test table.
def count_test_records(self): """Return the number of records in the test table.""" cnn = self.connect() cur = cnn.cursor() cur.execute("select count(*) from test_tpc;") rv = cur.fetchone()[0] cnn.close() return rv
[ "def", "count_test_records", "(", "self", ")", ":", "cnn", "=", "self", ".", "connect", "(", ")", "cur", "=", "cnn", ".", "cursor", "(", ")", "cur", ".", "execute", "(", "\"select count(*) from test_tpc;\"", ")", "rv", "=", "cur", ".", "fetchone", "(", ...
[ 860, 4 ]
[ 867, 17 ]
python
en
['en', 'en', 'en']
True
CurrentSiteManager._get_field_name
(self)
Return self.__field_name or 'site' or 'sites'.
Return self.__field_name or 'site' or 'sites'.
def _get_field_name(self): """ Return self.__field_name or 'site' or 'sites'. """ if not self.__field_name: try: self.model._meta.get_field('site') except FieldDoesNotExist: self.__field_name = 'sites' else: self.__fiel...
[ "def", "_get_field_name", "(", "self", ")", ":", "if", "not", "self", ".", "__field_name", ":", "try", ":", "self", ".", "model", ".", "_meta", ".", "get_field", "(", "'site'", ")", "except", "FieldDoesNotExist", ":", "self", ".", "__field_name", "=", "'...
[ 49, 4 ]
[ 59, 32 ]
python
en
['en', 'en', 'en']
True
LogEntryQuerySet.get_users
(self)
Returns a QuerySet of Users who have created at least one log entry in this QuerySet. The returned queryset is ordered by the username.
Returns a QuerySet of Users who have created at least one log entry in this QuerySet.
def get_users(self): """ Returns a QuerySet of Users who have created at least one log entry in this QuerySet. The returned queryset is ordered by the username. """ User = get_user_model() return User.objects.filter( pk__in=set(self.values_list('user__pk', fl...
[ "def", "get_users", "(", "self", ")", ":", "User", "=", "get_user_model", "(", ")", "return", "User", ".", "objects", ".", "filter", "(", "pk__in", "=", "set", "(", "self", ".", "values_list", "(", "'user__pk'", ",", "flat", "=", "True", ")", ")", ")...
[ 19, 4 ]
[ 28, 39 ]
python
en
['en', 'error', 'th']
False
BaseLogEntryManager.log_action
(self, instance, action, **kwargs)
:param instance: The model instance we are logging an action for :param action: The action. Should be namespaced to app (e.g. wagtail.create, wagtail.workflow.start) :param kwargs: Addition fields to for the model deriving from BaseLogEntry - user: The user performing the action ...
:param instance: The model instance we are logging an action for :param action: The action. Should be namespaced to app (e.g. wagtail.create, wagtail.workflow.start) :param kwargs: Addition fields to for the model deriving from BaseLogEntry - user: The user performing the action ...
def log_action(self, instance, action, **kwargs): """ :param instance: The model instance we are logging an action for :param action: The action. Should be namespaced to app (e.g. wagtail.create, wagtail.workflow.start) :param kwargs: Addition fields to for the model deriving from BaseLo...
[ "def", "log_action", "(", "self", ",", "instance", ",", "action", ",", "*", "*", "kwargs", ")", ":", "data", "=", "kwargs", ".", "pop", "(", "'data'", ",", "''", ")", "title", "=", "kwargs", ".", "pop", "(", "'title'", ",", "None", ")", "if", "no...
[ 38, 4 ]
[ 62, 9 ]
python
en
['en', 'error', 'th']
False
BaseLogEntry.user_display_name
(self)
Returns the display name of the associated user; get_full_name if available and non-empty, otherwise get_username. Defaults to 'system' when none is provided
Returns the display name of the associated user; get_full_name if available and non-empty, otherwise get_username. Defaults to 'system' when none is provided
def user_display_name(self): """ Returns the display name of the associated user; get_full_name if available and non-empty, otherwise get_username. Defaults to 'system' when none is provided """ if self.user_id: try: user = self.user ...
[ "def", "user_display_name", "(", "self", ")", ":", "if", "self", ".", "user_id", ":", "try", ":", "user", "=", "self", ".", "user", "except", "self", ".", "_meta", ".", "get_field", "(", "'user'", ")", ".", "related_model", ".", "DoesNotExist", ":", "#...
[ 130, 4 ]
[ 150, 30 ]
python
en
['en', 'error', 'th']
False
BaseLogEntry.data
(self)
Provides deserialized data
Provides deserialized data
def data(self): """ Provides deserialized data """ if self.data_json: return json.loads(self.data_json) else: return {}
[ "def", "data", "(", "self", ")", ":", "if", "self", ".", "data_json", ":", "return", "json", ".", "loads", "(", "self", ".", "data_json", ")", "else", ":", "return", "{", "}" ]
[ 153, 4 ]
[ 160, 21 ]
python
en
['en', 'error', 'th']
False
BaseSpecifier.__str__
(self)
Returns the str representation of this Specifier like object. This should be representative of the Specifier itself.
Returns the str representation of this Specifier like object. This should be representative of the Specifier itself.
def __str__(self): # type: () -> str """ Returns the str representation of this Specifier like object. This should be representative of the Specifier itself. """
[ "def", "__str__", "(", "self", ")", ":", "# type: () -> str" ]
[ 32, 4 ]
[ 37, 11 ]
python
en
['en', 'error', 'th']
False
BaseSpecifier.__hash__
(self)
Returns a hash value for this Specifier like object.
Returns a hash value for this Specifier like object.
def __hash__(self): # type: () -> int """ Returns a hash value for this Specifier like object. """
[ "def", "__hash__", "(", "self", ")", ":", "# type: () -> int" ]
[ 40, 4 ]
[ 44, 11 ]
python
en
['en', 'error', 'th']
False
BaseSpecifier.__eq__
(self, other)
Returns a boolean representing whether or not the two Specifier like objects are equal.
Returns a boolean representing whether or not the two Specifier like objects are equal.
def __eq__(self, other): # type: (object) -> bool """ Returns a boolean representing whether or not the two Specifier like objects are equal. """
[ "def", "__eq__", "(", "self", ",", "other", ")", ":", "# type: (object) -> bool" ]
[ 47, 4 ]
[ 52, 11 ]
python
en
['en', 'error', 'th']
False
BaseSpecifier.__ne__
(self, other)
Returns a boolean representing whether or not the two Specifier like objects are not equal.
Returns a boolean representing whether or not the two Specifier like objects are not equal.
def __ne__(self, other): # type: (object) -> bool """ Returns a boolean representing whether or not the two Specifier like objects are not equal. """
[ "def", "__ne__", "(", "self", ",", "other", ")", ":", "# type: (object) -> bool" ]
[ 55, 4 ]
[ 60, 11 ]
python
en
['en', 'error', 'th']
False
BaseSpecifier.prereleases
(self)
Returns whether or not pre-releases as a whole are allowed by this specifier.
Returns whether or not pre-releases as a whole are allowed by this specifier.
def prereleases(self): # type: () -> Optional[bool] """ Returns whether or not pre-releases as a whole are allowed by this specifier. """
[ "def", "prereleases", "(", "self", ")", ":", "# type: () -> Optional[bool]" ]
[ 63, 4 ]
[ 68, 11 ]
python
en
['en', 'error', 'th']
False
BaseSpecifier.prereleases
(self, value)
Sets whether or not pre-releases as a whole are allowed by this specifier.
Sets whether or not pre-releases as a whole are allowed by this specifier.
def prereleases(self, value): # type: (bool) -> None """ Sets whether or not pre-releases as a whole are allowed by this specifier. """
[ "def", "prereleases", "(", "self", ",", "value", ")", ":", "# type: (bool) -> None" ]
[ 71, 4 ]
[ 76, 11 ]
python
en
['en', 'error', 'th']
False
BaseSpecifier.contains
(self, item, prereleases=None)
Determines if the given item is contained within this specifier.
Determines if the given item is contained within this specifier.
def contains(self, item, prereleases=None): # type: (str, Optional[bool]) -> bool """ Determines if the given item is contained within this specifier. """
[ "def", "contains", "(", "self", ",", "item", ",", "prereleases", "=", "None", ")", ":", "# type: (str, Optional[bool]) -> bool" ]
[ 79, 4 ]
[ 83, 11 ]
python
en
['en', 'error', 'th']
False
BaseSpecifier.filter
(self, iterable, prereleases=None)
Takes an iterable of items and filters them so that only items which are contained within this specifier are allowed in it.
Takes an iterable of items and filters them so that only items which are contained within this specifier are allowed in it.
def filter(self, iterable, prereleases=None): # type: (Iterable[UnparsedVersion], Optional[bool]) -> Iterable[UnparsedVersion] """ Takes an iterable of items and filters them so that only items which are contained within this specifier are allowed in it. """
[ "def", "filter", "(", "self", ",", "iterable", ",", "prereleases", "=", "None", ")", ":", "# type: (Iterable[UnparsedVersion], Optional[bool]) -> Iterable[UnparsedVersion]" ]
[ 86, 4 ]
[ 91, 11 ]
python
en
['en', 'error', 'th']
False
GoodnessOfFitLogProb.fit_estimator
(self, print_fit_result=True)
Fits the estimator with the provided data Args: print_fit_result: boolean that specifies whether the fitted distribution shall be plotted (only works if ndim_x and ndim_y = 1)
Fits the estimator with the provided data
def fit_estimator(self, print_fit_result=True): #todo set to False """ Fits the estimator with the provided data Args: print_fit_result: boolean that specifies whether the fitted distribution shall be plotted (only works if ndim_x and ndim_y = 1) """ self.time_to_fit = None if not self.e...
[ "def", "fit_estimator", "(", "self", ",", "print_fit_result", "=", "True", ")", ":", "#todo set to False", "self", ".", "time_to_fit", "=", "None", "if", "not", "self", ".", "estimator", ".", "fitted", ":", "# fit estimator if necessary", "t_start", "=", "time",...
[ 55, 2 ]
[ 81, 24 ]
python
en
['en', 'error', 'th']
False
GoodnessOfFitLogProb.compute_results
(self)
Computes statistics and stores the results in GoodnessOfFitResult object Returns: GoodnessOfFitResult object that holds the computed statistics
Computes statistics and stores the results in GoodnessOfFitResult object
def compute_results(self): """ Computes statistics and stores the results in GoodnessOfFitResult object Returns: GoodnessOfFitResult object that holds the computed statistics """ assert self.estimator is not None assert self.probabilistic_model is not None gof_result = Goodness...
[ "def", "compute_results", "(", "self", ")", ":", "assert", "self", ".", "estimator", "is", "not", "None", "assert", "self", ".", "probabilistic_model", "is", "not", "None", "gof_result", "=", "GoodnessOfFitSingleResult", "(", "self", ".", "estimator", ".", "ge...
[ 83, 2 ]
[ 100, 21 ]
python
en
['en', 'error', 'th']
False
get_supported_platform
()
Return this platform's maximum compatible version. distutils.util.get_platform() normally reports the minimum version of Mac OS X that would be required to *use* extensions produced by distutils. But what we want when checking compatibility is to know the version of Mac OS X that we are *running*. To...
Return this platform's maximum compatible version.
def get_supported_platform(): """Return this platform's maximum compatible version. distutils.util.get_platform() normally reports the minimum version of Mac OS X that would be required to *use* extensions produced by distutils. But what we want when checking compatibility is to know the version o...
[ "def", "get_supported_platform", "(", ")", ":", "plat", "=", "get_build_platform", "(", ")", "m", "=", "macosVersionString", ".", "match", "(", "plat", ")", "if", "m", "is", "not", "None", "and", "sys", ".", "platform", "==", "\"darwin\"", ":", "try", ":...
[ 176, 0 ]
[ 197, 15 ]
python
en
['en', 'la', 'en']
True
register_loader_type
(loader_type, provider_factory)
Register `provider_factory` to make providers for `loader_type` `loader_type` is the type or class of a PEP 302 ``module.__loader__``, and `provider_factory` is a function that, passed a *module* object, returns an ``IResourceProvider`` for that module.
Register `provider_factory` to make providers for `loader_type`
def register_loader_type(loader_type, provider_factory): """Register `provider_factory` to make providers for `loader_type` `loader_type` is the type or class of a PEP 302 ``module.__loader__``, and `provider_factory` is a function that, passed a *module* object, returns an ``IResourceProvider`` for th...
[ "def", "register_loader_type", "(", "loader_type", ",", "provider_factory", ")", ":", "_provider_factories", "[", "loader_type", "]", "=", "provider_factory" ]
[ 343, 0 ]
[ 350, 55 ]
python
en
['en', 'no', 'en']
True
get_provider
(moduleOrReq)
Return an IResourceProvider for the named module or requirement
Return an IResourceProvider for the named module or requirement
def get_provider(moduleOrReq): """Return an IResourceProvider for the named module or requirement""" if isinstance(moduleOrReq, Requirement): return working_set.find(moduleOrReq) or require(str(moduleOrReq))[0] try: module = sys.modules[moduleOrReq] except KeyError: __import__(mo...
[ "def", "get_provider", "(", "moduleOrReq", ")", ":", "if", "isinstance", "(", "moduleOrReq", ",", "Requirement", ")", ":", "return", "working_set", ".", "find", "(", "moduleOrReq", ")", "or", "require", "(", "str", "(", "moduleOrReq", ")", ")", "[", "0", ...
[ 353, 0 ]
[ 363, 61 ]
python
en
['en', 'en', 'en']
True
get_build_platform
()
Return this platform's string for platform-specific distributions XXX Currently this is the same as ``distutils.util.get_platform()``, but it needs some hacks for Linux and Mac OS X.
Return this platform's string for platform-specific distributions
def get_build_platform(): """Return this platform's string for platform-specific distributions XXX Currently this is the same as ``distutils.util.get_platform()``, but it needs some hacks for Linux and Mac OS X. """ from sysconfig import get_platform plat = get_platform() if sys.platform =...
[ "def", "get_build_platform", "(", ")", ":", "from", "sysconfig", "import", "get_platform", "plat", "=", "get_platform", "(", ")", "if", "sys", ".", "platform", "==", "\"darwin\"", "and", "not", "plat", ".", "startswith", "(", "'macosx-'", ")", ":", "try", ...
[ 386, 0 ]
[ 407, 15 ]
python
en
['en', 'da', 'en']
True
compatible_platforms
(provided, required)
Can code for the `provided` platform run on the `required` platform? Returns true if either platform is ``None``, or the platforms are equal. XXX Needs compatibility checks for Linux and other unixy OSes.
Can code for the `provided` platform run on the `required` platform?
def compatible_platforms(provided, required): """Can code for the `provided` platform run on the `required` platform? Returns true if either platform is ``None``, or the platforms are equal. XXX Needs compatibility checks for Linux and other unixy OSes. """ if provided is None or required is None ...
[ "def", "compatible_platforms", "(", "provided", ",", "required", ")", ":", "if", "provided", "is", "None", "or", "required", "is", "None", "or", "provided", "==", "required", ":", "# easy case", "return", "True", "# Mac OS X special cases", "reqMac", "=", "macos...
[ 416, 0 ]
[ 459, 16 ]
python
en
['en', 'en', 'en']
True
run_script
(dist_spec, script_name)
Locate distribution `dist_spec` and run its `script_name` script
Locate distribution `dist_spec` and run its `script_name` script
def run_script(dist_spec, script_name): """Locate distribution `dist_spec` and run its `script_name` script""" ns = sys._getframe(1).f_globals name = ns['__name__'] ns.clear() ns['__name__'] = name require(dist_spec)[0].run_script(script_name, ns)
[ "def", "run_script", "(", "dist_spec", ",", "script_name", ")", ":", "ns", "=", "sys", ".", "_getframe", "(", "1", ")", ".", "f_globals", "name", "=", "ns", "[", "'__name__'", "]", "ns", ".", "clear", "(", ")", "ns", "[", "'__name__'", "]", "=", "n...
[ 462, 0 ]
[ 468, 53 ]
python
en
['en', 'co', 'en']
True
get_distribution
(dist)
Return a current distribution object for a Requirement or string
Return a current distribution object for a Requirement or string
def get_distribution(dist): """Return a current distribution object for a Requirement or string""" if isinstance(dist, six.string_types): dist = Requirement.parse(dist) if isinstance(dist, Requirement): dist = get_provider(dist) if not isinstance(dist, Distribution): raise TypeEr...
[ "def", "get_distribution", "(", "dist", ")", ":", "if", "isinstance", "(", "dist", ",", "six", ".", "string_types", ")", ":", "dist", "=", "Requirement", ".", "parse", "(", "dist", ")", "if", "isinstance", "(", "dist", ",", "Requirement", ")", ":", "di...
[ 475, 0 ]
[ 483, 15 ]
python
en
['en', 'en', 'en']
True
load_entry_point
(dist, group, name)
Return `name` entry point of `group` for `dist` or raise ImportError
Return `name` entry point of `group` for `dist` or raise ImportError
def load_entry_point(dist, group, name): """Return `name` entry point of `group` for `dist` or raise ImportError""" return get_distribution(dist).load_entry_point(group, name)
[ "def", "load_entry_point", "(", "dist", ",", "group", ",", "name", ")", ":", "return", "get_distribution", "(", "dist", ")", ".", "load_entry_point", "(", "group", ",", "name", ")" ]
[ 486, 0 ]
[ 488, 63 ]
python
en
['en', 'en', 'en']
True
get_entry_map
(dist, group=None)
Return the entry point map for `group`, or the full entry map
Return the entry point map for `group`, or the full entry map
def get_entry_map(dist, group=None): """Return the entry point map for `group`, or the full entry map""" return get_distribution(dist).get_entry_map(group)
[ "def", "get_entry_map", "(", "dist", ",", "group", "=", "None", ")", ":", "return", "get_distribution", "(", "dist", ")", ".", "get_entry_map", "(", "group", ")" ]
[ 491, 0 ]
[ 493, 54 ]
python
en
['en', 'en', 'en']
True
get_entry_info
(dist, group, name)
Return the EntryPoint object for `group`+`name`, or ``None``
Return the EntryPoint object for `group`+`name`, or ``None``
def get_entry_info(dist, group, name): """Return the EntryPoint object for `group`+`name`, or ``None``""" return get_distribution(dist).get_entry_info(group, name)
[ "def", "get_entry_info", "(", "dist", ",", "group", ",", "name", ")", ":", "return", "get_distribution", "(", "dist", ")", ".", "get_entry_info", "(", "group", ",", "name", ")" ]
[ 496, 0 ]
[ 498, 61 ]
python
en
['en', 'en', 'en']
True
get_default_cache
()
Return the ``PYTHON_EGG_CACHE`` environment variable or a platform-relevant user cache dir for an app named "Python-Eggs".
Return the ``PYTHON_EGG_CACHE`` environment variable or a platform-relevant user cache dir for an app named "Python-Eggs".
def get_default_cache(): """ Return the ``PYTHON_EGG_CACHE`` environment variable or a platform-relevant user cache dir for an app named "Python-Eggs". """ return ( os.environ.get('PYTHON_EGG_CACHE') or appdirs.user_cache_dir(appname='Python-Eggs') )
[ "def", "get_default_cache", "(", ")", ":", "return", "(", "os", ".", "environ", ".", "get", "(", "'PYTHON_EGG_CACHE'", ")", "or", "appdirs", ".", "user_cache_dir", "(", "appname", "=", "'Python-Eggs'", ")", ")" ]
[ 1304, 0 ]
[ 1313, 5 ]
python
en
['en', 'error', 'th']
False
safe_name
(name)
Convert an arbitrary string to a standard distribution name Any runs of non-alphanumeric/. characters are replaced with a single '-'.
Convert an arbitrary string to a standard distribution name
def safe_name(name): """Convert an arbitrary string to a standard distribution name Any runs of non-alphanumeric/. characters are replaced with a single '-'. """ return re.sub('[^A-Za-z0-9.]+', '-', name)
[ "def", "safe_name", "(", "name", ")", ":", "return", "re", ".", "sub", "(", "'[^A-Za-z0-9.]+'", ",", "'-'", ",", "name", ")" ]
[ 1316, 0 ]
[ 1321, 46 ]
python
en
['en', 'en', 'en']
True
safe_version
(version)
Convert an arbitrary string to a standard version string
Convert an arbitrary string to a standard version string
def safe_version(version): """ Convert an arbitrary string to a standard version string """ try: # normalize the version return str(packaging.version.Version(version)) except packaging.version.InvalidVersion: version = version.replace(' ', '.') return re.sub('[^A-Za-z...
[ "def", "safe_version", "(", "version", ")", ":", "try", ":", "# normalize the version", "return", "str", "(", "packaging", ".", "version", ".", "Version", "(", "version", ")", ")", "except", "packaging", ".", "version", ".", "InvalidVersion", ":", "version", ...
[ 1324, 0 ]
[ 1333, 53 ]
python
en
['en', 'error', 'th']
False
safe_extra
(extra)
Convert an arbitrary string to a standard 'extra' name Any runs of non-alphanumeric characters are replaced with a single '_', and the result is always lowercased.
Convert an arbitrary string to a standard 'extra' name
def safe_extra(extra): """Convert an arbitrary string to a standard 'extra' name Any runs of non-alphanumeric characters are replaced with a single '_', and the result is always lowercased. """ return re.sub('[^A-Za-z0-9.-]+', '_', extra).lower()
[ "def", "safe_extra", "(", "extra", ")", ":", "return", "re", ".", "sub", "(", "'[^A-Za-z0-9.-]+'", ",", "'_'", ",", "extra", ")", ".", "lower", "(", ")" ]
[ 1336, 0 ]
[ 1342, 56 ]
python
en
['en', 'en', 'en']
True
to_filename
(name)
Convert a project or version name to its filename-escaped form Any '-' characters are currently replaced with '_'.
Convert a project or version name to its filename-escaped form
def to_filename(name): """Convert a project or version name to its filename-escaped form Any '-' characters are currently replaced with '_'. """ return name.replace('-', '_')
[ "def", "to_filename", "(", "name", ")", ":", "return", "name", ".", "replace", "(", "'-'", ",", "'_'", ")" ]
[ 1345, 0 ]
[ 1350, 33 ]
python
en
['en', 'en', 'en']
True
invalid_marker
(text)
Validate text as a PEP 508 environment marker; return an exception if invalid or False otherwise.
Validate text as a PEP 508 environment marker; return an exception if invalid or False otherwise.
def invalid_marker(text): """ Validate text as a PEP 508 environment marker; return an exception if invalid or False otherwise. """ try: evaluate_marker(text) except SyntaxError as e: e.filename = None e.lineno = None return e return False
[ "def", "invalid_marker", "(", "text", ")", ":", "try", ":", "evaluate_marker", "(", "text", ")", "except", "SyntaxError", "as", "e", ":", "e", ".", "filename", "=", "None", "e", ".", "lineno", "=", "None", "return", "e", "return", "False" ]
[ 1353, 0 ]
[ 1364, 16 ]
python
en
['en', 'error', 'th']
False
evaluate_marker
(text, extra=None)
Evaluate a PEP 508 environment marker. Return a boolean indicating the marker result in this environment. Raise SyntaxError if marker is invalid. This implementation uses the 'pyparsing' module.
Evaluate a PEP 508 environment marker. Return a boolean indicating the marker result in this environment. Raise SyntaxError if marker is invalid.
def evaluate_marker(text, extra=None): """ Evaluate a PEP 508 environment marker. Return a boolean indicating the marker result in this environment. Raise SyntaxError if marker is invalid. This implementation uses the 'pyparsing' module. """ try: marker = packaging.markers.Marker(te...
[ "def", "evaluate_marker", "(", "text", ",", "extra", "=", "None", ")", ":", "try", ":", "marker", "=", "packaging", ".", "markers", ".", "Marker", "(", "text", ")", "return", "marker", ".", "evaluate", "(", ")", "except", "packaging", ".", "markers", "...
[ 1367, 0 ]
[ 1379, 28 ]
python
en
['en', 'error', 'th']
False