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 |
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
rgs1/zk_shell | ab4223c8f165a32b7f652932329b0880e43b9922 | zk_shell/xclient.py | python | XClient.tree | (self, path, max_depth, full_path=False, include_stat=False) | DFS generator which starts from a given path and goes up to a max depth.
:param path: path from which the DFS will start
:param max_depth: max depth of DFS (0 means no limit)
:param full_path: should the full path of the child node be returned
:param include_stat: return the child Znode... | DFS generator which starts from a given path and goes up to a max depth. | [
"DFS",
"generator",
"which",
"starts",
"from",
"a",
"given",
"path",
"and",
"goes",
"up",
"to",
"a",
"max",
"depth",
"."
] | def tree(self, path, max_depth, full_path=False, include_stat=False):
"""DFS generator which starts from a given path and goes up to a max depth.
:param path: path from which the DFS will start
:param max_depth: max depth of DFS (0 means no limit)
:param full_path: should the full path ... | [
"def",
"tree",
"(",
"self",
",",
"path",
",",
"max_depth",
",",
"full_path",
"=",
"False",
",",
"include_stat",
"=",
"False",
")",
":",
"for",
"child_level_stat",
"in",
"self",
".",
"do_tree",
"(",
"path",
",",
"max_depth",
",",
"0",
",",
"full_path",
... | https://github.com/rgs1/zk_shell/blob/ab4223c8f165a32b7f652932329b0880e43b9922/zk_shell/xclient.py#L275-L284 | ||
zhl2008/awd-platform | 0416b31abea29743387b10b3914581fbe8e7da5e | web_flaskbb/lib/python2.7/site-packages/babel/localedata.py | python | LocaleDataDict.__getitem__ | (self, key) | return val | [] | def __getitem__(self, key):
orig = val = self._data[key]
if isinstance(val, Alias): # resolve an alias
val = val.resolve(self.base)
if isinstance(val, tuple): # Merge a partial dict with an alias
alias, others = val
val = alias.resolve(self.base).copy()
... | [
"def",
"__getitem__",
"(",
"self",
",",
"key",
")",
":",
"orig",
"=",
"val",
"=",
"self",
".",
"_data",
"[",
"key",
"]",
"if",
"isinstance",
"(",
"val",
",",
"Alias",
")",
":",
"# resolve an alias",
"val",
"=",
"val",
".",
"resolve",
"(",
"self",
"... | https://github.com/zhl2008/awd-platform/blob/0416b31abea29743387b10b3914581fbe8e7da5e/web_flaskbb/lib/python2.7/site-packages/babel/localedata.py#L207-L219 | |||
jina-ai/jina | c77a492fcd5adba0fc3de5347bea83dd4e7d8087 | daemon/api/endpoints/flows.py | python | _create | (flow: FlowDepends = Depends(FlowDepends)) | [] | async def _create(flow: FlowDepends = Depends(FlowDepends)):
try:
return await store.add(
id=flow.id,
workspace_id=flow.workspace_id,
params=flow.params,
ports=flow.ports,
envs=flow.envs,
device_requests=flow.device_requests,
)
... | [
"async",
"def",
"_create",
"(",
"flow",
":",
"FlowDepends",
"=",
"Depends",
"(",
"FlowDepends",
")",
")",
":",
"try",
":",
"return",
"await",
"store",
".",
"add",
"(",
"id",
"=",
"flow",
".",
"id",
",",
"workspace_id",
"=",
"flow",
".",
"workspace_id",... | https://github.com/jina-ai/jina/blob/c77a492fcd5adba0fc3de5347bea83dd4e7d8087/daemon/api/endpoints/flows.py#L32-L43 | ||||
tecladocode/rest-apis-flask-python | d2d40872012dcf1b63ffde4bbd2dd447fec98eca | section5/item.py | python | Item.insert | (cls, item) | [] | def insert(cls, item):
connection = sqlite3.connect('data.db')
cursor = connection.cursor()
query = "INSERT INTO {table} VALUES(?, ?)".format(table=cls.TABLE_NAME)
cursor.execute(query, (item['name'], item['price']))
connection.commit()
connection.close() | [
"def",
"insert",
"(",
"cls",
",",
"item",
")",
":",
"connection",
"=",
"sqlite3",
".",
"connect",
"(",
"'data.db'",
")",
"cursor",
"=",
"connection",
".",
"cursor",
"(",
")",
"query",
"=",
"\"INSERT INTO {table} VALUES(?, ?)\"",
".",
"format",
"(",
"table",
... | https://github.com/tecladocode/rest-apis-flask-python/blob/d2d40872012dcf1b63ffde4bbd2dd447fec98eca/section5/item.py#L52-L60 | ||||
jina-ai/jina | c77a492fcd5adba0fc3de5347bea83dd4e7d8087 | daemon/files.py | python | DaemonFile.jinav | (self) | return self._jina | Property representing python version
:return: python version in the daemonfile | Property representing python version | [
"Property",
"representing",
"python",
"version"
] | def jinav(self):
"""Property representing python version
:return: python version in the daemonfile
"""
return self._jina | [
"def",
"jinav",
"(",
"self",
")",
":",
"return",
"self",
".",
"_jina"
] | https://github.com/jina-ai/jina/blob/c77a492fcd5adba0fc3de5347bea83dd4e7d8087/daemon/files.py#L139-L144 | |
apple/ccs-calendarserver | 13c706b985fb728b9aab42dc0fef85aae21921c3 | calendarserver/tools/delegatesmigration.py | python | usage | (e=None) | [] | def usage(e=None):
if e:
print(e)
print("")
print("")
print(" Migrates delegate assignments from external Postgres DB to Calendar Server Store")
print("")
print("options:")
print(" -h --help: print this help and exit")
print(" -f --config <path>: Specify caldavd.plist con... | [
"def",
"usage",
"(",
"e",
"=",
"None",
")",
":",
"if",
"e",
":",
"print",
"(",
"e",
")",
"print",
"(",
"\"\"",
")",
"print",
"(",
"\"\"",
")",
"print",
"(",
"\" Migrates delegate assignments from external Postgres DB to Calendar Server Store\"",
")",
"print",
... | https://github.com/apple/ccs-calendarserver/blob/13c706b985fb728b9aab42dc0fef85aae21921c3/calendarserver/tools/delegatesmigration.py#L43-L65 | ||||
debian-calibre/calibre | 020fc81d3936a64b2ac51459ecb796666ab6a051 | src/calibre/gui2/preferences/__init__.py | python | show_config_widget | (category, name, gui=None, show_restart_msg=False,
parent=None, never_shutdown=False) | return rr | Show the preferences plugin identified by category and name
:param gui: gui instance, if None a hidden gui is created
:param show_restart_msg: If True and the preferences plugin indicates a
restart is required, show a message box telling the user to restart
:param parent: The parent of the displayed di... | Show the preferences plugin identified by category and name | [
"Show",
"the",
"preferences",
"plugin",
"identified",
"by",
"category",
"and",
"name"
] | def show_config_widget(category, name, gui=None, show_restart_msg=False,
parent=None, never_shutdown=False):
'''
Show the preferences plugin identified by category and name
:param gui: gui instance, if None a hidden gui is created
:param show_restart_msg: If True and the preferences plugin indi... | [
"def",
"show_config_widget",
"(",
"category",
",",
"name",
",",
"gui",
"=",
"None",
",",
"show_restart_msg",
"=",
"False",
",",
"parent",
"=",
"None",
",",
"never_shutdown",
"=",
"False",
")",
":",
"from",
"calibre",
".",
"gui2",
"import",
"gprefs",
"pl",
... | https://github.com/debian-calibre/calibre/blob/020fc81d3936a64b2ac51459ecb796666ab6a051/src/calibre/gui2/preferences/__init__.py#L343-L403 | |
tomplus/kubernetes_asyncio | f028cc793e3a2c519be6a52a49fb77ff0b014c9b | kubernetes_asyncio/client/models/v1_namespace_status.py | python | V1NamespaceStatus.__ne__ | (self, other) | return self.to_dict() != other.to_dict() | Returns true if both objects are not equal | Returns true if both objects are not equal | [
"Returns",
"true",
"if",
"both",
"objects",
"are",
"not",
"equal"
] | def __ne__(self, other):
"""Returns true if both objects are not equal"""
if not isinstance(other, V1NamespaceStatus):
return True
return self.to_dict() != other.to_dict() | [
"def",
"__ne__",
"(",
"self",
",",
"other",
")",
":",
"if",
"not",
"isinstance",
"(",
"other",
",",
"V1NamespaceStatus",
")",
":",
"return",
"True",
"return",
"self",
".",
"to_dict",
"(",
")",
"!=",
"other",
".",
"to_dict",
"(",
")"
] | https://github.com/tomplus/kubernetes_asyncio/blob/f028cc793e3a2c519be6a52a49fb77ff0b014c9b/kubernetes_asyncio/client/models/v1_namespace_status.py#L145-L150 | |
makehumancommunity/makehuman | 8006cf2cc851624619485658bb933a4244bbfd7c | makehuman/lib/qtgui.py | python | dummySvgCall | () | Code which is here just so pyinstaller can discover we need SVG support | Code which is here just so pyinstaller can discover we need SVG support | [
"Code",
"which",
"is",
"here",
"just",
"so",
"pyinstaller",
"can",
"discover",
"we",
"need",
"SVG",
"support"
] | def dummySvgCall():
"""Code which is here just so pyinstaller can discover we need SVG support"""
dummy = QtSvg.QGraphicsSvgItem("some_svg.svg") | [
"def",
"dummySvgCall",
"(",
")",
":",
"dummy",
"=",
"QtSvg",
".",
"QGraphicsSvgItem",
"(",
"\"some_svg.svg\"",
")"
] | https://github.com/makehumancommunity/makehuman/blob/8006cf2cc851624619485658bb933a4244bbfd7c/makehuman/lib/qtgui.py#L52-L54 | ||
l11x0m7/Question_Answering_Models | b53c33db08a51f8e5f8c774eb65ec29c75942c66 | cQA/decomposable_att_model/models.py | python | DecompAtt.__init__ | (self, config) | [] | def __init__(self, config):
self.config = config
# 输入
self.add_placeholders()
# [batch_size, sequence_size, embed_size]
q_embed, a_embed = self.add_embeddings()
# 上下文编码
q_encode, a_encode = self.context_encoding(q_embed, a_embed)
# attention层
q_att... | [
"def",
"__init__",
"(",
"self",
",",
"config",
")",
":",
"self",
".",
"config",
"=",
"config",
"# 输入",
"self",
".",
"add_placeholders",
"(",
")",
"# [batch_size, sequence_size, embed_size]",
"q_embed",
",",
"a_embed",
"=",
"self",
".",
"add_embeddings",
"(",
"... | https://github.com/l11x0m7/Question_Answering_Models/blob/b53c33db08a51f8e5f8c774eb65ec29c75942c66/cQA/decomposable_att_model/models.py#L7-L24 | ||||
IvanFon/xinput-gui | 900f4dc0fe8020eb106881cf7e489862f532b9a1 | xinput_gui/settings.py | python | Settings.load_config | (self) | Load config file. | Load config file. | [
"Load",
"config",
"file",
"."
] | def load_config(self):
'''Load config file.'''
# Create config if needed
if not CONFIG_PATH.is_file():
copyfile(resource_filename('xinput_gui', 'res/config.json'), CONFIG_PATH)
with open(CONFIG_PATH) as config_file:
self.config = json.load(config_file)
... | [
"def",
"load_config",
"(",
"self",
")",
":",
"# Create config if needed",
"if",
"not",
"CONFIG_PATH",
".",
"is_file",
"(",
")",
":",
"copyfile",
"(",
"resource_filename",
"(",
"'xinput_gui'",
",",
"'res/config.json'",
")",
",",
"CONFIG_PATH",
")",
"with",
"open"... | https://github.com/IvanFon/xinput-gui/blob/900f4dc0fe8020eb106881cf7e489862f532b9a1/xinput_gui/settings.py#L47-L60 | ||
AppScale/gts | 46f909cf5dc5ba81faf9d81dc9af598dcf8a82a9 | AppServer/google/appengine/api/backends/backends.py | python | _get_dev2_hostname | (backend, instance=None) | Returns the hostname of a backend [instance] in devappserver2.
Args:
backend: The name of the backend.
instance: The backend instance number, in [0, instances-1].
Returns:
The hostname of the backend. | Returns the hostname of a backend [instance] in devappserver2. | [
"Returns",
"the",
"hostname",
"of",
"a",
"backend",
"[",
"instance",
"]",
"in",
"devappserver2",
"."
] | def _get_dev2_hostname(backend, instance=None):
"""Returns the hostname of a backend [instance] in devappserver2.
Args:
backend: The name of the backend.
instance: The backend instance number, in [0, instances-1].
Returns:
The hostname of the backend.
"""
try:
return modules.get_hostname(mod... | [
"def",
"_get_dev2_hostname",
"(",
"backend",
",",
"instance",
"=",
"None",
")",
":",
"try",
":",
"return",
"modules",
".",
"get_hostname",
"(",
"module",
"=",
"backend",
",",
"instance",
"=",
"instance",
")",
"except",
"modules",
".",
"InvalidModuleError",
"... | https://github.com/AppScale/gts/blob/46f909cf5dc5ba81faf9d81dc9af598dcf8a82a9/AppServer/google/appengine/api/backends/backends.py#L179-L194 | ||
yianjiajia/django_web_ansible | 1103343082a65abf9d37310f5048514d74930753 | devops/apps/ansible/elfinder/volumes/base.py | python | ElfinderVolumeDriver._move | (self, source, target_dir, name) | Move file into another parent directory.
Return the new file path or raise ``os.error``.
.. warning::
**Not implemented**, each driver must provide its own
imlementation. | Move file into another parent directory.
Return the new file path or raise ``os.error``.
.. warning::
**Not implemented**, each driver must provide its own
imlementation. | [
"Move",
"file",
"into",
"another",
"parent",
"directory",
".",
"Return",
"the",
"new",
"file",
"path",
"or",
"raise",
"os",
".",
"error",
".",
"..",
"warning",
"::",
"**",
"Not",
"implemented",
"**",
"each",
"driver",
"must",
"provide",
"its",
"own",
"im... | def _move(self, source, target_dir, name):
"""
Move file into another parent directory.
Return the new file path or raise ``os.error``.
.. warning::
**Not implemented**, each driver must provide its own
imlementation.
"""
raise No... | [
"def",
"_move",
"(",
"self",
",",
"source",
",",
"target_dir",
",",
"name",
")",
":",
"raise",
"NotImplementedError"
] | https://github.com/yianjiajia/django_web_ansible/blob/1103343082a65abf9d37310f5048514d74930753/devops/apps/ansible/elfinder/volumes/base.py#L2048-L2058 | ||
tosher/Mediawiker | 81bf97cace59bedcb1668e7830b85c36e014428e | lib/Crypto.win.x64/Crypto/PublicKey/DSA.py | python | _import_key_der | (key_data, passphrase, params) | Import a DSA key (public or private half), encoded in DER form. | Import a DSA key (public or private half), encoded in DER form. | [
"Import",
"a",
"DSA",
"key",
"(",
"public",
"or",
"private",
"half",
")",
"encoded",
"in",
"DER",
"form",
"."
] | def _import_key_der(key_data, passphrase, params):
"""Import a DSA key (public or private half), encoded in DER form."""
decodings = (_import_openssl_private,
_import_subjectPublicKeyInfo,
_import_x509_cert,
_import_pkcs8)
for decoding in decodings:
... | [
"def",
"_import_key_der",
"(",
"key_data",
",",
"passphrase",
",",
"params",
")",
":",
"decodings",
"=",
"(",
"_import_openssl_private",
",",
"_import_subjectPublicKeyInfo",
",",
"_import_x509_cert",
",",
"_import_pkcs8",
")",
"for",
"decoding",
"in",
"decodings",
"... | https://github.com/tosher/Mediawiker/blob/81bf97cace59bedcb1668e7830b85c36e014428e/lib/Crypto.win.x64/Crypto/PublicKey/DSA.py#L583-L597 | ||
jgagneastro/coffeegrindsize | 22661ebd21831dba4cf32bfc6ba59fe3d49f879c | App/dist/coffeegrindsize.app/Contents/Resources/lib/python3.7/numpy/polynomial/hermite.py | python | hermint | (c, m=1, k=[], lbnd=0, scl=1, axis=0) | return c | Integrate a Hermite series.
Returns the Hermite series coefficients `c` integrated `m` times from
`lbnd` along `axis`. At each iteration the resulting series is
**multiplied** by `scl` and an integration constant, `k`, is added.
The scaling factor is for use in a linear change of variable. ("Buyer
... | Integrate a Hermite series. | [
"Integrate",
"a",
"Hermite",
"series",
"."
] | def hermint(c, m=1, k=[], lbnd=0, scl=1, axis=0):
"""
Integrate a Hermite series.
Returns the Hermite series coefficients `c` integrated `m` times from
`lbnd` along `axis`. At each iteration the resulting series is
**multiplied** by `scl` and an integration constant, `k`, is added.
The scaling ... | [
"def",
"hermint",
"(",
"c",
",",
"m",
"=",
"1",
",",
"k",
"=",
"[",
"]",
",",
"lbnd",
"=",
"0",
",",
"scl",
"=",
"1",
",",
"axis",
"=",
"0",
")",
":",
"c",
"=",
"np",
".",
"array",
"(",
"c",
",",
"ndmin",
"=",
"1",
",",
"copy",
"=",
"... | https://github.com/jgagneastro/coffeegrindsize/blob/22661ebd21831dba4cf32bfc6ba59fe3d49f879c/App/dist/coffeegrindsize.app/Contents/Resources/lib/python3.7/numpy/polynomial/hermite.py#L730-L853 | |
Source-Python-Dev-Team/Source.Python | d0ffd8ccbd1e9923c9bc44936f20613c1c76b7fb | addons/source-python/packages/site-packages/docutils/nodes.py | python | TreeCopyVisitor.default_visit | (self, node) | Copy the current node, and make it the new acting parent. | Copy the current node, and make it the new acting parent. | [
"Copy",
"the",
"current",
"node",
"and",
"make",
"it",
"the",
"new",
"acting",
"parent",
"."
] | def default_visit(self, node):
"""Copy the current node, and make it the new acting parent."""
newnode = node.copy()
self.parent.append(newnode)
self.parent_stack.append(self.parent)
self.parent = newnode | [
"def",
"default_visit",
"(",
"self",
",",
"node",
")",
":",
"newnode",
"=",
"node",
".",
"copy",
"(",
")",
"self",
".",
"parent",
".",
"append",
"(",
"newnode",
")",
"self",
".",
"parent_stack",
".",
"append",
"(",
"self",
".",
"parent",
")",
"self",... | https://github.com/Source-Python-Dev-Team/Source.Python/blob/d0ffd8ccbd1e9923c9bc44936f20613c1c76b7fb/addons/source-python/packages/site-packages/docutils/nodes.py#L1992-L1997 | ||
timkpaine/pyEX | 254acd2b0cf7cb7183100106f4ecc11d1860c46a | pyEX/studies/technicals/cycle.py | python | ht_sine | (client, symbol, range="6m", col="close") | return pd.DataFrame({col: df[col].values, "sine": x, "leadsine": y}) | This will return a dataframe of
Hilbert Transform - SineWave
for the given symbol across
the given range
Args:
client (pyEX.Client); Client
symbol (string); Ticker
range (string); range to use, for pyEX.chart
col (string); column to use to calculate
Returns:
... | This will return a dataframe of
Hilbert Transform - SineWave
for the given symbol across
the given range | [
"This",
"will",
"return",
"a",
"dataframe",
"of",
"Hilbert",
"Transform",
"-",
"SineWave",
"for",
"the",
"given",
"symbol",
"across",
"the",
"given",
"range"
] | def ht_sine(client, symbol, range="6m", col="close"):
"""This will return a dataframe of
Hilbert Transform - SineWave
for the given symbol across
the given range
Args:
client (pyEX.Client); Client
symbol (string); Ticker
range (string); range to use, for pyEX.chart
c... | [
"def",
"ht_sine",
"(",
"client",
",",
"symbol",
",",
"range",
"=",
"\"6m\"",
",",
"col",
"=",
"\"close\"",
")",
":",
"df",
"=",
"client",
".",
"chartDF",
"(",
"symbol",
",",
"range",
")",
"x",
",",
"y",
"=",
"t",
".",
"HT_SINE",
"(",
"df",
"[",
... | https://github.com/timkpaine/pyEX/blob/254acd2b0cf7cb7183100106f4ecc11d1860c46a/pyEX/studies/technicals/cycle.py#L72-L89 | |
guille0/songoku | deb9cfa1e3b02518070b8ecc5ae58ff6cddf3208 | sudoku_solving.py | python | search | (values) | return some(search(assign(values.copy(), s, d))
for d in values[s]) | Using depth-first search and propagation, try all possible values. | Using depth-first search and propagation, try all possible values. | [
"Using",
"depth",
"-",
"first",
"search",
"and",
"propagation",
"try",
"all",
"possible",
"values",
"."
] | def search(values):
"Using depth-first search and propagation, try all possible values."
if values is False:
return False ## Failed earlier
if all(len(values[s]) == 1 for s in squares):
return values ## Solved!
## Chose the unfilled square s with the fewest possibilities
n,s = min((l... | [
"def",
"search",
"(",
"values",
")",
":",
"if",
"values",
"is",
"False",
":",
"return",
"False",
"## Failed earlier",
"if",
"all",
"(",
"len",
"(",
"values",
"[",
"s",
"]",
")",
"==",
"1",
"for",
"s",
"in",
"squares",
")",
":",
"return",
"values",
... | https://github.com/guille0/songoku/blob/deb9cfa1e3b02518070b8ecc5ae58ff6cddf3208/sudoku_solving.py#L115-L124 | |
robotlearn/pyrobolearn | 9cd7c060723fda7d2779fa255ac998c2c82b8436 | pyrobolearn/returns/targets.py | python | QTarget.__init__ | (self, q_value, policy=None) | r"""
Initialize the Q-target.
Args:
q_value (Value): state value function
policy (Policy): policy. | r"""
Initialize the Q-target. | [
"r",
"Initialize",
"the",
"Q",
"-",
"target",
"."
] | def __init__(self, q_value, policy=None):
r"""
Initialize the Q-target.
Args:
q_value (Value): state value function
policy (Policy): policy.
"""
super(QTarget, self).__init__()
# check given value function
if not isinstance(q_value, Value... | [
"def",
"__init__",
"(",
"self",
",",
"q_value",
",",
"policy",
"=",
"None",
")",
":",
"super",
"(",
"QTarget",
",",
"self",
")",
".",
"__init__",
"(",
")",
"# check given value function",
"if",
"not",
"isinstance",
"(",
"q_value",
",",
"Value",
")",
":",... | https://github.com/robotlearn/pyrobolearn/blob/9cd7c060723fda7d2779fa255ac998c2c82b8436/pyrobolearn/returns/targets.py#L180-L200 | ||
FSecureLABS/Jandroid | e31d0dab58a2bfd6ed8e0a387172b8bd7c893436 | src/template_parser.py | python | AndroidTemplateParser.__fn_check_graph | (self, graphable_element) | Checks the GRAPH section of template for correctness.
A graphable element is of the structure
x WITH p AS attribute=r, q AS label, ...
where
x is the element to graph (will be either a node or tracepath)
p, q are values used as an attribute or label
... | Checks the GRAPH section of template for correctness.
A graphable element is of the structure
x WITH p AS attribute=r, q AS label, ...
where
x is the element to graph (will be either a node or tracepath)
p, q are values used as an attribute or label
... | [
"Checks",
"the",
"GRAPH",
"section",
"of",
"template",
"for",
"correctness",
".",
"A",
"graphable",
"element",
"is",
"of",
"the",
"structure",
"x",
"WITH",
"p",
"AS",
"attribute",
"=",
"r",
"q",
"AS",
"label",
"...",
"where",
"x",
"is",
"the",
"element",... | def __fn_check_graph(self, graphable_element):
"""Checks the GRAPH section of template for correctness.
A graphable element is of the structure
x WITH p AS attribute=r, q AS label, ...
where
x is the element to graph (will be either a node or tracepath)
... | [
"def",
"__fn_check_graph",
"(",
"self",
",",
"graphable_element",
")",
":",
"# The graphable element must be specified by a string.",
"if",
"type",
"(",
"graphable_element",
")",
"is",
"not",
"str",
":",
"raise",
"JandroidException",
"(",
"{",
"'type'",
":",
"str",
... | https://github.com/FSecureLABS/Jandroid/blob/e31d0dab58a2bfd6ed8e0a387172b8bd7c893436/src/template_parser.py#L1115-L1182 | ||
mesalock-linux/mesapy | ed546d59a21b36feb93e2309d5c6b75aa0ad95c9 | pypy/module/_locale/interp_locale.py | python | strxfrm | (space, s) | return space.newtext(val) | string -> string. Returns a string that behaves for cmp locale-aware. | string -> string. Returns a string that behaves for cmp locale-aware. | [
"string",
"-",
">",
"string",
".",
"Returns",
"a",
"string",
"that",
"behaves",
"for",
"cmp",
"locale",
"-",
"aware",
"."
] | def strxfrm(space, s):
"string -> string. Returns a string that behaves for cmp locale-aware."
n1 = len(s) + 1
buf = lltype.malloc(rffi.CCHARP.TO, n1, flavor="raw", zero=True)
s_c = rffi.str2charp(s)
try:
n2 = _strxfrm(buf, s_c, n1) + 1
finally:
rffi.free_charp(s_c)
if n2 > ... | [
"def",
"strxfrm",
"(",
"space",
",",
"s",
")",
":",
"n1",
"=",
"len",
"(",
"s",
")",
"+",
"1",
"buf",
"=",
"lltype",
".",
"malloc",
"(",
"rffi",
".",
"CCHARP",
".",
"TO",
",",
"n1",
",",
"flavor",
"=",
"\"raw\"",
",",
"zero",
"=",
"True",
")"... | https://github.com/mesalock-linux/mesapy/blob/ed546d59a21b36feb93e2309d5c6b75aa0ad95c9/pypy/module/_locale/interp_locale.py#L152-L176 | |
apigee/henchman | 13c53c66669800aaa89f1799ac974b45ec473c3d | modules/curl/curl/requests/requests/sessions.py | python | Session.get | (self, url, **kwargs) | return self.request('GET', url, **kwargs) | Sends a GET request. Returns :class:`Response` object.
:param url: URL for the new :class:`Request` object.
:param \*\*kwargs: Optional arguments that ``request`` takes. | Sends a GET request. Returns :class:`Response` object. | [
"Sends",
"a",
"GET",
"request",
".",
"Returns",
":",
"class",
":",
"Response",
"object",
"."
] | def get(self, url, **kwargs):
"""Sends a GET request. Returns :class:`Response` object.
:param url: URL for the new :class:`Request` object.
:param \*\*kwargs: Optional arguments that ``request`` takes.
"""
kwargs.setdefault('allow_redirects', True)
return self.request(... | [
"def",
"get",
"(",
"self",
",",
"url",
",",
"*",
"*",
"kwargs",
")",
":",
"kwargs",
".",
"setdefault",
"(",
"'allow_redirects'",
",",
"True",
")",
"return",
"self",
".",
"request",
"(",
"'GET'",
",",
"url",
",",
"*",
"*",
"kwargs",
")"
] | https://github.com/apigee/henchman/blob/13c53c66669800aaa89f1799ac974b45ec473c3d/modules/curl/curl/requests/requests/sessions.py#L472-L480 | |
bruderstein/PythonScript | df9f7071ddf3a079e3a301b9b53a6dc78cf1208f | PythonLib/min/plistlib.py | python | _DumbXMLWriter.writeln | (self, line) | [] | def writeln(self, line):
if line:
# plist has fixed encoding of utf-8
# XXX: is this test needed?
if isinstance(line, str):
line = line.encode('utf-8')
self.file.write(self._indent_level * self.indent)
self.file.write(line)
sel... | [
"def",
"writeln",
"(",
"self",
",",
"line",
")",
":",
"if",
"line",
":",
"# plist has fixed encoding of utf-8",
"# XXX: is this test needed?",
"if",
"isinstance",
"(",
"line",
",",
"str",
")",
":",
"line",
"=",
"line",
".",
"encode",
"(",
"'utf-8'",
")",
"se... | https://github.com/bruderstein/PythonScript/blob/df9f7071ddf3a079e3a301b9b53a6dc78cf1208f/PythonLib/min/plistlib.py#L300-L309 | ||||
pydicom/pydicom | 935de3b4ac94a5f520f3c91b42220ff0f13bce54 | pydicom/valuerep.py | python | DA.__new__ | ( # type: ignore[misc]
cls: Type["DA"], *args: Any, **kwargs: Any
) | Create an instance of DA object.
Raise an exception if the string cannot be parsed or the argument
is otherwise incompatible.
The arguments (``*args`` and ``**kwargs``) are either the ones
inherited from :class:`datetime.date`, or the first argument is
a string conformant to th... | Create an instance of DA object. | [
"Create",
"an",
"instance",
"of",
"DA",
"object",
"."
] | def __new__( # type: ignore[misc]
cls: Type["DA"], *args: Any, **kwargs: Any
) -> Optional["DA"]:
"""Create an instance of DA object.
Raise an exception if the string cannot be parsed or the argument
is otherwise incompatible.
The arguments (``*args`` and ``**kwargs``) are... | [
"def",
"__new__",
"(",
"# type: ignore[misc]",
"cls",
":",
"Type",
"[",
"\"DA\"",
"]",
",",
"*",
"args",
":",
"Any",
",",
"*",
"*",
"kwargs",
":",
"Any",
")",
"->",
"Optional",
"[",
"\"DA\"",
"]",
":",
"if",
"not",
"args",
"or",
"args",
"[",
"0",
... | https://github.com/pydicom/pydicom/blob/935de3b4ac94a5f520f3c91b42220ff0f13bce54/pydicom/valuerep.py#L482-L527 | ||
davidoren/CuckooSploit | 3fce8183bee8f7917e08f765ce2a01c921f86354 | lib/cuckoo/core/database.py | python | Database.__init__ | (self, dsn=None, schema_check=True) | @param dsn: database connection string.
@param schema_check: disable or enable the db schema version check | [] | def __init__(self, dsn=None, schema_check=True):
"""@param dsn: database connection string.
@param schema_check: disable or enable the db schema version check
"""
self._lock = SuperLock()
cfg = Config()
if dsn:
self._connect_database(dsn)
elif cfg.dat... | [
"def",
"__init__",
"(",
"self",
",",
"dsn",
"=",
"None",
",",
"schema_check",
"=",
"True",
")",
":",
"self",
".",
"_lock",
"=",
"SuperLock",
"(",
")",
"cfg",
"=",
"Config",
"(",
")",
"if",
"dsn",
":",
"self",
".",
"_connect_database",
"(",
"dsn",
"... | https://github.com/davidoren/CuckooSploit/blob/3fce8183bee8f7917e08f765ce2a01c921f86354/lib/cuckoo/core/database.py#L325-L386 | |||
frappe/frappe | b64cab6867dfd860f10ccaf41a4ec04bc890b583 | frappe/model/utils/rename_doc.py | python | update_linked_doctypes | (doctype, docname, linked_to, value, ignore_doctypes=None) | linked_doctype_info_list = list formed by get_fetch_fields() function
docname = Master DocType's name in which modification are made
value = Value for the field thats set in other DocType's by fetching from Master DocType | linked_doctype_info_list = list formed by get_fetch_fields() function
docname = Master DocType's name in which modification are made
value = Value for the field thats set in other DocType's by fetching from Master DocType | [
"linked_doctype_info_list",
"=",
"list",
"formed",
"by",
"get_fetch_fields",
"()",
"function",
"docname",
"=",
"Master",
"DocType",
"s",
"name",
"in",
"which",
"modification",
"are",
"made",
"value",
"=",
"Value",
"for",
"the",
"field",
"thats",
"set",
"in",
"... | def update_linked_doctypes(doctype, docname, linked_to, value, ignore_doctypes=None):
"""
linked_doctype_info_list = list formed by get_fetch_fields() function
docname = Master DocType's name in which modification are made
value = Value for the field thats set in other DocType's by fetching from Master DocType
"""... | [
"def",
"update_linked_doctypes",
"(",
"doctype",
",",
"docname",
",",
"linked_to",
",",
"value",
",",
"ignore_doctypes",
"=",
"None",
")",
":",
"linked_doctype_info_list",
"=",
"get_fetch_fields",
"(",
"doctype",
",",
"linked_to",
",",
"ignore_doctypes",
")",
"for... | https://github.com/frappe/frappe/blob/b64cab6867dfd860f10ccaf41a4ec04bc890b583/frappe/model/utils/rename_doc.py#L7-L24 | ||
donnemartin/gitsome | d7c57abc7cb66e9c910a844f15d4536866da3310 | xonsh/ply/example/yply/yparse.py | python | p_rule | (p) | rule : ID ':' rulelist ';' | rule : ID ':' rulelist ';' | [
"rule",
":",
"ID",
":",
"rulelist",
";"
] | def p_rule(p):
'''rule : ID ':' rulelist ';' '''
p[0] = (p[1], [p[3]]) | [
"def",
"p_rule",
"(",
"p",
")",
":",
"p",
"[",
"0",
"]",
"=",
"(",
"p",
"[",
"1",
"]",
",",
"[",
"p",
"[",
"3",
"]",
"]",
")"
] | https://github.com/donnemartin/gitsome/blob/d7c57abc7cb66e9c910a844f15d4536866da3310/xonsh/ply/example/yply/yparse.py#L171-L173 | ||
entropy1337/infernal-twin | 10995cd03312e39a48ade0f114ebb0ae3a711bb8 | Modules/airgraph-ng/graphviz/libDumpParse.py | python | airDumpParse.airDumpParse | (self,cleanedDump) | return | Function takes parsed dump file list and does some more cleaning.
Returns a list of 2 dictionaries (Clients and APs) | Function takes parsed dump file list and does some more cleaning.
Returns a list of 2 dictionaries (Clients and APs) | [
"Function",
"takes",
"parsed",
"dump",
"file",
"list",
"and",
"does",
"some",
"more",
"cleaning",
".",
"Returns",
"a",
"list",
"of",
"2",
"dictionaries",
"(",
"Clients",
"and",
"APs",
")"
] | def airDumpParse(self,cleanedDump):
"""
Function takes parsed dump file list and does some more cleaning.
Returns a list of 2 dictionaries (Clients and APs)
"""
try: #some very basic error handeling to make sure they are loading up the correct file
try:
... | [
"def",
"airDumpParse",
"(",
"self",
",",
"cleanedDump",
")",
":",
"try",
":",
"#some very basic error handeling to make sure they are loading up the correct file",
"try",
":",
"apStart",
"=",
"cleanedDump",
".",
"index",
"(",
"'BSSID, First time seen, Last time seen, Channel, S... | https://github.com/entropy1337/infernal-twin/blob/10995cd03312e39a48ade0f114ebb0ae3a711bb8/Modules/airgraph-ng/graphviz/libDumpParse.py#L39-L63 | |
kubernetes-client/python | 47b9da9de2d02b2b7a34fbe05afb44afd130d73a | kubernetes/client/models/v2beta1_metric_status.py | python | V2beta1MetricStatus.__repr__ | (self) | return self.to_str() | For `print` and `pprint` | For `print` and `pprint` | [
"For",
"print",
"and",
"pprint"
] | def __repr__(self):
"""For `print` and `pprint`"""
return self.to_str() | [
"def",
"__repr__",
"(",
"self",
")",
":",
"return",
"self",
".",
"to_str",
"(",
")"
] | https://github.com/kubernetes-client/python/blob/47b9da9de2d02b2b7a34fbe05afb44afd130d73a/kubernetes/client/models/v2beta1_metric_status.py#L237-L239 | |
numenta/htmpapers | 10038118a6558c065863b0aab2b0d5d341096d0a | arxiv/how_can_we_be_so_dense/src/expsuite.py | python | PyExperimentSuite.create_dir | (self, params, delete=False) | creates a subdirectory for the experiment, and deletes existing
files, if the delete flag is true. then writes the current
experiment.cfg file in the folder. | creates a subdirectory for the experiment, and deletes existing
files, if the delete flag is true. then writes the current
experiment.cfg file in the folder. | [
"creates",
"a",
"subdirectory",
"for",
"the",
"experiment",
"and",
"deletes",
"existing",
"files",
"if",
"the",
"delete",
"flag",
"is",
"true",
".",
"then",
"writes",
"the",
"current",
"experiment",
".",
"cfg",
"file",
"in",
"the",
"folder",
"."
] | def create_dir(self, params, delete=False):
""" creates a subdirectory for the experiment, and deletes existing
files, if the delete flag is true. then writes the current
experiment.cfg file in the folder.
"""
# create experiment path and subdir
fullpath = os.path... | [
"def",
"create_dir",
"(",
"self",
",",
"params",
",",
"delete",
"=",
"False",
")",
":",
"# create experiment path and subdir",
"fullpath",
"=",
"os",
".",
"path",
".",
"join",
"(",
"params",
"[",
"'path'",
"]",
",",
"params",
"[",
"'name'",
"]",
")",
"se... | https://github.com/numenta/htmpapers/blob/10038118a6558c065863b0aab2b0d5d341096d0a/arxiv/how_can_we_be_so_dense/src/expsuite.py#L534-L548 | ||
jgagneastro/coffeegrindsize | 22661ebd21831dba4cf32bfc6ba59fe3d49f879c | App/dist/coffeegrindsize.app/Contents/Resources/lib/python3.7/pandas/io/packers.py | python | c2f | (r, i, ctype_name) | return np.typeDict[ctype_name](ftype(r) + 1j * ftype(i)) | Convert strings to complex number instance with specified numpy type. | Convert strings to complex number instance with specified numpy type. | [
"Convert",
"strings",
"to",
"complex",
"number",
"instance",
"with",
"specified",
"numpy",
"type",
"."
] | def c2f(r, i, ctype_name):
"""
Convert strings to complex number instance with specified numpy type.
"""
ftype = c2f_dict[ctype_name]
return np.typeDict[ctype_name](ftype(r) + 1j * ftype(i)) | [
"def",
"c2f",
"(",
"r",
",",
"i",
",",
"ctype_name",
")",
":",
"ftype",
"=",
"c2f_dict",
"[",
"ctype_name",
"]",
"return",
"np",
".",
"typeDict",
"[",
"ctype_name",
"]",
"(",
"ftype",
"(",
"r",
")",
"+",
"1j",
"*",
"ftype",
"(",
"i",
")",
")"
] | https://github.com/jgagneastro/coffeegrindsize/blob/22661ebd21831dba4cf32bfc6ba59fe3d49f879c/App/dist/coffeegrindsize.app/Contents/Resources/lib/python3.7/pandas/io/packers.py#L259-L265 | |
openstack/magnum | fa298eeab19b1d87070d72c7c4fb26cd75b0781e | magnum/db/sqlalchemy/models.py | python | JsonEncodedType.process_bind_param | (self, value, dialect) | return serialized_value | [] | def process_bind_param(self, value, dialect):
if value is None:
# Save default value according to current type to keep the
# interface the consistent.
value = self.type()
elif not isinstance(value, self.type):
raise TypeError("%(class)s supposes to store "... | [
"def",
"process_bind_param",
"(",
"self",
",",
"value",
",",
"dialect",
")",
":",
"if",
"value",
"is",
"None",
":",
"# Save default value according to current type to keep the",
"# interface the consistent.",
"value",
"=",
"self",
".",
"type",
"(",
")",
"elif",
"not... | https://github.com/openstack/magnum/blob/fa298eeab19b1d87070d72c7c4fb26cd75b0781e/magnum/db/sqlalchemy/models.py#L52-L64 | |||
bokeh/bokeh | a00e59da76beb7b9f83613533cfd3aced1df5f06 | _setup_support.py | python | build_js | () | Build BokehJS files under the ``bokehjs`` source subdirectory.
Also prints a table of statistics about the generated assets (file sizes,
etc.) or any error messages if the build fails.
Note this function only builds BokehJS assets, it does not install them
into the python source tree. | Build BokehJS files under the ``bokehjs`` source subdirectory. | [
"Build",
"BokehJS",
"files",
"under",
"the",
"bokehjs",
"source",
"subdirectory",
"."
] | def build_js():
''' Build BokehJS files under the ``bokehjs`` source subdirectory.
Also prints a table of statistics about the generated assets (file sizes,
etc.) or any error messages if the build fails.
Note this function only builds BokehJS assets, it does not install them
into the python sourc... | [
"def",
"build_js",
"(",
")",
":",
"print",
"(",
"\"Building BokehJS... \"",
",",
"end",
"=",
"\"\"",
")",
"sys",
".",
"stdout",
".",
"flush",
"(",
")",
"os",
".",
"chdir",
"(",
"'bokehjs'",
")",
"cmd",
"=",
"[",
"\"node\"",
",",
"\"make\"",
",",
"\"b... | https://github.com/bokeh/bokeh/blob/a00e59da76beb7b9f83613533cfd3aced1df5f06/_setup_support.py#L183-L255 | ||
django-nonrel/djangotoolbox | 7e2c47e2ab5ee98d0c0f47c5ccce08e75feda48a | djangotoolbox/utils.py | python | equal_lists | (left, right) | return True | Compares two lists and returs True if they contain the same
elements, but doesn't require that they have the same order. | Compares two lists and returs True if they contain the same
elements, but doesn't require that they have the same order. | [
"Compares",
"two",
"lists",
"and",
"returs",
"True",
"if",
"they",
"contain",
"the",
"same",
"elements",
"but",
"doesn",
"t",
"require",
"that",
"they",
"have",
"the",
"same",
"order",
"."
] | def equal_lists(left, right):
"""
Compares two lists and returs True if they contain the same
elements, but doesn't require that they have the same order.
"""
right = list(right)
if len(left) != len(right):
return False
for item in left:
if item in right:
del righ... | [
"def",
"equal_lists",
"(",
"left",
",",
"right",
")",
":",
"right",
"=",
"list",
"(",
"right",
")",
"if",
"len",
"(",
"left",
")",
"!=",
"len",
"(",
"right",
")",
":",
"return",
"False",
"for",
"item",
"in",
"left",
":",
"if",
"item",
"in",
"righ... | https://github.com/django-nonrel/djangotoolbox/blob/7e2c47e2ab5ee98d0c0f47c5ccce08e75feda48a/djangotoolbox/utils.py#L52-L65 | |
kamilion/customizer | 1442e1b9df81f2f917eda0ef0b48faadcec421ce | installer.py | python | tool_check | (tool, was_found=False, critical=False) | Print a message when a tool is missing. Returns nothing. | Print a message when a tool is missing. Returns nothing. | [
"Print",
"a",
"message",
"when",
"a",
"tool",
"is",
"missing",
".",
"Returns",
"nothing",
"."
] | def tool_check(tool, was_found=False, critical=False):
"""
Print a message when a tool is missing. Returns nothing.
"""
if was_found:
print(u"Tool: '{0}' is available.".format(tool))
else:
tool_warning(tool, critical) | [
"def",
"tool_check",
"(",
"tool",
",",
"was_found",
"=",
"False",
",",
"critical",
"=",
"False",
")",
":",
"if",
"was_found",
":",
"print",
"(",
"u\"Tool: '{0}' is available.\"",
".",
"format",
"(",
"tool",
")",
")",
"else",
":",
"tool_warning",
"(",
"tool... | https://github.com/kamilion/customizer/blob/1442e1b9df81f2f917eda0ef0b48faadcec421ce/installer.py#L620-L627 | ||
elastic/rally | 7c58ef6f81f618fbc142dfa58b0ed00a5b05fbae | esrally/metrics.py | python | MetricsStore.put_value_cluster_level | (
self,
name,
value,
unit=None,
task=None,
operation=None,
operation_type=None,
sample_type=SampleType.Normal,
absolute_time=None,
relative_time=None,
meta_data=None,
) | Adds a new cluster level value metric.
:param name: The name of the metric.
:param value: The metric value. It is expected to be numeric.
:param unit: The unit of this metric value (e.g. ms, docs/s). Optional. Defaults to None.
:param task: The task name to which this value applies. Opt... | Adds a new cluster level value metric. | [
"Adds",
"a",
"new",
"cluster",
"level",
"value",
"metric",
"."
] | def put_value_cluster_level(
self,
name,
value,
unit=None,
task=None,
operation=None,
operation_type=None,
sample_type=SampleType.Normal,
absolute_time=None,
relative_time=None,
meta_data=None,
):
"""
Adds a new ... | [
"def",
"put_value_cluster_level",
"(",
"self",
",",
"name",
",",
"value",
",",
"unit",
"=",
"None",
",",
"task",
"=",
"None",
",",
"operation",
"=",
"None",
",",
"operation_type",
"=",
"None",
",",
"sample_type",
"=",
"SampleType",
".",
"Normal",
",",
"a... | https://github.com/elastic/rally/blob/7c58ef6f81f618fbc142dfa58b0ed00a5b05fbae/esrally/metrics.py#L483-L525 | ||
glutanimate/review-heatmap | c758478125b60a81c66c87c35b12b7968ec0a348 | src/review_heatmap/libaddon/config/abstract/interface.py | python | ConfigInterface.ready | (self) | return False | Base storage object ready for I/O
Returns:
bool -- whether base storage object is ready | Base storage object ready for I/O | [
"Base",
"storage",
"object",
"ready",
"for",
"I",
"/",
"O"
] | def ready(self) -> bool:
"""Base storage object ready for I/O
Returns:
bool -- whether base storage object is ready
"""
return False | [
"def",
"ready",
"(",
"self",
")",
"->",
"bool",
":",
"return",
"False"
] | https://github.com/glutanimate/review-heatmap/blob/c758478125b60a81c66c87c35b12b7968ec0a348/src/review_heatmap/libaddon/config/abstract/interface.py#L48-L54 | |
albertz/music-player | d23586f5bf657cbaea8147223be7814d117ae73d | src/lastfm/session.py | python | LastfmSession.obtain_access_token | (self, request_token=None) | return self.token | Obtain an access token for a user.
After you get a request token, and then send the user to the authorize
URL, you can use the authorized request token with this method to get the
access token to use for future operations. The access token is stored on
the session object.
Args:
request_token: A request t... | Obtain an access token for a user. | [
"Obtain",
"an",
"access",
"token",
"for",
"a",
"user",
"."
] | def obtain_access_token(self, request_token=None):
"""Obtain an access token for a user.
After you get a request token, and then send the user to the authorize
URL, you can use the authorized request token with this method to get the
access token to use for future operations. The access token is stored on
th... | [
"def",
"obtain_access_token",
"(",
"self",
",",
"request_token",
"=",
"None",
")",
":",
"request_token",
"=",
"request_token",
"or",
"self",
".",
"request_token",
"assert",
"request_token",
",",
"\"No request_token available on the session. Please pass one.\"",
"url",
"="... | https://github.com/albertz/music-player/blob/d23586f5bf657cbaea8147223be7814d117ae73d/src/lastfm/session.py#L178-L210 | |
crossbario/crossbar | ed350b7ba1c8421f3640b9c2e94a21ed4cfdff64 | crossbar/network/_api.py | python | Network.verify_onboard_member | (self,
vaction_oid: bytes,
vaction_code: str,
details: Optional[CallDetails] = None) | return onboard_request_verified | Verify on-boarding of a new member by submitting a verification code.
Upon successful on-board, this procedure will also publish the same data that is returned
to the following topic - but only for subscribers of same ``authid`` (clients of the user
that was on-boarded):
* **Procedure*... | Verify on-boarding of a new member by submitting a verification code. | [
"Verify",
"on",
"-",
"boarding",
"of",
"a",
"new",
"member",
"by",
"submitting",
"a",
"verification",
"code",
"."
] | async def verify_onboard_member(self,
vaction_oid: bytes,
vaction_code: str,
details: Optional[CallDetails] = None) -> dict:
"""
Verify on-boarding of a new member by submitting a verification cod... | [
"async",
"def",
"verify_onboard_member",
"(",
"self",
",",
"vaction_oid",
":",
"bytes",
",",
"vaction_code",
":",
"str",
",",
"details",
":",
"Optional",
"[",
"CallDetails",
"]",
"=",
"None",
")",
"->",
"dict",
":",
"self",
".",
"log",
".",
"info",
"(",
... | https://github.com/crossbario/crossbar/blob/ed350b7ba1c8421f3640b9c2e94a21ed4cfdff64/crossbar/network/_api.py#L555-L608 | |
kubernetes-client/python | 47b9da9de2d02b2b7a34fbe05afb44afd130d73a | kubernetes/client/models/v1_job_condition.py | python | V1JobCondition.__eq__ | (self, other) | return self.to_dict() == other.to_dict() | Returns true if both objects are equal | Returns true if both objects are equal | [
"Returns",
"true",
"if",
"both",
"objects",
"are",
"equal"
] | def __eq__(self, other):
"""Returns true if both objects are equal"""
if not isinstance(other, V1JobCondition):
return False
return self.to_dict() == other.to_dict() | [
"def",
"__eq__",
"(",
"self",
",",
"other",
")",
":",
"if",
"not",
"isinstance",
"(",
"other",
",",
"V1JobCondition",
")",
":",
"return",
"False",
"return",
"self",
".",
"to_dict",
"(",
")",
"==",
"other",
".",
"to_dict",
"(",
")"
] | https://github.com/kubernetes-client/python/blob/47b9da9de2d02b2b7a34fbe05afb44afd130d73a/kubernetes/client/models/v1_job_condition.py#L252-L257 | |
hasanirtiza/Pedestron | 3bdcf8476edc0741f28a80dd4cb161ac532507ee | tools/voc_eval.py | python | voc_eval | (result_file, dataset, iou_thr=0.5) | [] | def voc_eval(result_file, dataset, iou_thr=0.5):
det_results = mmcv.load(result_file)
gt_bboxes = []
gt_labels = []
gt_ignore = []
for i in range(len(dataset)):
ann = dataset.get_ann_info(i)
bboxes = ann['bboxes']
labels = ann['labels']
if 'bboxes_ignore' in ann:
... | [
"def",
"voc_eval",
"(",
"result_file",
",",
"dataset",
",",
"iou_thr",
"=",
"0.5",
")",
":",
"det_results",
"=",
"mmcv",
".",
"load",
"(",
"result_file",
")",
"gt_bboxes",
"=",
"[",
"]",
"gt_labels",
"=",
"[",
"]",
"gt_ignore",
"=",
"[",
"]",
"for",
... | https://github.com/hasanirtiza/Pedestron/blob/3bdcf8476edc0741f28a80dd4cb161ac532507ee/tools/voc_eval.py#L10-L43 | ||||
googleads/google-ads-python | 2a1d6062221f6aad1992a6bcca0e7e4a93d2db86 | google/ads/googleads/v7/services/services/google_ads_service/client.py | python | GoogleAdsServiceClient.remarketing_action_path | (
customer_id: str, remarketing_action_id: str,
) | return "customers/{customer_id}/remarketingActions/{remarketing_action_id}".format(
customer_id=customer_id,
remarketing_action_id=remarketing_action_id,
) | Return a fully-qualified remarketing_action string. | Return a fully-qualified remarketing_action string. | [
"Return",
"a",
"fully",
"-",
"qualified",
"remarketing_action",
"string",
"."
] | def remarketing_action_path(
customer_id: str, remarketing_action_id: str,
) -> str:
"""Return a fully-qualified remarketing_action string."""
return "customers/{customer_id}/remarketingActions/{remarketing_action_id}".format(
customer_id=customer_id,
remarketing_acti... | [
"def",
"remarketing_action_path",
"(",
"customer_id",
":",
"str",
",",
"remarketing_action_id",
":",
"str",
",",
")",
"->",
"str",
":",
"return",
"\"customers/{customer_id}/remarketingActions/{remarketing_action_id}\"",
".",
"format",
"(",
"customer_id",
"=",
"customer_id... | https://github.com/googleads/google-ads-python/blob/2a1d6062221f6aad1992a6bcca0e7e4a93d2db86/google/ads/googleads/v7/services/services/google_ads_service/client.py#L2169-L2176 | |
sjev/trading-with-python | 095c16326b6b588fdb7d1b9d71a84007678108ad | lib/interactiveBrokers/tickLogger.py | python | TickLogger.__init__ | (self,tws, subscriptions) | init class, register handlers | init class, register handlers | [
"init",
"class",
"register",
"handlers"
] | def __init__(self,tws, subscriptions):
''' init class, register handlers '''
tws.register(self._priceHandler,message.tickPrice)
tws.register(self._sizeHandler,message.tickSize)
self.subscriptions = subscriptions
# save starting time of logging. Al... | [
"def",
"__init__",
"(",
"self",
",",
"tws",
",",
"subscriptions",
")",
":",
"tws",
".",
"register",
"(",
"self",
".",
"_priceHandler",
",",
"message",
".",
"tickPrice",
")",
"tws",
".",
"register",
"(",
"self",
".",
"_sizeHandler",
",",
"message",
".",
... | https://github.com/sjev/trading-with-python/blob/095c16326b6b588fdb7d1b9d71a84007678108ad/lib/interactiveBrokers/tickLogger.py#L39-L57 | ||
pantsbuild/pex | 473c6ac732ed4bc338b4b20a9ec930d1d722c9b4 | pex/vendor/_vendored/setuptools/setuptools/config.py | python | ConfigOptionsHandler.parse_section_packages__find | (self, section_options) | return find_kwargs | Parses `packages.find` configuration file section.
To be used in conjunction with _parse_packages().
:param dict section_options: | Parses `packages.find` configuration file section. | [
"Parses",
"packages",
".",
"find",
"configuration",
"file",
"section",
"."
] | def parse_section_packages__find(self, section_options):
"""Parses `packages.find` configuration file section.
To be used in conjunction with _parse_packages().
:param dict section_options:
"""
section_data = self._parse_section_to_dict(
section_options, self._parse... | [
"def",
"parse_section_packages__find",
"(",
"self",
",",
"section_options",
")",
":",
"section_data",
"=",
"self",
".",
"_parse_section_to_dict",
"(",
"section_options",
",",
"self",
".",
"_parse_list",
")",
"valid_keys",
"=",
"[",
"'where'",
",",
"'include'",
","... | https://github.com/pantsbuild/pex/blob/473c6ac732ed4bc338b4b20a9ec930d1d722c9b4/pex/vendor/_vendored/setuptools/setuptools/config.py#L614-L633 | |
AppScale/gts | 46f909cf5dc5ba81faf9d81dc9af598dcf8a82a9 | AppServer/lib/django-1.4/django/db/models/sql/compiler.py | python | SQLCompiler.deferred_to_columns | (self) | return columns | Converts the self.deferred_loading data structure to mapping of table
names to sets of column names which are to be loaded. Returns the
dictionary. | Converts the self.deferred_loading data structure to mapping of table
names to sets of column names which are to be loaded. Returns the
dictionary. | [
"Converts",
"the",
"self",
".",
"deferred_loading",
"data",
"structure",
"to",
"mapping",
"of",
"table",
"names",
"to",
"sets",
"of",
"column",
"names",
"which",
"are",
"to",
"be",
"loaded",
".",
"Returns",
"the",
"dictionary",
"."
] | def deferred_to_columns(self):
"""
Converts the self.deferred_loading data structure to mapping of table
names to sets of column names which are to be loaded. Returns the
dictionary.
"""
columns = {}
self.query.deferred_to_data(columns, self.query.deferred_to_colu... | [
"def",
"deferred_to_columns",
"(",
"self",
")",
":",
"columns",
"=",
"{",
"}",
"self",
".",
"query",
".",
"deferred_to_data",
"(",
"columns",
",",
"self",
".",
"query",
".",
"deferred_to_columns_cb",
")",
"return",
"columns"
] | https://github.com/AppScale/gts/blob/46f909cf5dc5ba81faf9d81dc9af598dcf8a82a9/AppServer/lib/django-1.4/django/db/models/sql/compiler.py#L741-L749 | |
home-assistant/core | 265ebd17a3f17ed8dc1e9bdede03ac8e323f1ab1 | homeassistant/components/homematicip_cloud/cover.py | python | HomematicipCoverShutterGroup.async_close_cover_tilt | (self, **kwargs) | Close the slats. | Close the slats. | [
"Close",
"the",
"slats",
"."
] | async def async_close_cover_tilt(self, **kwargs) -> None:
"""Close the slats."""
await self._device.set_slats_level(HMIP_SLATS_CLOSED) | [
"async",
"def",
"async_close_cover_tilt",
"(",
"self",
",",
"*",
"*",
"kwargs",
")",
"->",
"None",
":",
"await",
"self",
".",
"_device",
".",
"set_slats_level",
"(",
"HMIP_SLATS_CLOSED",
")"
] | https://github.com/home-assistant/core/blob/265ebd17a3f17ed8dc1e9bdede03ac8e323f1ab1/homeassistant/components/homematicip_cloud/cover.py#L368-L370 | ||
taers232c/GAMADV-XTD3 | 3097d6c24b7377037c746317908fcaff8404d88a | src/gam/gdata/service.py | python | GDataService.PostOrPut | (self, verb, data, uri, extra_headers=None, url_params=None,
escape_params=True, redirects_remaining=4, media_source=None,
converter=None) | Insert data into a GData service at the given URI.
Args:
verb: string, either 'POST' or 'PUT'
data: string, ElementTree._Element, atom.Entry, or gdata.GDataEntry The
XML to be sent to the uri.
uri: string The location (feed) to which the data should be inserted.
Example: ... | Insert data into a GData service at the given URI. | [
"Insert",
"data",
"into",
"a",
"GData",
"service",
"at",
"the",
"given",
"URI",
"."
] | def PostOrPut(self, verb, data, uri, extra_headers=None, url_params=None,
escape_params=True, redirects_remaining=4, media_source=None,
converter=None):
"""Insert data into a GData service at the given URI.
Args:
verb: string, either 'POST' or 'PUT'
data: string, ElementTree... | [
"def",
"PostOrPut",
"(",
"self",
",",
"verb",
",",
"data",
",",
"uri",
",",
"extra_headers",
"=",
"None",
",",
"url_params",
"=",
"None",
",",
"escape_params",
"=",
"True",
",",
"redirects_remaining",
"=",
"4",
",",
"media_source",
"=",
"None",
",",
"con... | https://github.com/taers232c/GAMADV-XTD3/blob/3097d6c24b7377037c746317908fcaff8404d88a/src/gam/gdata/service.py#L1239-L1358 | ||
home-assistant/core | 265ebd17a3f17ed8dc1e9bdede03ac8e323f1ab1 | script/scaffold/generate.py | python | _generate | (src_dir, target_dir, info: Info) | Generate an integration. | Generate an integration. | [
"Generate",
"an",
"integration",
"."
] | def _generate(src_dir, target_dir, info: Info) -> None:
"""Generate an integration."""
replaces = {"NEW_DOMAIN": info.domain, "NEW_NAME": info.name}
if not target_dir.exists():
target_dir.mkdir()
for source_file in src_dir.glob("**/*"):
content = source_file.read_text()
for to... | [
"def",
"_generate",
"(",
"src_dir",
",",
"target_dir",
",",
"info",
":",
"Info",
")",
"->",
"None",
":",
"replaces",
"=",
"{",
"\"NEW_DOMAIN\"",
":",
"info",
".",
"domain",
",",
"\"NEW_NAME\"",
":",
"info",
".",
"name",
"}",
"if",
"not",
"target_dir",
... | https://github.com/home-assistant/core/blob/265ebd17a3f17ed8dc1e9bdede03ac8e323f1ab1/script/scaffold/generate.py#L21-L50 | ||
gulvarol/smplpytorch | a18b0197d8a7204865b2ec95307e2286533f9487 | smplpytorch/pytorch/rodrigues_layer.py | python | quat2mat | (quat) | return rotMat | Convert quaternion coefficients to rotation matrix.
Args:
quat: size = [batch_size, 4] 4 <===>(w, x, y, z)
Returns:
Rotation matrix corresponding to the quaternion -- size = [batch_size, 3, 3] | Convert quaternion coefficients to rotation matrix.
Args:
quat: size = [batch_size, 4] 4 <===>(w, x, y, z)
Returns:
Rotation matrix corresponding to the quaternion -- size = [batch_size, 3, 3] | [
"Convert",
"quaternion",
"coefficients",
"to",
"rotation",
"matrix",
".",
"Args",
":",
"quat",
":",
"size",
"=",
"[",
"batch_size",
"4",
"]",
"4",
"<",
"===",
">",
"(",
"w",
"x",
"y",
"z",
")",
"Returns",
":",
"Rotation",
"matrix",
"corresponding",
"to... | def quat2mat(quat):
"""Convert quaternion coefficients to rotation matrix.
Args:
quat: size = [batch_size, 4] 4 <===>(w, x, y, z)
Returns:
Rotation matrix corresponding to the quaternion -- size = [batch_size, 3, 3]
"""
norm_quat = quat
norm_quat = norm_quat / norm_quat.norm(p=2,... | [
"def",
"quat2mat",
"(",
"quat",
")",
":",
"norm_quat",
"=",
"quat",
"norm_quat",
"=",
"norm_quat",
"/",
"norm_quat",
".",
"norm",
"(",
"p",
"=",
"2",
",",
"dim",
"=",
"1",
",",
"keepdim",
"=",
"True",
")",
"w",
",",
"x",
",",
"y",
",",
"z",
"="... | https://github.com/gulvarol/smplpytorch/blob/a18b0197d8a7204865b2ec95307e2286533f9487/smplpytorch/pytorch/rodrigues_layer.py#L13-L38 | |
collinsctk/PyQYT | 7af3673955f94ff1b2df2f94220cd2dab2e252af | ExtentionPackages/paramiko/transport.py | python | Transport.auth_password | (self, username, password, event=None, fallback=True) | Authenticate to the server using a password. The username and password
are sent over an encrypted link.
If an ``event`` is passed in, this method will return immediately, and
the event will be triggered once authentication succeeds or fails. On
success, `is_authenticated` will return ... | Authenticate to the server using a password. The username and password
are sent over an encrypted link. | [
"Authenticate",
"to",
"the",
"server",
"using",
"a",
"password",
".",
"The",
"username",
"and",
"password",
"are",
"sent",
"over",
"an",
"encrypted",
"link",
"."
] | def auth_password(self, username, password, event=None, fallback=True):
"""
Authenticate to the server using a password. The username and password
are sent over an encrypted link.
If an ``event`` is passed in, this method will return immediately, and
the event will be triggered... | [
"def",
"auth_password",
"(",
"self",
",",
"username",
",",
"password",
",",
"event",
"=",
"None",
",",
"fallback",
"=",
"True",
")",
":",
"if",
"(",
"not",
"self",
".",
"active",
")",
"or",
"(",
"not",
"self",
".",
"initial_kex_done",
")",
":",
"# we... | https://github.com/collinsctk/PyQYT/blob/7af3673955f94ff1b2df2f94220cd2dab2e252af/ExtentionPackages/paramiko/transport.py#L1205-L1282 | ||
PaddlePaddle/PaddleX | 2bab73f81ab54e328204e7871e6ae4a82e719f5d | paddlex/ppdet/data/source/category.py | python | _widerface_category | () | return clsid2catid, catid2name | [] | def _widerface_category():
label_map = widerface_label()
label_map = sorted(label_map.items(), key=lambda x: x[1])
cats = [l[0] for l in label_map]
clsid2catid = {i: i for i in range(len(cats))}
catid2name = {i: name for i, name in enumerate(cats)}
return clsid2catid, catid2name | [
"def",
"_widerface_category",
"(",
")",
":",
"label_map",
"=",
"widerface_label",
"(",
")",
"label_map",
"=",
"sorted",
"(",
"label_map",
".",
"items",
"(",
")",
",",
"key",
"=",
"lambda",
"x",
":",
"x",
"[",
"1",
"]",
")",
"cats",
"=",
"[",
"l",
"... | https://github.com/PaddlePaddle/PaddleX/blob/2bab73f81ab54e328204e7871e6ae4a82e719f5d/paddlex/ppdet/data/source/category.py#L369-L376 | |||
TkTech/notifico | 484c411cba3cc00b69dbf462c2f038a2d9a44f84 | notifico/services/hooks/gitlab.py | python | GitlabHook._handle_merge_request | (cls, user, request, hook, json) | [] | def _handle_merge_request(cls, user, request, hook, json):
fmt_string = (
u'{RESET}[{BLUE}{name}{RESET}] {ORANGE}{who}{RESET} {action} '
'merge request {GREEN}!{num}{RESET}: {title} - {PINK}{url}{RESET}'
)
action = json['object_attributes']['action']
action += 'd... | [
"def",
"_handle_merge_request",
"(",
"cls",
",",
"user",
",",
"request",
",",
"hook",
",",
"json",
")",
":",
"fmt_string",
"=",
"(",
"u'{RESET}[{BLUE}{name}{RESET}] {ORANGE}{who}{RESET} {action} '",
"'merge request {GREEN}!{num}{RESET}: {title} - {PINK}{url}{RESET}'",
")",
"a... | https://github.com/TkTech/notifico/blob/484c411cba3cc00b69dbf462c2f038a2d9a44f84/notifico/services/hooks/gitlab.py#L392-L409 | ||||
andresriancho/w3af | cd22e5252243a87aaa6d0ddea47cf58dacfe00a9 | w3af/core/ui/gui/scanrun.py | python | KBBrowser.page_change | (self, page) | Handle the page change in the page control. | Handle the page change in the page control. | [
"Handle",
"the",
"page",
"change",
"in",
"the",
"page",
"control",
"."
] | def page_change(self, page):
"""
Handle the page change in the page control.
"""
# Only do something if I have a list of request and responses
if self.req_res_ids:
request_id = self.req_res_ids[page]
try:
historyItem = self._historyItem.rea... | [
"def",
"page_change",
"(",
"self",
",",
"page",
")",
":",
"# Only do something if I have a list of request and responses",
"if",
"self",
".",
"req_res_ids",
":",
"request_id",
"=",
"self",
".",
"req_res_ids",
"[",
"page",
"]",
"try",
":",
"historyItem",
"=",
"self... | https://github.com/andresriancho/w3af/blob/cd22e5252243a87aaa6d0ddea47cf58dacfe00a9/w3af/core/ui/gui/scanrun.py#L332-L351 | ||
Ericsson/codechecker | c4e43f62dc3acbf71d3109b337db7c97f7852f43 | analyzer/codechecker_analyzer/analyzer_context.py | python | Context.__set_version | (self) | Get the package version from the version config file. | Get the package version from the version config file. | [
"Get",
"the",
"package",
"version",
"from",
"the",
"version",
"config",
"file",
"."
] | def __set_version(self):
"""
Get the package version from the version config file.
"""
vfile_data = load_json_or_empty(self.version_file)
if not vfile_data:
sys.exit(1)
package_version = vfile_data['version']
package_build_date = vfile_data['package_... | [
"def",
"__set_version",
"(",
"self",
")",
":",
"vfile_data",
"=",
"load_json_or_empty",
"(",
"self",
".",
"version_file",
")",
"if",
"not",
"vfile_data",
":",
"sys",
".",
"exit",
"(",
"1",
")",
"package_version",
"=",
"vfile_data",
"[",
"'version'",
"]",
"... | https://github.com/Ericsson/codechecker/blob/c4e43f62dc3acbf71d3109b337db7c97f7852f43/analyzer/codechecker_analyzer/analyzer_context.py#L116-L142 | ||
zhl2008/awd-platform | 0416b31abea29743387b10b3914581fbe8e7da5e | web_flaskbb/Python-2.7.9/Lib/email/generator.py | python | _make_boundary | (text=None) | return b | [] | def _make_boundary(text=None):
# Craft a random boundary. If text is given, ensure that the chosen
# boundary doesn't appear in the text.
token = random.randrange(sys.maxint)
boundary = ('=' * 15) + (_fmt % token) + '=='
if text is None:
return boundary
b = boundary
counter = 0
... | [
"def",
"_make_boundary",
"(",
"text",
"=",
"None",
")",
":",
"# Craft a random boundary. If text is given, ensure that the chosen",
"# boundary doesn't appear in the text.",
"token",
"=",
"random",
".",
"randrange",
"(",
"sys",
".",
"maxint",
")",
"boundary",
"=",
"(",
... | https://github.com/zhl2008/awd-platform/blob/0416b31abea29743387b10b3914581fbe8e7da5e/web_flaskbb/Python-2.7.9/Lib/email/generator.py#L356-L371 | |||
hardmaru/slimevolleygym | 68b0b6850dcc9a6b20dbab92600748442d008485 | slimevolleygym/slimevolley.py | python | circle | (canvas, x, y, r, color) | Processing style function to make it easy to port p5.js program to python | Processing style function to make it easy to port p5.js program to python | [
"Processing",
"style",
"function",
"to",
"make",
"it",
"easy",
"to",
"port",
"p5",
".",
"js",
"program",
"to",
"python"
] | def circle(canvas, x, y, r, color):
""" Processing style function to make it easy to port p5.js program to python """
if PIXEL_MODE:
return cv2.circle(canvas, (round(x), round(WINDOW_HEIGHT-y)), round(r),
color, thickness=-1, lineType=cv2.LINE_AA)
else:
geom = rendering.make_circle(r, res=40)
tr... | [
"def",
"circle",
"(",
"canvas",
",",
"x",
",",
"y",
",",
"r",
",",
"color",
")",
":",
"if",
"PIXEL_MODE",
":",
"return",
"cv2",
".",
"circle",
"(",
"canvas",
",",
"(",
"round",
"(",
"x",
")",
",",
"round",
"(",
"WINDOW_HEIGHT",
"-",
"y",
")",
"... | https://github.com/hardmaru/slimevolleygym/blob/68b0b6850dcc9a6b20dbab92600748442d008485/slimevolleygym/slimevolley.py#L205-L217 | ||
RUB-NDS/PRET | b59eae87bd001a15f8e3d818aafdba767f4b3aa9 | pjl.py | python | pjl.do_mkdir | (self, arg) | Create remote directory: mkdir <path> | Create remote directory: mkdir <path> | [
"Create",
"remote",
"directory",
":",
"mkdir",
"<path",
">"
] | def do_mkdir(self, arg):
"Create remote directory: mkdir <path>"
if not arg:
arg = eval(input("Directory: "))
path = self.rpath(arg)
self.cmd('@PJL FSMKDIR NAME="' + path + '"', False) | [
"def",
"do_mkdir",
"(",
"self",
",",
"arg",
")",
":",
"if",
"not",
"arg",
":",
"arg",
"=",
"eval",
"(",
"input",
"(",
"\"Directory: \"",
")",
")",
"path",
"=",
"self",
".",
"rpath",
"(",
"arg",
")",
"self",
".",
"cmd",
"(",
"'@PJL FSMKDIR NAME=\"'",
... | https://github.com/RUB-NDS/PRET/blob/b59eae87bd001a15f8e3d818aafdba767f4b3aa9/pjl.py#L203-L208 | ||
avalonstrel/GatedConvolution_pytorch | 0a49013a70e77cc484ab45a5da535c2ac003b252 | models/networks.py | python | GatedDeConv2dWithActivation.__init__ | (self, scale_factor, in_channels, out_channels, kernel_size, stride=1, padding=0, dilation=1, groups=1, bias=True, batch_norm=True,activation=torch.nn.LeakyReLU(0.2, inplace=True)) | [] | def __init__(self, scale_factor, in_channels, out_channels, kernel_size, stride=1, padding=0, dilation=1, groups=1, bias=True, batch_norm=True,activation=torch.nn.LeakyReLU(0.2, inplace=True)):
super(GatedDeConv2dWithActivation, self).__init__()
self.conv2d = GatedConv2dWithActivation(in_channels, out_c... | [
"def",
"__init__",
"(",
"self",
",",
"scale_factor",
",",
"in_channels",
",",
"out_channels",
",",
"kernel_size",
",",
"stride",
"=",
"1",
",",
"padding",
"=",
"0",
",",
"dilation",
"=",
"1",
",",
"groups",
"=",
"1",
",",
"bias",
"=",
"True",
",",
"b... | https://github.com/avalonstrel/GatedConvolution_pytorch/blob/0a49013a70e77cc484ab45a5da535c2ac003b252/models/networks.py#L76-L79 | ||||
huggingface/transformers | 623b4f7c63f60cce917677ee704d6c93ee960b4b | src/transformers/utils/dummy_pt_objects.py | python | XLMRobertaForCausalLM.forward | (self, *args, **kwargs) | [] | def forward(self, *args, **kwargs):
requires_backends(self, ["torch"]) | [
"def",
"forward",
"(",
"self",
",",
"*",
"args",
",",
"*",
"*",
"kwargs",
")",
":",
"requires_backends",
"(",
"self",
",",
"[",
"\"torch\"",
"]",
")"
] | https://github.com/huggingface/transformers/blob/623b4f7c63f60cce917677ee704d6c93ee960b4b/src/transformers/utils/dummy_pt_objects.py#L5402-L5403 | ||||
openhatch/oh-mainline | ce29352a034e1223141dcc2f317030bbc3359a51 | vendor/packages/twisted/twisted/words/protocols/msn.py | python | _login | (userHandle, passwd, nexusServer, cached=0, authData='') | return cb | This function is used internally and should not ever be called
directly.
@raise SSLRequired: If there is no SSL support available. | This function is used internally and should not ever be called
directly. | [
"This",
"function",
"is",
"used",
"internally",
"and",
"should",
"not",
"ever",
"be",
"called",
"directly",
"."
] | def _login(userHandle, passwd, nexusServer, cached=0, authData=''):
"""
This function is used internally and should not ever be called
directly.
@raise SSLRequired: If there is no SSL support available.
"""
if ClientContextFactory is None:
raise SSLRequired(
'Connecting to t... | [
"def",
"_login",
"(",
"userHandle",
",",
"passwd",
",",
"nexusServer",
",",
"cached",
"=",
"0",
",",
"authData",
"=",
"''",
")",
":",
"if",
"ClientContextFactory",
"is",
"None",
":",
"raise",
"SSLRequired",
"(",
"'Connecting to the Passport server requires SSL, bu... | https://github.com/openhatch/oh-mainline/blob/ce29352a034e1223141dcc2f317030bbc3359a51/vendor/packages/twisted/twisted/words/protocols/msn.py#L175-L202 | |
HymanLiuTS/flaskTs | 286648286976e85d9b9a5873632331efcafe0b21 | flasky/lib/python2.7/site-packages/pip/_vendor/ipaddress.py | python | v6_int_to_packed | (address) | Represent an address as 16 packed bytes in network (big-endian) order.
Args:
address: An integer representation of an IPv6 IP address.
Returns:
The integer address packed as 16 bytes in network (big-endian) order. | Represent an address as 16 packed bytes in network (big-endian) order. | [
"Represent",
"an",
"address",
"as",
"16",
"packed",
"bytes",
"in",
"network",
"(",
"big",
"-",
"endian",
")",
"order",
"."
] | def v6_int_to_packed(address):
"""Represent an address as 16 packed bytes in network (big-endian) order.
Args:
address: An integer representation of an IPv6 IP address.
Returns:
The integer address packed as 16 bytes in network (big-endian) order.
"""
try:
return _compat_t... | [
"def",
"v6_int_to_packed",
"(",
"address",
")",
":",
"try",
":",
"return",
"_compat_to_bytes",
"(",
"address",
",",
"16",
",",
"'big'",
")",
"except",
"(",
"struct",
".",
"error",
",",
"OverflowError",
")",
":",
"raise",
"ValueError",
"(",
"\"Address negativ... | https://github.com/HymanLiuTS/flaskTs/blob/286648286976e85d9b9a5873632331efcafe0b21/flasky/lib/python2.7/site-packages/pip/_vendor/ipaddress.py#L260-L273 | ||
PyFilesystem/pyfilesystem | 7dfe14ae6c3b9c53543c1c3890232d9f37579f34 | fs/opener.py | python | OpenerRegistry.add | (self, opener) | Adds an opener to the registry
:param opener: a class derived from fs.opener.Opener | Adds an opener to the registry | [
"Adds",
"an",
"opener",
"to",
"the",
"registry"
] | def add(self, opener):
"""Adds an opener to the registry
:param opener: a class derived from fs.opener.Opener
"""
index = len(self.openers)
self.openers[index] = opener
for name in opener.names:
self.registry[name] = index | [
"def",
"add",
"(",
"self",
",",
"opener",
")",
":",
"index",
"=",
"len",
"(",
"self",
".",
"openers",
")",
"self",
".",
"openers",
"[",
"index",
"]",
"=",
"opener",
"for",
"name",
"in",
"opener",
".",
"names",
":",
"self",
".",
"registry",
"[",
"... | https://github.com/PyFilesystem/pyfilesystem/blob/7dfe14ae6c3b9c53543c1c3890232d9f37579f34/fs/opener.py#L182-L192 | ||
PaddlePaddle/PARL | 5fb7a5d2b5d0f0dac57fdf4acb9e79485c7efa96 | parl/remote/remote_class_serialization.py | python | locate_remote_file | (module_path) | return relative_module_path, False | xparl has to locate the file that has the class decorated by parl.remote_class.
If the entry_path is the prefix of the absolute path of the module, which means the
file of the module is in the directory of entry or its subdirectories, this function
will return the relative path between this file and the ... | xparl has to locate the file that has the class decorated by parl.remote_class. | [
"xparl",
"has",
"to",
"locate",
"the",
"file",
"that",
"has",
"the",
"class",
"decorated",
"by",
"parl",
".",
"remote_class",
"."
] | def locate_remote_file(module_path):
"""xparl has to locate the file that has the class decorated by parl.remote_class.
If the entry_path is the prefix of the absolute path of the module, which means the
file of the module is in the directory of entry or its subdirectories, this function
will return ... | [
"def",
"locate_remote_file",
"(",
"module_path",
")",
":",
"if",
"isnotebook",
"(",
")",
":",
"entry_path",
"=",
"os",
".",
"getcwd",
"(",
")",
"else",
":",
"entry_file",
"=",
"sys",
".",
"argv",
"[",
"0",
"]",
"entry_file",
"=",
"entry_file",
".",
"sp... | https://github.com/PaddlePaddle/PARL/blob/5fb7a5d2b5d0f0dac57fdf4acb9e79485c7efa96/parl/remote/remote_class_serialization.py#L67-L140 | |
plotly/plotly.py | cfad7862594b35965c0e000813bd7805e8494a5b | packages/python/plotly/plotly/graph_objs/parcoords/_tickfont.py | python | Tickfont.size | (self) | return self["size"] | The 'size' property is a number and may be specified as:
- An int or float in the interval [1, inf]
Returns
-------
int|float | The 'size' property is a number and may be specified as:
- An int or float in the interval [1, inf] | [
"The",
"size",
"property",
"is",
"a",
"number",
"and",
"may",
"be",
"specified",
"as",
":",
"-",
"An",
"int",
"or",
"float",
"in",
"the",
"interval",
"[",
"1",
"inf",
"]"
] | def size(self):
"""
The 'size' property is a number and may be specified as:
- An int or float in the interval [1, inf]
Returns
-------
int|float
"""
return self["size"] | [
"def",
"size",
"(",
"self",
")",
":",
"return",
"self",
"[",
"\"size\"",
"]"
] | https://github.com/plotly/plotly.py/blob/cfad7862594b35965c0e000813bd7805e8494a5b/packages/python/plotly/plotly/graph_objs/parcoords/_tickfont.py#L104-L113 | |
scateu/PyWGS84ToGCJ02 | 7a94a6bc423b9547b939acfdd479a7b54f2aee8d | WGS84Distance.py | python | distance | (origin, destination) | return d | (lat,lon)
kilometers | (lat,lon)
kilometers | [
"(",
"lat",
"lon",
")",
"kilometers"
] | def distance(origin, destination):
"""
(lat,lon)
kilometers
"""
lat1, lon1 = origin
lat2, lon2 = destination
radius = 6371 # km
dlat = math.radians(lat2-lat1)
dlon = math.radians(lon2-lon1)
a = math.sin(dlat/2) * math.sin(dlat/2) + math.cos(math.radians(lat1)) \
* math.c... | [
"def",
"distance",
"(",
"origin",
",",
"destination",
")",
":",
"lat1",
",",
"lon1",
"=",
"origin",
"lat2",
",",
"lon2",
"=",
"destination",
"radius",
"=",
"6371",
"# km",
"dlat",
"=",
"math",
".",
"radians",
"(",
"lat2",
"-",
"lat1",
")",
"dlon",
"=... | https://github.com/scateu/PyWGS84ToGCJ02/blob/7a94a6bc423b9547b939acfdd479a7b54f2aee8d/WGS84Distance.py#L8-L24 | |
awslabs/aws-lambda-powertools-python | 0c6ac0fe183476140ee1df55fe9fa1cc20925577 | aws_lambda_powertools/utilities/data_classes/s3_object_event.py | python | S3ObjectUserIdentity.arn | (self) | return self["arn"] | The ARN of the principal that made the call.
The last section of the ARN contains the user or role that made the call. | The ARN of the principal that made the call.
The last section of the ARN contains the user or role that made the call. | [
"The",
"ARN",
"of",
"the",
"principal",
"that",
"made",
"the",
"call",
".",
"The",
"last",
"section",
"of",
"the",
"ARN",
"contains",
"the",
"user",
"or",
"role",
"that",
"made",
"the",
"call",
"."
] | def arn(self) -> str:
"""The ARN of the principal that made the call.
The last section of the ARN contains the user or role that made the call."""
return self["arn"] | [
"def",
"arn",
"(",
"self",
")",
"->",
"str",
":",
"return",
"self",
"[",
"\"arn\"",
"]"
] | https://github.com/awslabs/aws-lambda-powertools-python/blob/0c6ac0fe183476140ee1df55fe9fa1cc20925577/aws_lambda_powertools/utilities/data_classes/s3_object_event.py#L211-L214 | |
mesalock-linux/mesapy | ed546d59a21b36feb93e2309d5c6b75aa0ad95c9 | lib-python/2.7/nntplib.py | python | NNTP.post | (self, f) | return self.getresp() | Process a POST command. Arguments:
- f: file containing the article
Returns:
- resp: server response if successful | Process a POST command. Arguments:
- f: file containing the article
Returns:
- resp: server response if successful | [
"Process",
"a",
"POST",
"command",
".",
"Arguments",
":",
"-",
"f",
":",
"file",
"containing",
"the",
"article",
"Returns",
":",
"-",
"resp",
":",
"server",
"response",
"if",
"successful"
] | def post(self, f):
"""Process a POST command. Arguments:
- f: file containing the article
Returns:
- resp: server response if successful"""
resp = self.shortcmd('POST')
# Raises error_??? if posting is not allowed
if resp[0] != '3':
raise NNTPReplyEr... | [
"def",
"post",
"(",
"self",
",",
"f",
")",
":",
"resp",
"=",
"self",
".",
"shortcmd",
"(",
"'POST'",
")",
"# Raises error_??? if posting is not allowed",
"if",
"resp",
"[",
"0",
"]",
"!=",
"'3'",
":",
"raise",
"NNTPReplyError",
"(",
"resp",
")",
"while",
... | https://github.com/mesalock-linux/mesapy/blob/ed546d59a21b36feb93e2309d5c6b75aa0ad95c9/lib-python/2.7/nntplib.py#L558-L578 | |
ioflo/ioflo | 177ac656d7c4ff801aebb0d8b401db365a5248ce | ioflo/base/logging.py | python | Logger.makeRunner | (self) | generator factory function to create generator to run this logger | generator factory function to create generator to run this logger | [
"generator",
"factory",
"function",
"to",
"create",
"generator",
"to",
"run",
"this",
"logger"
] | def makeRunner(self):
"""
generator factory function to create generator to run this logger
"""
#do any on creation initialization here
console.profuse(" Making Logger Task Runner {0}\n".format(self.name))
self.status = STOPPED #operational status of tasker
s... | [
"def",
"makeRunner",
"(",
"self",
")",
":",
"#do any on creation initialization here",
"console",
".",
"profuse",
"(",
"\" Making Logger Task Runner {0}\\n\"",
".",
"format",
"(",
"self",
".",
"name",
")",
")",
"self",
".",
"status",
"=",
"STOPPED",
"#operationa... | https://github.com/ioflo/ioflo/blob/177ac656d7c4ff801aebb0d8b401db365a5248ce/ioflo/base/logging.py#L244-L313 | ||
zopefoundation/Zope | ea04dd670d1a48d4d5c879d3db38fc2e9b4330bb | src/ZPublisher/xmlrpc.py | python | Response.__delattr__ | (self, name) | return delattr(self._real, name) | [] | def __delattr__(self, name):
return delattr(self._real, name) | [
"def",
"__delattr__",
"(",
"self",
",",
"name",
")",
":",
"return",
"delattr",
"(",
"self",
".",
"_real",
",",
"name",
")"
] | https://github.com/zopefoundation/Zope/blob/ea04dd670d1a48d4d5c879d3db38fc2e9b4330bb/src/ZPublisher/xmlrpc.py#L149-L150 | |||
plotly/plotly.py | cfad7862594b35965c0e000813bd7805e8494a5b | packages/python/plotly/plotly/graph_objs/_scatter3d.py | python | Scatter3d.uid | (self) | return self["uid"] | Assign an id to this trace, Use this to provide object
constancy between traces during animations and transitions.
The 'uid' property is a string and must be specified as:
- A string
- A number that will be converted to a string
Returns
-------
str | Assign an id to this trace, Use this to provide object
constancy between traces during animations and transitions.
The 'uid' property is a string and must be specified as:
- A string
- A number that will be converted to a string | [
"Assign",
"an",
"id",
"to",
"this",
"trace",
"Use",
"this",
"to",
"provide",
"object",
"constancy",
"between",
"traces",
"during",
"animations",
"and",
"transitions",
".",
"The",
"uid",
"property",
"is",
"a",
"string",
"and",
"must",
"be",
"specified",
"as",... | def uid(self):
"""
Assign an id to this trace, Use this to provide object
constancy between traces during animations and transitions.
The 'uid' property is a string and must be specified as:
- A string
- A number that will be converted to a string
Return... | [
"def",
"uid",
"(",
"self",
")",
":",
"return",
"self",
"[",
"\"uid\"",
"]"
] | https://github.com/plotly/plotly.py/blob/cfad7862594b35965c0e000813bd7805e8494a5b/packages/python/plotly/plotly/graph_objs/_scatter3d.py#L1485-L1498 | |
shellphish/ictf-framework | c0384f12060cf47442a52f516c6e78bd722f208a | database/support/mysql-connector-python-2.1.3/lib/mysql/connector/connection.py | python | MySQLConnection.commit | (self) | Commit current transaction | Commit current transaction | [
"Commit",
"current",
"transaction"
] | def commit(self):
"""Commit current transaction"""
self._execute_query("COMMIT") | [
"def",
"commit",
"(",
"self",
")",
":",
"self",
".",
"_execute_query",
"(",
"\"COMMIT\"",
")"
] | https://github.com/shellphish/ictf-framework/blob/c0384f12060cf47442a52f516c6e78bd722f208a/database/support/mysql-connector-python-2.1.3/lib/mysql/connector/connection.py#L848-L850 | ||
fancompute/ceviche | 5da9df12cb2b15cc25ca1a3d4b5eb827eb89e195 | ceviche/derivatives.py | python | createDws | (component, dir, shape, dL, bloch_x=0.0, bloch_y=0.0) | creates the derivative matrices
component: one of 'x' or 'y' for derivative in x or y direction
dir: one of 'f' or 'b', whether to take forward or backward finite difference
shape: shape of the FDFD grid
dL: spatial grid size (m)
block_x: bloch phase (phase ac... | creates the derivative matrices
component: one of 'x' or 'y' for derivative in x or y direction
dir: one of 'f' or 'b', whether to take forward or backward finite difference
shape: shape of the FDFD grid
dL: spatial grid size (m)
block_x: bloch phase (phase ac... | [
"creates",
"the",
"derivative",
"matrices",
"component",
":",
"one",
"of",
"x",
"or",
"y",
"for",
"derivative",
"in",
"x",
"or",
"y",
"direction",
"dir",
":",
"one",
"of",
"f",
"or",
"b",
"whether",
"to",
"take",
"forward",
"or",
"backward",
"finite",
... | def createDws(component, dir, shape, dL, bloch_x=0.0, bloch_y=0.0):
""" creates the derivative matrices
component: one of 'x' or 'y' for derivative in x or y direction
dir: one of 'f' or 'b', whether to take forward or backward finite difference
shape: shape of the FDFD grid
... | [
"def",
"createDws",
"(",
"component",
",",
"dir",
",",
"shape",
",",
"dL",
",",
"bloch_x",
"=",
"0.0",
",",
"bloch_y",
"=",
"0.0",
")",
":",
"Nx",
",",
"Ny",
"=",
"shape",
"# special case, a 1D problem",
"if",
"component",
"==",
"'x'",
"and",
"Nx",
"==... | https://github.com/fancompute/ceviche/blob/5da9df12cb2b15cc25ca1a3d4b5eb827eb89e195/ceviche/derivatives.py#L63-L92 | ||
kubernetes-client/python | 47b9da9de2d02b2b7a34fbe05afb44afd130d73a | kubernetes/client/models/v1_replica_set_condition.py | python | V1ReplicaSetCondition.__repr__ | (self) | return self.to_str() | For `print` and `pprint` | For `print` and `pprint` | [
"For",
"print",
"and",
"pprint"
] | def __repr__(self):
"""For `print` and `pprint`"""
return self.to_str() | [
"def",
"__repr__",
"(",
"self",
")",
":",
"return",
"self",
".",
"to_str",
"(",
")"
] | https://github.com/kubernetes-client/python/blob/47b9da9de2d02b2b7a34fbe05afb44afd130d73a/kubernetes/client/models/v1_replica_set_condition.py#L220-L222 | |
compas-dev/compas | 0b33f8786481f710115fb1ae5fe79abc2a9a5175 | src/compas/data/data.py | python | Data.from_data | (cls, data) | return obj | Construct an object of this type from the provided data.
Parameters
----------
data : dict
The data dictionary.
Returns
-------
:class:`compas.data.Data`
An instance of this object type if the data contained in the dict has the correct schema. | Construct an object of this type from the provided data. | [
"Construct",
"an",
"object",
"of",
"this",
"type",
"from",
"the",
"provided",
"data",
"."
] | def from_data(cls, data):
"""Construct an object of this type from the provided data.
Parameters
----------
data : dict
The data dictionary.
Returns
-------
:class:`compas.data.Data`
An instance of this object type if the data contained i... | [
"def",
"from_data",
"(",
"cls",
",",
"data",
")",
":",
"obj",
"=",
"cls",
"(",
")",
"obj",
".",
"data",
"=",
"data",
"return",
"obj"
] | https://github.com/compas-dev/compas/blob/0b33f8786481f710115fb1ae5fe79abc2a9a5175/src/compas/data/data.py#L193-L209 | |
mrjoes/sockjs-tornado | 3fcd86db622e0c2b8f48641d3a53f0d52eb0c6aa | sockjs/tornado/session.py | python | BaseSession.__init__ | (self, conn, server) | Base constructor.
`conn`
Connection class
`server`
SockJSRouter instance | Base constructor. | [
"Base",
"constructor",
"."
] | def __init__(self, conn, server):
"""Base constructor.
`conn`
Connection class
`server`
SockJSRouter instance
"""
self.server = server
self.stats = server.stats
self.send_expects_json = False
self.handler = None
self.stat... | [
"def",
"__init__",
"(",
"self",
",",
"conn",
",",
"server",
")",
":",
"self",
".",
"server",
"=",
"server",
"self",
".",
"stats",
"=",
"server",
".",
"stats",
"self",
".",
"send_expects_json",
"=",
"False",
"self",
".",
"handler",
"=",
"None",
"self",
... | https://github.com/mrjoes/sockjs-tornado/blob/3fcd86db622e0c2b8f48641d3a53f0d52eb0c6aa/sockjs/tornado/session.py#L68-L88 | ||
coderholic/pyradio | cd3ee2d6b369fedfd009371a59aca23ab39b020f | pyradio/radio.py | python | PyRadio._redisplay_ask_to_create_new_theme | (self) | [] | def _redisplay_ask_to_create_new_theme(self):
if logger.isEnabledFor(logging.ERROR):
logger.error('DE self.ws.previous_operation_mode = {}'.format(self.ws.previous_operation_mode))
self._theme_selector.parent = self.outerBodyWin
if self.ws.previous_operation_mode == self.ws.CONFIG_MO... | [
"def",
"_redisplay_ask_to_create_new_theme",
"(",
"self",
")",
":",
"if",
"logger",
".",
"isEnabledFor",
"(",
"logging",
".",
"ERROR",
")",
":",
"logger",
".",
"error",
"(",
"'DE self.ws.previous_operation_mode = {}'",
".",
"format",
"(",
"self",
".",
"ws",
".",... | https://github.com/coderholic/pyradio/blob/cd3ee2d6b369fedfd009371a59aca23ab39b020f/pyradio/radio.py#L7053-L7063 | ||||
pantsbuild/pex | 473c6ac732ed4bc338b4b20a9ec930d1d722c9b4 | pex/vendor/_vendored/pip/pip/_internal/exceptions.py | python | HashMissing.__init__ | (self, gotten_hash) | :param gotten_hash: The hash of the (possibly malicious) archive we
just downloaded | :param gotten_hash: The hash of the (possibly malicious) archive we
just downloaded | [
":",
"param",
"gotten_hash",
":",
"The",
"hash",
"of",
"the",
"(",
"possibly",
"malicious",
")",
"archive",
"we",
"just",
"downloaded"
] | def __init__(self, gotten_hash):
# type: (str) -> None
"""
:param gotten_hash: The hash of the (possibly malicious) archive we
just downloaded
"""
self.gotten_hash = gotten_hash | [
"def",
"__init__",
"(",
"self",
",",
"gotten_hash",
")",
":",
"# type: (str) -> None",
"self",
".",
"gotten_hash",
"=",
"gotten_hash"
] | https://github.com/pantsbuild/pex/blob/473c6ac732ed4bc338b4b20a9ec930d1d722c9b4/pex/vendor/_vendored/pip/pip/_internal/exceptions.py#L273-L279 | ||
meetup/python-api-client | 3874c74b0b6dd91fa05495a54a70f5ca8728dec3 | oauth.py | python | generate_timestamp | () | return int(time.time()) | Get seconds since epoch (UTC). | Get seconds since epoch (UTC). | [
"Get",
"seconds",
"since",
"epoch",
"(",
"UTC",
")",
"."
] | def generate_timestamp():
"""Get seconds since epoch (UTC)."""
return int(time.time()) | [
"def",
"generate_timestamp",
"(",
")",
":",
"return",
"int",
"(",
"time",
".",
"time",
"(",
")",
")"
] | https://github.com/meetup/python-api-client/blob/3874c74b0b6dd91fa05495a54a70f5ca8728dec3/oauth.py#L59-L61 | |
adamcharnock/lightbus | 5e7069da06cd37a8131e8c592ee957ccb73603d5 | lightbus/client/bus_client.py | python | BusClient.run_forever | (self) | return self.exit_code | [] | def run_forever(self):
block(self.start_worker())
self._actually_run_forever()
logger.debug("Main thread event loop was stopped")
# Close down the worker
logger.debug("Stopping worker")
block(self.stop_worker())
# Close down the client
logger.debug("Clo... | [
"def",
"run_forever",
"(",
"self",
")",
":",
"block",
"(",
"self",
".",
"start_worker",
"(",
")",
")",
"self",
".",
"_actually_run_forever",
"(",
")",
"logger",
".",
"debug",
"(",
"\"Main thread event loop was stopped\"",
")",
"# Close down the worker",
"logger",
... | https://github.com/adamcharnock/lightbus/blob/5e7069da06cd37a8131e8c592ee957ccb73603d5/lightbus/client/bus_client.py#L150-L164 | |||
doorstop-dev/doorstop | 03aa287e5069e29da6979274e1cb6714ee450d3a | doorstop/common.py | python | write_lines | (lines, path, end='\n', encoding='utf-8') | return path | Write lines of text to a file.
:param lines: iterator of strings
:param path: file to write lines
:param end: string to end lines
:param encoding: output file encoding
:return: path of new file | Write lines of text to a file. | [
"Write",
"lines",
"of",
"text",
"to",
"a",
"file",
"."
] | def write_lines(lines, path, end='\n', encoding='utf-8'):
"""Write lines of text to a file.
:param lines: iterator of strings
:param path: file to write lines
:param end: string to end lines
:param encoding: output file encoding
:return: path of new file
"""
log.trace("writing lines t... | [
"def",
"write_lines",
"(",
"lines",
",",
"path",
",",
"end",
"=",
"'\\n'",
",",
"encoding",
"=",
"'utf-8'",
")",
":",
"log",
".",
"trace",
"(",
"\"writing lines to '{}'...\"",
".",
"format",
"(",
"path",
")",
")",
"# type: ignore",
"with",
"open",
"(",
"... | https://github.com/doorstop-dev/doorstop/blob/03aa287e5069e29da6979274e1cb6714ee450d3a/doorstop/common.py#L145-L161 | |
Theano/Theano | 8fd9203edfeecebced9344b0c70193be292a9ade | theano/gpuarray/cudnn_defs.py | python | get_definitions | (cudnn_version=None) | return CuDNNV7() | Return cuDNN definitions to be used by Theano for the given cuDNN version.
``cudnn_version`` must be None or an integer
(typically the version returned by :func:`theano.gpuarray.dnn.version`).
if None, return definitions for the most recent supported cuDNN version. | Return cuDNN definitions to be used by Theano for the given cuDNN version. | [
"Return",
"cuDNN",
"definitions",
"to",
"be",
"used",
"by",
"Theano",
"for",
"the",
"given",
"cuDNN",
"version",
"."
] | def get_definitions(cudnn_version=None):
"""
Return cuDNN definitions to be used by Theano for the given cuDNN version.
``cudnn_version`` must be None or an integer
(typically the version returned by :func:`theano.gpuarray.dnn.version`).
if None, return definitions for the most recent supported cu... | [
"def",
"get_definitions",
"(",
"cudnn_version",
"=",
"None",
")",
":",
"if",
"cudnn_version",
"is",
"not",
"None",
":",
"if",
"cudnn_version",
"//",
"1000",
"==",
"5",
":",
"return",
"CuDNNV51",
"(",
")",
"if",
"cudnn_version",
"//",
"1000",
"==",
"6",
"... | https://github.com/Theano/Theano/blob/8fd9203edfeecebced9344b0c70193be292a9ade/theano/gpuarray/cudnn_defs.py#L322-L337 | |
1012598167/flask_mongodb_game | 60c7e0351586656ec38f851592886338e50b4110 | python_flask/venv/Lib/site-packages/pip-19.0.3-py3.6.egg/pip/_vendor/packaging/markers.py | python | Marker.evaluate | (self, environment=None) | return _evaluate_markers(self._markers, current_environment) | Evaluate a marker.
Return the boolean from evaluating the given marker against the
environment. environment is an optional argument to override all or
part of the determined environment.
The environment is determined from the current Python process. | Evaluate a marker. | [
"Evaluate",
"a",
"marker",
"."
] | def evaluate(self, environment=None):
"""Evaluate a marker.
Return the boolean from evaluating the given marker against the
environment. environment is an optional argument to override all or
part of the determined environment.
The environment is determined from the current Pyt... | [
"def",
"evaluate",
"(",
"self",
",",
"environment",
"=",
"None",
")",
":",
"current_environment",
"=",
"default_environment",
"(",
")",
"if",
"environment",
"is",
"not",
"None",
":",
"current_environment",
".",
"update",
"(",
"environment",
")",
"return",
"_ev... | https://github.com/1012598167/flask_mongodb_game/blob/60c7e0351586656ec38f851592886338e50b4110/python_flask/venv/Lib/site-packages/pip-19.0.3-py3.6.egg/pip/_vendor/packaging/markers.py#L283-L296 | |
open-mmlab/mmskeleton | b4c076baa9e02e69b5876c49fa7c509866d902c7 | deprecated/origin_stgcn_repo/feeder/feeder_kinetics.py | python | Feeder_kinetics.__len__ | (self) | return len(self.sample_name) | [] | def __len__(self):
return len(self.sample_name) | [
"def",
"__len__",
"(",
"self",
")",
":",
"return",
"len",
"(",
"self",
".",
"sample_name",
")"
] | https://github.com/open-mmlab/mmskeleton/blob/b4c076baa9e02e69b5876c49fa7c509866d902c7/deprecated/origin_stgcn_repo/feeder/feeder_kinetics.py#L89-L90 | |||
hacktoolspack/hack-tools | c2b1e324f4b24a2c5b4f111e7ef84e9c547159c2 | BruteXSS/mechanize/_mechanize.py | python | Browser.links | (self, **kwds) | Return iterable over links (mechanize.Link objects). | Return iterable over links (mechanize.Link objects). | [
"Return",
"iterable",
"over",
"links",
"(",
"mechanize",
".",
"Link",
"objects",
")",
"."
] | def links(self, **kwds):
"""Return iterable over links (mechanize.Link objects)."""
if not self.viewing_html():
raise BrowserStateError("not viewing HTML")
links = self._factory.links()
if kwds:
return self._filter_links(links, **kwds)
else:
re... | [
"def",
"links",
"(",
"self",
",",
"*",
"*",
"kwds",
")",
":",
"if",
"not",
"self",
".",
"viewing_html",
"(",
")",
":",
"raise",
"BrowserStateError",
"(",
"\"not viewing HTML\"",
")",
"links",
"=",
"self",
".",
"_factory",
".",
"links",
"(",
")",
"if",
... | https://github.com/hacktoolspack/hack-tools/blob/c2b1e324f4b24a2c5b4f111e7ef84e9c547159c2/BruteXSS/mechanize/_mechanize.py#L402-L410 | ||
pandaproject/panda | 133baa47882a289773a30c9656e2ea4efe569387 | api_examples/scraperwiki.py | python | slugify | (value) | return re.sub('[-\s]+', '-', value) | Graciously borrowed from Django core. | Graciously borrowed from Django core. | [
"Graciously",
"borrowed",
"from",
"Django",
"core",
"."
] | def slugify(value):
"""
Graciously borrowed from Django core.
"""
import unicodedata
value = unicodedata.normalize('NFKD', value).encode('ascii', 'ignore')
value = unicode(re.sub('[^\w\s-]', '', value).strip().lower())
return re.sub('[-\s]+', '-', value) | [
"def",
"slugify",
"(",
"value",
")",
":",
"import",
"unicodedata",
"value",
"=",
"unicodedata",
".",
"normalize",
"(",
"'NFKD'",
",",
"value",
")",
".",
"encode",
"(",
"'ascii'",
",",
"'ignore'",
")",
"value",
"=",
"unicode",
"(",
"re",
".",
"sub",
"("... | https://github.com/pandaproject/panda/blob/133baa47882a289773a30c9656e2ea4efe569387/api_examples/scraperwiki.py#L36-L43 | |
huggingface/transformers | 623b4f7c63f60cce917677ee704d6c93ee960b4b | src/transformers/models/bertweet/tokenization_bertweet.py | python | BertweetTokenizer.normalizeTweet | (self, tweet) | return " ".join(normTweet.split()) | Normalize a raw Tweet | Normalize a raw Tweet | [
"Normalize",
"a",
"raw",
"Tweet"
] | def normalizeTweet(self, tweet):
"""
Normalize a raw Tweet
"""
for punct in self.special_puncts:
tweet = tweet.replace(punct, self.special_puncts[punct])
tokens = self.tweetPreprocessor.tokenize(tweet)
normTweet = " ".join([self.normalizeToken(token) for toke... | [
"def",
"normalizeTweet",
"(",
"self",
",",
"tweet",
")",
":",
"for",
"punct",
"in",
"self",
".",
"special_puncts",
":",
"tweet",
"=",
"tweet",
".",
"replace",
"(",
"punct",
",",
"self",
".",
"special_puncts",
"[",
"punct",
"]",
")",
"tokens",
"=",
"sel... | https://github.com/huggingface/transformers/blob/623b4f7c63f60cce917677ee704d6c93ee960b4b/src/transformers/models/bertweet/tokenization_bertweet.py#L323-L355 | |
jupyter/nbdime | 17d103c5102f98fb83417fc54a99237795110b3a | nbdime/merging/chunks.py | python | __unused__get_diff_range | (diffs, i) | return e, j, k | Returns diff entry and range j..k which this diff affects, i.e. base[j:k] is affected. | Returns diff entry and range j..k which this diff affects, i.e. base[j:k] is affected. | [
"Returns",
"diff",
"entry",
"and",
"range",
"j",
"..",
"k",
"which",
"this",
"diff",
"affects",
"i",
".",
"e",
".",
"base",
"[",
"j",
":",
"k",
"]",
"is",
"affected",
"."
] | def __unused__get_diff_range(diffs, i):
"Returns diff entry and range j..k which this diff affects, i.e. base[j:k] is affected."
e = diffs[i]
j = e.key
if e.op == DiffOp.PATCH:
k = j + 1
elif e.op == DiffOp.ADDRANGE:
k = j
elif e.op == DiffOp.REMOVERANGE:
k = j + e.length... | [
"def",
"__unused__get_diff_range",
"(",
"diffs",
",",
"i",
")",
":",
"e",
"=",
"diffs",
"[",
"i",
"]",
"j",
"=",
"e",
".",
"key",
"if",
"e",
".",
"op",
"==",
"DiffOp",
".",
"PATCH",
":",
"k",
"=",
"j",
"+",
"1",
"elif",
"e",
".",
"op",
"==",
... | https://github.com/jupyter/nbdime/blob/17d103c5102f98fb83417fc54a99237795110b3a/nbdime/merging/chunks.py#L9-L21 | |
kipoi/models | 992a7149e64a4e7ee3c3ab5bad397f2e9e7e27a4 | FactorNet/HNF4A/onePeak_Unique35_DGF/dataloader.py | python | download_gencode_dir | (output_dir) | Download all the required gencode files | Download all the required gencode files | [
"Download",
"all",
"the",
"required",
"gencode",
"files"
] | def download_gencode_dir(output_dir):
"""Download all the required gencode files
"""
makedir_exist_ok(output_dir)
url_template = ("https://s3.eu-central-1.amazonaws.com/kipoi-models/"
"dataloader_files/FactorNet/dataloader_files/gencode_features/{}")
# url_template = "https://g... | [
"def",
"download_gencode_dir",
"(",
"output_dir",
")",
":",
"makedir_exist_ok",
"(",
"output_dir",
")",
"url_template",
"=",
"(",
"\"https://s3.eu-central-1.amazonaws.com/kipoi-models/\"",
"\"dataloader_files/FactorNet/dataloader_files/gencode_features/{}\"",
")",
"# url_template = \... | https://github.com/kipoi/models/blob/992a7149e64a4e7ee3c3ab5bad397f2e9e7e27a4/FactorNet/HNF4A/onePeak_Unique35_DGF/dataloader.py#L28-L47 | ||
bbangert/velruse | 7027acc43df77331d34014fdbb796ee5c54c8d5e | velruse/providers/openid.py | python | OpenIDConsumer._update_profile_data | (self, request, user_data, credentials) | Update the profile data using an OAuth request to fetch more data | Update the profile data using an OAuth request to fetch more data | [
"Update",
"the",
"profile",
"data",
"using",
"an",
"OAuth",
"request",
"to",
"fetch",
"more",
"data"
] | def _update_profile_data(self, request, user_data, credentials):
"""Update the profile data using an OAuth request to fetch more data""" | [
"def",
"_update_profile_data",
"(",
"self",
",",
"request",
",",
"user_data",
",",
"credentials",
")",
":"
] | https://github.com/bbangert/velruse/blob/7027acc43df77331d34014fdbb796ee5c54c8d5e/velruse/providers/openid.py#L224-L225 | ||
Skycrab/weixin-knife | 0cea6f645d1a94e45f394c32364dfb545f32b6b6 | weixin/pay.py | python | Wxpay_client_pub.postXml | (self) | return self.response | post请求xml | post请求xml | [
"post请求xml"
] | def postXml(self):
"""post请求xml"""
xml = self.createXml()
self.response = self.postXmlCurl(xml, self.url, self.curl_timeout)
return self.response | [
"def",
"postXml",
"(",
"self",
")",
":",
"xml",
"=",
"self",
".",
"createXml",
"(",
")",
"self",
".",
"response",
"=",
"self",
".",
"postXmlCurl",
"(",
"xml",
",",
"self",
".",
"url",
",",
"self",
".",
"curl_timeout",
")",
"return",
"self",
".",
"r... | https://github.com/Skycrab/weixin-knife/blob/0cea6f645d1a94e45f394c32364dfb545f32b6b6/weixin/pay.py#L197-L201 | |
GRAAL-Research/poutyne | f46e5fe610d175b96a490db24ef2d22b49cc594b | poutyne/framework/model_bundle.py | python | ModelBundle.get_path | (self, *paths: str) | return os.path.join(self.directory, *paths) | Returns the path inside the model bundle directory. | Returns the path inside the model bundle directory. | [
"Returns",
"the",
"path",
"inside",
"the",
"model",
"bundle",
"directory",
"."
] | def get_path(self, *paths: str) -> str:
"""
Returns the path inside the model bundle directory.
"""
return os.path.join(self.directory, *paths) | [
"def",
"get_path",
"(",
"self",
",",
"*",
"paths",
":",
"str",
")",
"->",
"str",
":",
"return",
"os",
".",
"path",
".",
"join",
"(",
"self",
".",
"directory",
",",
"*",
"paths",
")"
] | https://github.com/GRAAL-Research/poutyne/blob/f46e5fe610d175b96a490db24ef2d22b49cc594b/poutyne/framework/model_bundle.py#L427-L431 | |
python-zk/kazoo | f585d605eea0a37a08aae95a8cc259b80da2ecf0 | kazoo/handlers/utils.py | python | AsyncResult.get | (self, block=True, timeout=None) | Return the stored value or raise the exception.
If there is no value raises TimeoutError. | Return the stored value or raise the exception. | [
"Return",
"the",
"stored",
"value",
"or",
"raise",
"the",
"exception",
"."
] | def get(self, block=True, timeout=None):
"""Return the stored value or raise the exception.
If there is no value raises TimeoutError.
"""
with self._condition:
if self._exception is not _NONE:
if self._exception is None:
return self.value... | [
"def",
"get",
"(",
"self",
",",
"block",
"=",
"True",
",",
"timeout",
"=",
"None",
")",
":",
"with",
"self",
".",
"_condition",
":",
"if",
"self",
".",
"_exception",
"is",
"not",
"_NONE",
":",
"if",
"self",
".",
"_exception",
"is",
"None",
":",
"re... | https://github.com/python-zk/kazoo/blob/f585d605eea0a37a08aae95a8cc259b80da2ecf0/kazoo/handlers/utils.py#L59-L78 | ||
gem/oq-engine | 1bdb88f3914e390abcbd285600bfd39477aae47c | openquake/sep/liquefaction/liquefaction.py | python | hazus_magnitude_correction_factor | (
mag,
m3_coeff: float = 0.0027,
m2_coeff: float = -0.0267,
m1_coeff: float = -0.2055,
intercept=2.9188,
) | return (m3_coeff * (mag ** 3)
+ m2_coeff * (mag ** 2)
+ m1_coeff * mag
+ intercept) | Corrects the liquefaction probabilty equations based on the magnitude
of the causative earthquake. | Corrects the liquefaction probabilty equations based on the magnitude
of the causative earthquake. | [
"Corrects",
"the",
"liquefaction",
"probabilty",
"equations",
"based",
"on",
"the",
"magnitude",
"of",
"the",
"causative",
"earthquake",
"."
] | def hazus_magnitude_correction_factor(
mag,
m3_coeff: float = 0.0027,
m2_coeff: float = -0.0267,
m1_coeff: float = -0.2055,
intercept=2.9188,
):
"""
Corrects the liquefaction probabilty equations based on the magnitude
of the causative earthquake.
"""
return (m3_coeff * (mag ** 3... | [
"def",
"hazus_magnitude_correction_factor",
"(",
"mag",
",",
"m3_coeff",
":",
"float",
"=",
"0.0027",
",",
"m2_coeff",
":",
"float",
"=",
"-",
"0.0267",
",",
"m1_coeff",
":",
"float",
"=",
"-",
"0.2055",
",",
"intercept",
"=",
"2.9188",
",",
")",
":",
"r... | https://github.com/gem/oq-engine/blob/1bdb88f3914e390abcbd285600bfd39477aae47c/openquake/sep/liquefaction/liquefaction.py#L126-L140 | |
thadeusb/flask-cache | 1c60076b6d4c2df0ac1de54c59e63b4f780cecbc | flask_cache/__init__.py | python | Cache.delete_memoized | (self, f, *args, **kwargs) | Deletes the specified functions caches, based by given parameters.
If parameters are given, only the functions that were memoized with them
will be erased. Otherwise all versions of the caches will be forgotten.
Example::
@cache.memoize(50)
def random_func():
... | Deletes the specified functions caches, based by given parameters.
If parameters are given, only the functions that were memoized with them
will be erased. Otherwise all versions of the caches will be forgotten. | [
"Deletes",
"the",
"specified",
"functions",
"caches",
"based",
"by",
"given",
"parameters",
".",
"If",
"parameters",
"are",
"given",
"only",
"the",
"functions",
"that",
"were",
"memoized",
"with",
"them",
"will",
"be",
"erased",
".",
"Otherwise",
"all",
"versi... | def delete_memoized(self, f, *args, **kwargs):
"""
Deletes the specified functions caches, based by given parameters.
If parameters are given, only the functions that were memoized with them
will be erased. Otherwise all versions of the caches will be forgotten.
Example::
... | [
"def",
"delete_memoized",
"(",
"self",
",",
"f",
",",
"*",
"args",
",",
"*",
"*",
"kwargs",
")",
":",
"if",
"not",
"callable",
"(",
"f",
")",
":",
"raise",
"DeprecationWarning",
"(",
"\"Deleting messages by relative name is no longer\"",
"\" reliable, please switc... | https://github.com/thadeusb/flask-cache/blob/1c60076b6d4c2df0ac1de54c59e63b4f780cecbc/flask_cache/__init__.py#L556-L671 | ||
ajinabraham/OWASP-Xenotix-XSS-Exploit-Framework | cb692f527e4e819b6c228187c5702d990a180043 | bin/x86/Debug/scripting_engine/Lib/xml/sax/xmlreader.py | python | IncrementalParser.prepareParser | (self, source) | This method is called by the parse implementation to allow
the SAX 2.0 driver to prepare itself for parsing. | This method is called by the parse implementation to allow
the SAX 2.0 driver to prepare itself for parsing. | [
"This",
"method",
"is",
"called",
"by",
"the",
"parse",
"implementation",
"to",
"allow",
"the",
"SAX",
"2",
".",
"0",
"driver",
"to",
"prepare",
"itself",
"for",
"parsing",
"."
] | def prepareParser(self, source):
"""This method is called by the parse implementation to allow
the SAX 2.0 driver to prepare itself for parsing."""
raise NotImplementedError("prepareParser must be overridden!") | [
"def",
"prepareParser",
"(",
"self",
",",
"source",
")",
":",
"raise",
"NotImplementedError",
"(",
"\"prepareParser must be overridden!\"",
")"
] | https://github.com/ajinabraham/OWASP-Xenotix-XSS-Exploit-Framework/blob/cb692f527e4e819b6c228187c5702d990a180043/bin/x86/Debug/scripting_engine/Lib/xml/sax/xmlreader.py#L136-L139 | ||
cbanack/comic-vine-scraper | 8a7071796c61a9483079ad0e9ade56fcb7596bcd | src/py/database/comicvine/cvconnection.py | python | wait_until_ready | () | Waits until a fixed amount of time has passed since this function was
last called. Returns immediately if that much time has already passed. | Waits until a fixed amount of time has passed since this function was
last called. Returns immediately if that much time has already passed. | [
"Waits",
"until",
"a",
"fixed",
"amount",
"of",
"time",
"has",
"passed",
"since",
"this",
"function",
"was",
"last",
"called",
".",
"Returns",
"immediately",
"if",
"that",
"much",
"time",
"has",
"already",
"passed",
"."
] | def wait_until_ready():
'''
Waits until a fixed amount of time has passed since this function was
last called. Returns immediately if that much time has already passed.
'''
global __next_query_time_ms, __QUERY_DELAY_MS
time_ms = (DateTime.Now-DateTime(1970,1,1)).TotalMilliseconds
wait_ms = __nex... | [
"def",
"wait_until_ready",
"(",
")",
":",
"global",
"__next_query_time_ms",
",",
"__QUERY_DELAY_MS",
"time_ms",
"=",
"(",
"DateTime",
".",
"Now",
"-",
"DateTime",
"(",
"1970",
",",
"1",
",",
"1",
")",
")",
".",
"TotalMilliseconds",
"wait_ms",
"=",
"__next_qu... | https://github.com/cbanack/comic-vine-scraper/blob/8a7071796c61a9483079ad0e9ade56fcb7596bcd/src/py/database/comicvine/cvconnection.py#L262-L275 | ||
mit-han-lab/lite-transformer | 1df8001c779deb85819fc30d70349cc334c408ba | fairseq/utils.py | python | resolve_max_positions | (*args) | return max_positions | Resolve max position constraints from multiple sources. | Resolve max position constraints from multiple sources. | [
"Resolve",
"max",
"position",
"constraints",
"from",
"multiple",
"sources",
"."
] | def resolve_max_positions(*args):
"""Resolve max position constraints from multiple sources."""
def map_value_update(d1, d2):
updated_value = copy.deepcopy(d1)
for key in d2:
if key not in updated_value:
updated_value[key] = d2[key]
else:
... | [
"def",
"resolve_max_positions",
"(",
"*",
"args",
")",
":",
"def",
"map_value_update",
"(",
"d1",
",",
"d2",
")",
":",
"updated_value",
"=",
"copy",
".",
"deepcopy",
"(",
"d1",
")",
"for",
"key",
"in",
"d2",
":",
"if",
"key",
"not",
"in",
"updated_valu... | https://github.com/mit-han-lab/lite-transformer/blob/1df8001c779deb85819fc30d70349cc334c408ba/fairseq/utils.py#L262-L298 | |
nodesign/weio | 1d67d705a5c36a2e825ad13feab910b0aca9a2e8 | openWrt/files/usr/lib/python2.7/site-packages/tornado/template.py | python | _IncludeBlock.find_named_blocks | (self, loader, named_blocks) | [] | def find_named_blocks(self, loader, named_blocks):
included = loader.load(self.name, self.template_name)
included.file.find_named_blocks(loader, named_blocks) | [
"def",
"find_named_blocks",
"(",
"self",
",",
"loader",
",",
"named_blocks",
")",
":",
"included",
"=",
"loader",
".",
"load",
"(",
"self",
".",
"name",
",",
"self",
".",
"template_name",
")",
"included",
".",
"file",
".",
"find_named_blocks",
"(",
"loader... | https://github.com/nodesign/weio/blob/1d67d705a5c36a2e825ad13feab910b0aca9a2e8/openWrt/files/usr/lib/python2.7/site-packages/tornado/template.py#L460-L462 | ||||
bit-team/backintime | e1ae23ddc0b4229053e3e9c6c61adcb7f3d8e9b3 | common/snapshots.py | python | Snapshots.backup | (self, force = False) | return ret_error | Wrapper for :py:func:`takeSnapshot` which will prepair and clean up
things for the main :py:func:`takeSnapshot` method. This will check
that no other snapshots are running at the same time, there is nothing
prohibing a new snapshot (e.g. on battery) and the profile is configured
correctl... | Wrapper for :py:func:`takeSnapshot` which will prepair and clean up
things for the main :py:func:`takeSnapshot` method. This will check
that no other snapshots are running at the same time, there is nothing
prohibing a new snapshot (e.g. on battery) and the profile is configured
correctl... | [
"Wrapper",
"for",
":",
"py",
":",
"func",
":",
"takeSnapshot",
"which",
"will",
"prepair",
"and",
"clean",
"up",
"things",
"for",
"the",
"main",
":",
"py",
":",
"func",
":",
"takeSnapshot",
"method",
".",
"This",
"will",
"check",
"that",
"no",
"other",
... | def backup(self, force = False):
"""
Wrapper for :py:func:`takeSnapshot` which will prepair and clean up
things for the main :py:func:`takeSnapshot` method. This will check
that no other snapshots are running at the same time, there is nothing
prohibing a new snapshot (e.g. on ba... | [
"def",
"backup",
"(",
"self",
",",
"force",
"=",
"False",
")",
":",
"ret_val",
",",
"ret_error",
"=",
"False",
",",
"True",
"sleep",
"=",
"True",
"self",
".",
"config",
".",
"PLUGIN_MANAGER",
".",
"load",
"(",
"self",
")",
"if",
"not",
"self",
".",
... | https://github.com/bit-team/backintime/blob/e1ae23ddc0b4229053e3e9c6c61adcb7f3d8e9b3/common/snapshots.py#L585-L748 | |
USEPA/WNTR | 2f92bab5736da6ef3591fc4b0229ec1ac6cd6fcc | wntr/network/base.py | python | Link.name | (self) | return self._link_name | str: The link name (read-only) | str: The link name (read-only) | [
"str",
":",
"The",
"link",
"name",
"(",
"read",
"-",
"only",
")"
] | def name(self):
"""str: The link name (read-only)"""
return self._link_name | [
"def",
"name",
"(",
"self",
")",
":",
"return",
"self",
".",
"_link_name"
] | https://github.com/USEPA/WNTR/blob/2f92bab5736da6ef3591fc4b0229ec1ac6cd6fcc/wntr/network/base.py#L472-L474 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.