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/gtk/stc.py | python | StyledTextCtrl.ReplaceSelection | (*args, **kwargs) | return _stc.StyledTextCtrl_ReplaceSelection(*args, **kwargs) | ReplaceSelection(self, String text)
Replace the selected text with the argument text. | ReplaceSelection(self, String text) | [
"ReplaceSelection",
"(",
"self",
"String",
"text",
")"
] | def ReplaceSelection(*args, **kwargs):
"""
ReplaceSelection(self, String text)
Replace the selected text with the argument text.
"""
return _stc.StyledTextCtrl_ReplaceSelection(*args, **kwargs) | [
"def",
"ReplaceSelection",
"(",
"*",
"args",
",",
"*",
"*",
"kwargs",
")",
":",
"return",
"_stc",
".",
"StyledTextCtrl_ReplaceSelection",
"(",
"*",
"args",
",",
"*",
"*",
"kwargs",
")"
] | https://github.com/wxWidgets/wxPython-Classic/blob/19571e1ae65f1ac445f5491474121998c97a1bf0/src/gtk/stc.py#L3633-L3639 | |
eclipse/sumo | 7132a9b8b6eea734bdec38479026b4d8c4336d03 | tools/contributed/sumopy/coremodules/simulation/results.py | python | TrajectoryReader.__init__ | (self, element, sumo) | element is "lane" or "edge" or "tripinfo"
attrnames is a list of attribute names to read. | element is "lane" or "edge" or "tripinfo"
attrnames is a list of attribute names to read. | [
"element",
"is",
"lane",
"or",
"edge",
"or",
"tripinfo",
"attrnames",
"is",
"a",
"list",
"of",
"attribute",
"names",
"to",
"read",
"."
] | def __init__(self, element, sumo):
"""
element is "lane" or "edge" or "tripinfo"
attrnames is a list of attribute names to read.
"""
print 'TrajectoryReader', element
# print ' attrsconfigs_cumulative',attrsconfigs_cumulative
# print ' attrsconfigs_average',attr... | [
"def",
"__init__",
"(",
"self",
",",
"element",
",",
"sumo",
")",
":",
"print",
"'TrajectoryReader'",
",",
"element",
"# print ' attrsconfigs_cumulative',attrsconfigs_cumulative",
"# print ' attrsconfigs_average',attrsconfigs_average",
"IntervalAvReader2",
".",
"__init__",
"(... | https://github.com/eclipse/sumo/blob/7132a9b8b6eea734bdec38479026b4d8c4336d03/tools/contributed/sumopy/coremodules/simulation/results.py#L2433-L2453 | ||
hpi-xnor/BMXNet-v2 | af2b1859eafc5c721b1397cef02f946aaf2ce20d | example/sparse/linear_classification/weighted_softmax_ce.py | python | WeightedSoftmaxCrossEntropyLoss.backward | (self, req, out_grad, in_data, out_data, in_grad, aux) | Implements backward computation
req : list of {'null', 'write', 'inplace', 'add'}, how to assign to in_grad
out_grad : list of NDArray, gradient w.r.t. output data.
in_grad : list of NDArray, gradient w.r.t. input data. This is the output buffer. | Implements backward computation | [
"Implements",
"backward",
"computation"
] | def backward(self, req, out_grad, in_data, out_data, in_grad, aux):
"""Implements backward computation
req : list of {'null', 'write', 'inplace', 'add'}, how to assign to in_grad
out_grad : list of NDArray, gradient w.r.t. output data.
in_grad : list of NDArray, gradient w.r.t. input da... | [
"def",
"backward",
"(",
"self",
",",
"req",
",",
"out_grad",
",",
"in_data",
",",
"out_data",
",",
"in_grad",
",",
"aux",
")",
":",
"label",
"=",
"in_data",
"[",
"1",
"]",
"pred",
"=",
"out_data",
"[",
"0",
"]",
"dx",
"=",
"pred",
"-",
"mx",
".",... | https://github.com/hpi-xnor/BMXNet-v2/blob/af2b1859eafc5c721b1397cef02f946aaf2ce20d/example/sparse/linear_classification/weighted_softmax_ce.py#L44-L57 | ||
krishauser/Klampt | 972cc83ea5befac3f653c1ba20f80155768ad519 | Python/klampt/src/robotsim.py | python | RobotModel.getName | (self) | return _robotsim.RobotModel_getName(self) | r"""
getName(RobotModel self) -> char const * | r"""
getName(RobotModel self) -> char const * | [
"r",
"getName",
"(",
"RobotModel",
"self",
")",
"-",
">",
"char",
"const",
"*"
] | def getName(self) -> "char const *":
r"""
getName(RobotModel self) -> char const *
"""
return _robotsim.RobotModel_getName(self) | [
"def",
"getName",
"(",
"self",
")",
"->",
"\"char const *\"",
":",
"return",
"_robotsim",
".",
"RobotModel_getName",
"(",
"self",
")"
] | https://github.com/krishauser/Klampt/blob/972cc83ea5befac3f653c1ba20f80155768ad519/Python/klampt/src/robotsim.py#L4869-L4875 | |
larroy/clearskies_core | 3574ddf0edc8555454c7044126e786a6c29444dc | tools/gyp/pylib/gyp/generator/ninja.py | python | NinjaWriter.WriteMacBundleResources | (self, resources, bundle_depends) | Writes ninja edges for 'mac_bundle_resources'. | Writes ninja edges for 'mac_bundle_resources'. | [
"Writes",
"ninja",
"edges",
"for",
"mac_bundle_resources",
"."
] | def WriteMacBundleResources(self, resources, bundle_depends):
"""Writes ninja edges for 'mac_bundle_resources'."""
for output, res in gyp.xcode_emulation.GetMacBundleResources(
generator_default_variables['PRODUCT_DIR'],
self.xcode_settings, map(self.GypPathToNinja, resources)):
output = s... | [
"def",
"WriteMacBundleResources",
"(",
"self",
",",
"resources",
",",
"bundle_depends",
")",
":",
"for",
"output",
",",
"res",
"in",
"gyp",
".",
"xcode_emulation",
".",
"GetMacBundleResources",
"(",
"generator_default_variables",
"[",
"'PRODUCT_DIR'",
"]",
",",
"s... | https://github.com/larroy/clearskies_core/blob/3574ddf0edc8555454c7044126e786a6c29444dc/tools/gyp/pylib/gyp/generator/ninja.py#L746-L754 | ||
hanpfei/chromium-net | 392cc1fa3a8f92f42e4071ab6e674d8e0482f83f | third_party/catapult/third_party/gsutil/third_party/protorpc/protorpc/remote.py | python | Protocols.get_default | (cls) | return default_protocols | Get the global default Protocols instance.
Returns:
Current global default Protocols instance. | Get the global default Protocols instance. | [
"Get",
"the",
"global",
"default",
"Protocols",
"instance",
"."
] | def get_default(cls):
"""Get the global default Protocols instance.
Returns:
Current global default Protocols instance.
"""
default_protocols = cls.__default_protocols
if default_protocols is None:
with cls.__lock:
default_protocols = cls.__default_protocols
if default_p... | [
"def",
"get_default",
"(",
"cls",
")",
":",
"default_protocols",
"=",
"cls",
".",
"__default_protocols",
"if",
"default_protocols",
"is",
"None",
":",
"with",
"cls",
".",
"__lock",
":",
"default_protocols",
"=",
"cls",
".",
"__default_protocols",
"if",
"default_... | https://github.com/hanpfei/chromium-net/blob/392cc1fa3a8f92f42e4071ab6e674d8e0482f83f/third_party/catapult/third_party/gsutil/third_party/protorpc/protorpc/remote.py#L1218-L1231 | |
google/syzygy | 8164b24ebde9c5649c9a09e88a7fc0b0fcbd1bc5 | third_party/numpy/files/numpy/distutils/mingw32ccompiler.py | python | _build_import_library_x86 | () | return | Build the import libraries for Mingw32-gcc on Windows | Build the import libraries for Mingw32-gcc on Windows | [
"Build",
"the",
"import",
"libraries",
"for",
"Mingw32",
"-",
"gcc",
"on",
"Windows"
] | def _build_import_library_x86():
""" Build the import libraries for Mingw32-gcc on Windows
"""
lib_name = "python%d%d.lib" % tuple(sys.version_info[:2])
lib_file = os.path.join(sys.prefix,'libs',lib_name)
out_name = "libpython%d%d.a" % tuple(sys.version_info[:2])
out_file = os.path.join(sys.pref... | [
"def",
"_build_import_library_x86",
"(",
")",
":",
"lib_name",
"=",
"\"python%d%d.lib\"",
"%",
"tuple",
"(",
"sys",
".",
"version_info",
"[",
":",
"2",
"]",
")",
"lib_file",
"=",
"os",
".",
"path",
".",
"join",
"(",
"sys",
".",
"prefix",
",",
"'libs'",
... | https://github.com/google/syzygy/blob/8164b24ebde9c5649c9a09e88a7fc0b0fcbd1bc5/third_party/numpy/files/numpy/distutils/mingw32ccompiler.py#L325-L359 | |
windystrife/UnrealEngine_NVIDIAGameWorks | b50e6338a7c5b26374d66306ebc7807541ff815e | Engine/Extras/ThirdPartyNotUE/emsdk/Win64/python/2.7.5.3_64bit/Lib/distutils/dir_util.py | python | remove_tree | (directory, verbose=1, dry_run=0) | Recursively remove an entire directory tree.
Any errors are ignored (apart from being reported to stdout if 'verbose'
is true). | Recursively remove an entire directory tree. | [
"Recursively",
"remove",
"an",
"entire",
"directory",
"tree",
"."
] | def remove_tree(directory, verbose=1, dry_run=0):
"""Recursively remove an entire directory tree.
Any errors are ignored (apart from being reported to stdout if 'verbose'
is true).
"""
from distutils.util import grok_environment_error
global _path_created
if verbose >= 1:
log.info(... | [
"def",
"remove_tree",
"(",
"directory",
",",
"verbose",
"=",
"1",
",",
"dry_run",
"=",
"0",
")",
":",
"from",
"distutils",
".",
"util",
"import",
"grok_environment_error",
"global",
"_path_created",
"if",
"verbose",
">=",
"1",
":",
"log",
".",
"info",
"(",... | https://github.com/windystrife/UnrealEngine_NVIDIAGameWorks/blob/b50e6338a7c5b26374d66306ebc7807541ff815e/Engine/Extras/ThirdPartyNotUE/emsdk/Win64/python/2.7.5.3_64bit/Lib/distutils/dir_util.py#L182-L206 | ||
electron/electron | 8dfcf817e4182c48cd7e9d3471319c61224677e3 | script/lib/patches.py | python | read_patch | (patch_dir, patch_filename) | return ''.join(ret) | Read a patch from |patch_dir/filename| and amend the commit message with
metadata about the patch file it came from. | Read a patch from |patch_dir/filename| and amend the commit message with
metadata about the patch file it came from. | [
"Read",
"a",
"patch",
"from",
"|patch_dir",
"/",
"filename|",
"and",
"amend",
"the",
"commit",
"message",
"with",
"metadata",
"about",
"the",
"patch",
"file",
"it",
"came",
"from",
"."
] | def read_patch(patch_dir, patch_filename):
"""Read a patch from |patch_dir/filename| and amend the commit message with
metadata about the patch file it came from."""
ret = []
added_filename_line = False
patch_path = os.path.join(patch_dir, patch_filename)
with codecs.open(patch_path, encoding='utf-8') as f:... | [
"def",
"read_patch",
"(",
"patch_dir",
",",
"patch_filename",
")",
":",
"ret",
"=",
"[",
"]",
"added_filename_line",
"=",
"False",
"patch_path",
"=",
"os",
".",
"path",
".",
"join",
"(",
"patch_dir",
",",
"patch_filename",
")",
"with",
"codecs",
".",
"open... | https://github.com/electron/electron/blob/8dfcf817e4182c48cd7e9d3471319c61224677e3/script/lib/patches.py#L7-L20 | |
wxWidgets/wxPython-Classic | 19571e1ae65f1ac445f5491474121998c97a1bf0 | src/gtk/_controls.py | python | ToolBarBase.SetDropdownMenu | (*args, **kwargs) | return _controls_.ToolBarBase_SetDropdownMenu(*args, **kwargs) | SetDropdownMenu(self, int toolid, Menu menu) -> bool | SetDropdownMenu(self, int toolid, Menu menu) -> bool | [
"SetDropdownMenu",
"(",
"self",
"int",
"toolid",
"Menu",
"menu",
")",
"-",
">",
"bool"
] | def SetDropdownMenu(*args, **kwargs):
"""SetDropdownMenu(self, int toolid, Menu menu) -> bool"""
return _controls_.ToolBarBase_SetDropdownMenu(*args, **kwargs) | [
"def",
"SetDropdownMenu",
"(",
"*",
"args",
",",
"*",
"*",
"kwargs",
")",
":",
"return",
"_controls_",
".",
"ToolBarBase_SetDropdownMenu",
"(",
"*",
"args",
",",
"*",
"*",
"kwargs",
")"
] | https://github.com/wxWidgets/wxPython-Classic/blob/19571e1ae65f1ac445f5491474121998c97a1bf0/src/gtk/_controls.py#L3919-L3921 | |
wlanjie/AndroidFFmpeg | 7baf9122f4b8e1c74e7baf4be5c422c7a5ba5aaf | tools/fdk-aac-build/armeabi-v7a/toolchain/lib/python2.7/lib2to3/fixer_util.py | python | ListComp | (xp, fp, it, test=None) | return Node(syms.atom,
[Leaf(token.LBRACE, u"["),
inner,
Leaf(token.RBRACE, u"]")]) | A list comprehension of the form [xp for fp in it if test].
If test is None, the "if test" part is omitted. | A list comprehension of the form [xp for fp in it if test]. | [
"A",
"list",
"comprehension",
"of",
"the",
"form",
"[",
"xp",
"for",
"fp",
"in",
"it",
"if",
"test",
"]",
"."
] | def ListComp(xp, fp, it, test=None):
"""A list comprehension of the form [xp for fp in it if test].
If test is None, the "if test" part is omitted.
"""
xp.prefix = u""
fp.prefix = u" "
it.prefix = u" "
for_leaf = Leaf(token.NAME, u"for")
for_leaf.prefix = u" "
in_leaf = Leaf(token.N... | [
"def",
"ListComp",
"(",
"xp",
",",
"fp",
",",
"it",
",",
"test",
"=",
"None",
")",
":",
"xp",
".",
"prefix",
"=",
"u\"\"",
"fp",
".",
"prefix",
"=",
"u\" \"",
"it",
".",
"prefix",
"=",
"u\" \"",
"for_leaf",
"=",
"Leaf",
"(",
"token",
".",
"NAME",... | https://github.com/wlanjie/AndroidFFmpeg/blob/7baf9122f4b8e1c74e7baf4be5c422c7a5ba5aaf/tools/fdk-aac-build/armeabi-v7a/toolchain/lib/python2.7/lib2to3/fixer_util.py#L89-L111 | |
openweave/openweave-core | 11ceb6b7efd39fe05de7f79229247a5774d56766 | src/device-manager/python/weave-device-mgr.py | python | DeviceMgrCmd.do_blediagtest | (self, line) | return | ble-diag-test [ <options> ]
Perform BLE throughput test.
Options:
--packet-count # | -c #
Specifies total packet count for the test.
--duration # | -t #
Specifies a test duration (unit: second).
--payload-size # | -s #
Specifies t... | ble-diag-test [ <options> ] | [
"ble",
"-",
"diag",
"-",
"test",
"[",
"<options",
">",
"]"
] | def do_blediagtest(self, line):
"""
ble-diag-test [ <options> ]
Perform BLE throughput test.
Options:
--packet-count # | -c #
Specifies total packet count for the test.
--duration # | -t #
Specifies a test duration (unit: second).
... | [
"def",
"do_blediagtest",
"(",
"self",
",",
"line",
")",
":",
"args",
"=",
"shlex",
".",
"split",
"(",
"line",
")",
"optParser",
"=",
"OptionParser",
"(",
"usage",
"=",
"optparse",
".",
"SUPPRESS_USAGE",
",",
"option_class",
"=",
"ExtendedOption",
")",
"opt... | https://github.com/openweave/openweave-core/blob/11ceb6b7efd39fe05de7f79229247a5774d56766/src/device-manager/python/weave-device-mgr.py#L513-L629 | |
hanpfei/chromium-net | 392cc1fa3a8f92f42e4071ab6e674d8e0482f83f | tools/run-bisect-perf-regression.py | python | Goma._SetupAndStart | (self) | Sets up goma and launches it.
Args:
path_to_goma: Path to goma directory.
Returns:
True if successful. | Sets up goma and launches it. | [
"Sets",
"up",
"goma",
"and",
"launches",
"it",
"."
] | def _SetupAndStart(self):
"""Sets up goma and launches it.
Args:
path_to_goma: Path to goma directory.
Returns:
True if successful."""
self._SetupEnvVars()
# Sometimes goma is lingering around if something went bad on a previous
# run. Stop it before starting a new process. Can ig... | [
"def",
"_SetupAndStart",
"(",
"self",
")",
":",
"self",
".",
"_SetupEnvVars",
"(",
")",
"# Sometimes goma is lingering around if something went bad on a previous",
"# run. Stop it before starting a new process. Can ignore the return code",
"# since it will return an error if it wasn't runn... | https://github.com/hanpfei/chromium-net/blob/392cc1fa3a8f92f42e4071ab6e674d8e0482f83f/tools/run-bisect-perf-regression.py#L82-L98 | ||
MythTV/mythtv | d282a209cb8be85d036f85a62a8ec971b67d45f4 | mythtv/programs/scripts/metadata/Music/musicbrainzngs/caa.py | python | get_image_front | (releaseid, size=None) | return get_image(releaseid, "front", size=size) | Download the front cover art for a release.
The `size` argument and the possible error conditions are the same as for
:meth:`get_image`. | Download the front cover art for a release.
The `size` argument and the possible error conditions are the same as for
:meth:`get_image`. | [
"Download",
"the",
"front",
"cover",
"art",
"for",
"a",
"release",
".",
"The",
"size",
"argument",
"and",
"the",
"possible",
"error",
"conditions",
"are",
"the",
"same",
"as",
"for",
":",
"meth",
":",
"get_image",
"."
] | def get_image_front(releaseid, size=None):
"""Download the front cover art for a release.
The `size` argument and the possible error conditions are the same as for
:meth:`get_image`.
"""
return get_image(releaseid, "front", size=size) | [
"def",
"get_image_front",
"(",
"releaseid",
",",
"size",
"=",
"None",
")",
":",
"return",
"get_image",
"(",
"releaseid",
",",
"\"front\"",
",",
"size",
"=",
"size",
")"
] | https://github.com/MythTV/mythtv/blob/d282a209cb8be85d036f85a62a8ec971b67d45f4/mythtv/programs/scripts/metadata/Music/musicbrainzngs/caa.py#L127-L132 | |
aws/lumberyard | f85344403c1c2e77ec8c75deb2c116e97b713217 | dev/Gems/CloudGemMetric/v1/AWS/python/windows/Lib/pandas/io/formats/style.py | python | Styler.set_caption | (self, caption) | return self | Set the caption on a Styler.
Parameters
----------
caption : str
Returns
-------
self : Styler | Set the caption on a Styler. | [
"Set",
"the",
"caption",
"on",
"a",
"Styler",
"."
] | def set_caption(self, caption):
"""
Set the caption on a Styler.
Parameters
----------
caption : str
Returns
-------
self : Styler
"""
self.caption = caption
return self | [
"def",
"set_caption",
"(",
"self",
",",
"caption",
")",
":",
"self",
".",
"caption",
"=",
"caption",
"return",
"self"
] | https://github.com/aws/lumberyard/blob/f85344403c1c2e77ec8c75deb2c116e97b713217/dev/Gems/CloudGemMetric/v1/AWS/python/windows/Lib/pandas/io/formats/style.py#L868-L881 | |
aws/lumberyard | f85344403c1c2e77ec8c75deb2c116e97b713217 | dev/Tools/Python/3.7.10/mac/Python.framework/Versions/3.7/lib/python3.7/tkinter/__init__.py | python | Misc.mainloop | (self, n=0) | Call the mainloop of Tk. | Call the mainloop of Tk. | [
"Call",
"the",
"mainloop",
"of",
"Tk",
"."
] | def mainloop(self, n=0):
"""Call the mainloop of Tk."""
self.tk.mainloop(n) | [
"def",
"mainloop",
"(",
"self",
",",
"n",
"=",
"0",
")",
":",
"self",
".",
"tk",
".",
"mainloop",
"(",
"n",
")"
] | https://github.com/aws/lumberyard/blob/f85344403c1c2e77ec8c75deb2c116e97b713217/dev/Tools/Python/3.7.10/mac/Python.framework/Versions/3.7/lib/python3.7/tkinter/__init__.py#L1281-L1283 | ||
ChromiumWebApps/chromium | c7361d39be8abd1574e6ce8957c8dbddd4c6ccf7 | build/android/pylib/utils/emulator.py | python | Emulator._InstallKillHandler | (self) | Install a handler to kill the emulator when we exit unexpectedly. | Install a handler to kill the emulator when we exit unexpectedly. | [
"Install",
"a",
"handler",
"to",
"kill",
"the",
"emulator",
"when",
"we",
"exit",
"unexpectedly",
"."
] | def _InstallKillHandler(self):
"""Install a handler to kill the emulator when we exit unexpectedly."""
for sig in self._SIGNALS:
signal.signal(sig, self._ShutdownOnSignal) | [
"def",
"_InstallKillHandler",
"(",
"self",
")",
":",
"for",
"sig",
"in",
"self",
".",
"_SIGNALS",
":",
"signal",
".",
"signal",
"(",
"sig",
",",
"self",
".",
"_ShutdownOnSignal",
")"
] | https://github.com/ChromiumWebApps/chromium/blob/c7361d39be8abd1574e6ce8957c8dbddd4c6ccf7/build/android/pylib/utils/emulator.py#L421-L424 | ||
catboost/catboost | 167f64f237114a4d10b2b4ee42adb4569137debe | contrib/tools/python/src/Lib/plat-mac/videoreader.py | python | _Reader._getpixmapcontent | (self) | return ''.join(rv) | Shuffle the offscreen PixMap data, because it may have funny stride values | Shuffle the offscreen PixMap data, because it may have funny stride values | [
"Shuffle",
"the",
"offscreen",
"PixMap",
"data",
"because",
"it",
"may",
"have",
"funny",
"stride",
"values"
] | def _getpixmapcontent(self):
"""Shuffle the offscreen PixMap data, because it may have funny stride values"""
rowbytes = Qdoffs.GetPixRowBytes(self.pixmap)
width = self.videodescr['width']
height = self.videodescr['height']
start = 0
rv = []
for i in range(height)... | [
"def",
"_getpixmapcontent",
"(",
"self",
")",
":",
"rowbytes",
"=",
"Qdoffs",
".",
"GetPixRowBytes",
"(",
"self",
".",
"pixmap",
")",
"width",
"=",
"self",
".",
"videodescr",
"[",
"'width'",
"]",
"height",
"=",
"self",
".",
"videodescr",
"[",
"'height'",
... | https://github.com/catboost/catboost/blob/167f64f237114a4d10b2b4ee42adb4569137debe/contrib/tools/python/src/Lib/plat-mac/videoreader.py#L235-L246 | |
hanpfei/chromium-net | 392cc1fa3a8f92f42e4071ab6e674d8e0482f83f | third_party/catapult/third_party/gsutil/third_party/protorpc/protorpc/webapp/service_handlers.py | python | ServiceHandlerFactory.default | (cls, service_factory, parameter_prefix='') | return factory | Convenience method to map default factory configuration to application.
Creates a standardized default service factory configuration that pre-maps
the URL encoded protocol handler to the factory.
Args:
service_factory: Service factory to instantiate and provide to
service handler.
meth... | Convenience method to map default factory configuration to application. | [
"Convenience",
"method",
"to",
"map",
"default",
"factory",
"configuration",
"to",
"application",
"."
] | def default(cls, service_factory, parameter_prefix=''):
"""Convenience method to map default factory configuration to application.
Creates a standardized default service factory configuration that pre-maps
the URL encoded protocol handler to the factory.
Args:
service_factory: Service factory to... | [
"def",
"default",
"(",
"cls",
",",
"service_factory",
",",
"parameter_prefix",
"=",
"''",
")",
":",
"factory",
"=",
"cls",
"(",
"service_factory",
")",
"factory",
".",
"add_request_mapper",
"(",
"ProtobufRPCMapper",
"(",
")",
")",
"factory",
".",
"add_request_... | https://github.com/hanpfei/chromium-net/blob/392cc1fa3a8f92f42e4071ab6e674d8e0482f83f/third_party/catapult/third_party/gsutil/third_party/protorpc/protorpc/webapp/service_handlers.py#L354-L378 | |
mousebird-consulting-inc/WhirlyGlobe | 436478011c847c729b485009ed4db0645e304763 | common/local_libs/nanopb/generator/nanopb_generator.py | python | main_cli | () | Main function when invoked directly from the command line. | Main function when invoked directly from the command line. | [
"Main",
"function",
"when",
"invoked",
"directly",
"from",
"the",
"command",
"line",
"."
] | def main_cli():
'''Main function when invoked directly from the command line.'''
options, filenames = optparser.parse_args()
if not filenames:
optparser.print_help()
sys.exit(1)
if options.quiet:
options.verbose = False
if options.output_dir and not os.path.exists(options... | [
"def",
"main_cli",
"(",
")",
":",
"options",
",",
"filenames",
"=",
"optparser",
".",
"parse_args",
"(",
")",
"if",
"not",
"filenames",
":",
"optparser",
".",
"print_help",
"(",
")",
"sys",
".",
"exit",
"(",
"1",
")",
"if",
"options",
".",
"quiet",
"... | https://github.com/mousebird-consulting-inc/WhirlyGlobe/blob/436478011c847c729b485009ed4db0645e304763/common/local_libs/nanopb/generator/nanopb_generator.py#L2003-L2067 | ||
ricardoquesada/Spidermonkey | 4a75ea2543408bd1b2c515aa95901523eeef7858 | dom/bindings/Codegen.py | python | UnionConversions | (descriptors, dictionaries, callbacks, config) | return (headers,
CGWrapper(CGList(SortedDictValues(unionConversions), "\n"),
post="\n\n")) | Returns a CGThing to declare all union argument conversion helper structs. | Returns a CGThing to declare all union argument conversion helper structs. | [
"Returns",
"a",
"CGThing",
"to",
"declare",
"all",
"union",
"argument",
"conversion",
"helper",
"structs",
"."
] | def UnionConversions(descriptors, dictionaries, callbacks, config):
"""
Returns a CGThing to declare all union argument conversion helper structs.
"""
# Now find all the things we'll need as arguments because we
# need to unwrap them.
headers = set()
unionConversions = dict()
for t, des... | [
"def",
"UnionConversions",
"(",
"descriptors",
",",
"dictionaries",
",",
"callbacks",
",",
"config",
")",
":",
"# Now find all the things we'll need as arguments because we",
"# need to unwrap them.",
"headers",
"=",
"set",
"(",
")",
"unionConversions",
"=",
"dict",
"(",
... | https://github.com/ricardoquesada/Spidermonkey/blob/4a75ea2543408bd1b2c515aa95901523eeef7858/dom/bindings/Codegen.py#L1282-L1340 | |
openmm/openmm | cb293447c4fc8b03976dfe11399f107bab70f3d9 | wrappers/python/openmm/app/pdbxfile.py | python | PDBxFile.getNumFrames | (self) | return len(self._positions) | Get the number of frames stored in the file. | Get the number of frames stored in the file. | [
"Get",
"the",
"number",
"of",
"frames",
"stored",
"in",
"the",
"file",
"."
] | def getNumFrames(self):
"""Get the number of frames stored in the file."""
return len(self._positions) | [
"def",
"getNumFrames",
"(",
"self",
")",
":",
"return",
"len",
"(",
"self",
".",
"_positions",
")"
] | https://github.com/openmm/openmm/blob/cb293447c4fc8b03976dfe11399f107bab70f3d9/wrappers/python/openmm/app/pdbxfile.py#L224-L226 | |
catboost/catboost | 167f64f237114a4d10b2b4ee42adb4569137debe | contrib/python/scipy/py3/scipy/sparse/bsr.py | python | bsr_matrix.matvec | (self, other) | return self * other | Multiply matrix by vector. | Multiply matrix by vector. | [
"Multiply",
"matrix",
"by",
"vector",
"."
] | def matvec(self, other):
"""Multiply matrix by vector."""
return self * other | [
"def",
"matvec",
"(",
"self",
",",
"other",
")",
":",
"return",
"self",
"*",
"other"
] | https://github.com/catboost/catboost/blob/167f64f237114a4d10b2b4ee42adb4569137debe/contrib/python/scipy/py3/scipy/sparse/bsr.py#L328-L330 | |
catboost/catboost | 167f64f237114a4d10b2b4ee42adb4569137debe | contrib/python/scikit-learn/py2/sklearn/externals/odict.py | python | OrderedDict.__delitem__ | (self, key, dict_delitem=dict.__delitem__) | od.__delitem__(y) <==> del od[y] | od.__delitem__(y) <==> del od[y] | [
"od",
".",
"__delitem__",
"(",
"y",
")",
"<",
"==",
">",
"del",
"od",
"[",
"y",
"]"
] | def __delitem__(self, key, dict_delitem=dict.__delitem__):
'od.__delitem__(y) <==> del od[y]'
# Deleting an existing item uses self.__map to find the link which is
# then removed by updating the links in the predecessor and successor nodes.
dict_delitem(self, key)
link_prev, link... | [
"def",
"__delitem__",
"(",
"self",
",",
"key",
",",
"dict_delitem",
"=",
"dict",
".",
"__delitem__",
")",
":",
"# Deleting an existing item uses self.__map to find the link which is",
"# then removed by updating the links in the predecessor and successor nodes.",
"dict_delitem",
"(... | https://github.com/catboost/catboost/blob/167f64f237114a4d10b2b4ee42adb4569137debe/contrib/python/scikit-learn/py2/sklearn/externals/odict.py#L61-L68 | ||
miyosuda/TensorFlowAndroidDemo | 35903e0221aa5f109ea2dbef27f20b52e317f42d | jni-build/jni/include/tensorflow/python/ops/control_flow_ops.py | python | GradLoopState.forward_index | (self) | return self._forward_index | The loop index of forward loop. | The loop index of forward loop. | [
"The",
"loop",
"index",
"of",
"forward",
"loop",
"."
] | def forward_index(self):
"""The loop index of forward loop."""
return self._forward_index | [
"def",
"forward_index",
"(",
"self",
")",
":",
"return",
"self",
".",
"_forward_index"
] | https://github.com/miyosuda/TensorFlowAndroidDemo/blob/35903e0221aa5f109ea2dbef27f20b52e317f42d/jni-build/jni/include/tensorflow/python/ops/control_flow_ops.py#L571-L573 | |
aws/lumberyard | f85344403c1c2e77ec8c75deb2c116e97b713217 | dev/Tools/Python/3.7.10/windows/Lib/site-packages/setuptools/dist.py | python | check_package_data | (dist, attr, value) | Verify that value is a dictionary of package names to glob lists | Verify that value is a dictionary of package names to glob lists | [
"Verify",
"that",
"value",
"is",
"a",
"dictionary",
"of",
"package",
"names",
"to",
"glob",
"lists"
] | def check_package_data(dist, attr, value):
"""Verify that value is a dictionary of package names to glob lists"""
if not isinstance(value, dict):
raise DistutilsSetupError(
"{!r} must be a dictionary mapping package names to lists of "
"string wildcard patterns".format(attr))
... | [
"def",
"check_package_data",
"(",
"dist",
",",
"attr",
",",
"value",
")",
":",
"if",
"not",
"isinstance",
"(",
"value",
",",
"dict",
")",
":",
"raise",
"DistutilsSetupError",
"(",
"\"{!r} must be a dictionary mapping package names to lists of \"",
"\"string wildcard pat... | https://github.com/aws/lumberyard/blob/f85344403c1c2e77ec8c75deb2c116e97b713217/dev/Tools/Python/3.7.10/windows/Lib/site-packages/setuptools/dist.py#L311-L323 | ||
aws/lumberyard | f85344403c1c2e77ec8c75deb2c116e97b713217 | dev/Gems/CloudGemMetric/v1/AWS/common-code/Lib/numba/controlflow.py | python | CFGraph.nodes | (self) | return self._nodes | Return the set of live nodes. | Return the set of live nodes. | [
"Return",
"the",
"set",
"of",
"live",
"nodes",
"."
] | def nodes(self):
"""
Return the set of live nodes.
"""
return self._nodes | [
"def",
"nodes",
"(",
"self",
")",
":",
"return",
"self",
".",
"_nodes"
] | https://github.com/aws/lumberyard/blob/f85344403c1c2e77ec8c75deb2c116e97b713217/dev/Gems/CloudGemMetric/v1/AWS/common-code/Lib/numba/controlflow.py#L232-L236 | |
benoitsteiner/tensorflow-opencl | cb7cb40a57fde5cfd4731bc551e82a1e2fef43a5 | tensorflow/python/ops/control_flow_ops.py | python | _EnforceShapeInvariant | (merge_var, next_var) | Check if the shapes of the loops variables are invariants.
Args:
merge_vars: The list of tensors representing the initial values of the
loop variables.
next_vars: The list of tensors representing the values of the loop
variables after one loop iteration.
Raises:
ValueError: If any tensor i... | Check if the shapes of the loops variables are invariants. | [
"Check",
"if",
"the",
"shapes",
"of",
"the",
"loops",
"variables",
"are",
"invariants",
"."
] | def _EnforceShapeInvariant(merge_var, next_var):
"""Check if the shapes of the loops variables are invariants.
Args:
merge_vars: The list of tensors representing the initial values of the
loop variables.
next_vars: The list of tensors representing the values of the loop
variables after one loop... | [
"def",
"_EnforceShapeInvariant",
"(",
"merge_var",
",",
"next_var",
")",
":",
"if",
"isinstance",
"(",
"merge_var",
",",
"ops",
".",
"Tensor",
")",
":",
"m_shape",
"=",
"merge_var",
".",
"get_shape",
"(",
")",
"n_shape",
"=",
"next_var",
".",
"get_shape",
... | https://github.com/benoitsteiner/tensorflow-opencl/blob/cb7cb40a57fde5cfd4731bc551e82a1e2fef43a5/tensorflow/python/ops/control_flow_ops.py#L559-L624 | ||
aws/lumberyard | f85344403c1c2e77ec8c75deb2c116e97b713217 | dev/Tools/Python/3.7.10/windows/Lib/_osx_support.py | python | get_platform_osx | (_config_vars, osname, release, machine) | return (osname, release, machine) | Filter values for get_platform() | Filter values for get_platform() | [
"Filter",
"values",
"for",
"get_platform",
"()"
] | def get_platform_osx(_config_vars, osname, release, machine):
"""Filter values for get_platform()"""
# called from get_platform() in sysconfig and distutils.util
#
# For our purposes, we'll assume that the system version from
# distutils' perspective is what MACOSX_DEPLOYMENT_TARGET is set
# to.... | [
"def",
"get_platform_osx",
"(",
"_config_vars",
",",
"osname",
",",
"release",
",",
"machine",
")",
":",
"# called from get_platform() in sysconfig and distutils.util",
"#",
"# For our purposes, we'll assume that the system version from",
"# distutils' perspective is what MACOSX_DEPLOY... | https://github.com/aws/lumberyard/blob/f85344403c1c2e77ec8c75deb2c116e97b713217/dev/Tools/Python/3.7.10/windows/Lib/_osx_support.py#L440-L513 | |
wxWidgets/wxPython-Classic | 19571e1ae65f1ac445f5491474121998c97a1bf0 | src/osx_carbon/_windows.py | python | TipWindow.__init__ | (self, *args, **kwargs) | __init__(self, Window parent, String text, int maxLength=100, Rect rectBound=None) -> TipWindow | __init__(self, Window parent, String text, int maxLength=100, Rect rectBound=None) -> TipWindow | [
"__init__",
"(",
"self",
"Window",
"parent",
"String",
"text",
"int",
"maxLength",
"=",
"100",
"Rect",
"rectBound",
"=",
"None",
")",
"-",
">",
"TipWindow"
] | def __init__(self, *args, **kwargs):
"""__init__(self, Window parent, String text, int maxLength=100, Rect rectBound=None) -> TipWindow"""
_windows_.TipWindow_swiginit(self,_windows_.new_TipWindow(*args, **kwargs))
self._setOORInfo(self) | [
"def",
"__init__",
"(",
"self",
",",
"*",
"args",
",",
"*",
"*",
"kwargs",
")",
":",
"_windows_",
".",
"TipWindow_swiginit",
"(",
"self",
",",
"_windows_",
".",
"new_TipWindow",
"(",
"*",
"args",
",",
"*",
"*",
"kwargs",
")",
")",
"self",
".",
"_setO... | https://github.com/wxWidgets/wxPython-Classic/blob/19571e1ae65f1ac445f5491474121998c97a1bf0/src/osx_carbon/_windows.py#L2177-L2180 | ||
aws/lumberyard | f85344403c1c2e77ec8c75deb2c116e97b713217 | dev/Gems/CloudGemMetric/v1/AWS/python/windows/Lib/numba/listobject.py | python | impl_allocated | (l) | list._allocated() | list._allocated() | [
"list",
".",
"_allocated",
"()"
] | def impl_allocated(l):
"""list._allocated()
"""
if isinstance(l, types.ListType):
def impl(l):
return _list_allocated(l)
return impl | [
"def",
"impl_allocated",
"(",
"l",
")",
":",
"if",
"isinstance",
"(",
"l",
",",
"types",
".",
"ListType",
")",
":",
"def",
"impl",
"(",
"l",
")",
":",
"return",
"_list_allocated",
"(",
"l",
")",
"return",
"impl"
] | https://github.com/aws/lumberyard/blob/f85344403c1c2e77ec8c75deb2c116e97b713217/dev/Gems/CloudGemMetric/v1/AWS/python/windows/Lib/numba/listobject.py#L408-L415 | ||
catboost/catboost | 167f64f237114a4d10b2b4ee42adb4569137debe | contrib/python/scipy/py2/scipy/misc/common.py | python | face | (gray=False) | return face | Get a 1024 x 768, color image of a raccoon face.
raccoon-procyon-lotor.jpg at http://www.public-domain-image.com
Parameters
----------
gray : bool, optional
If True return 8-bit grey-scale image, otherwise return a color image
Returns
-------
face : ndarray
image of a raco... | Get a 1024 x 768, color image of a raccoon face. | [
"Get",
"a",
"1024",
"x",
"768",
"color",
"image",
"of",
"a",
"raccoon",
"face",
"."
] | def face(gray=False):
"""
Get a 1024 x 768, color image of a raccoon face.
raccoon-procyon-lotor.jpg at http://www.public-domain-image.com
Parameters
----------
gray : bool, optional
If True return 8-bit grey-scale image, otherwise return a color image
Returns
-------
face... | [
"def",
"face",
"(",
"gray",
"=",
"False",
")",
":",
"import",
"bz2",
"import",
"os",
"with",
"open",
"(",
"os",
".",
"path",
".",
"join",
"(",
"os",
".",
"path",
".",
"dirname",
"(",
"__file__",
")",
",",
"'face.dat'",
")",
",",
"'rb'",
")",
"as"... | https://github.com/catboost/catboost/blob/167f64f237114a4d10b2b4ee42adb4569137debe/contrib/python/scipy/py2/scipy/misc/common.py#L162-L204 | |
qgis/QGIS | 15a77662d4bb712184f6aa60d0bd663010a76a75 | python/plugins/db_manager/db_plugins/spatialite/connector.py | python | SpatiaLiteDBConnector.createTable | (self, table, field_defs, pkey) | return True | Creates ordinary table
'fields' is array containing field definitions
'pkey' is the primary key name | Creates ordinary table
'fields' is array containing field definitions
'pkey' is the primary key name | [
"Creates",
"ordinary",
"table",
"fields",
"is",
"array",
"containing",
"field",
"definitions",
"pkey",
"is",
"the",
"primary",
"key",
"name"
] | def createTable(self, table, field_defs, pkey):
"""Creates ordinary table
'fields' is array containing field definitions
'pkey' is the primary key name
"""
if len(field_defs) == 0:
return False
sql = "CREATE TABLE %s (" % self.... | [
"def",
"createTable",
"(",
"self",
",",
"table",
",",
"field_defs",
",",
"pkey",
")",
":",
"if",
"len",
"(",
"field_defs",
")",
"==",
"0",
":",
"return",
"False",
"sql",
"=",
"\"CREATE TABLE %s (\"",
"%",
"self",
".",
"quoteId",
"(",
"table",
")",
"sql... | https://github.com/qgis/QGIS/blob/15a77662d4bb712184f6aa60d0bd663010a76a75/python/plugins/db_manager/db_plugins/spatialite/connector.py#L427-L442 | |
baidu-research/tensorflow-allreduce | 66d5b855e90b0949e9fa5cca5599fd729a70e874 | tensorflow/python/ops/distributions/util.py | python | pick_vector | (cond,
true_vector,
false_vector,
name="pick_vector") | Picks possibly different length row `Tensor`s based on condition.
Value `Tensor`s should have exactly one dimension.
If `cond` is a python Boolean or `tf.constant` then either `true_vector` or
`false_vector` is immediately returned. I.e., no graph nodes are created and
no validation happens.
Args:
cond... | Picks possibly different length row `Tensor`s based on condition. | [
"Picks",
"possibly",
"different",
"length",
"row",
"Tensor",
"s",
"based",
"on",
"condition",
"."
] | def pick_vector(cond,
true_vector,
false_vector,
name="pick_vector"):
"""Picks possibly different length row `Tensor`s based on condition.
Value `Tensor`s should have exactly one dimension.
If `cond` is a python Boolean or `tf.constant` then either `true_vector` o... | [
"def",
"pick_vector",
"(",
"cond",
",",
"true_vector",
",",
"false_vector",
",",
"name",
"=",
"\"pick_vector\"",
")",
":",
"with",
"ops",
".",
"name_scope",
"(",
"name",
",",
"values",
"=",
"(",
"cond",
",",
"true_vector",
",",
"false_vector",
")",
")",
... | https://github.com/baidu-research/tensorflow-allreduce/blob/66d5b855e90b0949e9fa5cca5599fd729a70e874/tensorflow/python/ops/distributions/util.py#L649-L702 | ||
MegEngine/MegEngine | ce9ad07a27ec909fb8db4dd67943d24ba98fb93a | imperative/python/megengine/data/sampler.py | python | SequentialSampler.sample | (self) | r"""Return a generator. | r"""Return a generator. | [
"r",
"Return",
"a",
"generator",
"."
] | def sample(self) -> Iterator[Any]:
r"""Return a generator."""
if self.indices is None:
return iter(range(len(self.dataset)))
else:
return self.indices | [
"def",
"sample",
"(",
"self",
")",
"->",
"Iterator",
"[",
"Any",
"]",
":",
"if",
"self",
".",
"indices",
"is",
"None",
":",
"return",
"iter",
"(",
"range",
"(",
"len",
"(",
"self",
".",
"dataset",
")",
")",
")",
"else",
":",
"return",
"self",
"."... | https://github.com/MegEngine/MegEngine/blob/ce9ad07a27ec909fb8db4dd67943d24ba98fb93a/imperative/python/megengine/data/sampler.py#L199-L204 | ||
catboost/catboost | 167f64f237114a4d10b2b4ee42adb4569137debe | contrib/python/subprocess32/subprocess32.py | python | Popen._check_timeout | (self, endtime, orig_timeout) | Convenience for checking if a timeout has expired. | Convenience for checking if a timeout has expired. | [
"Convenience",
"for",
"checking",
"if",
"a",
"timeout",
"has",
"expired",
"."
] | def _check_timeout(self, endtime, orig_timeout):
"""Convenience for checking if a timeout has expired."""
if endtime is None:
return
if time.time() > endtime:
raise TimeoutExpired(self.args, orig_timeout) | [
"def",
"_check_timeout",
"(",
"self",
",",
"endtime",
",",
"orig_timeout",
")",
":",
"if",
"endtime",
"is",
"None",
":",
"return",
"if",
"time",
".",
"time",
"(",
")",
">",
"endtime",
":",
"raise",
"TimeoutExpired",
"(",
"self",
".",
"args",
",",
"orig... | https://github.com/catboost/catboost/blob/167f64f237114a4d10b2b4ee42adb4569137debe/contrib/python/subprocess32/subprocess32.py#L769-L774 | ||
ptrkrysik/gr-gsm | 2de47e28ce1fb9a518337bfc0add36c8e3cff5eb | docs/doxygen/doxyxml/base.py | python | Base._get_dict_members | (self, cat=None) | return self._dict_members[cat] | For given category a dictionary is returned mapping member names to
members of that category. For names that are duplicated the name is
mapped to None. | For given category a dictionary is returned mapping member names to
members of that category. For names that are duplicated the name is
mapped to None. | [
"For",
"given",
"category",
"a",
"dictionary",
"is",
"returned",
"mapping",
"member",
"names",
"to",
"members",
"of",
"that",
"category",
".",
"For",
"names",
"that",
"are",
"duplicated",
"the",
"name",
"is",
"mapped",
"to",
"None",
"."
] | def _get_dict_members(self, cat=None):
"""
For given category a dictionary is returned mapping member names to
members of that category. For names that are duplicated the name is
mapped to None.
"""
self.confirm_no_error()
if cat not in self._dict_members:
... | [
"def",
"_get_dict_members",
"(",
"self",
",",
"cat",
"=",
"None",
")",
":",
"self",
".",
"confirm_no_error",
"(",
")",
"if",
"cat",
"not",
"in",
"self",
".",
"_dict_members",
":",
"new_dict",
"=",
"{",
"}",
"for",
"mem",
"in",
"self",
".",
"in_category... | https://github.com/ptrkrysik/gr-gsm/blob/2de47e28ce1fb9a518337bfc0add36c8e3cff5eb/docs/doxygen/doxyxml/base.py#L125-L140 | |
Xilinx/Vitis-AI | fc74d404563d9951b57245443c73bef389f3657f | tools/Vitis-AI-Quantizer/vai_q_tensorflow1.x/tensorflow/python/ops/math_grad.py | python | _ErfGrad | (op, grad) | Returns grad * 2/sqrt(pi) * exp(-x**2). | Returns grad * 2/sqrt(pi) * exp(-x**2). | [
"Returns",
"grad",
"*",
"2",
"/",
"sqrt",
"(",
"pi",
")",
"*",
"exp",
"(",
"-",
"x",
"**",
"2",
")",
"."
] | def _ErfGrad(op, grad):
"""Returns grad * 2/sqrt(pi) * exp(-x**2)."""
x = op.inputs[0]
two_over_root_pi = constant_op.constant(2 / np.sqrt(np.pi), dtype=grad.dtype)
with ops.control_dependencies([grad]):
x = math_ops.conj(x)
return grad * two_over_root_pi * math_ops.exp(-math_ops.square(x)) | [
"def",
"_ErfGrad",
"(",
"op",
",",
"grad",
")",
":",
"x",
"=",
"op",
".",
"inputs",
"[",
"0",
"]",
"two_over_root_pi",
"=",
"constant_op",
".",
"constant",
"(",
"2",
"/",
"np",
".",
"sqrt",
"(",
"np",
".",
"pi",
")",
",",
"dtype",
"=",
"grad",
... | https://github.com/Xilinx/Vitis-AI/blob/fc74d404563d9951b57245443c73bef389f3657f/tools/Vitis-AI-Quantizer/vai_q_tensorflow1.x/tensorflow/python/ops/math_grad.py#L759-L765 | ||
jiaxiang-wu/quantized-cnn | 4d020e17026df90e40111d219e3eb74e0afb1588 | cpplint.py | python | GetPreviousNonBlankLine | (clean_lines, linenum) | return ('', -1) | Return the most recent non-blank line and its line number.
Args:
clean_lines: A CleansedLines instance containing the file contents.
linenum: The number of the line to check.
Returns:
A tuple with two elements. The first element is the contents of the last
non-blank line before the current line, ... | Return the most recent non-blank line and its line number. | [
"Return",
"the",
"most",
"recent",
"non",
"-",
"blank",
"line",
"and",
"its",
"line",
"number",
"."
] | def GetPreviousNonBlankLine(clean_lines, linenum):
"""Return the most recent non-blank line and its line number.
Args:
clean_lines: A CleansedLines instance containing the file contents.
linenum: The number of the line to check.
Returns:
A tuple with two elements. The first element is the contents ... | [
"def",
"GetPreviousNonBlankLine",
"(",
"clean_lines",
",",
"linenum",
")",
":",
"prevlinenum",
"=",
"linenum",
"-",
"1",
"while",
"prevlinenum",
">=",
"0",
":",
"prevline",
"=",
"clean_lines",
".",
"elided",
"[",
"prevlinenum",
"]",
"if",
"not",
"IsBlankLine",... | https://github.com/jiaxiang-wu/quantized-cnn/blob/4d020e17026df90e40111d219e3eb74e0afb1588/cpplint.py#L3867-L3887 | |
google/ion | ef47f3b824050499ce5c6f774b366f6c4dbce0af | ion/build.py | python | BuildState.GetCommandLineOptions | (self) | return self.args_ | Returns an object with attributes for each command line option.
Returns:
An argparse.Namespace object. | Returns an object with attributes for each command line option. | [
"Returns",
"an",
"object",
"with",
"attributes",
"for",
"each",
"command",
"line",
"option",
"."
] | def GetCommandLineOptions(self):
"""Returns an object with attributes for each command line option.
Returns:
An argparse.Namespace object.
"""
return self.args_ | [
"def",
"GetCommandLineOptions",
"(",
"self",
")",
":",
"return",
"self",
".",
"args_"
] | https://github.com/google/ion/blob/ef47f3b824050499ce5c6f774b366f6c4dbce0af/ion/build.py#L1549-L1555 | |
NVIDIA/DALI | bf16cc86ba8f091b145f91962f21fe1b6aff243d | docs/examples/use_cases/tensorflow/efficientdet/pipeline/anchors_utils/argmax_matcher.py | python | ArgMaxMatcher._match | (self, similarity_matrix) | Tries to match each column of the similarity matrix to a row.
Args:
similarity_matrix: tensor of shape [N, M] representing any similarity
metric.
Returns:
Match object with corresponding matches for each of M columns. | Tries to match each column of the similarity matrix to a row. | [
"Tries",
"to",
"match",
"each",
"column",
"of",
"the",
"similarity",
"matrix",
"to",
"a",
"row",
"."
] | def _match(self, similarity_matrix):
"""Tries to match each column of the similarity matrix to a row.
Args:
similarity_matrix: tensor of shape [N, M] representing any similarity
metric.
Returns:
Match object with corresponding matches for each of M columns.
... | [
"def",
"_match",
"(",
"self",
",",
"similarity_matrix",
")",
":",
"def",
"_match_when_rows_are_empty",
"(",
")",
":",
"\"\"\"Performs matching when the rows of similarity matrix are empty.\n\n When the rows are empty, all detections are false positives. So we return\n ... | https://github.com/NVIDIA/DALI/blob/bf16cc86ba8f091b145f91962f21fe1b6aff243d/docs/examples/use_cases/tensorflow/efficientdet/pipeline/anchors_utils/argmax_matcher.py#L110-L204 | ||
aws/lumberyard | f85344403c1c2e77ec8c75deb2c116e97b713217 | dev/Gems/CloudGemMetric/v1/AWS/common-code/Lib/psutil/_pslinux.py | python | calculate_avail_vmem | (mems) | return int(avail) | Fallback for kernels < 3.14 where /proc/meminfo does not provide
"MemAvailable:" column, see:
https://blog.famzah.net/2014/09/24/
This code reimplements the algorithm outlined here:
https://git.kernel.org/cgit/linux/kernel/git/torvalds/linux.git/
commit/?id=34e431b0ae398fc54ea69ff85ec700722c9da7... | Fallback for kernels < 3.14 where /proc/meminfo does not provide
"MemAvailable:" column, see:
https://blog.famzah.net/2014/09/24/
This code reimplements the algorithm outlined here:
https://git.kernel.org/cgit/linux/kernel/git/torvalds/linux.git/
commit/?id=34e431b0ae398fc54ea69ff85ec700722c9da7... | [
"Fallback",
"for",
"kernels",
"<",
"3",
".",
"14",
"where",
"/",
"proc",
"/",
"meminfo",
"does",
"not",
"provide",
"MemAvailable",
":",
"column",
"see",
":",
"https",
":",
"//",
"blog",
".",
"famzah",
".",
"net",
"/",
"2014",
"/",
"09",
"/",
"24",
... | def calculate_avail_vmem(mems):
"""Fallback for kernels < 3.14 where /proc/meminfo does not provide
"MemAvailable:" column, see:
https://blog.famzah.net/2014/09/24/
This code reimplements the algorithm outlined here:
https://git.kernel.org/cgit/linux/kernel/git/torvalds/linux.git/
commit/?id... | [
"def",
"calculate_avail_vmem",
"(",
"mems",
")",
":",
"# Fallback for very old distros. According to",
"# https://git.kernel.org/cgit/linux/kernel/git/torvalds/linux.git/",
"# commit/?id=34e431b0ae398fc54ea69ff85ec700722c9da773",
"# ...long ago \"avail\" was calculated as (free + cached).",
... | https://github.com/aws/lumberyard/blob/f85344403c1c2e77ec8c75deb2c116e97b713217/dev/Gems/CloudGemMetric/v1/AWS/common-code/Lib/psutil/_pslinux.py#L321-L371 | |
apache/incubator-weex | 5c25f0b59f7ac90703c363e7261f60bd06356dbe | weex_core/tools/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/apache/incubator-weex/blob/5c25f0b59f7ac90703c363e7261f60bd06356dbe/weex_core/tools/cpplint.py#L4685-L4840 | ||
Z3Prover/z3 | d745d03afdfdf638d66093e2bfbacaf87187f35b | src/api/python/z3/z3.py | python | ArraySortRef.range | (self) | return _to_sort_ref(Z3_get_array_sort_range(self.ctx_ref(), self.ast), self.ctx) | Return the range of the array sort `self`.
>>> A = ArraySort(IntSort(), BoolSort())
>>> A.range()
Bool | Return the range of the array sort `self`. | [
"Return",
"the",
"range",
"of",
"the",
"array",
"sort",
"self",
"."
] | def range(self):
"""Return the range of the array sort `self`.
>>> A = ArraySort(IntSort(), BoolSort())
>>> A.range()
Bool
"""
return _to_sort_ref(Z3_get_array_sort_range(self.ctx_ref(), self.ast), self.ctx) | [
"def",
"range",
"(",
"self",
")",
":",
"return",
"_to_sort_ref",
"(",
"Z3_get_array_sort_range",
"(",
"self",
".",
"ctx_ref",
"(",
")",
",",
"self",
".",
"ast",
")",
",",
"self",
".",
"ctx",
")"
] | https://github.com/Z3Prover/z3/blob/d745d03afdfdf638d66093e2bfbacaf87187f35b/src/api/python/z3/z3.py#L4503-L4510 | |
KhronosGroup/SPIRV-LLVM | 1eb85593f3fe2c39379b9a9b088d51eda4f42b8b | bindings/python/llvm/object.py | python | Relocation.type_name | (self) | return lib.LLVMGetRelocationTypeName(self) | The relocation type's name, as a str. | The relocation type's name, as a str. | [
"The",
"relocation",
"type",
"s",
"name",
"as",
"a",
"str",
"."
] | def type_name(self):
"""The relocation type's name, as a str."""
if self.expired:
raise Exception('Relocation instance has expired.')
return lib.LLVMGetRelocationTypeName(self) | [
"def",
"type_name",
"(",
"self",
")",
":",
"if",
"self",
".",
"expired",
":",
"raise",
"Exception",
"(",
"'Relocation instance has expired.'",
")",
"return",
"lib",
".",
"LLVMGetRelocationTypeName",
"(",
"self",
")"
] | https://github.com/KhronosGroup/SPIRV-LLVM/blob/1eb85593f3fe2c39379b9a9b088d51eda4f42b8b/bindings/python/llvm/object.py#L408-L413 | |
oracle/graaljs | 36a56e8e993d45fc40939a3a4d9c0c24990720f1 | graal-nodejs/deps/v8/third_party/jinja2/compiler.py | python | CodeGenerator.push_parameter_definitions | (self, frame) | Pushes all parameter targets from the given frame into a local
stack that permits tracking of yet to be assigned parameters. In
particular this enables the optimization from `visit_Name` to skip
undefined expressions for parameters in macros as macros can reference
otherwise unbound par... | Pushes all parameter targets from the given frame into a local
stack that permits tracking of yet to be assigned parameters. In
particular this enables the optimization from `visit_Name` to skip
undefined expressions for parameters in macros as macros can reference
otherwise unbound par... | [
"Pushes",
"all",
"parameter",
"targets",
"from",
"the",
"given",
"frame",
"into",
"a",
"local",
"stack",
"that",
"permits",
"tracking",
"of",
"yet",
"to",
"be",
"assigned",
"parameters",
".",
"In",
"particular",
"this",
"enables",
"the",
"optimization",
"from"... | def push_parameter_definitions(self, frame):
"""Pushes all parameter targets from the given frame into a local
stack that permits tracking of yet to be assigned parameters. In
particular this enables the optimization from `visit_Name` to skip
undefined expressions for parameters in macr... | [
"def",
"push_parameter_definitions",
"(",
"self",
",",
"frame",
")",
":",
"self",
".",
"_param_def_block",
".",
"append",
"(",
"frame",
".",
"symbols",
".",
"dump_param_targets",
"(",
")",
")"
] | https://github.com/oracle/graaljs/blob/36a56e8e993d45fc40939a3a4d9c0c24990720f1/graal-nodejs/deps/v8/third_party/jinja2/compiler.py#L614-L621 | ||
tensorflow/tensorflow | 419e3a6b650ea4bd1b0cba23c4348f8a69f3272e | tensorflow/python/ops/rnn.py | python | raw_rnn | (cell,
loop_fn,
parallel_iterations=None,
swap_memory=False,
scope=None) | Creates an `RNN` specified by RNNCell `cell` and loop function `loop_fn`.
**NOTE: This method is still in testing, and the API may change.**
This function is a more primitive version of `dynamic_rnn` that provides
more direct access to the inputs each iteration. It also provides more
control over when to sta... | Creates an `RNN` specified by RNNCell `cell` and loop function `loop_fn`. | [
"Creates",
"an",
"RNN",
"specified",
"by",
"RNNCell",
"cell",
"and",
"loop",
"function",
"loop_fn",
"."
] | def raw_rnn(cell,
loop_fn,
parallel_iterations=None,
swap_memory=False,
scope=None):
"""Creates an `RNN` specified by RNNCell `cell` and loop function `loop_fn`.
**NOTE: This method is still in testing, and the API may change.**
This function is a more primitive v... | [
"def",
"raw_rnn",
"(",
"cell",
",",
"loop_fn",
",",
"parallel_iterations",
"=",
"None",
",",
"swap_memory",
"=",
"False",
",",
"scope",
"=",
"None",
")",
":",
"rnn_cell_impl",
".",
"assert_like_rnncell",
"(",
"\"cell\"",
",",
"cell",
")",
"if",
"not",
"cal... | https://github.com/tensorflow/tensorflow/blob/419e3a6b650ea4bd1b0cba23c4348f8a69f3272e/tensorflow/python/ops/rnn.py#L983-L1303 | ||
ApolloAuto/apollo-platform | 86d9dc6743b496ead18d597748ebabd34a513289 | ros/third_party/lib_x86_64/python2.7/dist-packages/rosdep2/installers.py | python | InstallerContext.get_installer_keys | (self) | return self.installers.keys() | :returns: list of registered installer keys | :returns: list of registered installer keys | [
":",
"returns",
":",
"list",
"of",
"registered",
"installer",
"keys"
] | def get_installer_keys(self):
"""
:returns: list of registered installer keys
"""
return self.installers.keys() | [
"def",
"get_installer_keys",
"(",
"self",
")",
":",
"return",
"self",
".",
"installers",
".",
"keys",
"(",
")"
] | https://github.com/ApolloAuto/apollo-platform/blob/86d9dc6743b496ead18d597748ebabd34a513289/ros/third_party/lib_x86_64/python2.7/dist-packages/rosdep2/installers.py#L155-L159 | |
apache/arrow | af33dd1157eb8d7d9bfac25ebf61445b793b7943 | cpp/build-support/cpplint.py | python | _IncludeState.FindHeader | (self, header) | return -1 | Check if a header has already been included.
Args:
header: header to check.
Returns:
Line number of previous occurrence, or -1 if the header has not
been seen before. | Check if a header has already been included. | [
"Check",
"if",
"a",
"header",
"has",
"already",
"been",
"included",
"."
] | def FindHeader(self, header):
"""Check if a header has already been included.
Args:
header: header to check.
Returns:
Line number of previous occurrence, or -1 if the header has not
been seen before.
"""
for section_list in self.include_list:
for f in section_list:
i... | [
"def",
"FindHeader",
"(",
"self",
",",
"header",
")",
":",
"for",
"section_list",
"in",
"self",
".",
"include_list",
":",
"for",
"f",
"in",
"section_list",
":",
"if",
"f",
"[",
"0",
"]",
"==",
"header",
":",
"return",
"f",
"[",
"1",
"]",
"return",
... | https://github.com/apache/arrow/blob/af33dd1157eb8d7d9bfac25ebf61445b793b7943/cpp/build-support/cpplint.py#L838-L851 | |
genn-team/genn | 75e1eb218cafa228bf36ae4613d1ce26e877b12c | generate_swig_interfaces.py | python | generateNumpyApplyArgoutviewArray1D | ( dataType, varName, sizeName ) | return Template( '%apply ( ${data_t}* ARGOUTVIEW_ARRAY1, int* DIM1 ) {( ${data_t}* ${varName}, int* ${sizeName} )};\n').substitute( data_t=dataType, varName=varName, sizeName=sizeName ) | Generates a line which applies numpy ARGOUTVIEW_ARRAY1 typemap to variable. ARGOUTVIEW_ARRAY1 gives access to C array via numpy array. | Generates a line which applies numpy ARGOUTVIEW_ARRAY1 typemap to variable. ARGOUTVIEW_ARRAY1 gives access to C array via numpy array. | [
"Generates",
"a",
"line",
"which",
"applies",
"numpy",
"ARGOUTVIEW_ARRAY1",
"typemap",
"to",
"variable",
".",
"ARGOUTVIEW_ARRAY1",
"gives",
"access",
"to",
"C",
"array",
"via",
"numpy",
"array",
"."
] | def generateNumpyApplyArgoutviewArray1D( dataType, varName, sizeName ):
'''Generates a line which applies numpy ARGOUTVIEW_ARRAY1 typemap to variable. ARGOUTVIEW_ARRAY1 gives access to C array via numpy array.'''
return Template( '%apply ( ${data_t}* ARGOUTVIEW_ARRAY1, int* DIM1 ) {( ${data_t}* ${varName}, int*... | [
"def",
"generateNumpyApplyArgoutviewArray1D",
"(",
"dataType",
",",
"varName",
",",
"sizeName",
")",
":",
"return",
"Template",
"(",
"'%apply ( ${data_t}* ARGOUTVIEW_ARRAY1, int* DIM1 ) {( ${data_t}* ${varName}, int* ${sizeName} )};\\n'",
")",
".",
"substitute",
"(",
"data_t",
... | https://github.com/genn-team/genn/blob/75e1eb218cafa228bf36ae4613d1ce26e877b12c/generate_swig_interfaces.py#L301-L303 | |
baidu-research/tensorflow-allreduce | 66d5b855e90b0949e9fa5cca5599fd729a70e874 | tensorflow/python/ops/transpose_benchmark.py | python | TransposeBenchmark._run_graph | (self, device, input_shape, perm, num_iters, datatype) | return duration | Run the graph and print its execution time.
Args:
device: String, the device to run on.
input_shape: Shape of the input tensor.
perm: A list of ints with the same length as input tensor's dimension.
num_iters: Number of iterations to run the benchmark.
datatype: numpy data type of the... | Run the graph and print its execution time. | [
"Run",
"the",
"graph",
"and",
"print",
"its",
"execution",
"time",
"."
] | def _run_graph(self, device, input_shape, perm, num_iters, datatype):
"""Run the graph and print its execution time.
Args:
device: String, the device to run on.
input_shape: Shape of the input tensor.
perm: A list of ints with the same length as input tensor's dimension.
num_iters: Numb... | [
"def",
"_run_graph",
"(",
"self",
",",
"device",
",",
"input_shape",
",",
"perm",
",",
"num_iters",
",",
"datatype",
")",
":",
"graph",
"=",
"ops",
".",
"Graph",
"(",
")",
"with",
"graph",
".",
"as_default",
"(",
")",
":",
"outputs",
"=",
"build_graph"... | https://github.com/baidu-research/tensorflow-allreduce/blob/66d5b855e90b0949e9fa5cca5599fd729a70e874/tensorflow/python/ops/transpose_benchmark.py#L63-L104 | |
mantidproject/mantid | 03deeb89254ec4289edb8771e0188c2090a02f32 | scripts/Inelastic/IndirectCommon.py | python | getInstrRun | (ws_name) | return instrument, run_number | Get the instrument name and run number from a workspace.
@param ws_name - name of the workspace
@return tuple of form (instrument, run number) | Get the instrument name and run number from a workspace. | [
"Get",
"the",
"instrument",
"name",
"and",
"run",
"number",
"from",
"a",
"workspace",
"."
] | def getInstrRun(ws_name):
"""
Get the instrument name and run number from a workspace.
@param ws_name - name of the workspace
@return tuple of form (instrument, run number)
"""
run_number = get_run_number(ws_name)
instrument = s_api.mtd[ws_name].getInstrument().getName()
if instrument... | [
"def",
"getInstrRun",
"(",
"ws_name",
")",
":",
"run_number",
"=",
"get_run_number",
"(",
"ws_name",
")",
"instrument",
"=",
"s_api",
".",
"mtd",
"[",
"ws_name",
"]",
".",
"getInstrument",
"(",
")",
".",
"getName",
"(",
")",
"if",
"instrument",
"!=",
"''... | https://github.com/mantidproject/mantid/blob/03deeb89254ec4289edb8771e0188c2090a02f32/scripts/Inelastic/IndirectCommon.py#L60-L80 | |
aws/lumberyard | f85344403c1c2e77ec8c75deb2c116e97b713217 | dev/Tools/Python/3.7.10/windows/Lib/pathlib.py | python | Path._raw_open | (self, flags, mode=0o777) | return self._accessor.open(self, flags, mode) | Open the file pointed by this path and return a file descriptor,
as os.open() does. | Open the file pointed by this path and return a file descriptor,
as os.open() does. | [
"Open",
"the",
"file",
"pointed",
"by",
"this",
"path",
"and",
"return",
"a",
"file",
"descriptor",
"as",
"os",
".",
"open",
"()",
"does",
"."
] | def _raw_open(self, flags, mode=0o777):
"""
Open the file pointed by this path and return a file descriptor,
as os.open() does.
"""
if self._closed:
self._raise_closed()
return self._accessor.open(self, flags, mode) | [
"def",
"_raw_open",
"(",
"self",
",",
"flags",
",",
"mode",
"=",
"0o777",
")",
":",
"if",
"self",
".",
"_closed",
":",
"self",
".",
"_raise_closed",
"(",
")",
"return",
"self",
".",
"_accessor",
".",
"open",
"(",
"self",
",",
"flags",
",",
"mode",
... | https://github.com/aws/lumberyard/blob/f85344403c1c2e77ec8c75deb2c116e97b713217/dev/Tools/Python/3.7.10/windows/Lib/pathlib.py#L1065-L1072 | |
wxWidgets/wxPython-Classic | 19571e1ae65f1ac445f5491474121998c97a1bf0 | src/msw/_windows.py | python | PyPreviewControlBar.__init__ | (self, *args, **kwargs) | __init__(self, PrintPreview preview, long buttons, Window parent,
Point pos=DefaultPosition, Size size=DefaultSize,
long style=0, String name=PanelNameStr) -> PyPreviewControlBar | __init__(self, PrintPreview preview, long buttons, Window parent,
Point pos=DefaultPosition, Size size=DefaultSize,
long style=0, String name=PanelNameStr) -> PyPreviewControlBar | [
"__init__",
"(",
"self",
"PrintPreview",
"preview",
"long",
"buttons",
"Window",
"parent",
"Point",
"pos",
"=",
"DefaultPosition",
"Size",
"size",
"=",
"DefaultSize",
"long",
"style",
"=",
"0",
"String",
"name",
"=",
"PanelNameStr",
")",
"-",
">",
"PyPreviewCo... | def __init__(self, *args, **kwargs):
"""
__init__(self, PrintPreview preview, long buttons, Window parent,
Point pos=DefaultPosition, Size size=DefaultSize,
long style=0, String name=PanelNameStr) -> PyPreviewControlBar
"""
_windows_.PyPreviewControlBar_swigini... | [
"def",
"__init__",
"(",
"self",
",",
"*",
"args",
",",
"*",
"*",
"kwargs",
")",
":",
"_windows_",
".",
"PyPreviewControlBar_swiginit",
"(",
"self",
",",
"_windows_",
".",
"new_PyPreviewControlBar",
"(",
"*",
"args",
",",
"*",
"*",
"kwargs",
")",
")",
"se... | https://github.com/wxWidgets/wxPython-Classic/blob/19571e1ae65f1ac445f5491474121998c97a1bf0/src/msw/_windows.py#L5793-L5800 | ||
aws/lumberyard | f85344403c1c2e77ec8c75deb2c116e97b713217 | dev/Tools/Python/3.7.10/windows/Lib/distutils/cmd.py | python | Command.ensure_filename | (self, option) | Ensure that 'option' is the name of an existing file. | Ensure that 'option' is the name of an existing file. | [
"Ensure",
"that",
"option",
"is",
"the",
"name",
"of",
"an",
"existing",
"file",
"."
] | def ensure_filename(self, option):
"""Ensure that 'option' is the name of an existing file."""
self._ensure_tested_string(option, os.path.isfile,
"filename",
"'%s' does not exist or is not a file") | [
"def",
"ensure_filename",
"(",
"self",
",",
"option",
")",
":",
"self",
".",
"_ensure_tested_string",
"(",
"option",
",",
"os",
".",
"path",
".",
"isfile",
",",
"\"filename\"",
",",
"\"'%s' does not exist or is not a file\"",
")"
] | https://github.com/aws/lumberyard/blob/f85344403c1c2e77ec8c75deb2c116e97b713217/dev/Tools/Python/3.7.10/windows/Lib/distutils/cmd.py#L251-L255 | ||
wlanjie/AndroidFFmpeg | 7baf9122f4b8e1c74e7baf4be5c422c7a5ba5aaf | tools/fdk-aac-build/armeabi-v7a/toolchain/lib/python2.7/idlelib/configHandler.py | python | IdleConf.GetThemeDict | (self,type,themeName) | return theme | type - string, 'default' or 'user' theme type
themeName - string, theme name
Returns a dictionary which holds {option:value} for each element
in the specified theme. Values are loaded over a set of ultimate last
fallback defaults to guarantee that all theme elements are present in
... | type - string, 'default' or 'user' theme type
themeName - string, theme name
Returns a dictionary which holds {option:value} for each element
in the specified theme. Values are loaded over a set of ultimate last
fallback defaults to guarantee that all theme elements are present in
... | [
"type",
"-",
"string",
"default",
"or",
"user",
"theme",
"type",
"themeName",
"-",
"string",
"theme",
"name",
"Returns",
"a",
"dictionary",
"which",
"holds",
"{",
"option",
":",
"value",
"}",
"for",
"each",
"element",
"in",
"the",
"specified",
"theme",
"."... | def GetThemeDict(self,type,themeName):
"""
type - string, 'default' or 'user' theme type
themeName - string, theme name
Returns a dictionary which holds {option:value} for each element
in the specified theme. Values are loaded over a set of ultimate last
fallback defaults... | [
"def",
"GetThemeDict",
"(",
"self",
",",
"type",
",",
"themeName",
")",
":",
"if",
"type",
"==",
"'user'",
":",
"cfgParser",
"=",
"self",
".",
"userCfg",
"[",
"'highlight'",
"]",
"elif",
"type",
"==",
"'default'",
":",
"cfgParser",
"=",
"self",
".",
"d... | https://github.com/wlanjie/AndroidFFmpeg/blob/7baf9122f4b8e1c74e7baf4be5c422c7a5ba5aaf/tools/fdk-aac-build/armeabi-v7a/toolchain/lib/python2.7/idlelib/configHandler.py#L324-L386 | |
openthread/openthread | 9fcdbed9c526c70f1556d1ed84099c1535c7cd32 | tools/harness-thci/OpenThread_WpanCtl.py | python | OpenThread_WpanCtl.getULA64 | (self) | return self.getMLEID() | get mesh local EID of Thread device | get mesh local EID of Thread device | [
"get",
"mesh",
"local",
"EID",
"of",
"Thread",
"device"
] | def getULA64(self):
"""get mesh local EID of Thread device"""
print('%s call getULA64' % self.port)
return self.getMLEID() | [
"def",
"getULA64",
"(",
"self",
")",
":",
"print",
"(",
"'%s call getULA64'",
"%",
"self",
".",
"port",
")",
"return",
"self",
".",
"getMLEID",
"(",
")"
] | https://github.com/openthread/openthread/blob/9fcdbed9c526c70f1556d1ed84099c1535c7cd32/tools/harness-thci/OpenThread_WpanCtl.py#L1945-L1948 | |
tensorflow/deepmath | b5b721f54de1d5d6a02d78f5da5995237f9995f9 | deepmath/treegen/cnf_model.py | python | CNFTreeModel.build_term | (self, loom_input, term, emb, context) | Add term to loom_input. | Add term to loom_input. | [
"Add",
"term",
"to",
"loom_input",
"."
] | def build_term(self, loom_input, term, emb, context):
"""Add term to loom_input."""
# pylint: disable=g-long-lambda
# func: 0, number: 1, var: 2
term_type_id = 1 * ('number' in term) + 2 * ('var' in term)
with self.aux_lstm(emb, loom_input, context) as (emb, add_to_lstm):
loom_input.supervis... | [
"def",
"build_term",
"(",
"self",
",",
"loom_input",
",",
"term",
",",
"emb",
",",
"context",
")",
":",
"# pylint: disable=g-long-lambda",
"# func: 0, number: 1, var: 2",
"term_type_id",
"=",
"1",
"*",
"(",
"'number'",
"in",
"term",
")",
"+",
"2",
"*",
"(",
... | https://github.com/tensorflow/deepmath/blob/b5b721f54de1d5d6a02d78f5da5995237f9995f9/deepmath/treegen/cnf_model.py#L1243-L1275 | ||
runtimejs/runtime | 0a6e84c30823d35a4548d6634166784260ae7b74 | deps/v8/tools/stats-viewer.py | python | SharedDataAccess.ByteAt | (self, index) | return ord(self.CharAt(index)) | Return the (unsigned) byte at the specified byte index. | Return the (unsigned) byte at the specified byte index. | [
"Return",
"the",
"(",
"unsigned",
")",
"byte",
"at",
"the",
"specified",
"byte",
"index",
"."
] | def ByteAt(self, index):
"""Return the (unsigned) byte at the specified byte index."""
return ord(self.CharAt(index)) | [
"def",
"ByteAt",
"(",
"self",
",",
"index",
")",
":",
"return",
"ord",
"(",
"self",
".",
"CharAt",
"(",
"index",
")",
")"
] | https://github.com/runtimejs/runtime/blob/0a6e84c30823d35a4548d6634166784260ae7b74/deps/v8/tools/stats-viewer.py#L312-L314 | |
adobe/chromium | cfe5bf0b51b1f6b9fe239c2a3c2f2364da9967d7 | media/tools/constrained_network_server/cns.py | python | PortAllocator._CleanupLocked | (self, all_ports) | Internal cleanup method, expects lock to have already been acquired.
See Cleanup() for more information.
Args:
all_ports: Should all ports be torn down regardless of expiration? | Internal cleanup method, expects lock to have already been acquired. | [
"Internal",
"cleanup",
"method",
"expects",
"lock",
"to",
"have",
"already",
"been",
"acquired",
"."
] | def _CleanupLocked(self, all_ports):
"""Internal cleanup method, expects lock to have already been acquired.
See Cleanup() for more information.
Args:
all_ports: Should all ports be torn down regardless of expiration?
"""
now = time.time()
# Use .items() instead of .iteritems() so we can... | [
"def",
"_CleanupLocked",
"(",
"self",
",",
"all_ports",
")",
":",
"now",
"=",
"time",
".",
"time",
"(",
")",
"# Use .items() instead of .iteritems() so we can delete keys w/o error.",
"for",
"port",
",",
"status",
"in",
"self",
".",
"_ports",
".",
"items",
"(",
... | https://github.com/adobe/chromium/blob/cfe5bf0b51b1f6b9fe239c2a3c2f2364da9967d7/media/tools/constrained_network_server/cns.py#L131-L146 | ||
miyosuda/TensorFlowAndroidDemo | 35903e0221aa5f109ea2dbef27f20b52e317f42d | jni-build/jni/include/tensorflow/python/ops/math_ops.py | python | cast | (x, dtype, name=None) | Casts a tensor to a new type.
The operation casts `x` (in case of `Tensor`) or `x.values`
(in case of `SparseTensor`) to `dtype`.
For example:
```python
# tensor `a` is [1.8, 2.2], dtype=tf.float
tf.cast(a, tf.int32) ==> [1, 2] # dtype=tf.int32
```
Args:
x: A `Tensor` or `SparseTensor`.
dty... | Casts a tensor to a new type. | [
"Casts",
"a",
"tensor",
"to",
"a",
"new",
"type",
"."
] | def cast(x, dtype, name=None):
"""Casts a tensor to a new type.
The operation casts `x` (in case of `Tensor`) or `x.values`
(in case of `SparseTensor`) to `dtype`.
For example:
```python
# tensor `a` is [1.8, 2.2], dtype=tf.float
tf.cast(a, tf.int32) ==> [1, 2] # dtype=tf.int32
```
Args:
x: A... | [
"def",
"cast",
"(",
"x",
",",
"dtype",
",",
"name",
"=",
"None",
")",
":",
"base_type",
"=",
"dtypes",
".",
"as_dtype",
"(",
"dtype",
")",
".",
"base_dtype",
"with",
"ops",
".",
"op_scope",
"(",
"[",
"x",
"]",
",",
"name",
",",
"\"Cast\"",
")",
"... | https://github.com/miyosuda/TensorFlowAndroidDemo/blob/35903e0221aa5f109ea2dbef27f20b52e317f42d/jni-build/jni/include/tensorflow/python/ops/math_ops.py#L587-L625 | ||
microsoft/CNTK | e9396480025b9ca457d26b6f33dd07c474c6aa04 | bindings/python/cntk/contrib/deeprl/agent/qlearning.py | python | QLearning.start | (self, state) | return self._last_action, {
'action_behavior': action_behavior,
'epsilon': self._epsilon} | Start a new episode.
Args:
state (object): observation provided by the environment.
Returns:
action (int): action choosen by agent.
debug_info (dict): auxiliary diagnostic information. | Start a new episode. | [
"Start",
"a",
"new",
"episode",
"."
] | def start(self, state):
"""
Start a new episode.
Args:
state (object): observation provided by the environment.
Returns:
action (int): action choosen by agent.
debug_info (dict): auxiliary diagnostic information.
"""
if self._preproce... | [
"def",
"start",
"(",
"self",
",",
"state",
")",
":",
"if",
"self",
".",
"_preprocessor",
"is",
"not",
"None",
":",
"self",
".",
"_preprocessor",
".",
"reset",
"(",
")",
"self",
".",
"_adjust_exploration_rate",
"(",
")",
"self",
".",
"_last_state",
"=",
... | https://github.com/microsoft/CNTK/blob/e9396480025b9ca457d26b6f33dd07c474c6aa04/bindings/python/cntk/contrib/deeprl/agent/qlearning.py#L135-L156 | |
google/certificate-transparency | 2588562fd306a447958471b6f06c1069619c1641 | python/ct/crypto/signing/signer_ecdsa.py | python | EcdsaSigner.__init__ | (self, key_pem) | Creates a signer from a PEM-encoded ECDSA private key.
Args:
- key_pem: Private key, in PEM format. | Creates a signer from a PEM-encoded ECDSA private key. | [
"Creates",
"a",
"signer",
"from",
"a",
"PEM",
"-",
"encoded",
"ECDSA",
"private",
"key",
"."
] | def __init__(self, key_pem):
"""Creates a signer from a PEM-encoded ECDSA private key.
Args:
- key_pem: Private key, in PEM format.
"""
self.__key = ecdsa.SigningKey.from_pem(key_pem) | [
"def",
"__init__",
"(",
"self",
",",
"key_pem",
")",
":",
"self",
".",
"__key",
"=",
"ecdsa",
".",
"SigningKey",
".",
"from_pem",
"(",
"key_pem",
")"
] | https://github.com/google/certificate-transparency/blob/2588562fd306a447958471b6f06c1069619c1641/python/ct/crypto/signing/signer_ecdsa.py#L9-L15 | ||
catboost/catboost | 167f64f237114a4d10b2b4ee42adb4569137debe | contrib/python/scipy/py3/scipy/optimize/_differentialevolution.py | python | DifferentialEvolutionSolver._select_samples | (self, candidate, number_samples) | return idxs | obtain random integers from range(self.num_population_members),
without replacement. You can't have the original candidate either. | obtain random integers from range(self.num_population_members),
without replacement. You can't have the original candidate either. | [
"obtain",
"random",
"integers",
"from",
"range",
"(",
"self",
".",
"num_population_members",
")",
"without",
"replacement",
".",
"You",
"can",
"t",
"have",
"the",
"original",
"candidate",
"either",
"."
] | def _select_samples(self, candidate, number_samples):
"""
obtain random integers from range(self.num_population_members),
without replacement. You can't have the original candidate either.
"""
idxs = list(range(self.num_population_members))
idxs.remove(candidate)
... | [
"def",
"_select_samples",
"(",
"self",
",",
"candidate",
",",
"number_samples",
")",
":",
"idxs",
"=",
"list",
"(",
"range",
"(",
"self",
".",
"num_population_members",
")",
")",
"idxs",
".",
"remove",
"(",
"candidate",
")",
"self",
".",
"random_number_gener... | https://github.com/catboost/catboost/blob/167f64f237114a4d10b2b4ee42adb4569137debe/contrib/python/scipy/py3/scipy/optimize/_differentialevolution.py#L993-L1002 | |
mantidproject/mantid | 03deeb89254ec4289edb8771e0188c2090a02f32 | qt/python/mantidqtinterfaces/mantidqtinterfaces/Muon/GUI/Common/contexts/fitting_contexts/tf_asymmetry_fitting_context.py | python | TFAsymmetryFittingContext.tf_asymmetry_single_functions | (self, tf_asymmetry_functions: list) | Sets the single TF Asymmetry fit functions stored in the model. | Sets the single TF Asymmetry fit functions stored in the model. | [
"Sets",
"the",
"single",
"TF",
"Asymmetry",
"fit",
"functions",
"stored",
"in",
"the",
"model",
"."
] | def tf_asymmetry_single_functions(self, tf_asymmetry_functions: list) -> None:
"""Sets the single TF Asymmetry fit functions stored in the model."""
self._tf_asymmetry_single_functions = tf_asymmetry_functions | [
"def",
"tf_asymmetry_single_functions",
"(",
"self",
",",
"tf_asymmetry_functions",
":",
"list",
")",
"->",
"None",
":",
"self",
".",
"_tf_asymmetry_single_functions",
"=",
"tf_asymmetry_functions"
] | https://github.com/mantidproject/mantid/blob/03deeb89254ec4289edb8771e0188c2090a02f32/qt/python/mantidqtinterfaces/mantidqtinterfaces/Muon/GUI/Common/contexts/fitting_contexts/tf_asymmetry_fitting_context.py#L92-L94 | ||
notepad-plus-plus/notepad-plus-plus | d372894e784afd3d224e9d4d03ae679ba6312788 | scintilla/scripts/GenerateCaseConvert.py | python | flatten | (listOfLists) | return itertools.chain.from_iterable(listOfLists) | Flatten one level of nesting | Flatten one level of nesting | [
"Flatten",
"one",
"level",
"of",
"nesting"
] | def flatten(listOfLists):
"Flatten one level of nesting"
return itertools.chain.from_iterable(listOfLists) | [
"def",
"flatten",
"(",
"listOfLists",
")",
":",
"return",
"itertools",
".",
"chain",
".",
"from_iterable",
"(",
"listOfLists",
")"
] | https://github.com/notepad-plus-plus/notepad-plus-plus/blob/d372894e784afd3d224e9d4d03ae679ba6312788/scintilla/scripts/GenerateCaseConvert.py#L34-L36 | |
schwehr/libais | 1e19605942c8e155cd02fde6d1acde75ecd15d75 | ais/vdm.py | python | VdmLines | (lines) | Yield only the lines that contain AIS messages.
Args:
lines: An iterable series of strings.
Yields:
Lines that look like they probably contain valid VDM/VDO messages. | Yield only the lines that contain AIS messages. | [
"Yield",
"only",
"the",
"lines",
"that",
"contain",
"AIS",
"messages",
"."
] | def VdmLines(lines):
"""Yield only the lines that contain AIS messages.
Args:
lines: An iterable series of strings.
Yields:
Lines that look like they probably contain valid VDM/VDO messages.
"""
for line in lines:
line = line.rstrip()
if nmea.ID_BARE_VDM_RE.match(line):
yield line | [
"def",
"VdmLines",
"(",
"lines",
")",
":",
"for",
"line",
"in",
"lines",
":",
"line",
"=",
"line",
".",
"rstrip",
"(",
")",
"if",
"nmea",
".",
"ID_BARE_VDM_RE",
".",
"match",
"(",
"line",
")",
":",
"yield",
"line"
] | https://github.com/schwehr/libais/blob/1e19605942c8e155cd02fde6d1acde75ecd15d75/ais/vdm.py#L93-L105 | ||
aws/lumberyard | f85344403c1c2e77ec8c75deb2c116e97b713217 | dev/Tools/Python/3.7.10/windows/Lib/heapq.py | python | _heappop_max | (heap) | return lastelt | Maxheap version of a heappop. | Maxheap version of a heappop. | [
"Maxheap",
"version",
"of",
"a",
"heappop",
"."
] | def _heappop_max(heap):
"""Maxheap version of a heappop."""
lastelt = heap.pop() # raises appropriate IndexError if heap is empty
if heap:
returnitem = heap[0]
heap[0] = lastelt
_siftup_max(heap, 0)
return returnitem
return lastelt | [
"def",
"_heappop_max",
"(",
"heap",
")",
":",
"lastelt",
"=",
"heap",
".",
"pop",
"(",
")",
"# raises appropriate IndexError if heap is empty",
"if",
"heap",
":",
"returnitem",
"=",
"heap",
"[",
"0",
"]",
"heap",
"[",
"0",
"]",
"=",
"lastelt",
"_siftup_max",... | https://github.com/aws/lumberyard/blob/f85344403c1c2e77ec8c75deb2c116e97b713217/dev/Tools/Python/3.7.10/windows/Lib/heapq.py#L179-L187 | |
wxWidgets/wxPython-Classic | 19571e1ae65f1ac445f5491474121998c97a1bf0 | wx/tools/Editra/src/extern/pubsub.py | python | PublisherClass.subscribe | (self, listener, topic = ALL_TOPICS) | Subscribe listener for given topic. If topic is not specified,
listener will be subscribed for all topics (that listener will
receive a Message for any topic for which a message is generated).
This method may be called multiple times for one listener,
registering it with many ... | Subscribe listener for given topic. If topic is not specified,
listener will be subscribed for all topics (that listener will
receive a Message for any topic for which a message is generated).
This method may be called multiple times for one listener,
registering it with many ... | [
"Subscribe",
"listener",
"for",
"given",
"topic",
".",
"If",
"topic",
"is",
"not",
"specified",
"listener",
"will",
"be",
"subscribed",
"for",
"all",
"topics",
"(",
"that",
"listener",
"will",
"receive",
"a",
"Message",
"for",
"any",
"topic",
"for",
"which",... | def subscribe(self, listener, topic = ALL_TOPICS):
"""
Subscribe listener for given topic. If topic is not specified,
listener will be subscribed for all topics (that listener will
receive a Message for any topic for which a message is generated).
This method may be ca... | [
"def",
"subscribe",
"(",
"self",
",",
"listener",
",",
"topic",
"=",
"ALL_TOPICS",
")",
":",
"self",
".",
"validate",
"(",
"listener",
")",
"if",
"topic",
"is",
"None",
":",
"raise",
"TypeError",
",",
"'Topic must be either a word, tuple of '",
"'words, or getSt... | https://github.com/wxWidgets/wxPython-Classic/blob/19571e1ae65f1ac445f5491474121998c97a1bf0/wx/tools/Editra/src/extern/pubsub.py#L637-L683 | ||
naver/sling | 5671cd445a2caae0b4dd0332299e4cfede05062c | webkit/Tools/Scripts/webkitpy/thirdparty/irc/irclib.py | python | ip_numstr_to_quad | (num) | return ".".join(p) | Convert an IP number as an integer given in ASCII
representation (e.g. '3232235521') to an IP address string
(e.g. '192.168.0.1'). | Convert an IP number as an integer given in ASCII
representation (e.g. '3232235521') to an IP address string
(e.g. '192.168.0.1'). | [
"Convert",
"an",
"IP",
"number",
"as",
"an",
"integer",
"given",
"in",
"ASCII",
"representation",
"(",
"e",
".",
"g",
".",
"3232235521",
")",
"to",
"an",
"IP",
"address",
"string",
"(",
"e",
".",
"g",
".",
"192",
".",
"168",
".",
"0",
".",
"1",
"... | def ip_numstr_to_quad(num):
"""Convert an IP number as an integer given in ASCII
representation (e.g. '3232235521') to an IP address string
(e.g. '192.168.0.1')."""
n = long(num)
p = map(str, map(int, [n >> 24 & 0xFF, n >> 16 & 0xFF,
n >> 8 & 0xFF, n & 0xFF]))
return "... | [
"def",
"ip_numstr_to_quad",
"(",
"num",
")",
":",
"n",
"=",
"long",
"(",
"num",
")",
"p",
"=",
"map",
"(",
"str",
",",
"map",
"(",
"int",
",",
"[",
"n",
">>",
"24",
"&",
"0xFF",
",",
"n",
">>",
"16",
"&",
"0xFF",
",",
"n",
">>",
"8",
"&",
... | https://github.com/naver/sling/blob/5671cd445a2caae0b4dd0332299e4cfede05062c/webkit/Tools/Scripts/webkitpy/thirdparty/irc/irclib.py#L1258-L1265 | |
cms-sw/cmssw | fd9de012d503d3405420bcbeec0ec879baa57cf2 | Utilities/RelMon/python/dqm_interfaces.py | python | DQMcommunicator.get_samples | (self, samples_string="*") | return samples_dict["samples"] | A sample contains, among the other things, a data type, a dataset name
and a run. | A sample contains, among the other things, a data type, a dataset name
and a run. | [
"A",
"sample",
"contains",
"among",
"the",
"other",
"things",
"a",
"data",
"type",
"a",
"dataset",
"name",
"and",
"a",
"run",
"."
] | def get_samples(self, samples_string="*"):
"""
A sample contains, among the other things, a data type, a dataset name
and a run.
"""
full_url='%s/data/json/samples?match=%s' % (self.server, samples_string)
samples_dict=eval(self.get_data(full_url))
return samples... | [
"def",
"get_samples",
"(",
"self",
",",
"samples_string",
"=",
"\"*\"",
")",
":",
"full_url",
"=",
"'%s/data/json/samples?match=%s'",
"%",
"(",
"self",
".",
"server",
",",
"samples_string",
")",
"samples_dict",
"=",
"eval",
"(",
"self",
".",
"get_data",
"(",
... | https://github.com/cms-sw/cmssw/blob/fd9de012d503d3405420bcbeec0ec879baa57cf2/Utilities/RelMon/python/dqm_interfaces.py#L191-L198 | |
devsisters/libquic | 8954789a056d8e7d5fcb6452fd1572ca57eb5c4e | src/third_party/protobuf/python/google/protobuf/internal/python_message.py | python | _AddMessageMethods | (message_descriptor, cls) | Adds implementations of all Message methods to cls. | Adds implementations of all Message methods to cls. | [
"Adds",
"implementations",
"of",
"all",
"Message",
"methods",
"to",
"cls",
"."
] | def _AddMessageMethods(message_descriptor, cls):
"""Adds implementations of all Message methods to cls."""
_AddListFieldsMethod(message_descriptor, cls)
_AddHasFieldMethod(message_descriptor, cls)
_AddClearFieldMethod(message_descriptor, cls)
if message_descriptor.is_extendable:
_AddClearExtensionMethod(c... | [
"def",
"_AddMessageMethods",
"(",
"message_descriptor",
",",
"cls",
")",
":",
"_AddListFieldsMethod",
"(",
"message_descriptor",
",",
"cls",
")",
"_AddHasFieldMethod",
"(",
"message_descriptor",
",",
"cls",
")",
"_AddClearFieldMethod",
"(",
"message_descriptor",
",",
... | https://github.com/devsisters/libquic/blob/8954789a056d8e7d5fcb6452fd1572ca57eb5c4e/src/third_party/protobuf/python/google/protobuf/internal/python_message.py#L1306-L1328 | ||
pmq20/node-packer | 12c46c6e44fbc14d9ee645ebd17d5296b324f7e0 | current/tools/gyp/pylib/gyp/MSVSSettings.py | python | ValidateMSVSSettings | (settings, stderr=sys.stderr) | Validates that the names of the settings are valid for MSVS.
Args:
settings: A dictionary. The key is the tool name. The values are
themselves dictionaries of settings and their values.
stderr: The stream receiving the error messages. | Validates that the names of the settings are valid for MSVS. | [
"Validates",
"that",
"the",
"names",
"of",
"the",
"settings",
"are",
"valid",
"for",
"MSVS",
"."
] | def ValidateMSVSSettings(settings, stderr=sys.stderr):
"""Validates that the names of the settings are valid for MSVS.
Args:
settings: A dictionary. The key is the tool name. The values are
themselves dictionaries of settings and their values.
stderr: The stream receiving the error messages... | [
"def",
"ValidateMSVSSettings",
"(",
"settings",
",",
"stderr",
"=",
"sys",
".",
"stderr",
")",
":",
"_ValidateSettings",
"(",
"_msvs_validators",
",",
"settings",
",",
"stderr",
")"
] | https://github.com/pmq20/node-packer/blob/12c46c6e44fbc14d9ee645ebd17d5296b324f7e0/current/tools/gyp/pylib/gyp/MSVSSettings.py#L484-L492 | ||
mindspore-ai/mindspore | fb8fd3338605bb34fa5cea054e535a8b1d753fab | mindspore/python/mindspore/nn/optim/ftrl.py | python | _check_param | (initial_accum, lr_power, l1, l2, use_locking, prim_name=None) | Check param. | Check param. | [
"Check",
"param",
"."
] | def _check_param(initial_accum, lr_power, l1, l2, use_locking, prim_name=None):
"""Check param."""
validator.check_value_type("initial_accum", initial_accum, [float], prim_name)
validator.check_number("initial_accum", initial_accum, 0.0, Rel.GE, prim_name)
validator.check_value_type("lr_power", lr_powe... | [
"def",
"_check_param",
"(",
"initial_accum",
",",
"lr_power",
",",
"l1",
",",
"l2",
",",
"use_locking",
",",
"prim_name",
"=",
"None",
")",
":",
"validator",
".",
"check_value_type",
"(",
"\"initial_accum\"",
",",
"initial_accum",
",",
"[",
"float",
"]",
","... | https://github.com/mindspore-ai/mindspore/blob/fb8fd3338605bb34fa5cea054e535a8b1d753fab/mindspore/python/mindspore/nn/optim/ftrl.py#L59-L73 | ||
apple/swift-lldb | d74be846ef3e62de946df343e8c234bde93a8912 | scripts/Python/static-binding/lldb.py | python | SBAddress.IsValid | (self) | return _lldb.SBAddress_IsValid(self) | IsValid(SBAddress self) -> bool | IsValid(SBAddress self) -> bool | [
"IsValid",
"(",
"SBAddress",
"self",
")",
"-",
">",
"bool"
] | def IsValid(self):
"""IsValid(SBAddress self) -> bool"""
return _lldb.SBAddress_IsValid(self) | [
"def",
"IsValid",
"(",
"self",
")",
":",
"return",
"_lldb",
".",
"SBAddress_IsValid",
"(",
"self",
")"
] | https://github.com/apple/swift-lldb/blob/d74be846ef3e62de946df343e8c234bde93a8912/scripts/Python/static-binding/lldb.py#L874-L876 | |
windystrife/UnrealEngine_NVIDIAGameWorks | b50e6338a7c5b26374d66306ebc7807541ff815e | Engine/Extras/ThirdPartyNotUE/emsdk/Win64/python/2.7.5.3_64bit/Lib/logging/__init__.py | python | Handler.handleError | (self, record) | Handle errors which occur during an emit() call.
This method should be called from handlers when an exception is
encountered during an emit() call. If raiseExceptions is false,
exceptions get silently ignored. This is what is mostly wanted
for a logging system - most users will not care... | Handle errors which occur during an emit() call. | [
"Handle",
"errors",
"which",
"occur",
"during",
"an",
"emit",
"()",
"call",
"."
] | def handleError(self, record):
"""
Handle errors which occur during an emit() call.
This method should be called from handlers when an exception is
encountered during an emit() call. If raiseExceptions is false,
exceptions get silently ignored. This is what is mostly wanted
... | [
"def",
"handleError",
"(",
"self",
",",
"record",
")",
":",
"if",
"raiseExceptions",
"and",
"sys",
".",
"stderr",
":",
"# see issue 13807",
"ei",
"=",
"sys",
".",
"exc_info",
"(",
")",
"try",
":",
"traceback",
".",
"print_exception",
"(",
"ei",
"[",
"0",... | https://github.com/windystrife/UnrealEngine_NVIDIAGameWorks/blob/b50e6338a7c5b26374d66306ebc7807541ff815e/Engine/Extras/ThirdPartyNotUE/emsdk/Win64/python/2.7.5.3_64bit/Lib/logging/__init__.py#L786-L808 | ||
catboost/catboost | 167f64f237114a4d10b2b4ee42adb4569137debe | contrib/python/scipy/py2/scipy/integrate/_ivp/common.py | python | OdeSolution.__call__ | (self, t) | return ys | Evaluate the solution.
Parameters
----------
t : float or array_like with shape (n_points,)
Points to evaluate at.
Returns
-------
y : ndarray, shape (n_states,) or (n_states, n_points)
Computed values. Shape depends on whether `t` is a scalar or... | Evaluate the solution. | [
"Evaluate",
"the",
"solution",
"."
] | def __call__(self, t):
"""Evaluate the solution.
Parameters
----------
t : float or array_like with shape (n_points,)
Points to evaluate at.
Returns
-------
y : ndarray, shape (n_states,) or (n_states, n_points)
Computed values. Shape dep... | [
"def",
"__call__",
"(",
"self",
",",
"t",
")",
":",
"t",
"=",
"np",
".",
"asarray",
"(",
"t",
")",
"if",
"t",
".",
"ndim",
"==",
"0",
":",
"return",
"self",
".",
"_call_single",
"(",
"t",
")",
"order",
"=",
"np",
".",
"argsort",
"(",
"t",
")"... | https://github.com/catboost/catboost/blob/167f64f237114a4d10b2b4ee42adb4569137debe/contrib/python/scipy/py2/scipy/integrate/_ivp/common.py#L191-L237 | |
NervanaSystems/ngraph | f677a119765ca30636cf407009dabd118664951f | python/src/ngraph/utils/reduction.py | python | get_reduction_axes | (node: Node, reduction_axes: Optional[Iterable[int]]) | return reduction_axes | Get reduction axes if it is None and convert it to set if its type is different.
If reduction_axes is None we default to reduce all axes.
:param node: The node we fill reduction axes for.
:param reduction_axes: The collection of indices of axes to reduce. May be None.
:return: Set filled with indices ... | Get reduction axes if it is None and convert it to set if its type is different. | [
"Get",
"reduction",
"axes",
"if",
"it",
"is",
"None",
"and",
"convert",
"it",
"to",
"set",
"if",
"its",
"type",
"is",
"different",
"."
] | def get_reduction_axes(node: Node, reduction_axes: Optional[Iterable[int]]) -> Iterable[int]:
"""Get reduction axes if it is None and convert it to set if its type is different.
If reduction_axes is None we default to reduce all axes.
:param node: The node we fill reduction axes for.
:param reduction_... | [
"def",
"get_reduction_axes",
"(",
"node",
":",
"Node",
",",
"reduction_axes",
":",
"Optional",
"[",
"Iterable",
"[",
"int",
"]",
"]",
")",
"->",
"Iterable",
"[",
"int",
"]",
":",
"if",
"reduction_axes",
"is",
"None",
":",
"reduction_axes",
"=",
"set",
"(... | https://github.com/NervanaSystems/ngraph/blob/f677a119765ca30636cf407009dabd118664951f/python/src/ngraph/utils/reduction.py#L22-L36 | |
NVIDIA/TensorRT | 42805f078052daad1a98bc5965974fcffaad0960 | samples/python/yolov3_onnx/yolov3_to_onnx.py | python | GraphBuilderONNX._make_shortcut_node | (self, layer_name, layer_dict) | return layer_name, channels | Create an ONNX Add node with the shortcut properties from
the DarkNet-based graph.
Keyword arguments:
layer_name -- the layer's name (also the corresponding key in layer_configs)
layer_dict -- a layer parameter dictionary (one element of layer_configs) | Create an ONNX Add node with the shortcut properties from
the DarkNet-based graph. | [
"Create",
"an",
"ONNX",
"Add",
"node",
"with",
"the",
"shortcut",
"properties",
"from",
"the",
"DarkNet",
"-",
"based",
"graph",
"."
] | def _make_shortcut_node(self, layer_name, layer_dict):
"""Create an ONNX Add node with the shortcut properties from
the DarkNet-based graph.
Keyword arguments:
layer_name -- the layer's name (also the corresponding key in layer_configs)
layer_dict -- a layer parameter dictionary... | [
"def",
"_make_shortcut_node",
"(",
"self",
",",
"layer_name",
",",
"layer_dict",
")",
":",
"shortcut_index",
"=",
"layer_dict",
"[",
"'from'",
"]",
"activation",
"=",
"layer_dict",
"[",
"'activation'",
"]",
"assert",
"activation",
"==",
"'linear'",
"first_node_spe... | https://github.com/NVIDIA/TensorRT/blob/42805f078052daad1a98bc5965974fcffaad0960/samples/python/yolov3_onnx/yolov3_to_onnx.py#L598-L623 | |
infinit/memo | 3a8394d0f647efe03ccb8bfe885a7279cb8be8a6 | elle/drake/src/drake/__init__.py | python | Path.touch | (self) | Create the designated file if it does not exists.
Creates the parent directories if needed first.
>>> Path('/tmp/.drake').remove()
>>> p = Path('/tmp/.drake/.sub/.foo')
>>> p.touch()
>>> p.exists()
True
If the file does exist, this is a no-op.
>>> path = Path('/tmp/.d... | Create the designated file if it does not exists. | [
"Create",
"the",
"designated",
"file",
"if",
"it",
"does",
"not",
"exists",
"."
] | def touch(self):
"""Create the designated file if it does not exists.
Creates the parent directories if needed first.
>>> Path('/tmp/.drake').remove()
>>> p = Path('/tmp/.drake/.sub/.foo')
>>> p.touch()
>>> p.exists()
True
If the file does exist, this is a no-op.
... | [
"def",
"touch",
"(",
"self",
")",
":",
"parent",
"=",
"self",
".",
"dirname",
"(",
")",
"if",
"parent",
"is",
"not",
"Path",
".",
"dot",
":",
"parent",
".",
"mkpath",
"(",
")",
"if",
"not",
"_OS",
".",
"path",
".",
"exists",
"(",
"str",
"(",
"s... | https://github.com/infinit/memo/blob/3a8394d0f647efe03ccb8bfe885a7279cb8be8a6/elle/drake/src/drake/__init__.py#L862-L888 | ||
hanpfei/chromium-net | 392cc1fa3a8f92f42e4071ab6e674d8e0482f83f | third_party/catapult/third_party/gsutil/third_party/boto/boto/gs/bucket.py | python | Bucket._get_xml_acl_helper | (self, key_name, headers, query_args) | return body | Provides common functionality for get_xml_acl and _get_acl_helper. | Provides common functionality for get_xml_acl and _get_acl_helper. | [
"Provides",
"common",
"functionality",
"for",
"get_xml_acl",
"and",
"_get_acl_helper",
"."
] | def _get_xml_acl_helper(self, key_name, headers, query_args):
"""Provides common functionality for get_xml_acl and _get_acl_helper."""
response = self.connection.make_request('GET', self.name, key_name,
query_args=query_args,
... | [
"def",
"_get_xml_acl_helper",
"(",
"self",
",",
"key_name",
",",
"headers",
",",
"query_args",
")",
":",
"response",
"=",
"self",
".",
"connection",
".",
"make_request",
"(",
"'GET'",
",",
"self",
".",
"name",
",",
"key_name",
",",
"query_args",
"=",
"quer... | https://github.com/hanpfei/chromium-net/blob/392cc1fa3a8f92f42e4071ab6e674d8e0482f83f/third_party/catapult/third_party/gsutil/third_party/boto/boto/gs/bucket.py#L327-L344 | |
martinmoene/string-view-lite | 6c2ba8672db54a355a6d76c820dd46ecda254038 | script/update-version.py | python | editFilesToVersionFromCommandLine | () | Update version number given on command line in paths from configuration table. | Update version number given on command line in paths from configuration table. | [
"Update",
"version",
"number",
"given",
"on",
"command",
"line",
"in",
"paths",
"from",
"configuration",
"table",
"."
] | def editFilesToVersionFromCommandLine():
"""Update version number given on command line in paths from configuration table."""
parser = argparse.ArgumentParser(
description='Update version number in files.',
epilog="""""",
formatter_class=argparse.RawTextHelpFormatter)
parser.add_ar... | [
"def",
"editFilesToVersionFromCommandLine",
"(",
")",
":",
"parser",
"=",
"argparse",
".",
"ArgumentParser",
"(",
"description",
"=",
"'Update version number in files.'",
",",
"epilog",
"=",
"\"\"\"\"\"\"",
",",
"formatter_class",
"=",
"argparse",
".",
"RawTextHelpForma... | https://github.com/martinmoene/string-view-lite/blob/6c2ba8672db54a355a6d76c820dd46ecda254038/script/update-version.py#L101-L123 | ||
meganz/sdk | 00ace479a434b2d5c329cfe4f7178392fcfd1cdb | examples/python/megacli.py | python | MegaShell.do_ls | (self, arg) | Usage: ls [path] | Usage: ls [path] | [
"Usage",
":",
"ls",
"[",
"path",
"]"
] | def do_ls(self, arg):
"""Usage: ls [path]"""
args = arg.split()
if len(args) > 1:
print(self.do_ls.__doc__)
return
if self.cwd == None:
print('INFO: Not logged in')
return
path = None
if len(args) == 0:
path = ... | [
"def",
"do_ls",
"(",
"self",
",",
"arg",
")",
":",
"args",
"=",
"arg",
".",
"split",
"(",
")",
"if",
"len",
"(",
"args",
")",
">",
"1",
":",
"print",
"(",
"self",
".",
"do_ls",
".",
"__doc__",
")",
"return",
"if",
"self",
".",
"cwd",
"==",
"N... | https://github.com/meganz/sdk/blob/00ace479a434b2d5c329cfe4f7178392fcfd1cdb/examples/python/megacli.py#L165-L194 | ||
catboost/catboost | 167f64f237114a4d10b2b4ee42adb4569137debe | contrib/python/pandas/py3/pandas/core/reshape/tile.py | python | _convert_bin_to_datelike_type | (bins, dtype) | return bins | Convert bins to a DatetimeIndex or TimedeltaIndex if the original dtype is
datelike
Parameters
----------
bins : list-like of bins
dtype : dtype of data
Returns
-------
bins : Array-like of bins, DatetimeIndex or TimedeltaIndex if dtype is
datelike | Convert bins to a DatetimeIndex or TimedeltaIndex if the original dtype is
datelike | [
"Convert",
"bins",
"to",
"a",
"DatetimeIndex",
"or",
"TimedeltaIndex",
"if",
"the",
"original",
"dtype",
"is",
"datelike"
] | def _convert_bin_to_datelike_type(bins, dtype):
"""
Convert bins to a DatetimeIndex or TimedeltaIndex if the original dtype is
datelike
Parameters
----------
bins : list-like of bins
dtype : dtype of data
Returns
-------
bins : Array-like of bins, DatetimeIndex or TimedeltaInde... | [
"def",
"_convert_bin_to_datelike_type",
"(",
"bins",
",",
"dtype",
")",
":",
"if",
"is_datetime64tz_dtype",
"(",
"dtype",
")",
":",
"bins",
"=",
"to_datetime",
"(",
"bins",
".",
"astype",
"(",
"np",
".",
"int64",
")",
",",
"utc",
"=",
"True",
")",
".",
... | https://github.com/catboost/catboost/blob/167f64f237114a4d10b2b4ee42adb4569137debe/contrib/python/pandas/py3/pandas/core/reshape/tile.py#L530-L549 | |
aws/lumberyard | f85344403c1c2e77ec8c75deb2c116e97b713217 | dev/Tools/Python/3.7.10/windows/Lib/site-packages/pip/_vendor/pkg_resources/__init__.py | python | Environment.scan | (self, search_path=None) | Scan `search_path` for distributions usable in this environment
Any distributions found are added to the environment.
`search_path` should be a sequence of ``sys.path`` items. If not
supplied, ``sys.path`` is used. Only distributions conforming to
the platform/python version defined a... | Scan `search_path` for distributions usable in this environment | [
"Scan",
"search_path",
"for",
"distributions",
"usable",
"in",
"this",
"environment"
] | def scan(self, search_path=None):
"""Scan `search_path` for distributions usable in this environment
Any distributions found are added to the environment.
`search_path` should be a sequence of ``sys.path`` items. If not
supplied, ``sys.path`` is used. Only distributions conforming to
... | [
"def",
"scan",
"(",
"self",
",",
"search_path",
"=",
"None",
")",
":",
"if",
"search_path",
"is",
"None",
":",
"search_path",
"=",
"sys",
".",
"path",
"for",
"item",
"in",
"search_path",
":",
"for",
"dist",
"in",
"find_distributions",
"(",
"item",
")",
... | https://github.com/aws/lumberyard/blob/f85344403c1c2e77ec8c75deb2c116e97b713217/dev/Tools/Python/3.7.10/windows/Lib/site-packages/pip/_vendor/pkg_resources/__init__.py#L1004-L1017 | ||
apiaryio/drafter | 4634ebd07f6c6f257cc656598ccd535492fdfb55 | tools/gyp/pylib/gyp/xcodeproj_file.py | python | XCObject._XCKVPrint | (self, file, tabs, key, value) | Prints a key and value, members of an XCObject's _properties dictionary,
to file.
tabs is an int identifying the indentation level. If the class'
_should_print_single_line variable is True, tabs is ignored and the
key-value pair will be followed by a space insead of a newline. | Prints a key and value, members of an XCObject's _properties dictionary,
to file. | [
"Prints",
"a",
"key",
"and",
"value",
"members",
"of",
"an",
"XCObject",
"s",
"_properties",
"dictionary",
"to",
"file",
"."
] | def _XCKVPrint(self, file, tabs, key, value):
"""Prints a key and value, members of an XCObject's _properties dictionary,
to file.
tabs is an int identifying the indentation level. If the class'
_should_print_single_line variable is True, tabs is ignored and the
key-value pair will be followed by ... | [
"def",
"_XCKVPrint",
"(",
"self",
",",
"file",
",",
"tabs",
",",
"key",
",",
"value",
")",
":",
"if",
"self",
".",
"_should_print_single_line",
":",
"printable",
"=",
"''",
"after_kv",
"=",
"' '",
"else",
":",
"printable",
"=",
"'\\t'",
"*",
"tabs",
"a... | https://github.com/apiaryio/drafter/blob/4634ebd07f6c6f257cc656598ccd535492fdfb55/tools/gyp/pylib/gyp/xcodeproj_file.py#L639-L699 | ||
google/shaka-packager | e1b0c7c45431327fd3ce193514a5407d07b39b22 | packager/third_party/protobuf/python/google/protobuf/internal/well_known_types.py | python | _FieldMaskTree.IntersectPath | (self, path, intersection) | Calculates the intersection part of a field path with this tree.
Args:
path: The field path to calculates.
intersection: The out tree to record the intersection part. | Calculates the intersection part of a field path with this tree. | [
"Calculates",
"the",
"intersection",
"part",
"of",
"a",
"field",
"path",
"with",
"this",
"tree",
"."
] | def IntersectPath(self, path, intersection):
"""Calculates the intersection part of a field path with this tree.
Args:
path: The field path to calculates.
intersection: The out tree to record the intersection part.
"""
node = self._root
for name in path.split('.'):
if name not in ... | [
"def",
"IntersectPath",
"(",
"self",
",",
"path",
",",
"intersection",
")",
":",
"node",
"=",
"self",
".",
"_root",
"for",
"name",
"in",
"path",
".",
"split",
"(",
"'.'",
")",
":",
"if",
"name",
"not",
"in",
"node",
":",
"return",
"elif",
"not",
"n... | https://github.com/google/shaka-packager/blob/e1b0c7c45431327fd3ce193514a5407d07b39b22/packager/third_party/protobuf/python/google/protobuf/internal/well_known_types.py#L590-L605 | ||
lmb-freiburg/flownet2 | b92e198b56b0e52e1ba0a5a98dc0e39fa5ae70cc | scripts/cpp_lint.py | python | _Filters | () | return _cpplint_state.filters | Returns the module's list of output filters, as a list. | Returns the module's list of output filters, as a list. | [
"Returns",
"the",
"module",
"s",
"list",
"of",
"output",
"filters",
"as",
"a",
"list",
"."
] | def _Filters():
"""Returns the module's list of output filters, as a list."""
return _cpplint_state.filters | [
"def",
"_Filters",
"(",
")",
":",
"return",
"_cpplint_state",
".",
"filters"
] | https://github.com/lmb-freiburg/flownet2/blob/b92e198b56b0e52e1ba0a5a98dc0e39fa5ae70cc/scripts/cpp_lint.py#L792-L794 | |
benoitsteiner/tensorflow-opencl | cb7cb40a57fde5cfd4731bc551e82a1e2fef43a5 | tensorflow/python/debug/cli/command_parser.py | python | validate_slicing_string | (slicing_string) | return bool(re.search(r"^\[(\d|,|\s|:)+\]$", slicing_string)) | Validate a slicing string.
Check if the input string contains only brackets, digits, commas and
colons that are valid characters in numpy-style array slicing.
Args:
slicing_string: (str) Input slicing string to be validated.
Returns:
(bool) True if and only if the slicing string is valid. | Validate a slicing string. | [
"Validate",
"a",
"slicing",
"string",
"."
] | def validate_slicing_string(slicing_string):
"""Validate a slicing string.
Check if the input string contains only brackets, digits, commas and
colons that are valid characters in numpy-style array slicing.
Args:
slicing_string: (str) Input slicing string to be validated.
Returns:
(bool) True if an... | [
"def",
"validate_slicing_string",
"(",
"slicing_string",
")",
":",
"return",
"bool",
"(",
"re",
".",
"search",
"(",
"r\"^\\[(\\d|,|\\s|:)+\\]$\"",
",",
"slicing_string",
")",
")"
] | https://github.com/benoitsteiner/tensorflow-opencl/blob/cb7cb40a57fde5cfd4731bc551e82a1e2fef43a5/tensorflow/python/debug/cli/command_parser.py#L174-L187 | |
aws/lumberyard | f85344403c1c2e77ec8c75deb2c116e97b713217 | dev/Gems/CloudGemDefectReporter/v1/AWS/common-code/Lib/PIL/Image.py | python | fromqpixmap | (im) | return ImageQt.fromqpixmap(im) | Creates an image instance from a QPixmap image | Creates an image instance from a QPixmap image | [
"Creates",
"an",
"image",
"instance",
"from",
"a",
"QPixmap",
"image"
] | def fromqpixmap(im):
"""Creates an image instance from a QPixmap image"""
from . import ImageQt
if not ImageQt.qt_is_installed:
raise ImportError("Qt bindings are not installed")
return ImageQt.fromqpixmap(im) | [
"def",
"fromqpixmap",
"(",
"im",
")",
":",
"from",
".",
"import",
"ImageQt",
"if",
"not",
"ImageQt",
".",
"qt_is_installed",
":",
"raise",
"ImportError",
"(",
"\"Qt bindings are not installed\"",
")",
"return",
"ImageQt",
".",
"fromqpixmap",
"(",
"im",
")"
] | https://github.com/aws/lumberyard/blob/f85344403c1c2e77ec8c75deb2c116e97b713217/dev/Gems/CloudGemDefectReporter/v1/AWS/common-code/Lib/PIL/Image.py#L2747-L2753 | |
Rid7/Table-OCR | 26814d4d4d3a2cd9f6b0155d66dd475927a23d11 | data.py | python | data_preprocess.trainGenerator | (self, batch_size, image_save_prefix="image", label_save_prefix="label",
save_to_dir=None, seed=7) | can generate image and label at the same time
use the same seed for image_datagen and label_datagen to ensure the transformation for image and label is the same
if you want to visualize the results of generator, set save_to_dir = "your path" | can generate image and label at the same time
use the same seed for image_datagen and label_datagen to ensure the transformation for image and label is the same
if you want to visualize the results of generator, set save_to_dir = "your path" | [
"can",
"generate",
"image",
"and",
"label",
"at",
"the",
"same",
"time",
"use",
"the",
"same",
"seed",
"for",
"image_datagen",
"and",
"label_datagen",
"to",
"ensure",
"the",
"transformation",
"for",
"image",
"and",
"label",
"is",
"the",
"same",
"if",
"you",
... | def trainGenerator(self, batch_size, image_save_prefix="image", label_save_prefix="label",
save_to_dir=None, seed=7):
'''
can generate image and label at the same time
use the same seed for image_datagen and label_datagen to ensure the transformation for image and label is... | [
"def",
"trainGenerator",
"(",
"self",
",",
"batch_size",
",",
"image_save_prefix",
"=",
"\"image\"",
",",
"label_save_prefix",
"=",
"\"label\"",
",",
"save_to_dir",
"=",
"None",
",",
"seed",
"=",
"7",
")",
":",
"image_datagen",
"=",
"ImageDataGenerator",
"(",
... | https://github.com/Rid7/Table-OCR/blob/26814d4d4d3a2cd9f6b0155d66dd475927a23d11/data.py#L70-L109 | ||
apache/incubator-mxnet | f03fb23f1d103fec9541b5ae59ee06b1734a51d9 | python/mxnet/symbol/numpy/_symbol.py | python | bitwise_and | (x1, x2, out=None, **kwargs) | return _ufunc_helper(x1, x2, _npi.bitwise_and, _np.bitwise_and, _npi.bitwise_and_scalar, None, out) | r"""
Compute the bit-wise XOR of two arrays element-wise.
Parameters
----------
x1, x2 : _Symbol or scalar
Only integer and boolean types are handled. If x1.shape != x2.shape,
they must be broadcastable to a common shape (which becomes the shape of the output).
out : _Symbol or None... | r"""
Compute the bit-wise XOR of two arrays element-wise. | [
"r",
"Compute",
"the",
"bit",
"-",
"wise",
"XOR",
"of",
"two",
"arrays",
"element",
"-",
"wise",
"."
] | def bitwise_and(x1, x2, out=None, **kwargs):
r"""
Compute the bit-wise XOR of two arrays element-wise.
Parameters
----------
x1, x2 : _Symbol or scalar
Only integer and boolean types are handled. If x1.shape != x2.shape,
they must be broadcastable to a common shape (which becomes th... | [
"def",
"bitwise_and",
"(",
"x1",
",",
"x2",
",",
"out",
"=",
"None",
",",
"*",
"*",
"kwargs",
")",
":",
"return",
"_ufunc_helper",
"(",
"x1",
",",
"x2",
",",
"_npi",
".",
"bitwise_and",
",",
"_np",
".",
"bitwise_and",
",",
"_npi",
".",
"bitwise_and_s... | https://github.com/apache/incubator-mxnet/blob/f03fb23f1d103fec9541b5ae59ee06b1734a51d9/python/mxnet/symbol/numpy/_symbol.py#L5937-L5956 | |
GXYM/DRRG | 9e074fa9052de8d131f55ca1f6ae6673c1bfeca4 | dataset/TD500/Evaluation_Protocol/script075.py | python | evaluation_imports | () | return {
'Polygon':'plg',
'numpy':'np'
} | evaluation_imports: Dictionary ( key = module name , value = alias ) with python modules used in the evaluation. | evaluation_imports: Dictionary ( key = module name , value = alias ) with python modules used in the evaluation. | [
"evaluation_imports",
":",
"Dictionary",
"(",
"key",
"=",
"module",
"name",
"value",
"=",
"alias",
")",
"with",
"python",
"modules",
"used",
"in",
"the",
"evaluation",
"."
] | def evaluation_imports():
"""
evaluation_imports: Dictionary ( key = module name , value = alias ) with python modules used in the evaluation.
"""
return {
'Polygon':'plg',
'numpy':'np'
} | [
"def",
"evaluation_imports",
"(",
")",
":",
"return",
"{",
"'Polygon'",
":",
"'plg'",
",",
"'numpy'",
":",
"'np'",
"}"
] | https://github.com/GXYM/DRRG/blob/9e074fa9052de8d131f55ca1f6ae6673c1bfeca4/dataset/TD500/Evaluation_Protocol/script075.py#L7-L14 | |
microsoft/ivy | 9f3c7ecc0b2383129fdd0953e10890d98d09a82d | ivy/ivy_solver.py | python | clauses_imply_formula | (clauses1, fmla2) | return s.check() == z3.unsat | True if clauses1 imply clauses2. | True if clauses1 imply clauses2. | [
"True",
"if",
"clauses1",
"imply",
"clauses2",
"."
] | def clauses_imply_formula(clauses1, fmla2):
"""True if clauses1 imply clauses2.
"""
s = z3.Solver()
s.add(clauses_to_z3(clauses1))
s.add(formula_to_z3(ivy_logic.Not(fmla2)))
# print s.to_smt2()
return s.check() == z3.unsat | [
"def",
"clauses_imply_formula",
"(",
"clauses1",
",",
"fmla2",
")",
":",
"s",
"=",
"z3",
".",
"Solver",
"(",
")",
"s",
".",
"add",
"(",
"clauses_to_z3",
"(",
"clauses1",
")",
")",
"s",
".",
"add",
"(",
"formula_to_z3",
"(",
"ivy_logic",
".",
"Not",
"... | https://github.com/microsoft/ivy/blob/9f3c7ecc0b2383129fdd0953e10890d98d09a82d/ivy/ivy_solver.py#L1418-L1425 | |
SequoiaDB/SequoiaDB | 2894ed7e5bd6fe57330afc900cf76d0ff0df9f64 | driver/python/pysequoiadb/collection.py | python | collection.create_lob | (self, oid=None) | return obj | create lob.
Parameters:
Name Type Info:
oid bson.ObjectId Specified the oid of lob to be created,
if None, the oid is generated automatically
Return values:
a lob object
Exceptions:
pysequoi... | create lob. | [
"create",
"lob",
"."
] | def create_lob(self, oid=None):
"""create lob.
Parameters:
Name Type Info:
oid bson.ObjectId Specified the oid of lob to be created,
if None, the oid is generated automatically
Return values:
a lob obj... | [
"def",
"create_lob",
"(",
"self",
",",
"oid",
"=",
"None",
")",
":",
"if",
"oid",
"is",
"None",
":",
"str_id",
"=",
"None",
"elif",
"isinstance",
"(",
"oid",
",",
"bson",
".",
"ObjectId",
")",
":",
"str_id",
"=",
"str",
"(",
"oid",
")",
"else",
"... | https://github.com/SequoiaDB/SequoiaDB/blob/2894ed7e5bd6fe57330afc900cf76d0ff0df9f64/driver/python/pysequoiadb/collection.py#L1042-L1069 | |
catboost/catboost | 167f64f237114a4d10b2b4ee42adb4569137debe | contrib/python/scipy/py3/scipy/linalg/matfuncs.py | python | tanhm | (A) | return _maybe_real(A, solve(coshm(A), sinhm(A))) | Compute the hyperbolic matrix tangent.
This routine uses expm to compute the matrix exponentials.
Parameters
----------
A : (N, N) array_like
Input array
Returns
-------
tanhm : (N, N) ndarray
Hyperbolic matrix tangent of `A`
Examples
--------
>>> from scipy.l... | Compute the hyperbolic matrix tangent. | [
"Compute",
"the",
"hyperbolic",
"matrix",
"tangent",
"."
] | def tanhm(A):
"""
Compute the hyperbolic matrix tangent.
This routine uses expm to compute the matrix exponentials.
Parameters
----------
A : (N, N) array_like
Input array
Returns
-------
tanhm : (N, N) ndarray
Hyperbolic matrix tangent of `A`
Examples
---... | [
"def",
"tanhm",
"(",
"A",
")",
":",
"A",
"=",
"_asarray_square",
"(",
"A",
")",
"return",
"_maybe_real",
"(",
"A",
",",
"solve",
"(",
"coshm",
"(",
"A",
")",
",",
"sinhm",
"(",
"A",
")",
")",
")"
] | https://github.com/catboost/catboost/blob/167f64f237114a4d10b2b4ee42adb4569137debe/contrib/python/scipy/py3/scipy/linalg/matfuncs.py#L451-L486 | |
benoitsteiner/tensorflow-opencl | cb7cb40a57fde5cfd4731bc551e82a1e2fef43a5 | tensorflow/python/keras/_impl/keras/utils/generic_utils.py | python | custom_object_scope | (*args) | return CustomObjectScope(*args) | Provides a scope that changes to `_GLOBAL_CUSTOM_OBJECTS` cannot escape.
Convenience wrapper for `CustomObjectScope`.
Code within a `with` statement will be able to access custom objects
by name. Changes to global custom objects persist
within the enclosing `with` statement. At end of the `with` statement,
g... | Provides a scope that changes to `_GLOBAL_CUSTOM_OBJECTS` cannot escape. | [
"Provides",
"a",
"scope",
"that",
"changes",
"to",
"_GLOBAL_CUSTOM_OBJECTS",
"cannot",
"escape",
"."
] | def custom_object_scope(*args):
"""Provides a scope that changes to `_GLOBAL_CUSTOM_OBJECTS` cannot escape.
Convenience wrapper for `CustomObjectScope`.
Code within a `with` statement will be able to access custom objects
by name. Changes to global custom objects persist
within the enclosing `with` statement... | [
"def",
"custom_object_scope",
"(",
"*",
"args",
")",
":",
"return",
"CustomObjectScope",
"(",
"*",
"args",
")"
] | https://github.com/benoitsteiner/tensorflow-opencl/blob/cb7cb40a57fde5cfd4731bc551e82a1e2fef43a5/tensorflow/python/keras/_impl/keras/utils/generic_utils.py#L70-L97 | |
wxWidgets/wxPython-Classic | 19571e1ae65f1ac445f5491474121998c97a1bf0 | src/osx_cocoa/_core.py | python | HeaderColumn.GetTitle | (*args, **kwargs) | return _core_.HeaderColumn_GetTitle(*args, **kwargs) | GetTitle(self) -> String | GetTitle(self) -> String | [
"GetTitle",
"(",
"self",
")",
"-",
">",
"String"
] | def GetTitle(*args, **kwargs):
"""GetTitle(self) -> String"""
return _core_.HeaderColumn_GetTitle(*args, **kwargs) | [
"def",
"GetTitle",
"(",
"*",
"args",
",",
"*",
"*",
"kwargs",
")",
":",
"return",
"_core_",
".",
"HeaderColumn_GetTitle",
"(",
"*",
"args",
",",
"*",
"*",
"kwargs",
")"
] | https://github.com/wxWidgets/wxPython-Classic/blob/19571e1ae65f1ac445f5491474121998c97a1bf0/src/osx_cocoa/_core.py#L16384-L16386 | |
krishauser/Klampt | 972cc83ea5befac3f653c1ba20f80155768ad519 | Python/python2_version/klampt/robotsim.py | python | Simulator.setState | (self, str) | return _robotsim.Simulator_setState(self, str) | setState(Simulator self, std::string const & str)
Sets the current simulation state from a Base64 string returned by a prior
getState call. | setState(Simulator self, std::string const & str) | [
"setState",
"(",
"Simulator",
"self",
"std",
"::",
"string",
"const",
"&",
"str",
")"
] | def setState(self, str):
"""
setState(Simulator self, std::string const & str)
Sets the current simulation state from a Base64 string returned by a prior
getState call.
"""
return _robotsim.Simulator_setState(self, str) | [
"def",
"setState",
"(",
"self",
",",
"str",
")",
":",
"return",
"_robotsim",
".",
"Simulator_setState",
"(",
"self",
",",
"str",
")"
] | https://github.com/krishauser/Klampt/blob/972cc83ea5befac3f653c1ba20f80155768ad519/Python/python2_version/klampt/robotsim.py#L8238-L8248 | |
catboost/catboost | 167f64f237114a4d10b2b4ee42adb4569137debe | contrib/python/tornado/tornado-6/tornado/http1connection.py | python | HTTP1ServerConnection.__init__ | (
self,
stream: iostream.IOStream,
params: Optional[HTTP1ConnectionParameters] = None,
context: Optional[object] = None,
) | :arg stream: an `.IOStream`
:arg params: a `.HTTP1ConnectionParameters` or None
:arg context: an opaque application-defined object that is accessible
as ``connection.context`` | :arg stream: an `.IOStream`
:arg params: a `.HTTP1ConnectionParameters` or None
:arg context: an opaque application-defined object that is accessible
as ``connection.context`` | [
":",
"arg",
"stream",
":",
"an",
".",
"IOStream",
":",
"arg",
"params",
":",
"a",
".",
"HTTP1ConnectionParameters",
"or",
"None",
":",
"arg",
"context",
":",
"an",
"opaque",
"application",
"-",
"defined",
"object",
"that",
"is",
"accessible",
"as",
"connec... | def __init__(
self,
stream: iostream.IOStream,
params: Optional[HTTP1ConnectionParameters] = None,
context: Optional[object] = None,
) -> None:
"""
:arg stream: an `.IOStream`
:arg params: a `.HTTP1ConnectionParameters` or None
:arg context: an opaque ... | [
"def",
"__init__",
"(",
"self",
",",
"stream",
":",
"iostream",
".",
"IOStream",
",",
"params",
":",
"Optional",
"[",
"HTTP1ConnectionParameters",
"]",
"=",
"None",
",",
"context",
":",
"Optional",
"[",
"object",
"]",
"=",
"None",
",",
")",
"->",
"None",... | https://github.com/catboost/catboost/blob/167f64f237114a4d10b2b4ee42adb4569137debe/contrib/python/tornado/tornado-6/tornado/http1connection.py#L771-L788 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.