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 |
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
jliljebl/flowblade | 995313a509b80e99eb1ad550d945bdda5995093b | flowblade-trunk/Flowblade/edit.py | python | _container_clip_full_render_replace_redo | (self) | [] | def _container_clip_full_render_replace_redo(self):
_remove_clip(self.track, self.index)
_insert_clip(self.track, self.new_clip, self.index, self.old_clip.clip_in, self.old_clip.clip_out)
if self.new_clip.container_data == None:
self.new_clip.container_data = copy.deepcopy(self.old_clip.container_d... | [
"def",
"_container_clip_full_render_replace_redo",
"(",
"self",
")",
":",
"_remove_clip",
"(",
"self",
".",
"track",
",",
"self",
".",
"index",
")",
"_insert_clip",
"(",
"self",
".",
"track",
",",
"self",
".",
"new_clip",
",",
"self",
".",
"index",
",",
"s... | https://github.com/jliljebl/flowblade/blob/995313a509b80e99eb1ad550d945bdda5995093b/flowblade-trunk/Flowblade/edit.py#L2907-L2924 | ||||
n1nj4sec/pupy | a5d766ea81fdfe3bc2c38c9bdaf10e9b75af3b39 | pupy/packages/windows/all/pupwinutils/security.py | python | get_thread_token | () | return hToken | [] | def get_thread_token():
hThread = GetCurrentThread()
hToken = HANDLE(INVALID_HANDLE_VALUE)
dwError = None
if not OpenThreadToken(hThread, tokenprivs, False, byref(hToken)):
dwError = get_last_error()
CloseHandle(hThread)
if dwError:
if dwError == ERROR_NO_TOKEN:
re... | [
"def",
"get_thread_token",
"(",
")",
":",
"hThread",
"=",
"GetCurrentThread",
"(",
")",
"hToken",
"=",
"HANDLE",
"(",
"INVALID_HANDLE_VALUE",
")",
"dwError",
"=",
"None",
"if",
"not",
"OpenThreadToken",
"(",
"hThread",
",",
"tokenprivs",
",",
"False",
",",
"... | https://github.com/n1nj4sec/pupy/blob/a5d766ea81fdfe3bc2c38c9bdaf10e9b75af3b39/pupy/packages/windows/all/pupwinutils/security.py#L1561-L1576 | |||
DLR-RM/stable-baselines3 | e9a8979022d7005560d43b7a9c1dc1ba85f7989a | stable_baselines3/common/results_plotter.py | python | plot_results | (
dirs: List[str], num_timesteps: Optional[int], x_axis: str, task_name: str, figsize: Tuple[int, int] = (8, 2)
) | Plot the results using csv files from ``Monitor`` wrapper.
:param dirs: the save location of the results to plot
:param num_timesteps: only plot the points below this value
:param x_axis: the axis for the x and y output
(can be X_TIMESTEPS='timesteps', X_EPISODES='episodes' or X_WALLTIME='walltime_... | Plot the results using csv files from ``Monitor`` wrapper. | [
"Plot",
"the",
"results",
"using",
"csv",
"files",
"from",
"Monitor",
"wrapper",
"."
] | def plot_results(
dirs: List[str], num_timesteps: Optional[int], x_axis: str, task_name: str, figsize: Tuple[int, int] = (8, 2)
) -> None:
"""
Plot the results using csv files from ``Monitor`` wrapper.
:param dirs: the save location of the results to plot
:param num_timesteps: only plot the points ... | [
"def",
"plot_results",
"(",
"dirs",
":",
"List",
"[",
"str",
"]",
",",
"num_timesteps",
":",
"Optional",
"[",
"int",
"]",
",",
"x_axis",
":",
"str",
",",
"task_name",
":",
"str",
",",
"figsize",
":",
"Tuple",
"[",
"int",
",",
"int",
"]",
"=",
"(",
... | https://github.com/DLR-RM/stable-baselines3/blob/e9a8979022d7005560d43b7a9c1dc1ba85f7989a/stable_baselines3/common/results_plotter.py#L101-L122 | ||
gaubert/gmvault | 61a3f633a352503a395b7f5a0d9cf5fc9e0ac9b4 | src/gmv/gmvault_utils.py | python | UTC.utcoffset | (self, a_dt) | return ZERO | return utcoffset | return utcoffset | [
"return",
"utcoffset"
] | def utcoffset(self, a_dt): #pylint: disable=W0613
''' return utcoffset '''
return ZERO | [
"def",
"utcoffset",
"(",
"self",
",",
"a_dt",
")",
":",
"#pylint: disable=W0613",
"return",
"ZERO"
] | https://github.com/gaubert/gmvault/blob/61a3f633a352503a395b7f5a0d9cf5fc9e0ac9b4/src/gmv/gmvault_utils.py#L232-L234 | |
chribsen/simple-machine-learning-examples | dc94e52a4cebdc8bb959ff88b81ff8cfeca25022 | venv/lib/python2.7/site-packages/pip/req/req_uninstall.py | python | UninstallPathSet.compact | (self, paths) | return short_paths | Compact a path set to contain the minimal number of paths
necessary to contain all paths in the set. If /a/path/ and
/a/path/to/a/file.txt are both in the set, leave only the
shorter path. | Compact a path set to contain the minimal number of paths
necessary to contain all paths in the set. If /a/path/ and
/a/path/to/a/file.txt are both in the set, leave only the
shorter path. | [
"Compact",
"a",
"path",
"set",
"to",
"contain",
"the",
"minimal",
"number",
"of",
"paths",
"necessary",
"to",
"contain",
"all",
"paths",
"in",
"the",
"set",
".",
"If",
"/",
"a",
"/",
"path",
"/",
"and",
"/",
"a",
"/",
"path",
"/",
"to",
"/",
"a",
... | def compact(self, paths):
"""Compact a path set to contain the minimal number of paths
necessary to contain all paths in the set. If /a/path/ and
/a/path/to/a/file.txt are both in the set, leave only the
shorter path."""
short_paths = set()
for path in sorted(paths, key=l... | [
"def",
"compact",
"(",
"self",
",",
"paths",
")",
":",
"short_paths",
"=",
"set",
"(",
")",
"for",
"path",
"in",
"sorted",
"(",
"paths",
",",
"key",
"=",
"len",
")",
":",
"if",
"not",
"any",
"(",
"[",
"(",
"path",
".",
"startswith",
"(",
"shortpa... | https://github.com/chribsen/simple-machine-learning-examples/blob/dc94e52a4cebdc8bb959ff88b81ff8cfeca25022/venv/lib/python2.7/site-packages/pip/req/req_uninstall.py#L63-L75 | |
golismero/golismero | 7d605b937e241f51c1ca4f47b20f755eeefb9d76 | thirdparty_libs/nltk/grammar.py | python | FeatureGrammar._get_type_if_possible | (self, item) | Helper function which returns the ``TYPE`` feature of the ``item``,
if it exists, otherwise it returns the ``item`` itself | Helper function which returns the ``TYPE`` feature of the ``item``,
if it exists, otherwise it returns the ``item`` itself | [
"Helper",
"function",
"which",
"returns",
"the",
"TYPE",
"feature",
"of",
"the",
"item",
"if",
"it",
"exists",
"otherwise",
"it",
"returns",
"the",
"item",
"itself"
] | def _get_type_if_possible(self, item):
"""
Helper function which returns the ``TYPE`` feature of the ``item``,
if it exists, otherwise it returns the ``item`` itself
"""
if isinstance(item, dict) and TYPE in item:
return FeatureValueType(item[TYPE])
else:
... | [
"def",
"_get_type_if_possible",
"(",
"self",
",",
"item",
")",
":",
"if",
"isinstance",
"(",
"item",
",",
"dict",
")",
"and",
"TYPE",
"in",
"item",
":",
"return",
"FeatureValueType",
"(",
"item",
"[",
"TYPE",
"]",
")",
"else",
":",
"return",
"item"
] | https://github.com/golismero/golismero/blob/7d605b937e241f51c1ca4f47b20f755eeefb9d76/thirdparty_libs/nltk/grammar.py#L808-L816 | ||
guildai/guildai | 1665985a3d4d788efc1a3180ca51cc417f71ca78 | guild/external/pip/_vendor/urllib3/contrib/pyopenssl.py | python | get_subj_alt_name | (peer_cert) | return names | Given an PyOpenSSL certificate, provides all the subject alternative names. | Given an PyOpenSSL certificate, provides all the subject alternative names. | [
"Given",
"an",
"PyOpenSSL",
"certificate",
"provides",
"all",
"the",
"subject",
"alternative",
"names",
"."
] | def get_subj_alt_name(peer_cert):
"""
Given an PyOpenSSL certificate, provides all the subject alternative names.
"""
# Pass the cert to cryptography, which has much better APIs for this.
if hasattr(peer_cert, "to_cryptography"):
cert = peer_cert.to_cryptography()
else:
# This is... | [
"def",
"get_subj_alt_name",
"(",
"peer_cert",
")",
":",
"# Pass the cert to cryptography, which has much better APIs for this.",
"if",
"hasattr",
"(",
"peer_cert",
",",
"\"to_cryptography\"",
")",
":",
"cert",
"=",
"peer_cert",
".",
"to_cryptography",
"(",
")",
"else",
... | https://github.com/guildai/guildai/blob/1665985a3d4d788efc1a3180ca51cc417f71ca78/guild/external/pip/_vendor/urllib3/contrib/pyopenssl.py#L187-L235 | |
PyHDI/Pyverilog | 2a42539bebd1b4587ee577d491ff002d0cc7295d | pyverilog/vparser/parser.py | python | VerilogParser.p_paramlist_empty | (self, p) | paramlist : empty | paramlist : empty | [
"paramlist",
":",
"empty"
] | def p_paramlist_empty(self, p):
'paramlist : empty'
p[0] = Paramlist(params=()) | [
"def",
"p_paramlist_empty",
"(",
"self",
",",
"p",
")",
":",
"p",
"[",
"0",
"]",
"=",
"Paramlist",
"(",
"params",
"=",
"(",
")",
")"
] | https://github.com/PyHDI/Pyverilog/blob/2a42539bebd1b4587ee577d491ff002d0cc7295d/pyverilog/vparser/parser.py#L148-L150 | ||
TencentCloud/tencentcloud-sdk-python | 3677fd1cdc8c5fd626ce001c13fd3b59d1f279d2 | tencentcloud/captcha/v20190722/models.py | python | TicketThroughUnit.__init__ | (self) | r"""
:param DateKey: 时间
:type DateKey: str
:param Through: 票据验证的通过量
:type Through: int | r"""
:param DateKey: 时间
:type DateKey: str
:param Through: 票据验证的通过量
:type Through: int | [
"r",
":",
"param",
"DateKey",
":",
"时间",
":",
"type",
"DateKey",
":",
"str",
":",
"param",
"Through",
":",
"票据验证的通过量",
":",
"type",
"Through",
":",
"int"
] | def __init__(self):
r"""
:param DateKey: 时间
:type DateKey: str
:param Through: 票据验证的通过量
:type Through: int
"""
self.DateKey = None
self.Through = None | [
"def",
"__init__",
"(",
"self",
")",
":",
"self",
".",
"DateKey",
"=",
"None",
"self",
".",
"Through",
"=",
"None"
] | https://github.com/TencentCloud/tencentcloud-sdk-python/blob/3677fd1cdc8c5fd626ce001c13fd3b59d1f279d2/tencentcloud/captcha/v20190722/models.py#L1435-L1443 | ||
bruderstein/PythonScript | df9f7071ddf3a079e3a301b9b53a6dc78cf1208f | PythonLib/full/configparser.py | python | RawConfigParser.get | (self, section, option, *, raw=False, vars=None, fallback=_UNSET) | Get an option value for a given section.
If `vars' is provided, it must be a dictionary. The option is looked up
in `vars' (if provided), `section', and in `DEFAULTSECT' in that order.
If the key is not found and `fallback' is provided, it is used as
a fallback value. `None' can be prov... | Get an option value for a given section. | [
"Get",
"an",
"option",
"value",
"for",
"a",
"given",
"section",
"."
] | def get(self, section, option, *, raw=False, vars=None, fallback=_UNSET):
"""Get an option value for a given section.
If `vars' is provided, it must be a dictionary. The option is looked up
in `vars' (if provided), `section', and in `DEFAULTSECT' in that order.
If the key is not found a... | [
"def",
"get",
"(",
"self",
",",
"section",
",",
"option",
",",
"*",
",",
"raw",
"=",
"False",
",",
"vars",
"=",
"None",
",",
"fallback",
"=",
"_UNSET",
")",
":",
"try",
":",
"d",
"=",
"self",
".",
"_unify_values",
"(",
"section",
",",
"vars",
")"... | https://github.com/bruderstein/PythonScript/blob/df9f7071ddf3a079e3a301b9b53a6dc78cf1208f/PythonLib/full/configparser.py#L766-L801 | ||
python-discord/site | 899c304730598812a41be68a037c723d815e95e1 | pydis_site/apps/api/viewsets/bot/user.py | python | UserListPagination.get_previous_page_number | (self) | return page_number | Get the previous page number. | Get the previous page number. | [
"Get",
"the",
"previous",
"page",
"number",
"."
] | def get_previous_page_number(self) -> typing.Optional[int]:
"""Get the previous page number."""
if not self.page.has_previous():
return None
page_number = self.page.previous_page_number()
return page_number | [
"def",
"get_previous_page_number",
"(",
"self",
")",
"->",
"typing",
".",
"Optional",
"[",
"int",
"]",
":",
"if",
"not",
"self",
".",
"page",
".",
"has_previous",
"(",
")",
":",
"return",
"None",
"page_number",
"=",
"self",
".",
"page",
".",
"previous_pa... | https://github.com/python-discord/site/blob/899c304730598812a41be68a037c723d815e95e1/pydis_site/apps/api/viewsets/bot/user.py#L32-L38 | |
researchmm/tasn | 5dba8ccc096cedc63913730eeea14a9647911129 | tasn-mxnet/3rdparty/tvm/python/tvm/relay/op/tensor.py | python | less | (lhs, rhs) | return _make.less(lhs, rhs) | Broadcasted elementwise test for (lhs < rhs).
Parameters
----------
lhs : relay.Expr
The left hand side input data
rhs : relay.Expr
The right hand side input data
Returns
-------
result : relay.Expr
The computed result. | Broadcasted elementwise test for (lhs < rhs). | [
"Broadcasted",
"elementwise",
"test",
"for",
"(",
"lhs",
"<",
"rhs",
")",
"."
] | def less(lhs, rhs):
"""Broadcasted elementwise test for (lhs < rhs).
Parameters
----------
lhs : relay.Expr
The left hand side input data
rhs : relay.Expr
The right hand side input data
Returns
-------
result : relay.Expr
The computed result.
"""
return ... | [
"def",
"less",
"(",
"lhs",
",",
"rhs",
")",
":",
"return",
"_make",
".",
"less",
"(",
"lhs",
",",
"rhs",
")"
] | https://github.com/researchmm/tasn/blob/5dba8ccc096cedc63913730eeea14a9647911129/tasn-mxnet/3rdparty/tvm/python/tvm/relay/op/tensor.py#L343-L358 | |
securesystemslab/zippy | ff0e84ac99442c2c55fe1d285332cfd4e185e089 | zippy/lib-python/3/decimal.py | python | Context.copy_abs | (self, a) | return a.copy_abs() | Returns a copy of the operand with the sign set to 0.
>>> ExtendedContext.copy_abs(Decimal('2.1'))
Decimal('2.1')
>>> ExtendedContext.copy_abs(Decimal('-100'))
Decimal('100')
>>> ExtendedContext.copy_abs(-1)
Decimal('1') | Returns a copy of the operand with the sign set to 0. | [
"Returns",
"a",
"copy",
"of",
"the",
"operand",
"with",
"the",
"sign",
"set",
"to",
"0",
"."
] | def copy_abs(self, a):
"""Returns a copy of the operand with the sign set to 0.
>>> ExtendedContext.copy_abs(Decimal('2.1'))
Decimal('2.1')
>>> ExtendedContext.copy_abs(Decimal('-100'))
Decimal('100')
>>> ExtendedContext.copy_abs(-1)
Decimal('1')
"""
... | [
"def",
"copy_abs",
"(",
"self",
",",
"a",
")",
":",
"a",
"=",
"_convert_other",
"(",
"a",
",",
"raiseit",
"=",
"True",
")",
"return",
"a",
".",
"copy_abs",
"(",
")"
] | https://github.com/securesystemslab/zippy/blob/ff0e84ac99442c2c55fe1d285332cfd4e185e089/zippy/lib-python/3/decimal.py#L4175-L4186 | |
datawire/forge | d501be4571dcef5691804c7db7008ee877933c8d | forge/schema.py | python | Sequence.name | (self) | return "sequence[%s]" % self.type.name | [] | def name(self):
return "sequence[%s]" % self.type.name | [
"def",
"name",
"(",
"self",
")",
":",
"return",
"\"sequence[%s]\"",
"%",
"self",
".",
"type",
".",
"name"
] | https://github.com/datawire/forge/blob/d501be4571dcef5691804c7db7008ee877933c8d/forge/schema.py#L397-L398 | |||
rembo10/headphones | b3199605be1ebc83a7a8feab6b1e99b64014187c | lib/configobj.py | python | ConfigObj._decode | (self, infile, encoding) | return infile | Decode infile to unicode. Using the specified encoding.
if is a string, it also needs converting to a list. | Decode infile to unicode. Using the specified encoding. | [
"Decode",
"infile",
"to",
"unicode",
".",
"Using",
"the",
"specified",
"encoding",
"."
] | def _decode(self, infile, encoding):
"""
Decode infile to unicode. Using the specified encoding.
if is a string, it also needs converting to a list.
"""
if isinstance(infile, basestring):
# can't be unicode
# NOTE: Could raise a ``UnicodeDecodeError``
... | [
"def",
"_decode",
"(",
"self",
",",
"infile",
",",
"encoding",
")",
":",
"if",
"isinstance",
"(",
"infile",
",",
"basestring",
")",
":",
"# can't be unicode",
"# NOTE: Could raise a ``UnicodeDecodeError``",
"return",
"infile",
".",
"decode",
"(",
"encoding",
")",
... | https://github.com/rembo10/headphones/blob/b3199605be1ebc83a7a8feab6b1e99b64014187c/lib/configobj.py#L1494-L1510 | |
inconvergent/svgsort | de54f1973d87009c37ff9755ebd5ee880f08e3f4 | svgsort/svgpathtools/path.py | python | Path.cropped | (self, T0, T1) | return new_path | returns a cropped copy of the path. | returns a cropped copy of the path. | [
"returns",
"a",
"cropped",
"copy",
"of",
"the",
"path",
"."
] | def cropped(self, T0, T1):
"""returns a cropped copy of the path."""
assert 0 <= T0 <= 1 and 0 <= T1<= 1
assert T0 != T1
assert not (T0 == 1 and T1 == 0)
if T0 == 1 and 0 < T1 < 1 and self.isclosed():
return self.cropped(0, T1)
if T1 == 1:
seg1 = self[-1]
t_seg1 = 1
i1 ... | [
"def",
"cropped",
"(",
"self",
",",
"T0",
",",
"T1",
")",
":",
"assert",
"0",
"<=",
"T0",
"<=",
"1",
"and",
"0",
"<=",
"T1",
"<=",
"1",
"assert",
"T0",
"!=",
"T1",
"assert",
"not",
"(",
"T0",
"==",
"1",
"and",
"T1",
"==",
"0",
")",
"if",
"T... | https://github.com/inconvergent/svgsort/blob/de54f1973d87009c37ff9755ebd5ee880f08e3f4/svgsort/svgpathtools/path.py#L2547-L2606 | |
openshift/openshift-tools | 1188778e728a6e4781acf728123e5b356380fe6f | openshift/installer/vendored/openshift-ansible-3.9.40/roles/openshift_health_checker/library/ocutil.py | python | main | () | Module that executes commands on a remote OpenShift cluster | Module that executes commands on a remote OpenShift cluster | [
"Module",
"that",
"executes",
"commands",
"on",
"a",
"remote",
"OpenShift",
"cluster"
] | def main():
"""Module that executes commands on a remote OpenShift cluster"""
module = AnsibleModule(
argument_spec=dict(
namespace=dict(type="str", required=False),
config_file=dict(type="str", required=True),
cmd=dict(type="str", required=True),
extra_a... | [
"def",
"main",
"(",
")",
":",
"module",
"=",
"AnsibleModule",
"(",
"argument_spec",
"=",
"dict",
"(",
"namespace",
"=",
"dict",
"(",
"type",
"=",
"\"str\"",
",",
"required",
"=",
"False",
")",
",",
"config_file",
"=",
"dict",
"(",
"type",
"=",
"\"str\"... | https://github.com/openshift/openshift-tools/blob/1188778e728a6e4781acf728123e5b356380fe6f/openshift/installer/vendored/openshift-ansible-3.9.40/roles/openshift_health_checker/library/ocutil.py#L38-L69 | ||
astropy/astroquery | 11c9c83fa8e5f948822f8f73c854ec4b72043016 | astroquery/utils/mocks.py | python | MockResponse.__init__ | (self, content=None, url=None, headers={}, content_type=None,
stream=False, auth=None, status_code=200, verify=True,
allow_redirects=True, json=None) | [] | def __init__(self, content=None, url=None, headers={}, content_type=None,
stream=False, auth=None, status_code=200, verify=True,
allow_redirects=True, json=None):
assert content is None or hasattr(content, 'decode')
self.content = content
self.raw = content
... | [
"def",
"__init__",
"(",
"self",
",",
"content",
"=",
"None",
",",
"url",
"=",
"None",
",",
"headers",
"=",
"{",
"}",
",",
"content_type",
"=",
"None",
",",
"stream",
"=",
"False",
",",
"auth",
"=",
"None",
",",
"status_code",
"=",
"200",
",",
"veri... | https://github.com/astropy/astroquery/blob/11c9c83fa8e5f948822f8f73c854ec4b72043016/astroquery/utils/mocks.py#L15-L26 | ||||
google/clusterfuzz | f358af24f414daa17a3649b143e71ea71871ef59 | src/clusterfuzz/_internal/bot/untrusted_runner/tasks_host.py | python | process_testcase | (engine_name, tool_name, target_name, arguments,
testcase_path, output_path, timeout) | return engine.ReproduceResult(
list(response.command), response.return_code, response.time_executed,
response.output) | Process testcase on untrusted worker. | Process testcase on untrusted worker. | [
"Process",
"testcase",
"on",
"untrusted",
"worker",
"."
] | def process_testcase(engine_name, tool_name, target_name, arguments,
testcase_path, output_path, timeout):
"""Process testcase on untrusted worker."""
if tool_name == 'minimize':
operation = untrusted_runner_pb2.ProcessTestcaseRequest.MINIMIZE
else:
operation = untrusted_runner_pb2.Pr... | [
"def",
"process_testcase",
"(",
"engine_name",
",",
"tool_name",
",",
"target_name",
",",
"arguments",
",",
"testcase_path",
",",
"output_path",
",",
"timeout",
")",
":",
"if",
"tool_name",
"==",
"'minimize'",
":",
"operation",
"=",
"untrusted_runner_pb2",
".",
... | https://github.com/google/clusterfuzz/blob/f358af24f414daa17a3649b143e71ea71871ef59/src/clusterfuzz/_internal/bot/untrusted_runner/tasks_host.py#L109-L136 | |
sagemath/sage | f9b2db94f675ff16963ccdefba4f1a3393b3fe0d | src/sage/combinat/sloane_functions.py | python | A000120._repr_ | (self) | return "1's-counting sequence: number of 1's in binary expansion of n." | EXAMPLES::
sage: sloane.A000120._repr_()
"1's-counting sequence: number of 1's in binary expansion of n." | EXAMPLES:: | [
"EXAMPLES",
"::"
] | def _repr_(self):
"""
EXAMPLES::
sage: sloane.A000120._repr_()
"1's-counting sequence: number of 1's in binary expansion of n."
"""
return "1's-counting sequence: number of 1's in binary expansion of n." | [
"def",
"_repr_",
"(",
"self",
")",
":",
"return",
"\"1's-counting sequence: number of 1's in binary expansion of n.\""
] | https://github.com/sagemath/sage/blob/f9b2db94f675ff16963ccdefba4f1a3393b3fe0d/src/sage/combinat/sloane_functions.py#L1972-L1979 | |
replit-archive/empythoned | 977ec10ced29a3541a4973dc2b59910805695752 | cpython/Lib/lib-tk/turtle.py | python | TurtleScreen.listen | (self, xdummy=None, ydummy=None) | Set focus on TurtleScreen (in order to collect key-events)
No arguments.
Dummy arguments are provided in order
to be able to pass listen to the onclick method.
Example (for a TurtleScreen instance named screen):
>>> screen.listen() | Set focus on TurtleScreen (in order to collect key-events) | [
"Set",
"focus",
"on",
"TurtleScreen",
"(",
"in",
"order",
"to",
"collect",
"key",
"-",
"events",
")"
] | def listen(self, xdummy=None, ydummy=None):
"""Set focus on TurtleScreen (in order to collect key-events)
No arguments.
Dummy arguments are provided in order
to be able to pass listen to the onclick method.
Example (for a TurtleScreen instance named screen):
>>> screen.... | [
"def",
"listen",
"(",
"self",
",",
"xdummy",
"=",
"None",
",",
"ydummy",
"=",
"None",
")",
":",
"self",
".",
"_listen",
"(",
")"
] | https://github.com/replit-archive/empythoned/blob/977ec10ced29a3541a4973dc2b59910805695752/cpython/Lib/lib-tk/turtle.py#L1349-L1359 | ||
leancloud/satori | 701caccbd4fe45765001ca60435c0cb499477c03 | satori-rules/plugin/libs/urllib3/connectionpool.py | python | HTTPConnectionPool._prepare_proxy | (self, conn) | [] | def _prepare_proxy(self, conn):
# Nothing to do for HTTP connections.
pass | [
"def",
"_prepare_proxy",
"(",
"self",
",",
"conn",
")",
":",
"# Nothing to do for HTTP connections.",
"pass"
] | https://github.com/leancloud/satori/blob/701caccbd4fe45765001ca60435c0cb499477c03/satori-rules/plugin/libs/urllib3/connectionpool.py#L287-L289 | ||||
mesalock-linux/mesapy | ed546d59a21b36feb93e2309d5c6b75aa0ad95c9 | pypy/module/cpyext/stubs.py | python | PyUnicode_RichCompare | (space, left, right, op) | Rich compare two unicode strings and return one of the following:
NULL in case an exception was raised
Py_True or Py_False for successful comparisons
Py_NotImplemented in case the type combination is unknown
Note that Py_EQ and Py_NE comparisons can cause a
UnicodeWarning in case the conversion ... | Rich compare two unicode strings and return one of the following: | [
"Rich",
"compare",
"two",
"unicode",
"strings",
"and",
"return",
"one",
"of",
"the",
"following",
":"
] | def PyUnicode_RichCompare(space, left, right, op):
"""Rich compare two unicode strings and return one of the following:
NULL in case an exception was raised
Py_True or Py_False for successful comparisons
Py_NotImplemented in case the type combination is unknown
Note that Py_EQ and Py_NE comparis... | [
"def",
"PyUnicode_RichCompare",
"(",
"space",
",",
"left",
",",
"right",
",",
"op",
")",
":",
"raise",
"NotImplementedError"
] | https://github.com/mesalock-linux/mesapy/blob/ed546d59a21b36feb93e2309d5c6b75aa0ad95c9/pypy/module/cpyext/stubs.py#L1736-L1751 | ||
SforAiDl/Neural-Voice-Cloning-With-Few-Samples | 33fb609427657c9492f46507184ecba4dcc272b0 | speaker_adaptatation-libri.py | python | masked_mean | (y, mask) | return (y * mask_).sum() / mask_.sum() | [] | def masked_mean(y, mask):
# (B, T, D)
mask_ = mask.expand_as(y)
return (y * mask_).sum() / mask_.sum() | [
"def",
"masked_mean",
"(",
"y",
",",
"mask",
")",
":",
"# (B, T, D)",
"mask_",
"=",
"mask",
".",
"expand_as",
"(",
"y",
")",
"return",
"(",
"y",
"*",
"mask_",
")",
".",
"sum",
"(",
")",
"/",
"mask_",
".",
"sum",
"(",
")"
] | https://github.com/SforAiDl/Neural-Voice-Cloning-With-Few-Samples/blob/33fb609427657c9492f46507184ecba4dcc272b0/speaker_adaptatation-libri.py#L532-L535 | |||
svip-lab/impersonator | b041dd415157c1e7f5b46e579a1ad4dffabb2e66 | thirdparty/his_evaluators/his_evaluators/metrics/bodynets/batch_smpl.py | python | SMPL.skinning | (self, theta, offsets=0) | return detail_info | Args:
theta: (N, 3 + 72 + 10)
offsets (torch.tensor) : (N, nv, 3) or 0
Returns: | Args:
theta: (N, 3 + 72 + 10)
offsets (torch.tensor) : (N, nv, 3) or 0
Returns: | [
"Args",
":",
"theta",
":",
"(",
"N",
"3",
"+",
"72",
"+",
"10",
")",
"offsets",
"(",
"torch",
".",
"tensor",
")",
":",
"(",
"N",
"nv",
"3",
")",
"or",
"0",
"Returns",
":"
] | def skinning(self, theta, offsets=0) -> dict:
"""
Args:
theta: (N, 3 + 72 + 10)
offsets (torch.tensor) : (N, nv, 3) or 0
Returns:
"""
cam = theta[:, 0:3]
pose = theta[:, 3:-10].contiguous()
shape = theta[:, -10:].contiguous()
vert... | [
"def",
"skinning",
"(",
"self",
",",
"theta",
",",
"offsets",
"=",
"0",
")",
"->",
"dict",
":",
"cam",
"=",
"theta",
"[",
":",
",",
"0",
":",
"3",
"]",
"pose",
"=",
"theta",
"[",
":",
",",
"3",
":",
"-",
"10",
"]",
".",
"contiguous",
"(",
"... | https://github.com/svip-lab/impersonator/blob/b041dd415157c1e7f5b46e579a1ad4dffabb2e66/thirdparty/his_evaluators/his_evaluators/metrics/bodynets/batch_smpl.py#L424-L446 | |
googleapis/python-dialogflow | e48ea001b7c8a4a5c1fe4b162bad49ea397458e9 | google/cloud/dialogflow_v2/services/intents/async_client.py | python | IntentsAsyncClient.batch_update_intents | (
self,
request: Union[intent.BatchUpdateIntentsRequest, dict] = None,
*,
parent: str = None,
intent_batch_uri: str = None,
intent_batch_inline: intent.IntentBatch = None,
retry: OptionalRetry = gapic_v1.method.DEFAULT,
timeout: float = None,
metad... | return response | r"""Updates/Creates multiple intents in the specified agent.
This method is a `long-running
operation <https://cloud.google.com/dialogflow/es/docs/how/long-running-operations>`__.
The returned ``Operation`` type has the following
method-specific fields:
- ``metadata``: An empt... | r"""Updates/Creates multiple intents in the specified agent. | [
"r",
"Updates",
"/",
"Creates",
"multiple",
"intents",
"in",
"the",
"specified",
"agent",
"."
] | async def batch_update_intents(
self,
request: Union[intent.BatchUpdateIntentsRequest, dict] = None,
*,
parent: str = None,
intent_batch_uri: str = None,
intent_batch_inline: intent.IntentBatch = None,
retry: OptionalRetry = gapic_v1.method.DEFAULT,
timeou... | [
"async",
"def",
"batch_update_intents",
"(",
"self",
",",
"request",
":",
"Union",
"[",
"intent",
".",
"BatchUpdateIntentsRequest",
",",
"dict",
"]",
"=",
"None",
",",
"*",
",",
"parent",
":",
"str",
"=",
"None",
",",
"intent_batch_uri",
":",
"str",
"=",
... | https://github.com/googleapis/python-dialogflow/blob/e48ea001b7c8a4a5c1fe4b162bad49ea397458e9/google/cloud/dialogflow_v2/services/intents/async_client.py#L649-L767 | |
googleanalytics/google-analytics-super-proxy | f5bad82eb1375d222638423e6ae302173a9a7948 | src/controllers/util/request_timestamp_shard.py | python | IncreaseShards | (name, num_shards) | Increase the number of shards for a given sharded counter.
Will never decrease the number of shards.
Args:
name: The name of the counter.
num_shards: How many shards to use. | Increase the number of shards for a given sharded counter. | [
"Increase",
"the",
"number",
"of",
"shards",
"for",
"a",
"given",
"sharded",
"counter",
"."
] | def IncreaseShards(name, num_shards):
"""Increase the number of shards for a given sharded counter.
Will never decrease the number of shards.
Args:
name: The name of the counter.
num_shards: How many shards to use.
"""
config = GeneralTimestampShardConfig.get_or_insert(name)
if config.num_shards <... | [
"def",
"IncreaseShards",
"(",
"name",
",",
"num_shards",
")",
":",
"config",
"=",
"GeneralTimestampShardConfig",
".",
"get_or_insert",
"(",
"name",
")",
"if",
"config",
".",
"num_shards",
"<",
"num_shards",
":",
"config",
".",
"num_shards",
"=",
"num_shards",
... | https://github.com/googleanalytics/google-analytics-super-proxy/blob/f5bad82eb1375d222638423e6ae302173a9a7948/src/controllers/util/request_timestamp_shard.py#L118-L130 | ||
triaquae/triaquae | bbabf736b3ba56a0c6498e7f04e16c13b8b8f2b9 | TriAquae/models/Centos_6.4/rsa/_version133.py | python | decrypt_int | (cyphertext, dkey, n) | return encrypt_int(cyphertext, dkey, n) | Decrypts a cypher text using the decryption key 'dkey', working
modulo n | Decrypts a cypher text using the decryption key 'dkey', working
modulo n | [
"Decrypts",
"a",
"cypher",
"text",
"using",
"the",
"decryption",
"key",
"dkey",
"working",
"modulo",
"n"
] | def decrypt_int(cyphertext, dkey, n):
"""Decrypts a cypher text using the decryption key 'dkey', working
modulo n"""
return encrypt_int(cyphertext, dkey, n) | [
"def",
"decrypt_int",
"(",
"cyphertext",
",",
"dkey",
",",
"n",
")",
":",
"return",
"encrypt_int",
"(",
"cyphertext",
",",
"dkey",
",",
"n",
")"
] | https://github.com/triaquae/triaquae/blob/bbabf736b3ba56a0c6498e7f04e16c13b8b8f2b9/TriAquae/models/Centos_6.4/rsa/_version133.py#L345-L349 | |
sagemath/sage | f9b2db94f675ff16963ccdefba4f1a3393b3fe0d | src/sage/sets/family.py | python | TrivialFamily.__setstate__ | (self, state) | TESTS::
sage: from sage.sets.family import TrivialFamily
sage: f = TrivialFamily([3,4,7])
sage: f.__setstate__({'_enumeration': (2, 4, 8)})
sage: f
Family (2, 4, 8) | TESTS:: | [
"TESTS",
"::"
] | def __setstate__(self, state):
"""
TESTS::
sage: from sage.sets.family import TrivialFamily
sage: f = TrivialFamily([3,4,7])
sage: f.__setstate__({'_enumeration': (2, 4, 8)})
sage: f
Family (2, 4, 8)
"""
self.__init__(state['_e... | [
"def",
"__setstate__",
"(",
"self",
",",
"state",
")",
":",
"self",
".",
"__init__",
"(",
"state",
"[",
"'_enumeration'",
"]",
")"
] | https://github.com/sagemath/sage/blob/f9b2db94f675ff16963ccdefba4f1a3393b3fe0d/src/sage/sets/family.py#L1329-L1339 | ||
deepgully/me | f7ad65edc2fe435310c6676bc2e322cfe5d4c8f0 | libs/werkzeug/contrib/profiler.py | python | make_action | (app_factory, hostname='localhost', port=5000,
threaded=False, processes=1, stream=None,
sort_by=('time', 'calls'), restrictions=()) | return action | Return a new callback for :mod:`werkzeug.script` that starts a local
server with the profiler enabled.
::
from werkzeug.contrib import profiler
action_profile = profiler.make_action(make_app) | Return a new callback for :mod:`werkzeug.script` that starts a local
server with the profiler enabled. | [
"Return",
"a",
"new",
"callback",
"for",
":",
"mod",
":",
"werkzeug",
".",
"script",
"that",
"starts",
"a",
"local",
"server",
"with",
"the",
"profiler",
"enabled",
"."
] | def make_action(app_factory, hostname='localhost', port=5000,
threaded=False, processes=1, stream=None,
sort_by=('time', 'calls'), restrictions=()):
"""Return a new callback for :mod:`werkzeug.script` that starts a local
server with the profiler enabled.
::
from wer... | [
"def",
"make_action",
"(",
"app_factory",
",",
"hostname",
"=",
"'localhost'",
",",
"port",
"=",
"5000",
",",
"threaded",
"=",
"False",
",",
"processes",
"=",
"1",
",",
"stream",
"=",
"None",
",",
"sort_by",
"=",
"(",
"'time'",
",",
"'calls'",
")",
","... | https://github.com/deepgully/me/blob/f7ad65edc2fe435310c6676bc2e322cfe5d4c8f0/libs/werkzeug/contrib/profiler.py#L101-L118 | |
roclark/sportsipy | c19f545d3376d62ded6304b137dc69238ac620a9 | sportsipy/ncaaf/player.py | python | AbstractPlayer.player_id | (self) | return self._player_id | Returns a ``string`` of the player's ID on sports-reference, such as
'david-blough-1' for David Blough. | Returns a ``string`` of the player's ID on sports-reference, such as
'david-blough-1' for David Blough. | [
"Returns",
"a",
"string",
"of",
"the",
"player",
"s",
"ID",
"on",
"sports",
"-",
"reference",
"such",
"as",
"david",
"-",
"blough",
"-",
"1",
"for",
"David",
"Blough",
"."
] | def player_id(self):
"""
Returns a ``string`` of the player's ID on sports-reference, such as
'david-blough-1' for David Blough.
"""
return self._player_id | [
"def",
"player_id",
"(",
"self",
")",
":",
"return",
"self",
".",
"_player_id"
] | https://github.com/roclark/sportsipy/blob/c19f545d3376d62ded6304b137dc69238ac620a9/sportsipy/ncaaf/player.py#L193-L198 | |
LuxCoreRender/BlendLuxCore | bf31ca58501d54c02acd97001b6db7de81da7cbf | nodes/materials/tree.py | python | LuxCoreMaterialNodeTree.get_from_context | (cls, context) | return None, None, None | Switches the displayed node tree when user selects object/material | Switches the displayed node tree when user selects object/material | [
"Switches",
"the",
"displayed",
"node",
"tree",
"when",
"user",
"selects",
"object",
"/",
"material"
] | def get_from_context(cls, context):
"""
Switches the displayed node tree when user selects object/material
"""
obj = context.active_object
if obj and obj.type not in {"LIGHT", "CAMERA"}:
mat = obj.active_material
if mat:
node_tree = mat.l... | [
"def",
"get_from_context",
"(",
"cls",
",",
"context",
")",
":",
"obj",
"=",
"context",
".",
"active_object",
"if",
"obj",
"and",
"obj",
".",
"type",
"not",
"in",
"{",
"\"LIGHT\"",
",",
"\"CAMERA\"",
"}",
":",
"mat",
"=",
"obj",
".",
"active_material",
... | https://github.com/LuxCoreRender/BlendLuxCore/blob/bf31ca58501d54c02acd97001b6db7de81da7cbf/nodes/materials/tree.py#L15-L30 | |
edfungus/Crouton | ada98b3930192938a48909072b45cb84b945f875 | clients/python_clients/cf_demo_client/cf_env/lib/python2.7/site-packages/setuptools/package_index.py | python | htmldecode | (text) | return entity_sub(decode_entity, text) | Decode HTML entities in the given text. | Decode HTML entities in the given text. | [
"Decode",
"HTML",
"entities",
"in",
"the",
"given",
"text",
"."
] | def htmldecode(text):
"""Decode HTML entities in the given text."""
return entity_sub(decode_entity, text) | [
"def",
"htmldecode",
"(",
"text",
")",
":",
"return",
"entity_sub",
"(",
"decode_entity",
",",
"text",
")"
] | https://github.com/edfungus/Crouton/blob/ada98b3930192938a48909072b45cb84b945f875/clients/python_clients/cf_demo_client/cf_env/lib/python2.7/site-packages/setuptools/package_index.py#L884-L886 | |
Georce/lepus | 5b01bae82b5dc1df00c9e058989e2eb9b89ff333 | lepus/pymongo-2.7/pymongo/mongo_replica_set_client.py | python | MongoReplicaSetClient.max_write_batch_size | (self) | return common.MAX_WRITE_BATCH_SIZE | The maxWriteBatchSize reported by the server.
Returns a default value when connected to server versions prior to
MongoDB 2.6.
.. versionadded:: 2.7 | The maxWriteBatchSize reported by the server. | [
"The",
"maxWriteBatchSize",
"reported",
"by",
"the",
"server",
"."
] | def max_write_batch_size(self):
"""The maxWriteBatchSize reported by the server.
Returns a default value when connected to server versions prior to
MongoDB 2.6.
.. versionadded:: 2.7
"""
rs_state = self.__rs_state
if rs_state.primary_member:
return r... | [
"def",
"max_write_batch_size",
"(",
"self",
")",
":",
"rs_state",
"=",
"self",
".",
"__rs_state",
"if",
"rs_state",
".",
"primary_member",
":",
"return",
"rs_state",
".",
"primary_member",
".",
"max_write_batch_size",
"return",
"common",
".",
"MAX_WRITE_BATCH_SIZE"
... | https://github.com/Georce/lepus/blob/5b01bae82b5dc1df00c9e058989e2eb9b89ff333/lepus/pymongo-2.7/pymongo/mongo_replica_set_client.py#L990-L1001 | |
shiyanlou/louplus-python | 4c61697259e286e3d9116c3299f170d019ba3767 | taobei/challenge-06/tbweb/handlers/order.py | python | create | () | return render_template('order/create.html', form=form, cart_products=cart_products) | 创建订单 | 创建订单 | [
"创建订单"
] | def create():
"""创建订单
"""
form = OrderForm()
resp = TbUser(current_app).get_json('/addresses', params={
'user_id': current_user.get_id(),
})
addresses = resp['data']['addresses']
form.address_id.choices = [(str(v['id']), v['address']) for v in addresses]
for addresse in address... | [
"def",
"create",
"(",
")",
":",
"form",
"=",
"OrderForm",
"(",
")",
"resp",
"=",
"TbUser",
"(",
"current_app",
")",
".",
"get_json",
"(",
"'/addresses'",
",",
"params",
"=",
"{",
"'user_id'",
":",
"current_user",
".",
"get_id",
"(",
")",
",",
"}",
")... | https://github.com/shiyanlou/louplus-python/blob/4c61697259e286e3d9116c3299f170d019ba3767/taobei/challenge-06/tbweb/handlers/order.py#L72-L147 | |
biopython/biopython | 2dd97e71762af7b046d7f7f8a4f1e38db6b06c86 | Bio/SeqFeature.py | python | WithinPosition.extension | (self) | return self._right - self._left | Legacy attribute to get extension (from left to right) as an integer (OBSOLETE). | Legacy attribute to get extension (from left to right) as an integer (OBSOLETE). | [
"Legacy",
"attribute",
"to",
"get",
"extension",
"(",
"from",
"left",
"to",
"right",
")",
"as",
"an",
"integer",
"(",
"OBSOLETE",
")",
"."
] | def extension(self): # noqa: D402
"""Legacy attribute to get extension (from left to right) as an integer (OBSOLETE).""" # noqa: D402
return self._right - self._left | [
"def",
"extension",
"(",
"self",
")",
":",
"# noqa: D402",
"# noqa: D402",
"return",
"self",
".",
"_right",
"-",
"self",
".",
"_left"
] | https://github.com/biopython/biopython/blob/2dd97e71762af7b046d7f7f8a4f1e38db6b06c86/Bio/SeqFeature.py#L1817-L1819 | |
PokemonGoF/PokemonGo-Bot-Desktop | 4bfa94f0183406c6a86f93645eff7abd3ad4ced8 | build/pywin/Lib/xml/sax/xmlreader.py | python | XMLReader.setFeature | (self, name, state) | Sets the state of a SAX2 feature. | Sets the state of a SAX2 feature. | [
"Sets",
"the",
"state",
"of",
"a",
"SAX2",
"feature",
"."
] | def setFeature(self, name, state):
"Sets the state of a SAX2 feature."
raise SAXNotRecognizedException("Feature '%s' not recognized" % name) | [
"def",
"setFeature",
"(",
"self",
",",
"name",
",",
"state",
")",
":",
"raise",
"SAXNotRecognizedException",
"(",
"\"Feature '%s' not recognized\"",
"%",
"name",
")"
] | https://github.com/PokemonGoF/PokemonGo-Bot-Desktop/blob/4bfa94f0183406c6a86f93645eff7abd3ad4ced8/build/pywin/Lib/xml/sax/xmlreader.py#L79-L81 | ||
ParmEd/ParmEd | cd763f2e83c98ba9e51676f6dbebf0eebfd5157e | parmed/modeller/residue.py | python | ResidueTemplate.to_dataframe | (self) | return ret | Create a pandas dataframe from the atom information
Returns
-------
df : :class:`pandas.DataFrame`
The pandas DataFrame with all of the atomic properties
Notes
-----
The DataFrame will be over all atoms. The columns will be the attributes
of the atom... | Create a pandas dataframe from the atom information | [
"Create",
"a",
"pandas",
"dataframe",
"from",
"the",
"atom",
"information"
] | def to_dataframe(self):
""" Create a pandas dataframe from the atom information
Returns
-------
df : :class:`pandas.DataFrame`
The pandas DataFrame with all of the atomic properties
Notes
-----
The DataFrame will be over all atoms. The columns will b... | [
"def",
"to_dataframe",
"(",
"self",
")",
":",
"import",
"pandas",
"as",
"pd",
"ret",
"=",
"pd",
".",
"DataFrame",
"(",
")",
"ret",
"[",
"'number'",
"]",
"=",
"[",
"atom",
".",
"number",
"for",
"atom",
"in",
"self",
".",
"atoms",
"]",
"ret",
"[",
... | https://github.com/ParmEd/ParmEd/blob/cd763f2e83c98ba9e51676f6dbebf0eebfd5157e/parmed/modeller/residue.py#L569-L659 | |
krintoxi/NoobSec-Toolkit | 38738541cbc03cedb9a3b3ed13b629f781ad64f6 | NoobSecToolkit - MAC OSX/tools/inject/thirdparty/gprof2dot/gprof2dot.py | python | CallgrindParser.parse_part_detail | (self) | return self.parse_keys(self._detail_keys) | [] | def parse_part_detail(self):
return self.parse_keys(self._detail_keys) | [
"def",
"parse_part_detail",
"(",
"self",
")",
":",
"return",
"self",
".",
"parse_keys",
"(",
"self",
".",
"_detail_keys",
")"
] | https://github.com/krintoxi/NoobSec-Toolkit/blob/38738541cbc03cedb9a3b3ed13b629f781ad64f6/NoobSecToolkit - MAC OSX/tools/inject/thirdparty/gprof2dot/gprof2dot.py#L1099-L1100 | |||
hahnyuan/nn_tools | e04903d2946a75b62128b64ada7eec8b9fbd841f | Datasets/lmdb_datasets.py | python | LMDB_generator.generate_dataset | (self,datas,targets,others=None) | return dataset | [] | def generate_dataset(self,datas,targets,others=None):
dataset = pb2.Dataset()
assert len(datas)==len(targets),ValueError('the lengths of datas and targets are not the same')
for idx in xrange(len(datas)):
try:
if others==None:
datum=self.generate_d... | [
"def",
"generate_dataset",
"(",
"self",
",",
"datas",
",",
"targets",
",",
"others",
"=",
"None",
")",
":",
"dataset",
"=",
"pb2",
".",
"Dataset",
"(",
")",
"assert",
"len",
"(",
"datas",
")",
"==",
"len",
"(",
"targets",
")",
",",
"ValueError",
"(",... | https://github.com/hahnyuan/nn_tools/blob/e04903d2946a75b62128b64ada7eec8b9fbd841f/Datasets/lmdb_datasets.py#L32-L45 | |||
enkore/i3pystatus | 34af13547dfb8407d9cf47473b8068e681dcc55f | i3pystatus/core/util.py | python | get_module | (function) | return call_wrapper | Function decorator for retrieving the ``self`` argument from the stack.
Intended for use with callbacks that need access to a modules variables, for example:
.. code:: python
from i3pystatus import Status, get_module
from i3pystatus.core.command import execute
status = Status(...)
... | Function decorator for retrieving the ``self`` argument from the stack. | [
"Function",
"decorator",
"for",
"retrieving",
"the",
"self",
"argument",
"from",
"the",
"stack",
"."
] | def get_module(function):
"""Function decorator for retrieving the ``self`` argument from the stack.
Intended for use with callbacks that need access to a modules variables, for example:
.. code:: python
from i3pystatus import Status, get_module
from i3pystatus.core.command import execute... | [
"def",
"get_module",
"(",
"function",
")",
":",
"@",
"functools",
".",
"wraps",
"(",
"function",
")",
"def",
"call_wrapper",
"(",
"*",
"args",
",",
"*",
"*",
"kwargs",
")",
":",
"stack",
"=",
"inspect",
".",
"stack",
"(",
")",
"caller_frame_info",
"=",... | https://github.com/enkore/i3pystatus/blob/34af13547dfb8407d9cf47473b8068e681dcc55f/i3pystatus/core/util.py#L668-L693 | |
dimagi/commcare-hq | d67ff1d3b4c51fa050c19e60c3253a79d3452a39 | corehq/motech/repeaters/models.py | python | ReferCaseRepeater.get_url | (self, repeat_record) | return self.connection_settings.url.format(domain=new_domain) | [] | def get_url(self, repeat_record):
new_domain = self.payload_doc(repeat_record).get_case_property('new_domain')
return self.connection_settings.url.format(domain=new_domain) | [
"def",
"get_url",
"(",
"self",
",",
"repeat_record",
")",
":",
"new_domain",
"=",
"self",
".",
"payload_doc",
"(",
"repeat_record",
")",
".",
"get_case_property",
"(",
"'new_domain'",
")",
"return",
"self",
".",
"connection_settings",
".",
"url",
".",
"format"... | https://github.com/dimagi/commcare-hq/blob/d67ff1d3b4c51fa050c19e60c3253a79d3452a39/corehq/motech/repeaters/models.py#L724-L726 | |||
shunsukesaito/PIFu | 02a6d8643d3267d06cb4a510b30a59e7e07255de | lib/train_util.py | python | calc_error_color | (opt, netG, netC, cuda, dataset, num_tests) | return np.average(error_color_arr) | [] | def calc_error_color(opt, netG, netC, cuda, dataset, num_tests):
if num_tests > len(dataset):
num_tests = len(dataset)
with torch.no_grad():
error_color_arr = []
for idx in tqdm(range(num_tests)):
data = dataset[idx * len(dataset) // num_tests]
# retrieve the dat... | [
"def",
"calc_error_color",
"(",
"opt",
",",
"netG",
",",
"netC",
",",
"cuda",
",",
"dataset",
",",
"num_tests",
")",
":",
"if",
"num_tests",
">",
"len",
"(",
"dataset",
")",
":",
"num_tests",
"=",
"len",
"(",
"dataset",
")",
"with",
"torch",
".",
"no... | https://github.com/shunsukesaito/PIFu/blob/02a6d8643d3267d06cb4a510b30a59e7e07255de/lib/train_util.py#L178-L203 | |||
securesystemslab/zippy | ff0e84ac99442c2c55fe1d285332cfd4e185e089 | zippy/benchmarks/src/benchmarks/sympy/sympy/polys/agca/modules.py | python | QuotientModule.is_submodule | (self, other) | return False | Return True if ``other`` is a submodule of ``self``.
>>> from sympy.abc import x
>>> from sympy import QQ
>>> Q = QQ.old_poly_ring(x).free_module(2) / [(x, x)]
>>> S = Q.submodule([1, 0])
>>> Q.is_submodule(S)
True
>>> S.is_submodule(Q)
False | Return True if ``other`` is a submodule of ``self``. | [
"Return",
"True",
"if",
"other",
"is",
"a",
"submodule",
"of",
"self",
"."
] | def is_submodule(self, other):
"""
Return True if ``other`` is a submodule of ``self``.
>>> from sympy.abc import x
>>> from sympy import QQ
>>> Q = QQ.old_poly_ring(x).free_module(2) / [(x, x)]
>>> S = Q.submodule([1, 0])
>>> Q.is_submodule(S)
True
... | [
"def",
"is_submodule",
"(",
"self",
",",
"other",
")",
":",
"if",
"isinstance",
"(",
"other",
",",
"QuotientModule",
")",
":",
"return",
"self",
".",
"killed_module",
"==",
"other",
".",
"killed_module",
"and",
"self",
".",
"base",
".",
"is_submodule",
"("... | https://github.com/securesystemslab/zippy/blob/ff0e84ac99442c2c55fe1d285332cfd4e185e089/zippy/benchmarks/src/benchmarks/sympy/sympy/polys/agca/modules.py#L1296-L1314 | |
jayleicn/scipy-lecture-notes-zh-CN | cc87204fcc4bd2f4702f7c29c83cb8ed5c94b7d6 | packages/traits/reservoir_state_property.py | python | ReservoirState._get_storage | (self) | return min(new_storage, self.max_storage) | [] | def _get_storage(self):
new_storage = self._storage - self.release + self.inflows
return min(new_storage, self.max_storage) | [
"def",
"_get_storage",
"(",
"self",
")",
":",
"new_storage",
"=",
"self",
".",
"_storage",
"-",
"self",
".",
"release",
"+",
"self",
".",
"inflows",
"return",
"min",
"(",
"new_storage",
",",
"self",
".",
"max_storage",
")"
] | https://github.com/jayleicn/scipy-lecture-notes-zh-CN/blob/cc87204fcc4bd2f4702f7c29c83cb8ed5c94b7d6/packages/traits/reservoir_state_property.py#L31-L33 | |||
dBeker/Faster-RCNN-TensorFlow-Python3 | 027e5603551b3b9053042a113b4c7be9579dbb4a | demo.py | python | vis_detections | (im, class_name, dets, thresh=0.5) | Draw detected bounding boxes. | Draw detected bounding boxes. | [
"Draw",
"detected",
"bounding",
"boxes",
"."
] | def vis_detections(im, class_name, dets, thresh=0.5):
"""Draw detected bounding boxes."""
inds = np.where(dets[:, -1] >= thresh)[0]
if len(inds) == 0:
return
im = im[:, :, (2, 1, 0)]
fig, ax = plt.subplots(figsize=(12, 12))
ax.imshow(im, aspect='equal')
for i in inds:
bbox =... | [
"def",
"vis_detections",
"(",
"im",
",",
"class_name",
",",
"dets",
",",
"thresh",
"=",
"0.5",
")",
":",
"inds",
"=",
"np",
".",
"where",
"(",
"dets",
"[",
":",
",",
"-",
"1",
"]",
">=",
"thresh",
")",
"[",
"0",
"]",
"if",
"len",
"(",
"inds",
... | https://github.com/dBeker/Faster-RCNN-TensorFlow-Python3/blob/027e5603551b3b9053042a113b4c7be9579dbb4a/demo.py#L43-L73 | ||
spack/spack | 675210bd8bd1c5d32ad1cc83d898fb43b569ed74 | lib/spack/external/altgraph/Graph.py | python | Graph.back_topo_sort | (self) | return self._topo_sort(forward=False) | Reverse topological sort.
Returns a list of nodes where the successors (based on incoming edges)
of any given node appear in the sequence after that node. | Reverse topological sort. | [
"Reverse",
"topological",
"sort",
"."
] | def back_topo_sort(self):
"""
Reverse topological sort.
Returns a list of nodes where the successors (based on incoming edges)
of any given node appear in the sequence after that node.
"""
return self._topo_sort(forward=False) | [
"def",
"back_topo_sort",
"(",
"self",
")",
":",
"return",
"self",
".",
"_topo_sort",
"(",
"forward",
"=",
"False",
")"
] | https://github.com/spack/spack/blob/675210bd8bd1c5d32ad1cc83d898fb43b569ed74/lib/spack/external/altgraph/Graph.py#L433-L440 | |
thu-coai/CrossWOZ | 265e97379b34221f5949beb46f3eec0e2dc943c4 | convlab2/dst/trade/crosswoz/utils/logger.py | python | Logger.__init__ | (self, log_dir) | Create a summary writer logging to log_dir. | Create a summary writer logging to log_dir. | [
"Create",
"a",
"summary",
"writer",
"logging",
"to",
"log_dir",
"."
] | def __init__(self, log_dir):
"""Create a summary writer logging to log_dir."""
self.writer = tf.summary.FileWriter(log_dir) | [
"def",
"__init__",
"(",
"self",
",",
"log_dir",
")",
":",
"self",
".",
"writer",
"=",
"tf",
".",
"summary",
".",
"FileWriter",
"(",
"log_dir",
")"
] | https://github.com/thu-coai/CrossWOZ/blob/265e97379b34221f5949beb46f3eec0e2dc943c4/convlab2/dst/trade/crosswoz/utils/logger.py#L13-L15 | ||
glitchdotcom/WebPutty | 4f5da5eb2b4668cbf3c15cf002feacd1d95d2ef7 | libs/babel/messages/mofile.py | python | write_mo | (fileobj, catalog, use_fuzzy=False) | Write a catalog to the specified file-like object using the GNU MO file
format.
>>> from babel.messages import Catalog
>>> from gettext import GNUTranslations
>>> from StringIO import StringIO
>>> catalog = Catalog(locale='en_US')
>>> catalog.add('foo', 'Voh')
>>> catalog.add((u'ba... | Write a catalog to the specified file-like object using the GNU MO file
format.
>>> from babel.messages import Catalog
>>> from gettext import GNUTranslations
>>> from StringIO import StringIO
>>> catalog = Catalog(locale='en_US')
>>> catalog.add('foo', 'Voh')
>>> catalog.add((u'ba... | [
"Write",
"a",
"catalog",
"to",
"the",
"specified",
"file",
"-",
"like",
"object",
"using",
"the",
"GNU",
"MO",
"file",
"format",
".",
">>>",
"from",
"babel",
".",
"messages",
"import",
"Catalog",
">>>",
"from",
"gettext",
"import",
"GNUTranslations",
">>>",
... | def write_mo(fileobj, catalog, use_fuzzy=False):
"""Write a catalog to the specified file-like object using the GNU MO file
format.
>>> from babel.messages import Catalog
>>> from gettext import GNUTranslations
>>> from StringIO import StringIO
>>> catalog = Catalog(locale='en_US')
... | [
"def",
"write_mo",
"(",
"fileobj",
",",
"catalog",
",",
"use_fuzzy",
"=",
"False",
")",
":",
"messages",
"=",
"list",
"(",
"catalog",
")",
"if",
"not",
"use_fuzzy",
":",
"messages",
"[",
"1",
":",
"]",
"=",
"[",
"m",
"for",
"m",
"in",
"messages",
"... | https://github.com/glitchdotcom/WebPutty/blob/4f5da5eb2b4668cbf3c15cf002feacd1d95d2ef7/libs/babel/messages/mofile.py#L27-L121 | ||
edisonlz/fastor | 342078a18363ac41d3c6b1ab29dbdd44fdb0b7b3 | base/site-packages/django/utils/functional.py | python | allow_lazy | (func, *resultclasses) | return wrapper | A decorator that allows a function to be called with one or more lazy
arguments. If none of the args are lazy, the function is evaluated
immediately, otherwise a __proxy__ is returned that will evaluate the
function when needed. | A decorator that allows a function to be called with one or more lazy
arguments. If none of the args are lazy, the function is evaluated
immediately, otherwise a __proxy__ is returned that will evaluate the
function when needed. | [
"A",
"decorator",
"that",
"allows",
"a",
"function",
"to",
"be",
"called",
"with",
"one",
"or",
"more",
"lazy",
"arguments",
".",
"If",
"none",
"of",
"the",
"args",
"are",
"lazy",
"the",
"function",
"is",
"evaluated",
"immediately",
"otherwise",
"a",
"__pr... | def allow_lazy(func, *resultclasses):
"""
A decorator that allows a function to be called with one or more lazy
arguments. If none of the args are lazy, the function is evaluated
immediately, otherwise a __proxy__ is returned that will evaluate the
function when needed.
"""
@wraps(func)
... | [
"def",
"allow_lazy",
"(",
"func",
",",
"*",
"resultclasses",
")",
":",
"@",
"wraps",
"(",
"func",
")",
"def",
"wrapper",
"(",
"*",
"args",
",",
"*",
"*",
"kwargs",
")",
":",
"for",
"arg",
"in",
"list",
"(",
"args",
")",
"+",
"list",
"(",
"six",
... | https://github.com/edisonlz/fastor/blob/342078a18363ac41d3c6b1ab29dbdd44fdb0b7b3/base/site-packages/django/utils/functional.py#L190-L205 | |
Yuliang-Liu/Box_Discretization_Network | 5b3a30c97429ef8e5c5e1c4e2476c7d9abdc03e6 | maskrcnn_benchmark/modeling/backbone/resnet.py | python | StemWithGN.__init__ | (self, cfg) | [] | def __init__(self, cfg):
super(StemWithGN, self).__init__(cfg, norm_func=group_norm) | [
"def",
"__init__",
"(",
"self",
",",
"cfg",
")",
":",
"super",
"(",
"StemWithGN",
",",
"self",
")",
".",
"__init__",
"(",
"cfg",
",",
"norm_func",
"=",
"group_norm",
")"
] | https://github.com/Yuliang-Liu/Box_Discretization_Network/blob/5b3a30c97429ef8e5c5e1c4e2476c7d9abdc03e6/maskrcnn_benchmark/modeling/backbone/resnet.py#L455-L456 | ||||
redhat-imaging/imagefactory | 176f6e045e1df049d50f33a924653128d5ab8b27 | imgfac/rest/bottle.py | python | ConfigDict.setdefault | (self, key, value) | return self[key] | [] | def setdefault(self, key, value):
if key not in self:
self[key] = value
return self[key] | [
"def",
"setdefault",
"(",
"self",
",",
"key",
",",
"value",
")",
":",
"if",
"key",
"not",
"in",
"self",
":",
"self",
"[",
"key",
"]",
"=",
"value",
"return",
"self",
"[",
"key",
"]"
] | https://github.com/redhat-imaging/imagefactory/blob/176f6e045e1df049d50f33a924653128d5ab8b27/imgfac/rest/bottle.py#L2138-L2141 | |||
huggingface/datasets | 249b4a38390bf1543f5b6e2f3dc208b5689c1c13 | datasets/igbo_ner/igbo_ner.py | python | IgboNer._generate_examples | (self, filepath, split) | Yields examples. | Yields examples. | [
"Yields",
"examples",
"."
] | def _generate_examples(self, filepath, split):
"""Yields examples."""
dictionary = {}
with open(filepath, "r", encoding="utf-8-sig") as f:
if self.config.name == "ner_data":
for id_, row in enumerate(f):
row = row.strip().split("\t")
... | [
"def",
"_generate_examples",
"(",
"self",
",",
"filepath",
",",
"split",
")",
":",
"dictionary",
"=",
"{",
"}",
"with",
"open",
"(",
"filepath",
",",
"\"r\"",
",",
"encoding",
"=",
"\"utf-8-sig\"",
")",
"as",
"f",
":",
"if",
"self",
".",
"config",
".",... | https://github.com/huggingface/datasets/blob/249b4a38390bf1543f5b6e2f3dc208b5689c1c13/datasets/igbo_ner/igbo_ner.py#L99-L122 | ||
voc/voctomix | 3156f3546890e6ae8d379df17e5cc718eee14b15 | voctocore/lib/config.py | python | VoctocoreConfigParser.getScheduleEvent | (self) | return overlay/event or <None> from INI configuration | return overlay/event or <None> from INI configuration | [
"return",
"overlay",
"/",
"event",
"or",
"<None",
">",
"from",
"INI",
"configuration"
] | def getScheduleEvent(self):
''' return overlay/event or <None> from INI configuration '''
if self.has_option('overlay', 'event'):
if self.has_option('overlay', 'room'):
self.log.warning(
"'overlay'/'event' overwrites 'overlay'/'room'")
return s... | [
"def",
"getScheduleEvent",
"(",
"self",
")",
":",
"if",
"self",
".",
"has_option",
"(",
"'overlay'",
",",
"'event'",
")",
":",
"if",
"self",
".",
"has_option",
"(",
"'overlay'",
",",
"'room'",
")",
":",
"self",
".",
"log",
".",
"warning",
"(",
"\"'over... | https://github.com/voc/voctomix/blob/3156f3546890e6ae8d379df17e5cc718eee14b15/voctocore/lib/config.py#L56-L64 | ||
Project-MONAI/MONAI | 83f8b06372a3803ebe9281300cb794a1f3395018 | monai/data/dataset.py | python | SmartCacheDataset.start | (self) | Start the background thread to replace training items for every epoch. | Start the background thread to replace training items for every epoch. | [
"Start",
"the",
"background",
"thread",
"to",
"replace",
"training",
"items",
"for",
"every",
"epoch",
"."
] | def start(self):
"""
Start the background thread to replace training items for every epoch.
"""
if self._replace_mgr is None or not self.is_started():
self._restart() | [
"def",
"start",
"(",
"self",
")",
":",
"if",
"self",
".",
"_replace_mgr",
"is",
"None",
"or",
"not",
"self",
".",
"is_started",
"(",
")",
":",
"self",
".",
"_restart",
"(",
")"
] | https://github.com/Project-MONAI/MONAI/blob/83f8b06372a3803ebe9281300cb794a1f3395018/monai/data/dataset.py#L938-L944 | ||
tensorflow/tensorboard | 61d11d99ef034c30ba20b6a7840c8eededb9031c | tensorboard/compat/tensorflow_stub/tensor_shape.py | python | Dimension.__ge__ | (self, other) | Returns True if `self` is known to be greater than or equal to
`other`.
Dimensions are compared as follows:
```python
(tf.Dimension(m) >= tf.Dimension(n)) == (m >= n)
(tf.Dimension(m) >= tf.Dimension(None)) == None
(tf.Dimension(None) >= tf.Dimension(n)) == ... | Returns True if `self` is known to be greater than or equal to
`other`. | [
"Returns",
"True",
"if",
"self",
"is",
"known",
"to",
"be",
"greater",
"than",
"or",
"equal",
"to",
"other",
"."
] | def __ge__(self, other):
"""Returns True if `self` is known to be greater than or equal to
`other`.
Dimensions are compared as follows:
```python
(tf.Dimension(m) >= tf.Dimension(n)) == (m >= n)
(tf.Dimension(m) >= tf.Dimension(None)) == None
(tf.Dimens... | [
"def",
"__ge__",
"(",
"self",
",",
"other",
")",
":",
"other",
"=",
"as_dimension",
"(",
"other",
")",
"if",
"self",
".",
"_value",
"is",
"None",
"or",
"other",
".",
"value",
"is",
"None",
":",
"return",
"None",
"else",
":",
"return",
"self",
".",
... | https://github.com/tensorflow/tensorboard/blob/61d11d99ef034c30ba20b6a7840c8eededb9031c/tensorboard/compat/tensorflow_stub/tensor_shape.py#L441-L465 | ||
Tencent/QT4i | 75f8705c194505b483c6b7464da8522cd53ba679 | qt4i/driver/util/_task.py | python | Task.execute3 | (self) | return out, err, returncode | 执行命令
@return: (stdout<StringIO>, stderr<StringIO>, returncode<int>) | 执行命令 | [
"执行命令"
] | def execute3(self):
'''执行命令
@return: (stdout<StringIO>, stderr<StringIO>, returncode<int>)
'''
out, err = StringIO(), StringIO()
returncode = self.__execute__(out, err)[-1]
return out, err, returncode | [
"def",
"execute3",
"(",
"self",
")",
":",
"out",
",",
"err",
"=",
"StringIO",
"(",
")",
",",
"StringIO",
"(",
")",
"returncode",
"=",
"self",
".",
"__execute__",
"(",
"out",
",",
"err",
")",
"[",
"-",
"1",
"]",
"return",
"out",
",",
"err",
",",
... | https://github.com/Tencent/QT4i/blob/75f8705c194505b483c6b7464da8522cd53ba679/qt4i/driver/util/_task.py#L88-L94 | |
tobspr/RenderPipeline | d8c38c0406a63298f4801782a8e44e9c1e467acf | rpcore/common_resources.py | python | CommonResources.update | (self) | Updates the commonly used resources, mostly the shader inputs | Updates the commonly used resources, mostly the shader inputs | [
"Updates",
"the",
"commonly",
"used",
"resources",
"mostly",
"the",
"shader",
"inputs"
] | def update(self):
""" Updates the commonly used resources, mostly the shader inputs """
update = self._input_ubo.update_input
# Get the current transform matrix of the camera
view_mat = Globals.render.get_transform(self._showbase.cam).get_mat()
# Compute the view matrix, but wi... | [
"def",
"update",
"(",
"self",
")",
":",
"update",
"=",
"self",
".",
"_input_ubo",
".",
"update_input",
"# Get the current transform matrix of the camera",
"view_mat",
"=",
"Globals",
".",
"render",
".",
"get_transform",
"(",
"self",
".",
"_showbase",
".",
"cam",
... | https://github.com/tobspr/RenderPipeline/blob/d8c38c0406a63298f4801782a8e44e9c1e467acf/rpcore/common_resources.py#L173-L246 | ||
spesmilo/electrum | bdbd59300fbd35b01605e66145458e5f396108e8 | electrum/wallet.py | python | Wallet.wallet_class | (wallet_type) | [] | def wallet_class(wallet_type):
if multisig_type(wallet_type):
return Multisig_Wallet
if wallet_type in wallet_constructors:
return wallet_constructors[wallet_type]
raise WalletFileException("Unknown wallet type: " + str(wallet_type)) | [
"def",
"wallet_class",
"(",
"wallet_type",
")",
":",
"if",
"multisig_type",
"(",
"wallet_type",
")",
":",
"return",
"Multisig_Wallet",
"if",
"wallet_type",
"in",
"wallet_constructors",
":",
"return",
"wallet_constructors",
"[",
"wallet_type",
"]",
"raise",
"WalletFi... | https://github.com/spesmilo/electrum/blob/bdbd59300fbd35b01605e66145458e5f396108e8/electrum/wallet.py#L3269-L3274 | ||||
mesonbuild/meson | a22d0f9a0a787df70ce79b05d0c45de90a970048 | mesonbuild/scripts/tags.py | python | ls_as_bytestream | () | return '\n'.join(files).encode() | [] | def ls_as_bytestream() -> bytes:
if os.path.exists('.git'):
return subprocess.run(['git', 'ls-tree', '-r', '--name-only', 'HEAD'],
stdout=subprocess.PIPE).stdout
files = [str(p) for p in Path('.').glob('**/*')
if not p.is_dir() and
not next((x for... | [
"def",
"ls_as_bytestream",
"(",
")",
"->",
"bytes",
":",
"if",
"os",
".",
"path",
".",
"exists",
"(",
"'.git'",
")",
":",
"return",
"subprocess",
".",
"run",
"(",
"[",
"'git'",
",",
"'ls-tree'",
",",
"'-r'",
",",
"'--name-only'",
",",
"'HEAD'",
"]",
... | https://github.com/mesonbuild/meson/blob/a22d0f9a0a787df70ce79b05d0c45de90a970048/mesonbuild/scripts/tags.py#L20-L28 | |||
anitagraser/movingpandas | b171436f8e868f40e7a6dc611167f4de7dd66b10 | movingpandas/trajectory_collection.py | python | TrajectoryCollection.hvplot | (self, *args, **kwargs) | return _TrajectoryCollectionPlotter(self, *args, **kwargs).hvplot() | Generate an interactive plot.
Parameters
----------
args :
These parameters will be passed to the TrajectoryPlotter
kwargs :
These parameters will be passed to the TrajectoryPlotter
Examples
--------
Plot speed along trajectories (with le... | Generate an interactive plot. | [
"Generate",
"an",
"interactive",
"plot",
"."
] | def hvplot(self, *args, **kwargs):
"""
Generate an interactive plot.
Parameters
----------
args :
These parameters will be passed to the TrajectoryPlotter
kwargs :
These parameters will be passed to the TrajectoryPlotter
Examples
... | [
"def",
"hvplot",
"(",
"self",
",",
"*",
"args",
",",
"*",
"*",
"kwargs",
")",
":",
"return",
"_TrajectoryCollectionPlotter",
"(",
"self",
",",
"*",
"args",
",",
"*",
"*",
"kwargs",
")",
".",
"hvplot",
"(",
")"
] | https://github.com/anitagraser/movingpandas/blob/b171436f8e868f40e7a6dc611167f4de7dd66b10/movingpandas/trajectory_collection.py#L426-L444 | |
fuzzbunch/fuzzbunch | 4b60a6c7cf9f84cf389d3fcdb9281de84ffb5802 | fuzzbunch/coli.py | python | CommandlineWrapper.__call__ | (self, argv) | Effectively "main" from Commandlinewrapper | Effectively "main" from Commandlinewrapper | [
"Effectively",
"main",
"from",
"Commandlinewrapper"
] | def __call__(self, argv):
"""Effectively "main" from Commandlinewrapper"""
logConfig = None
context = {}
rendezvous = None
try:
(opts, args) = self.__coli_parser.parse_args(argv)
if opts.InConfig is None:
raise ExploitConfigError("You must ... | [
"def",
"__call__",
"(",
"self",
",",
"argv",
")",
":",
"logConfig",
"=",
"None",
"context",
"=",
"{",
"}",
"rendezvous",
"=",
"None",
"try",
":",
"(",
"opts",
",",
"args",
")",
"=",
"self",
".",
"__coli_parser",
".",
"parse_args",
"(",
"argv",
")",
... | https://github.com/fuzzbunch/fuzzbunch/blob/4b60a6c7cf9f84cf389d3fcdb9281de84ffb5802/fuzzbunch/coli.py#L57-L117 | ||
sosreport/sos | 900e8bea7f3cd36c1dd48f3cbb351ab92f766654 | sos/archive.py | python | Archive.cleanup | (self) | Clean up any temporary resources used by an Archive class. | Clean up any temporary resources used by an Archive class. | [
"Clean",
"up",
"any",
"temporary",
"resources",
"used",
"by",
"an",
"Archive",
"class",
"."
] | def cleanup(self):
"""Clean up any temporary resources used by an Archive class."""
pass | [
"def",
"cleanup",
"(",
"self",
")",
":",
"pass"
] | https://github.com/sosreport/sos/blob/900e8bea7f3cd36c1dd48f3cbb351ab92f766654/sos/archive.py#L114-L116 | ||
sahana/eden | 1696fa50e90ce967df69f66b571af45356cc18da | modules/s3db/cr.py | python | CRShelterInspection.inject_js | (widget_id, options) | Helper function to inject static JS and instantiate
the shelterInspection widget
Args:
widget_id: the node ID where to instantiate the widget
options: dict of widget options (JSON-serializable) | Helper function to inject static JS and instantiate
the shelterInspection widget | [
"Helper",
"function",
"to",
"inject",
"static",
"JS",
"and",
"instantiate",
"the",
"shelterInspection",
"widget"
] | def inject_js(widget_id, options):
"""
Helper function to inject static JS and instantiate
the shelterInspection widget
Args:
widget_id: the node ID where to instantiate the widget
options: dict of widget options (JSON-serializable)
""... | [
"def",
"inject_js",
"(",
"widget_id",
",",
"options",
")",
":",
"s3",
"=",
"current",
".",
"response",
".",
"s3",
"appname",
"=",
"current",
".",
"request",
".",
"application",
"# Static JS",
"scripts",
"=",
"s3",
".",
"scripts",
"if",
"s3",
".",
"debug"... | https://github.com/sahana/eden/blob/1696fa50e90ce967df69f66b571af45356cc18da/modules/s3db/cr.py#L3039-L3065 | ||
Hiroshiba/realtime-yukarin | a8cd36b180c93d7251327b3ca4a027d2a9f0c868 | realtime_voice_conversion/stream/base_stream.py | python | BaseStream.__init__ | (
self,
in_segment_method: BaseSegmentMethod[T_IN],
out_segment_method: BaseSegmentMethod[T_OUT],
) | [] | def __init__(
self,
in_segment_method: BaseSegmentMethod[T_IN],
out_segment_method: BaseSegmentMethod[T_OUT],
):
self.in_segment_method = in_segment_method
self.out_segment_method = out_segment_method
self.stream: List[Segment[T_IN]] = [] | [
"def",
"__init__",
"(",
"self",
",",
"in_segment_method",
":",
"BaseSegmentMethod",
"[",
"T_IN",
"]",
",",
"out_segment_method",
":",
"BaseSegmentMethod",
"[",
"T_OUT",
"]",
",",
")",
":",
"self",
".",
"in_segment_method",
"=",
"in_segment_method",
"self",
".",
... | https://github.com/Hiroshiba/realtime-yukarin/blob/a8cd36b180c93d7251327b3ca4a027d2a9f0c868/realtime_voice_conversion/stream/base_stream.py#L11-L19 | ||||
suurjaak/Skyperious | 6a4f264dbac8d326c2fa8aeb5483dbca987860bf | skyperious/lib/controls.py | python | ColourManager.Adjust | (cls, colour1, colour2, ratio=0.5) | return wx.Colour(result) | Returns first colour adjusted towards second.
Arguments can be wx.Colour, RGB tuple, colour hex string,
or wx.SystemSettings colour index.
@param ratio RGB channel adjustment ratio towards second colour | Returns first colour adjusted towards second.
Arguments can be wx.Colour, RGB tuple, colour hex string,
or wx.SystemSettings colour index. | [
"Returns",
"first",
"colour",
"adjusted",
"towards",
"second",
".",
"Arguments",
"can",
"be",
"wx",
".",
"Colour",
"RGB",
"tuple",
"colour",
"hex",
"string",
"or",
"wx",
".",
"SystemSettings",
"colour",
"index",
"."
] | def Adjust(cls, colour1, colour2, ratio=0.5):
"""
Returns first colour adjusted towards second.
Arguments can be wx.Colour, RGB tuple, colour hex string,
or wx.SystemSettings colour index.
@param ratio RGB channel adjustment ratio towards second colour
"""
c... | [
"def",
"Adjust",
"(",
"cls",
",",
"colour1",
",",
"colour2",
",",
"ratio",
"=",
"0.5",
")",
":",
"colour1",
"=",
"wx",
".",
"SystemSettings",
".",
"GetColour",
"(",
"colour1",
")",
"if",
"isinstance",
"(",
"colour1",
",",
"(",
"int",
",",
"long",
")"... | https://github.com/suurjaak/Skyperious/blob/6a4f264dbac8d326c2fa8aeb5483dbca987860bf/skyperious/lib/controls.py#L312-L328 | |
bids-standard/pybids | 9449fdc319c4bdff4ed9aa1b299964352f394d56 | bids/layout/layout.py | python | BIDSLayout.get_nearest | (self, path, return_type='filename', strict=True,
all_=False, ignore_strict_entities='extension',
full_search=False, **filters) | return matches if all_ else matches[0] if matches else None | Walk up file tree from specified path and return nearest matching file(s).
Parameters
----------
path (str): The file to search from.
return_type (str): What to return; must be one of 'filename'
(default) or 'tuple'.
strict (bool): When True, all entities present in ... | Walk up file tree from specified path and return nearest matching file(s). | [
"Walk",
"up",
"file",
"tree",
"from",
"specified",
"path",
"and",
"return",
"nearest",
"matching",
"file",
"(",
"s",
")",
"."
] | def get_nearest(self, path, return_type='filename', strict=True,
all_=False, ignore_strict_entities='extension',
full_search=False, **filters):
"""Walk up file tree from specified path and return nearest matching file(s).
Parameters
----------
pat... | [
"def",
"get_nearest",
"(",
"self",
",",
"path",
",",
"return_type",
"=",
"'filename'",
",",
"strict",
"=",
"True",
",",
"all_",
"=",
"False",
",",
"ignore_strict_entities",
"=",
"'extension'",
",",
"full_search",
"=",
"False",
",",
"*",
"*",
"filters",
")"... | https://github.com/bids-standard/pybids/blob/9449fdc319c4bdff4ed9aa1b299964352f394d56/bids/layout/layout.py#L910-L1011 | |
khanhnamle1994/natural-language-processing | 01d450d5ac002b0156ef4cf93a07cb508c1bcdc5 | assignment1/.env/lib/python2.7/site-packages/zmq/eventloop/minitornado/ioloop.py | python | IOLoop.add_timeout | (self, deadline, callback) | Runs the ``callback`` at the time ``deadline`` from the I/O loop.
Returns an opaque handle that may be passed to
`remove_timeout` to cancel.
``deadline`` may be a number denoting a time (on the same
scale as `IOLoop.time`, normally `time.time`), or a
`datetime.timedelta` object... | Runs the ``callback`` at the time ``deadline`` from the I/O loop. | [
"Runs",
"the",
"callback",
"at",
"the",
"time",
"deadline",
"from",
"the",
"I",
"/",
"O",
"loop",
"."
] | def add_timeout(self, deadline, callback):
"""Runs the ``callback`` at the time ``deadline`` from the I/O loop.
Returns an opaque handle that may be passed to
`remove_timeout` to cancel.
``deadline`` may be a number denoting a time (on the same
scale as `IOLoop.time`, normally ... | [
"def",
"add_timeout",
"(",
"self",
",",
"deadline",
",",
"callback",
")",
":",
"raise",
"NotImplementedError",
"(",
")"
] | https://github.com/khanhnamle1994/natural-language-processing/blob/01d450d5ac002b0156ef4cf93a07cb508c1bcdc5/assignment1/.env/lib/python2.7/site-packages/zmq/eventloop/minitornado/ioloop.py#L392-L407 | ||
anki/cozmo-python-sdk | dd29edef18748fcd816550469195323842a7872e | src/cozmo/objects.py | python | FixedCustomObject.object_id | (self) | return self._object_id | int: The internal ID assigned to the object.
This value can only be assigned once as it is static in the engine. | int: The internal ID assigned to the object. | [
"int",
":",
"The",
"internal",
"ID",
"assigned",
"to",
"the",
"object",
"."
] | def object_id(self):
'''int: The internal ID assigned to the object.
This value can only be assigned once as it is static in the engine.
'''
return self._object_id | [
"def",
"object_id",
"(",
"self",
")",
":",
"return",
"self",
".",
"_object_id"
] | https://github.com/anki/cozmo-python-sdk/blob/dd29edef18748fcd816550469195323842a7872e/src/cozmo/objects.py#L902-L907 | |
bbfamily/abu | 2de85ae57923a720dac99a545b4f856f6b87304b | abupy/FactorSellBu/ABuFactorSellBreak.py | python | AbuFactorSellBreak.support_direction | (self) | return [ESupportDirection.DIRECTION_CAll.value] | 支持的方向,只支持正向 | 支持的方向,只支持正向 | [
"支持的方向,只支持正向"
] | def support_direction(self):
"""支持的方向,只支持正向"""
return [ESupportDirection.DIRECTION_CAll.value] | [
"def",
"support_direction",
"(",
"self",
")",
":",
"return",
"[",
"ESupportDirection",
".",
"DIRECTION_CAll",
".",
"value",
"]"
] | https://github.com/bbfamily/abu/blob/2de85ae57923a720dac99a545b4f856f6b87304b/abupy/FactorSellBu/ABuFactorSellBreak.py#L27-L29 | |
zhl2008/awd-platform | 0416b31abea29743387b10b3914581fbe8e7da5e | web_flaskbb/Python-2.7.9/Lib/plat-unixware7/IN.py | python | IN6_SET_ADDR_ANY | (a) | return IN6_ADDR_COPY_L(a, 0, 0, 0, 0) | [] | def IN6_SET_ADDR_ANY(a): return IN6_ADDR_COPY_L(a, 0, 0, 0, 0) | [
"def",
"IN6_SET_ADDR_ANY",
"(",
"a",
")",
":",
"return",
"IN6_ADDR_COPY_L",
"(",
"a",
",",
"0",
",",
"0",
",",
"0",
",",
"0",
")"
] | https://github.com/zhl2008/awd-platform/blob/0416b31abea29743387b10b3914581fbe8e7da5e/web_flaskbb/Python-2.7.9/Lib/plat-unixware7/IN.py#L77-L77 | |||
brendano/tweetmotif | 1b0b1e3a941745cd5a26eba01f554688b7c4b27e | everything_else/djfrontend/django-1.0.2/contrib/gis/gdal/libgdal.py | python | gdal_version | () | return _version_info('RELEASE_NAME') | Returns only the GDAL version number information. | Returns only the GDAL version number information. | [
"Returns",
"only",
"the",
"GDAL",
"version",
"number",
"information",
"."
] | def gdal_version():
"Returns only the GDAL version number information."
return _version_info('RELEASE_NAME') | [
"def",
"gdal_version",
"(",
")",
":",
"return",
"_version_info",
"(",
"'RELEASE_NAME'",
")"
] | https://github.com/brendano/tweetmotif/blob/1b0b1e3a941745cd5a26eba01f554688b7c4b27e/everything_else/djfrontend/django-1.0.2/contrib/gis/gdal/libgdal.py#L64-L66 | |
steeve/xbmctorrent | e6bcb1037668959e1e3cb5ba8cf3e379c6638da9 | resources/site-packages/bs4/dammit.py | python | UnicodeDammit.detwingle | (cls, in_bytes, main_encoding="utf8",
embedded_encoding="windows-1252") | return b''.join(byte_chunks) | Fix characters from one encoding embedded in some other encoding.
Currently the only situation supported is Windows-1252 (or its
subset ISO-8859-1), embedded in UTF-8.
The input must be a bytestring. If you've already converted
the document to Unicode, you're too late.
The out... | Fix characters from one encoding embedded in some other encoding. | [
"Fix",
"characters",
"from",
"one",
"encoding",
"embedded",
"in",
"some",
"other",
"encoding",
"."
] | def detwingle(cls, in_bytes, main_encoding="utf8",
embedded_encoding="windows-1252"):
"""Fix characters from one encoding embedded in some other encoding.
Currently the only situation supported is Windows-1252 (or its
subset ISO-8859-1), embedded in UTF-8.
The input m... | [
"def",
"detwingle",
"(",
"cls",
",",
"in_bytes",
",",
"main_encoding",
"=",
"\"utf8\"",
",",
"embedded_encoding",
"=",
"\"windows-1252\"",
")",
":",
"if",
"embedded_encoding",
".",
"replace",
"(",
"'_'",
",",
"'-'",
")",
".",
"lower",
"(",
")",
"not",
"in"... | https://github.com/steeve/xbmctorrent/blob/e6bcb1037668959e1e3cb5ba8cf3e379c6638da9/resources/site-packages/bs4/dammit.py#L765-L825 | |
IntelAI/nauta | bbedb114a755cf1f43b834a58fc15fb6e3a4b291 | applications/cli/example-python/package_examples/mnist_converter_pb.py | python | do_conversion | (work_dir, num_tests) | Converts requested number of examples from mnist test set to proto buffer format. Results are saved in a
conversion_out subdir of workdir.
Args:
work_dir: The full path of working directory for test data set.
num_tests: Number of test images to convert.
Raises:
IOError: An error oc... | Converts requested number of examples from mnist test set to proto buffer format. Results are saved in a
conversion_out subdir of workdir. | [
"Converts",
"requested",
"number",
"of",
"examples",
"from",
"mnist",
"test",
"set",
"to",
"proto",
"buffer",
"format",
".",
"Results",
"are",
"saved",
"in",
"a",
"conversion_out",
"subdir",
"of",
"workdir",
"."
] | def do_conversion(work_dir, num_tests):
"""
Converts requested number of examples from mnist test set to proto buffer format. Results are saved in a
conversion_out subdir of workdir.
Args:
work_dir: The full path of working directory for test data set.
num_tests: Number of test images t... | [
"def",
"do_conversion",
"(",
"work_dir",
",",
"num_tests",
")",
":",
"conversion_out_path",
"=",
"os",
".",
"path",
".",
"join",
"(",
"work_dir",
",",
"\"conversion_out\"",
")",
"os",
".",
"makedirs",
"(",
"conversion_out_path",
",",
"exist_ok",
"=",
"True",
... | https://github.com/IntelAI/nauta/blob/bbedb114a755cf1f43b834a58fc15fb6e3a4b291/applications/cli/example-python/package_examples/mnist_converter_pb.py#L39-L73 | ||
ZhaoJ9014/face.evoLVe | 63520924167efb9ef53dcceed0a15cf739cad1c9 | backbone/EfficientNets.py | python | round_repeats | (repeats, global_params) | return int(math.ceil(multiplier * repeats)) | Calculate module's repeat number of a block based on depth multiplier.
Use depth_coefficient of global_params.
Args:
repeats (int): num_repeat to be calculated.
global_params (namedtuple): Global params of the model.
Returns:
new repeat: New repeat number after calculating. | Calculate module's repeat number of a block based on depth multiplier.
Use depth_coefficient of global_params. | [
"Calculate",
"module",
"s",
"repeat",
"number",
"of",
"a",
"block",
"based",
"on",
"depth",
"multiplier",
".",
"Use",
"depth_coefficient",
"of",
"global_params",
"."
] | def round_repeats(repeats, global_params):
"""Calculate module's repeat number of a block based on depth multiplier.
Use depth_coefficient of global_params.
Args:
repeats (int): num_repeat to be calculated.
global_params (namedtuple): Global params of the model.
Returns:
new... | [
"def",
"round_repeats",
"(",
"repeats",
",",
"global_params",
")",
":",
"multiplier",
"=",
"global_params",
".",
"depth_coefficient",
"if",
"not",
"multiplier",
":",
"return",
"repeats",
"# follow the formula transferred from official TensorFlow implementation",
"return",
"... | https://github.com/ZhaoJ9014/face.evoLVe/blob/63520924167efb9ef53dcceed0a15cf739cad1c9/backbone/EfficientNets.py#L103-L118 | |
plotly/plotly.py | cfad7862594b35965c0e000813bd7805e8494a5b | packages/python/plotly/plotly/graph_objs/pie/marker/_line.py | python | Line.colorsrc | (self) | return self["colorsrc"] | Sets the source reference on Chart Studio Cloud for `color`.
The 'colorsrc' property must be specified as a string or
as a plotly.grid_objs.Column object
Returns
-------
str | Sets the source reference on Chart Studio Cloud for `color`.
The 'colorsrc' property must be specified as a string or
as a plotly.grid_objs.Column object | [
"Sets",
"the",
"source",
"reference",
"on",
"Chart",
"Studio",
"Cloud",
"for",
"color",
".",
"The",
"colorsrc",
"property",
"must",
"be",
"specified",
"as",
"a",
"string",
"or",
"as",
"a",
"plotly",
".",
"grid_objs",
".",
"Column",
"object"
] | def colorsrc(self):
"""
Sets the source reference on Chart Studio Cloud for `color`.
The 'colorsrc' property must be specified as a string or
as a plotly.grid_objs.Column object
Returns
-------
str
"""
return self["colorsrc"] | [
"def",
"colorsrc",
"(",
"self",
")",
":",
"return",
"self",
"[",
"\"colorsrc\"",
"]"
] | https://github.com/plotly/plotly.py/blob/cfad7862594b35965c0e000813bd7805e8494a5b/packages/python/plotly/plotly/graph_objs/pie/marker/_line.py#L76-L87 | |
sagemath/sage | f9b2db94f675ff16963ccdefba4f1a3393b3fe0d | src/sage/combinat/knutson_tao_puzzles.py | python | DeltaPiece.__hash__ | (self) | return hash((DeltaPiece, self.border())) | r"""
TESTS::
sage: from sage.combinat.knutson_tao_puzzles import DeltaPiece
sage: delta = DeltaPiece('a','b','c')
sage: hash(delta) == hash(delta)
True | r"""
TESTS:: | [
"r",
"TESTS",
"::"
] | def __hash__(self):
r"""
TESTS::
sage: from sage.combinat.knutson_tao_puzzles import DeltaPiece
sage: delta = DeltaPiece('a','b','c')
sage: hash(delta) == hash(delta)
True
"""
return hash((DeltaPiece, self.border())) | [
"def",
"__hash__",
"(",
"self",
")",
":",
"return",
"hash",
"(",
"(",
"DeltaPiece",
",",
"self",
".",
"border",
"(",
")",
")",
")"
] | https://github.com/sagemath/sage/blob/f9b2db94f675ff16963ccdefba4f1a3393b3fe0d/src/sage/combinat/knutson_tao_puzzles.py#L403-L412 | |
Theano/Theano | 8fd9203edfeecebced9344b0c70193be292a9ade | theano/gof/type.py | python | CLinkerType.c_extract_out | (self, name, sub, check_input=True) | return """
if (py_%(name)s == Py_None)
{
%(c_init_code)s
}
else
{
%(c_extract_code)s
}
""" % dict(
name=name,
c_init_code=self.c_init(name, sub),
c_extract_code=self.c_extract(name, sub, check_input)) | Optional: C code to extract a PyObject * instance.
Unlike c_extract, c_extract_out has to accept Py_None,
meaning that the variable should be left uninitialized. | Optional: C code to extract a PyObject * instance. | [
"Optional",
":",
"C",
"code",
"to",
"extract",
"a",
"PyObject",
"*",
"instance",
"."
] | def c_extract_out(self, name, sub, check_input=True):
"""
Optional: C code to extract a PyObject * instance.
Unlike c_extract, c_extract_out has to accept Py_None,
meaning that the variable should be left uninitialized.
"""
return """
if (py_%(name)s == Py_None)... | [
"def",
"c_extract_out",
"(",
"self",
",",
"name",
",",
"sub",
",",
"check_input",
"=",
"True",
")",
":",
"return",
"\"\"\"\n if (py_%(name)s == Py_None)\n {\n %(c_init_code)s\n }\n else\n {\n %(c_extract_code)s\n }\n ... | https://github.com/Theano/Theano/blob/8fd9203edfeecebced9344b0c70193be292a9ade/theano/gof/type.py#L188-L208 | |
phonopy/phonopy | 816586d0ba8177482ecf40e52f20cbdee2260d51 | phonopy/cui/settings.py | python | PhonopySettings.set_is_legacy_plot | (self, val) | Set is_legacy_plot. | Set is_legacy_plot. | [
"Set",
"is_legacy_plot",
"."
] | def set_is_legacy_plot(self, val):
"""Set is_legacy_plot."""
self._v["is_legacy_plot"] = val | [
"def",
"set_is_legacy_plot",
"(",
"self",
",",
"val",
")",
":",
"self",
".",
"_v",
"[",
"\"is_legacy_plot\"",
"]",
"=",
"val"
] | https://github.com/phonopy/phonopy/blob/816586d0ba8177482ecf40e52f20cbdee2260d51/phonopy/cui/settings.py#L1304-L1306 | ||
Dvlv/Tkinter-By-Example | 30721f15f7bea41489a7c46819beb5282781e563 | Code/Chapter7-1.py | python | Timer.setup_worker | (self) | [] | def setup_worker(self):
now = datetime.datetime.now()
in_25_mins = now + datetime.timedelta(minutes=25)
#in_25_mins = now + datetime.timedelta(seconds=3)
worker = CountingThread(self, now, in_25_mins)
self.worker = worker | [
"def",
"setup_worker",
"(",
"self",
")",
":",
"now",
"=",
"datetime",
".",
"datetime",
".",
"now",
"(",
")",
"in_25_mins",
"=",
"now",
"+",
"datetime",
".",
"timedelta",
"(",
"minutes",
"=",
"25",
")",
"#in_25_mins = now + datetime.timedelta(seconds=3)",
"work... | https://github.com/Dvlv/Tkinter-By-Example/blob/30721f15f7bea41489a7c46819beb5282781e563/Code/Chapter7-1.py#L76-L81 | ||||
deepinsight/insightface | c0b25f998a649f662c7136eb389abcacd7900e9d | detection/scrfd/mmdet/core/mask/structures.py | python | BaseInstanceMasks.expand | (self, expanded_h, expanded_w, top, left) | see :class:`Expand`. | see :class:`Expand`. | [
"see",
":",
"class",
":",
"Expand",
"."
] | def expand(self, expanded_h, expanded_w, top, left):
"""see :class:`Expand`."""
pass | [
"def",
"expand",
"(",
"self",
",",
"expanded_h",
",",
"expanded_w",
",",
"top",
",",
"left",
")",
":",
"pass"
] | https://github.com/deepinsight/insightface/blob/c0b25f998a649f662c7136eb389abcacd7900e9d/detection/scrfd/mmdet/core/mask/structures.py#L104-L106 | ||
jiangxinyang227/bert-for-task | 3e7aed9e3c757ebc22aabfd4f3fb7b4cd81b010a | albert_task/albert/optimization.py | python | LAMBOptimizer.apply_gradients | (self, grads_and_vars, global_step=None, name=None) | return tf.group(*assignments, name=name) | See base class. | See base class. | [
"See",
"base",
"class",
"."
] | def apply_gradients(self, grads_and_vars, global_step=None, name=None):
"""See base class."""
assignments = []
for (grad, param) in grads_and_vars:
if grad is None or param is None:
continue
param_name = self._get_variable_name(param.name)
m ... | [
"def",
"apply_gradients",
"(",
"self",
",",
"grads_and_vars",
",",
"global_step",
"=",
"None",
",",
"name",
"=",
"None",
")",
":",
"assignments",
"=",
"[",
"]",
"for",
"(",
"grad",
",",
"param",
")",
"in",
"grads_and_vars",
":",
"if",
"grad",
"is",
"No... | https://github.com/jiangxinyang227/bert-for-task/blob/3e7aed9e3c757ebc22aabfd4f3fb7b4cd81b010a/albert_task/albert/optimization.py#L213-L283 | |
openshift/openshift-tools | 1188778e728a6e4781acf728123e5b356380fe6f | openshift/installer/vendored/openshift-ansible-3.11.28-1/roles/lib_openshift/library/oc_user.py | python | Yedit.separator | (self) | return self._separator | getter method for separator | getter method for separator | [
"getter",
"method",
"for",
"separator"
] | def separator(self):
''' getter method for separator '''
return self._separator | [
"def",
"separator",
"(",
"self",
")",
":",
"return",
"self",
".",
"_separator"
] | https://github.com/openshift/openshift-tools/blob/1188778e728a6e4781acf728123e5b356380fe6f/openshift/installer/vendored/openshift-ansible-3.11.28-1/roles/lib_openshift/library/oc_user.py#L224-L226 | |
holzschu/Carnets | 44effb10ddfc6aa5c8b0687582a724ba82c6b547 | Library/lib/python3.7/site-packages/pip/_internal/utils/outdated.py | python | was_installed_by_pip | (pkg) | Checks whether pkg was installed by pip
This is used not to display the upgrade message when pip is in fact
installed by system package manager, such as dnf on Fedora. | Checks whether pkg was installed by pip | [
"Checks",
"whether",
"pkg",
"was",
"installed",
"by",
"pip"
] | def was_installed_by_pip(pkg):
# type: (str) -> bool
"""Checks whether pkg was installed by pip
This is used not to display the upgrade message when pip is in fact
installed by system package manager, such as dnf on Fedora.
"""
try:
dist = pkg_resources.get_distribution(pkg)
ret... | [
"def",
"was_installed_by_pip",
"(",
"pkg",
")",
":",
"# type: (str) -> bool",
"try",
":",
"dist",
"=",
"pkg_resources",
".",
"get_distribution",
"(",
"pkg",
")",
"return",
"(",
"dist",
".",
"has_metadata",
"(",
"'INSTALLER'",
")",
"and",
"'pip'",
"in",
"dist",... | https://github.com/holzschu/Carnets/blob/44effb10ddfc6aa5c8b0687582a724ba82c6b547/Library/lib/python3.7/site-packages/pip/_internal/utils/outdated.py#L79-L91 | ||
SolidCode/SolidPython | 4715c827ad90db26ee37df57bc425e6f2de3cf8d | solid/utils.py | python | _euc_obj | (an_obj: Any, intended_class:type=Vector3) | return result | Take a single object (not a list of them!) and return a euclid type
# If given a euclid obj, return the desired type,
# -- 3d types are projected to z=0 when intended_class is 2D
# -- 2D types are projected to z=0 when intended class is 3D
_euc_obj( Vector3(0,1,2), Vector3) -> Vector3(0... | Take a single object (not a list of them!) and return a euclid type
# If given a euclid obj, return the desired type,
# -- 3d types are projected to z=0 when intended_class is 2D
# -- 2D types are projected to z=0 when intended class is 3D
_euc_obj( Vector3(0,1,2), Vector3) -> Vector3(0... | [
"Take",
"a",
"single",
"object",
"(",
"not",
"a",
"list",
"of",
"them!",
")",
"and",
"return",
"a",
"euclid",
"type",
"#",
"If",
"given",
"a",
"euclid",
"obj",
"return",
"the",
"desired",
"type",
"#",
"--",
"3d",
"types",
"are",
"projected",
"to",
"z... | def _euc_obj(an_obj: Any, intended_class:type=Vector3) -> Union[Point23, Vector23]:
''' Take a single object (not a list of them!) and return a euclid type
# If given a euclid obj, return the desired type,
# -- 3d types are projected to z=0 when intended_class is 2D
# -- 2D types are projec... | [
"def",
"_euc_obj",
"(",
"an_obj",
":",
"Any",
",",
"intended_class",
":",
"type",
"=",
"Vector3",
")",
"->",
"Union",
"[",
"Point23",
",",
"Vector23",
"]",
":",
"elts_in_constructor",
"=",
"3",
"if",
"intended_class",
"in",
"(",
"Point2",
",",
"Vector2",
... | https://github.com/SolidCode/SolidPython/blob/4715c827ad90db26ee37df57bc425e6f2de3cf8d/solid/utils.py#L752-L771 | |
grnet/synnefo | d06ec8c7871092131cdaabf6b03ed0b504c93e43 | snf-common/synnefo/lib/utils.py | python | split_time | (value) | return (int(seconds), int(microseconds)) | Splits time as floating point number into a tuple.
@param value: Time in seconds
@type value: int or float
@return: Tuple containing (seconds, microseconds) | Splits time as floating point number into a tuple. | [
"Splits",
"time",
"as",
"floating",
"point",
"number",
"into",
"a",
"tuple",
"."
] | def split_time(value):
"""Splits time as floating point number into a tuple.
@param value: Time in seconds
@type value: int or float
@return: Tuple containing (seconds, microseconds)
"""
(seconds, microseconds) = divmod(int(value * 1000000), 1000000)
assert 0 <= seconds, \
"Second... | [
"def",
"split_time",
"(",
"value",
")",
":",
"(",
"seconds",
",",
"microseconds",
")",
"=",
"divmod",
"(",
"int",
"(",
"value",
"*",
"1000000",
")",
",",
"1000000",
")",
"assert",
"0",
"<=",
"seconds",
",",
"\"Seconds must be larger than or equal to 0, but are... | https://github.com/grnet/synnefo/blob/d06ec8c7871092131cdaabf6b03ed0b504c93e43/snf-common/synnefo/lib/utils.py#L20-L35 | |
CastagnaIT/plugin.video.netflix | 5cf5fa436eb9956576c0f62aa31a4c7d6c5b8a4a | packages/httpcore/_async/http11.py | python | AsyncHTTP11Connection.should_close | (self) | return self._server_disconnected() or self._keepalive_expired() | Return `True` if the connection is in a state where it should be closed. | Return `True` if the connection is in a state where it should be closed. | [
"Return",
"True",
"if",
"the",
"connection",
"is",
"in",
"a",
"state",
"where",
"it",
"should",
"be",
"closed",
"."
] | def should_close(self) -> bool:
"""
Return `True` if the connection is in a state where it should be closed.
"""
return self._server_disconnected() or self._keepalive_expired() | [
"def",
"should_close",
"(",
"self",
")",
"->",
"bool",
":",
"return",
"self",
".",
"_server_disconnected",
"(",
")",
"or",
"self",
".",
"_keepalive_expired",
"(",
")"
] | https://github.com/CastagnaIT/plugin.video.netflix/blob/5cf5fa436eb9956576c0f62aa31a4c7d6c5b8a4a/packages/httpcore/_async/http11.py#L75-L79 | |
AlessandroZ/LaZagne | 30623c9138e2387d10f6631007f954f2a4ead06d | Windows/lazagne/config/DPAPI/crypto.py | python | dataDecrypt | (cipherAlgo, hashAlgo, raw, encKey, iv, rounds) | return cleartxt | Internal use. Decrypts data stored in DPAPI structures. | Internal use. Decrypts data stored in DPAPI structures. | [
"Internal",
"use",
".",
"Decrypts",
"data",
"stored",
"in",
"DPAPI",
"structures",
"."
] | def dataDecrypt(cipherAlgo, hashAlgo, raw, encKey, iv, rounds):
"""
Internal use. Decrypts data stored in DPAPI structures.
"""
hname = {"HMAC": "sha1"}.get(hashAlgo.name, hashAlgo.name)
derived = pbkdf2(encKey, iv, cipherAlgo.keyLength + cipherAlgo.ivLength, rounds, hname)
key, iv = derived[:in... | [
"def",
"dataDecrypt",
"(",
"cipherAlgo",
",",
"hashAlgo",
",",
"raw",
",",
"encKey",
",",
"iv",
",",
"rounds",
")",
":",
"hname",
"=",
"{",
"\"HMAC\"",
":",
"\"sha1\"",
"}",
".",
"get",
"(",
"hashAlgo",
".",
"name",
",",
"hashAlgo",
".",
"name",
")",... | https://github.com/AlessandroZ/LaZagne/blob/30623c9138e2387d10f6631007f954f2a4ead06d/Windows/lazagne/config/DPAPI/crypto.py#L337-L353 | |
winpython/winpython | 5af92920d1d6b4e12702d1816a1f7bbb95a3d949 | winpython/qthelpers.py | python | file_uri | (fname) | Select the right file uri scheme according to the operating system | Select the right file uri scheme according to the operating system | [
"Select",
"the",
"right",
"file",
"uri",
"scheme",
"according",
"to",
"the",
"operating",
"system"
] | def file_uri(fname):
"""Select the right file uri scheme according to the operating system"""
if os.name == 'nt':
# Local file
if re.search(r'^[a-zA-Z]:', fname):
return 'file:///' + fname
# UNC based path
else:
return 'file://' + fname
else:
r... | [
"def",
"file_uri",
"(",
"fname",
")",
":",
"if",
"os",
".",
"name",
"==",
"'nt'",
":",
"# Local file",
"if",
"re",
".",
"search",
"(",
"r'^[a-zA-Z]:'",
",",
"fname",
")",
":",
"return",
"'file:///'",
"+",
"fname",
"# UNC based path",
"else",
":",
"return... | https://github.com/winpython/winpython/blob/5af92920d1d6b4e12702d1816a1f7bbb95a3d949/winpython/qthelpers.py#L103-L113 | ||
bdcht/amoco | dac8e00b862eb6d87cc88dddd1e5316c67c1d798 | amoco/sa/lsweep.py | python | lsweep.score | (self, func=None) | return len(sig) | a measure for the *complexity* of the program.
For the moment it is associated only with the
signature length. | a measure for the *complexity* of the program.
For the moment it is associated only with the
signature length. | [
"a",
"measure",
"for",
"the",
"*",
"complexity",
"*",
"of",
"the",
"program",
".",
"For",
"the",
"moment",
"it",
"is",
"associated",
"only",
"with",
"the",
"signature",
"length",
"."
] | def score(self, func=None):
"""a measure for the *complexity* of the program.
For the moment it is associated only with the
signature length.
"""
sig = self.signature(func)
return len(sig) | [
"def",
"score",
"(",
"self",
",",
"func",
"=",
"None",
")",
":",
"sig",
"=",
"self",
".",
"signature",
"(",
"func",
")",
"return",
"len",
"(",
"sig",
")"
] | https://github.com/bdcht/amoco/blob/dac8e00b862eb6d87cc88dddd1e5316c67c1d798/amoco/sa/lsweep.py#L171-L177 | |
inasafe/inasafe | 355eb2ce63f516b9c26af0c86a24f99e53f63f87 | safe/gis/vector/union.py | python | union | (union_a, union_b) | return union_layer | Union of two vector layers.
Issue https://github.com/inasafe/inasafe/issues/3186
:param union_a: The vector layer for the union.
:type union_a: QgsVectorLayer
:param union_b: The vector layer for the union.
:type union_b: QgsVectorLayer
:return: The clip vector layer.
:rtype: QgsVectorLa... | Union of two vector layers. | [
"Union",
"of",
"two",
"vector",
"layers",
"."
] | def union(union_a, union_b):
"""Union of two vector layers.
Issue https://github.com/inasafe/inasafe/issues/3186
:param union_a: The vector layer for the union.
:type union_a: QgsVectorLayer
:param union_b: The vector layer for the union.
:type union_b: QgsVectorLayer
:return: The clip v... | [
"def",
"union",
"(",
"union_a",
",",
"union_b",
")",
":",
"output_layer_name",
"=",
"union_steps",
"[",
"'output_layer_name'",
"]",
"output_layer_name",
"=",
"output_layer_name",
"%",
"(",
"union_a",
".",
"keywords",
"[",
"'layer_purpose'",
"]",
",",
"union_b",
... | https://github.com/inasafe/inasafe/blob/355eb2ce63f516b9c26af0c86a24f99e53f63f87/safe/gis/vector/union.py#L33-L90 | |
wanggrun/Adaptively-Connected-Neural-Networks | e27066ef52301bdafa5932f43af8feeb23647edb | cnn/pixel-aware/resnet_model.py | python | get_bn | (zero_init=False) | Zero init gamma is good for resnet. See https://arxiv.org/abs/1706.02677. | Zero init gamma is good for resnet. See https://arxiv.org/abs/1706.02677. | [
"Zero",
"init",
"gamma",
"is",
"good",
"for",
"resnet",
".",
"See",
"https",
":",
"//",
"arxiv",
".",
"org",
"/",
"abs",
"/",
"1706",
".",
"02677",
"."
] | def get_bn(zero_init=False):
"""
Zero init gamma is good for resnet. See https://arxiv.org/abs/1706.02677.
"""
if zero_init:
return lambda x, name=None: BatchNorm('bn', x, gamma_init=tf.zeros_initializer())
else:
return lambda x, name=None: BatchNorm('bn', x) | [
"def",
"get_bn",
"(",
"zero_init",
"=",
"False",
")",
":",
"if",
"zero_init",
":",
"return",
"lambda",
"x",
",",
"name",
"=",
"None",
":",
"BatchNorm",
"(",
"'bn'",
",",
"x",
",",
"gamma_init",
"=",
"tf",
".",
"zeros_initializer",
"(",
")",
")",
"els... | https://github.com/wanggrun/Adaptively-Connected-Neural-Networks/blob/e27066ef52301bdafa5932f43af8feeb23647edb/cnn/pixel-aware/resnet_model.py#L44-L51 | ||
zhl2008/awd-platform | 0416b31abea29743387b10b3914581fbe8e7da5e | web_flaskbb/lib/python2.7/site-packages/pip/_internal/__init__.py | python | auto_complete_paths | (current, completion_type) | If ``completion_type`` is ``file`` or ``path``, list all regular files
and directories starting with ``current``; otherwise only list directories
starting with ``current``.
:param current: The word to be completed
:param completion_type: path completion type(`file`, `path` or `dir`)i
:return: A gen... | If ``completion_type`` is ``file`` or ``path``, list all regular files
and directories starting with ``current``; otherwise only list directories
starting with ``current``. | [
"If",
"completion_type",
"is",
"file",
"or",
"path",
"list",
"all",
"regular",
"files",
"and",
"directories",
"starting",
"with",
"current",
";",
"otherwise",
"only",
"list",
"directories",
"starting",
"with",
"current",
"."
] | def auto_complete_paths(current, completion_type):
"""If ``completion_type`` is ``file`` or ``path``, list all regular files
and directories starting with ``current``; otherwise only list directories
starting with ``current``.
:param current: The word to be completed
:param completion_type: path co... | [
"def",
"auto_complete_paths",
"(",
"current",
",",
"completion_type",
")",
":",
"directory",
",",
"filename",
"=",
"os",
".",
"path",
".",
"split",
"(",
"current",
")",
"current_path",
"=",
"os",
".",
"path",
".",
"abspath",
"(",
"directory",
")",
"# Don't... | https://github.com/zhl2008/awd-platform/blob/0416b31abea29743387b10b3914581fbe8e7da5e/web_flaskbb/lib/python2.7/site-packages/pip/_internal/__init__.py#L174-L201 | ||
havakv/pycox | 69940e0b28c8851cb6a2ca66083f857aee902022 | pycox/models/utils.py | python | log_softplus | (input, threshold=-15.) | return output | Equivalent to 'F.softplus(input).log()', but for 'input < threshold',
we return 'input', as this is approximately the same.
Arguments:
input {torch.tensor} -- Input tensor
Keyword Arguments:
threshold {float} -- Treshold for when to just return input (default: {-15.})
Returns:... | Equivalent to 'F.softplus(input).log()', but for 'input < threshold',
we return 'input', as this is approximately the same. | [
"Equivalent",
"to",
"F",
".",
"softplus",
"(",
"input",
")",
".",
"log",
"()",
"but",
"for",
"input",
"<",
"threshold",
"we",
"return",
"input",
"as",
"this",
"is",
"approximately",
"the",
"same",
"."
] | def log_softplus(input, threshold=-15.):
"""Equivalent to 'F.softplus(input).log()', but for 'input < threshold',
we return 'input', as this is approximately the same.
Arguments:
input {torch.tensor} -- Input tensor
Keyword Arguments:
threshold {float} -- Treshold for when to just ... | [
"def",
"log_softplus",
"(",
"input",
",",
"threshold",
"=",
"-",
"15.",
")",
":",
"output",
"=",
"input",
".",
"clone",
"(",
")",
"above",
"=",
"input",
">=",
"threshold",
"output",
"[",
"above",
"]",
"=",
"F",
".",
"softplus",
"(",
"input",
"[",
"... | https://github.com/havakv/pycox/blob/69940e0b28c8851cb6a2ca66083f857aee902022/pycox/models/utils.py#L39-L55 | |
VITA-Group/DeblurGANv2 | 756db7f0b30b5a35afd19347b02c34d595135cf1 | models/senet.py | python | SENet.__init__ | (self, block, layers, groups, reduction, dropout_p=0.2,
inplanes=128, input_3x3=True, downsample_kernel_size=3,
downsample_padding=1, num_classes=1000) | Parameters
----------
block (nn.Module): Bottleneck class.
- For SENet154: SEBottleneck
- For SE-ResNet models: SEResNetBottleneck
- For SE-ResNeXt models: SEResNeXtBottleneck
layers (list of ints): Number of residual blocks for 4 layers of the
ne... | Parameters
----------
block (nn.Module): Bottleneck class.
- For SENet154: SEBottleneck
- For SE-ResNet models: SEResNetBottleneck
- For SE-ResNeXt models: SEResNeXtBottleneck
layers (list of ints): Number of residual blocks for 4 layers of the
ne... | [
"Parameters",
"----------",
"block",
"(",
"nn",
".",
"Module",
")",
":",
"Bottleneck",
"class",
".",
"-",
"For",
"SENet154",
":",
"SEBottleneck",
"-",
"For",
"SE",
"-",
"ResNet",
"models",
":",
"SEResNetBottleneck",
"-",
"For",
"SE",
"-",
"ResNeXt",
"model... | def __init__(self, block, layers, groups, reduction, dropout_p=0.2,
inplanes=128, input_3x3=True, downsample_kernel_size=3,
downsample_padding=1, num_classes=1000):
"""
Parameters
----------
block (nn.Module): Bottleneck class.
- For SENet154... | [
"def",
"__init__",
"(",
"self",
",",
"block",
",",
"layers",
",",
"groups",
",",
"reduction",
",",
"dropout_p",
"=",
"0.2",
",",
"inplanes",
"=",
"128",
",",
"input_3x3",
"=",
"True",
",",
"downsample_kernel_size",
"=",
"3",
",",
"downsample_padding",
"=",... | https://github.com/VITA-Group/DeblurGANv2/blob/756db7f0b30b5a35afd19347b02c34d595135cf1/models/senet.py#L203-L316 | ||
IdentityPython/pysaml2 | 6badb32d212257bd83ffcc816f9b625f68281b47 | src/saml2/request.py | python | LogoutRequest.issuer | (self) | return self.message.issuer | [] | def issuer(self):
return self.message.issuer | [
"def",
"issuer",
"(",
"self",
")",
":",
"return",
"self",
".",
"message",
".",
"issuer"
] | https://github.com/IdentityPython/pysaml2/blob/6badb32d212257bd83ffcc816f9b625f68281b47/src/saml2/request.py#L196-L197 | |||
tobegit3hub/deep_image_model | 8a53edecd9e00678b278bb10f6fb4bdb1e4ee25e | java_predict_client/src/main/proto/tensorflow/contrib/tensor_forest/python/topn.py | python | TopN.insert | (self, ids, scores) | Insert the ids and scores into the TopN. | Insert the ids and scores into the TopN. | [
"Insert",
"the",
"ids",
"and",
"scores",
"into",
"the",
"TopN",
"."
] | def insert(self, ids, scores):
"""Insert the ids and scores into the TopN."""
with tf.control_dependencies(self.last_ops):
scatter_op = tf.scatter_update(self.id_to_score, ids, scores)
larger_scores = tf.greater(scores, self.sl_scores[0])
def shortlist_insert():
larger_ids = tf.boolea... | [
"def",
"insert",
"(",
"self",
",",
"ids",
",",
"scores",
")",
":",
"with",
"tf",
".",
"control_dependencies",
"(",
"self",
".",
"last_ops",
")",
":",
"scatter_op",
"=",
"tf",
".",
"scatter_update",
"(",
"self",
".",
"id_to_score",
",",
"ids",
",",
"sco... | https://github.com/tobegit3hub/deep_image_model/blob/8a53edecd9e00678b278bb10f6fb4bdb1e4ee25e/java_predict_client/src/main/proto/tensorflow/contrib/tensor_forest/python/topn.py#L81-L101 | ||
cpbotha/nvpy | 844e8e5ad67cbae91603e95703b5fc34e78675ab | nvpy/view.py | python | View.set_search_mode | (self, search_mode, silent=False) | @param search_mode: the search mode, "gstyle" or "regexp"
@param silent: Specify True if you don't want the view to trigger any events.
@return: | [] | def set_search_mode(self, search_mode, silent=False):
"""
@param search_mode: the search mode, "gstyle" or "regexp"
@param silent: Specify True if you don't want the view to trigger any events.
@return:
"""
if silent:
self.mute('change:search_mode')
... | [
"def",
"set_search_mode",
"(",
"self",
",",
"search_mode",
",",
"silent",
"=",
"False",
")",
":",
"if",
"silent",
":",
"self",
".",
"mute",
"(",
"'change:search_mode'",
")",
"self",
".",
"search_mode_var",
".",
"set",
"(",
"search_mode",
")",
"self",
".",
... | https://github.com/cpbotha/nvpy/blob/844e8e5ad67cbae91603e95703b5fc34e78675ab/nvpy/view.py#L2018-L2031 | |||
cackharot/suds-py3 | 1d92cc6297efee31bfd94b50b99c431505d7de21 | suds/xsd/sxbase.py | python | SchemaObject.extension | (self) | return False | Get whether the object is an extension of another type.
@return: True if an extension, else False.
@rtype: boolean | Get whether the object is an extension of another type. | [
"Get",
"whether",
"the",
"object",
"is",
"an",
"extension",
"of",
"another",
"type",
"."
] | def extension(self):
"""
Get whether the object is an extension of another type.
@return: True if an extension, else False.
@rtype: boolean
"""
return False | [
"def",
"extension",
"(",
"self",
")",
":",
"return",
"False"
] | https://github.com/cackharot/suds-py3/blob/1d92cc6297efee31bfd94b50b99c431505d7de21/suds/xsd/sxbase.py#L285-L291 | |
Antergos/Cnchi | 13ac2209da9432d453e0097cf48a107640b563a9 | src/main_window.py | python | MainWindow.on_exit_button_clicked | (self, _widget, _data=None) | Quit Cnchi | Quit Cnchi | [
"Quit",
"Cnchi"
] | def on_exit_button_clicked(self, _widget, _data=None):
""" Quit Cnchi """
try:
misc.remove_temp_files(self.settings.get('temp'))
logging.info("Quiting installer...")
for proc in multiprocessing.active_children():
proc.terminate()
logging.sh... | [
"def",
"on_exit_button_clicked",
"(",
"self",
",",
"_widget",
",",
"_data",
"=",
"None",
")",
":",
"try",
":",
"misc",
".",
"remove_temp_files",
"(",
"self",
".",
"settings",
".",
"get",
"(",
"'temp'",
")",
")",
"logging",
".",
"info",
"(",
"\"Quiting in... | https://github.com/Antergos/Cnchi/blob/13ac2209da9432d453e0097cf48a107640b563a9/src/main_window.py#L434-L443 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.