nwo stringlengths 5 106 | sha stringlengths 40 40 | path stringlengths 4 174 | language stringclasses 1
value | identifier stringlengths 1 140 | parameters stringlengths 0 87.7k | argument_list stringclasses 1
value | return_statement stringlengths 0 426k | docstring stringlengths 0 64.3k | docstring_summary stringlengths 0 26.3k | docstring_tokens list | function stringlengths 18 4.83M | function_tokens list | url stringlengths 83 304 |
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
colour-science/colour | 38782ac059e8ddd91939f3432bf06811c16667f0 | colour/io/image.py | python | read_image | (path, bit_depth='float32', method='OpenImageIO', **kwargs) | return function(path, bit_depth, **kwargs) | Reads the image at given path using given method.
Parameters
----------
path : str
Image path.
bit_depth : str, optional
**{'float32', 'uint8', 'uint16', 'float16'}**,
Returned image bit depth, for the *Imageio* method, the image data is
converted with :func:`colour.io.c... | Reads the image at given path using given method. | [
"Reads",
"the",
"image",
"at",
"given",
"path",
"using",
"given",
"method",
"."
] | def read_image(path, bit_depth='float32', method='OpenImageIO', **kwargs):
"""
Reads the image at given path using given method.
Parameters
----------
path : str
Image path.
bit_depth : str, optional
**{'float32', 'uint8', 'uint16', 'float16'}**,
Returned image bit depth... | [
"def",
"read_image",
"(",
"path",
",",
"bit_depth",
"=",
"'float32'",
",",
"method",
"=",
"'OpenImageIO'",
",",
"*",
"*",
"kwargs",
")",
":",
"method",
"=",
"validate_method",
"(",
"method",
",",
"READ_IMAGE_METHODS",
")",
"if",
"method",
"==",
"'openimageio... | https://github.com/colour-science/colour/blob/38782ac059e8ddd91939f3432bf06811c16667f0/colour/io/image.py#L309-L374 | |
pallets/werkzeug | 9efe8c00dcb2b6fc086961ba304729db01912652 | src/werkzeug/security.py | python | check_password_hash | (pwhash: str, password: str) | return hmac.compare_digest(_hash_internal(method, salt, password)[0], hashval) | Check a password against a given salted and hashed password value.
In order to support unsalted legacy passwords this method supports
plain text passwords, md5 and sha1 hashes (both salted and unsalted).
Returns `True` if the password matched, `False` otherwise.
:param pwhash: a hashed string like ret... | Check a password against a given salted and hashed password value.
In order to support unsalted legacy passwords this method supports
plain text passwords, md5 and sha1 hashes (both salted and unsalted). | [
"Check",
"a",
"password",
"against",
"a",
"given",
"salted",
"and",
"hashed",
"password",
"value",
".",
"In",
"order",
"to",
"support",
"unsalted",
"legacy",
"passwords",
"this",
"method",
"supports",
"plain",
"text",
"passwords",
"md5",
"and",
"sha1",
"hashes... | def check_password_hash(pwhash: str, password: str) -> bool:
"""Check a password against a given salted and hashed password value.
In order to support unsalted legacy passwords this method supports
plain text passwords, md5 and sha1 hashes (both salted and unsalted).
Returns `True` if the password matc... | [
"def",
"check_password_hash",
"(",
"pwhash",
":",
"str",
",",
"password",
":",
"str",
")",
"->",
"bool",
":",
"if",
"pwhash",
".",
"count",
"(",
"\"$\"",
")",
"<",
"2",
":",
"return",
"False",
"method",
",",
"salt",
",",
"hashval",
"=",
"pwhash",
"."... | https://github.com/pallets/werkzeug/blob/9efe8c00dcb2b6fc086961ba304729db01912652/src/werkzeug/security.py#L92-L107 | |
plotly/plotly.py | cfad7862594b35965c0e000813bd7805e8494a5b | packages/python/plotly/plotly/graph_objs/heatmap/_colorbar.py | python | ColorBar.tickvals | (self) | return self["tickvals"] | Sets the values at which ticks on this axis appear. Only has an
effect if `tickmode` is set to "array". Used with `ticktext`.
The 'tickvals' property is an array that may be specified as a tuple,
list, numpy array, or pandas Series
Returns
-------
numpy.ndarray | Sets the values at which ticks on this axis appear. Only has an
effect if `tickmode` is set to "array". Used with `ticktext`.
The 'tickvals' property is an array that may be specified as a tuple,
list, numpy array, or pandas Series | [
"Sets",
"the",
"values",
"at",
"which",
"ticks",
"on",
"this",
"axis",
"appear",
".",
"Only",
"has",
"an",
"effect",
"if",
"tickmode",
"is",
"set",
"to",
"array",
".",
"Used",
"with",
"ticktext",
".",
"The",
"tickvals",
"property",
"is",
"an",
"array",
... | def tickvals(self):
"""
Sets the values at which ticks on this axis appear. Only has an
effect if `tickmode` is set to "array". Used with `ticktext`.
The 'tickvals' property is an array that may be specified as a tuple,
list, numpy array, or pandas Series
Returns
... | [
"def",
"tickvals",
"(",
"self",
")",
":",
"return",
"self",
"[",
"\"tickvals\"",
"]"
] | https://github.com/plotly/plotly.py/blob/cfad7862594b35965c0e000813bd7805e8494a5b/packages/python/plotly/plotly/graph_objs/heatmap/_colorbar.py#L1082-L1094 | |
plaid/plaid-python | 8c60fca608e426f3ff30da8857775946d29e122c | plaid/model/transfer_cancel_request.py | python | TransferCancelRequest.__init__ | (self, transfer_id, *args, **kwargs) | TransferCancelRequest - a model defined in OpenAPI
Args:
transfer_id (str): Plaid’s unique identifier for a transfer.
Keyword Args:
_check_type (bool): if True, values for parameters in openapi_types
will be type checked and a TypeError will be
... | TransferCancelRequest - a model defined in OpenAPI | [
"TransferCancelRequest",
"-",
"a",
"model",
"defined",
"in",
"OpenAPI"
] | def __init__(self, transfer_id, *args, **kwargs): # noqa: E501
"""TransferCancelRequest - a model defined in OpenAPI
Args:
transfer_id (str): Plaid’s unique identifier for a transfer.
Keyword Args:
_check_type (bool): if True, values for parameters in openapi_types
... | [
"def",
"__init__",
"(",
"self",
",",
"transfer_id",
",",
"*",
"args",
",",
"*",
"*",
"kwargs",
")",
":",
"# noqa: E501",
"_check_type",
"=",
"kwargs",
".",
"pop",
"(",
"'_check_type'",
",",
"True",
")",
"_spec_property_naming",
"=",
"kwargs",
".",
"pop",
... | https://github.com/plaid/plaid-python/blob/8c60fca608e426f3ff30da8857775946d29e122c/plaid/model/transfer_cancel_request.py#L101-L173 | ||
coleifer/walrus | 2583ac8ba81d3f6aa43fccbe28c0c13b99a1fa9d | walrus/containers.py | python | Hash.values | (self) | return self.database.hvals(self.key) | Return the values stored in the hash. | Return the values stored in the hash. | [
"Return",
"the",
"values",
"stored",
"in",
"the",
"hash",
"."
] | def values(self):
"""Return the values stored in the hash."""
return self.database.hvals(self.key) | [
"def",
"values",
"(",
"self",
")",
":",
"return",
"self",
".",
"database",
".",
"hvals",
"(",
"self",
".",
"key",
")"
] | https://github.com/coleifer/walrus/blob/2583ac8ba81d3f6aa43fccbe28c0c13b99a1fa9d/walrus/containers.py#L170-L172 | |
larryhastings/gilectomy | 4315ec3f1d6d4f813cc82ce27a24e7f784dbfc1a | Lib/queue.py | python | Queue.join | (self) | Blocks until all items in the Queue have been gotten and processed.
The count of unfinished tasks goes up whenever an item is added to the
queue. The count goes down whenever a consumer thread calls task_done()
to indicate the item was retrieved and all work on it is complete.
When the... | Blocks until all items in the Queue have been gotten and processed. | [
"Blocks",
"until",
"all",
"items",
"in",
"the",
"Queue",
"have",
"been",
"gotten",
"and",
"processed",
"."
] | def join(self):
'''Blocks until all items in the Queue have been gotten and processed.
The count of unfinished tasks goes up whenever an item is added to the
queue. The count goes down whenever a consumer thread calls task_done()
to indicate the item was retrieved and all work on it is ... | [
"def",
"join",
"(",
"self",
")",
":",
"with",
"self",
".",
"all_tasks_done",
":",
"while",
"self",
".",
"unfinished_tasks",
":",
"self",
".",
"all_tasks_done",
".",
"wait",
"(",
")"
] | https://github.com/larryhastings/gilectomy/blob/4315ec3f1d6d4f813cc82ce27a24e7f784dbfc1a/Lib/queue.py#L72-L83 | ||
zhoubear/open-paperless | b42d4e3bc88343ca5803c613321327406eabca1a | mayan/apps/converter/classes.py | python | ConverterBase.soffice | (self) | Executes LibreOffice as a subprocess | Executes LibreOffice as a subprocess | [
"Executes",
"LibreOffice",
"as",
"a",
"subprocess"
] | def soffice(self):
"""
Executes LibreOffice as a subprocess
"""
if not LIBREOFFICE:
raise OfficeConversionError(
_('LibreOffice not installed or not found.')
)
new_file_object, input_filepath = mkstemp()
self.file_object.seek(0)
... | [
"def",
"soffice",
"(",
"self",
")",
":",
"if",
"not",
"LIBREOFFICE",
":",
"raise",
"OfficeConversionError",
"(",
"_",
"(",
"'LibreOffice not installed or not found.'",
")",
")",
"new_file_object",
",",
"input_filepath",
"=",
"mkstemp",
"(",
")",
"self",
".",
"fi... | https://github.com/zhoubear/open-paperless/blob/b42d4e3bc88343ca5803c613321327406eabca1a/mayan/apps/converter/classes.py#L114-L181 | ||
holzschu/Carnets | 44effb10ddfc6aa5c8b0687582a724ba82c6b547 | Library/lib/python3.7/turtle.py | python | RawTurtle.undobufferentries | (self) | return self.undobuffer.nr_of_items() | Return count of entries in the undobuffer.
No argument.
Example (for a Turtle instance named turtle):
>>> while undobufferentries():
... undo() | Return count of entries in the undobuffer. | [
"Return",
"count",
"of",
"entries",
"in",
"the",
"undobuffer",
"."
] | def undobufferentries(self):
"""Return count of entries in the undobuffer.
No argument.
Example (for a Turtle instance named turtle):
>>> while undobufferentries():
... undo()
"""
if self.undobuffer is None:
return 0
return self.undobuffe... | [
"def",
"undobufferentries",
"(",
"self",
")",
":",
"if",
"self",
".",
"undobuffer",
"is",
"None",
":",
"return",
"0",
"return",
"self",
".",
"undobuffer",
".",
"nr_of_items",
"(",
")"
] | https://github.com/holzschu/Carnets/blob/44effb10ddfc6aa5c8b0687582a724ba82c6b547/Library/lib/python3.7/turtle.py#L2603-L2614 | |
loli/medpy | 39131b94f0ab5328ab14a874229320efc2f74d98 | medpy/graphcut/generate.py | python | __boundary_term_label | (graph, label_image, boundary_term_args) | return {} | Fake regional_term function with the appropriate signature. | Fake regional_term function with the appropriate signature. | [
"Fake",
"regional_term",
"function",
"with",
"the",
"appropriate",
"signature",
"."
] | def __boundary_term_label(graph, label_image, boundary_term_args):
"""Fake regional_term function with the appropriate signature."""
# supplying no boundary term contradicts the whole graph cut idea.
return {} | [
"def",
"__boundary_term_label",
"(",
"graph",
",",
"label_image",
",",
"boundary_term_args",
")",
":",
"# supplying no boundary term contradicts the whole graph cut idea.",
"return",
"{",
"}"
] | https://github.com/loli/medpy/blob/39131b94f0ab5328ab14a874229320efc2f74d98/medpy/graphcut/generate.py#L311-L314 | |
ni/nidaqmx-python | 62fc6b48cbbb330fe1bcc9aedadc86610a1269b6 | nidaqmx/_task_modules/export_signals.py | python | ExportSignals.adv_cmplt_event_delay | (self, val) | [] | def adv_cmplt_event_delay(self, val):
cfunc = lib_importer.windll.DAQmxSetExportedAdvCmpltEventDelayVal
if cfunc.argtypes is None:
with cfunc.arglock:
if cfunc.argtypes is None:
cfunc.argtypes = [
lib_importer.task_handle, ctypes.c_... | [
"def",
"adv_cmplt_event_delay",
"(",
"self",
",",
"val",
")",
":",
"cfunc",
"=",
"lib_importer",
".",
"windll",
".",
"DAQmxSetExportedAdvCmpltEventDelayVal",
"if",
"cfunc",
".",
"argtypes",
"is",
"None",
":",
"with",
"cfunc",
".",
"arglock",
":",
"if",
"cfunc"... | https://github.com/ni/nidaqmx-python/blob/62fc6b48cbbb330fe1bcc9aedadc86610a1269b6/nidaqmx/_task_modules/export_signals.py#L47-L57 | ||||
Antergos/Cnchi | 13ac2209da9432d453e0097cf48a107640b563a9 | src/widgets/zfs_treeview.py | python | ZFSTreeview.get_num_drives | (self) | return num_drives | Returns number of active drives that will conform the zfs pool | Returns number of active drives that will conform the zfs pool | [
"Returns",
"number",
"of",
"active",
"drives",
"that",
"will",
"conform",
"the",
"zfs",
"pool"
] | def get_num_drives(self):
""" Returns number of active drives that will conform the zfs pool """
num_drives = 0
for row in self.device_list_store:
if row[ZFSTreeview.COL_USE_ACTIVE]:
num_drives += 1
return num_drives | [
"def",
"get_num_drives",
"(",
"self",
")",
":",
"num_drives",
"=",
"0",
"for",
"row",
"in",
"self",
".",
"device_list_store",
":",
"if",
"row",
"[",
"ZFSTreeview",
".",
"COL_USE_ACTIVE",
"]",
":",
"num_drives",
"+=",
"1",
"return",
"num_drives"
] | https://github.com/Antergos/Cnchi/blob/13ac2209da9432d453e0097cf48a107640b563a9/src/widgets/zfs_treeview.py#L175-L181 | |
IJDykeman/wangTiles | 7c1ee2095ebdf7f72bce07d94c6484915d5cae8b | experimental_code/tiles_3d/venv/lib/python2.7/site-packages/setuptools/py26compat.py | python | strip_fragment | (url) | return url | In `Python 8280 <http://bugs.python.org/issue8280>`_, Python 2.7 and
later was patched to disregard the fragment when making URL requests.
Do the same for Python 2.6 and earlier. | In `Python 8280 <http://bugs.python.org/issue8280>`_, Python 2.7 and
later was patched to disregard the fragment when making URL requests.
Do the same for Python 2.6 and earlier. | [
"In",
"Python",
"8280",
"<http",
":",
"//",
"bugs",
".",
"python",
".",
"org",
"/",
"issue8280",
">",
"_",
"Python",
"2",
".",
"7",
"and",
"later",
"was",
"patched",
"to",
"disregard",
"the",
"fragment",
"when",
"making",
"URL",
"requests",
".",
"Do",
... | def strip_fragment(url):
"""
In `Python 8280 <http://bugs.python.org/issue8280>`_, Python 2.7 and
later was patched to disregard the fragment when making URL requests.
Do the same for Python 2.6 and earlier.
"""
url, fragment = splittag(url)
return url | [
"def",
"strip_fragment",
"(",
"url",
")",
":",
"url",
",",
"fragment",
"=",
"splittag",
"(",
"url",
")",
"return",
"url"
] | https://github.com/IJDykeman/wangTiles/blob/7c1ee2095ebdf7f72bce07d94c6484915d5cae8b/experimental_code/tiles_3d/venv/lib/python2.7/site-packages/setuptools/py26compat.py#L9-L16 | |
openedx/edx-platform | 68dd185a0ab45862a2a61e0f803d7e03d2be71b5 | lms/djangoapps/teams/api.py | python | is_instructor_managed_team | (team) | return is_instructor_managed_topic(team.course_id, team.topic_id) | Return true if the team is managed by instructors. | Return true if the team is managed by instructors. | [
"Return",
"true",
"if",
"the",
"team",
"is",
"managed",
"by",
"instructors",
"."
] | def is_instructor_managed_team(team):
"""
Return true if the team is managed by instructors.
"""
if not team:
return False
return is_instructor_managed_topic(team.course_id, team.topic_id) | [
"def",
"is_instructor_managed_team",
"(",
"team",
")",
":",
"if",
"not",
"team",
":",
"return",
"False",
"return",
"is_instructor_managed_topic",
"(",
"team",
".",
"course_id",
",",
"team",
".",
"topic_id",
")"
] | https://github.com/openedx/edx-platform/blob/68dd185a0ab45862a2a61e0f803d7e03d2be71b5/lms/djangoapps/teams/api.py#L96-L102 | |
caktux/pytrader | b45b216dab3db78d6028d85e9a6f80419c22cea0 | api.py | python | Api._on_order_not_found | (self, msg) | this means we have sent order/cancel with non-existing oid | this means we have sent order/cancel with non-existing oid | [
"this",
"means",
"we",
"have",
"sent",
"order",
"/",
"cancel",
"with",
"non",
"-",
"existing",
"oid"
] | def _on_order_not_found(self, msg):
"""this means we have sent order/cancel with non-existing oid"""
parts = msg["id"].split(":")
oid = parts[1]
self.debug("### got 'Order not found' for", oid)
# we are now going to fake a user_order message (the one we
# obviously missed... | [
"def",
"_on_order_not_found",
"(",
"self",
",",
"msg",
")",
":",
"parts",
"=",
"msg",
"[",
"\"id\"",
"]",
".",
"split",
"(",
"\":\"",
")",
"oid",
"=",
"parts",
"[",
"1",
"]",
"self",
".",
"debug",
"(",
"\"### got 'Order not found' for\"",
",",
"oid",
"... | https://github.com/caktux/pytrader/blob/b45b216dab3db78d6028d85e9a6f80419c22cea0/api.py#L1155-L1164 | ||
microsoft/unilm | 65f15af2a307ebb64cfb25adf54375b002e6fe8d | xtune/src/transformers/tokenization_gpt2.py | python | GPT2Tokenizer.convert_tokens_to_string | (self, tokens) | return text | Converts a sequence of tokens (string) in a single string. | Converts a sequence of tokens (string) in a single string. | [
"Converts",
"a",
"sequence",
"of",
"tokens",
"(",
"string",
")",
"in",
"a",
"single",
"string",
"."
] | def convert_tokens_to_string(self, tokens):
""" Converts a sequence of tokens (string) in a single string. """
text = "".join(tokens)
text = bytearray([self.byte_decoder[c] for c in text]).decode("utf-8", errors=self.errors)
return text | [
"def",
"convert_tokens_to_string",
"(",
"self",
",",
"tokens",
")",
":",
"text",
"=",
"\"\"",
".",
"join",
"(",
"tokens",
")",
"text",
"=",
"bytearray",
"(",
"[",
"self",
".",
"byte_decoder",
"[",
"c",
"]",
"for",
"c",
"in",
"text",
"]",
")",
".",
... | https://github.com/microsoft/unilm/blob/65f15af2a307ebb64cfb25adf54375b002e6fe8d/xtune/src/transformers/tokenization_gpt2.py#L239-L243 | |
oracle/graalpython | 577e02da9755d916056184ec441c26e00b70145c | graalpython/lib-python/3/encodings/cp875.py | python | Codec.decode | (self,input,errors='strict') | return codecs.charmap_decode(input,errors,decoding_table) | [] | def decode(self,input,errors='strict'):
return codecs.charmap_decode(input,errors,decoding_table) | [
"def",
"decode",
"(",
"self",
",",
"input",
",",
"errors",
"=",
"'strict'",
")",
":",
"return",
"codecs",
".",
"charmap_decode",
"(",
"input",
",",
"errors",
",",
"decoding_table",
")"
] | https://github.com/oracle/graalpython/blob/577e02da9755d916056184ec441c26e00b70145c/graalpython/lib-python/3/encodings/cp875.py#L14-L15 | |||
barseghyanartur/django-fobi | a998feae007d7fe3637429a80e42952ec7cda79f | src/fobi/base.py | python | get_registered_form_callbacks | (stage=None) | return form_callback_registry.get_callbacks(stage=stage) | Get registered form callbacks for the stage given. | Get registered form callbacks for the stage given. | [
"Get",
"registered",
"form",
"callbacks",
"for",
"the",
"stage",
"given",
"."
] | def get_registered_form_callbacks(stage=None):
"""Get registered form callbacks for the stage given."""
return form_callback_registry.get_callbacks(stage=stage) | [
"def",
"get_registered_form_callbacks",
"(",
"stage",
"=",
"None",
")",
":",
"return",
"form_callback_registry",
".",
"get_callbacks",
"(",
"stage",
"=",
"stage",
")"
] | https://github.com/barseghyanartur/django-fobi/blob/a998feae007d7fe3637429a80e42952ec7cda79f/src/fobi/base.py#L3527-L3529 | |
DonnchaC/shadowbrokers-exploits | 42d8265db860b634717da4faa668b2670457cf7e | windows/fuzzbunch/pyreadline/modes/notemacs.py | python | NotEmacsMode.beginning_of_line | (self, e) | Move to the start of the current line. | Move to the start of the current line. | [
"Move",
"to",
"the",
"start",
"of",
"the",
"current",
"line",
"."
] | def beginning_of_line(self, e): # (C-a)
'''Move to the start of the current line. '''
self.l_buffer.beginning_of_line() | [
"def",
"beginning_of_line",
"(",
"self",
",",
"e",
")",
":",
"# (C-a)",
"self",
".",
"l_buffer",
".",
"beginning_of_line",
"(",
")"
] | https://github.com/DonnchaC/shadowbrokers-exploits/blob/42d8265db860b634717da4faa668b2670457cf7e/windows/fuzzbunch/pyreadline/modes/notemacs.py#L93-L95 | ||
openid/python-openid | afa6adacbe1a41d8f614c8bce2264dfbe9e76489 | openid/extensions/draft/pape2.py | python | Request.parseExtensionArgs | (self, args) | Set the state of this request to be that expressed in these
PAPE arguments
@param args: The PAPE arguments without a namespace
@rtype: None
@raises ValueError: When the max_auth_age is not parseable as
an integer | Set the state of this request to be that expressed in these
PAPE arguments | [
"Set",
"the",
"state",
"of",
"this",
"request",
"to",
"be",
"that",
"expressed",
"in",
"these",
"PAPE",
"arguments"
] | def parseExtensionArgs(self, args):
"""Set the state of this request to be that expressed in these
PAPE arguments
@param args: The PAPE arguments without a namespace
@rtype: None
@raises ValueError: When the max_auth_age is not parseable as
an integer
"""
... | [
"def",
"parseExtensionArgs",
"(",
"self",
",",
"args",
")",
":",
"# preferred_auth_policies is a space-separated list of policy URIs",
"self",
".",
"preferred_auth_policies",
"=",
"[",
"]",
"policies_str",
"=",
"args",
".",
"get",
"(",
"'preferred_auth_policies'",
")",
... | https://github.com/openid/python-openid/blob/afa6adacbe1a41d8f614c8bce2264dfbe9e76489/openid/extensions/draft/pape2.py#L110-L139 | ||
openhatch/oh-mainline | ce29352a034e1223141dcc2f317030bbc3359a51 | vendor/packages/Django/django/db/backends/mysql/base.py | python | DatabaseWrapper.check_constraints | (self, table_names=None) | Checks each table name in `table_names` for rows with invalid foreign key references. This method is
intended to be used in conjunction with `disable_constraint_checking()` and `enable_constraint_checking()`, to
determine if rows with invalid references were entered while constraint checks were off.
... | Checks each table name in `table_names` for rows with invalid foreign key references. This method is
intended to be used in conjunction with `disable_constraint_checking()` and `enable_constraint_checking()`, to
determine if rows with invalid references were entered while constraint checks were off. | [
"Checks",
"each",
"table",
"name",
"in",
"table_names",
"for",
"rows",
"with",
"invalid",
"foreign",
"key",
"references",
".",
"This",
"method",
"is",
"intended",
"to",
"be",
"used",
"in",
"conjunction",
"with",
"disable_constraint_checking",
"()",
"and",
"enabl... | def check_constraints(self, table_names=None):
"""
Checks each table name in `table_names` for rows with invalid foreign key references. This method is
intended to be used in conjunction with `disable_constraint_checking()` and `enable_constraint_checking()`, to
determine if rows with in... | [
"def",
"check_constraints",
"(",
"self",
",",
"table_names",
"=",
"None",
")",
":",
"cursor",
"=",
"self",
".",
"cursor",
"(",
")",
"if",
"table_names",
"is",
"None",
":",
"table_names",
"=",
"self",
".",
"introspection",
".",
"table_names",
"(",
"cursor",... | https://github.com/openhatch/oh-mainline/blob/ce29352a034e1223141dcc2f317030bbc3359a51/vendor/packages/Django/django/db/backends/mysql/base.py#L459-L492 | ||
titu1994/progressive-neural-architecture-search | b180b63fe0c79a65400c3f64888257845889ee8f | manager.py | python | NetworkManager.get_rewards | (self, model_fn, actions, display_model_summary=True) | return reward | Creates a subnetwork given the actions predicted by the controller RNN,
trains it on the provided dataset, and then returns a reward.
# Args:
model_fn: a function which accepts one argument, a list of
parsed actions, obtained via an inverse mapping from the
S... | Creates a subnetwork given the actions predicted by the controller RNN,
trains it on the provided dataset, and then returns a reward. | [
"Creates",
"a",
"subnetwork",
"given",
"the",
"actions",
"predicted",
"by",
"the",
"controller",
"RNN",
"trains",
"it",
"on",
"the",
"provided",
"dataset",
"and",
"then",
"returns",
"a",
"reward",
"."
] | def get_rewards(self, model_fn, actions, display_model_summary=True):
'''
Creates a subnetwork given the actions predicted by the controller RNN,
trains it on the provided dataset, and then returns a reward.
# Args:
model_fn: a function which accepts one argument, a list of
... | [
"def",
"get_rewards",
"(",
"self",
",",
"model_fn",
",",
"actions",
",",
"display_model_summary",
"=",
"True",
")",
":",
"if",
"tf",
".",
"test",
".",
"is_gpu_available",
"(",
")",
":",
"device",
"=",
"'/gpu:0'",
"else",
":",
"device",
"=",
"'/cpu:0'",
"... | https://github.com/titu1994/progressive-neural-architecture-search/blob/b180b63fe0c79a65400c3f64888257845889ee8f/manager.py#L39-L174 | |
ctxis/CAPE | dae9fa6a254ecdbabeb7eb0d2389fa63722c1e82 | lib/cuckoo/common/abstracts.py | python | Machinery.set_status | (self, label, status) | Set status for a virtual machine.
@param label: virtual machine label
@param status: new virtual machine status | Set status for a virtual machine. | [
"Set",
"status",
"for",
"a",
"virtual",
"machine",
"."
] | def set_status(self, label, status):
"""Set status for a virtual machine.
@param label: virtual machine label
@param status: new virtual machine status
"""
self.db.set_machine_status(label, status) | [
"def",
"set_status",
"(",
"self",
",",
"label",
",",
"status",
")",
":",
"self",
".",
"db",
".",
"set_machine_status",
"(",
"label",
",",
"status",
")"
] | https://github.com/ctxis/CAPE/blob/dae9fa6a254ecdbabeb7eb0d2389fa63722c1e82/lib/cuckoo/common/abstracts.py#L288-L293 | ||
biocore/qiime | 76d633c0389671e93febbe1338b5ded658eba31f | qiime/workflow/downstream.py | python | run_alpha_rarefaction | (otu_table_fp,
mapping_fp,
output_dir,
command_handler,
params,
qiime_config,
tree_fp=None,
num_steps=10,
parall... | Run the data preparation steps of Qiime
The steps performed by this function are:
1) Generate rarefied OTU tables;
2) Compute alpha diversity metrics for each rarefied OTU table;
3) Collate alpha diversity results;
4) Generate alpha rarefaction plots. | Run the data preparation steps of Qiime | [
"Run",
"the",
"data",
"preparation",
"steps",
"of",
"Qiime"
] | def run_alpha_rarefaction(otu_table_fp,
mapping_fp,
output_dir,
command_handler,
params,
qiime_config,
tree_fp=None,
num_steps=10,
... | [
"def",
"run_alpha_rarefaction",
"(",
"otu_table_fp",
",",
"mapping_fp",
",",
"output_dir",
",",
"command_handler",
",",
"params",
",",
"qiime_config",
",",
"tree_fp",
"=",
"None",
",",
"num_steps",
"=",
"10",
",",
"parallel",
"=",
"False",
",",
"logger",
"=",
... | https://github.com/biocore/qiime/blob/76d633c0389671e93febbe1338b5ded658eba31f/qiime/workflow/downstream.py#L188-L342 | ||
cloudera/hue | 23f02102d4547c17c32bd5ea0eb24e9eadd657a4 | desktop/core/ext-py/docutils-0.14/docutils/utils/error_reporting.py | python | ErrorOutput.write | (self, data) | Write `data` to self.stream. Ignore, if self.stream is False.
`data` can be a `string`, `unicode`, or `Exception` instance. | Write `data` to self.stream. Ignore, if self.stream is False. | [
"Write",
"data",
"to",
"self",
".",
"stream",
".",
"Ignore",
"if",
"self",
".",
"stream",
"is",
"False",
"."
] | def write(self, data):
"""
Write `data` to self.stream. Ignore, if self.stream is False.
`data` can be a `string`, `unicode`, or `Exception` instance.
"""
if self.stream is False:
return
if isinstance(data, Exception):
data = unicode(SafeString(da... | [
"def",
"write",
"(",
"self",
",",
"data",
")",
":",
"if",
"self",
".",
"stream",
"is",
"False",
":",
"return",
"if",
"isinstance",
"(",
"data",
",",
"Exception",
")",
":",
"data",
"=",
"unicode",
"(",
"SafeString",
"(",
"data",
",",
"self",
".",
"e... | https://github.com/cloudera/hue/blob/23f02102d4547c17c32bd5ea0eb24e9eadd657a4/desktop/core/ext-py/docutils-0.14/docutils/utils/error_reporting.py#L187-L211 | ||
JiYou/openstack | 8607dd488bde0905044b303eb6e52bdea6806923 | packages/source/glance/glance/openstack/common/notifier/api.py | python | notify | (context, publisher_id, event_type, priority, payload) | Sends a notification using the specified driver
:param publisher_id: the source worker_type.host of the message
:param event_type: the literal type of event (ex. Instance Creation)
:param priority: patterned after the enumeration of Python logging
levels in the set (DEBUG, WA... | Sends a notification using the specified driver | [
"Sends",
"a",
"notification",
"using",
"the",
"specified",
"driver"
] | def notify(context, publisher_id, event_type, priority, payload):
"""Sends a notification using the specified driver
:param publisher_id: the source worker_type.host of the message
:param event_type: the literal type of event (ex. Instance Creation)
:param priority: patterned after the enumeratio... | [
"def",
"notify",
"(",
"context",
",",
"publisher_id",
",",
"event_type",
",",
"priority",
",",
"payload",
")",
":",
"if",
"priority",
"not",
"in",
"log_levels",
":",
"raise",
"BadPriorityException",
"(",
"_",
"(",
"'%s not in valid priorities'",
")",
"%",
"pri... | https://github.com/JiYou/openstack/blob/8607dd488bde0905044b303eb6e52bdea6806923/packages/source/glance/glance/openstack/common/notifier/api.py#L92-L145 | ||
baidu/knowledge-driven-dialogue | ba85518a1ac2a57988188fc5f2b8fe42e1facf64 | generative_pt/source/utils/metrics.py | python | EmbeddingMetrics.__init__ | (self, field) | [] | def __init__(self, field):
self.field = field
assert field.embeddings is not None
self.embeddings = np.array(field.embeddings) | [
"def",
"__init__",
"(",
"self",
",",
"field",
")",
":",
"self",
".",
"field",
"=",
"field",
"assert",
"field",
".",
"embeddings",
"is",
"not",
"None",
"self",
".",
"embeddings",
"=",
"np",
".",
"array",
"(",
"field",
".",
"embeddings",
")"
] | https://github.com/baidu/knowledge-driven-dialogue/blob/ba85518a1ac2a57988188fc5f2b8fe42e1facf64/generative_pt/source/utils/metrics.py#L132-L135 | ||||
DataIntegrationAlliance/data_integration_celery | 6775292030213dd1fa33a1ec0f542d5d2d2e612a | tasks/wind/index.py | python | import_index_info | (wind_codes, chain_param=None) | 导入指数信息
:param wind_codes:
:return: | 导入指数信息
:param wind_codes:
:return: | [
"导入指数信息",
":",
"param",
"wind_codes",
":",
":",
"return",
":"
] | def import_index_info(wind_codes, chain_param=None):
"""
导入指数信息
:param wind_codes:
:return:
"""
table_name = 'wind_index_info'
has_table = engine_md.has_table(table_name)
col_name_param_list = [
('LAUNCHDATE', Date),
('BASEDATE', Date),
('BASEVALUE', DOUBLE),
... | [
"def",
"import_index_info",
"(",
"wind_codes",
",",
"chain_param",
"=",
"None",
")",
":",
"table_name",
"=",
"'wind_index_info'",
"has_table",
"=",
"engine_md",
".",
"has_table",
"(",
"table_name",
")",
"col_name_param_list",
"=",
"[",
"(",
"'LAUNCHDATE'",
",",
... | https://github.com/DataIntegrationAlliance/data_integration_celery/blob/6775292030213dd1fa33a1ec0f542d5d2d2e612a/tasks/wind/index.py#L145-L191 | ||
pyg-team/pytorch_geometric | b920e9a3a64e22c8356be55301c88444ff051cae | torch_geometric/datasets/ogb_mag.py | python | OGB_MAG.download | (self) | [] | def download(self):
if not all([osp.exists(f) for f in self.raw_paths[:5]]):
path = download_url(self.url, self.raw_dir)
extract_zip(path, self.raw_dir)
for file_name in ['node-feat', 'node-label', 'relations']:
path = osp.join(self.raw_dir, 'mag', 'raw', file... | [
"def",
"download",
"(",
"self",
")",
":",
"if",
"not",
"all",
"(",
"[",
"osp",
".",
"exists",
"(",
"f",
")",
"for",
"f",
"in",
"self",
".",
"raw_paths",
"[",
":",
"5",
"]",
"]",
")",
":",
"path",
"=",
"download_url",
"(",
"self",
".",
"url",
... | https://github.com/pyg-team/pytorch_geometric/blob/b920e9a3a64e22c8356be55301c88444ff051cae/torch_geometric/datasets/ogb_mag.py#L92-L108 | ||||
fortharris/Pcode | 147962d160a834c219e12cb456abc130826468e4 | rope/refactor/patchedast.py | python | _PatchingASTWalker._Assert | (self, node) | [] | def _Assert(self, node):
children = ['assert', node.test]
if node.msg:
children.append(',')
children.append(node.msg)
self._handle(node, children) | [
"def",
"_Assert",
"(",
"self",
",",
"node",
")",
":",
"children",
"=",
"[",
"'assert'",
",",
"node",
".",
"test",
"]",
"if",
"node",
".",
"msg",
":",
"children",
".",
"append",
"(",
"','",
")",
"children",
".",
"append",
"(",
"node",
".",
"msg",
... | https://github.com/fortharris/Pcode/blob/147962d160a834c219e12cb456abc130826468e4/rope/refactor/patchedast.py#L229-L234 | ||||
JetBrains/python-skeletons | 95ad24b666e475998e5d1cc02ed53a2188036167 | os/__init__.py | python | execle | (path, *args) | Execute a new program, replacing the current process.
:type path: bytes | unicode
:rtype: None | Execute a new program, replacing the current process. | [
"Execute",
"a",
"new",
"program",
"replacing",
"the",
"current",
"process",
"."
] | def execle(path, *args):
"""Execute a new program, replacing the current process.
:type path: bytes | unicode
:rtype: None
"""
pass | [
"def",
"execle",
"(",
"path",
",",
"*",
"args",
")",
":",
"pass"
] | https://github.com/JetBrains/python-skeletons/blob/95ad24b666e475998e5d1cc02ed53a2188036167/os/__init__.py#L1005-L1011 | ||
joerick/pyinstrument | d3c45164a385021f366c1081baec18a1a226a573 | metrics/multi_overhead.py | python | time_base | (function, repeats) | return timer.repeat(number=repeats) | [] | def time_base(function, repeats):
timer = Timer(stmt=function)
return timer.repeat(number=repeats) | [
"def",
"time_base",
"(",
"function",
",",
"repeats",
")",
":",
"timer",
"=",
"Timer",
"(",
"stmt",
"=",
"function",
")",
"return",
"timer",
".",
"repeat",
"(",
"number",
"=",
"repeats",
")"
] | https://github.com/joerick/pyinstrument/blob/d3c45164a385021f366c1081baec18a1a226a573/metrics/multi_overhead.py#L40-L42 | |||
tdamdouni/Pythonista | 3e082d53b6b9b501a3c8cf3251a8ad4c8be9c2ad | installer/pexif.py | python | IfdData.isifd | (self, other) | return issubclass(other.__class__, IfdData) | Return true if other is an IFD | Return true if other is an IFD | [
"Return",
"true",
"if",
"other",
"is",
"an",
"IFD"
] | def isifd(self, other):
"""Return true if other is an IFD"""
return issubclass(other.__class__, IfdData) | [
"def",
"isifd",
"(",
"self",
",",
"other",
")",
":",
"return",
"issubclass",
"(",
"other",
".",
"__class__",
",",
"IfdData",
")"
] | https://github.com/tdamdouni/Pythonista/blob/3e082d53b6b9b501a3c8cf3251a8ad4c8be9c2ad/installer/pexif.py#L471-L473 | |
h2oai/h2o4gpu | aaf7795d3c3be430129eacfd99d598da0cc838e7 | src/interface_py/h2o4gpu/solvers/truncated_svd.py | python | TruncatedSVDH2O.transform | (self, X) | return X_new | Perform dimensionality reduction on X.
:param X : {array-like, sparse matrix}, shape (n_samples, n_features)
Training data.
:returns X_new : array, shape (n_samples, n_components)
Reduced version of X. This will always
be a dense arra... | Perform dimensionality reduction on X. | [
"Perform",
"dimensionality",
"reduction",
"on",
"X",
"."
] | def transform(self, X):
"""Perform dimensionality reduction on X.
:param X : {array-like, sparse matrix}, shape (n_samples, n_features)
Training data.
:returns X_new : array, shape (n_samples, n_components)
Reduced version of X. This will always
... | [
"def",
"transform",
"(",
"self",
",",
"X",
")",
":",
"fit",
"=",
"self",
".",
"fit",
"(",
"X",
")",
"X_new",
"=",
"fit",
".",
"U",
"*",
"fit",
".",
"singular_values_",
"return",
"X_new"
] | https://github.com/h2oai/h2o4gpu/blob/aaf7795d3c3be430129eacfd99d598da0cc838e7/src/interface_py/h2o4gpu/solvers/truncated_svd.py#L158-L171 | |
biopython/biopython | 2dd97e71762af7b046d7f7f8a4f1e38db6b06c86 | Bio/HMM/MarkovModel.py | python | HiddenMarkovModel.get_blank_transitions | (self) | return self._transition_pseudo | Get the default transitions for the model.
Returns a dictionary of all of the default transitions between any
two letters in the sequence alphabet. The dictionary is structured
with keys as (letter1, letter2) and values as the starting number
of transitions. | Get the default transitions for the model. | [
"Get",
"the",
"default",
"transitions",
"for",
"the",
"model",
"."
] | def get_blank_transitions(self):
"""Get the default transitions for the model.
Returns a dictionary of all of the default transitions between any
two letters in the sequence alphabet. The dictionary is structured
with keys as (letter1, letter2) and values as the starting number
... | [
"def",
"get_blank_transitions",
"(",
"self",
")",
":",
"return",
"self",
".",
"_transition_pseudo"
] | https://github.com/biopython/biopython/blob/2dd97e71762af7b046d7f7f8a4f1e38db6b06c86/Bio/HMM/MarkovModel.py#L509-L517 | |
project-alice-assistant/ProjectAlice | 9e0ba019643bdae0a5535c9fa4180739231dc361 | core/base/SkillManager.py | python | SkillManager.getSkillRepository | (self, skillName: str, directory: str = None) | Returns a Git object for the given skill
:param skillName:
:param directory: where to look for that skill, if not standard directory
:return: | Returns a Git object for the given skill
:param skillName:
:param directory: where to look for that skill, if not standard directory
:return: | [
"Returns",
"a",
"Git",
"object",
"for",
"the",
"given",
"skill",
":",
"param",
"skillName",
":",
":",
"param",
"directory",
":",
"where",
"to",
"look",
"for",
"that",
"skill",
"if",
"not",
"standard",
"directory",
":",
"return",
":"
] | def getSkillRepository(self, skillName: str, directory: str = None) -> Optional[Repository]:
"""
Returns a Git object for the given skill
:param skillName:
:param directory: where to look for that skill, if not standard directory
:return:
"""
if not directory:
directory = self.getSkillDirectory(skillN... | [
"def",
"getSkillRepository",
"(",
"self",
",",
"skillName",
":",
"str",
",",
"directory",
":",
"str",
"=",
"None",
")",
"->",
"Optional",
"[",
"Repository",
"]",
":",
"if",
"not",
"directory",
":",
"directory",
"=",
"self",
".",
"getSkillDirectory",
"(",
... | https://github.com/project-alice-assistant/ProjectAlice/blob/9e0ba019643bdae0a5535c9fa4180739231dc361/core/base/SkillManager.py#L393-L407 | ||
tdamdouni/Pythonista | 3e082d53b6b9b501a3c8cf3251a8ad4c8be9c2ad | weather/WeatherAnywhereScene-coomlata.py | python | SceneViewer.alerts | (self, sender) | Kill scene to cut memory overhead, textview then loads much faster into ui view. Note too that whene textview is loaded via .present() without killing the scene, the scene will lock up after closing the textview window. | Kill scene to cut memory overhead, textview then loads much faster into ui view. Note too that whene textview is loaded via .present() without killing the scene, the scene will lock up after closing the textview window. | [
"Kill",
"scene",
"to",
"cut",
"memory",
"overhead",
"textview",
"then",
"loads",
"much",
"faster",
"into",
"ui",
"view",
".",
"Note",
"too",
"that",
"whene",
"textview",
"is",
"loaded",
"via",
".",
"present",
"()",
"without",
"killing",
"the",
"scene",
"th... | def alerts(self, sender):
# Retrieve alerts
alerts = wa.get_alerts(json_w, json_f)
'''
Kill scene to cut memory overhead, textview then loads much faster into ui view. Note too that whene textview is loaded via .present() without killing the scene, the scene will lock up after closing the textview windo... | [
"def",
"alerts",
"(",
"self",
",",
"sender",
")",
":",
"# Retrieve alerts",
"alerts",
"=",
"wa",
".",
"get_alerts",
"(",
"json_w",
",",
"json_f",
")",
"self",
".",
"remove_subview",
"(",
"self",
".",
"scene_view",
")",
"tv",
"=",
"ui",
".",
"TextView",
... | https://github.com/tdamdouni/Pythonista/blob/3e082d53b6b9b501a3c8cf3251a8ad4c8be9c2ad/weather/WeatherAnywhereScene-coomlata.py#L431-L455 | ||
jacoxu/encoder_decoder | 6829c3bc42105aedfd1b8a81c81be19df4326c0a | keras/old_models.py | python | Model.to_json | (self, **kwargs) | return json.dumps(config, default=get_json_type, **kwargs) | Return a JSON string containing the model configuration.
To load a model from a JSON save file, use
`keras.models.from_json(json_string, custom_objects={})`. | Return a JSON string containing the model configuration. | [
"Return",
"a",
"JSON",
"string",
"containing",
"the",
"model",
"configuration",
"."
] | def to_json(self, **kwargs):
'''Return a JSON string containing the model configuration.
To load a model from a JSON save file, use
`keras.models.from_json(json_string, custom_objects={})`.
'''
import json
def get_json_type(obj):
# if obj is any numpy type
... | [
"def",
"to_json",
"(",
"self",
",",
"*",
"*",
"kwargs",
")",
":",
"import",
"json",
"def",
"get_json_type",
"(",
"obj",
")",
":",
"# if obj is any numpy type",
"if",
"type",
"(",
"obj",
")",
".",
"__module__",
"==",
"np",
".",
"__name__",
":",
"return",
... | https://github.com/jacoxu/encoder_decoder/blob/6829c3bc42105aedfd1b8a81c81be19df4326c0a/keras/old_models.py#L440-L460 | |
ragulpr/wtte-rnn | 162f5c17f21db79a316d563b60835d178142fd69 | python/wtte/wtte.py | python | loglik_continuous_conditional_correction | (y, u, a, b, epsilon=K.epsilon()) | return loglikelihoods | Integrated conditional excess loss.
Explanation TODO | Integrated conditional excess loss.
Explanation TODO | [
"Integrated",
"conditional",
"excess",
"loss",
".",
"Explanation",
"TODO"
] | def loglik_continuous_conditional_correction(y, u, a, b, epsilon=K.epsilon()):
"""Integrated conditional excess loss.
Explanation TODO
"""
ya = (y + epsilon) / a
loglikelihoods = y * \
(u * (K.log(b) + b * K.log(ya)) - (b / (b + 1.)) * K.pow(ya, b))
return loglikelihoods | [
"def",
"loglik_continuous_conditional_correction",
"(",
"y",
",",
"u",
",",
"a",
",",
"b",
",",
"epsilon",
"=",
"K",
".",
"epsilon",
"(",
")",
")",
":",
"ya",
"=",
"(",
"y",
"+",
"epsilon",
")",
"/",
"a",
"loglikelihoods",
"=",
"y",
"*",
"(",
"u",
... | https://github.com/ragulpr/wtte-rnn/blob/162f5c17f21db79a316d563b60835d178142fd69/python/wtte/wtte.py#L179-L186 | |
securesystemslab/zippy | ff0e84ac99442c2c55fe1d285332cfd4e185e089 | zippy/lib-python/3/http/client.py | python | HTTPResponse.close | (self) | [] | def close(self):
if self.fp:
self.fp.close()
self.fp = None | [
"def",
"close",
"(",
"self",
")",
":",
"if",
"self",
".",
"fp",
":",
"self",
".",
"fp",
".",
"close",
"(",
")",
"self",
".",
"fp",
"=",
"None"
] | https://github.com/securesystemslab/zippy/blob/ff0e84ac99442c2c55fe1d285332cfd4e185e089/zippy/lib-python/3/http/client.py#L449-L452 | ||||
appium/python-client | 72f942d2152ee1b0d7539f3bf2705b50d01133f7 | appium/webdriver/extensions/remote_fs.py | python | RemoteFS.push_file | (
self: T, destination_path: str, base64data: Optional[str] = None, source_path: Optional[str] = None
) | return self | Puts the data from the file at `source_path`, encoded as Base64, in the file specified as `path`.
Specify either `base64data` or `source_path`, if both specified default to `source_path`
Args:
destination_path: the location on the device/simulator where the local file contents should be sa... | Puts the data from the file at `source_path`, encoded as Base64, in the file specified as `path`. | [
"Puts",
"the",
"data",
"from",
"the",
"file",
"at",
"source_path",
"encoded",
"as",
"Base64",
"in",
"the",
"file",
"specified",
"as",
"path",
"."
] | def push_file(
self: T, destination_path: str, base64data: Optional[str] = None, source_path: Optional[str] = None
) -> T:
"""Puts the data from the file at `source_path`, encoded as Base64, in the file specified as `path`.
Specify either `base64data` or `source_path`, if both specified def... | [
"def",
"push_file",
"(",
"self",
":",
"T",
",",
"destination_path",
":",
"str",
",",
"base64data",
":",
"Optional",
"[",
"str",
"]",
"=",
"None",
",",
"source_path",
":",
"Optional",
"[",
"str",
"]",
"=",
"None",
")",
"->",
"T",
":",
"if",
"source_pa... | https://github.com/appium/python-client/blob/72f942d2152ee1b0d7539f3bf2705b50d01133f7/appium/webdriver/extensions/remote_fs.py#L59-L92 | |
home-assistant/core | 265ebd17a3f17ed8dc1e9bdede03ac8e323f1ab1 | homeassistant/components/satel_integra/__init__.py | python | async_setup | (hass: HomeAssistant, config: ConfigType) | return True | Set up the Satel Integra component. | Set up the Satel Integra component. | [
"Set",
"up",
"the",
"Satel",
"Integra",
"component",
"."
] | async def async_setup(hass: HomeAssistant, config: ConfigType) -> bool:
"""Set up the Satel Integra component."""
conf = config[DOMAIN]
zones = conf.get(CONF_ZONES)
outputs = conf.get(CONF_OUTPUTS)
switchable_outputs = conf.get(CONF_SWITCHABLE_OUTPUTS)
host = conf.get(CONF_HOST)
port = conf... | [
"async",
"def",
"async_setup",
"(",
"hass",
":",
"HomeAssistant",
",",
"config",
":",
"ConfigType",
")",
"->",
"bool",
":",
"conf",
"=",
"config",
"[",
"DOMAIN",
"]",
"zones",
"=",
"conf",
".",
"get",
"(",
"CONF_ZONES",
")",
"outputs",
"=",
"conf",
"."... | https://github.com/home-assistant/core/blob/265ebd17a3f17ed8dc1e9bdede03ac8e323f1ab1/homeassistant/components/satel_integra/__init__.py#L94-L180 | |
CouchPotato/CouchPotatoV1 | 135b3331d1b88ef645e29b76f2d4cc4a732c9232 | library/sqlalchemy/engine/base.py | python | ResultProxy.lastrowid | (self) | return self._saved_cursor.lastrowid | return the 'lastrowid' accessor on the DBAPI cursor.
This is a DBAPI specific method and is only functional
for those backends which support it, for statements
where it is appropriate. It's behavior is not
consistent across backends.
Usage of this method is no... | return the 'lastrowid' accessor on the DBAPI cursor.
This is a DBAPI specific method and is only functional
for those backends which support it, for statements
where it is appropriate. It's behavior is not
consistent across backends.
Usage of this method is no... | [
"return",
"the",
"lastrowid",
"accessor",
"on",
"the",
"DBAPI",
"cursor",
".",
"This",
"is",
"a",
"DBAPI",
"specific",
"method",
"and",
"is",
"only",
"functional",
"for",
"those",
"backends",
"which",
"support",
"it",
"for",
"statements",
"where",
"it",
"is"... | def lastrowid(self):
"""return the 'lastrowid' accessor on the DBAPI cursor.
This is a DBAPI specific method and is only functional
for those backends which support it, for statements
where it is appropriate. It's behavior is not
consistent across backends.
... | [
"def",
"lastrowid",
"(",
"self",
")",
":",
"return",
"self",
".",
"_saved_cursor",
".",
"lastrowid"
] | https://github.com/CouchPotato/CouchPotatoV1/blob/135b3331d1b88ef645e29b76f2d4cc4a732c9232/library/sqlalchemy/engine/base.py#L2293-L2307 | |
OCA/stock-logistics-warehouse | 185c1b0cb9e31e3746a89ec269b4bc09c69b2411 | stock_packaging_calculator/models/product.py | python | Product._product_qty_by_packaging | (self, pkg_by_qty, qty, with_contained=False) | return res | Produce a list of dictionaries of packaging info. | Produce a list of dictionaries of packaging info. | [
"Produce",
"a",
"list",
"of",
"dictionaries",
"of",
"packaging",
"info",
"."
] | def _product_qty_by_packaging(self, pkg_by_qty, qty, with_contained=False):
"""Produce a list of dictionaries of packaging info."""
# TODO: refactor to handle fractional quantities (eg: 0.5 Kg)
res = []
prepare_values = self.env.context.get(
"_packaging_values_handler", self.... | [
"def",
"_product_qty_by_packaging",
"(",
"self",
",",
"pkg_by_qty",
",",
"qty",
",",
"with_contained",
"=",
"False",
")",
":",
"# TODO: refactor to handle fractional quantities (eg: 0.5 Kg)",
"res",
"=",
"[",
"]",
"prepare_values",
"=",
"self",
".",
"env",
".",
"con... | https://github.com/OCA/stock-logistics-warehouse/blob/185c1b0cb9e31e3746a89ec269b4bc09c69b2411/stock_packaging_calculator/models/product.py#L113-L134 | |
VITA-Group/FasterSeg | 478b0265eb9ab626cfbe503ad16d2452878b38cc | latency/operations.py | python | ConvNorm.forward_latency | (self, size) | return latency, (c_out, h_out, w_out) | [] | def forward_latency(self, size):
c_in, h_in, w_in = size
if self.slimmable:
assert c_in == int(self.C_in * self.ratio[0]), "c_in %d, self.C_in * self.ratio[0] %d"%(c_in, self.C_in * self.ratio[0])
c_out = int(self.C_out * self.ratio[1])
else:
assert c_in == se... | [
"def",
"forward_latency",
"(",
"self",
",",
"size",
")",
":",
"c_in",
",",
"h_in",
",",
"w_in",
"=",
"size",
"if",
"self",
".",
"slimmable",
":",
"assert",
"c_in",
"==",
"int",
"(",
"self",
".",
"C_in",
"*",
"self",
".",
"ratio",
"[",
"0",
"]",
"... | https://github.com/VITA-Group/FasterSeg/blob/478b0265eb9ab626cfbe503ad16d2452878b38cc/latency/operations.py#L99-L119 | |||
HKUST-Aerial-Robotics/Stereo-RCNN | 63c6ab98b7a5e36c7bcfdec4529804fc940ee900 | lib/model/utils/blob.py | python | im_list_to_blob | (imgs_left, imgs_right) | return blob_left, blob_right | Convert a list of images into a network input.
Assumes images are already prepared (means subtracted, BGR order, ...). | Convert a list of images into a network input. | [
"Convert",
"a",
"list",
"of",
"images",
"into",
"a",
"network",
"input",
"."
] | def im_list_to_blob(imgs_left, imgs_right):
"""Convert a list of images into a network input.
Assumes images are already prepared (means subtracted, BGR order, ...).
"""
max_shape = np.array([im.shape for im in imgs_left]).max(axis=0)
num_images = len(imgs_left)
blob_left = np.zeros((num_images... | [
"def",
"im_list_to_blob",
"(",
"imgs_left",
",",
"imgs_right",
")",
":",
"max_shape",
"=",
"np",
".",
"array",
"(",
"[",
"im",
".",
"shape",
"for",
"im",
"in",
"imgs_left",
"]",
")",
".",
"max",
"(",
"axis",
"=",
"0",
")",
"num_images",
"=",
"len",
... | https://github.com/HKUST-Aerial-Robotics/Stereo-RCNN/blob/63c6ab98b7a5e36c7bcfdec4529804fc940ee900/lib/model/utils/blob.py#L20-L37 | |
quantopian/zipline | 014f1fc339dc8b7671d29be2d85ce57d3daec343 | zipline/pipeline/loaders/events.py | python | required_event_fields | (next_value_columns, previous_value_columns) | return {
TS_FIELD_NAME,
SID_FIELD_NAME,
EVENT_DATE_FIELD_NAME,
}.union(
# We also expect any of the field names that our loadable columns
# are mapped to.
viewvalues(next_value_columns),
viewvalues(previous_value_columns),
) | Compute the set of resource columns required to serve
``next_value_columns`` and ``previous_value_columns``. | Compute the set of resource columns required to serve
``next_value_columns`` and ``previous_value_columns``. | [
"Compute",
"the",
"set",
"of",
"resource",
"columns",
"required",
"to",
"serve",
"next_value_columns",
"and",
"previous_value_columns",
"."
] | def required_event_fields(next_value_columns, previous_value_columns):
"""
Compute the set of resource columns required to serve
``next_value_columns`` and ``previous_value_columns``.
"""
# These metadata columns are used to align event indexers.
return {
TS_FIELD_NAME,
SID_FIELD... | [
"def",
"required_event_fields",
"(",
"next_value_columns",
",",
"previous_value_columns",
")",
":",
"# These metadata columns are used to align event indexers.",
"return",
"{",
"TS_FIELD_NAME",
",",
"SID_FIELD_NAME",
",",
"EVENT_DATE_FIELD_NAME",
",",
"}",
".",
"union",
"(",
... | https://github.com/quantopian/zipline/blob/014f1fc339dc8b7671d29be2d85ce57d3daec343/zipline/pipeline/loaders/events.py#L21-L36 | |
openstack/heat | ea6633c35b04bb49c4a2858edc9df0a82d039478 | heat/engine/resources/openstack/heat/software_component.py | python | SoftwareComponent.validate | (self) | Validate SoftwareComponent properties consistency. | Validate SoftwareComponent properties consistency. | [
"Validate",
"SoftwareComponent",
"properties",
"consistency",
"."
] | def validate(self):
"""Validate SoftwareComponent properties consistency."""
super(SoftwareComponent, self).validate()
# One lifecycle action (e.g. CREATE) can only be associated with one
# config; otherwise a way to define ordering would be required.
configs = self.properties[s... | [
"def",
"validate",
"(",
"self",
")",
":",
"super",
"(",
"SoftwareComponent",
",",
"self",
")",
".",
"validate",
"(",
")",
"# One lifecycle action (e.g. CREATE) can only be associated with one",
"# config; otherwise a way to define ordering would be required.",
"configs",
"=",
... | https://github.com/openstack/heat/blob/ea6633c35b04bb49c4a2858edc9df0a82d039478/heat/engine/resources/openstack/heat/software_component.py#L140-L155 | ||
ajinabraham/OWASP-Xenotix-XSS-Exploit-Framework | cb692f527e4e819b6c228187c5702d990a180043 | external/Scripting Engine/Xenotix Python Scripting Engine/bin/x86/Debug/Lib/site-packages/Crypto/Hash/HMAC.py | python | HMAC.copy | (self) | return other | Return a copy ("clone") of the MAC object.
The copy will have the same internal state as the original MAC
object.
This can be used to efficiently compute the MAC of strings that
share a common initial substring.
:Returns: An `HMAC` object | Return a copy ("clone") of the MAC object. | [
"Return",
"a",
"copy",
"(",
"clone",
")",
"of",
"the",
"MAC",
"object",
"."
] | def copy(self):
"""Return a copy ("clone") of the MAC object.
The copy will have the same internal state as the original MAC
object.
This can be used to efficiently compute the MAC of strings that
share a common initial substring.
:Returns: An `HMAC` object
"""
... | [
"def",
"copy",
"(",
"self",
")",
":",
"other",
"=",
"HMAC",
"(",
"b",
"(",
"\"\"",
")",
")",
"other",
".",
"digestmod",
"=",
"self",
".",
"digestmod",
"other",
".",
"inner",
"=",
"self",
".",
"inner",
".",
"copy",
"(",
")",
"other",
".",
"outer",... | https://github.com/ajinabraham/OWASP-Xenotix-XSS-Exploit-Framework/blob/cb692f527e4e819b6c228187c5702d990a180043/external/Scripting Engine/Xenotix Python Scripting Engine/bin/x86/Debug/Lib/site-packages/Crypto/Hash/HMAC.py#L150-L164 | |
KalleHallden/AutoTimer | 2d954216700c4930baa154e28dbddc34609af7ce | env/lib/python2.7/site-packages/setuptools/_vendor/pyparsing.py | python | ParseExpression.__str__ | ( self ) | return self.strRepr | [] | def __str__( self ):
try:
return super(ParseExpression,self).__str__()
except Exception:
pass
if self.strRepr is None:
self.strRepr = "%s:(%s)" % ( self.__class__.__name__, _ustr(self.exprs) )
return self.strRepr | [
"def",
"__str__",
"(",
"self",
")",
":",
"try",
":",
"return",
"super",
"(",
"ParseExpression",
",",
"self",
")",
".",
"__str__",
"(",
")",
"except",
"Exception",
":",
"pass",
"if",
"self",
".",
"strRepr",
"is",
"None",
":",
"self",
".",
"strRepr",
"... | https://github.com/KalleHallden/AutoTimer/blob/2d954216700c4930baa154e28dbddc34609af7ce/env/lib/python2.7/site-packages/setuptools/_vendor/pyparsing.py#L3309-L3317 | |||
mardix/flask-cloudy | cf9f6f074e92af1d98f99fdf6ca458e29099e4b1 | flask_cloudy.py | python | get_file_extension_type | (filename) | return "OTHER" | Return the group associated to the file
:param filename:
:return: str | Return the group associated to the file
:param filename:
:return: str | [
"Return",
"the",
"group",
"associated",
"to",
"the",
"file",
":",
"param",
"filename",
":",
":",
"return",
":",
"str"
] | def get_file_extension_type(filename):
"""
Return the group associated to the file
:param filename:
:return: str
"""
ext = get_file_extension(filename)
if ext:
for name, group in EXTENSIONS.items():
if ext in group:
return name
return "OTHER" | [
"def",
"get_file_extension_type",
"(",
"filename",
")",
":",
"ext",
"=",
"get_file_extension",
"(",
"filename",
")",
"if",
"ext",
":",
"for",
"name",
",",
"group",
"in",
"EXTENSIONS",
".",
"items",
"(",
")",
":",
"if",
"ext",
"in",
"group",
":",
"return"... | https://github.com/mardix/flask-cloudy/blob/cf9f6f074e92af1d98f99fdf6ca458e29099e4b1/flask_cloudy.py#L70-L81 | |
pgmpy/pgmpy | 24279929a28082ea994c52f3d165ca63fc56b02b | pgmpy/models/SEM.py | python | SEMAlg.generate_samples | (self, n_samples=100) | return pd.DataFrame(samples, columns=observed) | Generates random samples from the model.
Parameters
----------
n_samples: int
The number of samples to generate.
Returns
-------
pd.DataFrame: The genrated samples. | Generates random samples from the model. | [
"Generates",
"random",
"samples",
"from",
"the",
"model",
"."
] | def generate_samples(self, n_samples=100):
"""
Generates random samples from the model.
Parameters
----------
n_samples: int
The number of samples to generate.
Returns
-------
pd.DataFrame: The genrated samples.
"""
if (self.B... | [
"def",
"generate_samples",
"(",
"self",
",",
"n_samples",
"=",
"100",
")",
":",
"if",
"(",
"self",
".",
"B_fixed_mask",
"is",
"None",
")",
"or",
"(",
"self",
".",
"zeta_fixed_mask",
"is",
"None",
")",
":",
"raise",
"ValueError",
"(",
"\"Parameters for the ... | https://github.com/pgmpy/pgmpy/blob/24279929a28082ea994c52f3d165ca63fc56b02b/pgmpy/models/SEM.py#L952-L990 | |
zhl2008/awd-platform | 0416b31abea29743387b10b3914581fbe8e7da5e | web_flaskbb/lib/python2.7/site-packages/mako/ext/babelplugin.py | python | BabelMakoExtractor.process_python | (self, code, code_lineno, translator_strings) | [] | def process_python(self, code, code_lineno, translator_strings):
comment_tags = self.config['comment-tags']
for lineno, funcname, messages, python_translator_comments \
in extract_python(code,
self.keywords, comment_tags, self.options):
yield... | [
"def",
"process_python",
"(",
"self",
",",
"code",
",",
"code_lineno",
",",
"translator_strings",
")",
":",
"comment_tags",
"=",
"self",
".",
"config",
"[",
"'comment-tags'",
"]",
"for",
"lineno",
",",
"funcname",
",",
"messages",
",",
"python_translator_comment... | https://github.com/zhl2008/awd-platform/blob/0416b31abea29743387b10b3914581fbe8e7da5e/web_flaskbb/lib/python2.7/site-packages/mako/ext/babelplugin.py#L27-L33 | ||||
replit-archive/empythoned | 977ec10ced29a3541a4973dc2b59910805695752 | cpython/Lib/compiler/pycodegen.py | python | CodeGenerator._implicitNameOp | (self, prefix, name) | Emit name ops for names generated implicitly by for loops
The interpreter generates names that start with a period or
dollar sign. The symbol table ignores these names because
they aren't present in the program text. | Emit name ops for names generated implicitly by for loops | [
"Emit",
"name",
"ops",
"for",
"names",
"generated",
"implicitly",
"by",
"for",
"loops"
] | def _implicitNameOp(self, prefix, name):
"""Emit name ops for names generated implicitly by for loops
The interpreter generates names that start with a period or
dollar sign. The symbol table ignores these names because
they aren't present in the program text.
"""
if se... | [
"def",
"_implicitNameOp",
"(",
"self",
",",
"prefix",
",",
"name",
")",
":",
"if",
"self",
".",
"optimized",
":",
"self",
".",
"emit",
"(",
"prefix",
"+",
"'_FAST'",
",",
"name",
")",
"else",
":",
"self",
".",
"emit",
"(",
"prefix",
"+",
"'_NAME'",
... | https://github.com/replit-archive/empythoned/blob/977ec10ced29a3541a4973dc2b59910805695752/cpython/Lib/compiler/pycodegen.py#L299-L309 | ||
Xyntax/DirBrute | 84a54013f57a4588add9c2032c7c6c0902e6f504 | libs/requests/models.py | python | Response.json | (self, **kwargs) | return json.loads(self.text, **kwargs) | Returns the json-encoded content of a response, if any.
:param \*\*kwargs: Optional arguments that ``json.loads`` takes. | Returns the json-encoded content of a response, if any. | [
"Returns",
"the",
"json",
"-",
"encoded",
"content",
"of",
"a",
"response",
"if",
"any",
"."
] | def json(self, **kwargs):
"""Returns the json-encoded content of a response, if any.
:param \*\*kwargs: Optional arguments that ``json.loads`` takes.
"""
if not self.encoding and len(self.content) > 3:
# No encoding set. JSON RFC 4627 section 3 states we should expect
... | [
"def",
"json",
"(",
"self",
",",
"*",
"*",
"kwargs",
")",
":",
"if",
"not",
"self",
".",
"encoding",
"and",
"len",
"(",
"self",
".",
"content",
")",
">",
"3",
":",
"# No encoding set. JSON RFC 4627 section 3 states we should expect",
"# UTF-8, -16 or -32. Detect w... | https://github.com/Xyntax/DirBrute/blob/84a54013f57a4588add9c2032c7c6c0902e6f504/libs/requests/models.py#L778-L799 | |
hyde/hyde | 7f415402cc3e007a746eb2b5bc102281fdb415bd | hyde/ext/plugins/structure.py | python | FlattenerPlugin.begin_site | (self) | Finds all the folders that need flattening and changes the
relative deploy path of all resources in those folders. | Finds all the folders that need flattening and changes the
relative deploy path of all resources in those folders. | [
"Finds",
"all",
"the",
"folders",
"that",
"need",
"flattening",
"and",
"changes",
"the",
"relative",
"deploy",
"path",
"of",
"all",
"resources",
"in",
"those",
"folders",
"."
] | def begin_site(self):
"""
Finds all the folders that need flattening and changes the
relative deploy path of all resources in those folders.
"""
items = []
try:
items = self.site.config.flattener.items
except AttributeError:
pass
f... | [
"def",
"begin_site",
"(",
"self",
")",
":",
"items",
"=",
"[",
"]",
"try",
":",
"items",
"=",
"self",
".",
"site",
".",
"config",
".",
"flattener",
".",
"items",
"except",
"AttributeError",
":",
"pass",
"for",
"item",
"in",
"items",
":",
"node",
"=",... | https://github.com/hyde/hyde/blob/7f415402cc3e007a746eb2b5bc102281fdb415bd/hyde/ext/plugins/structure.py#L32-L59 | ||
prakhar1989/Algorithms | 82e64ce9d451b33c1bce64a63276d6341a1f13b0 | sorting and basics/karatsuba.py | python | karatsuba | (x, y, b=10) | return (bm**2)*z1 + bm*z2 + z3 | returns product of x, y. Uses base b
in karatsuba algorithm
Gives running time of O(n^1.585) as opposed to
O(n^2) of naive multiplication
>>> karatsuba(1234223123412323, 1234534213423333123)
1523690672850721578619752112274729L | returns product of x, y. Uses base b
in karatsuba algorithm
Gives running time of O(n^1.585) as opposed to
O(n^2) of naive multiplication
>>> karatsuba(1234223123412323, 1234534213423333123)
1523690672850721578619752112274729L | [
"returns",
"product",
"of",
"x",
"y",
".",
"Uses",
"base",
"b",
"in",
"karatsuba",
"algorithm",
"Gives",
"running",
"time",
"of",
"O",
"(",
"n^1",
".",
"585",
")",
"as",
"opposed",
"to",
"O",
"(",
"n^2",
")",
"of",
"naive",
"multiplication",
">>>",
"... | def karatsuba(x, y, b=10):
""" returns product of x, y. Uses base b
in karatsuba algorithm
Gives running time of O(n^1.585) as opposed to
O(n^2) of naive multiplication
>>> karatsuba(1234223123412323, 1234534213423333123)
1523690672850721578619752112274729L
"""
if x < 1000 or y < 1000:
... | [
"def",
"karatsuba",
"(",
"x",
",",
"y",
",",
"b",
"=",
"10",
")",
":",
"if",
"x",
"<",
"1000",
"or",
"y",
"<",
"1000",
":",
"return",
"x",
"*",
"y",
"m",
"=",
"min",
"(",
"len",
"(",
"str",
"(",
"x",
")",
")",
"/",
"2",
",",
"len",
"(",... | https://github.com/prakhar1989/Algorithms/blob/82e64ce9d451b33c1bce64a63276d6341a1f13b0/sorting and basics/karatsuba.py#L1-L19 | |
holzschu/Carnets | 44effb10ddfc6aa5c8b0687582a724ba82c6b547 | Library/lib/python3.7/site-packages/jupyter_contrib_core-0.3.3-py3.7.egg/jupyter_contrib_core/notebook_compat/_compat/nbextensions.py | python | _nbextension_dirs | () | return [
os.path.join(jupyter_data_dir(), u'nbextensions'),
os.path.join(ENV_JUPYTER_PATH[0], u'nbextensions'),
os.path.join(SYSTEM_JUPYTER_PATH[0], 'nbextensions')
] | The possible locations of nbextensions. | The possible locations of nbextensions. | [
"The",
"possible",
"locations",
"of",
"nbextensions",
"."
] | def _nbextension_dirs():
"""The possible locations of nbextensions."""
return [
os.path.join(jupyter_data_dir(), u'nbextensions'),
os.path.join(ENV_JUPYTER_PATH[0], u'nbextensions'),
os.path.join(SYSTEM_JUPYTER_PATH[0], 'nbextensions')
] | [
"def",
"_nbextension_dirs",
"(",
")",
":",
"return",
"[",
"os",
".",
"path",
".",
"join",
"(",
"jupyter_data_dir",
"(",
")",
",",
"u'nbextensions'",
")",
",",
"os",
".",
"path",
".",
"join",
"(",
"ENV_JUPYTER_PATH",
"[",
"0",
"]",
",",
"u'nbextensions'",... | https://github.com/holzschu/Carnets/blob/44effb10ddfc6aa5c8b0687582a724ba82c6b547/Library/lib/python3.7/site-packages/jupyter_contrib_core-0.3.3-py3.7.egg/jupyter_contrib_core/notebook_compat/_compat/nbextensions.py#L459-L465 | |
ansible/ansible-modules-core | 00911a75ad6635834b6d28eef41f197b2f73c381 | cloud/openstack/os_port.py | python | _needs_update | (module, port, cloud) | return False | Check for differences in the updatable values.
NOTE: We don't currently allow name updates. | Check for differences in the updatable values. | [
"Check",
"for",
"differences",
"in",
"the",
"updatable",
"values",
"."
] | def _needs_update(module, port, cloud):
"""Check for differences in the updatable values.
NOTE: We don't currently allow name updates.
"""
compare_simple = ['admin_state_up',
'mac_address',
'device_owner',
'device_id']
compare_dict =... | [
"def",
"_needs_update",
"(",
"module",
",",
"port",
",",
"cloud",
")",
":",
"compare_simple",
"=",
"[",
"'admin_state_up'",
",",
"'mac_address'",
",",
"'device_owner'",
",",
"'device_id'",
"]",
"compare_dict",
"=",
"[",
"'allowed_address_pairs'",
",",
"'extra_dhcp... | https://github.com/ansible/ansible-modules-core/blob/00911a75ad6635834b6d28eef41f197b2f73c381/cloud/openstack/os_port.py#L215-L265 | |
tacnetsol/ghidra_scripts | 5c4d24bc7166f672015003572daeeb04d2e1f30e | MipsRopSystemChain.py | python | find_epilogue | (rop_finder, controlled_registers) | return function_epilogue | Find epilogues that grant control of each register. Ideal will return nine
gadgets one that gives control of s0, one that gives control of s0 and s1,
one that gives control of s0/s1/s2, etc.
:param rop_finder: Mips rop finder class.
:type rop_finder: mipsrop.MipsRop
:returns: Gadgets found.
:r... | Find epilogues that grant control of each register. Ideal will return nine
gadgets one that gives control of s0, one that gives control of s0 and s1,
one that gives control of s0/s1/s2, etc. | [
"Find",
"epilogues",
"that",
"grant",
"control",
"of",
"each",
"register",
".",
"Ideal",
"will",
"return",
"nine",
"gadgets",
"one",
"that",
"gives",
"control",
"of",
"s0",
"one",
"that",
"gives",
"control",
"of",
"s0",
"and",
"s1",
"one",
"that",
"gives",... | def find_epilogue(rop_finder, controlled_registers):
"""
Find epilogues that grant control of each register. Ideal will return nine
gadgets one that gives control of s0, one that gives control of s0 and s1,
one that gives control of s0/s1/s2, etc.
:param rop_finder: Mips rop finder class.
:type... | [
"def",
"find_epilogue",
"(",
"rop_finder",
",",
"controlled_registers",
")",
":",
"epilogue",
"=",
"mipsrop",
".",
"MipsInstruction",
"(",
"'.*lw'",
",",
"'ra'",
")",
"function_epilogue",
"=",
"[",
"]",
"for",
"i",
"in",
"range",
"(",
"0",
",",
"len",
"(",... | https://github.com/tacnetsol/ghidra_scripts/blob/5c4d24bc7166f672015003572daeeb04d2e1f30e/MipsRopSystemChain.py#L96-L121 | |
cronyo/cronyo | cd5abab0871b68bf31b18aac934303928130a441 | cronyo/vendor/urllib3/response.py | python | HTTPResponse.flush | (self) | [] | def flush(self):
if (
self._fp is not None
and hasattr(self._fp, "flush")
and not getattr(self._fp, "closed", False)
):
return self._fp.flush() | [
"def",
"flush",
"(",
"self",
")",
":",
"if",
"(",
"self",
".",
"_fp",
"is",
"not",
"None",
"and",
"hasattr",
"(",
"self",
".",
"_fp",
",",
"\"flush\"",
")",
"and",
"not",
"getattr",
"(",
"self",
".",
"_fp",
",",
"\"closed\"",
",",
"False",
")",
"... | https://github.com/cronyo/cronyo/blob/cd5abab0871b68bf31b18aac934303928130a441/cronyo/vendor/urllib3/response.py#L647-L653 | ||||
ZhenYangIACAS/NMT_GAN | e27f9468112b117509f065f0f8f298f5b80b5602 | model.py | python | shift_right | (input, pad=2) | return tf.concat((tf.ones_like(input[:, :1]) * pad, input[:, :-1]), 1) | Shift input tensor right to create decoder input. '2' denotes <S> | Shift input tensor right to create decoder input. '2' denotes <S> | [
"Shift",
"input",
"tensor",
"right",
"to",
"create",
"decoder",
"input",
".",
"2",
"denotes",
"<S",
">"
] | def shift_right(input, pad=2):
"""Shift input tensor right to create decoder input. '2' denotes <S>"""
return tf.concat((tf.ones_like(input[:, :1]) * pad, input[:, :-1]), 1) | [
"def",
"shift_right",
"(",
"input",
",",
"pad",
"=",
"2",
")",
":",
"return",
"tf",
".",
"concat",
"(",
"(",
"tf",
".",
"ones_like",
"(",
"input",
"[",
":",
",",
":",
"1",
"]",
")",
"*",
"pad",
",",
"input",
"[",
":",
",",
":",
"-",
"1",
"]... | https://github.com/ZhenYangIACAS/NMT_GAN/blob/e27f9468112b117509f065f0f8f298f5b80b5602/model.py#L764-L766 | |
google/grr | 8ad8a4d2c5a93c92729206b7771af19d92d4f915 | grr/server/grr_response_server/gui/api_call_router.py | python | ApiCallRouterStub.GetFileDetails | (self, args, context=None) | Get details of a VFS file on a given client. | Get details of a VFS file on a given client. | [
"Get",
"details",
"of",
"a",
"VFS",
"file",
"on",
"a",
"given",
"client",
"."
] | def GetFileDetails(self, args, context=None):
"""Get details of a VFS file on a given client."""
raise NotImplementedError() | [
"def",
"GetFileDetails",
"(",
"self",
",",
"args",
",",
"context",
"=",
"None",
")",
":",
"raise",
"NotImplementedError",
"(",
")"
] | https://github.com/google/grr/blob/8ad8a4d2c5a93c92729206b7771af19d92d4f915/grr/server/grr_response_server/gui/api_call_router.py#L452-L455 | ||
mitre/caldera | 46429594584f3852d1f9353402407fdb7c1a8302 | app/api/v2/responses.py | python | json_request_validation_middleware | (request, handler) | Middleware that converts json decoding and marshmallow validation
errors into 400 responses w/ json bodies. | Middleware that converts json decoding and marshmallow validation
errors into 400 responses w/ json bodies. | [
"Middleware",
"that",
"converts",
"json",
"decoding",
"and",
"marshmallow",
"validation",
"errors",
"into",
"400",
"responses",
"w",
"/",
"json",
"bodies",
"."
] | async def json_request_validation_middleware(request, handler):
"""Middleware that converts json decoding and marshmallow validation
errors into 400 responses w/ json bodies.
"""
try:
return await handler(request)
except errors.DataValidationError as ex:
raise JsonHttpBadRequest(
... | [
"async",
"def",
"json_request_validation_middleware",
"(",
"request",
",",
"handler",
")",
":",
"try",
":",
"return",
"await",
"handler",
"(",
"request",
")",
"except",
"errors",
".",
"DataValidationError",
"as",
"ex",
":",
"raise",
"JsonHttpBadRequest",
"(",
"e... | https://github.com/mitre/caldera/blob/46429594584f3852d1f9353402407fdb7c1a8302/app/api/v2/responses.py#L66-L80 | ||
getsentry/rb | 6f96a68dca2d77e9ac1d8bdd7a21e2575af65a20 | rb/clients.py | python | CommandBuffer.fileno | (self) | return self.connection._sock.fileno() | Returns the file number of the underlying connection's socket
to be able to select over it. | Returns the file number of the underlying connection's socket
to be able to select over it. | [
"Returns",
"the",
"file",
"number",
"of",
"the",
"underlying",
"connection",
"s",
"socket",
"to",
"be",
"able",
"to",
"select",
"over",
"it",
"."
] | def fileno(self):
"""Returns the file number of the underlying connection's socket
to be able to select over it.
"""
assert_open(self)
return self.connection._sock.fileno() | [
"def",
"fileno",
"(",
"self",
")",
":",
"assert_open",
"(",
"self",
")",
"return",
"self",
".",
"connection",
".",
"_sock",
".",
"fileno",
"(",
")"
] | https://github.com/getsentry/rb/blob/6f96a68dca2d77e9ac1d8bdd7a21e2575af65a20/rb/clients.py#L124-L129 | |
WeblateOrg/weblate | 8126f3dda9d24f2846b755955132a8b8410866c8 | weblate/trans/models/unit.py | python | Unit.update_source_units | (self, previous_source, user, author) | Update source for units withing same component.
This is needed when editing template translation for monolingual formats. | Update source for units withing same component. | [
"Update",
"source",
"for",
"units",
"withing",
"same",
"component",
"."
] | def update_source_units(self, previous_source, user, author):
"""Update source for units withing same component.
This is needed when editing template translation for monolingual formats.
"""
# Find relevant units
for unit in self.unit_set.exclude(id=self.id).prefetch().prefetch_... | [
"def",
"update_source_units",
"(",
"self",
",",
"previous_source",
",",
"user",
",",
"author",
")",
":",
"# Find relevant units",
"for",
"unit",
"in",
"self",
".",
"unit_set",
".",
"exclude",
"(",
"id",
"=",
"self",
".",
"id",
")",
".",
"prefetch",
"(",
... | https://github.com/WeblateOrg/weblate/blob/8126f3dda9d24f2846b755955132a8b8410866c8/weblate/trans/models/unit.py#L995-L1035 | ||
pyRiemann/pyRiemann | 30c2cd7204d19f1a60d3b7945dfd8ee3c46a8df8 | pyriemann/utils/utils.py | python | check_version | (library, min_version) | return ok | Check minimum library version required
Parameters
----------
library : str
The library name to import. Must have a ``__version__`` property.
min_version : str
The minimum version string. Anything that matches
``'(\\d+ | [a-z]+ | \\.)'``
Returns
-------
ok : bool
... | Check minimum library version required | [
"Check",
"minimum",
"library",
"version",
"required"
] | def check_version(library, min_version):
"""Check minimum library version required
Parameters
----------
library : str
The library name to import. Must have a ``__version__`` property.
min_version : str
The minimum version string. Anything that matches
``'(\\d+ | [a-z]+ | \\... | [
"def",
"check_version",
"(",
"library",
",",
"min_version",
")",
":",
"from",
"distutils",
".",
"version",
"import",
"LooseVersion",
"ok",
"=",
"True",
"try",
":",
"library",
"=",
"__import__",
"(",
"library",
")",
"except",
"ImportError",
":",
"ok",
"=",
... | https://github.com/pyRiemann/pyRiemann/blob/30c2cd7204d19f1a60d3b7945dfd8ee3c46a8df8/pyriemann/utils/utils.py#L1-L29 | |
pypa/pipenv | b21baade71a86ab3ee1429f71fbc14d4f95fb75d | pipenv/patched/notpip/_vendor/pkg_resources/__init__.py | python | _call_aside | (f, *args, **kwargs) | return f | [] | def _call_aside(f, *args, **kwargs):
f(*args, **kwargs)
return f | [
"def",
"_call_aside",
"(",
"f",
",",
"*",
"args",
",",
"*",
"*",
"kwargs",
")",
":",
"f",
"(",
"*",
"args",
",",
"*",
"*",
"kwargs",
")",
"return",
"f"
] | https://github.com/pypa/pipenv/blob/b21baade71a86ab3ee1429f71fbc14d4f95fb75d/pipenv/patched/notpip/_vendor/pkg_resources/__init__.py#L3234-L3236 | |||
oracle/graalpython | 577e02da9755d916056184ec441c26e00b70145c | graalpython/lib-python/3/inspect.py | python | Signature.from_function | (cls, func) | return _signature_from_function(cls, func) | Constructs Signature for the given python function.
Deprecated since Python 3.5, use `Signature.from_callable()`. | Constructs Signature for the given python function. | [
"Constructs",
"Signature",
"for",
"the",
"given",
"python",
"function",
"."
] | def from_function(cls, func):
"""Constructs Signature for the given python function.
Deprecated since Python 3.5, use `Signature.from_callable()`.
"""
warnings.warn("inspect.Signature.from_function() is deprecated since "
"Python 3.5, use Signature.from_callable()... | [
"def",
"from_function",
"(",
"cls",
",",
"func",
")",
":",
"warnings",
".",
"warn",
"(",
"\"inspect.Signature.from_function() is deprecated since \"",
"\"Python 3.5, use Signature.from_callable()\"",
",",
"DeprecationWarning",
",",
"stacklevel",
"=",
"2",
")",
"return",
"... | https://github.com/oracle/graalpython/blob/577e02da9755d916056184ec441c26e00b70145c/graalpython/lib-python/3/inspect.py#L2816-L2825 | |
zhl2008/awd-platform | 0416b31abea29743387b10b3914581fbe8e7da5e | web_flaskbb/Python-2.7.9/Lib/lib-tk/Tkinter.py | python | Misc.send | (self, interp, cmd, *args) | return self.tk.call(('send', interp, cmd) + args) | Send Tcl command CMD to different interpreter INTERP to be executed. | Send Tcl command CMD to different interpreter INTERP to be executed. | [
"Send",
"Tcl",
"command",
"CMD",
"to",
"different",
"interpreter",
"INTERP",
"to",
"be",
"executed",
"."
] | def send(self, interp, cmd, *args):
"""Send Tcl command CMD to different interpreter INTERP to be executed."""
return self.tk.call(('send', interp, cmd) + args) | [
"def",
"send",
"(",
"self",
",",
"interp",
",",
"cmd",
",",
"*",
"args",
")",
":",
"return",
"self",
".",
"tk",
".",
"call",
"(",
"(",
"'send'",
",",
"interp",
",",
"cmd",
")",
"+",
"args",
")"
] | https://github.com/zhl2008/awd-platform/blob/0416b31abea29743387b10b3914581fbe8e7da5e/web_flaskbb/Python-2.7.9/Lib/lib-tk/Tkinter.py#L764-L766 | |
sagemath/sage | f9b2db94f675ff16963ccdefba4f1a3393b3fe0d | src/sage/rings/asymptotic/misc.py | python | parent_to_repr_short | (P) | return s | r"""
Helper method which generates a short(er) representation string
out of a parent.
INPUT:
- ``P`` -- a parent.
OUTPUT:
A string.
EXAMPLES::
sage: from sage.rings.asymptotic.misc import parent_to_repr_short
sage: parent_to_repr_short(ZZ)
'ZZ'
sage: par... | r"""
Helper method which generates a short(er) representation string
out of a parent. | [
"r",
"Helper",
"method",
"which",
"generates",
"a",
"short",
"(",
"er",
")",
"representation",
"string",
"out",
"of",
"a",
"parent",
"."
] | def parent_to_repr_short(P):
r"""
Helper method which generates a short(er) representation string
out of a parent.
INPUT:
- ``P`` -- a parent.
OUTPUT:
A string.
EXAMPLES::
sage: from sage.rings.asymptotic.misc import parent_to_repr_short
sage: parent_to_repr_short(Z... | [
"def",
"parent_to_repr_short",
"(",
"P",
")",
":",
"from",
"sage",
".",
"rings",
".",
"all",
"import",
"RR",
",",
"CC",
",",
"RIF",
",",
"CIF",
",",
"RBF",
",",
"CBF",
"from",
"sage",
".",
"rings",
".",
"integer_ring",
"import",
"ZZ",
"from",
"sage",... | https://github.com/sagemath/sage/blob/f9b2db94f675ff16963ccdefba4f1a3393b3fe0d/src/sage/rings/asymptotic/misc.py#L105-L186 | |
avidLearnerInProgress/python-automation-scripts | 859cbbf72571673500cfc0fbcf493beaed48b7c5 | hackernews-scraper/json_to_csv.py | python | reduce_item | (key, value) | [] | def reduce_item(key, value):
global reduced_item
#Reduction Condition 1
if type(value) is list:
i=0
for sub_item in value:
reduce_item(key+'_'+to_string(i), sub_item)
i=i+1
#Reduction Condition 2
elif type(value) is dict:
sub_keys = value.keys()
... | [
"def",
"reduce_item",
"(",
"key",
",",
"value",
")",
":",
"global",
"reduced_item",
"#Reduction Condition 1",
"if",
"type",
"(",
"value",
")",
"is",
"list",
":",
"i",
"=",
"0",
"for",
"sub_item",
"in",
"value",
":",
"reduce_item",
"(",
"key",
"+",
"'_'",... | https://github.com/avidLearnerInProgress/python-automation-scripts/blob/859cbbf72571673500cfc0fbcf493beaed48b7c5/hackernews-scraper/json_to_csv.py#L40-L58 | ||||
CityOfZion/neo-python | 99783bc8310982a5380081ec41a6ee07ba843f3f | neo/Core/TX/Transaction.py | python | Transaction.GetTransactionResults | (self) | return realresults | Get the execution results of the transaction.
Returns:
None: if the transaction has no references.
list: of TransactionResult objects. | Get the execution results of the transaction. | [
"Get",
"the",
"execution",
"results",
"of",
"the",
"transaction",
"."
] | def GetTransactionResults(self):
"""
Get the execution results of the transaction.
Returns:
None: if the transaction has no references.
list: of TransactionResult objects.
"""
if self.References is None:
return None
results = []
... | [
"def",
"GetTransactionResults",
"(",
"self",
")",
":",
"if",
"self",
".",
"References",
"is",
"None",
":",
"return",
"None",
"results",
"=",
"[",
"]",
"realresults",
"=",
"[",
"]",
"for",
"ref_output",
"in",
"self",
".",
"References",
".",
"values",
"(",... | https://github.com/CityOfZion/neo-python/blob/99783bc8310982a5380081ec41a6ee07ba843f3f/neo/Core/TX/Transaction.py#L738-L765 | |
dmlc/dgl | 8d14a739bc9e446d6c92ef83eafe5782398118de | tutorials/models/3_generative_model/5_dgmg.py | python | DGMGSkeleton.__init__ | (self, v_max) | Parameters
----------
v_max: int
Max number of nodes considered | Parameters
----------
v_max: int
Max number of nodes considered | [
"Parameters",
"----------",
"v_max",
":",
"int",
"Max",
"number",
"of",
"nodes",
"considered"
] | def __init__(self, v_max):
"""
Parameters
----------
v_max: int
Max number of nodes considered
"""
super(DGMGSkeleton, self).__init__()
# Graph configuration
self.v_max = v_max | [
"def",
"__init__",
"(",
"self",
",",
"v_max",
")",
":",
"super",
"(",
"DGMGSkeleton",
",",
"self",
")",
".",
"__init__",
"(",
")",
"# Graph configuration",
"self",
".",
"v_max",
"=",
"v_max"
] | https://github.com/dmlc/dgl/blob/8d14a739bc9e446d6c92ef83eafe5782398118de/tutorials/models/3_generative_model/5_dgmg.py#L246-L256 | ||
saltstack/salt | fae5bc757ad0f1716483ce7ae180b451545c2058 | salt/modules/vmctl.py | python | create_disk | (name, size) | return ret | Create a VMM disk with the specified `name` and `size`.
size:
Size in megabytes, or use a specifier such as M, G, T.
CLI Example:
.. code-block:: bash
salt '*' vmctl.create_disk /path/to/disk.img size=10G | Create a VMM disk with the specified `name` and `size`. | [
"Create",
"a",
"VMM",
"disk",
"with",
"the",
"specified",
"name",
"and",
"size",
"."
] | def create_disk(name, size):
"""
Create a VMM disk with the specified `name` and `size`.
size:
Size in megabytes, or use a specifier such as M, G, T.
CLI Example:
.. code-block:: bash
salt '*' vmctl.create_disk /path/to/disk.img size=10G
"""
ret = False
cmd = "vmctl c... | [
"def",
"create_disk",
"(",
"name",
",",
"size",
")",
":",
"ret",
"=",
"False",
"cmd",
"=",
"\"vmctl create {} -s {}\"",
".",
"format",
"(",
"name",
",",
"size",
")",
"result",
"=",
"__salt__",
"[",
"\"cmd.run_all\"",
"]",
"(",
"cmd",
",",
"output_loglevel"... | https://github.com/saltstack/salt/blob/fae5bc757ad0f1716483ce7ae180b451545c2058/salt/modules/vmctl.py#L49-L75 | |
holzschu/Carnets | 44effb10ddfc6aa5c8b0687582a724ba82c6b547 | Library/lib/python3.7/site-packages/sympy/integrals/prde.py | python | prde_spde | (a, b, Q, n, DE) | return (A, B, Qq, R, n1) | Special Polynomial Differential Equation algorithm: Parametric Version.
Given a derivation D on k[t], an integer n, and a, b, q1, ..., qm in k[t]
with deg(a) > 0 and gcd(a, b) == 1, return (A, B, Q, R, n1), with
Qq = [q1, ..., qm] and R = [r1, ..., rm], such that for any solution
c1, ..., cm in Const(k... | Special Polynomial Differential Equation algorithm: Parametric Version. | [
"Special",
"Polynomial",
"Differential",
"Equation",
"algorithm",
":",
"Parametric",
"Version",
"."
] | def prde_spde(a, b, Q, n, DE):
"""
Special Polynomial Differential Equation algorithm: Parametric Version.
Given a derivation D on k[t], an integer n, and a, b, q1, ..., qm in k[t]
with deg(a) > 0 and gcd(a, b) == 1, return (A, B, Q, R, n1), with
Qq = [q1, ..., qm] and R = [r1, ..., rm], such that ... | [
"def",
"prde_spde",
"(",
"a",
",",
"b",
",",
"Q",
",",
"n",
",",
"DE",
")",
":",
"R",
",",
"Z",
"=",
"list",
"(",
"zip",
"(",
"*",
"[",
"gcdex_diophantine",
"(",
"b",
",",
"a",
",",
"qi",
")",
"for",
"qi",
"in",
"Q",
"]",
")",
")",
"A",
... | https://github.com/holzschu/Carnets/blob/44effb10ddfc6aa5c8b0687582a724ba82c6b547/Library/lib/python3.7/site-packages/sympy/integrals/prde.py#L284-L303 | |
netaddr/netaddr | e84688f7034b7a88ac00a676359be57eb7a78184 | netaddr/ip/__init__.py | python | BaseIP.__lt__ | (self, other) | :param other: an `IPAddress` or `IPNetwork` object.
:return: ``True`` if this `IPAddress` or `IPNetwork` object is
less than ``other``, ``False`` otherwise. | :param other: an `IPAddress` or `IPNetwork` object. | [
":",
"param",
"other",
":",
"an",
"IPAddress",
"or",
"IPNetwork",
"object",
"."
] | def __lt__(self, other):
"""
:param other: an `IPAddress` or `IPNetwork` object.
:return: ``True`` if this `IPAddress` or `IPNetwork` object is
less than ``other``, ``False`` otherwise.
"""
try:
return self.sort_key() < other.sort_key()
except (At... | [
"def",
"__lt__",
"(",
"self",
",",
"other",
")",
":",
"try",
":",
"return",
"self",
".",
"sort_key",
"(",
")",
"<",
"other",
".",
"sort_key",
"(",
")",
"except",
"(",
"AttributeError",
",",
"TypeError",
")",
":",
"return",
"NotImplemented"
] | https://github.com/netaddr/netaddr/blob/e84688f7034b7a88ac00a676359be57eb7a78184/netaddr/ip/__init__.py#L86-L96 | ||
deepgram/sidomo | b70825d9017eb0c2c6b6389345cccbcbd52cf669 | sidomo/sidomo.py | python | dodo | (do, image, sharedir, display) | dodo (like sudo but for docker) runs argument in a docker image.
do is the command to run in the image.
image taken from (1) command-line, (2) "DODOIMAGE" environment variable, or (3) first built image.
sharedir (e.g., to pass data to command) is mounted (default: current directory). empty string does no m... | dodo (like sudo but for docker) runs argument in a docker image. | [
"dodo",
"(",
"like",
"sudo",
"but",
"for",
"docker",
")",
"runs",
"argument",
"in",
"a",
"docker",
"image",
"."
] | def dodo(do, image, sharedir, display):
""" dodo (like sudo but for docker) runs argument in a docker image.
do is the command to run in the image.
image taken from (1) command-line, (2) "DODOIMAGE" environment variable, or (3) first built image.
sharedir (e.g., to pass data to command) is mounted (def... | [
"def",
"dodo",
"(",
"do",
",",
"image",
",",
"sharedir",
",",
"display",
")",
":",
"# try to set image three ways",
"if",
"not",
"image",
":",
"if",
"'DODOIMAGE'",
"in",
"os",
".",
"environ",
":",
"image",
"=",
"os",
".",
"environ",
"[",
"'DODOIMAGE'",
"... | https://github.com/deepgram/sidomo/blob/b70825d9017eb0c2c6b6389345cccbcbd52cf669/sidomo/sidomo.py#L79-L121 | ||
home-assistant/core | 265ebd17a3f17ed8dc1e9bdede03ac8e323f1ab1 | homeassistant/components/rtsp_to_webrtc/__init__.py | python | async_setup_entry | (hass: HomeAssistant, entry: ConfigEntry) | return True | Set up RTSPtoWebRTC from a config entry. | Set up RTSPtoWebRTC from a config entry. | [
"Set",
"up",
"RTSPtoWebRTC",
"from",
"a",
"config",
"entry",
"."
] | async def async_setup_entry(hass: HomeAssistant, entry: ConfigEntry) -> bool:
"""Set up RTSPtoWebRTC from a config entry."""
hass.data.setdefault(DOMAIN, {})
client: WebRTCClientInterface
try:
async with async_timeout.timeout(TIMEOUT):
client = await get_adaptive_client(
... | [
"async",
"def",
"async_setup_entry",
"(",
"hass",
":",
"HomeAssistant",
",",
"entry",
":",
"ConfigEntry",
")",
"->",
"bool",
":",
"hass",
".",
"data",
".",
"setdefault",
"(",
"DOMAIN",
",",
"{",
"}",
")",
"client",
":",
"WebRTCClientInterface",
"try",
":",... | https://github.com/home-assistant/core/blob/265ebd17a3f17ed8dc1e9bdede03ac8e323f1ab1/homeassistant/components/rtsp_to_webrtc/__init__.py#L42-L82 | |
mukulhase/WebWhatsapp-Wrapper | d2ea6e821cf754ba4e16a6d5ebc141c3f65da339 | sample/flask/webapi.py | python | init_client | (client_id) | return drivers[client_id] | Initialse a driver for client and store for future reference
@param client_id: ID of client user
@return whebwhatsapi object | Initialse a driver for client and store for future reference | [
"Initialse",
"a",
"driver",
"for",
"client",
"and",
"store",
"for",
"future",
"reference"
] | def init_client(client_id):
"""Initialse a driver for client and store for future reference
@param client_id: ID of client user
@return whebwhatsapi object
"""
if client_id not in drivers:
drivers[client_id] = init_driver(client_id)
return drivers[client_id] | [
"def",
"init_client",
"(",
"client_id",
")",
":",
"if",
"client_id",
"not",
"in",
"drivers",
":",
"drivers",
"[",
"client_id",
"]",
"=",
"init_driver",
"(",
"client_id",
")",
"return",
"drivers",
"[",
"client_id",
"]"
] | https://github.com/mukulhase/WebWhatsapp-Wrapper/blob/d2ea6e821cf754ba4e16a6d5ebc141c3f65da339/sample/flask/webapi.py#L217-L225 | |
behave/behave | e6364fe3d62c2befe34bc56471cfb317a218cd01 | behave4cmd0/log/steps.py | python | step_command_output_should_not_contain_log_records_from_categories | (context) | Verifies that the command output contains not log records from
the provided log categories (in any order).
.. code-block: gherkin
Given I define the log record schema:
| category | level | message |
| root | ERROR | __LOG_MESSAGE__ |
Then the command output should n... | Verifies that the command output contains not log records from
the provided log categories (in any order). | [
"Verifies",
"that",
"the",
"command",
"output",
"contains",
"not",
"log",
"records",
"from",
"the",
"provided",
"log",
"categories",
"(",
"in",
"any",
"order",
")",
"."
] | def step_command_output_should_not_contain_log_records_from_categories(context):
"""
Verifies that the command output contains not log records from
the provided log categories (in any order).
.. code-block: gherkin
Given I define the log record schema:
| category | level | message ... | [
"def",
"step_command_output_should_not_contain_log_records_from_categories",
"(",
"context",
")",
":",
"assert",
"context",
".",
"table",
",",
"\"REQUIRE: context.table\"",
"context",
".",
"table",
".",
"require_column",
"(",
"\"category\"",
")",
"record_schema",
"=",
"co... | https://github.com/behave/behave/blob/e6364fe3d62c2befe34bc56471cfb317a218cd01/behave4cmd0/log/steps.py#L283-L302 | ||
iclavera/learning_to_adapt | bd7d99ba402521c96631e7d09714128f549db0f1 | learning_to_adapt/mujoco_py/mjtypes.py | python | MjvOptionWrapper.ptr | (self) | return self._wrapped | [] | def ptr(self):
return self._wrapped | [
"def",
"ptr",
"(",
"self",
")",
":",
"return",
"self",
".",
"_wrapped"
] | https://github.com/iclavera/learning_to_adapt/blob/bd7d99ba402521c96631e7d09714128f549db0f1/learning_to_adapt/mujoco_py/mjtypes.py#L1417-L1418 | |||
khanhnamle1994/natural-language-processing | 01d450d5ac002b0156ef4cf93a07cb508c1bcdc5 | assignment1/.env/lib/python2.7/site-packages/pkg_resources/__init__.py | python | WorkingSet.resolve | (self, requirements, env=None, installer=None,
replace_conflicting=False, extras=None) | return to_activate | List all distributions needed to (recursively) meet `requirements`
`requirements` must be a sequence of ``Requirement`` objects. `env`,
if supplied, should be an ``Environment`` instance. If
not supplied, it defaults to all distributions available within any
entry or distribution in t... | List all distributions needed to (recursively) meet `requirements` | [
"List",
"all",
"distributions",
"needed",
"to",
"(",
"recursively",
")",
"meet",
"requirements"
] | def resolve(self, requirements, env=None, installer=None,
replace_conflicting=False, extras=None):
"""List all distributions needed to (recursively) meet `requirements`
`requirements` must be a sequence of ``Requirement`` objects. `env`,
if supplied, should be an ``Environment`... | [
"def",
"resolve",
"(",
"self",
",",
"requirements",
",",
"env",
"=",
"None",
",",
"installer",
"=",
"None",
",",
"replace_conflicting",
"=",
"False",
",",
"extras",
"=",
"None",
")",
":",
"# set up the stack",
"requirements",
"=",
"list",
"(",
"requirements"... | https://github.com/khanhnamle1994/natural-language-processing/blob/01d450d5ac002b0156ef4cf93a07cb508c1bcdc5/assignment1/.env/lib/python2.7/site-packages/pkg_resources/__init__.py#L799-L889 | |
Map-A-Droid/MAD | 81375b5c9ccc5ca3161eb487aa81469d40ded221 | mapadroid/madmin/routes/config.py | python | MADminConfig.settings | (self) | return redirect(url_for('settings_devices'), code=302) | [] | def settings(self):
return redirect(url_for('settings_devices'), code=302) | [
"def",
"settings",
"(",
"self",
")",
":",
"return",
"redirect",
"(",
"url_for",
"(",
"'settings_devices'",
")",
",",
"code",
"=",
"302",
")"
] | https://github.com/Map-A-Droid/MAD/blob/81375b5c9ccc5ca3161eb487aa81469d40ded221/mapadroid/madmin/routes/config.py#L446-L447 | |||
lykops/lykops | ed7e35d0c1abb1eacf7ab365e041347d0862c0a7 | library/security/encryption/AES256/api.py | python | Using_AES256._split_header | (self, data) | return (b_header, b_ciphertext) | 对加密数据进行分割,分为加密头和加密数据
:parm
data :需要分割的加密数据 | 对加密数据进行分割,分为加密头和加密数据
:parm
data :需要分割的加密数据 | [
"对加密数据进行分割,分为加密头和加密数据",
":",
"parm",
"data",
":需要分割的加密数据"
] | def _split_header(self, data):
'''
对加密数据进行分割,分为加密头和加密数据
:parm
data :需要分割的加密数据
'''
result = obj2bytes(data)
if result[0] :
data = result[1]
else :
data = string2bytes(data)
b_data = data.split(b... | [
"def",
"_split_header",
"(",
"self",
",",
"data",
")",
":",
"result",
"=",
"obj2bytes",
"(",
"data",
")",
"if",
"result",
"[",
"0",
"]",
":",
"data",
"=",
"result",
"[",
"1",
"]",
"else",
":",
"data",
"=",
"string2bytes",
"(",
"data",
")",
"b_data"... | https://github.com/lykops/lykops/blob/ed7e35d0c1abb1eacf7ab365e041347d0862c0a7/library/security/encryption/AES256/api.py#L368-L386 | |
PyQt5/PyQt | d2bbfc9fd6f3fdb5ed5404983cdd0848aa654cf0 | QScrollArea/QQSettingPanel.py | python | Window.onItemClicked | (self, item) | 左侧item | 左侧item | [
"左侧item"
] | def onItemClicked(self, item):
"""左侧item"""
row = self.listWidget.row(item) # 获取点击的item的索引
# 由于右侧的widget是按照命名widget_0 widget_1这样比较规范的方法,可以通过getattr找到
widget = getattr(self, 'widget_%d' % row, None)
if not widget:
return
# 定位右侧位置并滚动
self._blockSignals ... | [
"def",
"onItemClicked",
"(",
"self",
",",
"item",
")",
":",
"row",
"=",
"self",
".",
"listWidget",
".",
"row",
"(",
"item",
")",
"# 获取点击的item的索引",
"# 由于右侧的widget是按照命名widget_0 widget_1这样比较规范的方法,可以通过getattr找到",
"widget",
"=",
"getattr",
"(",
"self",
",",
"'widget_%d... | https://github.com/PyQt5/PyQt/blob/d2bbfc9fd6f3fdb5ed5404983cdd0848aa654cf0/QScrollArea/QQSettingPanel.py#L46-L56 | ||
holzschu/Carnets | 44effb10ddfc6aa5c8b0687582a724ba82c6b547 | Library/lib/python3.7/site-packages/pandas-0.24.2-py3.7-macosx-10.9-x86_64.egg/pandas/core/internals/blocks.py | python | Block.is_datelike | (self) | return self.is_datetime or self.is_timedelta | return True if I am a non-datelike | return True if I am a non-datelike | [
"return",
"True",
"if",
"I",
"am",
"a",
"non",
"-",
"datelike"
] | def is_datelike(self):
""" return True if I am a non-datelike """
return self.is_datetime or self.is_timedelta | [
"def",
"is_datelike",
"(",
"self",
")",
":",
"return",
"self",
".",
"is_datetime",
"or",
"self",
".",
"is_timedelta"
] | https://github.com/holzschu/Carnets/blob/44effb10ddfc6aa5c8b0687582a724ba82c6b547/Library/lib/python3.7/site-packages/pandas-0.24.2-py3.7-macosx-10.9-x86_64.egg/pandas/core/internals/blocks.py#L142-L144 | |
sagemath/sage | f9b2db94f675ff16963ccdefba4f1a3393b3fe0d | src/sage/rings/asymptotic/growth_group.py | python | MonomialGrowthGroup.factory | (cls,
base, var,
extend_by_non_growth_group=False,
return_factors=False,
**kwds) | r"""
Create a monomial growth group.
INPUT:
- ``base``, ``var``, keywords -- use in the initialization of the
exponential growth group; see :class:`MonomialGrowthGroup`
for details.
- ``extend_by_non_growth_group`` -- a boolean (default ``False``). If set, then
... | r"""
Create a monomial growth group. | [
"r",
"Create",
"a",
"monomial",
"growth",
"group",
"."
] | def factory(cls,
base, var,
extend_by_non_growth_group=False,
return_factors=False,
**kwds):
r"""
Create a monomial growth group.
INPUT:
- ``base``, ``var``, keywords -- use in the initialization of the
exponenti... | [
"def",
"factory",
"(",
"cls",
",",
"base",
",",
"var",
",",
"extend_by_non_growth_group",
"=",
"False",
",",
"return_factors",
"=",
"False",
",",
"*",
"*",
"kwds",
")",
":",
"from",
"sage",
".",
"categories",
".",
"cartesian_product",
"import",
"cartesian_pr... | https://github.com/sagemath/sage/blob/f9b2db94f675ff16963ccdefba4f1a3393b3fe0d/src/sage/rings/asymptotic/growth_group.py#L3771-L3830 | ||
jilljenn/tryalgo | 46da31aea9a0ff58819e360c987f9506b21f6e9d | tryalgo/laser_mirrors.py | python | laser_mirrors | (rows, cols, mir) | return None | Orienting mirrors to allow reachability by laser beam
:param int rows:
:param int cols: rows and cols are the dimension of the grid
:param mir: list of mirror coordinates, except
mir[0]= laser entrance,
mir[-1]= laser exit.
:complexity: :math:`O(2^n)` | Orienting mirrors to allow reachability by laser beam | [
"Orienting",
"mirrors",
"to",
"allow",
"reachability",
"by",
"laser",
"beam"
] | def laser_mirrors(rows, cols, mir):
"""Orienting mirrors to allow reachability by laser beam
:param int rows:
:param int cols: rows and cols are the dimension of the grid
:param mir: list of mirror coordinates, except
mir[0]= laser entrance,
mir[-1]= laser exit.
:com... | [
"def",
"laser_mirrors",
"(",
"rows",
",",
"cols",
",",
"mir",
")",
":",
"# build structures",
"n",
"=",
"len",
"(",
"mir",
")",
"orien",
"=",
"[",
"None",
"]",
"*",
"(",
"n",
"+",
"2",
")",
"orien",
"[",
"n",
"]",
"=",
"0",
"# arbitrary orientation... | https://github.com/jilljenn/tryalgo/blob/46da31aea9a0ff58819e360c987f9506b21f6e9d/tryalgo/laser_mirrors.py#L21-L54 | |
Abjad/abjad | d0646dfbe83db3dc5ab268f76a0950712b87b7fd | abjad/parsers/parser.py | python | GuileProxy.skip | (self, duration) | return leaf | r"""
Handles LilyPond ``\skip`` command. | r"""
Handles LilyPond ``\skip`` command. | [
"r",
"Handles",
"LilyPond",
"\\",
"skip",
"command",
"."
] | def skip(self, duration):
r"""
Handles LilyPond ``\skip`` command.
"""
leaf = Skip(duration.duration)
if duration.multiplier is not None:
attach(duration.multiplier, leaf)
return leaf | [
"def",
"skip",
"(",
"self",
",",
"duration",
")",
":",
"leaf",
"=",
"Skip",
"(",
"duration",
".",
"duration",
")",
"if",
"duration",
".",
"multiplier",
"is",
"not",
"None",
":",
"attach",
"(",
"duration",
".",
"multiplier",
",",
"leaf",
")",
"return",
... | https://github.com/Abjad/abjad/blob/d0646dfbe83db3dc5ab268f76a0950712b87b7fd/abjad/parsers/parser.py#L475-L482 | |
metabrainz/picard | 535bf8c7d9363ffc7abb3f69418ec11823c38118 | picard/script/functions.py | python | func_eq | (parser, x, y) | [] | def func_eq(parser, x, y):
if x == y:
return "1"
else:
return "" | [
"def",
"func_eq",
"(",
"parser",
",",
"x",
",",
"y",
")",
":",
"if",
"x",
"==",
"y",
":",
"return",
"\"1\"",
"else",
":",
"return",
"\"\""
] | https://github.com/metabrainz/picard/blob/535bf8c7d9363ffc7abb3f69418ec11823c38118/picard/script/functions.py#L662-L666 | ||||
plotly/plotly.py | cfad7862594b35965c0e000813bd7805e8494a5b | packages/python/plotly/plotly/graph_objs/layout/_title.py | python | Title.x | (self) | return self["x"] | Sets the x position with respect to `xref` in normalized
coordinates from 0 (left) to 1 (right).
The 'x' property is a number and may be specified as:
- An int or float in the interval [0, 1]
Returns
-------
int|float | Sets the x position with respect to `xref` in normalized
coordinates from 0 (left) to 1 (right).
The 'x' property is a number and may be specified as:
- An int or float in the interval [0, 1] | [
"Sets",
"the",
"x",
"position",
"with",
"respect",
"to",
"xref",
"in",
"normalized",
"coordinates",
"from",
"0",
"(",
"left",
")",
"to",
"1",
"(",
"right",
")",
".",
"The",
"x",
"property",
"is",
"a",
"number",
"and",
"may",
"be",
"specified",
"as",
... | def x(self):
"""
Sets the x position with respect to `xref` in normalized
coordinates from 0 (left) to 1 (right).
The 'x' property is a number and may be specified as:
- An int or float in the interval [0, 1]
Returns
-------
int|float
"""
... | [
"def",
"x",
"(",
"self",
")",
":",
"return",
"self",
"[",
"\"x\"",
"]"
] | https://github.com/plotly/plotly.py/blob/cfad7862594b35965c0e000813bd7805e8494a5b/packages/python/plotly/plotly/graph_objs/layout/_title.py#L139-L151 | |
tobiasfshr/MOTSFusion | 32fa6d7d3282c5046e45842370d225fa5a06603e | external/BB2SegNet/refinement_net/network/deeplab/core/preprocess_utils.py | python | resolve_shape | (tensor, rank=None, scope=None) | Fully resolves the shape of a Tensor.
Use as much as possible the shape components already known during graph
creation and resolve the remaining ones during runtime.
Args:
tensor: Input tensor whose shape we query.
rank: The rank of the tensor, provided that we know it.
scope: Optional name scope.
... | Fully resolves the shape of a Tensor. | [
"Fully",
"resolves",
"the",
"shape",
"of",
"a",
"Tensor",
"."
] | def resolve_shape(tensor, rank=None, scope=None):
"""Fully resolves the shape of a Tensor.
Use as much as possible the shape components already known during graph
creation and resolve the remaining ones during runtime.
Args:
tensor: Input tensor whose shape we query.
rank: The rank of the tensor, prov... | [
"def",
"resolve_shape",
"(",
"tensor",
",",
"rank",
"=",
"None",
",",
"scope",
"=",
"None",
")",
":",
"with",
"tf",
".",
"name_scope",
"(",
"scope",
",",
"'resolve_shape'",
",",
"[",
"tensor",
"]",
")",
":",
"if",
"rank",
"is",
"not",
"None",
":",
... | https://github.com/tobiasfshr/MOTSFusion/blob/32fa6d7d3282c5046e45842370d225fa5a06603e/external/BB2SegNet/refinement_net/network/deeplab/core/preprocess_utils.py#L317-L343 | ||
openstack/barbican | a9d2b133c8dc3307974f119f9a2b23a4ba82e8ce | barbican/common/config.py | python | list_opts | () | [] | def list_opts():
yield None, context_opts
yield None, common_opts
yield None, host_opts
yield None, db_opts
yield None, _options.eventlet_backdoor_opts
yield retry_opt_group, retry_opts
yield queue_opt_group, queue_opts
yield ks_queue_opt_group, ks_queue_opts
yield quota_opt_group, q... | [
"def",
"list_opts",
"(",
")",
":",
"yield",
"None",
",",
"context_opts",
"yield",
"None",
",",
"common_opts",
"yield",
"None",
",",
"host_opts",
"yield",
"None",
",",
"db_opts",
"yield",
"None",
",",
"_options",
".",
"eventlet_backdoor_opts",
"yield",
"retry_o... | https://github.com/openstack/barbican/blob/a9d2b133c8dc3307974f119f9a2b23a4ba82e8ce/barbican/common/config.py#L236-L245 | ||||
textX/textX | 452b684d434c557a63ff7ae2b014770c29669e4c | textx/registration.py | python | register_generator | (generator_desc_or_language, target=None, description='',
generator=None) | Programmatically register a generator.
Args:
generator_desc_or_language (GeneratorDesc or str): If GeneratorDesc is
given other parameters are not used.
For other parameters see `GeneratorDesc`. | Programmatically register a generator. | [
"Programmatically",
"register",
"a",
"generator",
"."
] | def register_generator(generator_desc_or_language, target=None, description='',
generator=None):
"""
Programmatically register a generator.
Args:
generator_desc_or_language (GeneratorDesc or str): If GeneratorDesc is
given other parameters are not used.
Fo... | [
"def",
"register_generator",
"(",
"generator_desc_or_language",
",",
"target",
"=",
"None",
",",
"description",
"=",
"''",
",",
"generator",
"=",
"None",
")",
":",
"global",
"generators",
"if",
"generators",
"is",
"None",
":",
"generator_descriptions",
"(",
")",... | https://github.com/textX/textX/blob/452b684d434c557a63ff7ae2b014770c29669e4c/textx/registration.py#L203-L232 | ||
jtriley/StarCluster | bc7c950e73f193eac9aab986b6764939cfdad978 | starcluster/cluster.py | python | ClusterValidator.validate | (self) | Checks that all cluster template settings are valid and raises an
exception.ClusterValidationError exception if not. | Checks that all cluster template settings are valid and raises an
exception.ClusterValidationError exception if not. | [
"Checks",
"that",
"all",
"cluster",
"template",
"settings",
"are",
"valid",
"and",
"raises",
"an",
"exception",
".",
"ClusterValidationError",
"exception",
"if",
"not",
"."
] | def validate(self):
"""
Checks that all cluster template settings are valid and raises an
exception.ClusterValidationError exception if not.
"""
log.info("Validating cluster template settings...")
try:
self.validate_required_settings()
self.validat... | [
"def",
"validate",
"(",
"self",
")",
":",
"log",
".",
"info",
"(",
"\"Validating cluster template settings...\"",
")",
"try",
":",
"self",
".",
"validate_required_settings",
"(",
")",
"self",
".",
"validate_vpc",
"(",
")",
"self",
".",
"validate_dns_prefix",
"("... | https://github.com/jtriley/StarCluster/blob/bc7c950e73f193eac9aab986b6764939cfdad978/starcluster/cluster.py#L1798-L1825 | ||
googledatalab/pydatalab | 1c86e26a0d24e3bc8097895ddeab4d0607be4c40 | datalab/bigquery/_table.py | python | Table.to_query | (self, fields=None) | return _query.Query('SELECT %s FROM %s' % (fields, self._repr_sql_()), context=self._context) | Return a Query for this Table.
Args:
fields: the fields to return. If None, all fields will be returned. This can be a string
which will be injected into the Query after SELECT, or a list of field names.
Returns:
A Query object that will return the specified fields from the records in th... | Return a Query for this Table. | [
"Return",
"a",
"Query",
"for",
"this",
"Table",
"."
] | def to_query(self, fields=None):
""" Return a Query for this Table.
Args:
fields: the fields to return. If None, all fields will be returned. This can be a string
which will be injected into the Query after SELECT, or a list of field names.
Returns:
A Query object that will return th... | [
"def",
"to_query",
"(",
"self",
",",
"fields",
"=",
"None",
")",
":",
"# Do import here to avoid top-level circular dependencies.",
"from",
".",
"import",
"_query",
"if",
"fields",
"is",
"None",
":",
"fields",
"=",
"'*'",
"elif",
"isinstance",
"(",
"fields",
","... | https://github.com/googledatalab/pydatalab/blob/1c86e26a0d24e3bc8097895ddeab4d0607be4c40/datalab/bigquery/_table.py#L914-L930 | |
kubernetes-client/python | 47b9da9de2d02b2b7a34fbe05afb44afd130d73a | kubernetes/client/models/v1_volume_error.py | python | V1VolumeError.message | (self) | return self._message | Gets the message of this V1VolumeError. # noqa: E501
String detailing the error encountered during Attach or Detach operation. This string may be logged, so it should not contain sensitive information. # noqa: E501
:return: The message of this V1VolumeError. # noqa: E501
:rtype: str | Gets the message of this V1VolumeError. # noqa: E501 | [
"Gets",
"the",
"message",
"of",
"this",
"V1VolumeError",
".",
"#",
"noqa",
":",
"E501"
] | def message(self):
"""Gets the message of this V1VolumeError. # noqa: E501
String detailing the error encountered during Attach or Detach operation. This string may be logged, so it should not contain sensitive information. # noqa: E501
:return: The message of this V1VolumeError. # noqa: E5... | [
"def",
"message",
"(",
"self",
")",
":",
"return",
"self",
".",
"_message"
] | https://github.com/kubernetes-client/python/blob/47b9da9de2d02b2b7a34fbe05afb44afd130d73a/kubernetes/client/models/v1_volume_error.py#L61-L69 | |
mcfletch/pyopengl | 02d11dad9ff18e50db10e975c4756e17bf198464 | OpenGL/GL/INTEL/fragment_shader_ordering.py | python | glInitFragmentShaderOrderingINTEL | () | return extensions.hasGLExtension( _EXTENSION_NAME ) | Return boolean indicating whether this extension is available | Return boolean indicating whether this extension is available | [
"Return",
"boolean",
"indicating",
"whether",
"this",
"extension",
"is",
"available"
] | def glInitFragmentShaderOrderingINTEL():
'''Return boolean indicating whether this extension is available'''
from OpenGL import extensions
return extensions.hasGLExtension( _EXTENSION_NAME ) | [
"def",
"glInitFragmentShaderOrderingINTEL",
"(",
")",
":",
"from",
"OpenGL",
"import",
"extensions",
"return",
"extensions",
".",
"hasGLExtension",
"(",
"_EXTENSION_NAME",
")"
] | https://github.com/mcfletch/pyopengl/blob/02d11dad9ff18e50db10e975c4756e17bf198464/OpenGL/GL/INTEL/fragment_shader_ordering.py#L45-L48 | |
sendgrid/sendgrid-python | df13b78b0cdcb410b4516f6761c4d3138edd4b2d | sendgrid/helpers/mail/batch_id.py | python | BatchId.get | (self) | return self.batch_id | Get a JSON-ready representation of this BatchId object.
:returns: The BatchId, ready for use in a request body.
:rtype: string | Get a JSON-ready representation of this BatchId object. | [
"Get",
"a",
"JSON",
"-",
"ready",
"representation",
"of",
"this",
"BatchId",
"object",
"."
] | def get(self):
"""
Get a JSON-ready representation of this BatchId object.
:returns: The BatchId, ready for use in a request body.
:rtype: string
"""
return self.batch_id | [
"def",
"get",
"(",
"self",
")",
":",
"return",
"self",
".",
"batch_id"
] | https://github.com/sendgrid/sendgrid-python/blob/df13b78b0cdcb410b4516f6761c4d3138edd4b2d/sendgrid/helpers/mail/batch_id.py#L43-L50 | |
pypa/pipenv | b21baade71a86ab3ee1429f71fbc14d4f95fb75d | pipenv/vendor/dparse/parser.py | python | RequirementsTXTParser.parse | (self) | Parses a requirements.txt-like file | Parses a requirements.txt-like file | [
"Parses",
"a",
"requirements",
".",
"txt",
"-",
"like",
"file"
] | def parse(self):
"""
Parses a requirements.txt-like file
"""
index_server = None
for num, line in enumerate(self.iter_lines()):
line = line.rstrip()
if not line:
continue
if line.startswith('#'):
# comments are l... | [
"def",
"parse",
"(",
"self",
")",
":",
"index_server",
"=",
"None",
"for",
"num",
",",
"line",
"in",
"enumerate",
"(",
"self",
".",
"iter_lines",
"(",
")",
")",
":",
"line",
"=",
"line",
".",
"rstrip",
"(",
")",
"if",
"not",
"line",
":",
"continue"... | https://github.com/pypa/pipenv/blob/b21baade71a86ab3ee1429f71fbc14d4f95fb75d/pipenv/vendor/dparse/parser.py#L207-L264 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.