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 |
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
wallix/PEPS | b7a95f8108967ebbc5f87d70f051e9233dfc6def | scripts/python/webmail.py | python | WebmailApi.tag_delete | (self, id) | return self._extract(result, 'tag.delete') | [] | def tag_delete(self, id):
result = self.session.delete('{}/users/me/tags/{}'.format(self._base_url, id), verify=verify)
return self._extract(result, 'tag.delete') | [
"def",
"tag_delete",
"(",
"self",
",",
"id",
")",
":",
"result",
"=",
"self",
".",
"session",
".",
"delete",
"(",
"'{}/users/me/tags/{}'",
".",
"format",
"(",
"self",
".",
"_base_url",
",",
"id",
")",
",",
"verify",
"=",
"verify",
")",
"return",
"self"... | https://github.com/wallix/PEPS/blob/b7a95f8108967ebbc5f87d70f051e9233dfc6def/scripts/python/webmail.py#L198-L200 | |||
wistbean/learn_python3_spider | 73c873f4845f4385f097e5057407d03dd37a117b | stackoverflow/venv/lib/python3.6/site-packages/twisted/internet/interfaces.py | python | IProducer.stopProducing | () | Stop producing data.
This tells a producer that its consumer has died, so it must stop
producing data for good. | Stop producing data. | [
"Stop",
"producing",
"data",
"."
] | def stopProducing():
"""
Stop producing data.
This tells a producer that its consumer has died, so it must stop
producing data for good.
""" | [
"def",
"stopProducing",
"(",
")",
":"
] | https://github.com/wistbean/learn_python3_spider/blob/73c873f4845f4385f097e5057407d03dd37a117b/stackoverflow/venv/lib/python3.6/site-packages/twisted/internet/interfaces.py#L1900-L1906 | ||
HymanLiuTS/flaskTs | 286648286976e85d9b9a5873632331efcafe0b21 | flasky/lib/python2.7/site-packages/markdown/blockparser.py | python | BlockParser.parseChunk | (self, parent, text) | Parse a chunk of markdown text and attach to given etree node.
While the ``text`` argument is generally assumed to contain multiple
blocks which will be split on blank lines, it could contain only one
block. Generally, this method would be called by extensions when
block parsing is requ... | Parse a chunk of markdown text and attach to given etree node. | [
"Parse",
"a",
"chunk",
"of",
"markdown",
"text",
"and",
"attach",
"to",
"given",
"etree",
"node",
"."
] | def parseChunk(self, parent, text):
""" Parse a chunk of markdown text and attach to given etree node.
While the ``text`` argument is generally assumed to contain multiple
blocks which will be split on blank lines, it could contain only one
block. Generally, this method would be called ... | [
"def",
"parseChunk",
"(",
"self",
",",
"parent",
",",
"text",
")",
":",
"self",
".",
"parseBlocks",
"(",
"parent",
",",
"text",
".",
"split",
"(",
"'\\n\\n'",
")",
")"
] | https://github.com/HymanLiuTS/flaskTs/blob/286648286976e85d9b9a5873632331efcafe0b21/flasky/lib/python2.7/site-packages/markdown/blockparser.py#L68-L80 | ||
rbaron/omr | 3d4b7dd53b272b195e872663673fb6098976dcd7 | omr.py | python | perspective_transform | (img, points) | return warped | Applies a 4-point perspective transformation in `img` so that `points`
are the new corners. | Applies a 4-point perspective transformation in `img` so that `points`
are the new corners. | [
"Applies",
"a",
"4",
"-",
"point",
"perspective",
"transformation",
"in",
"img",
"so",
"that",
"points",
"are",
"the",
"new",
"corners",
"."
] | def perspective_transform(img, points):
"""Applies a 4-point perspective transformation in `img` so that `points`
are the new corners."""
source = np.array(
points,
dtype="float32")
dest = np.array([
[TRANSF_SIZE, TRANSF_SIZE],
[0, TRANSF_SIZE],
[0, 0],
[... | [
"def",
"perspective_transform",
"(",
"img",
",",
"points",
")",
":",
"source",
"=",
"np",
".",
"array",
"(",
"points",
",",
"dtype",
"=",
"\"float32\"",
")",
"dest",
"=",
"np",
".",
"array",
"(",
"[",
"[",
"TRANSF_SIZE",
",",
"TRANSF_SIZE",
"]",
",",
... | https://github.com/rbaron/omr/blob/3d4b7dd53b272b195e872663673fb6098976dcd7/omr.py#L176-L192 | |
Source-Python-Dev-Team/Source.Python | d0ffd8ccbd1e9923c9bc44936f20613c1c76b7fb | addons/source-python/packages/site-packages/sqlalchemy/orm/persistence.py | python | _finalize_insert_update_commands | (base_mapper, uowtransaction, states) | finalize state on states that have been inserted or updated,
including calling after_insert/after_update events. | finalize state on states that have been inserted or updated,
including calling after_insert/after_update events. | [
"finalize",
"state",
"on",
"states",
"that",
"have",
"been",
"inserted",
"or",
"updated",
"including",
"calling",
"after_insert",
"/",
"after_update",
"events",
"."
] | def _finalize_insert_update_commands(base_mapper, uowtransaction, states):
"""finalize state on states that have been inserted or updated,
including calling after_insert/after_update events.
"""
for state, state_dict, mapper, connection, has_identity in states:
if mapper._readonly_props:
... | [
"def",
"_finalize_insert_update_commands",
"(",
"base_mapper",
",",
"uowtransaction",
",",
"states",
")",
":",
"for",
"state",
",",
"state_dict",
",",
"mapper",
",",
"connection",
",",
"has_identity",
"in",
"states",
":",
"if",
"mapper",
".",
"_readonly_props",
... | https://github.com/Source-Python-Dev-Team/Source.Python/blob/d0ffd8ccbd1e9923c9bc44936f20613c1c76b7fb/addons/source-python/packages/site-packages/sqlalchemy/orm/persistence.py#L937-L975 | ||
LGE-ARC-AdvancedAI/auptimizer | 50f6e3b4e0cb9146ca90fd74b9b24ca97ae22617 | Examples/cai_eas/eas/data_providers/cifar.py | python | CifarDataProvider.__init__ | (self, save_path=None, validation_size=None, shuffle=None, normalization=None,
one_hot=True, **kwargs) | Args:
save_path: `str`
validation_set: `bool`.
validation_split: `float` or None
float: chunk of `train set` will be marked as `validation set`.
None: if 'validation set' == True, `validation set` will be
copy of `test set`
shuffle: `str` or None
None: no any shuffling
once_prior_train:... | Args:
save_path: `str`
validation_set: `bool`.
validation_split: `float` or None
float: chunk of `train set` will be marked as `validation set`.
None: if 'validation set' == True, `validation set` will be
copy of `test set`
shuffle: `str` or None
None: no any shuffling
once_prior_train:... | [
"Args",
":",
"save_path",
":",
"str",
"validation_set",
":",
"bool",
".",
"validation_split",
":",
"float",
"or",
"None",
"float",
":",
"chunk",
"of",
"train",
"set",
"will",
"be",
"marked",
"as",
"validation",
"set",
".",
"None",
":",
"if",
"validation",
... | def __init__(self, save_path=None, validation_size=None, shuffle=None, normalization=None,
one_hot=True, **kwargs):
"""
Args:
save_path: `str`
validation_set: `bool`.
validation_split: `float` or None
float: chunk of `train set` will be marked as `validation set`.
None: if 'validation set' == ... | [
"def",
"__init__",
"(",
"self",
",",
"save_path",
"=",
"None",
",",
"validation_size",
"=",
"None",
",",
"shuffle",
"=",
"None",
",",
"normalization",
"=",
"None",
",",
"one_hot",
"=",
"True",
",",
"*",
"*",
"kwargs",
")",
":",
"self",
".",
"_save_path... | https://github.com/LGE-ARC-AdvancedAI/auptimizer/blob/50f6e3b4e0cb9146ca90fd74b9b24ca97ae22617/Examples/cai_eas/eas/data_providers/cifar.py#L111-L172 | ||
rucio/rucio | 6d0d358e04f5431f0b9a98ae40f31af0ddff4833 | lib/rucio/core/permission/atlas.py | python | perm_add_did | (issuer, kwargs) | return _is_root(issuer)\
or has_account_attribute(account=issuer, key='admin')\
or rucio.core.scope.is_scope_owner(scope=kwargs['scope'], account=issuer)\
or kwargs['scope'].external == u'mock' | Checks if an account can add an data identifier to a scope.
:param issuer: Account identifier which issues the command.
:param kwargs: List of arguments for the action.
:returns: True if account is allowed, otherwise False | Checks if an account can add an data identifier to a scope. | [
"Checks",
"if",
"an",
"account",
"can",
"add",
"an",
"data",
"identifier",
"to",
"a",
"scope",
"."
] | def perm_add_did(issuer, kwargs):
"""
Checks if an account can add an data identifier to a scope.
:param issuer: Account identifier which issues the command.
:param kwargs: List of arguments for the action.
:returns: True if account is allowed, otherwise False
"""
# Check the accounts of th... | [
"def",
"perm_add_did",
"(",
"issuer",
",",
"kwargs",
")",
":",
"# Check the accounts of the issued rules",
"if",
"not",
"_is_root",
"(",
"issuer",
")",
"and",
"not",
"has_account_attribute",
"(",
"account",
"=",
"issuer",
",",
"key",
"=",
"'admin'",
")",
":",
... | https://github.com/rucio/rucio/blob/6d0d358e04f5431f0b9a98ae40f31af0ddff4833/lib/rucio/core/permission/atlas.py#L397-L414 | |
zhl2008/awd-platform | 0416b31abea29743387b10b3914581fbe8e7da5e | web_flaskbb/Python-2.7.9/Lib/pydoc.py | python | stripid | (text) | return _re_stripid.sub(r'\1', text) | Remove the hexadecimal id from a Python object representation. | Remove the hexadecimal id from a Python object representation. | [
"Remove",
"the",
"hexadecimal",
"id",
"from",
"a",
"Python",
"object",
"representation",
"."
] | def stripid(text):
"""Remove the hexadecimal id from a Python object representation."""
# The behaviour of %p is implementation-dependent in terms of case.
return _re_stripid.sub(r'\1', text) | [
"def",
"stripid",
"(",
"text",
")",
":",
"# The behaviour of %p is implementation-dependent in terms of case.",
"return",
"_re_stripid",
".",
"sub",
"(",
"r'\\1'",
",",
"text",
")"
] | https://github.com/zhl2008/awd-platform/blob/0416b31abea29743387b10b3914581fbe8e7da5e/web_flaskbb/Python-2.7.9/Lib/pydoc.py#L125-L128 | |
secdev/scapy | 65089071da1acf54622df0b4fa7fc7673d47d3cd | scapy/contrib/automotive/ccp.py | python | DTO.answers | (self, other) | return 1 | In CCP, the payload of a DTO packet is dependent on the cmd field
of a corresponding CRO packet. Two packets correspond, if there
ctr field is equal. If answers detect the corresponding CRO, it will
interpret the payload of a DTO with the correct class. In CCP, there is
no other way, to ... | In CCP, the payload of a DTO packet is dependent on the cmd field
of a corresponding CRO packet. Two packets correspond, if there
ctr field is equal. If answers detect the corresponding CRO, it will
interpret the payload of a DTO with the correct class. In CCP, there is
no other way, to ... | [
"In",
"CCP",
"the",
"payload",
"of",
"a",
"DTO",
"packet",
"is",
"dependent",
"on",
"the",
"cmd",
"field",
"of",
"a",
"corresponding",
"CRO",
"packet",
".",
"Two",
"packets",
"correspond",
"if",
"there",
"ctr",
"field",
"is",
"equal",
".",
"If",
"answers... | def answers(self, other):
"""In CCP, the payload of a DTO packet is dependent on the cmd field
of a corresponding CRO packet. Two packets correspond, if there
ctr field is equal. If answers detect the corresponding CRO, it will
interpret the payload of a DTO with the correct class. In CC... | [
"def",
"answers",
"(",
"self",
",",
"other",
")",
":",
"if",
"not",
"hasattr",
"(",
"other",
",",
"\"ctr\"",
")",
":",
"return",
"0",
"if",
"self",
".",
"ctr",
"!=",
"other",
".",
"ctr",
":",
"return",
"0",
"if",
"not",
"hasattr",
"(",
"other",
"... | https://github.com/secdev/scapy/blob/65089071da1acf54622df0b4fa7fc7673d47d3cd/scapy/contrib/automotive/ccp.py#L564-L586 | |
domlysz/BlenderGIS | 0c00bc361d05599467174b8721d4cfeb4c3db608 | core/georaster/georef.py | python | GeoRef.pxFromGeo | (self, x, y, reverseY=False, round2Floor=False) | return xy(xPx, yPx) | Affine transformation (cf. ESRI WorldFile spec.)
Return pixel position of given geographic coords
use reverseY option to get y pixels counting from bottom
Pixels position is range from 0 (not 1) | Affine transformation (cf. ESRI WorldFile spec.)
Return pixel position of given geographic coords
use reverseY option to get y pixels counting from bottom
Pixels position is range from 0 (not 1) | [
"Affine",
"transformation",
"(",
"cf",
".",
"ESRI",
"WorldFile",
"spec",
".",
")",
"Return",
"pixel",
"position",
"of",
"given",
"geographic",
"coords",
"use",
"reverseY",
"option",
"to",
"get",
"y",
"pixels",
"counting",
"from",
"bottom",
"Pixels",
"position"... | def pxFromGeo(self, x, y, reverseY=False, round2Floor=False):
"""
Affine transformation (cf. ESRI WorldFile spec.)
Return pixel position of given geographic coords
use reverseY option to get y pixels counting from bottom
Pixels position is range from 0 (not 1)
"""
# aliases for more readability
pxSizex,... | [
"def",
"pxFromGeo",
"(",
"self",
",",
"x",
",",
"y",
",",
"reverseY",
"=",
"False",
",",
"round2Floor",
"=",
"False",
")",
":",
"# aliases for more readability",
"pxSizex",
",",
"pxSizey",
"=",
"self",
".",
"pxSize",
"rotx",
",",
"roty",
"=",
"self",
"."... | https://github.com/domlysz/BlenderGIS/blob/0c00bc361d05599467174b8721d4cfeb4c3db608/core/georaster/georef.py#L321-L343 | |
ClusterLabs/pcs | 1f225199e02c8d20456bb386f4c913c3ff21ac78 | pcs/config.py | python | config_checkpoint_diff | (lib, argv, modifiers) | Commandline options:
* -f - CIB file | Commandline options:
* -f - CIB file | [
"Commandline",
"options",
":",
"*",
"-",
"f",
"-",
"CIB",
"file"
] | def config_checkpoint_diff(lib, argv, modifiers):
"""
Commandline options:
* -f - CIB file
"""
modifiers.ensure_only_supported("-f")
if len(argv) != 2:
print_to_stderr(usage.config(["checkpoint diff"]))
sys.exit(1)
if argv[0] == argv[1]:
utils.err("cannot diff a ch... | [
"def",
"config_checkpoint_diff",
"(",
"lib",
",",
"argv",
",",
"modifiers",
")",
":",
"modifiers",
".",
"ensure_only_supported",
"(",
"\"-f\"",
")",
"if",
"len",
"(",
"argv",
")",
"!=",
"2",
":",
"print_to_stderr",
"(",
"usage",
".",
"config",
"(",
"[",
... | https://github.com/ClusterLabs/pcs/blob/1f225199e02c8d20456bb386f4c913c3ff21ac78/pcs/config.py#L716-L769 | ||
antonylesuisse/qweb | 2d6964a3e5cae90414c4f873eb770591f569dfe0 | qweb_python/qweb/static.py | python | WSGIStaticServe.__init__ | (self, urlroot="/", root=".", listdir=1, banner='') | [] | def __init__(self, urlroot="/", root=".", listdir=1, banner=''):
self.urlroot=urlroot
self.root="."
self.listdir=listdir
self.banner=banner
self.type_map=mimetypes.types_map.copy()
self.type_map['.csv']='text/csv' | [
"def",
"__init__",
"(",
"self",
",",
"urlroot",
"=",
"\"/\"",
",",
"root",
"=",
"\".\"",
",",
"listdir",
"=",
"1",
",",
"banner",
"=",
"''",
")",
":",
"self",
".",
"urlroot",
"=",
"urlroot",
"self",
".",
"root",
"=",
"\".\"",
"self",
".",
"listdir"... | https://github.com/antonylesuisse/qweb/blob/2d6964a3e5cae90414c4f873eb770591f569dfe0/qweb_python/qweb/static.py#L197-L203 | ||||
AppScale/gts | 46f909cf5dc5ba81faf9d81dc9af598dcf8a82a9 | AppServer/lib/django-0.96/django/core/validators.py | python | isCommaSeparatedEmailList | (field_data, all_data) | Checks that field_data is a string of e-mail addresses separated by commas.
Blank field_data values will not throw a validation error, and whitespace
is allowed around the commas. | Checks that field_data is a string of e-mail addresses separated by commas.
Blank field_data values will not throw a validation error, and whitespace
is allowed around the commas. | [
"Checks",
"that",
"field_data",
"is",
"a",
"string",
"of",
"e",
"-",
"mail",
"addresses",
"separated",
"by",
"commas",
".",
"Blank",
"field_data",
"values",
"will",
"not",
"throw",
"a",
"validation",
"error",
"and",
"whitespace",
"is",
"allowed",
"around",
"... | def isCommaSeparatedEmailList(field_data, all_data):
"""
Checks that field_data is a string of e-mail addresses separated by commas.
Blank field_data values will not throw a validation error, and whitespace
is allowed around the commas.
"""
for supposed_email in field_data.split(','):
tr... | [
"def",
"isCommaSeparatedEmailList",
"(",
"field_data",
",",
"all_data",
")",
":",
"for",
"supposed_email",
"in",
"field_data",
".",
"split",
"(",
"','",
")",
":",
"try",
":",
"isValidEmail",
"(",
"supposed_email",
".",
"strip",
"(",
")",
",",
"''",
")",
"e... | https://github.com/AppScale/gts/blob/46f909cf5dc5ba81faf9d81dc9af598dcf8a82a9/AppServer/lib/django-0.96/django/core/validators.py#L89-L99 | ||
buke/GreenOdoo | 3d8c55d426fb41fdb3f2f5a1533cfe05983ba1df | source/addons/purchase_requisition/purchase_requisition.py | python | purchase_requisition.make_purchase_order | (self, cr, uid, ids, partner_id, context=None) | return res | Create New RFQ for Supplier | Create New RFQ for Supplier | [
"Create",
"New",
"RFQ",
"for",
"Supplier"
] | def make_purchase_order(self, cr, uid, ids, partner_id, context=None):
"""
Create New RFQ for Supplier
"""
context = dict(context or {})
assert partner_id, 'Supplier should be specified'
purchase_order = self.pool.get('purchase.order')
purchase_order_line = self.p... | [
"def",
"make_purchase_order",
"(",
"self",
",",
"cr",
",",
"uid",
",",
"ids",
",",
"partner_id",
",",
"context",
"=",
"None",
")",
":",
"context",
"=",
"dict",
"(",
"context",
"or",
"{",
"}",
")",
"assert",
"partner_id",
",",
"'Supplier should be specified... | https://github.com/buke/GreenOdoo/blob/3d8c55d426fb41fdb3f2f5a1533cfe05983ba1df/source/addons/purchase_requisition/purchase_requisition.py#L177-L197 | |
tariqdaouda/pyGeno | 6311c9cd94443e05b130d8b4babc24c374a77d7c | pyGeno/tools/parsers/FastaTools.py | python | FastaFile.__setitem__ | (self, i, v) | sets the value of the ith entry | sets the value of the ith entry | [
"sets",
"the",
"value",
"of",
"the",
"ith",
"entry"
] | def __setitem__(self, i, v) :
"""sets the value of the ith entry"""
if len(v) != 2:
raise TypeError("v must have a len of 2 : (header, data)")
self.data[i] = v | [
"def",
"__setitem__",
"(",
"self",
",",
"i",
",",
"v",
")",
":",
"if",
"len",
"(",
"v",
")",
"!=",
"2",
":",
"raise",
"TypeError",
"(",
"\"v must have a len of 2 : (header, data)\"",
")",
"self",
".",
"data",
"[",
"i",
"]",
"=",
"v"
] | https://github.com/tariqdaouda/pyGeno/blob/6311c9cd94443e05b130d8b4babc24c374a77d7c/pyGeno/tools/parsers/FastaTools.py#L91-L96 | ||
ajinabraham/OWASP-Xenotix-XSS-Exploit-Framework | cb692f527e4e819b6c228187c5702d990a180043 | external/Scripting Engine/Xenotix Python Scripting Engine/packages/IronPython.StdLib.2.7.4/content/Lib/inspect.py | python | getsourcefile | (object) | Return the filename that can be used to locate an object's source.
Return None if no way can be identified to get the source. | Return the filename that can be used to locate an object's source.
Return None if no way can be identified to get the source. | [
"Return",
"the",
"filename",
"that",
"can",
"be",
"used",
"to",
"locate",
"an",
"object",
"s",
"source",
".",
"Return",
"None",
"if",
"no",
"way",
"can",
"be",
"identified",
"to",
"get",
"the",
"source",
"."
] | def getsourcefile(object):
"""Return the filename that can be used to locate an object's source.
Return None if no way can be identified to get the source.
"""
filename = getfile(object)
if string.lower(filename[-4:]) in ('.pyc', '.pyo'):
filename = filename[:-4] + '.py'
for suffix, mode... | [
"def",
"getsourcefile",
"(",
"object",
")",
":",
"filename",
"=",
"getfile",
"(",
"object",
")",
"if",
"string",
".",
"lower",
"(",
"filename",
"[",
"-",
"4",
":",
"]",
")",
"in",
"(",
"'.pyc'",
",",
"'.pyo'",
")",
":",
"filename",
"=",
"filename",
... | https://github.com/ajinabraham/OWASP-Xenotix-XSS-Exploit-Framework/blob/cb692f527e4e819b6c228187c5702d990a180043/external/Scripting Engine/Xenotix Python Scripting Engine/packages/IronPython.StdLib.2.7.4/content/Lib/inspect.py#L442-L460 | ||
sametmax/Django--an-app-at-a-time | 99eddf12ead76e6dfbeb09ce0bae61e282e22f8a | ignore_this_directory/django/core/serializers/xml_serializer.py | python | Deserializer._make_parser | (self) | return DefusedExpatParser() | Create a hardened XML parser (no custom/external entities). | Create a hardened XML parser (no custom/external entities). | [
"Create",
"a",
"hardened",
"XML",
"parser",
"(",
"no",
"custom",
"/",
"external",
"entities",
")",
"."
] | def _make_parser(self):
"""Create a hardened XML parser (no custom/external entities)."""
return DefusedExpatParser() | [
"def",
"_make_parser",
"(",
"self",
")",
":",
"return",
"DefusedExpatParser",
"(",
")"
] | https://github.com/sametmax/Django--an-app-at-a-time/blob/99eddf12ead76e6dfbeb09ce0bae61e282e22f8a/ignore_this_directory/django/core/serializers/xml_serializer.py#L160-L162 | |
jonathanslenders/asyncio-redis | 50d71a53798967f7fdf1be36b8447e322dedc5ee | asyncio_redis/protocol.py | python | RedisProtocol.bitop_not | (self, tr, destkey: NativeType, key: NativeType) | return self._query(
tr,
b"bitop",
b"not",
self.encode_from_native(destkey),
self.encode_from_native(key),
) | Perform a bitwise NOT operation between multiple keys | Perform a bitwise NOT operation between multiple keys | [
"Perform",
"a",
"bitwise",
"NOT",
"operation",
"between",
"multiple",
"keys"
] | def bitop_not(self, tr, destkey: NativeType, key: NativeType) -> int:
"""Perform a bitwise NOT operation between multiple keys
"""
return self._query(
tr,
b"bitop",
b"not",
self.encode_from_native(destkey),
self.encode_from_native(key),... | [
"def",
"bitop_not",
"(",
"self",
",",
"tr",
",",
"destkey",
":",
"NativeType",
",",
"key",
":",
"NativeType",
")",
"->",
"int",
":",
"return",
"self",
".",
"_query",
"(",
"tr",
",",
"b\"bitop\"",
",",
"b\"not\"",
",",
"self",
".",
"encode_from_native",
... | https://github.com/jonathanslenders/asyncio-redis/blob/50d71a53798967f7fdf1be36b8447e322dedc5ee/asyncio_redis/protocol.py#L1384-L1393 | |
w3h/isf | 6faf0a3df185465ec17369c90ccc16e2a03a1870 | lib/thirdparty/pyreadline/modes/notemacs.py | python | NotEmacsMode.delete_char_or_list | (self, e) | Deletes the character under the cursor if not at the beginning or
end of the line (like delete-char). If at the end of the line,
behaves identically to possible-completions. This command is unbound
by default. | Deletes the character under the cursor if not at the beginning or
end of the line (like delete-char). If at the end of the line,
behaves identically to possible-completions. This command is unbound
by default. | [
"Deletes",
"the",
"character",
"under",
"the",
"cursor",
"if",
"not",
"at",
"the",
"beginning",
"or",
"end",
"of",
"the",
"line",
"(",
"like",
"delete",
"-",
"char",
")",
".",
"If",
"at",
"the",
"end",
"of",
"the",
"line",
"behaves",
"identically",
"to... | def delete_char_or_list(self, e): # ()
'''Deletes the character under the cursor if not at the beginning or
end of the line (like delete-char). If at the end of the line,
behaves identically to possible-completions. This command is unbound
by default.'''
pass | [
"def",
"delete_char_or_list",
"(",
"self",
",",
"e",
")",
":",
"# ()",
"pass"
] | https://github.com/w3h/isf/blob/6faf0a3df185465ec17369c90ccc16e2a03a1870/lib/thirdparty/pyreadline/modes/notemacs.py#L458-L463 | ||
pywinauto/pywinauto | 7235e6f83edfd96a7aeb8bbf9fef7b8f3d912512 | pywinauto/handleprops.py | python | dumpwindow | (handle) | return props | Dump a window to a set of properties | Dump a window to a set of properties | [
"Dump",
"a",
"window",
"to",
"a",
"set",
"of",
"properties"
] | def dumpwindow(handle):
"""Dump a window to a set of properties"""
props = {}
for func in (text,
classname,
rectangle,
clientrect,
style,
exstyle,
contexthelpid,
controlid,
... | [
"def",
"dumpwindow",
"(",
"handle",
")",
":",
"props",
"=",
"{",
"}",
"for",
"func",
"in",
"(",
"text",
",",
"classname",
",",
"rectangle",
",",
"clientrect",
",",
"style",
",",
"exstyle",
",",
"contexthelpid",
",",
"controlid",
",",
"userdata",
",",
"... | https://github.com/pywinauto/pywinauto/blob/7235e6f83edfd96a7aeb8bbf9fef7b8f3d912512/pywinauto/handleprops.py#L383-L407 | |
tomplus/kubernetes_asyncio | f028cc793e3a2c519be6a52a49fb77ff0b014c9b | kubernetes_asyncio/client/models/v1beta1_mutating_webhook.py | python | V1beta1MutatingWebhook.__init__ | (self, admission_review_versions=None, client_config=None, failure_policy=None, match_policy=None, name=None, namespace_selector=None, object_selector=None, reinvocation_policy=None, rules=None, side_effects=None, timeout_seconds=None, local_vars_configuration=None) | V1beta1MutatingWebhook - a model defined in OpenAPI | V1beta1MutatingWebhook - a model defined in OpenAPI | [
"V1beta1MutatingWebhook",
"-",
"a",
"model",
"defined",
"in",
"OpenAPI"
] | def __init__(self, admission_review_versions=None, client_config=None, failure_policy=None, match_policy=None, name=None, namespace_selector=None, object_selector=None, reinvocation_policy=None, rules=None, side_effects=None, timeout_seconds=None, local_vars_configuration=None): # noqa: E501
"""V1beta1Mutating... | [
"def",
"__init__",
"(",
"self",
",",
"admission_review_versions",
"=",
"None",
",",
"client_config",
"=",
"None",
",",
"failure_policy",
"=",
"None",
",",
"match_policy",
"=",
"None",
",",
"name",
"=",
"None",
",",
"namespace_selector",
"=",
"None",
",",
"ob... | https://github.com/tomplus/kubernetes_asyncio/blob/f028cc793e3a2c519be6a52a49fb77ff0b014c9b/kubernetes_asyncio/client/models/v1beta1_mutating_webhook.py#L63-L101 | ||
gammapy/gammapy | 735b25cd5bbed35e2004d633621896dcd5295e8b | dev/authors.py | python | get_full_name | (author_data) | return " ".join(parts) | Get full name from CITATION.cff parts | Get full name from CITATION.cff parts | [
"Get",
"full",
"name",
"from",
"CITATION",
".",
"cff",
"parts"
] | def get_full_name(author_data):
"""Get full name from CITATION.cff parts"""
parts = []
parts.append(author_data["given-names"])
name_particle = author_data.get("name-particle", None)
if name_particle:
parts.append(name_particle)
parts.append(author_data["family-names"])
return " "... | [
"def",
"get_full_name",
"(",
"author_data",
")",
":",
"parts",
"=",
"[",
"]",
"parts",
".",
"append",
"(",
"author_data",
"[",
"\"given-names\"",
"]",
")",
"name_particle",
"=",
"author_data",
".",
"get",
"(",
"\"name-particle\"",
",",
"None",
")",
"if",
"... | https://github.com/gammapy/gammapy/blob/735b25cd5bbed35e2004d633621896dcd5295e8b/dev/authors.py#L39-L50 | |
phaethon/kamene | bf679a65d456411942ee4a907818ba3d6a183bfe | kamene/layers/ipsec.py | python | AuthAlgo.check_key | (self, key) | Check that the key length is valid.
@param key: a byte string | Check that the key length is valid. | [
"Check",
"that",
"the",
"key",
"length",
"is",
"valid",
"."
] | def check_key(self, key):
"""
Check that the key length is valid.
@param key: a byte string
"""
if self.key_size and len(key) not in self.key_size:
raise TypeError('invalid key size %s, must be one of %s' %
(len(key), self.key_size)) | [
"def",
"check_key",
"(",
"self",
",",
"key",
")",
":",
"if",
"self",
".",
"key_size",
"and",
"len",
"(",
"key",
")",
"not",
"in",
"self",
".",
"key_size",
":",
"raise",
"TypeError",
"(",
"'invalid key size %s, must be one of %s'",
"%",
"(",
"len",
"(",
"... | https://github.com/phaethon/kamene/blob/bf679a65d456411942ee4a907818ba3d6a183bfe/kamene/layers/ipsec.py#L476-L484 | ||
nosmokingbandit/watcher | dadacd21a5790ee609058a98a17fcc8954d24439 | lib/cherrypy/wsgiserver/__init__.py | python | HTTPServer.bind | (self, family, type, proto=0) | Create (or recreate) the actual socket object. | Create (or recreate) the actual socket object. | [
"Create",
"(",
"or",
"recreate",
")",
"the",
"actual",
"socket",
"object",
"."
] | def bind(self, family, type, proto=0):
"""Create (or recreate) the actual socket object."""
self.socket = socket.socket(family, type, proto)
prevent_socket_inheritance(self.socket)
self.socket.setsockopt(socket.SOL_SOCKET, socket.SO_REUSEADDR, 1)
if self.nodelay and not isinstanc... | [
"def",
"bind",
"(",
"self",
",",
"family",
",",
"type",
",",
"proto",
"=",
"0",
")",
":",
"self",
".",
"socket",
"=",
"socket",
".",
"socket",
"(",
"family",
",",
"type",
",",
"proto",
")",
"prevent_socket_inheritance",
"(",
"self",
".",
"socket",
")... | https://github.com/nosmokingbandit/watcher/blob/dadacd21a5790ee609058a98a17fcc8954d24439/lib/cherrypy/wsgiserver/__init__.py#L2042-L2066 | ||
microsoft/MASS | a72a74e5cab150f75cd4e241afa4681bfb92b721 | MASS-unsupNMT/translate.py | python | get_parser | () | return parser | Generate a parameters parser. | Generate a parameters parser. | [
"Generate",
"a",
"parameters",
"parser",
"."
] | def get_parser():
"""
Generate a parameters parser.
"""
# parse parameters
parser = argparse.ArgumentParser(description="Translate sentences")
# main parameters
parser.add_argument("--dump_path", type=str, default="./dumped/", help="Experiment dump path")
parser.add_argument("--exp_name... | [
"def",
"get_parser",
"(",
")",
":",
"# parse parameters",
"parser",
"=",
"argparse",
".",
"ArgumentParser",
"(",
"description",
"=",
"\"Translate sentences\"",
")",
"# main parameters",
"parser",
".",
"add_argument",
"(",
"\"--dump_path\"",
",",
"type",
"=",
"str",
... | https://github.com/microsoft/MASS/blob/a72a74e5cab150f75cd4e241afa4681bfb92b721/MASS-unsupNMT/translate.py#L32-L60 | |
FSecureLABS/Jandroid | e31d0dab58a2bfd6ed8e0a387172b8bd7c893436 | gui/appJar.py | python | gui.addEmptyLabel | (self, title, row=None, column=0, colspan=0, rowspan=0) | return self.addLabel(title=title, text='', row=row, column=column, colspan=colspan, rowspan=rowspan) | adds an empty label | adds an empty label | [
"adds",
"an",
"empty",
"label"
] | def addEmptyLabel(self, title, row=None, column=0, colspan=0, rowspan=0):
''' adds an empty label '''
return self.addLabel(title=title, text='', row=row, column=column, colspan=colspan, rowspan=rowspan) | [
"def",
"addEmptyLabel",
"(",
"self",
",",
"title",
",",
"row",
"=",
"None",
",",
"column",
"=",
"0",
",",
"colspan",
"=",
"0",
",",
"rowspan",
"=",
"0",
")",
":",
"return",
"self",
".",
"addLabel",
"(",
"title",
"=",
"title",
",",
"text",
"=",
"'... | https://github.com/FSecureLABS/Jandroid/blob/e31d0dab58a2bfd6ed8e0a387172b8bd7c893436/gui/appJar.py#L9116-L9118 | |
gramps-project/gramps | 04d4651a43eb210192f40a9f8c2bad8ee8fa3753 | gramps/gui/widgets/statusbar.py | python | Statusbar.clear_filter | (self) | Clear the filter status text. | Clear the filter status text. | [
"Clear",
"the",
"filter",
"status",
"text",
"."
] | def clear_filter(self):
"""Clear the filter status text."""
self.__filter.set_text('') | [
"def",
"clear_filter",
"(",
"self",
")",
":",
"self",
".",
"__filter",
".",
"set_text",
"(",
"''",
")"
] | https://github.com/gramps-project/gramps/blob/04d4651a43eb210192f40a9f8c2bad8ee8fa3753/gramps/gui/widgets/statusbar.py#L112-L114 | ||
naftaliharris/tauthon | 5587ceec329b75f7caf6d65a036db61ac1bae214 | Lib/plat-mac/macresource.py | python | open_error_resource | () | Open the resource file containing the error code to error message
mapping. | Open the resource file containing the error code to error message
mapping. | [
"Open",
"the",
"resource",
"file",
"containing",
"the",
"error",
"code",
"to",
"error",
"message",
"mapping",
"."
] | def open_error_resource():
"""Open the resource file containing the error code to error message
mapping."""
need('Estr', 1, filename="errors.rsrc", modname=__name__) | [
"def",
"open_error_resource",
"(",
")",
":",
"need",
"(",
"'Estr'",
",",
"1",
",",
"filename",
"=",
"\"errors.rsrc\"",
",",
"modname",
"=",
"__name__",
")"
] | https://github.com/naftaliharris/tauthon/blob/5587ceec329b75f7caf6d65a036db61ac1bae214/Lib/plat-mac/macresource.py#L114-L117 | ||
angr/claripy | 4c961b4dc664706be8142fe4868f27655bc8da77 | claripy/ast/bv.py | python | BVS | (name, size, min=None, max=None, stride=None, uninitialized=False, #pylint:disable=redefined-builtin
explicit_name=None, discrete_set=False, discrete_set_max_card=None, **kwargs) | return BV('BVS', (n, min, max, stride, uninitialized, discrete_set, discrete_set_max_card), variables={n},
length=size, symbolic=True, eager_backends=None, uninitialized=uninitialized, encoded_name=encoded_name,
**kwargs) | Creates a bit-vector symbol (i.e., a variable).
If you want to specify the maximum or minimum value of a normal symbol that is not part of value-set analysis, you
should manually add constraints to that effect. **Do not use ``min`` and ``max`` for symbolic execution.**
:param name: The name of ... | Creates a bit-vector symbol (i.e., a variable). | [
"Creates",
"a",
"bit",
"-",
"vector",
"symbol",
"(",
"i",
".",
"e",
".",
"a",
"variable",
")",
"."
] | def BVS(name, size, min=None, max=None, stride=None, uninitialized=False, #pylint:disable=redefined-builtin
explicit_name=None, discrete_set=False, discrete_set_max_card=None, **kwargs):
"""
Creates a bit-vector symbol (i.e., a variable).
If you want to specify the maximum or minimum value of a no... | [
"def",
"BVS",
"(",
"name",
",",
"size",
",",
"min",
"=",
"None",
",",
"max",
"=",
"None",
",",
"stride",
"=",
"None",
",",
"uninitialized",
"=",
"False",
",",
"#pylint:disable=redefined-builtin",
"explicit_name",
"=",
"None",
",",
"discrete_set",
"=",
"Fal... | https://github.com/angr/claripy/blob/4c961b4dc664706be8142fe4868f27655bc8da77/claripy/ast/bv.py#L197-L236 | |
Source-Python-Dev-Team/Source.Python | d0ffd8ccbd1e9923c9bc44936f20613c1c76b7fb | addons/source-python/Python3/smtplib.py | python | SMTP.set_debuglevel | (self, debuglevel) | Set the debug output level.
A non-false value results in debug messages for connection and for all
messages sent to and received from the server. | Set the debug output level. | [
"Set",
"the",
"debug",
"output",
"level",
"."
] | def set_debuglevel(self, debuglevel):
"""Set the debug output level.
A non-false value results in debug messages for connection and for all
messages sent to and received from the server.
"""
self.debuglevel = debuglevel | [
"def",
"set_debuglevel",
"(",
"self",
",",
"debuglevel",
")",
":",
"self",
".",
"debuglevel",
"=",
"debuglevel"
] | https://github.com/Source-Python-Dev-Team/Source.Python/blob/d0ffd8ccbd1e9923c9bc44936f20613c1c76b7fb/addons/source-python/Python3/smtplib.py#L285-L292 | ||
tensorflow/models | 6b8bb0cbeb3e10415c7a87448f08adc3c484c1d3 | official/recommendation/ranking/task.py | python | RankingTask.validation_step | (
self,
inputs: Dict[str, tf.Tensor],
model: tf.keras.Model,
metrics: Optional[List[tf.keras.metrics.Metric]] = None) | return model.test_step(inputs) | See base class. | See base class. | [
"See",
"base",
"class",
"."
] | def validation_step(
self,
inputs: Dict[str, tf.Tensor],
model: tf.keras.Model,
metrics: Optional[List[tf.keras.metrics.Metric]] = None) -> tf.Tensor:
"""See base class."""
# All metrics need to be passed through the RankingModel.
assert metrics == model.metrics
return model.test... | [
"def",
"validation_step",
"(",
"self",
",",
"inputs",
":",
"Dict",
"[",
"str",
",",
"tf",
".",
"Tensor",
"]",
",",
"model",
":",
"tf",
".",
"keras",
".",
"Model",
",",
"metrics",
":",
"Optional",
"[",
"List",
"[",
"tf",
".",
"keras",
".",
"metrics"... | https://github.com/tensorflow/models/blob/6b8bb0cbeb3e10415c7a87448f08adc3c484c1d3/official/recommendation/ranking/task.py#L190-L198 | |
SteveDoyle2/pyNastran | eda651ac2d4883d95a34951f8a002ff94f642a1a | pyNastran/bdf/subcase.py | python | Subcase.finish_subcase | (self) | Removes the subcase parameter from the subcase to avoid printing
it in a funny spot | Removes the subcase parameter from the subcase to avoid printing
it in a funny spot | [
"Removes",
"the",
"subcase",
"parameter",
"from",
"the",
"subcase",
"to",
"avoid",
"printing",
"it",
"in",
"a",
"funny",
"spot"
] | def finish_subcase(self):
"""
Removes the subcase parameter from the subcase to avoid printing
it in a funny spot
"""
if 'SUBCASE' in self.params:
del self.params['SUBCASE'] | [
"def",
"finish_subcase",
"(",
"self",
")",
":",
"if",
"'SUBCASE'",
"in",
"self",
".",
"params",
":",
"del",
"self",
".",
"params",
"[",
"'SUBCASE'",
"]"
] | https://github.com/SteveDoyle2/pyNastran/blob/eda651ac2d4883d95a34951f8a002ff94f642a1a/pyNastran/bdf/subcase.py#L1044-L1050 | ||
statsmodels/statsmodels | debbe7ea6ba28fe5bdb78f09f8cac694bef98722 | statsmodels/genmod/families/links.py | python | CDFLink.inverse_deriv2 | (self, z) | return _approx_fprime_scalar(z, self.inverse_deriv, centered=True) | Second derivative of the inverse link function g^(-1)(z).
Parameters
----------
z : array_like
`z` is usually the linear predictor for a GLM or GEE model.
Returns
-------
g^(-1)''(z) : ndarray
The value of the second derivative of the inverse of ... | Second derivative of the inverse link function g^(-1)(z). | [
"Second",
"derivative",
"of",
"the",
"inverse",
"link",
"function",
"g^",
"(",
"-",
"1",
")",
"(",
"z",
")",
"."
] | def inverse_deriv2(self, z):
"""
Second derivative of the inverse link function g^(-1)(z).
Parameters
----------
z : array_like
`z` is usually the linear predictor for a GLM or GEE model.
Returns
-------
g^(-1)''(z) : ndarray
The ... | [
"def",
"inverse_deriv2",
"(",
"self",
",",
"z",
")",
":",
"from",
"statsmodels",
".",
"tools",
".",
"numdiff",
"import",
"_approx_fprime_scalar",
"z",
"=",
"np",
".",
"atleast_1d",
"(",
"z",
")",
"# Note: special function for norm.ppf does not support complex",
"ret... | https://github.com/statsmodels/statsmodels/blob/debbe7ea6ba28fe5bdb78f09f8cac694bef98722/statsmodels/genmod/families/links.py#L710-L735 | |
plasticityai/supersqlite | d74da749c6fa5df021df3968b854b9a59f829e17 | setup.py | python | source_for_module_with_pyinit | (module, parent_module='') | return os.path.relpath(source_file, PROJ_PATH) | Create PyInit symbols for shared objects compiled with Python's
Extension() | Create PyInit symbols for shared objects compiled with Python's
Extension() | [
"Create",
"PyInit",
"symbols",
"for",
"shared",
"objects",
"compiled",
"with",
"Python",
"s",
"Extension",
"()"
] | def source_for_module_with_pyinit(module, parent_module=''):
""" Create PyInit symbols for shared objects compiled with Python's
Extension()"""
source_path = os.path.join(BUILD_PATH, 'entrypoints')
try:
os.makedirs(source_path)
except BaseException:
pass
source_file = os.path... | [
"def",
"source_for_module_with_pyinit",
"(",
"module",
",",
"parent_module",
"=",
"''",
")",
":",
"source_path",
"=",
"os",
".",
"path",
".",
"join",
"(",
"BUILD_PATH",
",",
"'entrypoints'",
")",
"try",
":",
"os",
".",
"makedirs",
"(",
"source_path",
")",
... | https://github.com/plasticityai/supersqlite/blob/d74da749c6fa5df021df3968b854b9a59f829e17/setup.py#L798-L812 | |
daoluan/decode-Django | d46a858b45b56de48b0355f50dd9e45402d04cfd | Django-1.5.1/django/contrib/gis/db/backends/oracle/operations.py | python | OracleOperations.spatial_lookup_sql | (self, lvalue, lookup_type, value, field, qn) | Returns the SQL WHERE clause for use in Oracle spatial SQL construction. | Returns the SQL WHERE clause for use in Oracle spatial SQL construction. | [
"Returns",
"the",
"SQL",
"WHERE",
"clause",
"for",
"use",
"in",
"Oracle",
"spatial",
"SQL",
"construction",
"."
] | def spatial_lookup_sql(self, lvalue, lookup_type, value, field, qn):
"Returns the SQL WHERE clause for use in Oracle spatial SQL construction."
alias, col, db_type = lvalue
# Getting the quoted table name as `geo_col`.
geo_col = '%s.%s' % (qn(alias), qn(col))
# See if a Oracle ... | [
"def",
"spatial_lookup_sql",
"(",
"self",
",",
"lvalue",
",",
"lookup_type",
",",
"value",
",",
"field",
",",
"qn",
")",
":",
"alias",
",",
"col",
",",
"db_type",
"=",
"lvalue",
"# Getting the quoted table name as `geo_col`.",
"geo_col",
"=",
"'%s.%s'",
"%",
"... | https://github.com/daoluan/decode-Django/blob/d46a858b45b56de48b0355f50dd9e45402d04cfd/Django-1.5.1/django/contrib/gis/db/backends/oracle/operations.py#L223-L267 | ||
wistbean/learn_python3_spider | 73c873f4845f4385f097e5057407d03dd37a117b | stackoverflow/venv/lib/python3.6/site-packages/twisted/trial/_dist/disttrial.py | python | DistTrialRunner.run | (self, suite, reactor=None, cooperate=cooperate,
untilFailure=False) | return result | Spawn local worker processes and load tests. After that, run them.
@param suite: A tests suite to be run.
@param reactor: The reactor to use, to be customized in tests.
@type reactor: A provider of
L{twisted.internet.interfaces.IReactorProcess}
@param cooperate: The cooper... | Spawn local worker processes and load tests. After that, run them. | [
"Spawn",
"local",
"worker",
"processes",
"and",
"load",
"tests",
".",
"After",
"that",
"run",
"them",
"."
] | def run(self, suite, reactor=None, cooperate=cooperate,
untilFailure=False):
"""
Spawn local worker processes and load tests. After that, run them.
@param suite: A tests suite to be run.
@param reactor: The reactor to use, to be customized in tests.
@type reactor: A... | [
"def",
"run",
"(",
"self",
",",
"suite",
",",
"reactor",
"=",
"None",
",",
"cooperate",
"=",
"cooperate",
",",
"untilFailure",
"=",
"False",
")",
":",
"if",
"reactor",
"is",
"None",
":",
"from",
"twisted",
".",
"internet",
"import",
"reactor",
"result",
... | https://github.com/wistbean/learn_python3_spider/blob/73c873f4845f4385f097e5057407d03dd37a117b/stackoverflow/venv/lib/python3.6/site-packages/twisted/trial/_dist/disttrial.py#L161-L249 | |
Jack-Cherish/python-spider | 0d3b56b3ec179cac93155fc14cec815b3c963083 | bilibili/xml2ass.py | python | main | () | [] | def main():
if len(sys.argv) == 1:
sys.argv.append('--help')
parser = argparse.ArgumentParser()
parser.add_argument('-o', '--output', metavar=_('OUTPUT'), help=_('Output file'))
parser.add_argument('-s', '--size', metavar=_('WIDTHxHEIGHT'), required=True, help=_('Stage size in pixels'))
pars... | [
"def",
"main",
"(",
")",
":",
"if",
"len",
"(",
"sys",
".",
"argv",
")",
"==",
"1",
":",
"sys",
".",
"argv",
".",
"append",
"(",
"'--help'",
")",
"parser",
"=",
"argparse",
".",
"ArgumentParser",
"(",
")",
"parser",
".",
"add_argument",
"(",
"'-o'"... | https://github.com/Jack-Cherish/python-spider/blob/0d3b56b3ec179cac93155fc14cec815b3c963083/bilibili/xml2ass.py#L778-L798 | ||||
home-assistant/core | 265ebd17a3f17ed8dc1e9bdede03ac8e323f1ab1 | homeassistant/components/wake_on_lan/switch.py | python | WolSwitch.is_on | (self) | return self._state | Return true if switch is on. | Return true if switch is on. | [
"Return",
"true",
"if",
"switch",
"is",
"on",
"."
] | def is_on(self):
"""Return true if switch is on."""
return self._state | [
"def",
"is_on",
"(",
"self",
")",
":",
"return",
"self",
".",
"_state"
] | https://github.com/home-assistant/core/blob/265ebd17a3f17ed8dc1e9bdede03ac8e323f1ab1/homeassistant/components/wake_on_lan/switch.py#L104-L106 | |
hzlzh/AlfredWorkflow.com | 7055f14f6922c80ea5943839eb0caff11ae57255 | Sources/Workflows/ONE「一个」/workflow/update.py | python | get_valid_releases | (github_slug, prereleases=False) | return releases | Return list of all valid releases
:param github_slug: ``username/repo`` for workflow's GitHub repo
:param prereleases: Whether to include pre-releases.
:returns: list of dicts. Each :class:`dict` has the form
``{'version': '1.1', 'download_url': 'http://github.com/...',
'prerelease': False ... | Return list of all valid releases | [
"Return",
"list",
"of",
"all",
"valid",
"releases"
] | def get_valid_releases(github_slug, prereleases=False):
"""Return list of all valid releases
:param github_slug: ``username/repo`` for workflow's GitHub repo
:param prereleases: Whether to include pre-releases.
:returns: list of dicts. Each :class:`dict` has the form
``{'version': '1.1', 'downl... | [
"def",
"get_valid_releases",
"(",
"github_slug",
",",
"prereleases",
"=",
"False",
")",
":",
"api_url",
"=",
"build_api_url",
"(",
"github_slug",
")",
"releases",
"=",
"[",
"]",
"wf",
"(",
")",
".",
"logger",
".",
"debug",
"(",
"'Retrieving releases list from ... | https://github.com/hzlzh/AlfredWorkflow.com/blob/7055f14f6922c80ea5943839eb0caff11ae57255/Sources/Workflows/ONE「一个」/workflow/update.py#L211-L271 | |
cloudera/hue | 23f02102d4547c17c32bd5ea0eb24e9eadd657a4 | desktop/core/ext-py/docutils-0.14/docutils/utils/math/math2html.py | python | Link.setmutualdestination | (self, destination) | Set another link as destination, and set its destination to this one. | Set another link as destination, and set its destination to this one. | [
"Set",
"another",
"link",
"as",
"destination",
"and",
"set",
"its",
"destination",
"to",
"this",
"one",
"."
] | def setmutualdestination(self, destination):
"Set another link as destination, and set its destination to this one."
self.destination = destination
destination.destination = self | [
"def",
"setmutualdestination",
"(",
"self",
",",
"destination",
")",
":",
"self",
".",
"destination",
"=",
"destination",
"destination",
".",
"destination",
"=",
"self"
] | https://github.com/cloudera/hue/blob/23f02102d4547c17c32bd5ea0eb24e9eadd657a4/desktop/core/ext-py/docutils-0.14/docutils/utils/math/math2html.py#L3799-L3802 | ||
mesalock-linux/mesapy | ed546d59a21b36feb93e2309d5c6b75aa0ad95c9 | lib-python/2.7/idlelib/configSectionNameDialog.py | python | GetCfgSectionNameDialog.__init__ | (self, parent, title, message, used_names, _htest=False) | message - string, informational message to display
used_names - string collection, names already in use for validity check
_htest - bool, change box location when running htest | message - string, informational message to display
used_names - string collection, names already in use for validity check
_htest - bool, change box location when running htest | [
"message",
"-",
"string",
"informational",
"message",
"to",
"display",
"used_names",
"-",
"string",
"collection",
"names",
"already",
"in",
"use",
"for",
"validity",
"check",
"_htest",
"-",
"bool",
"change",
"box",
"location",
"when",
"running",
"htest"
] | def __init__(self, parent, title, message, used_names, _htest=False):
"""
message - string, informational message to display
used_names - string collection, names already in use for validity check
_htest - bool, change box location when running htest
"""
Toplevel.__init__... | [
"def",
"__init__",
"(",
"self",
",",
"parent",
",",
"title",
",",
"message",
",",
"used_names",
",",
"_htest",
"=",
"False",
")",
":",
"Toplevel",
".",
"__init__",
"(",
"self",
",",
"parent",
")",
"self",
".",
"configure",
"(",
"borderwidth",
"=",
"5",... | https://github.com/mesalock-linux/mesapy/blob/ed546d59a21b36feb93e2309d5c6b75aa0ad95c9/lib-python/2.7/idlelib/configSectionNameDialog.py#L10-L40 | ||
cloudera/hue | 23f02102d4547c17c32bd5ea0eb24e9eadd657a4 | desktop/core/ext-py/gunicorn-19.9.0/gunicorn/http/message.py | python | Request.proxy_protocol | (self, line) | return True | \
Detect, check and parse proxy protocol.
:raises: ForbiddenProxyRequest, InvalidProxyLine.
:return: True for proxy protocol line else False | \
Detect, check and parse proxy protocol. | [
"\\",
"Detect",
"check",
"and",
"parse",
"proxy",
"protocol",
"."
] | def proxy_protocol(self, line):
"""\
Detect, check and parse proxy protocol.
:raises: ForbiddenProxyRequest, InvalidProxyLine.
:return: True for proxy protocol line else False
"""
if not self.cfg.proxy_protocol:
return False
if self.req_number != 1:
... | [
"def",
"proxy_protocol",
"(",
"self",
",",
"line",
")",
":",
"if",
"not",
"self",
".",
"cfg",
".",
"proxy_protocol",
":",
"return",
"False",
"if",
"self",
".",
"req_number",
"!=",
"1",
":",
"return",
"False",
"if",
"not",
"line",
".",
"startswith",
"("... | https://github.com/cloudera/hue/blob/23f02102d4547c17c32bd5ea0eb24e9eadd657a4/desktop/core/ext-py/gunicorn-19.9.0/gunicorn/http/message.py#L254-L273 | |
alkaline-ml/pmdarima | cafd5c79f1e5696c609716eca1514f0aaaf2d317 | pmdarima/arima/seasonality.py | python | OCSBTest._do_lag | (y, lag, omit_na=True) | return out | Perform the TS lagging | Perform the TS lagging | [
"Perform",
"the",
"TS",
"lagging"
] | def _do_lag(y, lag, omit_na=True):
"""Perform the TS lagging"""
n = y.shape[0]
if lag == 1:
return y.reshape(n, 1)
# Create a 2d array of dims (n + (lag - 1), lag). This looks cryptic..
# If there are tons of lags, this may not be super efficient...
out = np.... | [
"def",
"_do_lag",
"(",
"y",
",",
"lag",
",",
"omit_na",
"=",
"True",
")",
":",
"n",
"=",
"y",
".",
"shape",
"[",
"0",
"]",
"if",
"lag",
"==",
"1",
":",
"return",
"y",
".",
"reshape",
"(",
"n",
",",
"1",
")",
"# Create a 2d array of dims (n + (lag -... | https://github.com/alkaline-ml/pmdarima/blob/cafd5c79f1e5696c609716eca1514f0aaaf2d317/pmdarima/arima/seasonality.py#L439-L453 | |
openstack/python-neutronclient | 517bef2c5454dde2eba5cc2194ee857be6be7164 | neutronclient/v2_0/client.py | python | Client.create_router | (self, body=None) | return self.post(self.routers_path, body=body) | Creates a new router. | Creates a new router. | [
"Creates",
"a",
"new",
"router",
"."
] | def create_router(self, body=None):
"""Creates a new router."""
return self.post(self.routers_path, body=body) | [
"def",
"create_router",
"(",
"self",
",",
"body",
"=",
"None",
")",
":",
"return",
"self",
".",
"post",
"(",
"self",
".",
"routers_path",
",",
"body",
"=",
"body",
")"
] | https://github.com/openstack/python-neutronclient/blob/517bef2c5454dde2eba5cc2194ee857be6be7164/neutronclient/v2_0/client.py#L933-L935 | |
KhronosGroup/OpenXR-SDK-Source | 76756e2e7849b15466d29bee7d80cada92865550 | external/python/jinja2/compiler.py | python | CodeGenerator.fail | (self, msg, lineno) | Fail with a :exc:`TemplateAssertionError`. | Fail with a :exc:`TemplateAssertionError`. | [
"Fail",
"with",
"a",
":",
"exc",
":",
"TemplateAssertionError",
"."
] | def fail(self, msg, lineno):
"""Fail with a :exc:`TemplateAssertionError`."""
raise TemplateAssertionError(msg, lineno, self.name, self.filename) | [
"def",
"fail",
"(",
"self",
",",
"msg",
",",
"lineno",
")",
":",
"raise",
"TemplateAssertionError",
"(",
"msg",
",",
"lineno",
",",
"self",
".",
"name",
",",
"self",
".",
"filename",
")"
] | https://github.com/KhronosGroup/OpenXR-SDK-Source/blob/76756e2e7849b15466d29bee7d80cada92865550/external/python/jinja2/compiler.py#L313-L315 | ||
kubernetes-client/python | 47b9da9de2d02b2b7a34fbe05afb44afd130d73a | kubernetes/client/models/v1_pod_spec.py | python | V1PodSpec.host_aliases | (self, host_aliases) | Sets the host_aliases of this V1PodSpec.
HostAliases is an optional list of hosts and IPs that will be injected into the pod's hosts file if specified. This is only valid for non-hostNetwork pods. # noqa: E501
:param host_aliases: The host_aliases of this V1PodSpec. # noqa: E501
:type: list[... | Sets the host_aliases of this V1PodSpec. | [
"Sets",
"the",
"host_aliases",
"of",
"this",
"V1PodSpec",
"."
] | def host_aliases(self, host_aliases):
"""Sets the host_aliases of this V1PodSpec.
HostAliases is an optional list of hosts and IPs that will be injected into the pod's hosts file if specified. This is only valid for non-hostNetwork pods. # noqa: E501
:param host_aliases: The host_aliases of t... | [
"def",
"host_aliases",
"(",
"self",
",",
"host_aliases",
")",
":",
"self",
".",
"_host_aliases",
"=",
"host_aliases"
] | https://github.com/kubernetes-client/python/blob/47b9da9de2d02b2b7a34fbe05afb44afd130d73a/kubernetes/client/models/v1_pod_spec.py#L418-L427 | ||
pwnieexpress/pwn_plug_sources | 1a23324f5dc2c3de20f9c810269b6a29b2758cad | src/wifitap/scapy.py | python | TracerouteResult.graph | (self, ASN=1, padding=0, **kargs) | x.graph(ASN=1, other args):
ASN=0 : no clustering
ASN=1 : use whois.cymru.net AS clustering
ASN=2 : use whois.ra.net AS clustering
graph: GraphViz graph description
type: output type (svg, ps, gif, jpg, etc.), passed to dot's "-T" option
target: filename or redirect. Defa... | x.graph(ASN=1, other args):
ASN=0 : no clustering
ASN=1 : use whois.cymru.net AS clustering
ASN=2 : use whois.ra.net AS clustering
graph: GraphViz graph description
type: output type (svg, ps, gif, jpg, etc.), passed to dot's "-T" option
target: filename or redirect. Defa... | [
"x",
".",
"graph",
"(",
"ASN",
"=",
"1",
"other",
"args",
")",
":",
"ASN",
"=",
"0",
":",
"no",
"clustering",
"ASN",
"=",
"1",
":",
"use",
"whois",
".",
"cymru",
".",
"net",
"AS",
"clustering",
"ASN",
"=",
"2",
":",
"use",
"whois",
".",
"ra",
... | def graph(self, ASN=1, padding=0, **kargs):
"""x.graph(ASN=1, other args):
ASN=0 : no clustering
ASN=1 : use whois.cymru.net AS clustering
ASN=2 : use whois.ra.net AS clustering
graph: GraphViz graph description
type: output type (svg, ps, gif, jpg, etc.), passed to dot's... | [
"def",
"graph",
"(",
"self",
",",
"ASN",
"=",
"1",
",",
"padding",
"=",
"0",
",",
"*",
"*",
"kargs",
")",
":",
"if",
"(",
"self",
".",
"graphdef",
"is",
"None",
"or",
"self",
".",
"graphASN",
"!=",
"ASN",
"or",
"self",
".",
"graphpadding",
"!=",
... | https://github.com/pwnieexpress/pwn_plug_sources/blob/1a23324f5dc2c3de20f9c810269b6a29b2758cad/src/wifitap/scapy.py#L3597-L3611 | ||
yqyao/SSD_Pytorch | 6060bbb650e7a1df7c12d7c9650a38eaba4ab6a8 | utils/box_utils.py | python | intersect | (box_a, box_b) | return inter[:, :, 0] * inter[:, :, 1] | We resize both tensors to [A,B,2] without new malloc:
[A,2] -> [A,1,2] -> [A,B,2]
[B,2] -> [1,B,2] -> [A,B,2]
Then we compute the area of intersect between box_a and box_b.
Args:
box_a: (tensor) bounding boxes, Shape: [A,4].
box_b: (tensor) bounding boxes, Shape: [B,4].
Return:
(te... | We resize both tensors to [A,B,2] without new malloc:
[A,2] -> [A,1,2] -> [A,B,2]
[B,2] -> [1,B,2] -> [A,B,2]
Then we compute the area of intersect between box_a and box_b.
Args:
box_a: (tensor) bounding boxes, Shape: [A,4].
box_b: (tensor) bounding boxes, Shape: [B,4].
Return:
(te... | [
"We",
"resize",
"both",
"tensors",
"to",
"[",
"A",
"B",
"2",
"]",
"without",
"new",
"malloc",
":",
"[",
"A",
"2",
"]",
"-",
">",
"[",
"A",
"1",
"2",
"]",
"-",
">",
"[",
"A",
"B",
"2",
"]",
"[",
"B",
"2",
"]",
"-",
">",
"[",
"1",
"B",
... | def intersect(box_a, box_b):
""" We resize both tensors to [A,B,2] without new malloc:
[A,2] -> [A,1,2] -> [A,B,2]
[B,2] -> [1,B,2] -> [A,B,2]
Then we compute the area of intersect between box_a and box_b.
Args:
box_a: (tensor) bounding boxes, Shape: [A,4].
box_b: (tensor) bounding boxes... | [
"def",
"intersect",
"(",
"box_a",
",",
"box_b",
")",
":",
"# print(box_a)",
"A",
"=",
"box_a",
".",
"size",
"(",
"0",
")",
"B",
"=",
"box_b",
".",
"size",
"(",
"0",
")",
"max_xy",
"=",
"torch",
".",
"min",
"(",
"box_a",
"[",
":",
",",
"2",
":",... | https://github.com/yqyao/SSD_Pytorch/blob/6060bbb650e7a1df7c12d7c9650a38eaba4ab6a8/utils/box_utils.py#L100-L119 | |
Tencent/QT4A | cc99ce12bd10f864c95b7bf0675fd1b757bce4bb | qt4a/systemui.py | python | CrashWindow.close | (self) | 关闭 | 关闭 | [
"关闭"
] | def close(self):
'''关闭
'''
self.Controls['确定'].click() | [
"def",
"close",
"(",
"self",
")",
":",
"self",
".",
"Controls",
"[",
"'确定'].cl",
"i",
"c",
"k()",
"",
""
] | https://github.com/Tencent/QT4A/blob/cc99ce12bd10f864c95b7bf0675fd1b757bce4bb/qt4a/systemui.py#L105-L108 | ||
tensorflow/models | 6b8bb0cbeb3e10415c7a87448f08adc3c484c1d3 | official/vision/beta/serving/export_tflite_lib.py | python | representative_dataset | (
params: cfg.ExperimentConfig,
calibration_steps: int = 2000) | Creates representative dataset for input calibration.
Args:
params: An ExperimentConfig.
calibration_steps: The steps to do calibration.
Yields:
An input image tensor. | Creates representative dataset for input calibration. | [
"Creates",
"representative",
"dataset",
"for",
"input",
"calibration",
"."
] | def representative_dataset(
params: cfg.ExperimentConfig,
calibration_steps: int = 2000) -> Iterator[List[tf.Tensor]]:
""""Creates representative dataset for input calibration.
Args:
params: An ExperimentConfig.
calibration_steps: The steps to do calibration.
Yields:
An input image tensor.
... | [
"def",
"representative_dataset",
"(",
"params",
":",
"cfg",
".",
"ExperimentConfig",
",",
"calibration_steps",
":",
"int",
"=",
"2000",
")",
"->",
"Iterator",
"[",
"List",
"[",
"tf",
".",
"Tensor",
"]",
"]",
":",
"dataset",
"=",
"create_representative_dataset"... | https://github.com/tensorflow/models/blob/6b8bb0cbeb3e10415c7a87448f08adc3c484c1d3/official/vision/beta/serving/export_tflite_lib.py#L60-L77 | ||
matplotlib/matplotlib | 8d7a2b9d2a38f01ee0d6802dd4f9e98aec812322 | lib/matplotlib/offsetbox.py | python | OffsetImage.get_offset | (self) | return self._offset | Return offset of the container. | Return offset of the container. | [
"Return",
"offset",
"of",
"the",
"container",
"."
] | def get_offset(self):
"""Return offset of the container."""
return self._offset | [
"def",
"get_offset",
"(",
"self",
")",
":",
"return",
"self",
".",
"_offset"
] | https://github.com/matplotlib/matplotlib/blob/8d7a2b9d2a38f01ee0d6802dd4f9e98aec812322/lib/matplotlib/offsetbox.py#L1234-L1236 | |
oracle/graalpython | 577e02da9755d916056184ec441c26e00b70145c | graalpython/lib-python/3/datetime.py | python | datetime.isoformat | (self, sep='T', timespec='auto') | return s | Return the time formatted according to ISO.
The full format looks like 'YYYY-MM-DD HH:MM:SS.mmmmmm'.
By default, the fractional part is omitted if self.microsecond == 0.
If self.tzinfo is not None, the UTC offset is also attached, giving
giving a full format of 'YYYY-MM-DD HH:MM:SS.mmm... | Return the time formatted according to ISO. | [
"Return",
"the",
"time",
"formatted",
"according",
"to",
"ISO",
"."
] | def isoformat(self, sep='T', timespec='auto'):
"""Return the time formatted according to ISO.
The full format looks like 'YYYY-MM-DD HH:MM:SS.mmmmmm'.
By default, the fractional part is omitted if self.microsecond == 0.
If self.tzinfo is not None, the UTC offset is also attached, givin... | [
"def",
"isoformat",
"(",
"self",
",",
"sep",
"=",
"'T'",
",",
"timespec",
"=",
"'auto'",
")",
":",
"s",
"=",
"(",
"\"%04d-%02d-%02d%c\"",
"%",
"(",
"self",
".",
"_year",
",",
"self",
".",
"_month",
",",
"self",
".",
"_day",
",",
"sep",
")",
"+",
... | https://github.com/oracle/graalpython/blob/577e02da9755d916056184ec441c26e00b70145c/graalpython/lib-python/3/datetime.py#L1892-L1916 | |
pyparallel/pyparallel | 11e8c6072d48c8f13641925d17b147bf36ee0ba3 | Lib/site-packages/numpy-1.10.0.dev0_046311a-py3.3-win-amd64.egg/numpy/core/numerictypes.py | python | obj2sctype | (rep, default=None) | return res.type | Return the scalar dtype or NumPy equivalent of Python type of an object.
Parameters
----------
rep : any
The object of which the type is returned.
default : any, optional
If given, this is returned for objects whose types can not be
determined. If not given, None is returned for... | Return the scalar dtype or NumPy equivalent of Python type of an object. | [
"Return",
"the",
"scalar",
"dtype",
"or",
"NumPy",
"equivalent",
"of",
"Python",
"type",
"of",
"an",
"object",
"."
] | def obj2sctype(rep, default=None):
"""
Return the scalar dtype or NumPy equivalent of Python type of an object.
Parameters
----------
rep : any
The object of which the type is returned.
default : any, optional
If given, this is returned for objects whose types can not be
... | [
"def",
"obj2sctype",
"(",
"rep",
",",
"default",
"=",
"None",
")",
":",
"try",
":",
"if",
"issubclass",
"(",
"rep",
",",
"generic",
")",
":",
"return",
"rep",
"except",
"TypeError",
":",
"pass",
"if",
"isinstance",
"(",
"rep",
",",
"dtype",
")",
":",... | https://github.com/pyparallel/pyparallel/blob/11e8c6072d48c8f13641925d17b147bf36ee0ba3/Lib/site-packages/numpy-1.10.0.dev0_046311a-py3.3-win-amd64.egg/numpy/core/numerictypes.py#L611-L665 | |
playframework/play1 | 0ecac3bc2421ae2dbec27a368bf671eda1c9cba5 | python/Lib/decimal.py | python | Decimal.__rpow__ | (self, other, context=None) | return other.__pow__(self, context=context) | Swaps self/other and returns __pow__. | Swaps self/other and returns __pow__. | [
"Swaps",
"self",
"/",
"other",
"and",
"returns",
"__pow__",
"."
] | def __rpow__(self, other, context=None):
"""Swaps self/other and returns __pow__."""
other = _convert_other(other)
if other is NotImplemented:
return other
return other.__pow__(self, context=context) | [
"def",
"__rpow__",
"(",
"self",
",",
"other",
",",
"context",
"=",
"None",
")",
":",
"other",
"=",
"_convert_other",
"(",
"other",
")",
"if",
"other",
"is",
"NotImplemented",
":",
"return",
"other",
"return",
"other",
".",
"__pow__",
"(",
"self",
",",
... | https://github.com/playframework/play1/blob/0ecac3bc2421ae2dbec27a368bf671eda1c9cba5/python/Lib/decimal.py#L2388-L2393 | |
qiucheng025/zao- | 3a5edf3607b3a523f95746bc69b688090c76d89a | lib/gui/wrapper.py | python | FaceswapControl.execute_script | (self, command, args) | Execute the requested Faceswap Script | Execute the requested Faceswap Script | [
"Execute",
"the",
"requested",
"Faceswap",
"Script"
] | def execute_script(self, command, args):
""" Execute the requested Faceswap Script """
logger.debug("Executing Faceswap: (command: '%s', args: %s)", command, args)
self.thread = None
self.command = command
kwargs = {"stdout": PIPE,
"stderr": PIPE,
... | [
"def",
"execute_script",
"(",
"self",
",",
"command",
",",
"args",
")",
":",
"logger",
".",
"debug",
"(",
"\"Executing Faceswap: (command: '%s', args: %s)\"",
",",
"command",
",",
"args",
")",
"self",
".",
"thread",
"=",
"None",
"self",
".",
"command",
"=",
... | https://github.com/qiucheng025/zao-/blob/3a5edf3607b3a523f95746bc69b688090c76d89a/lib/gui/wrapper.py#L158-L171 | ||
fluentpython/notebooks | 0f6e1e8d1686743dacd9281df7c5b5921812010a | 01-data-model/vector2d.py | python | Vector.__mul__ | (self, scalar) | return Vector(self.x * scalar, self.y * scalar) | [] | def __mul__(self, scalar):
return Vector(self.x * scalar, self.y * scalar) | [
"def",
"__mul__",
"(",
"self",
",",
"scalar",
")",
":",
"return",
"Vector",
"(",
"self",
".",
"x",
"*",
"scalar",
",",
"self",
".",
"y",
"*",
"scalar",
")"
] | https://github.com/fluentpython/notebooks/blob/0f6e1e8d1686743dacd9281df7c5b5921812010a/01-data-model/vector2d.py#L23-L24 | |||
google/rekall | 55d1925f2df9759a989b35271b4fa48fc54a1c86 | rekall-core/rekall/plugins/overlays/windows/common.py | python | _EPROCESS.is_valid | (self) | return True | Validate the _EPROCESS. | Validate the _EPROCESS. | [
"Validate",
"the",
"_EPROCESS",
"."
] | def is_valid(self):
"""Validate the _EPROCESS."""
pid = self.pid
# PID must be in a reasonable range.
if pid < 0 or pid > 0xFFFF:
return False
# Since we're not validating memory pages anymore it's important
# to weed out zero'd structs.
if ((pid == ... | [
"def",
"is_valid",
"(",
"self",
")",
":",
"pid",
"=",
"self",
".",
"pid",
"# PID must be in a reasonable range.",
"if",
"pid",
"<",
"0",
"or",
"pid",
">",
"0xFFFF",
":",
"return",
"False",
"# Since we're not validating memory pages anymore it's important",
"# to weed ... | https://github.com/google/rekall/blob/55d1925f2df9759a989b35271b4fa48fc54a1c86/rekall-core/rekall/plugins/overlays/windows/common.py#L748-L766 | |
naftaliharris/tauthon | 5587ceec329b75f7caf6d65a036db61ac1bae214 | Lib/typing.py | python | _TypeAlias.__init__ | (self, name, type_var, impl_type, type_checker) | Initializer.
Args:
name: The name, e.g. 'Pattern'.
type_var: The type parameter, e.g. AnyStr, or the
specific type, e.g. str.
impl_type: The implementation type.
type_checker: Function that takes an impl_type instance.
and returns ... | Initializer. | [
"Initializer",
"."
] | def __init__(self, name, type_var, impl_type, type_checker):
"""Initializer.
Args:
name: The name, e.g. 'Pattern'.
type_var: The type parameter, e.g. AnyStr, or the
specific type, e.g. str.
impl_type: The implementation type.
type_checker:... | [
"def",
"__init__",
"(",
"self",
",",
"name",
",",
"type_var",
",",
"impl_type",
",",
"type_checker",
")",
":",
"assert",
"isinstance",
"(",
"name",
",",
"basestring",
")",
",",
"repr",
"(",
"name",
")",
"assert",
"isinstance",
"(",
"impl_type",
",",
"typ... | https://github.com/naftaliharris/tauthon/blob/5587ceec329b75f7caf6d65a036db61ac1bae214/Lib/typing.py#L245-L263 | ||
iiau-tracker/SPLT | a196e603798e9be969d9d985c087c11cad1cda43 | train_Verifier/experiments/triplet_pairs.py | python | get_two_samples | (type) | return (roi1,roi2) | instruction | instruction | [
"instruction"
] | def get_two_samples(type):
'''instruction'''
'''pick up 1 object from a specific type'''
object_idx = np.random.randint(0, type_video_dict[type]['num_track_ids'], 1)[0]
track_id = type_video_dict[type]['track_ids'][object_idx]
track_id_num_frames = type_video_dict[type]['num_frames'][object_idx]
... | [
"def",
"get_two_samples",
"(",
"type",
")",
":",
"'''pick up 1 object from a specific type'''",
"object_idx",
"=",
"np",
".",
"random",
".",
"randint",
"(",
"0",
",",
"type_video_dict",
"[",
"type",
"]",
"[",
"'num_track_ids'",
"]",
",",
"1",
")",
"[",
"0",
... | https://github.com/iiau-tracker/SPLT/blob/a196e603798e9be969d9d985c087c11cad1cda43/train_Verifier/experiments/triplet_pairs.py#L104-L114 | |
natashamjaques/neural_chat | ddb977bb4602a67c460d02231e7bbf7b2cb49a97 | ParlAI/parlai/agents/tfidf_retriever/utils.py | python | filter_ngram | (gram, mode='any') | Decide whether to keep or discard an n-gram.
Args:
gram: list of tokens (length N)
mode: Option to throw out ngram if
'any': any single token passes filter_word
'all': all tokens pass filter_word
'ends': book-ended by filterable tokens | Decide whether to keep or discard an n-gram. | [
"Decide",
"whether",
"to",
"keep",
"or",
"discard",
"an",
"n",
"-",
"gram",
"."
] | def filter_ngram(gram, mode='any'):
"""Decide whether to keep or discard an n-gram.
Args:
gram: list of tokens (length N)
mode: Option to throw out ngram if
'any': any single token passes filter_word
'all': all tokens pass filter_word
'ends': book-ended by filterab... | [
"def",
"filter_ngram",
"(",
"gram",
",",
"mode",
"=",
"'any'",
")",
":",
"filtered",
"=",
"[",
"filter_word",
"(",
"w",
")",
"for",
"w",
"in",
"gram",
"]",
"if",
"mode",
"==",
"'any'",
":",
"return",
"any",
"(",
"filtered",
")",
"elif",
"mode",
"==... | https://github.com/natashamjaques/neural_chat/blob/ddb977bb4602a67c460d02231e7bbf7b2cb49a97/ParlAI/parlai/agents/tfidf_retriever/utils.py#L261-L279 | ||
mars-project/mars | 6afd7ed86db77f29cc9470485698ef192ecc6d33 | mars/deploy/oscar/session.py | python | AbstractAsyncSession.execute | (self, *tileables, **kwargs) | Execute tileables.
Parameters
----------
tileables
Tileables.
kwargs | Execute tileables. | [
"Execute",
"tileables",
"."
] | async def execute(self, *tileables, **kwargs) -> ExecutionInfo:
"""
Execute tileables.
Parameters
----------
tileables
Tileables.
kwargs
""" | [
"async",
"def",
"execute",
"(",
"self",
",",
"*",
"tileables",
",",
"*",
"*",
"kwargs",
")",
"->",
"ExecutionInfo",
":"
] | https://github.com/mars-project/mars/blob/6afd7ed86db77f29cc9470485698ef192ecc6d33/mars/deploy/oscar/session.py#L228-L237 | ||
rndusr/stig | 334f03e2e3eda7c1856dd5489f0265a47b9861b6 | stig/tui/views/base.py | python | ListWidgetBase.sort | (self) | return self._sort | *Sorter object or `None` to keep list items unsorted | *Sorter object or `None` to keep list items unsorted | [
"*",
"Sorter",
"object",
"or",
"None",
"to",
"keep",
"list",
"items",
"unsorted"
] | def sort(self):
"""*Sorter object or `None` to keep list items unsorted"""
return self._sort | [
"def",
"sort",
"(",
"self",
")",
":",
"return",
"self",
".",
"_sort"
] | https://github.com/rndusr/stig/blob/334f03e2e3eda7c1856dd5489f0265a47b9861b6/stig/tui/views/base.py#L346-L348 | |
deanishe/alfred-fakeum | 12a7e64d9c099c0f11416ee99fae064d6360aab2 | src/libs/faker/providers/date_time/__init__.py | python | Provider.date_time_between_dates | (
self,
datetime_start=None,
datetime_end=None,
tzinfo=None) | return pick | Takes two DateTime objects and returns a random datetime between the two
given datetimes.
Accepts DateTime objects.
:param datetime_start: DateTime
:param datetime_end: DateTime
:param tzinfo: timezone, instance of datetime.tzinfo subclass
:example DateTime('1999-02-02 1... | Takes two DateTime objects and returns a random datetime between the two
given datetimes.
Accepts DateTime objects. | [
"Takes",
"two",
"DateTime",
"objects",
"and",
"returns",
"a",
"random",
"datetime",
"between",
"the",
"two",
"given",
"datetimes",
".",
"Accepts",
"DateTime",
"objects",
"."
] | def date_time_between_dates(
self,
datetime_start=None,
datetime_end=None,
tzinfo=None):
"""
Takes two DateTime objects and returns a random datetime between the two
given datetimes.
Accepts DateTime objects.
:param datetime_start:... | [
"def",
"date_time_between_dates",
"(",
"self",
",",
"datetime_start",
"=",
"None",
",",
"datetime_end",
"=",
"None",
",",
"tzinfo",
"=",
"None",
")",
":",
"if",
"datetime_start",
"is",
"None",
":",
"datetime_start",
"=",
"datetime",
".",
"now",
"(",
"tzinfo"... | https://github.com/deanishe/alfred-fakeum/blob/12a7e64d9c099c0f11416ee99fae064d6360aab2/src/libs/faker/providers/date_time/__init__.py#L1645-L1682 | |
python-attrs/cattrs | 50ba769c8349f5891b157d2bb7f06602822ac0a3 | src/cattr/converters.py | python | Converter.register_structure_hook_func | (
self,
check_func: Callable[[Type[T]], bool],
func: Callable[[Any, Type[T]], T],
) | Register a class-to-primitive converter function for a class, using
a function to check if it's a match. | Register a class-to-primitive converter function for a class, using
a function to check if it's a match. | [
"Register",
"a",
"class",
"-",
"to",
"-",
"primitive",
"converter",
"function",
"for",
"a",
"class",
"using",
"a",
"function",
"to",
"check",
"if",
"it",
"s",
"a",
"match",
"."
] | def register_structure_hook_func(
self,
check_func: Callable[[Type[T]], bool],
func: Callable[[Any, Type[T]], T],
):
"""Register a class-to-primitive converter function for a class, using
a function to check if it's a match.
"""
self._structure_func.register_f... | [
"def",
"register_structure_hook_func",
"(",
"self",
",",
"check_func",
":",
"Callable",
"[",
"[",
"Type",
"[",
"T",
"]",
"]",
",",
"bool",
"]",
",",
"func",
":",
"Callable",
"[",
"[",
"Any",
",",
"Type",
"[",
"T",
"]",
"]",
",",
"T",
"]",
",",
")... | https://github.com/python-attrs/cattrs/blob/50ba769c8349f5891b157d2bb7f06602822ac0a3/src/cattr/converters.py#L271-L279 | ||
kbandla/ImmunityDebugger | 2abc03fb15c8f3ed0914e1175c4d8933977c73e3 | 1.83/Libs/immlib.py | python | Debugger.getCurrentAddress | (self) | return debugger.get_current_address() | Get the current address been focus on the disasm window
@rtype: DWORD
@return: Address | Get the current address been focus on the disasm window | [
"Get",
"the",
"current",
"address",
"been",
"focus",
"on",
"the",
"disasm",
"window"
] | def getCurrentAddress(self):
"""
Get the current address been focus on the disasm window
@rtype: DWORD
@return: Address
"""
return debugger.get_current_address() | [
"def",
"getCurrentAddress",
"(",
"self",
")",
":",
"return",
"debugger",
".",
"get_current_address",
"(",
")"
] | https://github.com/kbandla/ImmunityDebugger/blob/2abc03fb15c8f3ed0914e1175c4d8933977c73e3/1.83/Libs/immlib.py#L1112-L1119 | |
realpython/book2-exercises | cde325eac8e6d8cff2316601c2e5b36bb46af7d0 | py2manager/gluon/contrib/simplejson/__init__.py | python | loads | (s, encoding=None, cls=None, object_hook=None, parse_float=None,
parse_int=None, parse_constant=None, object_pairs_hook=None,
use_decimal=False, **kw) | return cls(encoding=encoding, **kw).decode(s) | Deserialize ``s`` (a ``str`` or ``unicode`` instance containing a JSON
document) to a Python object.
*encoding* determines the encoding used to interpret any
:class:`str` objects decoded by this instance (``'utf-8'`` by
default). It has no effect when decoding :class:`unicode` objects.
Note that ... | Deserialize ``s`` (a ``str`` or ``unicode`` instance containing a JSON
document) to a Python object. | [
"Deserialize",
"s",
"(",
"a",
"str",
"or",
"unicode",
"instance",
"containing",
"a",
"JSON",
"document",
")",
"to",
"a",
"Python",
"object",
"."
] | def loads(s, encoding=None, cls=None, object_hook=None, parse_float=None,
parse_int=None, parse_constant=None, object_pairs_hook=None,
use_decimal=False, **kw):
"""Deserialize ``s`` (a ``str`` or ``unicode`` instance containing a JSON
document) to a Python object.
*encoding* determines the ... | [
"def",
"loads",
"(",
"s",
",",
"encoding",
"=",
"None",
",",
"cls",
"=",
"None",
",",
"object_hook",
"=",
"None",
",",
"parse_float",
"=",
"None",
",",
"parse_int",
"=",
"None",
",",
"parse_constant",
"=",
"None",
",",
"object_pairs_hook",
"=",
"None",
... | https://github.com/realpython/book2-exercises/blob/cde325eac8e6d8cff2316601c2e5b36bb46af7d0/py2manager/gluon/contrib/simplejson/__init__.py#L333-L403 | |
smicallef/spiderfoot | fd4bf9394c9ab3ecc90adc3115c56349fb23165b | sflib.py | python | SpiderFoot.urlFQDN | (self, url: str) | return baseurl.split('/')[count].lower() | Extract the FQDN from a URL.
Args:
url (str): URL
Returns:
str: FQDN | Extract the FQDN from a URL. | [
"Extract",
"the",
"FQDN",
"from",
"a",
"URL",
"."
] | def urlFQDN(self, url: str) -> str:
"""Extract the FQDN from a URL.
Args:
url (str): URL
Returns:
str: FQDN
"""
if not url:
self.error(f"Invalid URL: {url}")
return None
baseurl = self.urlBaseUrl(url)
if '://' in ... | [
"def",
"urlFQDN",
"(",
"self",
",",
"url",
":",
"str",
")",
"->",
"str",
":",
"if",
"not",
"url",
":",
"self",
".",
"error",
"(",
"f\"Invalid URL: {url}\"",
")",
"return",
"None",
"baseurl",
"=",
"self",
".",
"urlBaseUrl",
"(",
"url",
")",
"if",
"':/... | https://github.com/smicallef/spiderfoot/blob/fd4bf9394c9ab3ecc90adc3115c56349fb23165b/sflib.py#L696-L716 | |
maas/maas | db2f89970c640758a51247c59bf1ec6f60cf4ab5 | src/maasserver/storage_custom.py | python | _get_size | (size: str) | return bytes_value | Return size in bytes from a string.
It supports M, G, T suffixes. | Return size in bytes from a string. | [
"Return",
"size",
"in",
"bytes",
"from",
"a",
"string",
"."
] | def _get_size(size: str) -> int:
"""Return size in bytes from a string.
It supports M, G, T suffixes.
"""
multipliers = {
"M": 1000 ** 2,
"G": 1000 ** 3,
"T": 1000 ** 4,
}
try:
value, multiplier = size[:-1], size[-1]
value = float(value)
bytes_val... | [
"def",
"_get_size",
"(",
"size",
":",
"str",
")",
"->",
"int",
":",
"multipliers",
"=",
"{",
"\"M\"",
":",
"1000",
"**",
"2",
",",
"\"G\"",
":",
"1000",
"**",
"3",
",",
"\"T\"",
":",
"1000",
"**",
"4",
",",
"}",
"try",
":",
"value",
",",
"multi... | https://github.com/maas/maas/blob/db2f89970c640758a51247c59bf1ec6f60cf4ab5/src/maasserver/storage_custom.py#L536-L554 | |
HKUST-Aerial-Robotics/Stereo-RCNN | 63c6ab98b7a5e36c7bcfdec4529804fc940ee900 | lib/model/rpn/proposal_layer.py | python | _ProposalLayer._filter_boxes | (self, boxes, min_size) | return keep | Remove all boxes with any side smaller than min_size. | Remove all boxes with any side smaller than min_size. | [
"Remove",
"all",
"boxes",
"with",
"any",
"side",
"smaller",
"than",
"min_size",
"."
] | def _filter_boxes(self, boxes, min_size):
"""Remove all boxes with any side smaller than min_size."""
ws = boxes[:, :, 2] - boxes[:, :, 0] + 1
hs = boxes[:, :, 3] - boxes[:, :, 1] + 1
keep = ((ws >= min_size) & (hs >= min_size))
return keep | [
"def",
"_filter_boxes",
"(",
"self",
",",
"boxes",
",",
"min_size",
")",
":",
"ws",
"=",
"boxes",
"[",
":",
",",
":",
",",
"2",
"]",
"-",
"boxes",
"[",
":",
",",
":",
",",
"0",
"]",
"+",
"1",
"hs",
"=",
"boxes",
"[",
":",
",",
":",
",",
"... | https://github.com/HKUST-Aerial-Robotics/Stereo-RCNN/blob/63c6ab98b7a5e36c7bcfdec4529804fc940ee900/lib/model/rpn/proposal_layer.py#L155-L160 | |
henkelis/sonospy | 841f52010fd6e1e932d8f1a8896ad4e5a0667b8a | web2py/gluon/sql.py | python | sqlhtml_validators | (field) | return requires | Field type validation, using web2py's validators mechanism.
makes sure the content of a field is in line with the declared
fieldtype | Field type validation, using web2py's validators mechanism. | [
"Field",
"type",
"validation",
"using",
"web2py",
"s",
"validators",
"mechanism",
"."
] | def sqlhtml_validators(field):
"""
Field type validation, using web2py's validators mechanism.
makes sure the content of a field is in line with the declared
fieldtype
"""
field_type, field_length = field.type, field.length
if isinstance(field_type, SQLCustomType):
if hasattr(field_... | [
"def",
"sqlhtml_validators",
"(",
"field",
")",
":",
"field_type",
",",
"field_length",
"=",
"field",
".",
"type",
",",
"field",
".",
"length",
"if",
"isinstance",
"(",
"field_type",
",",
"SQLCustomType",
")",
":",
"if",
"hasattr",
"(",
"field_type",
",",
... | https://github.com/henkelis/sonospy/blob/841f52010fd6e1e932d8f1a8896ad4e5a0667b8a/web2py/gluon/sql.py#L417-L477 | |
dulwich/dulwich | 1f66817d712e3563ce1ff53b1218491a2eae39da | dulwich/web.py | python | get_repo | (backend, mat) | return backend.open_repository(url_prefix(mat)) | Get a Repo instance for the given backend and URL regex match. | Get a Repo instance for the given backend and URL regex match. | [
"Get",
"a",
"Repo",
"instance",
"for",
"the",
"given",
"backend",
"and",
"URL",
"regex",
"match",
"."
] | def get_repo(backend, mat) -> BaseRepo:
"""Get a Repo instance for the given backend and URL regex match."""
return backend.open_repository(url_prefix(mat)) | [
"def",
"get_repo",
"(",
"backend",
",",
"mat",
")",
"->",
"BaseRepo",
":",
"return",
"backend",
".",
"open_repository",
"(",
"url_prefix",
"(",
"mat",
")",
")"
] | https://github.com/dulwich/dulwich/blob/1f66817d712e3563ce1ff53b1218491a2eae39da/dulwich/web.py#L119-L121 | |
sethmlarson/virtualbox-python | 984a6e2cb0e8996f4df40f4444c1528849f1c70d | virtualbox/library.py | python | INetworkAdapter.boot_priority | (self) | return ret | Get or set int value for 'bootPriority'
Network boot priority of the adapter. Priority 1 is highest. If not set,
the priority is considered to be at the lowest possible setting. | Get or set int value for 'bootPriority'
Network boot priority of the adapter. Priority 1 is highest. If not set,
the priority is considered to be at the lowest possible setting. | [
"Get",
"or",
"set",
"int",
"value",
"for",
"bootPriority",
"Network",
"boot",
"priority",
"of",
"the",
"adapter",
".",
"Priority",
"1",
"is",
"highest",
".",
"If",
"not",
"set",
"the",
"priority",
"is",
"considered",
"to",
"be",
"at",
"the",
"lowest",
"p... | def boot_priority(self):
"""Get or set int value for 'bootPriority'
Network boot priority of the adapter. Priority 1 is highest. If not set,
the priority is considered to be at the lowest possible setting.
"""
ret = self._get_attr("bootPriority")
return ret | [
"def",
"boot_priority",
"(",
"self",
")",
":",
"ret",
"=",
"self",
".",
"_get_attr",
"(",
"\"bootPriority\"",
")",
"return",
"ret"
] | https://github.com/sethmlarson/virtualbox-python/blob/984a6e2cb0e8996f4df40f4444c1528849f1c70d/virtualbox/library.py#L29545-L29551 | |
mapnik/Cascadenik | 82f66859340a31dfcb24af127274f262d4f3ad85 | cascadenik/compile.py | python | Range.midpoint | (self) | Return a point guranteed to fall within this range, hopefully near the middle. | Return a point guranteed to fall within this range, hopefully near the middle. | [
"Return",
"a",
"point",
"guranteed",
"to",
"fall",
"within",
"this",
"range",
"hopefully",
"near",
"the",
"middle",
"."
] | def midpoint(self):
""" Return a point guranteed to fall within this range, hopefully near the middle.
"""
minpoint = self.leftedge
if self.leftop is gt:
minpoint += 1
maxpoint = self.rightedge
if self.rightop is lt:
maxpoint -= 1
i... | [
"def",
"midpoint",
"(",
"self",
")",
":",
"minpoint",
"=",
"self",
".",
"leftedge",
"if",
"self",
".",
"leftop",
"is",
"gt",
":",
"minpoint",
"+=",
"1",
"maxpoint",
"=",
"self",
".",
"rightedge",
"if",
"self",
".",
"rightop",
"is",
"lt",
":",
"maxpoi... | https://github.com/mapnik/Cascadenik/blob/82f66859340a31dfcb24af127274f262d4f3ad85/cascadenik/compile.py#L186-L206 | ||
jgagneastro/coffeegrindsize | 22661ebd21831dba4cf32bfc6ba59fe3d49f879c | App/dist/coffeegrindsize.app/Contents/Resources/lib/python3.7/scipy/optimize/_linprog_rs.py | python | _get_more_basis_columns | (A, basis) | return np.concatenate((basis, new_basis)) | Called when the auxiliary problem terminates with artificial columns in
the basis, which must be removed and replaced with non-artificial
columns. Finds additional columns that do not make the matrix singular. | Called when the auxiliary problem terminates with artificial columns in
the basis, which must be removed and replaced with non-artificial
columns. Finds additional columns that do not make the matrix singular. | [
"Called",
"when",
"the",
"auxiliary",
"problem",
"terminates",
"with",
"artificial",
"columns",
"in",
"the",
"basis",
"which",
"must",
"be",
"removed",
"and",
"replaced",
"with",
"non",
"-",
"artificial",
"columns",
".",
"Finds",
"additional",
"columns",
"that",... | def _get_more_basis_columns(A, basis):
"""
Called when the auxiliary problem terminates with artificial columns in
the basis, which must be removed and replaced with non-artificial
columns. Finds additional columns that do not make the matrix singular.
"""
m, n = A.shape
# options for inclu... | [
"def",
"_get_more_basis_columns",
"(",
"A",
",",
"basis",
")",
":",
"m",
",",
"n",
"=",
"A",
".",
"shape",
"# options for inclusion are those that aren't already in the basis",
"a",
"=",
"np",
".",
"arange",
"(",
"m",
"+",
"n",
")",
"bl",
"=",
"np",
".",
"... | https://github.com/jgagneastro/coffeegrindsize/blob/22661ebd21831dba4cf32bfc6ba59fe3d49f879c/App/dist/coffeegrindsize.app/Contents/Resources/lib/python3.7/scipy/optimize/_linprog_rs.py#L99-L131 | |
lisa-lab/pylearn2 | af81e5c362f0df4df85c3e54e23b2adeec026055 | pylearn2/monitor.py | python | get_channel | (model, dataset, channel, cost, batch_size) | return value | Make a temporary monitor and return the value of a channel in it.
Parameters
----------
model : pylearn2.models.model.Model
Will evaluate the channel for this Model.
dataset : pylearn2.datasets.Dataset
The Dataset to run on
channel : str
A string identifying the channel name... | Make a temporary monitor and return the value of a channel in it. | [
"Make",
"a",
"temporary",
"monitor",
"and",
"return",
"the",
"value",
"of",
"a",
"channel",
"in",
"it",
"."
] | def get_channel(model, dataset, channel, cost, batch_size):
"""
Make a temporary monitor and return the value of a channel in it.
Parameters
----------
model : pylearn2.models.model.Model
Will evaluate the channel for this Model.
dataset : pylearn2.datasets.Dataset
The Dataset t... | [
"def",
"get_channel",
"(",
"model",
",",
"dataset",
",",
"channel",
",",
"cost",
",",
"batch_size",
")",
":",
"monitor",
"=",
"Monitor",
"(",
"model",
")",
"monitor",
".",
"setup",
"(",
"dataset",
"=",
"dataset",
",",
"cost",
"=",
"cost",
",",
"batch_s... | https://github.com/lisa-lab/pylearn2/blob/af81e5c362f0df4df85c3e54e23b2adeec026055/pylearn2/monitor.py#L1212-L1246 | |
JulianEberius/SublimeRope | c6ac5179ce8c1e7af0c2c1134589f945252c362d | rope/base/resourceobserver.py | python | ResourceObserver.resource_moved | (self, resource, new_resource) | It is called when a resource is moved | It is called when a resource is moved | [
"It",
"is",
"called",
"when",
"a",
"resource",
"is",
"moved"
] | def resource_moved(self, resource, new_resource):
"""It is called when a resource is moved"""
if self.moved is not None:
self.moved(resource, new_resource) | [
"def",
"resource_moved",
"(",
"self",
",",
"resource",
",",
"new_resource",
")",
":",
"if",
"self",
".",
"moved",
"is",
"not",
"None",
":",
"self",
".",
"moved",
"(",
"resource",
",",
"new_resource",
")"
] | https://github.com/JulianEberius/SublimeRope/blob/c6ac5179ce8c1e7af0c2c1134589f945252c362d/rope/base/resourceobserver.py#L32-L35 | ||
stephenmcd/mezzanine | e38ffc69f732000ce44b7ed5c9d0516d258b8af2 | mezzanine/utils/cache.py | python | cache_installed | () | return (
has_key
and settings.CACHES
and not settings.TESTING
and middlewares_or_subclasses_installed(
[
"mezzanine.core.middleware.UpdateCacheMiddleware",
"mezzanine.core.middleware.FetchFromCacheMiddleware",
]
)
) | Returns ``True`` if a cache backend is configured, and the
cache middleware classes or subclasses thereof are present.
This will be evaluated once per run, and then cached. | Returns ``True`` if a cache backend is configured, and the
cache middleware classes or subclasses thereof are present.
This will be evaluated once per run, and then cached. | [
"Returns",
"True",
"if",
"a",
"cache",
"backend",
"is",
"configured",
"and",
"the",
"cache",
"middleware",
"classes",
"or",
"subclasses",
"thereof",
"are",
"present",
".",
"This",
"will",
"be",
"evaluated",
"once",
"per",
"run",
"and",
"then",
"cached",
"."
... | def cache_installed():
"""
Returns ``True`` if a cache backend is configured, and the
cache middleware classes or subclasses thereof are present.
This will be evaluated once per run, and then cached.
"""
has_key = bool(getattr(settings, "NEVERCACHE_KEY", ""))
return (
has_key
... | [
"def",
"cache_installed",
"(",
")",
":",
"has_key",
"=",
"bool",
"(",
"getattr",
"(",
"settings",
",",
"\"NEVERCACHE_KEY\"",
",",
"\"\"",
")",
")",
"return",
"(",
"has_key",
"and",
"settings",
".",
"CACHES",
"and",
"not",
"settings",
".",
"TESTING",
"and",... | https://github.com/stephenmcd/mezzanine/blob/e38ffc69f732000ce44b7ed5c9d0516d258b8af2/mezzanine/utils/cache.py#L58-L76 | |
snower/forsun | b90d9716b123d98f32575560850e7d8b74aa2612 | forsun/servers/processor/Forsun.py | python | Iface.getTime | (self, timestamp) | Parameters:
- timestamp | Parameters:
- timestamp | [
"Parameters",
":",
"-",
"timestamp"
] | def getTime(self, timestamp):
"""
Parameters:
- timestamp
"""
pass | [
"def",
"getTime",
"(",
"self",
",",
"timestamp",
")",
":",
"pass"
] | https://github.com/snower/forsun/blob/b90d9716b123d98f32575560850e7d8b74aa2612/forsun/servers/processor/Forsun.py#L73-L78 | ||
xuannianz/keras-CenterNet | 39cb123a94d7774490df28e637240de03577f912 | utils/visualization.py | python | draw_annotations | (image, annotations, color=(0, 255, 0), label_to_name=None) | Draws annotations in an image.
# Arguments
image : The image to draw on.
annotations : A [N, 5] matrix (x1, y1, x2, y2, label) or dictionary containing bboxes (shaped [N, 4]) and labels (shaped [N]).
color : The color of the boxes. By default the color from keras_retinanet... | Draws annotations in an image. | [
"Draws",
"annotations",
"in",
"an",
"image",
"."
] | def draw_annotations(image, annotations, color=(0, 255, 0), label_to_name=None):
""" Draws annotations in an image.
# Arguments
image : The image to draw on.
annotations : A [N, 5] matrix (x1, y1, x2, y2, label) or dictionary containing bboxes (shaped [N, 4]) and labels (shaped [N]).
... | [
"def",
"draw_annotations",
"(",
"image",
",",
"annotations",
",",
"color",
"=",
"(",
"0",
",",
"255",
",",
"0",
")",
",",
"label_to_name",
"=",
"None",
")",
":",
"if",
"isinstance",
"(",
"annotations",
",",
"np",
".",
"ndarray",
")",
":",
"annotations"... | https://github.com/xuannianz/keras-CenterNet/blob/39cb123a94d7774490df28e637240de03577f912/utils/visualization.py#L85-L106 | ||
opendatacube/datacube-core | b062184be61c140a168de94510bc3661748f112e | datacube/ui/click.py | python | pass_index | (app_name=None, expect_initialised=True) | return decorate | Get a connection to the index as the first argument.
:param str app_name:
A short name of the application for logging purposes.
:param bool expect_initialised:
Whether to connect immediately on startup. Useful to catch connection config issues immediately,
but if you're planning to fork... | Get a connection to the index as the first argument. | [
"Get",
"a",
"connection",
"to",
"the",
"index",
"as",
"the",
"first",
"argument",
"."
] | def pass_index(app_name=None, expect_initialised=True):
"""Get a connection to the index as the first argument.
:param str app_name:
A short name of the application for logging purposes.
:param bool expect_initialised:
Whether to connect immediately on startup. Useful to catch connection co... | [
"def",
"pass_index",
"(",
"app_name",
"=",
"None",
",",
"expect_initialised",
"=",
"True",
")",
":",
"def",
"decorate",
"(",
"f",
")",
":",
"@",
"pass_config",
"def",
"with_index",
"(",
"local_config",
":",
"config",
".",
"LocalConfig",
",",
"*",
"args",
... | https://github.com/opendatacube/datacube-core/blob/b062184be61c140a168de94510bc3661748f112e/datacube/ui/click.py#L205-L239 | |
whoosh-community/whoosh | 5421f1ab3bb802114105b3181b7ce4f44ad7d0bb | src/whoosh/searching.py | python | Searcher.suggest | (self, fieldname, text, limit=5, maxdist=2, prefix=0) | return c.suggest(text, limit=limit, maxdist=maxdist, prefix=prefix) | Returns a sorted list of suggested corrections for the given
mis-typed word ``text`` based on the contents of the given field::
>>> searcher.suggest("content", "specail")
["special"]
This is a convenience method. If you are planning to get suggestions
for multiple words... | Returns a sorted list of suggested corrections for the given
mis-typed word ``text`` based on the contents of the given field:: | [
"Returns",
"a",
"sorted",
"list",
"of",
"suggested",
"corrections",
"for",
"the",
"given",
"mis",
"-",
"typed",
"word",
"text",
"based",
"on",
"the",
"contents",
"of",
"the",
"given",
"field",
"::"
] | def suggest(self, fieldname, text, limit=5, maxdist=2, prefix=0):
"""Returns a sorted list of suggested corrections for the given
mis-typed word ``text`` based on the contents of the given field::
>>> searcher.suggest("content", "specail")
["special"]
This is a convenie... | [
"def",
"suggest",
"(",
"self",
",",
"fieldname",
",",
"text",
",",
"limit",
"=",
"5",
",",
"maxdist",
"=",
"2",
",",
"prefix",
"=",
"0",
")",
":",
"c",
"=",
"self",
".",
"reader",
"(",
")",
".",
"corrector",
"(",
"fieldname",
")",
"return",
"c",
... | https://github.com/whoosh-community/whoosh/blob/5421f1ab3bb802114105b3181b7ce4f44ad7d0bb/src/whoosh/searching.py#L465-L493 | |
yuvalpinter/Mimick | 8ad9dd8e957f92021526db4d2a639948a79c73f1 | model.py | python | LSTMTagger.loss | (self, sentence, word_chars, tags_set) | return errors | For use in training phase.
Tag sentence (all attributes) and compute loss based on probability of expected tags. | For use in training phase.
Tag sentence (all attributes) and compute loss based on probability of expected tags. | [
"For",
"use",
"in",
"training",
"phase",
".",
"Tag",
"sentence",
"(",
"all",
"attributes",
")",
"and",
"compute",
"loss",
"based",
"on",
"probability",
"of",
"expected",
"tags",
"."
] | def loss(self, sentence, word_chars, tags_set):
'''
For use in training phase.
Tag sentence (all attributes) and compute loss based on probability of expected tags.
'''
observations_set = self.build_tagging_graph(sentence, word_chars)
errors = {}
for att, tags in ... | [
"def",
"loss",
"(",
"self",
",",
"sentence",
",",
"word_chars",
",",
"tags_set",
")",
":",
"observations_set",
"=",
"self",
".",
"build_tagging_graph",
"(",
"sentence",
",",
"word_chars",
")",
"errors",
"=",
"{",
"}",
"for",
"att",
",",
"tags",
"in",
"ta... | https://github.com/yuvalpinter/Mimick/blob/8ad9dd8e957f92021526db4d2a639948a79c73f1/model.py#L142-L159 | |
jamiesun/SublimeEvernote | 62eeccabca6c4051340f0b1b8f7c10548437a9e1 | lib/thrift/server/TNonblockingServer.py | python | Connection.read | (self) | Reads data from stream and switch state. | Reads data from stream and switch state. | [
"Reads",
"data",
"from",
"stream",
"and",
"switch",
"state",
"."
] | def read(self):
"""Reads data from stream and switch state."""
assert self.status in (WAIT_LEN, WAIT_MESSAGE)
if self.status == WAIT_LEN:
self._read_len()
# go back to the main loop here for simplicity instead of
# falling through, even though there is a good ... | [
"def",
"read",
"(",
"self",
")",
":",
"assert",
"self",
".",
"status",
"in",
"(",
"WAIT_LEN",
",",
"WAIT_MESSAGE",
")",
"if",
"self",
".",
"status",
"==",
"WAIT_LEN",
":",
"self",
".",
"_read_len",
"(",
")",
"# go back to the main loop here for simplicity inst... | https://github.com/jamiesun/SublimeEvernote/blob/62eeccabca6c4051340f0b1b8f7c10548437a9e1/lib/thrift/server/TNonblockingServer.py#L131-L148 | ||
openid/python-openid | afa6adacbe1a41d8f614c8bce2264dfbe9e76489 | openid/extensions/sreg.py | python | SRegRequest.__contains__ | (self, field_name) | return (field_name in self.required or field_name in self.optional) | Was this field in the request? | Was this field in the request? | [
"Was",
"this",
"field",
"in",
"the",
"request?"
] | def __contains__(self, field_name):
"""Was this field in the request?"""
return (field_name in self.required or field_name in self.optional) | [
"def",
"__contains__",
"(",
"self",
",",
"field_name",
")",
":",
"return",
"(",
"field_name",
"in",
"self",
".",
"required",
"or",
"field_name",
"in",
"self",
".",
"optional",
")"
] | https://github.com/openid/python-openid/blob/afa6adacbe1a41d8f614c8bce2264dfbe9e76489/openid/extensions/sreg.py#L294-L296 | |
IronLanguages/ironpython3 | 7a7bb2a872eeab0d1009fc8a6e24dca43f65b693 | Src/StdLib/Lib/idlelib/PathBrowser.py | python | DirBrowserTreeItem.GetText | (self) | [] | def GetText(self):
if not self.packages:
return self.dir
else:
return self.packages[-1] + ": package" | [
"def",
"GetText",
"(",
"self",
")",
":",
"if",
"not",
"self",
".",
"packages",
":",
"return",
"self",
".",
"dir",
"else",
":",
"return",
"self",
".",
"packages",
"[",
"-",
"1",
"]",
"+",
"\": package\""
] | https://github.com/IronLanguages/ironpython3/blob/7a7bb2a872eeab0d1009fc8a6e24dca43f65b693/Src/StdLib/Lib/idlelib/PathBrowser.py#L45-L49 | ||||
HazyResearch/fonduer | c9fd6b91998cd708ab95aeee3dfaf47b9e549ffd | src/fonduer/candidates/models/figure_mention.py | python | TemporaryFigureMention.__gt__ | (self, other: object) | return self.__repr__() > other.__repr__() | Check if the mention is greater than another mention. | Check if the mention is greater than another mention. | [
"Check",
"if",
"the",
"mention",
"is",
"greater",
"than",
"another",
"mention",
"."
] | def __gt__(self, other: object) -> bool:
"""Check if the mention is greater than another mention."""
if not isinstance(other, TemporaryFigureMention):
return NotImplemented
# Allow sorting by comparing the string representations of each
return self.__repr__() > other.__repr__... | [
"def",
"__gt__",
"(",
"self",
",",
"other",
":",
"object",
")",
"->",
"bool",
":",
"if",
"not",
"isinstance",
"(",
"other",
",",
"TemporaryFigureMention",
")",
":",
"return",
"NotImplemented",
"# Allow sorting by comparing the string representations of each",
"return"... | https://github.com/HazyResearch/fonduer/blob/c9fd6b91998cd708ab95aeee3dfaf47b9e549ffd/src/fonduer/candidates/models/figure_mention.py#L37-L42 | |
bitbrute/evillimiter | 46d2033b022f4a51fb2f419393a5344ad3edea4a | evillimiter/menus/main_menu.py | python | MainMenu._scan_handler | (self, args) | Handles 'scan' command-line argument
(Re)scans for hosts on the network | Handles 'scan' command-line argument
(Re)scans for hosts on the network | [
"Handles",
"scan",
"command",
"-",
"line",
"argument",
"(",
"Re",
")",
"scans",
"for",
"hosts",
"on",
"the",
"network"
] | def _scan_handler(self, args):
"""
Handles 'scan' command-line argument
(Re)scans for hosts on the network
"""
if args.iprange:
iprange = self._parse_iprange(args.iprange)
if iprange is None:
IO.error('invalid ip range.')
re... | [
"def",
"_scan_handler",
"(",
"self",
",",
"args",
")",
":",
"if",
"args",
".",
"iprange",
":",
"iprange",
"=",
"self",
".",
"_parse_iprange",
"(",
"args",
".",
"iprange",
")",
"if",
"iprange",
"is",
"None",
":",
"IO",
".",
"error",
"(",
"'invalid ip ra... | https://github.com/bitbrute/evillimiter/blob/46d2033b022f4a51fb2f419393a5344ad3edea4a/evillimiter/menus/main_menu.py#L115-L140 | ||
huggingface/transformers | 623b4f7c63f60cce917677ee704d6c93ee960b4b | src/transformers/utils/dummy_tf_objects.py | python | TFGPT2ForSequenceClassification.call | (self, *args, **kwargs) | [] | def call(self, *args, **kwargs):
requires_backends(self, ["tf"]) | [
"def",
"call",
"(",
"self",
",",
"*",
"args",
",",
"*",
"*",
"kwargs",
")",
":",
"requires_backends",
"(",
"self",
",",
"[",
"\"tf\"",
"]",
")"
] | https://github.com/huggingface/transformers/blob/623b4f7c63f60cce917677ee704d6c93ee960b4b/src/transformers/utils/dummy_tf_objects.py#L1500-L1501 | ||||
GoogleCloudPlatform/appengine-mapreduce | 2045eb3605b6ecb40c83d11dd5442a89fe5c5dd6 | python/src/mapreduce/api/map_job/output_writer.py | python | OutputWriter.to_json | (self) | Returns writer state.
No RPC should take place in this method. Use start_slice/end_slice instead.
Returns:
A json-serializable state for the OutputWriter instance. | Returns writer state. | [
"Returns",
"writer",
"state",
"."
] | def to_json(self):
"""Returns writer state.
No RPC should take place in this method. Use start_slice/end_slice instead.
Returns:
A json-serializable state for the OutputWriter instance.
"""
raise NotImplementedError("to_json() not implemented in %s" %
type(self)... | [
"def",
"to_json",
"(",
"self",
")",
":",
"raise",
"NotImplementedError",
"(",
"\"to_json() not implemented in %s\"",
"%",
"type",
"(",
"self",
")",
")"
] | https://github.com/GoogleCloudPlatform/appengine-mapreduce/blob/2045eb3605b6ecb40c83d11dd5442a89fe5c5dd6/python/src/mapreduce/api/map_job/output_writer.py#L80-L89 | ||
ganeti/ganeti | d340a9ddd12f501bef57da421b5f9b969a4ba905 | lib/hypervisor/hv_kvm/__init__.py | python | KVMHypervisor._InstancePidAlive | (cls, instance_name) | return (pidfile, pid, alive) | Returns the instance pidfile, pid, and liveness.
@type instance_name: string
@param instance_name: instance name
@rtype: tuple
@return: (pid file name, pid, liveness) | Returns the instance pidfile, pid, and liveness. | [
"Returns",
"the",
"instance",
"pidfile",
"pid",
"and",
"liveness",
"."
] | def _InstancePidAlive(cls, instance_name):
"""Returns the instance pidfile, pid, and liveness.
@type instance_name: string
@param instance_name: instance name
@rtype: tuple
@return: (pid file name, pid, liveness)
"""
pidfile = cls._InstancePidFile(instance_name)
pid = utils.ReadPidFile... | [
"def",
"_InstancePidAlive",
"(",
"cls",
",",
"instance_name",
")",
":",
"pidfile",
"=",
"cls",
".",
"_InstancePidFile",
"(",
"instance_name",
")",
"pid",
"=",
"utils",
".",
"ReadPidFile",
"(",
"pidfile",
")",
"alive",
"=",
"False",
"try",
":",
"cmd_instance"... | https://github.com/ganeti/ganeti/blob/d340a9ddd12f501bef57da421b5f9b969a4ba905/lib/hypervisor/hv_kvm/__init__.py#L749-L768 | |
VirtueSecurity/aws-extender | d123b7e1a845847709ba3a481f11996bddc68a1c | BappModules/boto/s3/key.py | python | Key.send_file | (self, fp, headers=None, cb=None, num_cb=10,
query_args=None, chunked_transfer=False, size=None) | Upload a file to a key into a bucket on S3.
:type fp: file
:param fp: The file pointer to upload. The file pointer must
point at the offset from which you wish to upload.
ie. if uploading the full file, it should point at the
start of the file. Normally when a file i... | Upload a file to a key into a bucket on S3. | [
"Upload",
"a",
"file",
"to",
"a",
"key",
"into",
"a",
"bucket",
"on",
"S3",
"."
] | def send_file(self, fp, headers=None, cb=None, num_cb=10,
query_args=None, chunked_transfer=False, size=None):
"""
Upload a file to a key into a bucket on S3.
:type fp: file
:param fp: The file pointer to upload. The file pointer must
point at the offset fr... | [
"def",
"send_file",
"(",
"self",
",",
"fp",
",",
"headers",
"=",
"None",
",",
"cb",
"=",
"None",
",",
"num_cb",
"=",
"10",
",",
"query_args",
"=",
"None",
",",
"chunked_transfer",
"=",
"False",
",",
"size",
"=",
"None",
")",
":",
"self",
".",
"_sen... | https://github.com/VirtueSecurity/aws-extender/blob/d123b7e1a845847709ba3a481f11996bddc68a1c/BappModules/boto/s3/key.py#L721-L762 | ||
ThomasKluiters/fetchy | dfe1a73aa72cad4338445bec370be064707bff0c | fetchy/plugins/packages/mirror.py | python | Mirror.url_with_locale | (self) | The base url for this mirror in which the locale is included
this url may be None if no locale can be determined. | The base url for this mirror in which the locale is included
this url may be None if no locale can be determined. | [
"The",
"base",
"url",
"for",
"this",
"mirror",
"in",
"which",
"the",
"locale",
"is",
"included",
"this",
"url",
"may",
"be",
"None",
"if",
"no",
"locale",
"can",
"be",
"determined",
"."
] | def url_with_locale(self):
"""
The base url for this mirror in which the locale is included
this url may be None if no locale can be determined.
"""
raise NotImplementedError() | [
"def",
"url_with_locale",
"(",
"self",
")",
":",
"raise",
"NotImplementedError",
"(",
")"
] | https://github.com/ThomasKluiters/fetchy/blob/dfe1a73aa72cad4338445bec370be064707bff0c/fetchy/plugins/packages/mirror.py#L45-L50 | ||
IronLanguages/main | a949455434b1fda8c783289e897e78a9a0caabb5 | External.LCA_RESTRICTED/Languages/CPython/27/Lib/distutils/util.py | python | rfc822_escape | (header) | return header | Return a version of the string escaped for inclusion in an
RFC-822 header, by ensuring there are 8 spaces space after each newline. | Return a version of the string escaped for inclusion in an
RFC-822 header, by ensuring there are 8 spaces space after each newline. | [
"Return",
"a",
"version",
"of",
"the",
"string",
"escaped",
"for",
"inclusion",
"in",
"an",
"RFC",
"-",
"822",
"header",
"by",
"ensuring",
"there",
"are",
"8",
"spaces",
"space",
"after",
"each",
"newline",
"."
] | def rfc822_escape (header):
"""Return a version of the string escaped for inclusion in an
RFC-822 header, by ensuring there are 8 spaces space after each newline.
"""
lines = string.split(header, '\n')
header = string.join(lines, '\n' + 8*' ')
return header | [
"def",
"rfc822_escape",
"(",
"header",
")",
":",
"lines",
"=",
"string",
".",
"split",
"(",
"header",
",",
"'\\n'",
")",
"header",
"=",
"string",
".",
"join",
"(",
"lines",
",",
"'\\n'",
"+",
"8",
"*",
"' '",
")",
"return",
"header"
] | https://github.com/IronLanguages/main/blob/a949455434b1fda8c783289e897e78a9a0caabb5/External.LCA_RESTRICTED/Languages/CPython/27/Lib/distutils/util.py#L561-L567 | |
XX-net/XX-Net | a9898cfcf0084195fb7e69b6bc834e59aecdf14f | python3.8.2/Lib/site-packages/pip/_internal/utils/misc.py | python | path_to_display | (path) | return display_path | Convert a bytes (or text) path to text (unicode in Python 2) for display
and logging purposes.
This function should never error out. Also, this function is mainly needed
for Python 2 since in Python 3 str paths are already text. | Convert a bytes (or text) path to text (unicode in Python 2) for display
and logging purposes. | [
"Convert",
"a",
"bytes",
"(",
"or",
"text",
")",
"path",
"to",
"text",
"(",
"unicode",
"in",
"Python",
"2",
")",
"for",
"display",
"and",
"logging",
"purposes",
"."
] | def path_to_display(path):
# type: (Optional[Union[str, Text]]) -> Optional[Text]
"""
Convert a bytes (or text) path to text (unicode in Python 2) for display
and logging purposes.
This function should never error out. Also, this function is mainly needed
for Python 2 since in Python 3 str path... | [
"def",
"path_to_display",
"(",
"path",
")",
":",
"# type: (Optional[Union[str, Text]]) -> Optional[Text]",
"if",
"path",
"is",
"None",
":",
"return",
"None",
"if",
"isinstance",
"(",
"path",
",",
"text_type",
")",
":",
"return",
"path",
"# Otherwise, path is a bytes o... | https://github.com/XX-net/XX-Net/blob/a9898cfcf0084195fb7e69b6bc834e59aecdf14f/python3.8.2/Lib/site-packages/pip/_internal/utils/misc.py#L184-L215 | |
mchristopher/PokemonGo-DesktopMap | ec37575f2776ee7d64456e2a1f6b6b78830b4fe0 | app/pylibs/win32/gevent/_sslgte279.py | python | SSLSocket.accept | (self) | return newsock, addr | Accepts a new connection from a remote client, and returns
a tuple containing that new connection wrapped with a server-side
SSL channel, and the address of the remote client. | Accepts a new connection from a remote client, and returns
a tuple containing that new connection wrapped with a server-side
SSL channel, and the address of the remote client. | [
"Accepts",
"a",
"new",
"connection",
"from",
"a",
"remote",
"client",
"and",
"returns",
"a",
"tuple",
"containing",
"that",
"new",
"connection",
"wrapped",
"with",
"a",
"server",
"-",
"side",
"SSL",
"channel",
"and",
"the",
"address",
"of",
"the",
"remote",
... | def accept(self):
"""Accepts a new connection from a remote client, and returns
a tuple containing that new connection wrapped with a server-side
SSL channel, and the address of the remote client."""
newsock, addr = socket.accept(self)
newsock = self.context.wrap_socket(newsock,... | [
"def",
"accept",
"(",
"self",
")",
":",
"newsock",
",",
"addr",
"=",
"socket",
".",
"accept",
"(",
"self",
")",
"newsock",
"=",
"self",
".",
"context",
".",
"wrap_socket",
"(",
"newsock",
",",
"do_handshake_on_connect",
"=",
"self",
".",
"do_handshake_on_c... | https://github.com/mchristopher/PokemonGo-DesktopMap/blob/ec37575f2776ee7d64456e2a1f6b6b78830b4fe0/app/pylibs/win32/gevent/_sslgte279.py#L615-L625 | |
rotki/rotki | aafa446815cdd5e9477436d1b02bee7d01b398c8 | rotkehlchen/utils/mixins/serializableenum.py | python | SerializableEnumMixin.deserialize | (cls: Type[T], value: str) | May raise DeserializationError if the given value can't be deserialized | May raise DeserializationError if the given value can't be deserialized | [
"May",
"raise",
"DeserializationError",
"if",
"the",
"given",
"value",
"can",
"t",
"be",
"deserialized"
] | def deserialize(cls: Type[T], value: str) -> T:
"""May raise DeserializationError if the given value can't be deserialized"""
if not isinstance(value, str):
raise DeserializationError(
f'Failed to deserialize {cls.__name__} value from non string value: {value}',
)... | [
"def",
"deserialize",
"(",
"cls",
":",
"Type",
"[",
"T",
"]",
",",
"value",
":",
"str",
")",
"->",
"T",
":",
"if",
"not",
"isinstance",
"(",
"value",
",",
"str",
")",
":",
"raise",
"DeserializationError",
"(",
"f'Failed to deserialize {cls.__name__} value fr... | https://github.com/rotki/rotki/blob/aafa446815cdd5e9477436d1b02bee7d01b398c8/rotkehlchen/utils/mixins/serializableenum.py#L18-L29 | ||
tensorflow/models | 6b8bb0cbeb3e10415c7a87448f08adc3c484c1d3 | research/efficient-hrl/environments/maze_env.py | python | MazeEnv.get_range_sensor_obs | (self) | return sensor_readings | Returns egocentric range sensor observations of maze. | Returns egocentric range sensor observations of maze. | [
"Returns",
"egocentric",
"range",
"sensor",
"observations",
"of",
"maze",
"."
] | def get_range_sensor_obs(self):
"""Returns egocentric range sensor observations of maze."""
robot_x, robot_y, robot_z = self.wrapped_env.get_body_com("torso")[:3]
ori = self.get_ori()
structure = self.MAZE_STRUCTURE
size_scaling = self.MAZE_SIZE_SCALING
height = self.MAZE_HEIGHT
segments =... | [
"def",
"get_range_sensor_obs",
"(",
"self",
")",
":",
"robot_x",
",",
"robot_y",
",",
"robot_z",
"=",
"self",
".",
"wrapped_env",
".",
"get_body_com",
"(",
"\"torso\"",
")",
"[",
":",
"3",
"]",
"ori",
"=",
"self",
".",
"get_ori",
"(",
")",
"structure",
... | https://github.com/tensorflow/models/blob/6b8bb0cbeb3e10415c7a87448f08adc3c484c1d3/research/efficient-hrl/environments/maze_env.py#L323-L405 | |
zhl2008/awd-platform | 0416b31abea29743387b10b3914581fbe8e7da5e | web_hxb2/lib/python3.5/site-packages/django/db/models/fields/related.py | python | ForeignObject.__init__ | (self, to, on_delete, from_fields, to_fields, rel=None, related_name=None,
related_query_name=None, limit_choices_to=None, parent_link=False,
swappable=True, **kwargs) | [] | def __init__(self, to, on_delete, from_fields, to_fields, rel=None, related_name=None,
related_query_name=None, limit_choices_to=None, parent_link=False,
swappable=True, **kwargs):
if rel is None:
rel = self.rel_class(
self, to,
rela... | [
"def",
"__init__",
"(",
"self",
",",
"to",
",",
"on_delete",
",",
"from_fields",
",",
"to_fields",
",",
"rel",
"=",
"None",
",",
"related_name",
"=",
"None",
",",
"related_query_name",
"=",
"None",
",",
"limit_choices_to",
"=",
"None",
",",
"parent_link",
... | https://github.com/zhl2008/awd-platform/blob/0416b31abea29743387b10b3914581fbe8e7da5e/web_hxb2/lib/python3.5/site-packages/django/db/models/fields/related.py#L442-L460 | ||||
sagemath/sage | f9b2db94f675ff16963ccdefba4f1a3393b3fe0d | src/sage/coding/linear_code.py | python | LinearCodeNearestNeighborDecoder._latex_ | (self) | return "\\textnormal{Nearest neighbor decoder for }%s" % self.code()._latex_() | r"""
Return a latex representation of ``self``.
EXAMPLES::
sage: G = Matrix(GF(2), [[1,1,1,0,0,0,0],[1,0,0,1,1,0,0],[0,1,0,1,0,1,0],[1,1,0,1,0,0,1]])
sage: C = LinearCode(G)
sage: D = codes.decoders.LinearCodeNearestNeighborDecoder(C)
sage: latex(D)
... | r"""
Return a latex representation of ``self``. | [
"r",
"Return",
"a",
"latex",
"representation",
"of",
"self",
"."
] | def _latex_(self):
r"""
Return a latex representation of ``self``.
EXAMPLES::
sage: G = Matrix(GF(2), [[1,1,1,0,0,0,0],[1,0,0,1,1,0,0],[0,1,0,1,0,1,0],[1,1,0,1,0,0,1]])
sage: C = LinearCode(G)
sage: D = codes.decoders.LinearCodeNearestNeighborDecoder(C)
... | [
"def",
"_latex_",
"(",
"self",
")",
":",
"return",
"\"\\\\textnormal{Nearest neighbor decoder for }%s\"",
"%",
"self",
".",
"code",
"(",
")",
".",
"_latex_",
"(",
")"
] | https://github.com/sagemath/sage/blob/f9b2db94f675ff16963ccdefba4f1a3393b3fe0d/src/sage/coding/linear_code.py#L2982-L2994 | |
materialsproject/pymatgen | 8128f3062a334a2edd240e4062b5b9bdd1ae6f58 | pymatgen/core/tensors.py | python | Tensor.average_over_unit_sphere | (self, quad=None) | return sum(w * self.project(n) for w, n in zip(weights, points)) | Method for averaging the tensor projection over the unit
with option for custom quadrature.
Args:
quad (dict): quadrature for integration, should be
dictionary with "points" and "weights" keys defaults
to quadpy.sphere.Lebedev(19) as read from file
R... | Method for averaging the tensor projection over the unit
with option for custom quadrature. | [
"Method",
"for",
"averaging",
"the",
"tensor",
"projection",
"over",
"the",
"unit",
"with",
"option",
"for",
"custom",
"quadrature",
"."
] | def average_over_unit_sphere(self, quad=None):
"""
Method for averaging the tensor projection over the unit
with option for custom quadrature.
Args:
quad (dict): quadrature for integration, should be
dictionary with "points" and "weights" keys defaults
... | [
"def",
"average_over_unit_sphere",
"(",
"self",
",",
"quad",
"=",
"None",
")",
":",
"quad",
"=",
"quad",
"or",
"DEFAULT_QUAD",
"weights",
",",
"points",
"=",
"quad",
"[",
"\"weights\"",
"]",
",",
"quad",
"[",
"\"points\"",
"]",
"return",
"sum",
"(",
"w",... | https://github.com/materialsproject/pymatgen/blob/8128f3062a334a2edd240e4062b5b9bdd1ae6f58/pymatgen/core/tensors.py#L174-L190 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.