nwo stringlengths 5 86 | sha stringlengths 40 40 | path stringlengths 4 189 | language stringclasses 1
value | identifier stringlengths 1 94 | parameters stringlengths 2 4.03k | argument_list stringclasses 1
value | return_statement stringlengths 0 11.5k | docstring stringlengths 1 33.2k | docstring_summary stringlengths 0 5.15k | docstring_tokens list | function stringlengths 34 151k | function_tokens list | url stringlengths 90 278 |
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
wxWidgets/wxPython-Classic | 19571e1ae65f1ac445f5491474121998c97a1bf0 | src/msw/_core.py | python | Control.FindAccelIndex | (*args, **kwargs) | return _core_.Control_FindAccelIndex(*args, **kwargs) | FindAccelIndex(String label) -> int
Return the accel index in the string or -1 if none. | FindAccelIndex(String label) -> int | [
"FindAccelIndex",
"(",
"String",
"label",
")",
"-",
">",
"int"
] | def FindAccelIndex(*args, **kwargs):
"""
FindAccelIndex(String label) -> int
Return the accel index in the string or -1 if none.
"""
return _core_.Control_FindAccelIndex(*args, **kwargs) | [
"def",
"FindAccelIndex",
"(",
"*",
"args",
",",
"*",
"*",
"kwargs",
")",
":",
"return",
"_core_",
".",
"Control_FindAccelIndex",
"(",
"*",
"args",
",",
"*",
"*",
"kwargs",
")"
] | https://github.com/wxWidgets/wxPython-Classic/blob/19571e1ae65f1ac445f5491474121998c97a1bf0/src/msw/_core.py#L12734-L12740 | |
Xilinx/Vitis-AI | fc74d404563d9951b57245443c73bef389f3657f | tools/Vitis-AI-Quantizer/vai_q_tensorflow1.x/tensorflow/contrib/model_pruning/python/pruning.py | python | Pruning.add_pruning_summaries | (self) | Adds summaries of weight sparsities and thresholds. | Adds summaries of weight sparsities and thresholds. | [
"Adds",
"summaries",
"of",
"weight",
"sparsities",
"and",
"thresholds",
"."
] | def add_pruning_summaries(self):
"""Adds summaries of weight sparsities and thresholds."""
with ops.name_scope(self._spec.name + '_summaries'):
summary.scalar('sparsity', self._sparsity)
summary.scalar('last_mask_update_step', self._last_update_step)
masks = get_masks()
thresholds = get_... | [
"def",
"add_pruning_summaries",
"(",
"self",
")",
":",
"with",
"ops",
".",
"name_scope",
"(",
"self",
".",
"_spec",
".",
"name",
"+",
"'_summaries'",
")",
":",
"summary",
".",
"scalar",
"(",
"'sparsity'",
",",
"self",
".",
"_sparsity",
")",
"summary",
".... | https://github.com/Xilinx/Vitis-AI/blob/fc74d404563d9951b57245443c73bef389f3657f/tools/Vitis-AI-Quantizer/vai_q_tensorflow1.x/tensorflow/contrib/model_pruning/python/pruning.py#L610-L619 | ||
adobe/chromium | cfe5bf0b51b1f6b9fe239c2a3c2f2364da9967d7 | third_party/closure_linter/closure_linter/tokenutil.py | python | InsertSpaceTokenAfter | (token) | Inserts a space token after the given token.
Args:
token: The token to insert a space token after
Returns:
A single space token | Inserts a space token after the given token. | [
"Inserts",
"a",
"space",
"token",
"after",
"the",
"given",
"token",
"."
] | def InsertSpaceTokenAfter(token):
"""Inserts a space token after the given token.
Args:
token: The token to insert a space token after
Returns:
A single space token
"""
space_token = JavaScriptToken(' ', Type.WHITESPACE, token.line,
token.line_number)
InsertTokenAft... | [
"def",
"InsertSpaceTokenAfter",
"(",
"token",
")",
":",
"space_token",
"=",
"JavaScriptToken",
"(",
"' '",
",",
"Type",
".",
"WHITESPACE",
",",
"token",
".",
"line",
",",
"token",
".",
"line_number",
")",
"InsertTokenAfter",
"(",
"space_token",
",",
"token",
... | https://github.com/adobe/chromium/blob/cfe5bf0b51b1f6b9fe239c2a3c2f2364da9967d7/third_party/closure_linter/closure_linter/tokenutil.py#L293-L304 | ||
hanpfei/chromium-net | 392cc1fa3a8f92f42e4071ab6e674d8e0482f83f | third_party/catapult/experimental/statistical_analysis/results_stats.py | python | CombinePValues | (p_values) | return p_value | Combines p-values from a number of tests using Fisher's Method.
The tests the p-values result from must test the same null hypothesis and be
independent.
Args:
p_values: List of p-values.
Returns:
combined_p_value: Combined p-value according to Fisher's method. | Combines p-values from a number of tests using Fisher's Method. | [
"Combines",
"p",
"-",
"values",
"from",
"a",
"number",
"of",
"tests",
"using",
"Fisher",
"s",
"Method",
"."
] | def CombinePValues(p_values):
"""Combines p-values from a number of tests using Fisher's Method.
The tests the p-values result from must test the same null hypothesis and be
independent.
Args:
p_values: List of p-values.
Returns:
combined_p_value: Combined p-value according to Fisher's method.
""... | [
"def",
"CombinePValues",
"(",
"p_values",
")",
":",
"# TODO (wierichs): Update to use scipy.stats.combine_pvalues(p_values) when",
"# Scipy v0.15.0 becomes available as standard version.",
"if",
"not",
"np",
":",
"raise",
"ImportError",
"(",
"'This function requires Numpy.'",
")",
... | https://github.com/hanpfei/chromium-net/blob/392cc1fa3a8f92f42e4071ab6e674d8e0482f83f/third_party/catapult/experimental/statistical_analysis/results_stats.py#L157-L179 | |
Kitware/VTK | 5b4df4d90a4f31194d97d3c639dd38ea8f81e8b8 | Wrapping/Python/vtkmodules/wx/wxVTKRenderWindow.py | python | wxVTKRenderWindow.OnMiddleUp | (self, event) | Overridable event. | Overridable event. | [
"Overridable",
"event",
"."
] | def OnMiddleUp(self, event):
"""Overridable event.
"""
pass | [
"def",
"OnMiddleUp",
"(",
"self",
",",
"event",
")",
":",
"pass"
] | https://github.com/Kitware/VTK/blob/5b4df4d90a4f31194d97d3c639dd38ea8f81e8b8/Wrapping/Python/vtkmodules/wx/wxVTKRenderWindow.py#L442-L445 | ||
aws/lumberyard | f85344403c1c2e77ec8c75deb2c116e97b713217 | dev/Tools/Python/3.7.10/linux_x64/lib/python3.7/site-packages/wheel/macosx_libfile.py | python | calculate_macosx_platform_tag | (archive_root, platform_tag) | return platform_tag | Calculate proper macosx platform tag basing on files which are included to wheel
Example platform tag `macosx-10.14-x86_64` | Calculate proper macosx platform tag basing on files which are included to wheel | [
"Calculate",
"proper",
"macosx",
"platform",
"tag",
"basing",
"on",
"files",
"which",
"are",
"included",
"to",
"wheel"
] | def calculate_macosx_platform_tag(archive_root, platform_tag):
"""
Calculate proper macosx platform tag basing on files which are included to wheel
Example platform tag `macosx-10.14-x86_64`
"""
prefix, base_version, suffix = platform_tag.split('-')
base_version = tuple([int(x) for x in base_ve... | [
"def",
"calculate_macosx_platform_tag",
"(",
"archive_root",
",",
"platform_tag",
")",
":",
"prefix",
",",
"base_version",
",",
"suffix",
"=",
"platform_tag",
".",
"split",
"(",
"'-'",
")",
"base_version",
"=",
"tuple",
"(",
"[",
"int",
"(",
"x",
")",
"for",... | https://github.com/aws/lumberyard/blob/f85344403c1c2e77ec8c75deb2c116e97b713217/dev/Tools/Python/3.7.10/linux_x64/lib/python3.7/site-packages/wheel/macosx_libfile.py#L359-L428 | |
pmq20/node-packer | 12c46c6e44fbc14d9ee645ebd17d5296b324f7e0 | lts/deps/v8/third_party/jinja2/filters.py | python | do_urlize | (eval_ctx, value, trim_url_limit=None, nofollow=False,
target=None, rel=None) | return rv | Converts URLs in plain text into clickable links.
If you pass the filter an additional integer it will shorten the urls
to that number. Also a third argument exists that makes the urls
"nofollow":
.. sourcecode:: jinja
{{ mytext|urlize(40, true) }}
links are shortened to 40 chars ... | Converts URLs in plain text into clickable links. | [
"Converts",
"URLs",
"in",
"plain",
"text",
"into",
"clickable",
"links",
"."
] | def do_urlize(eval_ctx, value, trim_url_limit=None, nofollow=False,
target=None, rel=None):
"""Converts URLs in plain text into clickable links.
If you pass the filter an additional integer it will shorten the urls
to that number. Also a third argument exists that makes the urls
"nofollow... | [
"def",
"do_urlize",
"(",
"eval_ctx",
",",
"value",
",",
"trim_url_limit",
"=",
"None",
",",
"nofollow",
"=",
"False",
",",
"target",
"=",
"None",
",",
"rel",
"=",
"None",
")",
":",
"policies",
"=",
"eval_ctx",
".",
"environment",
".",
"policies",
"rel",
... | https://github.com/pmq20/node-packer/blob/12c46c6e44fbc14d9ee645ebd17d5296b324f7e0/lts/deps/v8/third_party/jinja2/filters.py#L499-L533 | |
oracle/graaljs | 36a56e8e993d45fc40939a3a4d9c0c24990720f1 | graal-nodejs/deps/npm/node_modules/node-gyp/gyp/pylib/gyp/generator/msvs.py | python | _GetLibraries | (spec) | return unique_libraries_list | Returns the list of libraries for this configuration.
Arguments:
spec: The target dictionary containing the properties of the target.
Returns:
The list of directory paths. | Returns the list of libraries for this configuration. | [
"Returns",
"the",
"list",
"of",
"libraries",
"for",
"this",
"configuration",
"."
] | def _GetLibraries(spec):
"""Returns the list of libraries for this configuration.
Arguments:
spec: The target dictionary containing the properties of the target.
Returns:
The list of directory paths.
"""
libraries = spec.get("libraries", [])
# Strip out -l, as it is not used on windows (but i... | [
"def",
"_GetLibraries",
"(",
"spec",
")",
":",
"libraries",
"=",
"spec",
".",
"get",
"(",
"\"libraries\"",
",",
"[",
"]",
")",
"# Strip out -l, as it is not used on windows (but is needed so we can pass",
"# in libraries that are assumed to be in the default library path).",
"#... | https://github.com/oracle/graaljs/blob/36a56e8e993d45fc40939a3a4d9c0c24990720f1/graal-nodejs/deps/npm/node_modules/node-gyp/gyp/pylib/gyp/generator/msvs.py#L1290-L1313 | |
mindspore-ai/mindspore | fb8fd3338605bb34fa5cea054e535a8b1d753fab | mindspore/python/mindspore/ops/_op_impl/tbe/greater_ds.py | python | _greater_ds_tbe | () | return | Greater TBE register | Greater TBE register | [
"Greater",
"TBE",
"register"
] | def _greater_ds_tbe():
"""Greater TBE register"""
return | [
"def",
"_greater_ds_tbe",
"(",
")",
":",
"return"
] | https://github.com/mindspore-ai/mindspore/blob/fb8fd3338605bb34fa5cea054e535a8b1d753fab/mindspore/python/mindspore/ops/_op_impl/tbe/greater_ds.py#L40-L42 | |
okex/V3-Open-API-SDK | c5abb0db7e2287718e0055e17e57672ce0ec7fd9 | okex-python-sdk-api/venv/Lib/site-packages/pip-19.0.3-py3.8.egg/pip/_vendor/six.py | python | ensure_text | (s, encoding='utf-8', errors='strict') | Coerce *s* to six.text_type.
For Python 2:
- `unicode` -> `unicode`
- `str` -> `unicode`
For Python 3:
- `str` -> `str`
- `bytes` -> decoded to `str` | Coerce *s* to six.text_type. | [
"Coerce",
"*",
"s",
"*",
"to",
"six",
".",
"text_type",
"."
] | def ensure_text(s, encoding='utf-8', errors='strict'):
"""Coerce *s* to six.text_type.
For Python 2:
- `unicode` -> `unicode`
- `str` -> `unicode`
For Python 3:
- `str` -> `str`
- `bytes` -> decoded to `str`
"""
if isinstance(s, binary_type):
return s.decode(encodin... | [
"def",
"ensure_text",
"(",
"s",
",",
"encoding",
"=",
"'utf-8'",
",",
"errors",
"=",
"'strict'",
")",
":",
"if",
"isinstance",
"(",
"s",
",",
"binary_type",
")",
":",
"return",
"s",
".",
"decode",
"(",
"encoding",
",",
"errors",
")",
"elif",
"isinstanc... | https://github.com/okex/V3-Open-API-SDK/blob/c5abb0db7e2287718e0055e17e57672ce0ec7fd9/okex-python-sdk-api/venv/Lib/site-packages/pip-19.0.3-py3.8.egg/pip/_vendor/six.py#L892-L908 | ||
wlanjie/AndroidFFmpeg | 7baf9122f4b8e1c74e7baf4be5c422c7a5ba5aaf | tools/fdk-aac-build/armeabi/toolchain/lib/python2.7/plat-mac/EasyDialogs.py | python | AskString | (prompt, default = "", id=261, ok=None, cancel=None) | Display a PROMPT string and a text entry field with a DEFAULT string.
Return the contents of the text entry field when the user clicks the
OK button or presses Return.
Return None when the user clicks the Cancel button.
If omitted, DEFAULT is empty.
The PROMPT and DEFAULT strings, as well as the ... | Display a PROMPT string and a text entry field with a DEFAULT string. | [
"Display",
"a",
"PROMPT",
"string",
"and",
"a",
"text",
"entry",
"field",
"with",
"a",
"DEFAULT",
"string",
"."
] | def AskString(prompt, default = "", id=261, ok=None, cancel=None):
"""Display a PROMPT string and a text entry field with a DEFAULT string.
Return the contents of the text entry field when the user clicks the
OK button or presses Return.
Return None when the user clicks the Cancel button.
If omitt... | [
"def",
"AskString",
"(",
"prompt",
",",
"default",
"=",
"\"\"",
",",
"id",
"=",
"261",
",",
"ok",
"=",
"None",
",",
"cancel",
"=",
"None",
")",
":",
"_initialize",
"(",
")",
"_interact",
"(",
")",
"d",
"=",
"GetNewDialog",
"(",
"id",
",",
"-",
"1... | https://github.com/wlanjie/AndroidFFmpeg/blob/7baf9122f4b8e1c74e7baf4be5c422c7a5ba5aaf/tools/fdk-aac-build/armeabi/toolchain/lib/python2.7/plat-mac/EasyDialogs.py#L97-L137 | ||
hanpfei/chromium-net | 392cc1fa3a8f92f42e4071ab6e674d8e0482f83f | tools/auto_bisect/bisect_perf_regression.py | python | BisectPerformanceMetrics._GetNearestV8BleedingEdgeFromTrunk | (
self, revision, v8_branch, bleeding_edge_branch, search_forward=True) | return bleeding_edge_revision | Gets the nearest V8 roll and maps to bleeding edge revision.
V8 is a bit tricky to bisect since it isn't just rolled out like blink.
Each revision on trunk might just be whatever was in bleeding edge, rolled
directly out. Or it could be some mixture of previous v8 trunk versions,
with bits and pieces c... | Gets the nearest V8 roll and maps to bleeding edge revision. | [
"Gets",
"the",
"nearest",
"V8",
"roll",
"and",
"maps",
"to",
"bleeding",
"edge",
"revision",
"."
] | def _GetNearestV8BleedingEdgeFromTrunk(
self, revision, v8_branch, bleeding_edge_branch, search_forward=True):
"""Gets the nearest V8 roll and maps to bleeding edge revision.
V8 is a bit tricky to bisect since it isn't just rolled out like blink.
Each revision on trunk might just be whatever was in b... | [
"def",
"_GetNearestV8BleedingEdgeFromTrunk",
"(",
"self",
",",
"revision",
",",
"v8_branch",
",",
"bleeding_edge_branch",
",",
"search_forward",
"=",
"True",
")",
":",
"cwd",
"=",
"self",
".",
"depot_registry",
".",
"GetDepotDir",
"(",
"'v8'",
")",
"cmd",
"=",
... | https://github.com/hanpfei/chromium-net/blob/392cc1fa3a8f92f42e4071ab6e674d8e0482f83f/tools/auto_bisect/bisect_perf_regression.py#L1690-L1744 | |
LiquidPlayer/LiquidCore | 9405979363f2353ac9a71ad8ab59685dd7f919c9 | deps/boost_1_66_0/tools/build/src/tools/common.py | python | file_creation_command | () | Return a command which can create a file. If 'r' is result of invocation, then
'r foobar' will create foobar with unspecified content. What happens if file
already exists is unspecified. | Return a command which can create a file. If 'r' is result of invocation, then
'r foobar' will create foobar with unspecified content. What happens if file
already exists is unspecified. | [
"Return",
"a",
"command",
"which",
"can",
"create",
"a",
"file",
".",
"If",
"r",
"is",
"result",
"of",
"invocation",
"then",
"r",
"foobar",
"will",
"create",
"foobar",
"with",
"unspecified",
"content",
".",
"What",
"happens",
"if",
"file",
"already",
"exis... | def file_creation_command():
"""
Return a command which can create a file. If 'r' is result of invocation, then
'r foobar' will create foobar with unspecified content. What happens if file
already exists is unspecified.
"""
if os_name() == 'NT':
return "echo. > "
else:
... | [
"def",
"file_creation_command",
"(",
")",
":",
"if",
"os_name",
"(",
")",
"==",
"'NT'",
":",
"return",
"\"echo. > \"",
"else",
":",
"return",
"\"touch \""
] | https://github.com/LiquidPlayer/LiquidCore/blob/9405979363f2353ac9a71ad8ab59685dd7f919c9/deps/boost_1_66_0/tools/build/src/tools/common.py#L555-L564 | ||
aws/lumberyard | f85344403c1c2e77ec8c75deb2c116e97b713217 | dev/Tools/Python/3.7.10/windows/Lib/site-packages/setuptools/command/easy_install.py | python | easy_install.pseudo_tempname | (self) | return os.path.join(self.install_dir, "test-easy-install-%s" % pid) | Return a pseudo-tempname base in the install directory.
This code is intentionally naive; if a malicious party can write to
the target directory you're already in deep doodoo. | Return a pseudo-tempname base in the install directory.
This code is intentionally naive; if a malicious party can write to
the target directory you're already in deep doodoo. | [
"Return",
"a",
"pseudo",
"-",
"tempname",
"base",
"in",
"the",
"install",
"directory",
".",
"This",
"code",
"is",
"intentionally",
"naive",
";",
"if",
"a",
"malicious",
"party",
"can",
"write",
"to",
"the",
"target",
"directory",
"you",
"re",
"already",
"i... | def pseudo_tempname(self):
"""Return a pseudo-tempname base in the install directory.
This code is intentionally naive; if a malicious party can write to
the target directory you're already in deep doodoo.
"""
try:
pid = os.getpid()
except Exception:
... | [
"def",
"pseudo_tempname",
"(",
"self",
")",
":",
"try",
":",
"pid",
"=",
"os",
".",
"getpid",
"(",
")",
"except",
"Exception",
":",
"pid",
"=",
"random",
".",
"randint",
"(",
"0",
",",
"sys",
".",
"maxsize",
")",
"return",
"os",
".",
"path",
".",
... | https://github.com/aws/lumberyard/blob/f85344403c1c2e77ec8c75deb2c116e97b713217/dev/Tools/Python/3.7.10/windows/Lib/site-packages/setuptools/command/easy_install.py#L442-L451 | |
hanpfei/chromium-net | 392cc1fa3a8f92f42e4071ab6e674d8e0482f83f | third_party/catapult/telemetry/third_party/web-page-replay/third_party/dns/message.py | python | _WireReader._get_question | (self, qcount) | Read the next I{qcount} records from the wire data and add them to
the question section.
@param qcount: the number of questions in the message
@type qcount: int | Read the next I{qcount} records from the wire data and add them to
the question section. | [
"Read",
"the",
"next",
"I",
"{",
"qcount",
"}",
"records",
"from",
"the",
"wire",
"data",
"and",
"add",
"them",
"to",
"the",
"question",
"section",
"."
] | def _get_question(self, qcount):
"""Read the next I{qcount} records from the wire data and add them to
the question section.
@param qcount: the number of questions in the message
@type qcount: int"""
if self.updating and qcount > 1:
raise dns.exception.FormError
... | [
"def",
"_get_question",
"(",
"self",
",",
"qcount",
")",
":",
"if",
"self",
".",
"updating",
"and",
"qcount",
">",
"1",
":",
"raise",
"dns",
".",
"exception",
".",
"FormError",
"for",
"i",
"in",
"xrange",
"(",
"0",
",",
"qcount",
")",
":",
"(",
"qn... | https://github.com/hanpfei/chromium-net/blob/392cc1fa3a8f92f42e4071ab6e674d8e0482f83f/third_party/catapult/telemetry/third_party/web-page-replay/third_party/dns/message.py#L584-L606 | ||
mantidproject/mantid | 03deeb89254ec4289edb8771e0188c2090a02f32 | qt/python/mantidqtinterfaces/mantidqtinterfaces/HFIR_4Circle_Reduction/hfctables.py | python | SinglePtIntegrationTable.set_reference_scan_numbers | (self, row_index, ref_numbers) | set reference scan numbers or warning as 'No match'
:param row_index:
:param ref_numbers:
:return: | set reference scan numbers or warning as 'No match'
:param row_index:
:param ref_numbers:
:return: | [
"set",
"reference",
"scan",
"numbers",
"or",
"warning",
"as",
"No",
"match",
":",
"param",
"row_index",
":",
":",
"param",
"ref_numbers",
":",
":",
"return",
":"
] | def set_reference_scan_numbers(self, row_index, ref_numbers):
""" set reference scan numbers or warning as 'No match'
:param row_index:
:param ref_numbers:
:return:
"""
# process the reference number
if isinstance(ref_numbers, str):
scans_str = ref_num... | [
"def",
"set_reference_scan_numbers",
"(",
"self",
",",
"row_index",
",",
"ref_numbers",
")",
":",
"# process the reference number",
"if",
"isinstance",
"(",
"ref_numbers",
",",
"str",
")",
":",
"scans_str",
"=",
"ref_numbers",
"elif",
"isinstance",
"(",
"ref_numbers... | https://github.com/mantidproject/mantid/blob/03deeb89254ec4289edb8771e0188c2090a02f32/qt/python/mantidqtinterfaces/mantidqtinterfaces/HFIR_4Circle_Reduction/hfctables.py#L1567-L1588 | ||
catboost/catboost | 167f64f237114a4d10b2b4ee42adb4569137debe | contrib/tools/python/src/Lib/pydoc.py | python | apropos | (key) | Print all the one-line module summaries that contain a substring. | Print all the one-line module summaries that contain a substring. | [
"Print",
"all",
"the",
"one",
"-",
"line",
"module",
"summaries",
"that",
"contain",
"a",
"substring",
"."
] | def apropos(key):
"""Print all the one-line module summaries that contain a substring."""
def callback(path, modname, desc):
if modname[-9:] == '.__init__':
modname = modname[:-9] + ' (package)'
print modname, desc and '- ' + desc
def onerror(modname):
pass
with warni... | [
"def",
"apropos",
"(",
"key",
")",
":",
"def",
"callback",
"(",
"path",
",",
"modname",
",",
"desc",
")",
":",
"if",
"modname",
"[",
"-",
"9",
":",
"]",
"==",
"'.__init__'",
":",
"modname",
"=",
"modname",
"[",
":",
"-",
"9",
"]",
"+",
"' (packag... | https://github.com/catboost/catboost/blob/167f64f237114a4d10b2b4ee42adb4569137debe/contrib/tools/python/src/Lib/pydoc.py#L2038-L2048 | ||
natanielruiz/android-yolo | 1ebb54f96a67a20ff83ddfc823ed83a13dc3a47f | jni-build/jni/include/tensorflow/python/client/timeline.py | python | Timeline._assign_lanes | (self) | Assigns non-overlapping lanes for the activities on each device. | Assigns non-overlapping lanes for the activities on each device. | [
"Assigns",
"non",
"-",
"overlapping",
"lanes",
"for",
"the",
"activities",
"on",
"each",
"device",
"."
] | def _assign_lanes(self):
"""Assigns non-overlapping lanes for the activities on each device."""
for device_stats in self._step_stats.dev_stats:
# TODO(pbar): Genuine thread IDs in NodeExecStats might be helpful.
lanes = [0]
for ns in device_stats.node_stats:
l = -1
for (i, lts)... | [
"def",
"_assign_lanes",
"(",
"self",
")",
":",
"for",
"device_stats",
"in",
"self",
".",
"_step_stats",
".",
"dev_stats",
":",
"# TODO(pbar): Genuine thread IDs in NodeExecStats might be helpful.",
"lanes",
"=",
"[",
"0",
"]",
"for",
"ns",
"in",
"device_stats",
".",... | https://github.com/natanielruiz/android-yolo/blob/1ebb54f96a67a20ff83ddfc823ed83a13dc3a47f/jni-build/jni/include/tensorflow/python/client/timeline.py#L397-L412 | ||
tiny-dnn/tiny-dnn | c0f576f5cb7b35893f62127cb7aec18f77a3bcc5 | third_party/cpplint.py | python | FlagCxx11Features | (filename, clean_lines, linenum, error) | Flag those c++11 features that we only allow in certain places.
Args:
filename: The name of the current file.
clean_lines: A CleansedLines instance containing the file.
linenum: The number of the line to check.
error: The function to call with any errors found. | Flag those c++11 features that we only allow in certain places. | [
"Flag",
"those",
"c",
"++",
"11",
"features",
"that",
"we",
"only",
"allow",
"in",
"certain",
"places",
"."
] | def FlagCxx11Features(filename, clean_lines, linenum, error):
"""Flag those c++11 features that we only allow in certain places.
Args:
filename: The name of the current file.
clean_lines: A CleansedLines instance containing the file.
linenum: The number of the line to check.
error: The function to ... | [
"def",
"FlagCxx11Features",
"(",
"filename",
",",
"clean_lines",
",",
"linenum",
",",
"error",
")",
":",
"line",
"=",
"clean_lines",
".",
"elided",
"[",
"linenum",
"]",
"include",
"=",
"Match",
"(",
"r'\\s*#\\s*include\\s+[<\"]([^<\"]+)[\">]'",
",",
"line",
")",... | https://github.com/tiny-dnn/tiny-dnn/blob/c0f576f5cb7b35893f62127cb7aec18f77a3bcc5/third_party/cpplint.py#L5983-L6032 | ||
aws/lumberyard | f85344403c1c2e77ec8c75deb2c116e97b713217 | dev/Gems/CloudGemMetric/v1/AWS/python/windows/Lib/pandas/core/indexes/base.py | python | Index._add_logical_methods_disabled | (cls) | Add in logical methods to disable. | Add in logical methods to disable. | [
"Add",
"in",
"logical",
"methods",
"to",
"disable",
"."
] | def _add_logical_methods_disabled(cls):
"""
Add in logical methods to disable.
"""
cls.all = make_invalid_op("all")
cls.any = make_invalid_op("any") | [
"def",
"_add_logical_methods_disabled",
"(",
"cls",
")",
":",
"cls",
".",
"all",
"=",
"make_invalid_op",
"(",
"\"all\"",
")",
"cls",
".",
"any",
"=",
"make_invalid_op",
"(",
"\"any\"",
")"
] | https://github.com/aws/lumberyard/blob/f85344403c1c2e77ec8c75deb2c116e97b713217/dev/Gems/CloudGemMetric/v1/AWS/python/windows/Lib/pandas/core/indexes/base.py#L5229-L5234 | ||
amd/OpenCL-caffe | 638543108517265366c18ae5821f3096cf5cf34a | scripts/cpp_lint.py | python | GetLineWidth | (line) | Determines the width of the line in column positions.
Args:
line: A string, which may be a Unicode string.
Returns:
The width of the line in column positions, accounting for Unicode
combining characters and wide characters. | Determines the width of the line in column positions. | [
"Determines",
"the",
"width",
"of",
"the",
"line",
"in",
"column",
"positions",
"."
] | def GetLineWidth(line):
"""Determines the width of the line in column positions.
Args:
line: A string, which may be a Unicode string.
Returns:
The width of the line in column positions, accounting for Unicode
combining characters and wide characters.
"""
if isinstance(line, unicode):
width =... | [
"def",
"GetLineWidth",
"(",
"line",
")",
":",
"if",
"isinstance",
"(",
"line",
",",
"unicode",
")",
":",
"width",
"=",
"0",
"for",
"uc",
"in",
"unicodedata",
".",
"normalize",
"(",
"'NFC'",
",",
"line",
")",
":",
"if",
"unicodedata",
".",
"east_asian_w... | https://github.com/amd/OpenCL-caffe/blob/638543108517265366c18ae5821f3096cf5cf34a/scripts/cpp_lint.py#L3437-L3456 | ||
hpi-xnor/BMXNet | ed0b201da6667887222b8e4b5f997c4f6b61943d | tools/caffe_converter/convert_symbol.py | python | convert_symbol | (prototxt_fname) | return ret, input_dim | Convert caffe model definition into Symbol
Parameters
----------
prototxt_fname : str
Filename of the prototxt file
Returns
-------
Symbol
Converted Symbol
tuple
Input shape | Convert caffe model definition into Symbol | [
"Convert",
"caffe",
"model",
"definition",
"into",
"Symbol"
] | def convert_symbol(prototxt_fname):
"""Convert caffe model definition into Symbol
Parameters
----------
prototxt_fname : str
Filename of the prototxt file
Returns
-------
Symbol
Converted Symbol
tuple
Input shape
"""
sym, output_name, input_dim = _parse_... | [
"def",
"convert_symbol",
"(",
"prototxt_fname",
")",
":",
"sym",
",",
"output_name",
",",
"input_dim",
"=",
"_parse_proto",
"(",
"prototxt_fname",
")",
"exec",
"(",
"sym",
")",
"# pylint: disable=exec-used",
"_locals",
"=",
"locals",
"(",
")",
"ret",
"=",
"[",... | https://github.com/hpi-xnor/BMXNet/blob/ed0b201da6667887222b8e4b5f997c4f6b61943d/tools/caffe_converter/convert_symbol.py#L295-L318 | |
baidu-research/tensorflow-allreduce | 66d5b855e90b0949e9fa5cca5599fd729a70e874 | tensorflow/python/ops/data_flow_ops.py | python | BaseStagingArea._scope_vals | (self, vals) | Return a list of values to pass to `name_scope()`.
Args:
vals: A tensor, a list or tuple of tensors, or a dictionary.
Returns:
The values in vals as a list. | Return a list of values to pass to `name_scope()`. | [
"Return",
"a",
"list",
"of",
"values",
"to",
"pass",
"to",
"name_scope",
"()",
"."
] | def _scope_vals(self, vals):
"""Return a list of values to pass to `name_scope()`.
Args:
vals: A tensor, a list or tuple of tensors, or a dictionary.
Returns:
The values in vals as a list.
"""
if isinstance(vals, (list, tuple)):
return vals
elif isinstance(vals, dict):
... | [
"def",
"_scope_vals",
"(",
"self",
",",
"vals",
")",
":",
"if",
"isinstance",
"(",
"vals",
",",
"(",
"list",
",",
"tuple",
")",
")",
":",
"return",
"vals",
"elif",
"isinstance",
"(",
"vals",
",",
"dict",
")",
":",
"return",
"vals",
".",
"values",
"... | https://github.com/baidu-research/tensorflow-allreduce/blob/66d5b855e90b0949e9fa5cca5599fd729a70e874/tensorflow/python/ops/data_flow_ops.py#L1559-L1573 | ||
PaddlePaddle/Paddle | 1252f4bb3e574df80aa6d18c7ddae1b3a90bd81c | python/paddle/vision/transforms/functional.py | python | hflip | (img) | Horizontally flips the given Image or np.array.
Args:
img (PIL.Image|np.array): Image to be flipped.
Returns:
PIL.Image or np.array: Horizontall flipped image.
Examples:
.. code-block:: python
import numpy as np
from PIL import Image
from padd... | Horizontally flips the given Image or np.array. | [
"Horizontally",
"flips",
"the",
"given",
"Image",
"or",
"np",
".",
"array",
"."
] | def hflip(img):
"""Horizontally flips the given Image or np.array.
Args:
img (PIL.Image|np.array): Image to be flipped.
Returns:
PIL.Image or np.array: Horizontall flipped image.
Examples:
.. code-block:: python
import numpy as np
from PIL import Imag... | [
"def",
"hflip",
"(",
"img",
")",
":",
"if",
"not",
"(",
"_is_pil_image",
"(",
"img",
")",
"or",
"_is_numpy_image",
"(",
"img",
")",
"or",
"_is_tensor_image",
"(",
"img",
")",
")",
":",
"raise",
"TypeError",
"(",
"'img should be PIL Image or Tensor Image or nda... | https://github.com/PaddlePaddle/Paddle/blob/1252f4bb3e574df80aa6d18c7ddae1b3a90bd81c/python/paddle/vision/transforms/functional.py#L291-L326 | ||
BitMEX/api-connectors | 37a3a5b806ad5d0e0fc975ab86d9ed43c3bcd812 | auto-generated/python/swagger_client/models/position.py | python | Position.current_comm | (self) | return self._current_comm | Gets the current_comm of this Position. # noqa: E501
:return: The current_comm of this Position. # noqa: E501
:rtype: float | Gets the current_comm of this Position. # noqa: E501 | [
"Gets",
"the",
"current_comm",
"of",
"this",
"Position",
".",
"#",
"noqa",
":",
"E501"
] | def current_comm(self):
"""Gets the current_comm of this Position. # noqa: E501
:return: The current_comm of this Position. # noqa: E501
:rtype: float
"""
return self._current_comm | [
"def",
"current_comm",
"(",
"self",
")",
":",
"return",
"self",
".",
"_current_comm"
] | https://github.com/BitMEX/api-connectors/blob/37a3a5b806ad5d0e0fc975ab86d9ed43c3bcd812/auto-generated/python/swagger_client/models/position.py#L1260-L1267 | |
ApolloAuto/apollo-platform | 86d9dc6743b496ead18d597748ebabd34a513289 | ros/third_party/lib_aarch64/python2.7/dist-packages/catkin_pkg/changelog.py | python | bullet_list_class_from_docutils | (bullet_list, bullet_type=None) | return content | Processes elements of bullet list into an encapsulating class
:param bullet_list: ``docutils.nodes.bullet_list`` list to be processed
:param bullet_type: ``str`` either 'bullet' or 'enumerated'
:returns: ``BulletList`` object representing a docutils bullet_list | Processes elements of bullet list into an encapsulating class | [
"Processes",
"elements",
"of",
"bullet",
"list",
"into",
"an",
"encapsulating",
"class"
] | def bullet_list_class_from_docutils(bullet_list, bullet_type=None):
'''
Processes elements of bullet list into an encapsulating class
:param bullet_list: ``docutils.nodes.bullet_list`` list to be processed
:param bullet_type: ``str`` either 'bullet' or 'enumerated'
:returns: ``BulletList`` object r... | [
"def",
"bullet_list_class_from_docutils",
"(",
"bullet_list",
",",
"bullet_type",
"=",
"None",
")",
":",
"content",
"=",
"BulletList",
"(",
"bullet_type",
"=",
"bullet_type",
")",
"for",
"child",
"in",
"bullet_list",
".",
"children",
":",
"if",
"isinstance",
"("... | https://github.com/ApolloAuto/apollo-platform/blob/86d9dc6743b496ead18d597748ebabd34a513289/ros/third_party/lib_aarch64/python2.7/dist-packages/catkin_pkg/changelog.py#L126-L140 | |
Xilinx/Vitis-AI | fc74d404563d9951b57245443c73bef389f3657f | tools/Vitis-AI-Quantizer/vai_q_tensorflow1.x/tensorflow/contrib/learn/python/learn/metric_spec.py | python | _adapt_metric_fn | (
metric_fn, metric_fn_name, is_labels_required, is_weights_required) | return _positional_no_labels_metric_fn | Adapt `metric_fn` to take only named args.
This returns a function that takes only named args `labels`, `predictions`,
and `weights`, and invokes `metric_fn` according to the following rules:
- If `metric_fn` args include exactly one of `_LABELS_ARGS`, that arg is
passed (usually by name, but positionally if... | Adapt `metric_fn` to take only named args. | [
"Adapt",
"metric_fn",
"to",
"take",
"only",
"named",
"args",
"."
] | def _adapt_metric_fn(
metric_fn, metric_fn_name, is_labels_required, is_weights_required):
"""Adapt `metric_fn` to take only named args.
This returns a function that takes only named args `labels`, `predictions`,
and `weights`, and invokes `metric_fn` according to the following rules:
- If `metric_fn` args... | [
"def",
"_adapt_metric_fn",
"(",
"metric_fn",
",",
"metric_fn_name",
",",
"is_labels_required",
",",
"is_weights_required",
")",
":",
"args",
"=",
"_args",
"(",
"metric_fn",
")",
"labels_arg",
"=",
"_matching_arg",
"(",
"metric_fn_name",
",",
"args",
",",
"_LABELS_... | https://github.com/Xilinx/Vitis-AI/blob/fc74d404563d9951b57245443c73bef389f3657f/tools/Vitis-AI-Quantizer/vai_q_tensorflow1.x/tensorflow/contrib/learn/python/learn/metric_spec.py#L112-L226 | |
wxWidgets/wxPython-Classic | 19571e1ae65f1ac445f5491474121998c97a1bf0 | src/osx_carbon/_windows.py | python | SashEvent.SetEdge | (*args, **kwargs) | return _windows_.SashEvent_SetEdge(*args, **kwargs) | SetEdge(self, int edge) | SetEdge(self, int edge) | [
"SetEdge",
"(",
"self",
"int",
"edge",
")"
] | def SetEdge(*args, **kwargs):
"""SetEdge(self, int edge)"""
return _windows_.SashEvent_SetEdge(*args, **kwargs) | [
"def",
"SetEdge",
"(",
"*",
"args",
",",
"*",
"*",
"kwargs",
")",
":",
"return",
"_windows_",
".",
"SashEvent_SetEdge",
"(",
"*",
"args",
",",
"*",
"*",
"kwargs",
")"
] | https://github.com/wxWidgets/wxPython-Classic/blob/19571e1ae65f1ac445f5491474121998c97a1bf0/src/osx_carbon/_windows.py#L1902-L1904 | |
Kitware/ParaView | f760af9124ff4634b23ebbeab95a4f56e0261955 | Plugins/pvblot/blotish.py | python | color | (ncol=None) | Set the maximum number of standard color scale colors to use on a color
plot to ncol. | Set the maximum number of standard color scale colors to use on a color
plot to ncol. | [
"Set",
"the",
"maximum",
"number",
"of",
"standard",
"color",
"scale",
"colors",
"to",
"use",
"on",
"a",
"color",
"plot",
"to",
"ncol",
"."
] | def color(ncol=None):
"""
Set the maximum number of standard color scale colors to use on a color
plot to ncol.
"""
maxColors = len(_standard_colors)
if not ncol:
print "Set to", state.numBlockColors, "of", maxColors, "colors."
return
ncol = int(ncol)
if ncol > maxColors... | [
"def",
"color",
"(",
"ncol",
"=",
"None",
")",
":",
"maxColors",
"=",
"len",
"(",
"_standard_colors",
")",
"if",
"not",
"ncol",
":",
"print",
"\"Set to\"",
",",
"state",
".",
"numBlockColors",
",",
"\"of\"",
",",
"maxColors",
",",
"\"colors.\"",
"return",
... | https://github.com/Kitware/ParaView/blob/f760af9124ff4634b23ebbeab95a4f56e0261955/Plugins/pvblot/blotish.py#L583-L600 | ||
microsoft/Azure-Kinect-Sensor-SDK | d87ef578676c05b9a5d23c097502942753bf3777 | src/python/k4a/src/k4a/_bindings/image.py | python | Image.create | (
image_format:EImageFormat,
width_pixels:int,
height_pixels:int,
stride_bytes:int) | return image | ! Create an image.
@param image_format (EImageFormat): The format of the image that will
be stored in this image container.
@param width_pixels (int): Width in pixels.
@param height_pixels (int): Height in pixels.
@param stride_bytes (int): The number of bytes per horizon... | ! Create an image. | [
"!",
"Create",
"an",
"image",
"."
] | def create(
image_format:EImageFormat,
width_pixels:int,
height_pixels:int,
stride_bytes:int):
'''! Create an image.
@param image_format (EImageFormat): The format of the image that will
be stored in this image container.
@param width_pixels (int): W... | [
"def",
"create",
"(",
"image_format",
":",
"EImageFormat",
",",
"width_pixels",
":",
"int",
",",
"height_pixels",
":",
"int",
",",
"stride_bytes",
":",
"int",
")",
":",
"image",
"=",
"None",
"assert",
"(",
"isinstance",
"(",
"image_format",
",",
"EImageForma... | https://github.com/microsoft/Azure-Kinect-Sensor-SDK/blob/d87ef578676c05b9a5d23c097502942753bf3777/src/python/k4a/src/k4a/_bindings/image.py#L284-L348 | |
rdkit/rdkit | ede860ae316d12d8568daf5ee800921c3389c84e | rdkit/Chem/MACCSkeys.py | python | _InitKeys | (keyList, keyDict) | *Internal Use Only*
generates SMARTS patterns for the keys, run once | *Internal Use Only* | [
"*",
"Internal",
"Use",
"Only",
"*"
] | def _InitKeys(keyList, keyDict):
""" *Internal Use Only*
generates SMARTS patterns for the keys, run once
"""
assert len(keyList) == len(keyDict.keys()), 'length mismatch'
for key in keyDict.keys():
patt, count = keyDict[key]
if patt != '?':
sma = Chem.MolFromSmarts(patt)
if not sma:
... | [
"def",
"_InitKeys",
"(",
"keyList",
",",
"keyDict",
")",
":",
"assert",
"len",
"(",
"keyList",
")",
"==",
"len",
"(",
"keyDict",
".",
"keys",
"(",
")",
")",
",",
"'length mismatch'",
"for",
"key",
"in",
"keyDict",
".",
"keys",
"(",
")",
":",
"patt",
... | https://github.com/rdkit/rdkit/blob/ede860ae316d12d8568daf5ee800921c3389c84e/rdkit/Chem/MACCSkeys.py#L220-L234 | ||
TimoSaemann/caffe-segnet-cudnn5 | abcf30dca449245e101bf4ced519f716177f0885 | scripts/cpp_lint.py | python | ProcessLine | (filename, file_extension, clean_lines, line,
include_state, function_state, nesting_state, error,
extra_check_functions=[]) | Processes a single line in the file.
Args:
filename: Filename of the file that is being processed.
file_extension: The extension (dot not included) of the file.
clean_lines: An array of strings, each representing a line of the file,
with comments stripped.
line: Number of line being ... | Processes a single line in the file. | [
"Processes",
"a",
"single",
"line",
"in",
"the",
"file",
"."
] | def ProcessLine(filename, file_extension, clean_lines, line,
include_state, function_state, nesting_state, error,
extra_check_functions=[]):
"""Processes a single line in the file.
Args:
filename: Filename of the file that is being processed.
file_extension: The extension (d... | [
"def",
"ProcessLine",
"(",
"filename",
",",
"file_extension",
",",
"clean_lines",
",",
"line",
",",
"include_state",
",",
"function_state",
",",
"nesting_state",
",",
"error",
",",
"extra_check_functions",
"=",
"[",
"]",
")",
":",
"raw_lines",
"=",
"clean_lines"... | https://github.com/TimoSaemann/caffe-segnet-cudnn5/blob/abcf30dca449245e101bf4ced519f716177f0885/scripts/cpp_lint.py#L4600-L4642 | ||
hpi-xnor/BMXNet | ed0b201da6667887222b8e4b5f997c4f6b61943d | python/mxnet/image/detection.py | python | ImageDetIter.augmentation_transform | (self, data, label) | return (data, label) | Override Transforms input data with specified augmentations. | Override Transforms input data with specified augmentations. | [
"Override",
"Transforms",
"input",
"data",
"with",
"specified",
"augmentations",
"."
] | def augmentation_transform(self, data, label): # pylint: disable=arguments-differ
"""Override Transforms input data with specified augmentations."""
for aug in self.auglist:
data, label = aug(data, label)
return (data, label) | [
"def",
"augmentation_transform",
"(",
"self",
",",
"data",
",",
"label",
")",
":",
"# pylint: disable=arguments-differ",
"for",
"aug",
"in",
"self",
".",
"auglist",
":",
"data",
",",
"label",
"=",
"aug",
"(",
"data",
",",
"label",
")",
"return",
"(",
"data... | https://github.com/hpi-xnor/BMXNet/blob/ed0b201da6667887222b8e4b5f997c4f6b61943d/python/mxnet/image/detection.py#L786-L790 | |
wlanjie/AndroidFFmpeg | 7baf9122f4b8e1c74e7baf4be5c422c7a5ba5aaf | tools/fdk-aac-build/armeabi/toolchain/lib/python2.7/rexec.py | python | RExec.r_reload | (self, m) | return self.importer.reload(m) | Reload the module object, re-parsing and re-initializing it.
This method is implicitly called by code executing in the
restricted environment. Overriding this method in a subclass is
used to change the policies enforced by a restricted environment. | Reload the module object, re-parsing and re-initializing it. | [
"Reload",
"the",
"module",
"object",
"re",
"-",
"parsing",
"and",
"re",
"-",
"initializing",
"it",
"."
] | def r_reload(self, m):
"""Reload the module object, re-parsing and re-initializing it.
This method is implicitly called by code executing in the
restricted environment. Overriding this method in a subclass is
used to change the policies enforced by a restricted environment.
""... | [
"def",
"r_reload",
"(",
"self",
",",
"m",
")",
":",
"return",
"self",
".",
"importer",
".",
"reload",
"(",
"m",
")"
] | https://github.com/wlanjie/AndroidFFmpeg/blob/7baf9122f4b8e1c74e7baf4be5c422c7a5ba5aaf/tools/fdk-aac-build/armeabi/toolchain/lib/python2.7/rexec.py#L349-L357 | |
coinapi/coinapi-sdk | 854f21e7f69ea8599ae35c5403565cf299d8b795 | oeml-sdk/python/openapi_client/model/order_cancel_all_request.py | python | OrderCancelAllRequest.openapi_types | () | return {
'exchange_id': (str,), # noqa: E501
} | This must be a method because a model may have properties that are
of type self, this must run after the class is loaded
Returns
openapi_types (dict): The key is attribute name
and the value is attribute type. | This must be a method because a model may have properties that are
of type self, this must run after the class is loaded | [
"This",
"must",
"be",
"a",
"method",
"because",
"a",
"model",
"may",
"have",
"properties",
"that",
"are",
"of",
"type",
"self",
"this",
"must",
"run",
"after",
"the",
"class",
"is",
"loaded"
] | def openapi_types():
"""
This must be a method because a model may have properties that are
of type self, this must run after the class is loaded
Returns
openapi_types (dict): The key is attribute name
and the value is attribute type.
"""
retu... | [
"def",
"openapi_types",
"(",
")",
":",
"return",
"{",
"'exchange_id'",
":",
"(",
"str",
",",
")",
",",
"# noqa: E501",
"}"
] | https://github.com/coinapi/coinapi-sdk/blob/854f21e7f69ea8599ae35c5403565cf299d8b795/oeml-sdk/python/openapi_client/model/order_cancel_all_request.py#L75-L86 | |
aws/lumberyard | f85344403c1c2e77ec8c75deb2c116e97b713217 | dev/Gems/CloudGemMetric/v1/AWS/common-code/Lib/numpy/core/overrides.py | python | array_function_from_dispatcher | (
implementation, module=None, verify=True, docs_from_dispatcher=True) | return decorator | Like array_function_dispatcher, but with function arguments flipped. | Like array_function_dispatcher, but with function arguments flipped. | [
"Like",
"array_function_dispatcher",
"but",
"with",
"function",
"arguments",
"flipped",
"."
] | def array_function_from_dispatcher(
implementation, module=None, verify=True, docs_from_dispatcher=True):
"""Like array_function_dispatcher, but with function arguments flipped."""
def decorator(dispatcher):
return array_function_dispatch(
dispatcher, module, verify=verify,
... | [
"def",
"array_function_from_dispatcher",
"(",
"implementation",
",",
"module",
"=",
"None",
",",
"verify",
"=",
"True",
",",
"docs_from_dispatcher",
"=",
"True",
")",
":",
"def",
"decorator",
"(",
"dispatcher",
")",
":",
"return",
"array_function_dispatch",
"(",
... | https://github.com/aws/lumberyard/blob/f85344403c1c2e77ec8c75deb2c116e97b713217/dev/Gems/CloudGemMetric/v1/AWS/common-code/Lib/numpy/core/overrides.py#L202-L210 | |
gimli-org/gimli | 17aa2160de9b15ababd9ef99e89b1bc3277bbb23 | pygimli/physics/SIP/sipspectrum.py | python | SIPSpectrum.showAll | (self, save=False, ax=None) | return fig, ax | Plot spectrum, Cole-Cole fit and Debye distribution | Plot spectrum, Cole-Cole fit and Debye distribution | [
"Plot",
"spectrum",
"Cole",
"-",
"Cole",
"fit",
"and",
"Debye",
"distribution"
] | def showAll(self, save=False, ax=None):
"""Plot spectrum, Cole-Cole fit and Debye distribution"""
# generate title strings
if np.any(self.mCC):
mCC = self.mCC
if mCC[0] > 1:
tstr = r'CC: $\rho$={:.1f} m={:.3f} $\tau$={:.1e}s c={:.2f}'
else:
... | [
"def",
"showAll",
"(",
"self",
",",
"save",
"=",
"False",
",",
"ax",
"=",
"None",
")",
":",
"# generate title strings",
"if",
"np",
".",
"any",
"(",
"self",
".",
"mCC",
")",
":",
"mCC",
"=",
"self",
".",
"mCC",
"if",
"mCC",
"[",
"0",
"]",
">",
... | https://github.com/gimli-org/gimli/blob/17aa2160de9b15ababd9ef99e89b1bc3277bbb23/pygimli/physics/SIP/sipspectrum.py#L788-L856 | |
ros-planning/moveit2 | dd240ef6fd8b9932a7a53964140f2952786187a9 | moveit_commander/src/moveit_commander/move_group.py | python | MoveGroupCommander.set_position_target | (self, xyz, end_effector_link="") | Specify a target position for the end-effector. Any orientation of the end-effector is acceptable. | Specify a target position for the end-effector. Any orientation of the end-effector is acceptable. | [
"Specify",
"a",
"target",
"position",
"for",
"the",
"end",
"-",
"effector",
".",
"Any",
"orientation",
"of",
"the",
"end",
"-",
"effector",
"is",
"acceptable",
"."
] | def set_position_target(self, xyz, end_effector_link=""):
""" Specify a target position for the end-effector. Any orientation of the end-effector is acceptable."""
if len(end_effector_link) > 0 or self.has_end_effector_link():
if not self._g.set_position_target(
xyz[0], xyz[1... | [
"def",
"set_position_target",
"(",
"self",
",",
"xyz",
",",
"end_effector_link",
"=",
"\"\"",
")",
":",
"if",
"len",
"(",
"end_effector_link",
")",
">",
"0",
"or",
"self",
".",
"has_end_effector_link",
"(",
")",
":",
"if",
"not",
"self",
".",
"_g",
".",
... | https://github.com/ros-planning/moveit2/blob/dd240ef6fd8b9932a7a53964140f2952786187a9/moveit_commander/src/moveit_commander/move_group.py#L322-L332 | ||
Tencent/CMONGO | c40380caa14e05509f46993aa8b8da966b09b0b5 | buildscripts/packager-enterprise.py | python | tarfile | (build_os, arch, spec) | return "dl/mongodb-linux-%s-enterprise-%s-%s.tar.gz" % (spec.version(), build_os, arch) | Return the location where we store the downloaded tarball for
this package | Return the location where we store the downloaded tarball for
this package | [
"Return",
"the",
"location",
"where",
"we",
"store",
"the",
"downloaded",
"tarball",
"for",
"this",
"package"
] | def tarfile(build_os, arch, spec):
"""Return the location where we store the downloaded tarball for
this package"""
return "dl/mongodb-linux-%s-enterprise-%s-%s.tar.gz" % (spec.version(), build_os, arch) | [
"def",
"tarfile",
"(",
"build_os",
",",
"arch",
",",
"spec",
")",
":",
"return",
"\"dl/mongodb-linux-%s-enterprise-%s-%s.tar.gz\"",
"%",
"(",
"spec",
".",
"version",
"(",
")",
",",
"build_os",
",",
"arch",
")"
] | https://github.com/Tencent/CMONGO/blob/c40380caa14e05509f46993aa8b8da966b09b0b5/buildscripts/packager-enterprise.py#L175-L178 | |
PlatformLab/RAMCloud | b1866af19124325a6dfd8cbc267e2e3ef1f965d1 | scripts/upload.py | python | SubversionVCS.GuessBase | (self, required) | return self.svn_base | Wrapper for _GuessBase. | Wrapper for _GuessBase. | [
"Wrapper",
"for",
"_GuessBase",
"."
] | def GuessBase(self, required):
"""Wrapper for _GuessBase."""
return self.svn_base | [
"def",
"GuessBase",
"(",
"self",
",",
"required",
")",
":",
"return",
"self",
".",
"svn_base"
] | https://github.com/PlatformLab/RAMCloud/blob/b1866af19124325a6dfd8cbc267e2e3ef1f965d1/scripts/upload.py#L1260-L1262 | |
CRYTEK/CRYENGINE | 232227c59a220cbbd311576f0fbeba7bb53b2a8c | Code/Tools/waf-1.7.13/waflib/Tools/gxx.py | python | gxx_modifier_aix | (conf) | Configuration flags for executing g++ on AIX | Configuration flags for executing g++ on AIX | [
"Configuration",
"flags",
"for",
"executing",
"g",
"++",
"on",
"AIX"
] | def gxx_modifier_aix(conf):
"""Configuration flags for executing g++ on AIX"""
v = conf.env
v['LINKFLAGS_cxxprogram']= ['-Wl,-brtl']
v['LINKFLAGS_cxxshlib'] = ['-shared', '-Wl,-brtl,-bexpfull']
v['SHLIB_MARKER'] = [] | [
"def",
"gxx_modifier_aix",
"(",
"conf",
")",
":",
"v",
"=",
"conf",
".",
"env",
"v",
"[",
"'LINKFLAGS_cxxprogram'",
"]",
"=",
"[",
"'-Wl,-brtl'",
"]",
"v",
"[",
"'LINKFLAGS_cxxshlib'",
"]",
"=",
"[",
"'-shared'",
",",
"'-Wl,-brtl,-bexpfull'",
"]",
"v",
"["... | https://github.com/CRYTEK/CRYENGINE/blob/232227c59a220cbbd311576f0fbeba7bb53b2a8c/Code/Tools/waf-1.7.13/waflib/Tools/gxx.py#L113-L119 | ||
kungfu-origin/kungfu | 90c84b2b590855654cb9a6395ed050e0f7763512 | core/deps/SQLiteCpp-2.3.0/cpplint.py | python | CheckLanguage | (filename, clean_lines, linenum, file_extension,
include_state, nesting_state, error) | Checks rules from the 'C++ language rules' section of cppguide.html.
Some of these rules are hard to test (function overloading, using
uint32 inappropriately), but we do the best we can.
Args:
filename: The name of the current file.
clean_lines: A CleansedLines instance containing the file.
linenum:... | Checks rules from the 'C++ language rules' section of cppguide.html. | [
"Checks",
"rules",
"from",
"the",
"C",
"++",
"language",
"rules",
"section",
"of",
"cppguide",
".",
"html",
"."
] | def CheckLanguage(filename, clean_lines, linenum, file_extension,
include_state, nesting_state, error):
"""Checks rules from the 'C++ language rules' section of cppguide.html.
Some of these rules are hard to test (function overloading, using
uint32 inappropriately), but we do the best we can.
... | [
"def",
"CheckLanguage",
"(",
"filename",
",",
"clean_lines",
",",
"linenum",
",",
"file_extension",
",",
"include_state",
",",
"nesting_state",
",",
"error",
")",
":",
"# If the line is empty or consists of entirely a comment, no need to",
"# check it.",
"line",
"=",
"cle... | https://github.com/kungfu-origin/kungfu/blob/90c84b2b590855654cb9a6395ed050e0f7763512/core/deps/SQLiteCpp-2.3.0/cpplint.py#L3763-L4070 | ||
albertz/openlierox | d316c14a8eb57848ef56e9bfa7b23a56f694a51b | tools/DedicatedServerVideo/atom/core.py | python | parse | (xml_string, target_class=None, version=1, encoding=None) | return _xml_element_from_tree(tree, target_class, version) | Parses the XML string according to the rules for the target_class.
Args:
xml_string: str or unicode
target_class: XmlElement or a subclass. If None is specified, the
XmlElement class is used.
version: int (optional) The version of the schema which should be used when
converting the XML in... | Parses the XML string according to the rules for the target_class. | [
"Parses",
"the",
"XML",
"string",
"according",
"to",
"the",
"rules",
"for",
"the",
"target_class",
"."
] | def parse(xml_string, target_class=None, version=1, encoding=None):
"""Parses the XML string according to the rules for the target_class.
Args:
xml_string: str or unicode
target_class: XmlElement or a subclass. If None is specified, the
XmlElement class is used.
version: int (optional) The vers... | [
"def",
"parse",
"(",
"xml_string",
",",
"target_class",
"=",
"None",
",",
"version",
"=",
"1",
",",
"encoding",
"=",
"None",
")",
":",
"if",
"target_class",
"is",
"None",
":",
"target_class",
"=",
"XmlElement",
"if",
"isinstance",
"(",
"xml_string",
",",
... | https://github.com/albertz/openlierox/blob/d316c14a8eb57848ef56e9bfa7b23a56f694a51b/tools/DedicatedServerVideo/atom/core.py#L485-L505 | |
aws/lumberyard | f85344403c1c2e77ec8c75deb2c116e97b713217 | dev/Tools/Python/3.7.10/linux_x64/lib/python3.7/datetime.py | python | _is_leap | (year) | return year % 4 == 0 and (year % 100 != 0 or year % 400 == 0) | year -> 1 if leap year, else 0. | year -> 1 if leap year, else 0. | [
"year",
"-",
">",
"1",
"if",
"leap",
"year",
"else",
"0",
"."
] | def _is_leap(year):
"year -> 1 if leap year, else 0."
return year % 4 == 0 and (year % 100 != 0 or year % 400 == 0) | [
"def",
"_is_leap",
"(",
"year",
")",
":",
"return",
"year",
"%",
"4",
"==",
"0",
"and",
"(",
"year",
"%",
"100",
"!=",
"0",
"or",
"year",
"%",
"400",
"==",
"0",
")"
] | https://github.com/aws/lumberyard/blob/f85344403c1c2e77ec8c75deb2c116e97b713217/dev/Tools/Python/3.7.10/linux_x64/lib/python3.7/datetime.py#L37-L39 | |
apple/turicreate | cce55aa5311300e3ce6af93cb45ba791fd1bdf49 | src/external/xgboost/python-package/xgboost/core.py | python | DMatrix.get_uint_info | (self, field) | return ctypes2numpy(ret, length.value, np.uint32) | Get unsigned integer property from the DMatrix.
Parameters
----------
field: str
The field name of the information
Returns
-------
info : array
a numpy array of float information of the data | Get unsigned integer property from the DMatrix. | [
"Get",
"unsigned",
"integer",
"property",
"from",
"the",
"DMatrix",
"."
] | def get_uint_info(self, field):
"""Get unsigned integer property from the DMatrix.
Parameters
----------
field: str
The field name of the information
Returns
-------
info : array
a numpy array of float information of the data
"""
... | [
"def",
"get_uint_info",
"(",
"self",
",",
"field",
")",
":",
"length",
"=",
"ctypes",
".",
"c_ulong",
"(",
")",
"ret",
"=",
"ctypes",
".",
"POINTER",
"(",
"ctypes",
".",
"c_uint",
")",
"(",
")",
"_check_call",
"(",
"_LIB",
".",
"XGDMatrixGetUIntInfo",
... | https://github.com/apple/turicreate/blob/cce55aa5311300e3ce6af93cb45ba791fd1bdf49/src/external/xgboost/python-package/xgboost/core.py#L298-L317 | |
apple/swift-lldb | d74be846ef3e62de946df343e8c234bde93a8912 | scripts/Python/static-binding/lldb.py | python | SBThreadPlan.__init__ | (self, *args) | __init__(lldb::SBThreadPlan self) -> SBThreadPlan
__init__(lldb::SBThreadPlan self, SBThreadPlan threadPlan) -> SBThreadPlan
__init__(lldb::SBThreadPlan self, lldb::ThreadPlanSP const & lldb_object_sp) -> SBThreadPlan
__init__(lldb::SBThreadPlan self, SBThread thread, char const * class_name) ->... | __init__(lldb::SBThreadPlan self) -> SBThreadPlan
__init__(lldb::SBThreadPlan self, SBThreadPlan threadPlan) -> SBThreadPlan
__init__(lldb::SBThreadPlan self, lldb::ThreadPlanSP const & lldb_object_sp) -> SBThreadPlan
__init__(lldb::SBThreadPlan self, SBThread thread, char const * class_name) ->... | [
"__init__",
"(",
"lldb",
"::",
"SBThreadPlan",
"self",
")",
"-",
">",
"SBThreadPlan",
"__init__",
"(",
"lldb",
"::",
"SBThreadPlan",
"self",
"SBThreadPlan",
"threadPlan",
")",
"-",
">",
"SBThreadPlan",
"__init__",
"(",
"lldb",
"::",
"SBThreadPlan",
"self",
"ll... | def __init__(self, *args):
"""
__init__(lldb::SBThreadPlan self) -> SBThreadPlan
__init__(lldb::SBThreadPlan self, SBThreadPlan threadPlan) -> SBThreadPlan
__init__(lldb::SBThreadPlan self, lldb::ThreadPlanSP const & lldb_object_sp) -> SBThreadPlan
__init__(lldb::SBThreadPlan sel... | [
"def",
"__init__",
"(",
"self",
",",
"*",
"args",
")",
":",
"this",
"=",
"_lldb",
".",
"new_SBThreadPlan",
"(",
"*",
"args",
")",
"try",
":",
"self",
".",
"this",
".",
"append",
"(",
"this",
")",
"except",
"__builtin__",
".",
"Exception",
":",
"self"... | https://github.com/apple/swift-lldb/blob/d74be846ef3e62de946df343e8c234bde93a8912/scripts/Python/static-binding/lldb.py#L12085-L12096 | ||
wxWidgets/wxPython-Classic | 19571e1ae65f1ac445f5491474121998c97a1bf0 | wx/lib/plot.py | python | PlotGraphics.setPrinterScale | (self, scale) | Thickens up lines and markers only for printing | Thickens up lines and markers only for printing | [
"Thickens",
"up",
"lines",
"and",
"markers",
"only",
"for",
"printing"
] | def setPrinterScale(self, scale):
"""Thickens up lines and markers only for printing"""
self.printerScale = scale | [
"def",
"setPrinterScale",
"(",
"self",
",",
"scale",
")",
":",
"self",
".",
"printerScale",
"=",
"scale"
] | https://github.com/wxWidgets/wxPython-Classic/blob/19571e1ae65f1ac445f5491474121998c97a1bf0/wx/lib/plot.py#L480-L482 | ||
forkineye/ESPixelStick | 22926f1c0d1131f1369fc7cad405689a095ae3cb | dist/bin/esptool/serial/serialutil.py | python | SerialBase.bytesize | (self) | return self._bytesize | Get the current byte size setting. | Get the current byte size setting. | [
"Get",
"the",
"current",
"byte",
"size",
"setting",
"."
] | def bytesize(self):
"""Get the current byte size setting."""
return self._bytesize | [
"def",
"bytesize",
"(",
"self",
")",
":",
"return",
"self",
".",
"_bytesize"
] | https://github.com/forkineye/ESPixelStick/blob/22926f1c0d1131f1369fc7cad405689a095ae3cb/dist/bin/esptool/serial/serialutil.py#L298-L300 | |
verilog-to-routing/vtr-verilog-to-routing | d9719cf7374821156c3cee31d66991cb85578562 | vtr_flow/scripts/python_libs/vtr/util.py | python | run_dir_name | (run_num) | return "run{:03d}".format(run_num) | Returns the formatted directory name for a specific run number | Returns the formatted directory name for a specific run number | [
"Returns",
"the",
"formatted",
"directory",
"name",
"for",
"a",
"specific",
"run",
"number"
] | def run_dir_name(run_num):
"""
Returns the formatted directory name for a specific run number
"""
return "run{:03d}".format(run_num) | [
"def",
"run_dir_name",
"(",
"run_num",
")",
":",
"return",
"\"run{:03d}\"",
".",
"format",
"(",
"run_num",
")"
] | https://github.com/verilog-to-routing/vtr-verilog-to-routing/blob/d9719cf7374821156c3cee31d66991cb85578562/vtr_flow/scripts/python_libs/vtr/util.py#L511-L515 | |
catboost/catboost | 167f64f237114a4d10b2b4ee42adb4569137debe | contrib/python/pandas/py2/pandas/core/arrays/categorical.py | python | Categorical.isna | (self) | return ret | Detect missing values
Missing values (-1 in .codes) are detected.
Returns
-------
a boolean array of whether my values are null
See Also
--------
isna : Top-level isna.
isnull : Alias of isna.
Categorical.notna : Boolean inverse of Categorical.i... | Detect missing values | [
"Detect",
"missing",
"values"
] | def isna(self):
"""
Detect missing values
Missing values (-1 in .codes) are detected.
Returns
-------
a boolean array of whether my values are null
See Also
--------
isna : Top-level isna.
isnull : Alias of isna.
Categorical.notn... | [
"def",
"isna",
"(",
"self",
")",
":",
"ret",
"=",
"self",
".",
"_codes",
"==",
"-",
"1",
"return",
"ret"
] | https://github.com/catboost/catboost/blob/167f64f237114a4d10b2b4ee42adb4569137debe/contrib/python/pandas/py2/pandas/core/arrays/categorical.py#L1383-L1402 | |
natanielruiz/android-yolo | 1ebb54f96a67a20ff83ddfc823ed83a13dc3a47f | jni-build/jni/include/tensorflow/contrib/factorization/python/ops/factorization_ops.py | python | WALSModel._cached_copy | (self, var, name) | Helper function to create a worker cached copy of a Variable.
Args:
var: Variable or list of Variable to cache. If a list, the items are
concatenated along dimension 0 to get the cached entry.
name: name of cached variable.
Returns:
Tuple consisting of following three entries:
... | Helper function to create a worker cached copy of a Variable. | [
"Helper",
"function",
"to",
"create",
"a",
"worker",
"cached",
"copy",
"of",
"a",
"Variable",
"."
] | def _cached_copy(self, var, name):
"""Helper function to create a worker cached copy of a Variable.
Args:
var: Variable or list of Variable to cache. If a list, the items are
concatenated along dimension 0 to get the cached entry.
name: name of cached variable.
Returns:
Tuple con... | [
"def",
"_cached_copy",
"(",
"self",
",",
"var",
",",
"name",
")",
":",
"if",
"var",
"is",
"None",
":",
"return",
"None",
",",
"None",
",",
"None",
"else",
":",
"cache",
"=",
"WALSModel",
".",
"_transient_var",
"(",
"name",
")",
"with",
"ops",
".",
... | https://github.com/natanielruiz/android-yolo/blob/1ebb54f96a67a20ff83ddfc823ed83a13dc3a47f/jni-build/jni/include/tensorflow/contrib/factorization/python/ops/factorization_ops.py#L211-L239 | ||
google/ml-metadata | b60196492d2ea2bcd8e4ddff0f3757e5fd710e4d | ml_metadata/metadata_store/types.py | python | _NodeAndType._is_consistent | (self) | return True | Test if the type and the node are consistent. | Test if the type and the node are consistent. | [
"Test",
"if",
"the",
"type",
"and",
"the",
"node",
"are",
"consistent",
"."
] | def _is_consistent(self) -> bool:
"""Test if the type and the node are consistent."""
node = self._get_node()
node_type = self._get_type()
if node.HasField("type_id") and node_type.HasField("id"):
if node.type_id != node_type.id:
return False
# All fields are optional, by definition.
... | [
"def",
"_is_consistent",
"(",
"self",
")",
"->",
"bool",
":",
"node",
"=",
"self",
".",
"_get_node",
"(",
")",
"node_type",
"=",
"self",
".",
"_get_type",
"(",
")",
"if",
"node",
".",
"HasField",
"(",
"\"type_id\"",
")",
"and",
"node_type",
".",
"HasFi... | https://github.com/google/ml-metadata/blob/b60196492d2ea2bcd8e4ddff0f3757e5fd710e4d/ml_metadata/metadata_store/types.py#L329-L343 | |
zhaoweicai/cascade-rcnn | 2252f46158ea6555868ca6fa5c221ea71d9b5e6c | scripts/cpp_lint.py | python | ProcessFileData | (filename, file_extension, lines, error,
extra_check_functions=[]) | Performs lint checks and reports any errors to the given error function.
Args:
filename: Filename of the file that is being processed.
file_extension: The extension (dot not included) of the file.
lines: An array of strings, each representing a line of the file, with the
last element being emp... | Performs lint checks and reports any errors to the given error function. | [
"Performs",
"lint",
"checks",
"and",
"reports",
"any",
"errors",
"to",
"the",
"given",
"error",
"function",
"."
] | def ProcessFileData(filename, file_extension, lines, error,
extra_check_functions=[]):
"""Performs lint checks and reports any errors to the given error function.
Args:
filename: Filename of the file that is being processed.
file_extension: The extension (dot not included) of the file.
... | [
"def",
"ProcessFileData",
"(",
"filename",
",",
"file_extension",
",",
"lines",
",",
"error",
",",
"extra_check_functions",
"=",
"[",
"]",
")",
":",
"lines",
"=",
"(",
"[",
"'// marker so line numbers and indices both start at 1'",
"]",
"+",
"lines",
"+",
"[",
"... | https://github.com/zhaoweicai/cascade-rcnn/blob/2252f46158ea6555868ca6fa5c221ea71d9b5e6c/scripts/cpp_lint.py#L4648-L4691 | ||
Xilinx/Vitis-AI | fc74d404563d9951b57245443c73bef389f3657f | tools/Vitis-AI-Quantizer/vai_q_tensorflow1.x/tensorflow/python/ops/clustering_ops.py | python | KMeans._infer_graph | (self, inputs, clusters) | return zip(*output) | Maps input to closest cluster and the score.
Args:
inputs: list of input Tensors.
clusters: Tensor of cluster centers.
Returns:
List of tuple, where each value in tuple corresponds to a value in inp.
The tuple has following three elements:
all_scores: distance of each input to ea... | Maps input to closest cluster and the score. | [
"Maps",
"input",
"to",
"closest",
"cluster",
"and",
"the",
"score",
"."
] | def _infer_graph(self, inputs, clusters):
"""Maps input to closest cluster and the score.
Args:
inputs: list of input Tensors.
clusters: Tensor of cluster centers.
Returns:
List of tuple, where each value in tuple corresponds to a value in inp.
The tuple has following three element... | [
"def",
"_infer_graph",
"(",
"self",
",",
"inputs",
",",
"clusters",
")",
":",
"assert",
"isinstance",
"(",
"inputs",
",",
"list",
")",
"# Pairwise distances are used only by transform(). In all other cases, this",
"# sub-graph is not evaluated.",
"scores",
"=",
"self",
".... | https://github.com/Xilinx/Vitis-AI/blob/fc74d404563d9951b57245443c73bef389f3657f/tools/Vitis-AI-Quantizer/vai_q_tensorflow1.x/tensorflow/python/ops/clustering_ops.py#L227-L263 | |
wxWidgets/wxPython-Classic | 19571e1ae65f1ac445f5491474121998c97a1bf0 | src/osx_carbon/_core.py | python | FSFile.GetModificationTime | (*args, **kwargs) | return _core_.FSFile_GetModificationTime(*args, **kwargs) | GetModificationTime(self) -> DateTime | GetModificationTime(self) -> DateTime | [
"GetModificationTime",
"(",
"self",
")",
"-",
">",
"DateTime"
] | def GetModificationTime(*args, **kwargs):
"""GetModificationTime(self) -> DateTime"""
return _core_.FSFile_GetModificationTime(*args, **kwargs) | [
"def",
"GetModificationTime",
"(",
"*",
"args",
",",
"*",
"*",
"kwargs",
")",
":",
"return",
"_core_",
".",
"FSFile_GetModificationTime",
"(",
"*",
"args",
",",
"*",
"*",
"kwargs",
")"
] | https://github.com/wxWidgets/wxPython-Classic/blob/19571e1ae65f1ac445f5491474121998c97a1bf0/src/osx_carbon/_core.py#L2311-L2313 | |
wlanjie/AndroidFFmpeg | 7baf9122f4b8e1c74e7baf4be5c422c7a5ba5aaf | tools/fdk-aac-build/x86/toolchain/lib/python2.7/lib-tk/ttk.py | python | OptionMenu.__init__ | (self, master, variable, default=None, *values, **kwargs) | Construct a themed OptionMenu widget with master as the parent,
the resource textvariable set to variable, the initially selected
value specified by the default parameter, the menu values given by
*values and additional keywords.
WIDGET-SPECIFIC OPTIONS
style: stylename
... | Construct a themed OptionMenu widget with master as the parent,
the resource textvariable set to variable, the initially selected
value specified by the default parameter, the menu values given by
*values and additional keywords. | [
"Construct",
"a",
"themed",
"OptionMenu",
"widget",
"with",
"master",
"as",
"the",
"parent",
"the",
"resource",
"textvariable",
"set",
"to",
"variable",
"the",
"initially",
"selected",
"value",
"specified",
"by",
"the",
"default",
"parameter",
"the",
"menu",
"va... | def __init__(self, master, variable, default=None, *values, **kwargs):
"""Construct a themed OptionMenu widget with master as the parent,
the resource textvariable set to variable, the initially selected
value specified by the default parameter, the menu values given by
*values and addit... | [
"def",
"__init__",
"(",
"self",
",",
"master",
",",
"variable",
",",
"default",
"=",
"None",
",",
"*",
"values",
",",
"*",
"*",
"kwargs",
")",
":",
"kw",
"=",
"{",
"'textvariable'",
":",
"variable",
",",
"'style'",
":",
"kwargs",
".",
"pop",
"(",
"... | https://github.com/wlanjie/AndroidFFmpeg/blob/7baf9122f4b8e1c74e7baf4be5c422c7a5ba5aaf/tools/fdk-aac-build/x86/toolchain/lib/python2.7/lib-tk/ttk.py#L1557-L1583 | ||
sfzhang15/RefineDet | 52b6fe23dc1a160fe710b7734576dca509bf4fae | scripts/cpp_lint.py | python | CheckEmptyBlockBody | (filename, clean_lines, linenum, error) | Look for empty loop/conditional body with only a single semicolon.
Args:
filename: The name of the current file.
clean_lines: A CleansedLines instance containing the file.
linenum: The number of the line to check.
error: The function to call with any errors found. | Look for empty loop/conditional body with only a single semicolon. | [
"Look",
"for",
"empty",
"loop",
"/",
"conditional",
"body",
"with",
"only",
"a",
"single",
"semicolon",
"."
] | def CheckEmptyBlockBody(filename, clean_lines, linenum, error):
"""Look for empty loop/conditional body with only a single semicolon.
Args:
filename: The name of the current file.
clean_lines: A CleansedLines instance containing the file.
linenum: The number of the line to check.
error: The functio... | [
"def",
"CheckEmptyBlockBody",
"(",
"filename",
",",
"clean_lines",
",",
"linenum",
",",
"error",
")",
":",
"# Search for loop keywords at the beginning of the line. Because only",
"# whitespaces are allowed before the keywords, this will also ignore most",
"# do-while-loops, since those... | https://github.com/sfzhang15/RefineDet/blob/52b6fe23dc1a160fe710b7734576dca509bf4fae/scripts/cpp_lint.py#L3247-L3279 | ||
mantidproject/mantid | 03deeb89254ec4289edb8771e0188c2090a02f32 | qt/python/mantidqtinterfaces/mantidqtinterfaces/Muon/GUI/Common/fitting_widgets/general_fitting/general_fitting_model.py | python | GeneralFittingModel.simultaneous_fit_by | (self, simultaneous_fit_by: str) | Sets the simultaneous fit by parameter stored in the model. | Sets the simultaneous fit by parameter stored in the model. | [
"Sets",
"the",
"simultaneous",
"fit",
"by",
"parameter",
"stored",
"in",
"the",
"model",
"."
] | def simultaneous_fit_by(self, simultaneous_fit_by: str) -> None:
"""Sets the simultaneous fit by parameter stored in the model."""
self.fitting_context.simultaneous_fit_by = simultaneous_fit_by | [
"def",
"simultaneous_fit_by",
"(",
"self",
",",
"simultaneous_fit_by",
":",
"str",
")",
"->",
"None",
":",
"self",
".",
"fitting_context",
".",
"simultaneous_fit_by",
"=",
"simultaneous_fit_by"
] | https://github.com/mantidproject/mantid/blob/03deeb89254ec4289edb8771e0188c2090a02f32/qt/python/mantidqtinterfaces/mantidqtinterfaces/Muon/GUI/Common/fitting_widgets/general_fitting/general_fitting_model.py#L71-L73 | ||
pmq20/node-packer | 12c46c6e44fbc14d9ee645ebd17d5296b324f7e0 | lts/deps/npm/node_modules/node-gyp/gyp/pylib/gyp/MSVSSettings.py | python | _Type.ConvertToMSBuild | (self, value) | return value | Returns the MSBuild equivalent of the MSVS value given.
Args:
value: the MSVS value to convert.
Returns:
the MSBuild equivalent.
Raises:
ValueError if value is not valid. | Returns the MSBuild equivalent of the MSVS value given. | [
"Returns",
"the",
"MSBuild",
"equivalent",
"of",
"the",
"MSVS",
"value",
"given",
"."
] | def ConvertToMSBuild(self, value):
"""Returns the MSBuild equivalent of the MSVS value given.
Args:
value: the MSVS value to convert.
Returns:
the MSBuild equivalent.
Raises:
ValueError if value is not valid.
"""
return value | [
"def",
"ConvertToMSBuild",
"(",
"self",
",",
"value",
")",
":",
"return",
"value"
] | https://github.com/pmq20/node-packer/blob/12c46c6e44fbc14d9ee645ebd17d5296b324f7e0/lts/deps/npm/node_modules/node-gyp/gyp/pylib/gyp/MSVSSettings.py#L94-L106 | |
windystrife/UnrealEngine_NVIDIAGameWorks | b50e6338a7c5b26374d66306ebc7807541ff815e | Engine/Extras/ThirdPartyNotUE/emsdk/Win64/python/2.7.5.3_64bit/Lib/site-packages/pythonwin/pywin/mfc/activex.py | python | MakeControlInstance | ( controlClass, name = None ) | return MakeControlClass(controlClass, name)() | As for MakeControlClass(), but returns an instance of the class. | As for MakeControlClass(), but returns an instance of the class. | [
"As",
"for",
"MakeControlClass",
"()",
"but",
"returns",
"an",
"instance",
"of",
"the",
"class",
"."
] | def MakeControlInstance( controlClass, name = None ):
"""As for MakeControlClass(), but returns an instance of the class.
"""
return MakeControlClass(controlClass, name)() | [
"def",
"MakeControlInstance",
"(",
"controlClass",
",",
"name",
"=",
"None",
")",
":",
"return",
"MakeControlClass",
"(",
"controlClass",
",",
"name",
")",
"(",
")"
] | https://github.com/windystrife/UnrealEngine_NVIDIAGameWorks/blob/b50e6338a7c5b26374d66306ebc7807541ff815e/Engine/Extras/ThirdPartyNotUE/emsdk/Win64/python/2.7.5.3_64bit/Lib/site-packages/pythonwin/pywin/mfc/activex.py#L72-L75 | |
microsoft/EdgeML | ef9f8a77f096acbdeb941014791f8eda1c1bc35b | tools/SeeDot/seedot/compiler/converter/util.py | python | extractXandYfromMat | (mat, numOutputs) | return X, Y | The first numOutputs entries are used as Y.
The remaining entries are part of X. | The first numOutputs entries are used as Y.
The remaining entries are part of X. | [
"The",
"first",
"numOutputs",
"entries",
"are",
"used",
"as",
"Y",
".",
"The",
"remaining",
"entries",
"are",
"part",
"of",
"X",
"."
] | def extractXandYfromMat(mat, numOutputs):
'''
The first numOutputs entries are used as Y.
The remaining entries are part of X.
'''
X = []
Y = []
for i in range(len(mat)):
ys = [float(x) for x in mat[i][0:numOutputs]]
isInt = all(element.is_integer() for element in ys)
... | [
"def",
"extractXandYfromMat",
"(",
"mat",
",",
"numOutputs",
")",
":",
"X",
"=",
"[",
"]",
"Y",
"=",
"[",
"]",
"for",
"i",
"in",
"range",
"(",
"len",
"(",
"mat",
")",
")",
":",
"ys",
"=",
"[",
"float",
"(",
"x",
")",
"for",
"x",
"in",
"mat",
... | https://github.com/microsoft/EdgeML/blob/ef9f8a77f096acbdeb941014791f8eda1c1bc35b/tools/SeeDot/seedot/compiler/converter/util.py#L217-L234 | |
apache/kudu | 90895ce76590f10730ad7aac3613b69d89ff5422 | build-support/check_compatibility.py | python | get_artifact_name | (jar_path) | return ARTIFACT_NAME_PATTERN.search(jar_path).group(1) | Return the artifact name given a full jar path. | Return the artifact name given a full jar path. | [
"Return",
"the",
"artifact",
"name",
"given",
"a",
"full",
"jar",
"path",
"."
] | def get_artifact_name(jar_path):
""" Return the artifact name given a full jar path. """
return ARTIFACT_NAME_PATTERN.search(jar_path).group(1) | [
"def",
"get_artifact_name",
"(",
"jar_path",
")",
":",
"return",
"ARTIFACT_NAME_PATTERN",
".",
"search",
"(",
"jar_path",
")",
".",
"group",
"(",
"1",
")"
] | https://github.com/apache/kudu/blob/90895ce76590f10730ad7aac3613b69d89ff5422/build-support/check_compatibility.py#L139-L141 | |
bairdzhang/smallhardface | 76fa1d87a9602d9b13d7a7fe693fc7aec91cab80 | caffe/scripts/cpp_lint.py | python | CheckCaffeRandom | (filename, clean_lines, linenum, error) | Checks for calls to C random functions (rand, rand_r, random, ...).
Caffe code should (almost) always use the caffe_rng_* functions rather
than these, as the internal state of these C functions is independent of the
native Caffe RNG system which should produce deterministic results for a
fixed Caffe seed set u... | Checks for calls to C random functions (rand, rand_r, random, ...). | [
"Checks",
"for",
"calls",
"to",
"C",
"random",
"functions",
"(",
"rand",
"rand_r",
"random",
"...",
")",
"."
] | def CheckCaffeRandom(filename, clean_lines, linenum, error):
"""Checks for calls to C random functions (rand, rand_r, random, ...).
Caffe code should (almost) always use the caffe_rng_* functions rather
than these, as the internal state of these C functions is independent of the
native Caffe RNG system which s... | [
"def",
"CheckCaffeRandom",
"(",
"filename",
",",
"clean_lines",
",",
"linenum",
",",
"error",
")",
":",
"line",
"=",
"clean_lines",
".",
"elided",
"[",
"linenum",
"]",
"for",
"function",
"in",
"c_random_function_list",
":",
"ix",
"=",
"line",
".",
"find",
... | https://github.com/bairdzhang/smallhardface/blob/76fa1d87a9602d9b13d7a7fe693fc7aec91cab80/caffe/scripts/cpp_lint.py#L1644-L1667 | ||
google/asylo | a3b09ebff6c0e3b10e25d40f14991e16bb75d883 | asylo/platform/system_call/type_conversions/types_parse_functions.py | python | get_structs | () | return '#define STRUCTS_INIT \\\n{}\n'.format(', \\\n'.join(struct_rows)) | r"""Returns a macro containing all struct descriptions.
The returned macro is used by types conversion generator to initialize a
struct description table (struct_properties_table) mapping struct names to a
struct (StructProperties) describing the struct properties, including struct
members. A typical output of... | r"""Returns a macro containing all struct descriptions. | [
"r",
"Returns",
"a",
"macro",
"containing",
"all",
"struct",
"descriptions",
"."
] | def get_structs():
r"""Returns a macro containing all struct descriptions.
The returned macro is used by types conversion generator to initialize a
struct description table (struct_properties_table) mapping struct names to a
struct (StructProperties) describing the struct properties, including struct
members... | [
"def",
"get_structs",
"(",
")",
":",
"struct_rows",
"=",
"[",
"]",
"for",
"struct_name",
",",
"struct_properties",
"in",
"sorted",
"(",
"_struct_map",
".",
"items",
"(",
")",
")",
":",
"struct_rows",
".",
"append",
"(",
"'{{{struct}, {{{pack_attributes}, {skip_c... | https://github.com/google/asylo/blob/a3b09ebff6c0e3b10e25d40f14991e16bb75d883/asylo/platform/system_call/type_conversions/types_parse_functions.py#L241-L269 | |
panda3d/panda3d | 833ad89ebad58395d0af0b7ec08538e5e4308265 | direct/src/showbase/Job.py | python | Job.suspend | (self) | Called when JobManager is going to stop running this job for a
while. | Called when JobManager is going to stop running this job for a
while. | [
"Called",
"when",
"JobManager",
"is",
"going",
"to",
"stop",
"running",
"this",
"job",
"for",
"a",
"while",
"."
] | def suspend(self):
"""Called when JobManager is going to stop running this job for a
while.
""" | [
"def",
"suspend",
"(",
"self",
")",
":"
] | https://github.com/panda3d/panda3d/blob/833ad89ebad58395d0af0b7ec08538e5e4308265/direct/src/showbase/Job.py#L77-L80 | ||
mongodb/mongo | d8ff665343ad29cf286ee2cf4a1960d29371937b | buildscripts/resmokelib/multiversionconstants.py | python | version_str | (version) | return '{}.{}'.format(version.major, version.minor) | Return a string of the given version in 'MAJOR.MINOR' form. | Return a string of the given version in 'MAJOR.MINOR' form. | [
"Return",
"a",
"string",
"of",
"the",
"given",
"version",
"in",
"MAJOR",
".",
"MINOR",
"form",
"."
] | def version_str(version):
"""Return a string of the given version in 'MAJOR.MINOR' form."""
return '{}.{}'.format(version.major, version.minor) | [
"def",
"version_str",
"(",
"version",
")",
":",
"return",
"'{}.{}'",
".",
"format",
"(",
"version",
".",
"major",
",",
"version",
".",
"minor",
")"
] | https://github.com/mongodb/mongo/blob/d8ff665343ad29cf286ee2cf4a1960d29371937b/buildscripts/resmokelib/multiversionconstants.py#L134-L136 | |
Xilinx/Vitis-AI | fc74d404563d9951b57245443c73bef389f3657f | demo/DPU-for-RNN/rnn_u25_u50lv/apps/open_information_extraction/utils/run_oie.py | python | get_confidence | (model, tag_per_token, class_probs) | return prod_prob | Get the confidence of a given model in a token list, using the class probabilities
associated with this prediction. | Get the confidence of a given model in a token list, using the class probabilities
associated with this prediction. | [
"Get",
"the",
"confidence",
"of",
"a",
"given",
"model",
"in",
"a",
"token",
"list",
"using",
"the",
"class",
"probabilities",
"associated",
"with",
"this",
"prediction",
"."
] | def get_confidence(model, tag_per_token, class_probs):
"""
Get the confidence of a given model in a token list, using the class probabilities
associated with this prediction.
"""
#tag_per_token = list([tag for tag in tag_per_token if tag != 'O'])
token_indexes = [model._model.vocab.get_token_ind... | [
"def",
"get_confidence",
"(",
"model",
",",
"tag_per_token",
",",
"class_probs",
")",
":",
"#tag_per_token = list([tag for tag in tag_per_token if tag != 'O'])",
"token_indexes",
"=",
"[",
"model",
".",
"_model",
".",
"vocab",
".",
"get_token_index",
"(",
"tag",
",",
... | https://github.com/Xilinx/Vitis-AI/blob/fc74d404563d9951b57245443c73bef389f3657f/demo/DPU-for-RNN/rnn_u25_u50lv/apps/open_information_extraction/utils/run_oie.py#L89-L107 | |
trilinos/Trilinos | 6168be6dd51e35e1cd681e9c4b24433e709df140 | packages/seacas/scripts/exodus3.in.py | python | exodus.get_element_attribute_names | (self, blkId) | return list(names) | get the list of element attribute names for a block
>>> attr_names = exo.get_element_attribute_names(elem_blk_id)
Parameters
----------
elem_blk_id : int
element block *ID* (not *INDEX*)
Returns
-------
<list<string>> attr_names | get the list of element attribute names for a block | [
"get",
"the",
"list",
"of",
"element",
"attribute",
"names",
"for",
"a",
"block"
] | def get_element_attribute_names(self, blkId):
"""
get the list of element attribute names for a block
>>> attr_names = exo.get_element_attribute_names(elem_blk_id)
Parameters
----------
elem_blk_id : int
element block *ID* (not *INDEX*)
Returns
... | [
"def",
"get_element_attribute_names",
"(",
"self",
",",
"blkId",
")",
":",
"names",
"=",
"self",
".",
"__ex_get_elem_attr_names",
"(",
"blkId",
")",
"return",
"list",
"(",
"names",
")"
] | https://github.com/trilinos/Trilinos/blob/6168be6dd51e35e1cd681e9c4b24433e709df140/packages/seacas/scripts/exodus3.in.py#L3031-L3047 | |
miyosuda/TensorFlowAndroidMNIST | 7b5a4603d2780a8a2834575706e9001977524007 | jni-build/jni/include/tensorflow/python/ops/tensor_array_ops.py | python | TensorArray.__init__ | (self, dtype, size=None, dynamic_size=None,
clear_after_read=None, tensor_array_name=None, handle=None,
flow=None, infer_shape=True, name=None) | Construct a new TensorArray or wrap an existing TensorArray handle.
A note about the parameter `name`:
The name of the `TensorArray` (even if passed in) is uniquified: each time
a new `TensorArray` is created at runtime it is assigned its own name for
the duration of the run. This avoids name colliss... | Construct a new TensorArray or wrap an existing TensorArray handle. | [
"Construct",
"a",
"new",
"TensorArray",
"or",
"wrap",
"an",
"existing",
"TensorArray",
"handle",
"."
] | def __init__(self, dtype, size=None, dynamic_size=None,
clear_after_read=None, tensor_array_name=None, handle=None,
flow=None, infer_shape=True, name=None):
"""Construct a new TensorArray or wrap an existing TensorArray handle.
A note about the parameter `name`:
The name of t... | [
"def",
"__init__",
"(",
"self",
",",
"dtype",
",",
"size",
"=",
"None",
",",
"dynamic_size",
"=",
"None",
",",
"clear_after_read",
"=",
"None",
",",
"tensor_array_name",
"=",
"None",
",",
"handle",
"=",
"None",
",",
"flow",
"=",
"None",
",",
"infer_shape... | https://github.com/miyosuda/TensorFlowAndroidMNIST/blob/7b5a4603d2780a8a2834575706e9001977524007/jni-build/jni/include/tensorflow/python/ops/tensor_array_ops.py#L62-L144 | ||
cvmfs/cvmfs | 4637bdb5153178eadf885c1acf37bdc5c685bf8a | cpplint.py | python | FilesBelongToSameModule | (filename_cc, filename_h) | return files_belong_to_same_module, common_path | Check if these two filenames belong to the same module.
The concept of a 'module' here is a as follows:
foo.h, foo-inl.h, foo.cc, foo_test.cc and foo_unittest.cc belong to the
same 'module' if they are in the same directory.
some/path/public/xyzzy and some/path/internal/xyzzy are also considered
to belong to... | Check if these two filenames belong to the same module. | [
"Check",
"if",
"these",
"two",
"filenames",
"belong",
"to",
"the",
"same",
"module",
"."
] | def FilesBelongToSameModule(filename_cc, filename_h):
"""Check if these two filenames belong to the same module.
The concept of a 'module' here is a as follows:
foo.h, foo-inl.h, foo.cc, foo_test.cc and foo_unittest.cc belong to the
same 'module' if they are in the same directory.
some/path/public/xyzzy and ... | [
"def",
"FilesBelongToSameModule",
"(",
"filename_cc",
",",
"filename_h",
")",
":",
"if",
"not",
"filename_cc",
".",
"endswith",
"(",
"'.cc'",
")",
":",
"return",
"(",
"False",
",",
"''",
")",
"filename_cc",
"=",
"filename_cc",
"[",
":",
"-",
"len",
"(",
... | https://github.com/cvmfs/cvmfs/blob/4637bdb5153178eadf885c1acf37bdc5c685bf8a/cpplint.py#L5529-L5581 | |
wxWidgets/wxPython-Classic | 19571e1ae65f1ac445f5491474121998c97a1bf0 | src/gtk/richtext.py | python | RichTextCtrl.GetDefaultStyle | (*args, **kwargs) | return _richtext.RichTextCtrl_GetDefaultStyle(*args, **kwargs) | GetDefaultStyle(self) -> RichTextAttr
Retrieves a copy of the default style object. | GetDefaultStyle(self) -> RichTextAttr | [
"GetDefaultStyle",
"(",
"self",
")",
"-",
">",
"RichTextAttr"
] | def GetDefaultStyle(*args, **kwargs):
"""
GetDefaultStyle(self) -> RichTextAttr
Retrieves a copy of the default style object.
"""
return _richtext.RichTextCtrl_GetDefaultStyle(*args, **kwargs) | [
"def",
"GetDefaultStyle",
"(",
"*",
"args",
",",
"*",
"*",
"kwargs",
")",
":",
"return",
"_richtext",
".",
"RichTextCtrl_GetDefaultStyle",
"(",
"*",
"args",
",",
"*",
"*",
"kwargs",
")"
] | https://github.com/wxWidgets/wxPython-Classic/blob/19571e1ae65f1ac445f5491474121998c97a1bf0/src/gtk/richtext.py#L3173-L3179 | |
Xilinx/Vitis-AI | fc74d404563d9951b57245443c73bef389f3657f | tools/Vitis-AI-Quantizer/vai_q_tensorflow1.x/tensorflow/python/ops/clustering_ops.py | python | _InitializeClustersOpFactory._add_new_centers | (self) | return self._num_clusters - array_ops.shape(a)[0] | Adds some centers and returns the number of centers remaining. | Adds some centers and returns the number of centers remaining. | [
"Adds",
"some",
"centers",
"and",
"returns",
"the",
"number",
"of",
"centers",
"remaining",
"."
] | def _add_new_centers(self):
"""Adds some centers and returns the number of centers remaining."""
new_centers = self._choose_initial_centers()
if self._distance_metric == COSINE_DISTANCE:
new_centers = nn_impl.l2_normalize(new_centers, dim=1)
# If cluster_centers is empty, it doesn't have the right... | [
"def",
"_add_new_centers",
"(",
"self",
")",
":",
"new_centers",
"=",
"self",
".",
"_choose_initial_centers",
"(",
")",
"if",
"self",
".",
"_distance_metric",
"==",
"COSINE_DISTANCE",
":",
"new_centers",
"=",
"nn_impl",
".",
"l2_normalize",
"(",
"new_centers",
"... | https://github.com/Xilinx/Vitis-AI/blob/fc74d404563d9951b57245443c73bef389f3657f/tools/Vitis-AI-Quantizer/vai_q_tensorflow1.x/tensorflow/python/ops/clustering_ops.py#L735-L750 | |
wxWidgets/wxPython-Classic | 19571e1ae65f1ac445f5491474121998c97a1bf0 | src/osx_carbon/html.py | python | HtmlCell.Layout | (*args, **kwargs) | return _html.HtmlCell_Layout(*args, **kwargs) | Layout(self, int w) | Layout(self, int w) | [
"Layout",
"(",
"self",
"int",
"w",
")"
] | def Layout(*args, **kwargs):
"""Layout(self, int w)"""
return _html.HtmlCell_Layout(*args, **kwargs) | [
"def",
"Layout",
"(",
"*",
"args",
",",
"*",
"*",
"kwargs",
")",
":",
"return",
"_html",
".",
"HtmlCell_Layout",
"(",
"*",
"args",
",",
"*",
"*",
"kwargs",
")"
] | https://github.com/wxWidgets/wxPython-Classic/blob/19571e1ae65f1ac445f5491474121998c97a1bf0/src/osx_carbon/html.py#L682-L684 | |
KhronosGroup/Vulkan-Headers | b32da5329b50e3cb96229aaecba9ded032fe29cc | registry/spec_tools/util.py | python | findFirstWithPredicate | (collection, pred) | return None | Return the first element that satisfies the predicate, or None if none exist.
NOTE: Some places where this is used might be better served by changing to a dictionary. | Return the first element that satisfies the predicate, or None if none exist. | [
"Return",
"the",
"first",
"element",
"that",
"satisfies",
"the",
"predicate",
"or",
"None",
"if",
"none",
"exist",
"."
] | def findFirstWithPredicate(collection, pred):
"""Return the first element that satisfies the predicate, or None if none exist.
NOTE: Some places where this is used might be better served by changing to a dictionary.
"""
for elt in collection:
if pred(elt):
return elt
return None | [
"def",
"findFirstWithPredicate",
"(",
"collection",
",",
"pred",
")",
":",
"for",
"elt",
"in",
"collection",
":",
"if",
"pred",
"(",
"elt",
")",
":",
"return",
"elt",
"return",
"None"
] | https://github.com/KhronosGroup/Vulkan-Headers/blob/b32da5329b50e3cb96229aaecba9ded032fe29cc/registry/spec_tools/util.py#L26-L34 | |
BlzFans/wke | b0fa21158312e40c5fbd84682d643022b6c34a93 | cygwin/lib/python2.6/pickle.py | python | Unpickler.load | (self) | Read a pickled object representation from the open file.
Return the reconstituted object hierarchy specified in the file. | Read a pickled object representation from the open file. | [
"Read",
"a",
"pickled",
"object",
"representation",
"from",
"the",
"open",
"file",
"."
] | def load(self):
"""Read a pickled object representation from the open file.
Return the reconstituted object hierarchy specified in the file.
"""
self.mark = object() # any new unique object
self.stack = []
self.append = self.stack.append
read = self.read
... | [
"def",
"load",
"(",
"self",
")",
":",
"self",
".",
"mark",
"=",
"object",
"(",
")",
"# any new unique object",
"self",
".",
"stack",
"=",
"[",
"]",
"self",
".",
"append",
"=",
"self",
".",
"stack",
".",
"append",
"read",
"=",
"self",
".",
"read",
"... | https://github.com/BlzFans/wke/blob/b0fa21158312e40c5fbd84682d643022b6c34a93/cygwin/lib/python2.6/pickle.py#L845-L860 | ||
cvxpy/cvxpy | 5165b4fb750dfd237de8659383ef24b4b2e33aaf | cvxpy/atoms/elementwise/log.py | python | log.is_atom_concave | (self) | return True | Is the atom concave? | Is the atom concave? | [
"Is",
"the",
"atom",
"concave?"
] | def is_atom_concave(self) -> bool:
"""Is the atom concave?
"""
return True | [
"def",
"is_atom_concave",
"(",
"self",
")",
"->",
"bool",
":",
"return",
"True"
] | https://github.com/cvxpy/cvxpy/blob/5165b4fb750dfd237de8659383ef24b4b2e33aaf/cvxpy/atoms/elementwise/log.py#L48-L51 | |
freeorion/freeorion | c266a40eccd3a99a17de8fe57c36ef6ba3771665 | default/python/universe_generation/galaxy.py | python | AdjacencyGrid.nearest_neighbor | (self, p) | return None | Return nearest neighbor at any distance. | Return nearest neighbor at any distance. | [
"Return",
"nearest",
"neighbor",
"at",
"any",
"distance",
"."
] | def nearest_neighbor(self, p):
"""Return nearest neighbor at any distance."""
for ring in self._generate_rings_around_point(p):
candidates = [pos for cell in ring for pos in self.grid[cell]]
if candidates:
(_, pt) = min((util.distance(pos, p), pos) for pos in cand... | [
"def",
"nearest_neighbor",
"(",
"self",
",",
"p",
")",
":",
"for",
"ring",
"in",
"self",
".",
"_generate_rings_around_point",
"(",
"p",
")",
":",
"candidates",
"=",
"[",
"pos",
"for",
"cell",
"in",
"ring",
"for",
"pos",
"in",
"self",
".",
"grid",
"[",
... | https://github.com/freeorion/freeorion/blob/c266a40eccd3a99a17de8fe57c36ef6ba3771665/default/python/universe_generation/galaxy.py#L74-L81 | |
wlanjie/AndroidFFmpeg | 7baf9122f4b8e1c74e7baf4be5c422c7a5ba5aaf | tools/fdk-aac-build/armeabi-v7a/toolchain/lib/python2.7/lib-tk/Tkinter.py | python | Menu.unpost | (self) | Unmap a menu. | Unmap a menu. | [
"Unmap",
"a",
"menu",
"."
] | def unpost(self):
"""Unmap a menu."""
self.tk.call(self._w, 'unpost') | [
"def",
"unpost",
"(",
"self",
")",
":",
"self",
".",
"tk",
".",
"call",
"(",
"self",
".",
"_w",
",",
"'unpost'",
")"
] | https://github.com/wlanjie/AndroidFFmpeg/blob/7baf9122f4b8e1c74e7baf4be5c422c7a5ba5aaf/tools/fdk-aac-build/armeabi-v7a/toolchain/lib/python2.7/lib-tk/Tkinter.py#L2746-L2748 | ||
KratosMultiphysics/Kratos | 0000833054ed0503424eb28205d6508d9ca6cbbc | applications/CoSimulationApplication/python_scripts/utilities/model_part_utilities.py | python | CreateModelPartsFromCouplingDataSettings | (data_settings_list, model, solver_name) | This function creates the ModelParts-hierarchie that are used in the specified CouplingInterfaceData-settings | This function creates the ModelParts-hierarchie that are used in the specified CouplingInterfaceData-settings | [
"This",
"function",
"creates",
"the",
"ModelParts",
"-",
"hierarchie",
"that",
"are",
"used",
"in",
"the",
"specified",
"CouplingInterfaceData",
"-",
"settings"
] | def CreateModelPartsFromCouplingDataSettings(data_settings_list, model, solver_name):
'''This function creates the ModelParts-hierarchie that are used in the specified CouplingInterfaceData-settings'''
data_settings_list = data_settings_list.Clone() # clone to not mess with the following validation
for dat... | [
"def",
"CreateModelPartsFromCouplingDataSettings",
"(",
"data_settings_list",
",",
"model",
",",
"solver_name",
")",
":",
"data_settings_list",
"=",
"data_settings_list",
".",
"Clone",
"(",
")",
"# clone to not mess with the following validation",
"for",
"data_settings",
"in"... | https://github.com/KratosMultiphysics/Kratos/blob/0000833054ed0503424eb28205d6508d9ca6cbbc/applications/CoSimulationApplication/python_scripts/utilities/model_part_utilities.py#L55-L72 | ||
apache/incubator-mxnet | f03fb23f1d103fec9541b5ae59ee06b1734a51d9 | python/mxnet/ndarray/numpy/_op.py | python | argmax | (a, axis=None, out=None, keepdims=False) | return _api_internal.argmax(a, axis, keepdims, out) | r"""
Returns the indices of the maximum values along an axis.
Parameters
----------
a : ndarray
Input array. Only support ndarrays of dtype `float16`, `float32`, and `float64`.
axis : int, optional
By default, the index is into the flattened array, otherwise
along the specif... | r"""
Returns the indices of the maximum values along an axis. | [
"r",
"Returns",
"the",
"indices",
"of",
"the",
"maximum",
"values",
"along",
"an",
"axis",
"."
] | def argmax(a, axis=None, out=None, keepdims=False):
r"""
Returns the indices of the maximum values along an axis.
Parameters
----------
a : ndarray
Input array. Only support ndarrays of dtype `float16`, `float32`, and `float64`.
axis : int, optional
By default, the index is into... | [
"def",
"argmax",
"(",
"a",
",",
"axis",
"=",
"None",
",",
"out",
"=",
"None",
",",
"keepdims",
"=",
"False",
")",
":",
"return",
"_api_internal",
".",
"argmax",
"(",
"a",
",",
"axis",
",",
"keepdims",
",",
"out",
")"
] | https://github.com/apache/incubator-mxnet/blob/f03fb23f1d103fec9541b5ae59ee06b1734a51d9/python/mxnet/ndarray/numpy/_op.py#L5447-L5521 | |
su2code/SU2 | 72b2fa977b64b9683a388920f05298a40d39e5c5 | SU2_PY/SU2/io/state.py | python | State.find_files | (self,config) | return | SU2.io.State.find_files(config)
finds mesh and solution files for a given config.
updates state.FILES with filenames.
files already logged in state are not overridden.
will ignore solutions if config.RESTART_SOL == 'NO'. | SU2.io.State.find_files(config)
finds mesh and solution files for a given config.
updates state.FILES with filenames.
files already logged in state are not overridden.
will ignore solutions if config.RESTART_SOL == 'NO'. | [
"SU2",
".",
"io",
".",
"State",
".",
"find_files",
"(",
"config",
")",
"finds",
"mesh",
"and",
"solution",
"files",
"for",
"a",
"given",
"config",
".",
"updates",
"state",
".",
"FILES",
"with",
"filenames",
".",
"files",
"already",
"logged",
"in",
"state... | def find_files(self,config):
""" SU2.io.State.find_files(config)
finds mesh and solution files for a given config.
updates state.FILES with filenames.
files already logged in state are not overridden.
will ignore solutions if config.RESTART_SOL == 'NO'.
""... | [
"def",
"find_files",
"(",
"self",
",",
"config",
")",
":",
"files",
"=",
"self",
".",
"FILES",
"mesh_name",
"=",
"config",
".",
"MESH_FILENAME",
"if",
"config",
".",
"get",
"(",
"'READ_BINARY_RESTART'",
",",
"'YES'",
")",
"==",
"'NO'",
":",
"if",
"not",
... | https://github.com/su2code/SU2/blob/72b2fa977b64b9683a388920f05298a40d39e5c5/SU2_PY/SU2/io/state.py#L232-L369 | |
MythTV/mythtv | d282a209cb8be85d036f85a62a8ec971b67d45f4 | mythtv/programs/scripts/internetcontent/nv_python_libs/vimeo/oauth/oauth_api.py | python | OAuthServer.fetch_access_token | (self, oauth_request) | return new_token | Processes an access_token request and returns the
access token on success. | Processes an access_token request and returns the
access token on success. | [
"Processes",
"an",
"access_token",
"request",
"and",
"returns",
"the",
"access",
"token",
"on",
"success",
"."
] | def fetch_access_token(self, oauth_request):
"""Processes an access_token request and returns the
access token on success.
"""
version = self._get_version(oauth_request)
consumer = self._get_consumer(oauth_request)
try:
verifier = self._get_verifier(oauth_requ... | [
"def",
"fetch_access_token",
"(",
"self",
",",
"oauth_request",
")",
":",
"version",
"=",
"self",
".",
"_get_version",
"(",
"oauth_request",
")",
"consumer",
"=",
"self",
".",
"_get_consumer",
"(",
"oauth_request",
")",
"try",
":",
"verifier",
"=",
"self",
"... | https://github.com/MythTV/mythtv/blob/d282a209cb8be85d036f85a62a8ec971b67d45f4/mythtv/programs/scripts/internetcontent/nv_python_libs/vimeo/oauth/oauth_api.py#L409-L423 | |
ricardoquesada/Spidermonkey | 4a75ea2543408bd1b2c515aa95901523eeef7858 | media/webrtc/trunk/build/android/pylib/device_stats_monitor.py | python | DeviceStatsMonitor.StopAndCollect | (self, output_path) | return 'file://%s?results=file://%s' % (
DeviceStatsMonitor.RESULT_VIEWER_PATH, urllib.quote(output_path)) | Stops monitoring and saves results.
Args:
output_path: Path to save results.
Returns:
String of URL to load results in browser. | Stops monitoring and saves results. | [
"Stops",
"monitoring",
"and",
"saves",
"results",
"."
] | def StopAndCollect(self, output_path):
"""Stops monitoring and saves results.
Args:
output_path: Path to save results.
Returns:
String of URL to load results in browser.
"""
assert self._process
self._adb.KillAll(DeviceStatsMonitor.DEVICE_PATH)
self._process.wait()
profile ... | [
"def",
"StopAndCollect",
"(",
"self",
",",
"output_path",
")",
":",
"assert",
"self",
".",
"_process",
"self",
".",
"_adb",
".",
"KillAll",
"(",
"DeviceStatsMonitor",
".",
"DEVICE_PATH",
")",
"self",
".",
"_process",
".",
"wait",
"(",
")",
"profile",
"=",
... | https://github.com/ricardoquesada/Spidermonkey/blob/4a75ea2543408bd1b2c515aa95901523eeef7858/media/webrtc/trunk/build/android/pylib/device_stats_monitor.py#L47-L98 | |
alexozer/jankdrone | c4b403eb254b41b832ab2bdfade12ba59c99e5dc | shm/lib/nanopb/generator/nanopb_generator.py | python | iterate_extensions | (desc, names = Names()) | Recursively find all extensions.
For each, yield name, FieldDescriptorProto. | Recursively find all extensions.
For each, yield name, FieldDescriptorProto. | [
"Recursively",
"find",
"all",
"extensions",
".",
"For",
"each",
"yield",
"name",
"FieldDescriptorProto",
"."
] | def iterate_extensions(desc, names = Names()):
'''Recursively find all extensions.
For each, yield name, FieldDescriptorProto.
'''
for extension in desc.extension:
yield names, extension
for subname, subdesc in iterate_messages(desc, names):
for extension in subdesc.extension:
... | [
"def",
"iterate_extensions",
"(",
"desc",
",",
"names",
"=",
"Names",
"(",
")",
")",
":",
"for",
"extension",
"in",
"desc",
".",
"extension",
":",
"yield",
"names",
",",
"extension",
"for",
"subname",
",",
"subdesc",
"in",
"iterate_messages",
"(",
"desc",
... | https://github.com/alexozer/jankdrone/blob/c4b403eb254b41b832ab2bdfade12ba59c99e5dc/shm/lib/nanopb/generator/nanopb_generator.py#L947-L956 | ||
krishauser/Klampt | 972cc83ea5befac3f653c1ba20f80155768ad519 | Python/python2_version/klampt/vis/visualization.py | python | VisAppearance.transparent | (self) | Returns true if the item is entirely transparent, None if mixed transparency, and False otherwise | Returns true if the item is entirely transparent, None if mixed transparency, and False otherwise | [
"Returns",
"true",
"if",
"the",
"item",
"is",
"entirely",
"transparent",
"None",
"if",
"mixed",
"transparency",
"and",
"False",
"otherwise"
] | def transparent(self):
"""Returns true if the item is entirely transparent, None if mixed transparency, and False otherwise"""
if len(self.subAppearances)!=0:
anyTransp = False
anyOpaque = False
for n,app in self.subAppearances.iteritems():
if app.tran... | [
"def",
"transparent",
"(",
"self",
")",
":",
"if",
"len",
"(",
"self",
".",
"subAppearances",
")",
"!=",
"0",
":",
"anyTransp",
"=",
"False",
"anyOpaque",
"=",
"False",
"for",
"n",
",",
"app",
"in",
"self",
".",
"subAppearances",
".",
"iteritems",
"(",... | https://github.com/krishauser/Klampt/blob/972cc83ea5befac3f653c1ba20f80155768ad519/Python/python2_version/klampt/vis/visualization.py#L1914-L1938 | ||
apache/mesos | 97d9a4063332aae3825d78de71611657e05cf5e2 | support/cpplint.py | python | CleanseComments | (line) | return _RE_PATTERN_CLEANSE_LINE_C_COMMENTS.sub('', line) | Removes //-comments and single-line C-style /* */ comments.
Args:
line: A line of C++ source.
Returns:
The line with single-line comments removed. | Removes //-comments and single-line C-style /* */ comments. | [
"Removes",
"//",
"-",
"comments",
"and",
"single",
"-",
"line",
"C",
"-",
"style",
"/",
"*",
"*",
"/",
"comments",
"."
] | def CleanseComments(line):
"""Removes //-comments and single-line C-style /* */ comments.
Args:
line: A line of C++ source.
Returns:
The line with single-line comments removed.
"""
commentpos = line.find('//')
if commentpos != -1 and not IsCppString(line[:commentpos]):
line = line[:commentpos]... | [
"def",
"CleanseComments",
"(",
"line",
")",
":",
"commentpos",
"=",
"line",
".",
"find",
"(",
"'//'",
")",
"if",
"commentpos",
"!=",
"-",
"1",
"and",
"not",
"IsCppString",
"(",
"line",
"[",
":",
"commentpos",
"]",
")",
":",
"line",
"=",
"line",
"[",
... | https://github.com/apache/mesos/blob/97d9a4063332aae3825d78de71611657e05cf5e2/support/cpplint.py#L1413-L1426 | |
baidu-research/tensorflow-allreduce | 66d5b855e90b0949e9fa5cca5599fd729a70e874 | tensorflow/python/profiler/option_builder.py | python | ProfileOptionBuilder.with_file_output | (self, outfile) | return self | Print the result to a file. | Print the result to a file. | [
"Print",
"the",
"result",
"to",
"a",
"file",
"."
] | def with_file_output(self, outfile):
"""Print the result to a file."""
self._options['output'] = 'file:outfile=%s' % outfile
return self | [
"def",
"with_file_output",
"(",
"self",
",",
"outfile",
")",
":",
"self",
".",
"_options",
"[",
"'output'",
"]",
"=",
"'file:outfile=%s'",
"%",
"outfile",
"return",
"self"
] | https://github.com/baidu-research/tensorflow-allreduce/blob/66d5b855e90b0949e9fa5cca5599fd729a70e874/tensorflow/python/profiler/option_builder.py#L346-L349 | |
eclipse/sumo | 7132a9b8b6eea734bdec38479026b4d8c4336d03 | tools/contributed/sumopy/plugins/mapmatching/wxgui.py | python | WxGui.on_select_mode | (self, event=None) | Select GPS traces of a specific mode.
The mode is selected only among the currently selected trips. | Select GPS traces of a specific mode.
The mode is selected only among the currently selected trips. | [
"Select",
"GPS",
"traces",
"of",
"a",
"specific",
"mode",
".",
"The",
"mode",
"is",
"selected",
"only",
"among",
"the",
"currently",
"selected",
"trips",
"."
] | def on_select_mode(self, event=None):
"""
Select GPS traces of a specific mode.
The mode is selected only among the currently selected trips.
"""
p = mapmatching.ModeSelector(self._mapmatching, logger=self._mainframe.get_logger())
dlg = ProcessDialog(self._mainframe, p, i... | [
"def",
"on_select_mode",
"(",
"self",
",",
"event",
"=",
"None",
")",
":",
"p",
"=",
"mapmatching",
".",
"ModeSelector",
"(",
"self",
".",
"_mapmatching",
",",
"logger",
"=",
"self",
".",
"_mainframe",
".",
"get_logger",
"(",
")",
")",
"dlg",
"=",
"Pro... | https://github.com/eclipse/sumo/blob/7132a9b8b6eea734bdec38479026b4d8c4336d03/tools/contributed/sumopy/plugins/mapmatching/wxgui.py#L1201-L1226 | ||
hanpfei/chromium-net | 392cc1fa3a8f92f42e4071ab6e674d8e0482f83f | third_party/catapult/dashboard/dashboard/find_change_points.py | python | _FindSplit | (values) | return min(range(1, len(values)), key=StdDevOfTwoNormalizedSides) | Finds the index of the "most interesting" split of a sample of data.
Currently, the most interesting split is considered to be the split that
minimizes the standard deviation of the two sides concatenated together
(after modifying both sides by shifting all the numbers in the left and
right sides by the median... | Finds the index of the "most interesting" split of a sample of data. | [
"Finds",
"the",
"index",
"of",
"the",
"most",
"interesting",
"split",
"of",
"a",
"sample",
"of",
"data",
"."
] | def _FindSplit(values):
"""Finds the index of the "most interesting" split of a sample of data.
Currently, the most interesting split is considered to be the split that
minimizes the standard deviation of the two sides concatenated together
(after modifying both sides by shifting all the numbers in the left an... | [
"def",
"_FindSplit",
"(",
"values",
")",
":",
"def",
"StdDevOfTwoNormalizedSides",
"(",
"index",
")",
":",
"left",
",",
"right",
"=",
"values",
"[",
":",
"index",
"]",
",",
"values",
"[",
"index",
":",
"]",
"return",
"math_utils",
".",
"StandardDeviation",... | https://github.com/hanpfei/chromium-net/blob/392cc1fa3a8f92f42e4071ab6e674d8e0482f83f/third_party/catapult/dashboard/dashboard/find_change_points.py#L148-L169 | |
CRYTEK/CRYENGINE | 232227c59a220cbbd311576f0fbeba7bb53b2a8c | Editor/Python/windows/Lib/site-packages/pip/_vendor/pkg_resources/__init__.py | python | Environment.add | (self, dist) | Add `dist` if we ``can_add()`` it and it has not already been added | Add `dist` if we ``can_add()`` it and it has not already been added | [
"Add",
"dist",
"if",
"we",
"can_add",
"()",
"it",
"and",
"it",
"has",
"not",
"already",
"been",
"added"
] | def add(self, dist):
"""Add `dist` if we ``can_add()`` it and it has not already been added
"""
if self.can_add(dist) and dist.has_version():
dists = self._distmap.setdefault(dist.key, [])
if dist not in dists:
dists.append(dist)
dists.sort... | [
"def",
"add",
"(",
"self",
",",
"dist",
")",
":",
"if",
"self",
".",
"can_add",
"(",
"dist",
")",
"and",
"dist",
".",
"has_version",
"(",
")",
":",
"dists",
"=",
"self",
".",
"_distmap",
".",
"setdefault",
"(",
"dist",
".",
"key",
",",
"[",
"]",
... | https://github.com/CRYTEK/CRYENGINE/blob/232227c59a220cbbd311576f0fbeba7bb53b2a8c/Editor/Python/windows/Lib/site-packages/pip/_vendor/pkg_resources/__init__.py#L1034-L1041 | ||
wxWidgets/wxPython-Classic | 19571e1ae65f1ac445f5491474121998c97a1bf0 | src/osx_carbon/_misc.py | python | DateTime.MakeFromTimezone | (*args, **kwargs) | return _misc_.DateTime_MakeFromTimezone(*args, **kwargs) | MakeFromTimezone(self, wxDateTime::TimeZone tz, bool noDST=False) -> DateTime | MakeFromTimezone(self, wxDateTime::TimeZone tz, bool noDST=False) -> DateTime | [
"MakeFromTimezone",
"(",
"self",
"wxDateTime",
"::",
"TimeZone",
"tz",
"bool",
"noDST",
"=",
"False",
")",
"-",
">",
"DateTime"
] | def MakeFromTimezone(*args, **kwargs):
"""MakeFromTimezone(self, wxDateTime::TimeZone tz, bool noDST=False) -> DateTime"""
return _misc_.DateTime_MakeFromTimezone(*args, **kwargs) | [
"def",
"MakeFromTimezone",
"(",
"*",
"args",
",",
"*",
"*",
"kwargs",
")",
":",
"return",
"_misc_",
".",
"DateTime_MakeFromTimezone",
"(",
"*",
"args",
",",
"*",
"*",
"kwargs",
")"
] | https://github.com/wxWidgets/wxPython-Classic/blob/19571e1ae65f1ac445f5491474121998c97a1bf0/src/osx_carbon/_misc.py#L3934-L3936 | |
wxWidgets/wxPython-Classic | 19571e1ae65f1ac445f5491474121998c97a1bf0 | wx/lib/agw/xlsgrid.py | python | Excel.GetText | (self, row, col) | Returns the WYSIWYG text contained in a cell.
:param `row`: the row in which the cell lives;
:param `col`: the column in which the cell lives.
:note: The `row` and `col` parameters are not real Python index, as they
use the Excel indexing mode (i.e., first index is 1 and not 0). | Returns the WYSIWYG text contained in a cell. | [
"Returns",
"the",
"WYSIWYG",
"text",
"contained",
"in",
"a",
"cell",
"."
] | def GetText(self, row, col):
"""
Returns the WYSIWYG text contained in a cell.
:param `row`: the row in which the cell lives;
:param `col`: the column in which the cell lives.
:note: The `row` and `col` parameters are not real Python index, as they
use the Excel indexi... | [
"def",
"GetText",
"(",
"self",
",",
"row",
",",
"col",
")",
":",
"cell",
"=",
"self",
".",
"sheet",
".",
"Cells",
"(",
"row",
",",
"col",
")",
"if",
"cell",
":",
"return",
"cell",
".",
"Text"
] | https://github.com/wxWidgets/wxPython-Classic/blob/19571e1ae65f1ac445f5491474121998c97a1bf0/wx/lib/agw/xlsgrid.py#L580-L594 | ||
mantidproject/mantid | 03deeb89254ec4289edb8771e0188c2090a02f32 | Framework/PythonInterface/plugins/algorithms/WorkflowAlgorithms/ReflectometryISISPreprocess.py | python | ReflectometryISISPreprocess.seeAlso | (self) | return ['ReflectometryISISLoadAndProcess', 'ReflectometryReductionOneAuto'] | Return a list of related algorithm names. | Return a list of related algorithm names. | [
"Return",
"a",
"list",
"of",
"related",
"algorithm",
"names",
"."
] | def seeAlso(self):
"""Return a list of related algorithm names."""
return ['ReflectometryISISLoadAndProcess', 'ReflectometryReductionOneAuto'] | [
"def",
"seeAlso",
"(",
"self",
")",
":",
"return",
"[",
"'ReflectometryISISLoadAndProcess'",
",",
"'ReflectometryReductionOneAuto'",
"]"
] | https://github.com/mantidproject/mantid/blob/03deeb89254ec4289edb8771e0188c2090a02f32/Framework/PythonInterface/plugins/algorithms/WorkflowAlgorithms/ReflectometryISISPreprocess.py#L37-L39 | |
catboost/catboost | 167f64f237114a4d10b2b4ee42adb4569137debe | contrib/tools/python3/src/Lib/pty.py | python | _copy | (master_fd, master_read=_read, stdin_read=_read) | Parent copy loop.
Copies
pty master -> standard output (master_read)
standard input -> pty master (stdin_read) | Parent copy loop.
Copies
pty master -> standard output (master_read)
standard input -> pty master (stdin_read) | [
"Parent",
"copy",
"loop",
".",
"Copies",
"pty",
"master",
"-",
">",
"standard",
"output",
"(",
"master_read",
")",
"standard",
"input",
"-",
">",
"pty",
"master",
"(",
"stdin_read",
")"
] | def _copy(master_fd, master_read=_read, stdin_read=_read):
"""Parent copy loop.
Copies
pty master -> standard output (master_read)
standard input -> pty master (stdin_read)"""
fds = [master_fd, STDIN_FILENO]
while True:
rfds, wfds, xfds = select(fds, [], [])
... | [
"def",
"_copy",
"(",
"master_fd",
",",
"master_read",
"=",
"_read",
",",
"stdin_read",
"=",
"_read",
")",
":",
"fds",
"=",
"[",
"master_fd",
",",
"STDIN_FILENO",
"]",
"while",
"True",
":",
"rfds",
",",
"wfds",
",",
"xfds",
"=",
"select",
"(",
"fds",
... | https://github.com/catboost/catboost/blob/167f64f237114a4d10b2b4ee42adb4569137debe/contrib/tools/python3/src/Lib/pty.py#L130-L149 | ||
Xilinx/Vitis-AI | fc74d404563d9951b57245443c73bef389f3657f | tools/Vitis-AI-Quantizer/vai_q_tensorflow1.x/tensorflow/python/autograph/pyct/compiler.py | python | source_to_entity | (source, delete_on_exit) | return imp.load_source(module_name, f.name), f.name | Loads the given source code as a Python module. | Loads the given source code as a Python module. | [
"Loads",
"the",
"given",
"source",
"code",
"as",
"a",
"Python",
"module",
"."
] | def source_to_entity(source, delete_on_exit):
"""Loads the given source code as a Python module."""
if six.PY2:
source = source.encode('utf-8')
f = tempfile.NamedTemporaryFile(mode='w', suffix='.py', delete=False)
else:
f = tempfile.NamedTemporaryFile( # pylint:disable=unexpected-keyword-arg
... | [
"def",
"source_to_entity",
"(",
"source",
",",
"delete_on_exit",
")",
":",
"if",
"six",
".",
"PY2",
":",
"source",
"=",
"source",
".",
"encode",
"(",
"'utf-8'",
")",
"f",
"=",
"tempfile",
".",
"NamedTemporaryFile",
"(",
"mode",
"=",
"'w'",
",",
"suffix",... | https://github.com/Xilinx/Vitis-AI/blob/fc74d404563d9951b57245443c73bef389f3657f/tools/Vitis-AI-Quantizer/vai_q_tensorflow1.x/tensorflow/python/autograph/pyct/compiler.py#L89-L104 | |
chuckcho/video-caffe | fc232b3e3a90ea22dd041b9fc5c542f170581f20 | tools/extra/resize_and_crop_images.py | python | OpenCVResizeCrop.resize_and_crop_image | (self, input_file, output_file, output_side_length = 256) | Takes an image name, resize it and crop the center square | Takes an image name, resize it and crop the center square | [
"Takes",
"an",
"image",
"name",
"resize",
"it",
"and",
"crop",
"the",
"center",
"square"
] | def resize_and_crop_image(self, input_file, output_file, output_side_length = 256):
'''Takes an image name, resize it and crop the center square
'''
img = cv2.imread(input_file)
height, width, depth = img.shape
new_height = output_side_length
new_width = output_side_lengt... | [
"def",
"resize_and_crop_image",
"(",
"self",
",",
"input_file",
",",
"output_file",
",",
"output_side_length",
"=",
"256",
")",
":",
"img",
"=",
"cv2",
".",
"imread",
"(",
"input_file",
")",
"height",
",",
"width",
",",
"depth",
"=",
"img",
".",
"shape",
... | https://github.com/chuckcho/video-caffe/blob/fc232b3e3a90ea22dd041b9fc5c542f170581f20/tools/extra/resize_and_crop_images.py#L20-L36 | ||
mongodb/mongo | d8ff665343ad29cf286ee2cf4a1960d29371937b | buildscripts/resmokelib/powercycle/powercycle.py | python | new_resmoke_config | (config_file, new_config_file, test_data, eval_str="") | Create 'new_config_file', from 'config_file', with an update from 'test_data'. | Create 'new_config_file', from 'config_file', with an update from 'test_data'. | [
"Create",
"new_config_file",
"from",
"config_file",
"with",
"an",
"update",
"from",
"test_data",
"."
] | def new_resmoke_config(config_file, new_config_file, test_data, eval_str=""):
"""Create 'new_config_file', from 'config_file', with an update from 'test_data'."""
new_config = {
"executor": {
"config": {"shell_options": {"eval": eval_str, "global_vars": {"TestData": test_data}}}
}
... | [
"def",
"new_resmoke_config",
"(",
"config_file",
",",
"new_config_file",
",",
"test_data",
",",
"eval_str",
"=",
"\"\"",
")",
":",
"new_config",
"=",
"{",
"\"executor\"",
":",
"{",
"\"config\"",
":",
"{",
"\"shell_options\"",
":",
"{",
"\"eval\"",
":",
"eval_s... | https://github.com/mongodb/mongo/blob/d8ff665343ad29cf286ee2cf4a1960d29371937b/buildscripts/resmokelib/powercycle/powercycle.py#L1257-L1268 | ||
catboost/catboost | 167f64f237114a4d10b2b4ee42adb4569137debe | contrib/python/joblib/joblib/compressor.py | python | BinaryZlibFile.writable | (self) | return self._mode == _MODE_WRITE | Return whether the file was opened for writing. | Return whether the file was opened for writing. | [
"Return",
"whether",
"the",
"file",
"was",
"opened",
"for",
"writing",
"."
] | def writable(self):
"""Return whether the file was opened for writing."""
self._check_not_closed()
return self._mode == _MODE_WRITE | [
"def",
"writable",
"(",
"self",
")",
":",
"self",
".",
"_check_not_closed",
"(",
")",
"return",
"self",
".",
"_mode",
"==",
"_MODE_WRITE"
] | https://github.com/catboost/catboost/blob/167f64f237114a4d10b2b4ee42adb4569137debe/contrib/python/joblib/joblib/compressor.py#L340-L343 | |
aws/lumberyard | f85344403c1c2e77ec8c75deb2c116e97b713217 | dev/Tools/AWSPythonSDK/1.5.8/docutils/transforms/references.py | python | Footnotes.resolve_footnotes_and_citations | (self) | Link manually-labeled footnotes and citations to/from their
references. | Link manually-labeled footnotes and citations to/from their
references. | [
"Link",
"manually",
"-",
"labeled",
"footnotes",
"and",
"citations",
"to",
"/",
"from",
"their",
"references",
"."
] | def resolve_footnotes_and_citations(self):
"""
Link manually-labeled footnotes and citations to/from their
references.
"""
for footnote in self.document.footnotes:
for label in footnote['names']:
if label in self.document.footnote_refs:
... | [
"def",
"resolve_footnotes_and_citations",
"(",
"self",
")",
":",
"for",
"footnote",
"in",
"self",
".",
"document",
".",
"footnotes",
":",
"for",
"label",
"in",
"footnote",
"[",
"'names'",
"]",
":",
"if",
"label",
"in",
"self",
".",
"document",
".",
"footno... | https://github.com/aws/lumberyard/blob/f85344403c1c2e77ec8c75deb2c116e97b713217/dev/Tools/AWSPythonSDK/1.5.8/docutils/transforms/references.py#L598-L612 | ||
kamyu104/LeetCode-Solutions | 77605708a927ea3b85aee5a479db733938c7c211 | Python/path-in-zigzag-labelled-binary-tree.py | python | Solution.pathInZigZagTree | (self, label) | return result | :type label: int
:rtype: List[int] | :type label: int
:rtype: List[int] | [
":",
"type",
"label",
":",
"int",
":",
"rtype",
":",
"List",
"[",
"int",
"]"
] | def pathInZigZagTree(self, label):
"""
:type label: int
:rtype: List[int]
"""
count = 2**label.bit_length()
result = []
while label >= 1:
result.append(label)
label = ((count//2) + ((count-1)-label)) // 2
count //= 2
res... | [
"def",
"pathInZigZagTree",
"(",
"self",
",",
"label",
")",
":",
"count",
"=",
"2",
"**",
"label",
".",
"bit_length",
"(",
")",
"result",
"=",
"[",
"]",
"while",
"label",
">=",
"1",
":",
"result",
".",
"append",
"(",
"label",
")",
"label",
"=",
"(",... | https://github.com/kamyu104/LeetCode-Solutions/blob/77605708a927ea3b85aee5a479db733938c7c211/Python/path-in-zigzag-labelled-binary-tree.py#L5-L17 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.