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 |
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
catboost/catboost | 167f64f237114a4d10b2b4ee42adb4569137debe | contrib/tools/python3/src/Lib/http/server.py | python | BaseHTTPRequestHandler.send_error | (self, code, message=None, explain=None) | Send and log an error reply.
Arguments are
* code: an HTTP error code
3 digits
* message: a simple optional 1 line reason phrase.
*( HTAB / SP / VCHAR / %x80-FF )
defaults to short entry matching the response code
* explain: a ... | Send and log an error reply. | [
"Send",
"and",
"log",
"an",
"error",
"reply",
"."
] | def send_error(self, code, message=None, explain=None):
"""Send and log an error reply.
Arguments are
* code: an HTTP error code
3 digits
* message: a simple optional 1 line reason phrase.
*( HTAB / SP / VCHAR / %x80-FF )
defau... | [
"def",
"send_error",
"(",
"self",
",",
"code",
",",
"message",
"=",
"None",
",",
"explain",
"=",
"None",
")",
":",
"try",
":",
"shortmsg",
",",
"longmsg",
"=",
"self",
".",
"responses",
"[",
"code",
"]",
"except",
"KeyError",
":",
"shortmsg",
",",
"l... | https://github.com/catboost/catboost/blob/167f64f237114a4d10b2b4ee42adb4569137debe/contrib/tools/python3/src/Lib/http/server.py#L431-L482 | ||
RobotLocomotion/drake | 0e18a34604c45ed65bc9018a54f7610f91cdad5b | doc/pydrake/build.py | python | _write_module | (name, f_name) | Writes an rst file for module `name` into `f_name`. | Writes an rst file for module `name` into `f_name`. | [
"Writes",
"an",
"rst",
"file",
"for",
"module",
"name",
"into",
"f_name",
"."
] | def _write_module(name, f_name):
"""Writes an rst file for module `name` into `f_name`.
"""
if verbose():
print("Write: {}".format(name))
subs = _get_submodules(name)
with open(f_name, 'w') as f:
f.write("\n")
rst_name = name.replace("_", "\\_")
f.write("{}\n".format(... | [
"def",
"_write_module",
"(",
"name",
",",
"f_name",
")",
":",
"if",
"verbose",
"(",
")",
":",
"print",
"(",
"\"Write: {}\"",
".",
"format",
"(",
"name",
")",
")",
"subs",
"=",
"_get_submodules",
"(",
"name",
")",
"with",
"open",
"(",
"f_name",
",",
"... | https://github.com/RobotLocomotion/drake/blob/0e18a34604c45ed65bc9018a54f7610f91cdad5b/doc/pydrake/build.py#L80-L105 | ||
htcondor/htcondor | 4829724575176d1d6c936e4693dfd78a728569b0 | bindings/python/htcondor/htchirp/htchirp.py | python | HTChirp.rmdir | (self, remote_path, recursive=False) | Delete a directory on the remote machine.
The directory must be empty unless recursive is set to True.
:param remote_path: Path to directory
:param recursive: If set to True, recursively delete remote_path | Delete a directory on the remote machine. | [
"Delete",
"a",
"directory",
"on",
"the",
"remote",
"machine",
"."
] | def rmdir(self, remote_path, recursive=False):
"""Delete a directory on the remote machine.
The directory must be empty unless recursive is set to True.
:param remote_path: Path to directory
:param recursive: If set to True, recursively delete remote_path
"""
if recur... | [
"def",
"rmdir",
"(",
"self",
",",
"remote_path",
",",
"recursive",
"=",
"False",
")",
":",
"if",
"recursive",
":",
"self",
".",
"rmall",
"(",
"remote_path",
")",
"else",
":",
"self",
".",
"_simple_command",
"(",
"\"rmdir {0}\\n\"",
".",
"format",
"(",
"q... | https://github.com/htcondor/htcondor/blob/4829724575176d1d6c936e4693dfd78a728569b0/bindings/python/htcondor/htchirp/htchirp.py#L842-L856 | ||
RamadhanAmizudin/malware | 2c6c53c8b0d556f5d8078d6ca0fc4448f4697cf1 | Fuzzbunch/fuzzbunch/command.py | python | FbCmd.cmdloop | (self) | Repeatedly issue a prompt, accept input, parse an initial prefix
off the received input, and dispatch to action methods, passing them
the remainder of the line as argument. | Repeatedly issue a prompt, accept input, parse an initial prefix
off the received input, and dispatch to action methods, passing them
the remainder of the line as argument. | [
"Repeatedly",
"issue",
"a",
"prompt",
"accept",
"input",
"parse",
"an",
"initial",
"prefix",
"off",
"the",
"received",
"input",
"and",
"dispatch",
"to",
"action",
"methods",
"passing",
"them",
"the",
"remainder",
"of",
"the",
"line",
"as",
"argument",
"."
] | def cmdloop(self):
"""Repeatedly issue a prompt, accept input, parse an initial prefix
off the received input, and dispatch to action methods, passing them
the remainder of the line as argument.
"""
self.preloop()
self.io.pre_input(self.complete)
try:
... | [
"def",
"cmdloop",
"(",
"self",
")",
":",
"self",
".",
"preloop",
"(",
")",
"self",
".",
"io",
".",
"pre_input",
"(",
"self",
".",
"complete",
")",
"try",
":",
"stop",
"=",
"None",
"while",
"not",
"stop",
":",
"if",
"self",
".",
"cmdqueue",
":",
"... | https://github.com/RamadhanAmizudin/malware/blob/2c6c53c8b0d556f5d8078d6ca0fc4448f4697cf1/Fuzzbunch/fuzzbunch/command.py#L162-L182 | ||
google/ion | ef47f3b824050499ce5c6f774b366f6c4dbce0af | ion/build.py | python | BuildState.GetAdditionalGypGeneratorFlags | (self) | return self.GetCommandLineOptions().G | Returns list of additional gyp variables.
These are directly passed on the command line as -G=foo=bar.
Returns:
A list of extra flags to pass through to the gyp as generator flags. | Returns list of additional gyp variables. | [
"Returns",
"list",
"of",
"additional",
"gyp",
"variables",
"."
] | def GetAdditionalGypGeneratorFlags(self):
"""Returns list of additional gyp variables.
These are directly passed on the command line as -G=foo=bar.
Returns:
A list of extra flags to pass through to the gyp as generator flags.
"""
return self.GetCommandLineOptions().G | [
"def",
"GetAdditionalGypGeneratorFlags",
"(",
"self",
")",
":",
"return",
"self",
".",
"GetCommandLineOptions",
"(",
")",
".",
"G"
] | https://github.com/google/ion/blob/ef47f3b824050499ce5c6f774b366f6c4dbce0af/ion/build.py#L1605-L1613 | |
oracle/graaljs | 36a56e8e993d45fc40939a3a4d9c0c24990720f1 | graal-nodejs/deps/npm/node_modules/node-gyp/gyp/pylib/gyp/win_tool.py | python | WinTool.ExecClCompile | (self, project_dir, selected_files) | return subprocess.call(cmd, shell=True, cwd=BASE_DIR) | Executed by msvs-ninja projects when the 'ClCompile' target is used to
build selected C/C++ files. | Executed by msvs-ninja projects when the 'ClCompile' target is used to
build selected C/C++ files. | [
"Executed",
"by",
"msvs",
"-",
"ninja",
"projects",
"when",
"the",
"ClCompile",
"target",
"is",
"used",
"to",
"build",
"selected",
"C",
"/",
"C",
"++",
"files",
"."
] | def ExecClCompile(self, project_dir, selected_files):
"""Executed by msvs-ninja projects when the 'ClCompile' target is used to
build selected C/C++ files."""
project_dir = os.path.relpath(project_dir, BASE_DIR)
selected_files = selected_files.split(";")
ninja_targets = [
... | [
"def",
"ExecClCompile",
"(",
"self",
",",
"project_dir",
",",
"selected_files",
")",
":",
"project_dir",
"=",
"os",
".",
"path",
".",
"relpath",
"(",
"project_dir",
",",
"BASE_DIR",
")",
"selected_files",
"=",
"selected_files",
".",
"split",
"(",
"\";\"",
")... | https://github.com/oracle/graaljs/blob/36a56e8e993d45fc40939a3a4d9c0c24990720f1/graal-nodejs/deps/npm/node_modules/node-gyp/gyp/pylib/gyp/win_tool.py#L360-L370 | |
hanpfei/chromium-net | 392cc1fa3a8f92f42e4071ab6e674d8e0482f83f | third_party/catapult/third_party/gsutil/third_party/boto/boto/ec2/autoscale/__init__.py | python | AutoScaleConnection.get_all_scaling_process_types | (self) | return self.get_list('DescribeScalingProcessTypes', {},
[('member', ProcessType)]) | Returns scaling process types for use in the ResumeProcesses and
SuspendProcesses actions. | Returns scaling process types for use in the ResumeProcesses and
SuspendProcesses actions. | [
"Returns",
"scaling",
"process",
"types",
"for",
"use",
"in",
"the",
"ResumeProcesses",
"and",
"SuspendProcesses",
"actions",
"."
] | def get_all_scaling_process_types(self):
"""
Returns scaling process types for use in the ResumeProcesses and
SuspendProcesses actions.
"""
return self.get_list('DescribeScalingProcessTypes', {},
[('member', ProcessType)]) | [
"def",
"get_all_scaling_process_types",
"(",
"self",
")",
":",
"return",
"self",
".",
"get_list",
"(",
"'DescribeScalingProcessTypes'",
",",
"{",
"}",
",",
"[",
"(",
"'member'",
",",
"ProcessType",
")",
"]",
")"
] | https://github.com/hanpfei/chromium-net/blob/392cc1fa3a8f92f42e4071ab6e674d8e0482f83f/third_party/catapult/third_party/gsutil/third_party/boto/boto/ec2/autoscale/__init__.py#L576-L582 | |
hanpfei/chromium-net | 392cc1fa3a8f92f42e4071ab6e674d8e0482f83f | third_party/catapult/third_party/gsutil/gslib/commands/defacl.py | python | DefAclCommand._ChDefAcl | (self) | Parses options and changes default object ACLs on specified buckets. | Parses options and changes default object ACLs on specified buckets. | [
"Parses",
"options",
"and",
"changes",
"default",
"object",
"ACLs",
"on",
"specified",
"buckets",
"."
] | def _ChDefAcl(self):
"""Parses options and changes default object ACLs on specified buckets."""
self.parse_versions = True
self.changes = []
if self.sub_opts:
for o, a in self.sub_opts:
if o == '-g':
self.changes.append(
aclhelpers.AclChange(a, scope_type=aclhelper... | [
"def",
"_ChDefAcl",
"(",
"self",
")",
":",
"self",
".",
"parse_versions",
"=",
"True",
"self",
".",
"changes",
"=",
"[",
"]",
"if",
"self",
".",
"sub_opts",
":",
"for",
"o",
",",
"a",
"in",
"self",
".",
"sub_opts",
":",
"if",
"o",
"==",
"'-g'",
"... | https://github.com/hanpfei/chromium-net/blob/392cc1fa3a8f92f42e4071ab6e674d8e0482f83f/third_party/catapult/third_party/gsutil/gslib/commands/defacl.py#L215-L254 | ||
catboost/catboost | 167f64f237114a4d10b2b4ee42adb4569137debe | contrib/python/Jinja2/py3/jinja2/compiler.py | python | CodeGenerator.return_buffer_contents | (
self, frame: Frame, force_unescaped: bool = False
) | Return the buffer contents of the frame. | Return the buffer contents of the frame. | [
"Return",
"the",
"buffer",
"contents",
"of",
"the",
"frame",
"."
] | def return_buffer_contents(
self, frame: Frame, force_unescaped: bool = False
) -> None:
"""Return the buffer contents of the frame."""
if not force_unescaped:
if frame.eval_ctx.volatile:
self.writeline("if context.eval_ctx.autoescape:")
self.inden... | [
"def",
"return_buffer_contents",
"(",
"self",
",",
"frame",
":",
"Frame",
",",
"force_unescaped",
":",
"bool",
"=",
"False",
")",
"->",
"None",
":",
"if",
"not",
"force_unescaped",
":",
"if",
"frame",
".",
"eval_ctx",
".",
"volatile",
":",
"self",
".",
"... | https://github.com/catboost/catboost/blob/167f64f237114a4d10b2b4ee42adb4569137debe/contrib/python/Jinja2/py3/jinja2/compiler.py#L394-L412 | ||
wxWidgets/wxPython-Classic | 19571e1ae65f1ac445f5491474121998c97a1bf0 | src/msw/_gdi.py | python | AlphaPixelData_Accessor.MoveTo | (*args, **kwargs) | return _gdi_.AlphaPixelData_Accessor_MoveTo(*args, **kwargs) | MoveTo(self, AlphaPixelData data, int x, int y) | MoveTo(self, AlphaPixelData data, int x, int y) | [
"MoveTo",
"(",
"self",
"AlphaPixelData",
"data",
"int",
"x",
"int",
"y",
")"
] | def MoveTo(*args, **kwargs):
"""MoveTo(self, AlphaPixelData data, int x, int y)"""
return _gdi_.AlphaPixelData_Accessor_MoveTo(*args, **kwargs) | [
"def",
"MoveTo",
"(",
"*",
"args",
",",
"*",
"*",
"kwargs",
")",
":",
"return",
"_gdi_",
".",
"AlphaPixelData_Accessor_MoveTo",
"(",
"*",
"args",
",",
"*",
"*",
"kwargs",
")"
] | https://github.com/wxWidgets/wxPython-Classic/blob/19571e1ae65f1ac445f5491474121998c97a1bf0/src/msw/_gdi.py#L1254-L1256 | |
mindspore-ai/mindspore | fb8fd3338605bb34fa5cea054e535a8b1d753fab | mindspore/python/mindspore/_extends/remote/kernel_build_server.py | python | AkgBuilder.create | (self, process_num, waitime) | Create akg processor | Create akg processor | [
"Create",
"akg",
"processor"
] | def create(self, process_num, waitime):
""" Create akg processor"""
self.akg_processor = create_akg_parallel_process(process_num, waitime, self.platform) | [
"def",
"create",
"(",
"self",
",",
"process_num",
",",
"waitime",
")",
":",
"self",
".",
"akg_processor",
"=",
"create_akg_parallel_process",
"(",
"process_num",
",",
"waitime",
",",
"self",
".",
"platform",
")"
] | https://github.com/mindspore-ai/mindspore/blob/fb8fd3338605bb34fa5cea054e535a8b1d753fab/mindspore/python/mindspore/_extends/remote/kernel_build_server.py#L134-L136 | ||
0ad/0ad | f58db82e0e925016d83f4e3fa7ca599e3866e2af | source/tools/lobbybots/xpartamupp/echelon.py | python | EcheLOn._muc_online | (self, presence) | Add joining players to the list of players.
Arguments:
presence (sleekxmpp.stanza.presence.Presence): Received
presence stanza. | Add joining players to the list of players. | [
"Add",
"joining",
"players",
"to",
"the",
"list",
"of",
"players",
"."
] | def _muc_online(self, presence):
"""Add joining players to the list of players.
Arguments:
presence (sleekxmpp.stanza.presence.Presence): Received
presence stanza.
"""
nick = str(presence['muc']['nick'])
jid = sleekxmpp.jid.JID(presence['muc']['jid']... | [
"def",
"_muc_online",
"(",
"self",
",",
"presence",
")",
":",
"nick",
"=",
"str",
"(",
"presence",
"[",
"'muc'",
"]",
"[",
"'nick'",
"]",
")",
"jid",
"=",
"sleekxmpp",
".",
"jid",
".",
"JID",
"(",
"presence",
"[",
"'muc'",
"]",
"[",
"'jid'",
"]",
... | https://github.com/0ad/0ad/blob/f58db82e0e925016d83f4e3fa7ca599e3866e2af/source/tools/lobbybots/xpartamupp/echelon.py#L511-L532 | ||
aws/lumberyard | f85344403c1c2e77ec8c75deb2c116e97b713217 | dev/Gems/Blast/Editor/Scripts/external/pyassimp/helper.py | python | hasattr_silent | (object, name) | Calls hasttr() with the given parameters and preserves the legacy (pre-Python 3.2)
functionality of silently catching exceptions.
Returns the result of hasatter() or False if an exception was raised. | Calls hasttr() with the given parameters and preserves the legacy (pre-Python 3.2)
functionality of silently catching exceptions. | [
"Calls",
"hasttr",
"()",
"with",
"the",
"given",
"parameters",
"and",
"preserves",
"the",
"legacy",
"(",
"pre",
"-",
"Python",
"3",
".",
"2",
")",
"functionality",
"of",
"silently",
"catching",
"exceptions",
"."
] | def hasattr_silent(object, name):
"""
Calls hasttr() with the given parameters and preserves the legacy (pre-Python 3.2)
functionality of silently catching exceptions.
Returns the result of hasatter() or False if an exception was raised.
"""
try:
if not object:
... | [
"def",
"hasattr_silent",
"(",
"object",
",",
"name",
")",
":",
"try",
":",
"if",
"not",
"object",
":",
"return",
"False",
"return",
"hasattr",
"(",
"object",
",",
"name",
")",
"except",
"AttributeError",
":",
"return",
"False"
] | https://github.com/aws/lumberyard/blob/f85344403c1c2e77ec8c75deb2c116e97b713217/dev/Gems/Blast/Editor/Scripts/external/pyassimp/helper.py#L268-L281 | ||
mongodb/mongo | d8ff665343ad29cf286ee2cf4a1960d29371937b | buildscripts/libdeps/libdeps/analyzer.py | python | CommonDependents.run | (self) | return sorted(list(set.intersection(*neighbor_sets))) | For a given set of nodes, report what nodes depend on all nodes from that set. | For a given set of nodes, report what nodes depend on all nodes from that set. | [
"For",
"a",
"given",
"set",
"of",
"nodes",
"report",
"what",
"nodes",
"depend",
"on",
"all",
"nodes",
"from",
"that",
"set",
"."
] | def run(self):
"""For a given set of nodes, report what nodes depend on all nodes from that set."""
neighbor_sets = [set(self._dependents_graph[node]) for node in self._nodes]
return sorted(list(set.intersection(*neighbor_sets))) | [
"def",
"run",
"(",
"self",
")",
":",
"neighbor_sets",
"=",
"[",
"set",
"(",
"self",
".",
"_dependents_graph",
"[",
"node",
"]",
")",
"for",
"node",
"in",
"self",
".",
"_nodes",
"]",
"return",
"sorted",
"(",
"list",
"(",
"set",
".",
"intersection",
"(... | https://github.com/mongodb/mongo/blob/d8ff665343ad29cf286ee2cf4a1960d29371937b/buildscripts/libdeps/libdeps/analyzer.py#L392-L396 | |
okex/V3-Open-API-SDK | c5abb0db7e2287718e0055e17e57672ce0ec7fd9 | okex-python-sdk-api/venv/Lib/site-packages/pip-19.0.3-py3.8.egg/pip/_internal/utils/misc.py | python | is_svn_page | (html) | return (re.search(r'<title>[^<]*Revision \d+:', html) and
re.search(r'Powered by (?:<a[^>]*?>)?Subversion', html, re.I)) | Returns true if the page appears to be the index page of an svn repository | Returns true if the page appears to be the index page of an svn repository | [
"Returns",
"true",
"if",
"the",
"page",
"appears",
"to",
"be",
"the",
"index",
"page",
"of",
"an",
"svn",
"repository"
] | def is_svn_page(html):
# type: (Union[str, Text]) -> Optional[Match[Union[str, Text]]]
"""
Returns true if the page appears to be the index page of an svn repository
"""
return (re.search(r'<title>[^<]*Revision \d+:', html) and
re.search(r'Powered by (?:<a[^>]*?>)?Subversion', html, re.I... | [
"def",
"is_svn_page",
"(",
"html",
")",
":",
"# type: (Union[str, Text]) -> Optional[Match[Union[str, Text]]]",
"return",
"(",
"re",
".",
"search",
"(",
"r'<title>[^<]*Revision \\d+:'",
",",
"html",
")",
"and",
"re",
".",
"search",
"(",
"r'Powered by (?:<a[^>]*?>)?Subvers... | https://github.com/okex/V3-Open-API-SDK/blob/c5abb0db7e2287718e0055e17e57672ce0ec7fd9/okex-python-sdk-api/venv/Lib/site-packages/pip-19.0.3-py3.8.egg/pip/_internal/utils/misc.py#L219-L225 | |
aws/lumberyard | f85344403c1c2e77ec8c75deb2c116e97b713217 | dev/Tools/Python/3.7.10/windows/Lib/idlelib/configdialog.py | python | HighPage.on_new_color_set | (self) | Display sample of new color selection on the dialog. | Display sample of new color selection on the dialog. | [
"Display",
"sample",
"of",
"new",
"color",
"selection",
"on",
"the",
"dialog",
"."
] | def on_new_color_set(self):
"Display sample of new color selection on the dialog."
new_color = self.color.get()
self.style.configure('frame_color_set.TFrame', background=new_color)
plane = 'foreground' if self.fg_bg_toggle.get() else 'background'
sample_element = self.theme_eleme... | [
"def",
"on_new_color_set",
"(",
"self",
")",
":",
"new_color",
"=",
"self",
".",
"color",
".",
"get",
"(",
")",
"self",
".",
"style",
".",
"configure",
"(",
"'frame_color_set.TFrame'",
",",
"background",
"=",
"new_color",
")",
"plane",
"=",
"'foreground'",
... | https://github.com/aws/lumberyard/blob/f85344403c1c2e77ec8c75deb2c116e97b713217/dev/Tools/Python/3.7.10/windows/Lib/idlelib/configdialog.py#L1118-L1127 | ||
idaholab/moose | 9eeebc65e098b4c30f8205fb41591fd5b61eb6ff | python/peacock/ExodusViewer/plugins/CameraPlugin.py | python | CameraPlugin._callbackResetButton | (self) | Recomputes the original view. | Recomputes the original view. | [
"Recomputes",
"the",
"original",
"view",
"."
] | def _callbackResetButton(self):
"""
Recomputes the original view.
"""
if self._result:
renderer = self._result.getVTKRenderer()
renderer.ResetCamera()
camera = renderer.GetActiveCamera()
fp = camera.GetFocalPoint()
p = camera.Ge... | [
"def",
"_callbackResetButton",
"(",
"self",
")",
":",
"if",
"self",
".",
"_result",
":",
"renderer",
"=",
"self",
".",
"_result",
".",
"getVTKRenderer",
"(",
")",
"renderer",
".",
"ResetCamera",
"(",
")",
"camera",
"=",
"renderer",
".",
"GetActiveCamera",
... | https://github.com/idaholab/moose/blob/9eeebc65e098b4c30f8205fb41591fd5b61eb6ff/python/peacock/ExodusViewer/plugins/CameraPlugin.py#L71-L85 | ||
hakuna-m/wubiuefi | caec1af0a09c78fd5a345180ada1fe45e0c63493 | src/wubi/backends/common/tasklist.py | python | Task._get_weight | (self) | return float(self.size*self.weight) + sum(subtasks_weight) | get total weight for this task and all the subtasks | get total weight for this task and all the subtasks | [
"get",
"total",
"weight",
"for",
"this",
"task",
"and",
"all",
"the",
"subtasks"
] | def _get_weight(self):
'''
get total weight for this task and all the subtasks
'''
subtasks_weight = [s._get_weight() for s in self.subtasks]
return float(self.size*self.weight) + sum(subtasks_weight) | [
"def",
"_get_weight",
"(",
"self",
")",
":",
"subtasks_weight",
"=",
"[",
"s",
".",
"_get_weight",
"(",
")",
"for",
"s",
"in",
"self",
".",
"subtasks",
"]",
"return",
"float",
"(",
"self",
".",
"size",
"*",
"self",
".",
"weight",
")",
"+",
"sum",
"... | https://github.com/hakuna-m/wubiuefi/blob/caec1af0a09c78fd5a345180ada1fe45e0c63493/src/wubi/backends/common/tasklist.py#L348-L353 | |
catboost/catboost | 167f64f237114a4d10b2b4ee42adb4569137debe | contrib/tools/python/src/Lib/plat-mac/findertools.py | python | emptytrash | () | empty the trash | empty the trash | [
"empty",
"the",
"trash"
] | def emptytrash():
"""empty the trash"""
finder = _getfinder()
args = {}
attrs = {}
args['----'] = aetypes.ObjectSpecifier(want=aetypes.Type('prop'), form="prop", seld=aetypes.Type('trsh'), fr=None)
_reply, args, attrs = finder.send("fndr", "empt", args, attrs)
if 'errn' in args:
rais... | [
"def",
"emptytrash",
"(",
")",
":",
"finder",
"=",
"_getfinder",
"(",
")",
"args",
"=",
"{",
"}",
"attrs",
"=",
"{",
"}",
"args",
"[",
"'----'",
"]",
"=",
"aetypes",
".",
"ObjectSpecifier",
"(",
"want",
"=",
"aetypes",
".",
"Type",
"(",
"'prop'",
"... | https://github.com/catboost/catboost/blob/167f64f237114a4d10b2b4ee42adb4569137debe/contrib/tools/python/src/Lib/plat-mac/findertools.py#L689-L697 | ||
weolar/miniblink49 | 1c4678db0594a4abde23d3ebbcc7cd13c3170777 | third_party/WebKit/Tools/Scripts/webkitpy/thirdparty/pep8.py | python | filename_match | (filename, patterns, default=True) | return any(fnmatch(filename, pattern) for pattern in patterns) | Check if patterns contains a pattern that matches filename.
If patterns is unspecified, this always returns True. | Check if patterns contains a pattern that matches filename. | [
"Check",
"if",
"patterns",
"contains",
"a",
"pattern",
"that",
"matches",
"filename",
"."
] | def filename_match(filename, patterns, default=True):
"""Check if patterns contains a pattern that matches filename.
If patterns is unspecified, this always returns True.
"""
if not patterns:
return default
return any(fnmatch(filename, pattern) for pattern in patterns) | [
"def",
"filename_match",
"(",
"filename",
",",
"patterns",
",",
"default",
"=",
"True",
")",
":",
"if",
"not",
"patterns",
":",
"return",
"default",
"return",
"any",
"(",
"fnmatch",
"(",
"filename",
",",
"pattern",
")",
"for",
"pattern",
"in",
"patterns",
... | https://github.com/weolar/miniblink49/blob/1c4678db0594a4abde23d3ebbcc7cd13c3170777/third_party/WebKit/Tools/Scripts/webkitpy/thirdparty/pep8.py#L1151-L1158 | |
hughperkins/tf-coriander | 970d3df6c11400ad68405f22b0c42a52374e94ca | tensorflow/contrib/learn/python/learn/monitors.py | python | BaseMonitor.step_begin | (self, step) | return [] | Callback before training step begins.
You may use this callback to request evaluation of additional tensors
in the graph.
Args:
step: `int`, the current value of the global step.
Returns:
List of `Tensor` objects or string tensor names to be run.
Raises:
ValueError: if we've al... | Callback before training step begins. | [
"Callback",
"before",
"training",
"step",
"begins",
"."
] | def step_begin(self, step):
"""Callback before training step begins.
You may use this callback to request evaluation of additional tensors
in the graph.
Args:
step: `int`, the current value of the global step.
Returns:
List of `Tensor` objects or string tensor names to be run.
Ra... | [
"def",
"step_begin",
"(",
"self",
",",
"step",
")",
":",
"if",
"(",
"step",
"<",
"0",
")",
"or",
"(",
"(",
"self",
".",
"_max_steps",
"is",
"not",
"None",
")",
"and",
"(",
"step",
">",
"self",
".",
"_max_steps",
")",
")",
":",
"raise",
"ValueErro... | https://github.com/hughperkins/tf-coriander/blob/970d3df6c11400ad68405f22b0c42a52374e94ca/tensorflow/contrib/learn/python/learn/monitors.py#L218-L238 | |
eclipse/sumo | 7132a9b8b6eea734bdec38479026b4d8c4336d03 | tools/traci/_trafficlight.py | python | TrafficLightDomain.setProgram | (self, tlsID, programID) | setProgram(string, string) -> None
Switches to the program with the given programID. The program must have
been loaded earlier. The special value 'off' can always be used to
switch off the traffic light. | setProgram(string, string) -> None | [
"setProgram",
"(",
"string",
"string",
")",
"-",
">",
"None"
] | def setProgram(self, tlsID, programID):
"""setProgram(string, string) -> None
Switches to the program with the given programID. The program must have
been loaded earlier. The special value 'off' can always be used to
switch off the traffic light.
"""
self._setCmd(tc.TL_P... | [
"def",
"setProgram",
"(",
"self",
",",
"tlsID",
",",
"programID",
")",
":",
"self",
".",
"_setCmd",
"(",
"tc",
".",
"TL_PROGRAM",
",",
"tlsID",
",",
"\"s\"",
",",
"programID",
")"
] | https://github.com/eclipse/sumo/blob/7132a9b8b6eea734bdec38479026b4d8c4336d03/tools/traci/_trafficlight.py#L321-L328 | ||
ricardoquesada/Spidermonkey | 4a75ea2543408bd1b2c515aa95901523eeef7858 | toolkit/crashreporter/tools/symbolstore.py | python | Dumper_Mac.ShouldSkipDir | (self, dir) | return False | We create .dSYM bundles on the fly, but if someone runs
buildsymbols twice, we should skip any bundles we created
previously, otherwise we'll recurse into them and try to
dump the inner bits again. | We create .dSYM bundles on the fly, but if someone runs
buildsymbols twice, we should skip any bundles we created
previously, otherwise we'll recurse into them and try to
dump the inner bits again. | [
"We",
"create",
".",
"dSYM",
"bundles",
"on",
"the",
"fly",
"but",
"if",
"someone",
"runs",
"buildsymbols",
"twice",
"we",
"should",
"skip",
"any",
"bundles",
"we",
"created",
"previously",
"otherwise",
"we",
"ll",
"recurse",
"into",
"them",
"and",
"try",
... | def ShouldSkipDir(self, dir):
"""We create .dSYM bundles on the fly, but if someone runs
buildsymbols twice, we should skip any bundles we created
previously, otherwise we'll recurse into them and try to
dump the inner bits again."""
if dir.endswith(".dSYM"):
return ... | [
"def",
"ShouldSkipDir",
"(",
"self",
",",
"dir",
")",
":",
"if",
"dir",
".",
"endswith",
"(",
"\".dSYM\"",
")",
":",
"return",
"True",
"return",
"False"
] | https://github.com/ricardoquesada/Spidermonkey/blob/4a75ea2543408bd1b2c515aa95901523eeef7858/toolkit/crashreporter/tools/symbolstore.py#L832-L839 | |
wxWidgets/wxPython-Classic | 19571e1ae65f1ac445f5491474121998c97a1bf0 | wx/lib/masked/textctrl.py | python | BaseMaskedTextCtrl._CalcSize | (self, size=None) | return self._calcSize(size) | Calculate automatic size if allowed; use base mixin function. | Calculate automatic size if allowed; use base mixin function. | [
"Calculate",
"automatic",
"size",
"if",
"allowed",
";",
"use",
"base",
"mixin",
"function",
"."
] | def _CalcSize(self, size=None):
"""
Calculate automatic size if allowed; use base mixin function.
"""
return self._calcSize(size) | [
"def",
"_CalcSize",
"(",
"self",
",",
"size",
"=",
"None",
")",
":",
"return",
"self",
".",
"_calcSize",
"(",
"size",
")"
] | https://github.com/wxWidgets/wxPython-Classic/blob/19571e1ae65f1ac445f5491474121998c97a1bf0/wx/lib/masked/textctrl.py#L366-L370 | |
microsoft/TSS.MSR | 0f2516fca2cd9929c31d5450e39301c9bde43688 | TSS.Py/src/TpmTypes.py | python | TPM2_RSA_Decrypt_REQUEST.__init__ | (self, keyHandle = TPM_HANDLE(), cipherText = None, inScheme = None, label = None) | This command performs RSA decryption using the indicated padding
scheme according to IETF RFC 8017 ((PKCS#1).
Attributes:
keyHandle (TPM_HANDLE): RSA key to use for decryption
Auth Index: 1
Auth Role: USER
cipherText (bytes): Cipher text to be dec... | This command performs RSA decryption using the indicated padding
scheme according to IETF RFC 8017 ((PKCS#1). | [
"This",
"command",
"performs",
"RSA",
"decryption",
"using",
"the",
"indicated",
"padding",
"scheme",
"according",
"to",
"IETF",
"RFC",
"8017",
"((",
"PKCS#1",
")",
"."
] | def __init__(self, keyHandle = TPM_HANDLE(), cipherText = None, inScheme = None, label = None):
""" This command performs RSA decryption using the indicated padding
scheme according to IETF RFC 8017 ((PKCS#1).
Attributes:
keyHandle (TPM_HANDLE): RSA key to use for decryption
... | [
"def",
"__init__",
"(",
"self",
",",
"keyHandle",
"=",
"TPM_HANDLE",
"(",
")",
",",
"cipherText",
"=",
"None",
",",
"inScheme",
"=",
"None",
",",
"label",
"=",
"None",
")",
":",
"self",
".",
"keyHandle",
"=",
"keyHandle",
"self",
".",
"cipherText",
"="... | https://github.com/microsoft/TSS.MSR/blob/0f2516fca2cd9929c31d5450e39301c9bde43688/TSS.Py/src/TpmTypes.py#L10714-L10737 | ||
bigartm/bigartm | 47e37f982de87aa67bfd475ff1f39da696b181b3 | 3rdparty/protobuf-3.0.0/python/mox.py | python | MoxMetaTestBase.CleanUpTest | (cls, func) | return new_method | Adds Mox cleanup code to any MoxTestBase method.
Always unsets stubs after a test. Will verify all mocks for tests that
otherwise pass.
Args:
cls: MoxTestBase or subclass; the class whose test method we are altering.
func: method; the method of the MoxTestBase test class we wish to alter.
... | Adds Mox cleanup code to any MoxTestBase method. | [
"Adds",
"Mox",
"cleanup",
"code",
"to",
"any",
"MoxTestBase",
"method",
"."
] | def CleanUpTest(cls, func):
"""Adds Mox cleanup code to any MoxTestBase method.
Always unsets stubs after a test. Will verify all mocks for tests that
otherwise pass.
Args:
cls: MoxTestBase or subclass; the class whose test method we are altering.
func: method; the method of the MoxTestBas... | [
"def",
"CleanUpTest",
"(",
"cls",
",",
"func",
")",
":",
"def",
"new_method",
"(",
"self",
",",
"*",
"args",
",",
"*",
"*",
"kwargs",
")",
":",
"mox_obj",
"=",
"getattr",
"(",
"self",
",",
"'mox'",
",",
"None",
")",
"cleanup_mox",
"=",
"False",
"if... | https://github.com/bigartm/bigartm/blob/47e37f982de87aa67bfd475ff1f39da696b181b3/3rdparty/protobuf-3.0.0/python/mox.py#L1358-L1386 | |
llvm/llvm-project | ffa6262cb4e2a335d26416fad39a581b4f98c5f4 | clang/bindings/python/clang/cindex.py | python | Cursor.walk_preorder | (self) | Depth-first preorder walk over the cursor and its descendants.
Yields cursors. | Depth-first preorder walk over the cursor and its descendants. | [
"Depth",
"-",
"first",
"preorder",
"walk",
"over",
"the",
"cursor",
"and",
"its",
"descendants",
"."
] | def walk_preorder(self):
"""Depth-first preorder walk over the cursor and its descendants.
Yields cursors.
"""
yield self
for child in self.get_children():
for descendant in child.walk_preorder():
yield descendant | [
"def",
"walk_preorder",
"(",
"self",
")",
":",
"yield",
"self",
"for",
"child",
"in",
"self",
".",
"get_children",
"(",
")",
":",
"for",
"descendant",
"in",
"child",
".",
"walk_preorder",
"(",
")",
":",
"yield",
"descendant"
] | https://github.com/llvm/llvm-project/blob/ffa6262cb4e2a335d26416fad39a581b4f98c5f4/clang/bindings/python/clang/cindex.py#L1845-L1853 | ||
rapidsai/cudf | d5b2448fc69f17509304d594f029d0df56984962 | python/cudf/cudf/core/column/column.py | python | nullmask | (self) | return self.mask_array_view | The gpu buffer for the null-mask | The gpu buffer for the null-mask | [
"The",
"gpu",
"buffer",
"for",
"the",
"null",
"-",
"mask"
] | def nullmask(self) -> Buffer:
"""The gpu buffer for the null-mask"""
if not self.nullable:
raise ValueError("Column has no null mask")
return self.mask_array_view | [
"def",
"nullmask",
"(",
"self",
")",
"->",
"Buffer",
":",
"if",
"not",
"self",
".",
"nullable",
":",
"raise",
"ValueError",
"(",
"\"Column has no null mask\"",
")",
"return",
"self",
".",
"mask_array_view"
] | https://github.com/rapidsai/cudf/blob/d5b2448fc69f17509304d594f029d0df56984962/python/cudf/cudf/core/column/column.py#L352-L356 | |
rodeofx/OpenWalter | 6116fbe3f04f1146c854afbfbdbe944feaee647e | walter/maya/scripts/walterPanel/walterMayaTraverser.py | python | WalterMayaImplementation.expressionGroups | (self, origin) | return sorted(groupSet) | Get all available expression groups. | Get all available expression groups. | [
"Get",
"all",
"available",
"expression",
"groups",
"."
] | def expressionGroups(self, origin):
"""Get all available expression groups."""
alembicGroups = pm.walterStandin(alembicAllGroups=origin)
if alembicGroups:
groupSet = set(alembicGroups)
else:
groupSet = set()
for exp, grp, _ in self.iterateExpressionGroups... | [
"def",
"expressionGroups",
"(",
"self",
",",
"origin",
")",
":",
"alembicGroups",
"=",
"pm",
".",
"walterStandin",
"(",
"alembicAllGroups",
"=",
"origin",
")",
"if",
"alembicGroups",
":",
"groupSet",
"=",
"set",
"(",
"alembicGroups",
")",
"else",
":",
"group... | https://github.com/rodeofx/OpenWalter/blob/6116fbe3f04f1146c854afbfbdbe944feaee647e/walter/maya/scripts/walterPanel/walterMayaTraverser.py#L698-L710 | |
aws/lumberyard | f85344403c1c2e77ec8c75deb2c116e97b713217 | dev/Gems/CloudGemMetric/v1/AWS/python/windows/Lib/numba/cgutils.py | python | raw_memcpy | (builder, dst, src, count, itemsize, align=1) | return _raw_memcpy(builder, 'llvm.memcpy', dst, src, count, itemsize, align) | Emit a raw memcpy() call for `count` items of size `itemsize`
from `src` to `dest`. | Emit a raw memcpy() call for `count` items of size `itemsize`
from `src` to `dest`. | [
"Emit",
"a",
"raw",
"memcpy",
"()",
"call",
"for",
"count",
"items",
"of",
"size",
"itemsize",
"from",
"src",
"to",
"dest",
"."
] | def raw_memcpy(builder, dst, src, count, itemsize, align=1):
"""
Emit a raw memcpy() call for `count` items of size `itemsize`
from `src` to `dest`.
"""
return _raw_memcpy(builder, 'llvm.memcpy', dst, src, count, itemsize, align) | [
"def",
"raw_memcpy",
"(",
"builder",
",",
"dst",
",",
"src",
",",
"count",
",",
"itemsize",
",",
"align",
"=",
"1",
")",
":",
"return",
"_raw_memcpy",
"(",
"builder",
",",
"'llvm.memcpy'",
",",
"dst",
",",
"src",
",",
"count",
",",
"itemsize",
",",
"... | https://github.com/aws/lumberyard/blob/f85344403c1c2e77ec8c75deb2c116e97b713217/dev/Gems/CloudGemMetric/v1/AWS/python/windows/Lib/numba/cgutils.py#L1005-L1010 | |
apple/swift | 469f72fdae2ea828b3b6c0d7d62d7e4cf98c4893 | utils/build_swift/build_swift/shell.py | python | _flatmap | (func, *iterables) | return itertools.chain.from_iterable(map(func, *iterables)) | Helper function that maps the given func over the iterables and then
creates a single flat iterable from the results. | Helper function that maps the given func over the iterables and then
creates a single flat iterable from the results. | [
"Helper",
"function",
"that",
"maps",
"the",
"given",
"func",
"over",
"the",
"iterables",
"and",
"then",
"creates",
"a",
"single",
"flat",
"iterable",
"from",
"the",
"results",
"."
] | def _flatmap(func, *iterables):
"""Helper function that maps the given func over the iterables and then
creates a single flat iterable from the results.
"""
return itertools.chain.from_iterable(map(func, *iterables)) | [
"def",
"_flatmap",
"(",
"func",
",",
"*",
"iterables",
")",
":",
"return",
"itertools",
".",
"chain",
".",
"from_iterable",
"(",
"map",
"(",
"func",
",",
"*",
"iterables",
")",
")"
] | https://github.com/apple/swift/blob/469f72fdae2ea828b3b6c0d7d62d7e4cf98c4893/utils/build_swift/build_swift/shell.py#L97-L102 | |
LiquidPlayer/LiquidCore | 9405979363f2353ac9a71ad8ab59685dd7f919c9 | deps/node-10.15.3/deps/npm/node_modules/node-gyp/gyp/pylib/gyp/generator/eclipse.py | python | CalculateGeneratorInputInfo | (params) | Calculate the generator specific info that gets fed to input (called by
gyp). | Calculate the generator specific info that gets fed to input (called by
gyp). | [
"Calculate",
"the",
"generator",
"specific",
"info",
"that",
"gets",
"fed",
"to",
"input",
"(",
"called",
"by",
"gyp",
")",
"."
] | def CalculateGeneratorInputInfo(params):
"""Calculate the generator specific info that gets fed to input (called by
gyp)."""
generator_flags = params.get('generator_flags', {})
if generator_flags.get('adjust_static_libraries', False):
global generator_wants_static_library_dependencies_adjusted
generator... | [
"def",
"CalculateGeneratorInputInfo",
"(",
"params",
")",
":",
"generator_flags",
"=",
"params",
".",
"get",
"(",
"'generator_flags'",
",",
"{",
"}",
")",
"if",
"generator_flags",
".",
"get",
"(",
"'adjust_static_libraries'",
",",
"False",
")",
":",
"global",
... | https://github.com/LiquidPlayer/LiquidCore/blob/9405979363f2353ac9a71ad8ab59685dd7f919c9/deps/node-10.15.3/deps/npm/node_modules/node-gyp/gyp/pylib/gyp/generator/eclipse.py#L71-L77 | ||
lukasmonk/lucaschess | 13e2e5cb13b38a720ccf897af649054a64bcb914 | Code/QT/Columnas.py | python | Columna.QTcolorTexto | (self, rgb) | Convierte un parametro de color del texto para que sea usable por QT | Convierte un parametro de color del texto para que sea usable por QT | [
"Convierte",
"un",
"parametro",
"de",
"color",
"del",
"texto",
"para",
"que",
"sea",
"usable",
"por",
"QT"
] | def QTcolorTexto(self, rgb):
"""
Convierte un parametro de color del texto para que sea usable por QT
"""
if rgb == -1:
return None
else:
return QtGui.QColor(rgb) | [
"def",
"QTcolorTexto",
"(",
"self",
",",
"rgb",
")",
":",
"if",
"rgb",
"==",
"-",
"1",
":",
"return",
"None",
"else",
":",
"return",
"QtGui",
".",
"QColor",
"(",
"rgb",
")"
] | https://github.com/lukasmonk/lucaschess/blob/13e2e5cb13b38a720ccf897af649054a64bcb914/Code/QT/Columnas.py#L101-L108 | ||
baidu-research/tensorflow-allreduce | 66d5b855e90b0949e9fa5cca5599fd729a70e874 | tensorflow/contrib/session_bundle/gc.py | python | negation | (f) | return keep | Negate a filter.
Args:
f: filter function to invert
Returns:
A filter function that returns the negation of f. | Negate a filter. | [
"Negate",
"a",
"filter",
"."
] | def negation(f):
"""Negate a filter.
Args:
f: filter function to invert
Returns:
A filter function that returns the negation of f.
"""
def keep(paths):
l = set(paths)
r = set(f(paths))
return sorted(list(l-r))
return keep | [
"def",
"negation",
"(",
"f",
")",
":",
"def",
"keep",
"(",
"paths",
")",
":",
"l",
"=",
"set",
"(",
"paths",
")",
"r",
"=",
"set",
"(",
"f",
"(",
"paths",
")",
")",
"return",
"sorted",
"(",
"list",
"(",
"l",
"-",
"r",
")",
")",
"return",
"k... | https://github.com/baidu-research/tensorflow-allreduce/blob/66d5b855e90b0949e9fa5cca5599fd729a70e874/tensorflow/contrib/session_bundle/gc.py#L174-L187 | |
SoarGroup/Soar | a1c5e249499137a27da60533c72969eef3b8ab6b | scons/scons-local-4.1.0/SCons/Node/Python.py | python | ValueWithMemo | (value, built_value=None, name=None) | Memoized Value() node factory. | Memoized Value() node factory. | [
"Memoized",
"Value",
"()",
"node",
"factory",
"."
] | def ValueWithMemo(value, built_value=None, name=None):
"""
Memoized Value() node factory.
"""
global _memo_lookup_map
# No current support for memoizing a value that needs to be built.
if built_value:
return Value(value, built_value, name=name)
try:
memo_lookup_key = hash((... | [
"def",
"ValueWithMemo",
"(",
"value",
",",
"built_value",
"=",
"None",
",",
"name",
"=",
"None",
")",
":",
"global",
"_memo_lookup_map",
"# No current support for memoizing a value that needs to be built.",
"if",
"built_value",
":",
"return",
"Value",
"(",
"value",
",... | https://github.com/SoarGroup/Soar/blob/a1c5e249499137a27da60533c72969eef3b8ab6b/scons/scons-local-4.1.0/SCons/Node/Python.py#L174-L195 | ||
alibaba/weex_js_engine | 2bdf4b6f020c1fc99c63f649718f6faf7e27fdde | jni/v8core/v8/build/gyp/pylib/gyp/generator/ninja.py | python | QuoteShellArgument | (arg, flavor) | return "'" + arg.replace("'", "'" + '"\'"' + "'") + "'" | Quote a string such that it will be interpreted as a single argument
by the shell. | Quote a string such that it will be interpreted as a single argument
by the shell. | [
"Quote",
"a",
"string",
"such",
"that",
"it",
"will",
"be",
"interpreted",
"as",
"a",
"single",
"argument",
"by",
"the",
"shell",
"."
] | def QuoteShellArgument(arg, flavor):
"""Quote a string such that it will be interpreted as a single argument
by the shell."""
# Rather than attempting to enumerate the bad shell characters, just
# whitelist common OK ones and quote anything else.
if re.match(r'^[a-zA-Z0-9_=.\\/-]+$', arg):
return arg # N... | [
"def",
"QuoteShellArgument",
"(",
"arg",
",",
"flavor",
")",
":",
"# Rather than attempting to enumerate the bad shell characters, just",
"# whitelist common OK ones and quote anything else.",
"if",
"re",
".",
"match",
"(",
"r'^[a-zA-Z0-9_=.\\\\/-]+$'",
",",
"arg",
")",
":",
... | https://github.com/alibaba/weex_js_engine/blob/2bdf4b6f020c1fc99c63f649718f6faf7e27fdde/jni/v8core/v8/build/gyp/pylib/gyp/generator/ninja.py#L77-L86 | |
baidu-research/tensorflow-allreduce | 66d5b855e90b0949e9fa5cca5599fd729a70e874 | tensorflow/contrib/timeseries/python/timeseries/state_space_models/state_space_model.py | python | StateSpaceModel._imputation_step | (self, current_times, state) | return (estimated_state, estimated_state_var,
previous_times + catchup_times) | Add state transition noise to catch `state` up to `current_times`.
State space models are inherently sequential, so we need to "predict
through" any missing time steps to catch up each element of the batch to its
next observation/prediction time.
Args:
current_times: A [batch size] Tensor of tim... | Add state transition noise to catch `state` up to `current_times`. | [
"Add",
"state",
"transition",
"noise",
"to",
"catch",
"state",
"up",
"to",
"current_times",
"."
] | def _imputation_step(self, current_times, state):
"""Add state transition noise to catch `state` up to `current_times`.
State space models are inherently sequential, so we need to "predict
through" any missing time steps to catch up each element of the batch to its
next observation/prediction time.
... | [
"def",
"_imputation_step",
"(",
"self",
",",
"current_times",
",",
"state",
")",
":",
"estimated_state",
",",
"estimated_state_var",
",",
"previous_times",
"=",
"state",
"catchup_times",
"=",
"current_times",
"-",
"previous_times",
"non_negative_assertion",
"=",
"cont... | https://github.com/baidu-research/tensorflow-allreduce/blob/66d5b855e90b0949e9fa5cca5599fd729a70e874/tensorflow/contrib/timeseries/python/timeseries/state_space_models/state_space_model.py#L354-L387 | |
miyosuda/TensorFlowAndroidMNIST | 7b5a4603d2780a8a2834575706e9001977524007 | jni-build/jni/include/tensorflow/contrib/copy_graph/python/util/copy_elements.py | python | copy_op_to_graph | (org_instance, to_graph, variables,
scope="") | Given an `Operation` 'org_instance` from one `Graph`,
initializes and returns a copy of it from another `Graph`,
under the specified scope (default `""`).
The copying is done recursively, so any `Operation` whose output
is required to evaluate the `org_instance`, is also copied (unless
already done... | Given an `Operation` 'org_instance` from one `Graph`,
initializes and returns a copy of it from another `Graph`,
under the specified scope (default `""`). | [
"Given",
"an",
"Operation",
"org_instance",
"from",
"one",
"Graph",
"initializes",
"and",
"returns",
"a",
"copy",
"of",
"it",
"from",
"another",
"Graph",
"under",
"the",
"specified",
"scope",
"(",
"default",
")",
"."
] | def copy_op_to_graph(org_instance, to_graph, variables,
scope=""):
"""Given an `Operation` 'org_instance` from one `Graph`,
initializes and returns a copy of it from another `Graph`,
under the specified scope (default `""`).
The copying is done recursively, so any `Operation` whose... | [
"def",
"copy_op_to_graph",
"(",
"org_instance",
",",
"to_graph",
",",
"variables",
",",
"scope",
"=",
"\"\"",
")",
":",
"#The name of the new instance",
"if",
"scope",
"!=",
"''",
":",
"new_name",
"=",
"scope",
"+",
"'/'",
"+",
"org_instance",
".",
"name",
"... | https://github.com/miyosuda/TensorFlowAndroidMNIST/blob/7b5a4603d2780a8a2834575706e9001977524007/jni-build/jni/include/tensorflow/contrib/copy_graph/python/util/copy_elements.py#L101-L234 | ||
aws/lumberyard | f85344403c1c2e77ec8c75deb2c116e97b713217 | dev/Gems/CloudGemMetric/v1/AWS/common-code/Lib/pandas/core/arrays/datetimes.py | python | DatetimeArray.month_name | (self, locale=None) | return result | Return the month names of the DateTimeIndex with specified locale.
.. versionadded:: 0.23.0
Parameters
----------
locale : str, optional
Locale determining the language in which to return the month name.
Default is English locale.
Returns
------... | Return the month names of the DateTimeIndex with specified locale. | [
"Return",
"the",
"month",
"names",
"of",
"the",
"DateTimeIndex",
"with",
"specified",
"locale",
"."
] | def month_name(self, locale=None):
"""
Return the month names of the DateTimeIndex with specified locale.
.. versionadded:: 0.23.0
Parameters
----------
locale : str, optional
Locale determining the language in which to return the month name.
Def... | [
"def",
"month_name",
"(",
"self",
",",
"locale",
"=",
"None",
")",
":",
"if",
"self",
".",
"tz",
"is",
"not",
"None",
"and",
"not",
"timezones",
".",
"is_utc",
"(",
"self",
".",
"tz",
")",
":",
"values",
"=",
"self",
".",
"_local_timestamps",
"(",
... | https://github.com/aws/lumberyard/blob/f85344403c1c2e77ec8c75deb2c116e97b713217/dev/Gems/CloudGemMetric/v1/AWS/common-code/Lib/pandas/core/arrays/datetimes.py#L1143-L1176 | |
mindspore-ai/mindspore | fb8fd3338605bb34fa5cea054e535a8b1d753fab | mindspore/lite/tools/dataset/cropper/cropper_configure.py | python | extract_classname_source_node | (header_content) | return re.findall(r"(?<=class )[\w\d_]+(?=Node : )", header_content) | Use regex to find class names in header files of source nodes
:param header_content: string containing header of a source node IR file
:return: list of source node classes found | Use regex to find class names in header files of source nodes | [
"Use",
"regex",
"to",
"find",
"class",
"names",
"in",
"header",
"files",
"of",
"source",
"nodes"
] | def extract_classname_source_node(header_content):
"""
Use regex to find class names in header files of source nodes
:param header_content: string containing header of a source node IR file
:return: list of source node classes found
"""
return re.findall(r"(?<=class )[\w\d_]+(?=Node : )", heade... | [
"def",
"extract_classname_source_node",
"(",
"header_content",
")",
":",
"return",
"re",
".",
"findall",
"(",
"r\"(?<=class )[\\w\\d_]+(?=Node : )\"",
",",
"header_content",
")"
] | https://github.com/mindspore-ai/mindspore/blob/fb8fd3338605bb34fa5cea054e535a8b1d753fab/mindspore/lite/tools/dataset/cropper/cropper_configure.py#L105-L112 | |
ApolloAuto/apollo-platform | 86d9dc6743b496ead18d597748ebabd34a513289 | ros/third_party/lib_x86_64/python2.7/dist-packages/rosdep2/installers.py | python | InstallerContext.get_os_installer_keys | (self, os_key) | Get list of installer keys registered for the specified OS.
These keys can be resolved by calling
:meth:`InstallerContext.get_installer`.
:param os_key: Key for OS
:raises: :exc:`KeyError`: if no information for OS *os_key* is registered. | Get list of installer keys registered for the specified OS.
These keys can be resolved by calling
:meth:`InstallerContext.get_installer`.
:param os_key: Key for OS
:raises: :exc:`KeyError`: if no information for OS *os_key* is registered. | [
"Get",
"list",
"of",
"installer",
"keys",
"registered",
"for",
"the",
"specified",
"OS",
".",
"These",
"keys",
"can",
"be",
"resolved",
"by",
"calling",
":",
"meth",
":",
"InstallerContext",
".",
"get_installer",
".",
":",
"param",
"os_key",
":",
"Key",
"f... | def get_os_installer_keys(self, os_key):
"""
Get list of installer keys registered for the specified OS.
These keys can be resolved by calling
:meth:`InstallerContext.get_installer`.
:param os_key: Key for OS
:raises: :exc:`KeyError`: if no information for OS *os... | [
"def",
"get_os_installer_keys",
"(",
"self",
",",
"os_key",
")",
":",
"if",
"os_key",
"in",
"self",
".",
"os_installers",
":",
"return",
"self",
".",
"os_installers",
"[",
"os_key",
"]",
"[",
":",
"]",
"else",
":",
"raise",
"KeyError",
"(",
"os_key",
")"... | https://github.com/ApolloAuto/apollo-platform/blob/86d9dc6743b496ead18d597748ebabd34a513289/ros/third_party/lib_x86_64/python2.7/dist-packages/rosdep2/installers.py#L187-L199 | ||
microsoft/onnxruntime | f92e47e95b13a240e37caf7b36577983544f98fc | onnxruntime/python/tools/quantization/calibrate.py | python | CalibraterBase.select_tensors_to_calibrate | (self, model) | return tensors_to_calibrate, value_infos | select all quantization_candidates op type nodes' input/output tensors.
returns:
tensors (set): set of tensor name.
value_infos (dict): tensor name to value info. | select all quantization_candidates op type nodes' input/output tensors.
returns:
tensors (set): set of tensor name.
value_infos (dict): tensor name to value info. | [
"select",
"all",
"quantization_candidates",
"op",
"type",
"nodes",
"input",
"/",
"output",
"tensors",
".",
"returns",
":",
"tensors",
"(",
"set",
")",
":",
"set",
"of",
"tensor",
"name",
".",
"value_infos",
"(",
"dict",
")",
":",
"tensor",
"name",
"to",
... | def select_tensors_to_calibrate(self, model):
'''
select all quantization_candidates op type nodes' input/output tensors.
returns:
tensors (set): set of tensor name.
value_infos (dict): tensor name to value info.
'''
value_infos = {vi.name: vi for vi in m... | [
"def",
"select_tensors_to_calibrate",
"(",
"self",
",",
"model",
")",
":",
"value_infos",
"=",
"{",
"vi",
".",
"name",
":",
"vi",
"for",
"vi",
"in",
"model",
".",
"graph",
".",
"value_info",
"}",
"value_infos",
".",
"update",
"(",
"{",
"ot",
".",
"name... | https://github.com/microsoft/onnxruntime/blob/f92e47e95b13a240e37caf7b36577983544f98fc/onnxruntime/python/tools/quantization/calibrate.py#L84-L109 | |
aws/lumberyard | f85344403c1c2e77ec8c75deb2c116e97b713217 | dev/Tools/Python/3.7.10/mac/Python.framework/Versions/3.7/lib/python3.7/_pydecimal.py | python | Decimal.__divmod__ | (self, other, context=None) | return quotient, remainder | Return (self // other, self % other) | Return (self // other, self % other) | [
"Return",
"(",
"self",
"//",
"other",
"self",
"%",
"other",
")"
] | def __divmod__(self, other, context=None):
"""
Return (self // other, self % other)
"""
other = _convert_other(other)
if other is NotImplemented:
return other
if context is None:
context = getcontext()
ans = self._check_nans(other, contex... | [
"def",
"__divmod__",
"(",
"self",
",",
"other",
",",
"context",
"=",
"None",
")",
":",
"other",
"=",
"_convert_other",
"(",
"other",
")",
"if",
"other",
"is",
"NotImplemented",
":",
"return",
"other",
"if",
"context",
"is",
"None",
":",
"context",
"=",
... | https://github.com/aws/lumberyard/blob/f85344403c1c2e77ec8c75deb2c116e97b713217/dev/Tools/Python/3.7.10/mac/Python.framework/Versions/3.7/lib/python3.7/_pydecimal.py#L1423-L1457 | |
apple/turicreate | cce55aa5311300e3ce6af93cb45ba791fd1bdf49 | src/external/coremltools_wrap/coremltools/coremltools/models/neural_network/builder.py | python | NeuralNetworkBuilder.add_max_broadcastable | (self, name, input_names, output_name) | return spec_layer | Add a max_broadcastable layer to the model that performs element-wise
maximum operation with broadcast support.
Refer to the **MaxBroadcastableLayerParams** message in specification (NeuralNetwork.proto) for more details.
Parameters
----------
name: str
The name of t... | Add a max_broadcastable layer to the model that performs element-wise
maximum operation with broadcast support.
Refer to the **MaxBroadcastableLayerParams** message in specification (NeuralNetwork.proto) for more details. | [
"Add",
"a",
"max_broadcastable",
"layer",
"to",
"the",
"model",
"that",
"performs",
"element",
"-",
"wise",
"maximum",
"operation",
"with",
"broadcast",
"support",
".",
"Refer",
"to",
"the",
"**",
"MaxBroadcastableLayerParams",
"**",
"message",
"in",
"specificatio... | def add_max_broadcastable(self, name, input_names, output_name):
"""
Add a max_broadcastable layer to the model that performs element-wise
maximum operation with broadcast support.
Refer to the **MaxBroadcastableLayerParams** message in specification (NeuralNetwork.proto) for more detail... | [
"def",
"add_max_broadcastable",
"(",
"self",
",",
"name",
",",
"input_names",
",",
"output_name",
")",
":",
"spec_layer",
"=",
"self",
".",
"_add_generic_layer",
"(",
"name",
",",
"input_names",
",",
"[",
"output_name",
"]",
")",
"spec_layer",
".",
"maxBroadca... | https://github.com/apple/turicreate/blob/cce55aa5311300e3ce6af93cb45ba791fd1bdf49/src/external/coremltools_wrap/coremltools/coremltools/models/neural_network/builder.py#L5077-L5096 | |
aws/lumberyard | f85344403c1c2e77ec8c75deb2c116e97b713217 | dev/Gems/CloudGemMetric/v1/AWS/common-code/Lib/fsspec/spec.py | python | AbstractFileSystem.ls | (self, path, detail=True, **kwargs) | List objects at path.
This should include subdirectories and files at that location. The
difference between a file and a directory must be clear when details
are requested.
The specific keys, or perhaps a FileInfo class, or similar, is TBD,
but must be consistent across impleme... | List objects at path. | [
"List",
"objects",
"at",
"path",
"."
] | def ls(self, path, detail=True, **kwargs):
"""List objects at path.
This should include subdirectories and files at that location. The
difference between a file and a directory must be clear when details
are requested.
The specific keys, or perhaps a FileInfo class, or similar,... | [
"def",
"ls",
"(",
"self",
",",
"path",
",",
"detail",
"=",
"True",
",",
"*",
"*",
"kwargs",
")",
":",
"raise",
"NotImplementedError"
] | https://github.com/aws/lumberyard/blob/f85344403c1c2e77ec8c75deb2c116e97b713217/dev/Gems/CloudGemMetric/v1/AWS/common-code/Lib/fsspec/spec.py#L258-L296 | ||
PixarAnimationStudios/USD | faed18ce62c8736b02413635b584a2f637156bad | build_scripts/build_usd.py | python | GetXcodeDeveloperDirectory | () | return GetCommandOutput("xcode-select -p") | Returns the active developer directory as reported by 'xcode-select -p'.
Returns None if none is set. | Returns the active developer directory as reported by 'xcode-select -p'.
Returns None if none is set. | [
"Returns",
"the",
"active",
"developer",
"directory",
"as",
"reported",
"by",
"xcode",
"-",
"select",
"-",
"p",
".",
"Returns",
"None",
"if",
"none",
"is",
"set",
"."
] | def GetXcodeDeveloperDirectory():
"""Returns the active developer directory as reported by 'xcode-select -p'.
Returns None if none is set."""
if not MacOS():
return None
return GetCommandOutput("xcode-select -p") | [
"def",
"GetXcodeDeveloperDirectory",
"(",
")",
":",
"if",
"not",
"MacOS",
"(",
")",
":",
"return",
"None",
"return",
"GetCommandOutput",
"(",
"\"xcode-select -p\"",
")"
] | https://github.com/PixarAnimationStudios/USD/blob/faed18ce62c8736b02413635b584a2f637156bad/build_scripts/build_usd.py#L110-L116 | |
dogecoin/dogecoin | 31afd133119dd2e15862d46530cb99424cf564b0 | contrib/seeds/makeseeds.py | python | filtermultiport | (ips) | return [value[0] for (key,value) in list(hist.items()) if len(value)==1] | Filter out hosts with more nodes per IP | Filter out hosts with more nodes per IP | [
"Filter",
"out",
"hosts",
"with",
"more",
"nodes",
"per",
"IP"
] | def filtermultiport(ips):
'''Filter out hosts with more nodes per IP'''
hist = collections.defaultdict(list)
for ip in ips:
hist[ip['sortkey']].append(ip)
return [value[0] for (key,value) in list(hist.items()) if len(value)==1] | [
"def",
"filtermultiport",
"(",
"ips",
")",
":",
"hist",
"=",
"collections",
".",
"defaultdict",
"(",
"list",
")",
"for",
"ip",
"in",
"ips",
":",
"hist",
"[",
"ip",
"[",
"'sortkey'",
"]",
"]",
".",
"append",
"(",
"ip",
")",
"return",
"[",
"value",
"... | https://github.com/dogecoin/dogecoin/blob/31afd133119dd2e15862d46530cb99424cf564b0/contrib/seeds/makeseeds.py#L102-L107 | |
eclipse/sumo | 7132a9b8b6eea734bdec38479026b4d8c4336d03 | tools/traci/_gui.py | python | GuiDomain.track | (self, objID, viewID=DEFAULT_VIEW) | track(string, string) -> None
Start visually tracking the given vehicle or person on the given view. | track(string, string) -> None
Start visually tracking the given vehicle or person on the given view. | [
"track",
"(",
"string",
"string",
")",
"-",
">",
"None",
"Start",
"visually",
"tracking",
"the",
"given",
"vehicle",
"or",
"person",
"on",
"the",
"given",
"view",
"."
] | def track(self, objID, viewID=DEFAULT_VIEW):
"""track(string, string) -> None
Start visually tracking the given vehicle or person on the given view.
"""
self._setCmd(tc.VAR_TRACK_VEHICLE, viewID, "s", objID) | [
"def",
"track",
"(",
"self",
",",
"objID",
",",
"viewID",
"=",
"DEFAULT_VIEW",
")",
":",
"self",
".",
"_setCmd",
"(",
"tc",
".",
"VAR_TRACK_VEHICLE",
",",
"viewID",
",",
"\"s\"",
",",
"objID",
")"
] | https://github.com/eclipse/sumo/blob/7132a9b8b6eea734bdec38479026b4d8c4336d03/tools/traci/_gui.py#L126-L130 | ||
rdiankov/openrave | d1a23023fd4b58f077d2ca949ceaf1b91f3f13d7 | python/databases/grasping.py | python | GraspingModel.setPreshape | (self,grasp) | sets the preshape on the robot, assumes environment is locked | sets the preshape on the robot, assumes environment is locked | [
"sets",
"the",
"preshape",
"on",
"the",
"robot",
"assumes",
"environment",
"is",
"locked"
] | def setPreshape(self,grasp):
"""sets the preshape on the robot, assumes environment is locked"""
self.robot.SetDOFValues(grasp[self.graspindices['igrasppreshape']],self.manip.GetGripperIndices()) | [
"def",
"setPreshape",
"(",
"self",
",",
"grasp",
")",
":",
"self",
".",
"robot",
".",
"SetDOFValues",
"(",
"grasp",
"[",
"self",
".",
"graspindices",
"[",
"'igrasppreshape'",
"]",
"]",
",",
"self",
".",
"manip",
".",
"GetGripperIndices",
"(",
")",
")"
] | https://github.com/rdiankov/openrave/blob/d1a23023fd4b58f077d2ca949ceaf1b91f3f13d7/python/databases/grasping.py#L782-L784 | ||
hakuna-m/wubiuefi | caec1af0a09c78fd5a345180ada1fe45e0c63493 | src/wubi/backends/common/tasklist.py | python | Task._get_completed | (self) | return float(self.completed*self.weight) + sum(completed_subtasks) | get weighted sum of percent completed for this task and all the subtasks | get weighted sum of percent completed for this task and all the subtasks | [
"get",
"weighted",
"sum",
"of",
"percent",
"completed",
"for",
"this",
"task",
"and",
"all",
"the",
"subtasks"
] | def _get_completed(self):
'''
get weighted sum of percent completed for this task and all the subtasks
'''
completed_subtasks = [s._get_completed() for s in self.subtasks]
return float(self.completed*self.weight) + sum(completed_subtasks) | [
"def",
"_get_completed",
"(",
"self",
")",
":",
"completed_subtasks",
"=",
"[",
"s",
".",
"_get_completed",
"(",
")",
"for",
"s",
"in",
"self",
".",
"subtasks",
"]",
"return",
"float",
"(",
"self",
".",
"completed",
"*",
"self",
".",
"weight",
")",
"+"... | https://github.com/hakuna-m/wubiuefi/blob/caec1af0a09c78fd5a345180ada1fe45e0c63493/src/wubi/backends/common/tasklist.py#L341-L346 | |
catboost/catboost | 167f64f237114a4d10b2b4ee42adb4569137debe | contrib/tools/python3/src/Lib/_osx_support.py | python | _find_appropriate_compiler | (_config_vars) | return _config_vars | Find appropriate C compiler for extension module builds | Find appropriate C compiler for extension module builds | [
"Find",
"appropriate",
"C",
"compiler",
"for",
"extension",
"module",
"builds"
] | def _find_appropriate_compiler(_config_vars):
"""Find appropriate C compiler for extension module builds"""
# Issue #13590:
# The OSX location for the compiler varies between OSX
# (or rather Xcode) releases. With older releases (up-to 10.5)
# the compiler is in /usr/bin, with newer relea... | [
"def",
"_find_appropriate_compiler",
"(",
"_config_vars",
")",
":",
"# Issue #13590:",
"# The OSX location for the compiler varies between OSX",
"# (or rather Xcode) releases. With older releases (up-to 10.5)",
"# the compiler is in /usr/bin, with newer releases the compiler",
"# ca... | https://github.com/catboost/catboost/blob/167f64f237114a4d10b2b4ee42adb4569137debe/contrib/tools/python3/src/Lib/_osx_support.py#L198-L257 | |
Kitware/ParaView | f760af9124ff4634b23ebbeab95a4f56e0261955 | Wrapping/Python/paraview/servermanager.py | python | FieldDataInformation.iteritems | (self) | return FieldDataInformationIterator(self, True) | Implementation of the PY2 dictionary API | Implementation of the PY2 dictionary API | [
"Implementation",
"of",
"the",
"PY2",
"dictionary",
"API"
] | def iteritems(self):
"""Implementation of the PY2 dictionary API"""
return FieldDataInformationIterator(self, True) | [
"def",
"iteritems",
"(",
"self",
")",
":",
"return",
"FieldDataInformationIterator",
"(",
"self",
",",
"True",
")"
] | https://github.com/Kitware/ParaView/blob/f760af9124ff4634b23ebbeab95a4f56e0261955/Wrapping/Python/paraview/servermanager.py#L1682-L1684 | |
tensorflow/tensorflow | 419e3a6b650ea4bd1b0cba23c4348f8a69f3272e | tensorflow/python/client/session.py | python | _DictFetchMapper.__init__ | (self, fetches) | Creates a _DictFetchMapper.
Args:
fetches: Dict of fetches. | Creates a _DictFetchMapper. | [
"Creates",
"a",
"_DictFetchMapper",
"."
] | def __init__(self, fetches):
"""Creates a _DictFetchMapper.
Args:
fetches: Dict of fetches.
"""
self._fetch_type = type(fetches)
if isinstance(fetches, collections.defaultdict):
self._type_ctor = functools.partial(collections.defaultdict,
fetche... | [
"def",
"__init__",
"(",
"self",
",",
"fetches",
")",
":",
"self",
".",
"_fetch_type",
"=",
"type",
"(",
"fetches",
")",
"if",
"isinstance",
"(",
"fetches",
",",
"collections",
".",
"defaultdict",
")",
":",
"self",
".",
"_type_ctor",
"=",
"functools",
"."... | https://github.com/tensorflow/tensorflow/blob/419e3a6b650ea4bd1b0cba23c4348f8a69f3272e/tensorflow/python/client/session.py#L402-L419 | ||
mantidproject/mantid | 03deeb89254ec4289edb8771e0188c2090a02f32 | scripts/SANS/isis_reduction_steps.py | python | ConvertToQISIS.execute | (self, reducer, workspace) | Calculate the normalization workspaces and then call the chosen Q conversion algorithm. | Calculate the normalization workspaces and then call the chosen Q conversion algorithm. | [
"Calculate",
"the",
"normalization",
"workspaces",
"and",
"then",
"call",
"the",
"chosen",
"Q",
"conversion",
"algorithm",
"."
] | def execute(self, reducer, workspace):
"""
Calculate the normalization workspaces and then call the chosen Q conversion algorithm.
"""
wavepixeladj = ""
if reducer.wide_angle_correction and reducer.transmission_calculator.output_wksp:
# calculate the transmission wide... | [
"def",
"execute",
"(",
"self",
",",
"reducer",
",",
"workspace",
")",
":",
"wavepixeladj",
"=",
"\"\"",
"if",
"reducer",
".",
"wide_angle_correction",
"and",
"reducer",
".",
"transmission_calculator",
".",
"output_wksp",
":",
"# calculate the transmission wide angle c... | https://github.com/mantidproject/mantid/blob/03deeb89254ec4289edb8771e0188c2090a02f32/scripts/SANS/isis_reduction_steps.py#L2721-L2807 | ||
smartdevicelink/sdl_core | 68f082169e0a40fccd9eb0db3c83911c28870f07 | tools/InterfaceGenerator/generator/generators/SmartFactoryBase.py | python | CodeGenerator._gen_struct_impl | (self, struct, namespace, class_name) | return self._struct_impl_template.substitute(
namespace=namespace,
class_name=class_name,
struct_name=struct.name,
code=self._indent_code(
self._struct_impl_code_tempate.substitute(
struct_name=struct.name,
schema_lo... | Generate struct implementation for source file.
Generates implementation code of method that provide schema item for
struct. This code should be used in the source file.
Keyword arguments:
struct -- struct to generate method for.
namespace -- name of destination namespace.
... | Generate struct implementation for source file. | [
"Generate",
"struct",
"implementation",
"for",
"source",
"file",
"."
] | def _gen_struct_impl(self, struct, namespace, class_name):
"""Generate struct implementation for source file.
Generates implementation code of method that provide schema item for
struct. This code should be used in the source file.
Keyword arguments:
struct -- struct to generat... | [
"def",
"_gen_struct_impl",
"(",
"self",
",",
"struct",
",",
"namespace",
",",
"class_name",
")",
":",
"processed_enums",
"=",
"[",
"]",
"return",
"self",
".",
"_struct_impl_template",
".",
"substitute",
"(",
"namespace",
"=",
"namespace",
",",
"class_name",
"=... | https://github.com/smartdevicelink/sdl_core/blob/68f082169e0a40fccd9eb0db3c83911c28870f07/tools/InterfaceGenerator/generator/generators/SmartFactoryBase.py#L545-L574 | |
ZintrulCre/LeetCode_Archiver | de23e16ead29336b5ee7aa1898a392a5d6463d27 | LeetCode/python3/775.py | python | Solution.isIdealPermutation | (self, A) | return True | :type A: List[int]
:rtype: bool | :type A: List[int]
:rtype: bool | [
":",
"type",
"A",
":",
"List",
"[",
"int",
"]",
":",
"rtype",
":",
"bool"
] | def isIdealPermutation(self, A):
"""
:type A: List[int]
:rtype: bool
"""
size, m = len(A), 0
for i in range(size - 2):
m = max(m, A[i])
if m > A[i + 2]:
return False
return True | [
"def",
"isIdealPermutation",
"(",
"self",
",",
"A",
")",
":",
"size",
",",
"m",
"=",
"len",
"(",
"A",
")",
",",
"0",
"for",
"i",
"in",
"range",
"(",
"size",
"-",
"2",
")",
":",
"m",
"=",
"max",
"(",
"m",
",",
"A",
"[",
"i",
"]",
")",
"if"... | https://github.com/ZintrulCre/LeetCode_Archiver/blob/de23e16ead29336b5ee7aa1898a392a5d6463d27/LeetCode/python3/775.py#L2-L12 | |
mantidproject/mantid | 03deeb89254ec4289edb8771e0188c2090a02f32 | scripts/Inelastic/vesuvio/profiles.py | python | GaussianMassProfile.create_fit_function_str | (self, param_vals=None, param_prefix="") | return fitting_str + ";" | Creates a string used by the Fit algorithm for this profile
:param param_vals: A table of values for the parameters that override those set
on the object already. Default=None
:param param_prefix: A string prefix for the parameter as seen by the Mantid Fit algorithm | Creates a string used by the Fit algorithm for this profile | [
"Creates",
"a",
"string",
"used",
"by",
"the",
"Fit",
"algorithm",
"for",
"this",
"profile"
] | def create_fit_function_str(self, param_vals=None, param_prefix=""):
"""Creates a string used by the Fit algorithm for this profile
:param param_vals: A table of values for the parameters that override those set
on the object already. Default=None
:param param_prefix: A string prefix fo... | [
"def",
"create_fit_function_str",
"(",
"self",
",",
"param_vals",
"=",
"None",
",",
"param_prefix",
"=",
"\"\"",
")",
":",
"vals_provided",
"=",
"(",
"param_vals",
"is",
"not",
"None",
")",
"if",
"vals_provided",
":",
"def_width",
"=",
"param_vals",
"[",
"pa... | https://github.com/mantidproject/mantid/blob/03deeb89254ec4289edb8771e0188c2090a02f32/scripts/Inelastic/vesuvio/profiles.py#L145-L170 | |
tkn-tub/ns3-gym | 19bfe0a583e641142609939a090a09dfc63a095f | src/visualizer/visualizer/hud.py | python | Axes.__init__ | (self, viz) | !
Initializer function
@param self: this object
@param viz: visualization object
@return none | !
Initializer function | [
"!",
"Initializer",
"function"
] | def __init__(self, viz):
"""!
Initializer function
@param self: this object
@param viz: visualization object
@return none
"""
self.viz = viz
self.color = 0x8080C0FF
self.hlines = GooCanvas.CanvasPath(parent=viz.canvas.get_root_item(), stroke_color... | [
"def",
"__init__",
"(",
"self",
",",
"viz",
")",
":",
"self",
".",
"viz",
"=",
"viz",
"self",
".",
"color",
"=",
"0x8080C0FF",
"self",
".",
"hlines",
"=",
"GooCanvas",
".",
"CanvasPath",
"(",
"parent",
"=",
"viz",
".",
"canvas",
".",
"get_root_item",
... | https://github.com/tkn-tub/ns3-gym/blob/19bfe0a583e641142609939a090a09dfc63a095f/src/visualizer/visualizer/hud.py#L22-L47 | ||
baidu-research/tensorflow-allreduce | 66d5b855e90b0949e9fa5cca5599fd729a70e874 | tensorflow/python/framework/errors_impl.py | python | UnimplementedError.__init__ | (self, node_def, op, message) | Creates an `UnimplementedError`. | Creates an `UnimplementedError`. | [
"Creates",
"an",
"UnimplementedError",
"."
] | def __init__(self, node_def, op, message):
"""Creates an `UnimplementedError`."""
super(UnimplementedError, self).__init__(node_def, op, message,
UNIMPLEMENTED) | [
"def",
"__init__",
"(",
"self",
",",
"node_def",
",",
"op",
",",
"message",
")",
":",
"super",
"(",
"UnimplementedError",
",",
"self",
")",
".",
"__init__",
"(",
"node_def",
",",
"op",
",",
"message",
",",
"UNIMPLEMENTED",
")"
] | https://github.com/baidu-research/tensorflow-allreduce/blob/66d5b855e90b0949e9fa5cca5599fd729a70e874/tensorflow/python/framework/errors_impl.py#L368-L371 | ||
wxWidgets/wxPython-Classic | 19571e1ae65f1ac445f5491474121998c97a1bf0 | src/osx_cocoa/html.py | python | HtmlCell.GetWidth | (*args, **kwargs) | return _html.HtmlCell_GetWidth(*args, **kwargs) | GetWidth(self) -> int | GetWidth(self) -> int | [
"GetWidth",
"(",
"self",
")",
"-",
">",
"int"
] | def GetWidth(*args, **kwargs):
"""GetWidth(self) -> int"""
return _html.HtmlCell_GetWidth(*args, **kwargs) | [
"def",
"GetWidth",
"(",
"*",
"args",
",",
"*",
"*",
"kwargs",
")",
":",
"return",
"_html",
".",
"HtmlCell_GetWidth",
"(",
"*",
"args",
",",
"*",
"*",
"kwargs",
")"
] | https://github.com/wxWidgets/wxPython-Classic/blob/19571e1ae65f1ac445f5491474121998c97a1bf0/src/osx_cocoa/html.py#L618-L620 | |
zhaoweicai/cascade-rcnn | 2252f46158ea6555868ca6fa5c221ea71d9b5e6c | tools/extra/parse_log.py | python | fix_initial_nan_learning_rate | (dict_list) | Correct initial value of learning rate
Learning rate is normally not printed until after the initial test and
training step, which means the initial testing and training rows have
LearningRate = NaN. Fix this by copying over the LearningRate from the
second row, if it exists. | Correct initial value of learning rate | [
"Correct",
"initial",
"value",
"of",
"learning",
"rate"
] | def fix_initial_nan_learning_rate(dict_list):
"""Correct initial value of learning rate
Learning rate is normally not printed until after the initial test and
training step, which means the initial testing and training rows have
LearningRate = NaN. Fix this by copying over the LearningRate from the
... | [
"def",
"fix_initial_nan_learning_rate",
"(",
"dict_list",
")",
":",
"if",
"len",
"(",
"dict_list",
")",
">",
"1",
":",
"dict_list",
"[",
"0",
"]",
"[",
"'LearningRate'",
"]",
"=",
"dict_list",
"[",
"1",
"]",
"[",
"'LearningRate'",
"]"
] | https://github.com/zhaoweicai/cascade-rcnn/blob/2252f46158ea6555868ca6fa5c221ea71d9b5e6c/tools/extra/parse_log.py#L128-L138 | ||
tensorflow/tensorflow | 419e3a6b650ea4bd1b0cba23c4348f8a69f3272e | tensorflow/python/eager/function_cache.py | python | FunctionCache.lookup | (self, key: FunctionCacheKey, use_function_subtyping: bool) | return None | Looks up a concrete function based on the key. | Looks up a concrete function based on the key. | [
"Looks",
"up",
"a",
"concrete",
"function",
"based",
"on",
"the",
"key",
"."
] | def lookup(self, key: FunctionCacheKey, use_function_subtyping: bool):
"""Looks up a concrete function based on the key."""
if not use_function_subtyping:
return self._primary.get(key, None)
dispatch_key = self._dispatch_table.dispatch(key)
if dispatch_key is not None:
return self._primary[... | [
"def",
"lookup",
"(",
"self",
",",
"key",
":",
"FunctionCacheKey",
",",
"use_function_subtyping",
":",
"bool",
")",
":",
"if",
"not",
"use_function_subtyping",
":",
"return",
"self",
".",
"_primary",
".",
"get",
"(",
"key",
",",
"None",
")",
"dispatch_key",
... | https://github.com/tensorflow/tensorflow/blob/419e3a6b650ea4bd1b0cba23c4348f8a69f3272e/tensorflow/python/eager/function_cache.py#L146-L155 | |
nasa/fprime | 595cf3682d8365943d86c1a6fe7c78f0a116acf0 | Autocoders/Python/src/fprime_ac/generators/writers/AbstractWriter.py | python | AbstractWriter.includes1Write | (self, obj) | Defined to generate includes within a file.
Usually used for the base classes but also for Port types
@param args: the instance of the concrete element to operation on. | Defined to generate includes within a file.
Usually used for the base classes but also for Port types | [
"Defined",
"to",
"generate",
"includes",
"within",
"a",
"file",
".",
"Usually",
"used",
"for",
"the",
"base",
"classes",
"but",
"also",
"for",
"Port",
"types"
] | def includes1Write(self, obj):
"""
Defined to generate includes within a file.
Usually used for the base classes but also for Port types
@param args: the instance of the concrete element to operation on.
"""
raise Exception(
"# AbstractWriter.includesWrite1() ... | [
"def",
"includes1Write",
"(",
"self",
",",
"obj",
")",
":",
"raise",
"Exception",
"(",
"\"# AbstractWriter.includesWrite1() - Implementation Error: you must supply your own concrete implementation.\"",
")"
] | https://github.com/nasa/fprime/blob/595cf3682d8365943d86c1a6fe7c78f0a116acf0/Autocoders/Python/src/fprime_ac/generators/writers/AbstractWriter.py#L84-L92 | ||
hanpfei/chromium-net | 392cc1fa3a8f92f42e4071ab6e674d8e0482f83f | third_party/catapult/third_party/gsutil/gslib/copy_helper.py | python | FixWindowsNaming | (src_url, dst_url) | return dst_url | Translates Windows pathnames to cloud pathnames.
Rewrites the destination URL built by ConstructDstUrl().
Args:
src_url: Source StorageUrl to be copied.
dst_url: The destination StorageUrl built by ConstructDstUrl().
Returns:
StorageUrl to use for copy. | Translates Windows pathnames to cloud pathnames. | [
"Translates",
"Windows",
"pathnames",
"to",
"cloud",
"pathnames",
"."
] | def FixWindowsNaming(src_url, dst_url):
"""Translates Windows pathnames to cloud pathnames.
Rewrites the destination URL built by ConstructDstUrl().
Args:
src_url: Source StorageUrl to be copied.
dst_url: The destination StorageUrl built by ConstructDstUrl().
Returns:
StorageUrl to use for copy.
... | [
"def",
"FixWindowsNaming",
"(",
"src_url",
",",
"dst_url",
")",
":",
"if",
"(",
"src_url",
".",
"IsFileUrl",
"(",
")",
"and",
"src_url",
".",
"delim",
"==",
"'\\\\'",
"and",
"dst_url",
".",
"IsCloudUrl",
"(",
")",
")",
":",
"trans_url_str",
"=",
"re",
... | https://github.com/hanpfei/chromium-net/blob/392cc1fa3a8f92f42e4071ab6e674d8e0482f83f/third_party/catapult/third_party/gsutil/gslib/copy_helper.py#L1176-L1192 | |
zhaoweicai/cascade-rcnn | 2252f46158ea6555868ca6fa5c221ea71d9b5e6c | scripts/cpp_lint.py | python | ReplaceAll | (pattern, rep, s) | return _regexp_compile_cache[pattern].sub(rep, s) | Replaces instances of pattern in a string with a replacement.
The compiled regex is kept in a cache shared by Match and Search.
Args:
pattern: regex pattern
rep: replacement text
s: search string
Returns:
string with replacements made (or original string if no replacements) | Replaces instances of pattern in a string with a replacement. | [
"Replaces",
"instances",
"of",
"pattern",
"in",
"a",
"string",
"with",
"a",
"replacement",
"."
] | def ReplaceAll(pattern, rep, s):
"""Replaces instances of pattern in a string with a replacement.
The compiled regex is kept in a cache shared by Match and Search.
Args:
pattern: regex pattern
rep: replacement text
s: search string
Returns:
string with replacements made (or original string if... | [
"def",
"ReplaceAll",
"(",
"pattern",
",",
"rep",
",",
"s",
")",
":",
"if",
"pattern",
"not",
"in",
"_regexp_compile_cache",
":",
"_regexp_compile_cache",
"[",
"pattern",
"]",
"=",
"sre_compile",
".",
"compile",
"(",
"pattern",
")",
"return",
"_regexp_compile_c... | https://github.com/zhaoweicai/cascade-rcnn/blob/2252f46158ea6555868ca6fa5c221ea71d9b5e6c/scripts/cpp_lint.py#L529-L544 | |
p4lang/p4c | 3272e79369f20813cc1a555a5eb26f44432f84a4 | tools/cpplint.py | python | _NamespaceInfo.CheckEnd | (self, filename, clean_lines, linenum, error) | Check end of namespace comments. | Check end of namespace comments. | [
"Check",
"end",
"of",
"namespace",
"comments",
"."
] | def CheckEnd(self, filename, clean_lines, linenum, error):
"""Check end of namespace comments."""
line = clean_lines.raw_lines[linenum]
# Check how many lines is enclosed in this namespace. Don't issue
# warning for missing namespace comments if there aren't enough
# lines. However, do apply chec... | [
"def",
"CheckEnd",
"(",
"self",
",",
"filename",
",",
"clean_lines",
",",
"linenum",
",",
"error",
")",
":",
"line",
"=",
"clean_lines",
".",
"raw_lines",
"[",
"linenum",
"]",
"# Check how many lines is enclosed in this namespace. Don't issue",
"# warning for missing n... | https://github.com/p4lang/p4c/blob/3272e79369f20813cc1a555a5eb26f44432f84a4/tools/cpplint.py#L2838-L2888 | ||
yun-liu/RCF | 91bfb054ad04187dbbe21e539e165ad9bd3ff00b | scripts/cpp_lint.py | python | CheckForMultilineCommentsAndStrings | (filename, clean_lines, linenum, error) | Logs an error if we see /* ... */ or "..." that extend past one line.
/* ... */ comments are legit inside macros, for one line.
Otherwise, we prefer // comments, so it's ok to warn about the
other. Likewise, it's ok for strings to extend across multiple
lines, as long as a line continuation character (backsla... | Logs an error if we see /* ... */ or "..." that extend past one line. | [
"Logs",
"an",
"error",
"if",
"we",
"see",
"/",
"*",
"...",
"*",
"/",
"or",
"...",
"that",
"extend",
"past",
"one",
"line",
"."
] | def CheckForMultilineCommentsAndStrings(filename, clean_lines, linenum, error):
"""Logs an error if we see /* ... */ or "..." that extend past one line.
/* ... */ comments are legit inside macros, for one line.
Otherwise, we prefer // comments, so it's ok to warn about the
other. Likewise, it's ok for strings... | [
"def",
"CheckForMultilineCommentsAndStrings",
"(",
"filename",
",",
"clean_lines",
",",
"linenum",
",",
"error",
")",
":",
"line",
"=",
"clean_lines",
".",
"elided",
"[",
"linenum",
"]",
"# Remove all \\\\ (escaped backslashes) from the line. They are OK, and the",
"# secon... | https://github.com/yun-liu/RCF/blob/91bfb054ad04187dbbe21e539e165ad9bd3ff00b/scripts/cpp_lint.py#L1526-L1561 | ||
aws/lumberyard | f85344403c1c2e77ec8c75deb2c116e97b713217 | dev/Tools/Python/3.7.10/mac/Python.framework/Versions/3.7/lib/python3.7/shutil.py | python | copytree | (src, dst, symlinks=False, ignore=None, copy_function=copy2,
ignore_dangling_symlinks=False) | return dst | Recursively copy a directory tree.
The destination directory must not already exist.
If exception(s) occur, an Error is raised with a list of reasons.
If the optional symlinks flag is true, symbolic links in the
source tree result in symbolic links in the destination tree; if
it is false, the cont... | Recursively copy a directory tree. | [
"Recursively",
"copy",
"a",
"directory",
"tree",
"."
] | def copytree(src, dst, symlinks=False, ignore=None, copy_function=copy2,
ignore_dangling_symlinks=False):
"""Recursively copy a directory tree.
The destination directory must not already exist.
If exception(s) occur, an Error is raised with a list of reasons.
If the optional symlinks flag... | [
"def",
"copytree",
"(",
"src",
",",
"dst",
",",
"symlinks",
"=",
"False",
",",
"ignore",
"=",
"None",
",",
"copy_function",
"=",
"copy2",
",",
"ignore_dangling_symlinks",
"=",
"False",
")",
":",
"names",
"=",
"os",
".",
"listdir",
"(",
"src",
")",
"if"... | https://github.com/aws/lumberyard/blob/f85344403c1c2e77ec8c75deb2c116e97b713217/dev/Tools/Python/3.7.10/mac/Python.framework/Versions/3.7/lib/python3.7/shutil.py#L282-L369 | |
tensorflow/tensorflow | 419e3a6b650ea4bd1b0cba23c4348f8a69f3272e | tensorflow/python/util/traceback_utils.py | python | is_traceback_filtering_enabled | () | return value | Check whether traceback filtering is currently enabled.
See also `tf.debugging.enable_traceback_filtering()` and
`tf.debugging.disable_traceback_filtering()`. Note that filtering out
internal frames from the tracebacks of exceptions raised by TensorFlow code
is the default behavior.
Returns:
True if tra... | Check whether traceback filtering is currently enabled. | [
"Check",
"whether",
"traceback",
"filtering",
"is",
"currently",
"enabled",
"."
] | def is_traceback_filtering_enabled():
"""Check whether traceback filtering is currently enabled.
See also `tf.debugging.enable_traceback_filtering()` and
`tf.debugging.disable_traceback_filtering()`. Note that filtering out
internal frames from the tracebacks of exceptions raised by TensorFlow code
is the de... | [
"def",
"is_traceback_filtering_enabled",
"(",
")",
":",
"value",
"=",
"getattr",
"(",
"_ENABLE_TRACEBACK_FILTERING",
",",
"'value'",
",",
"True",
")",
"return",
"value"
] | https://github.com/tensorflow/tensorflow/blob/419e3a6b650ea4bd1b0cba23c4348f8a69f3272e/tensorflow/python/util/traceback_utils.py#L33-L48 | |
ChromiumWebApps/chromium | c7361d39be8abd1574e6ce8957c8dbddd4c6ccf7 | tools/telemetry/telemetry/core/platform/proc_supporting_platform_backend.py | python | ProcSupportingPlatformBackend._GetProcJiffies | (self, timer_list) | Parse '/proc/timer_list' output and returns the first jiffies attribute.
Multi-CPU machines will have multiple 'jiffies:' lines, all of which will be
essentially the same. Return the first one. | Parse '/proc/timer_list' output and returns the first jiffies attribute. | [
"Parse",
"/",
"proc",
"/",
"timer_list",
"output",
"and",
"returns",
"the",
"first",
"jiffies",
"attribute",
"."
] | def _GetProcJiffies(self, timer_list):
"""Parse '/proc/timer_list' output and returns the first jiffies attribute.
Multi-CPU machines will have multiple 'jiffies:' lines, all of which will be
essentially the same. Return the first one."""
if isinstance(timer_list, str):
timer_list = timer_list.s... | [
"def",
"_GetProcJiffies",
"(",
"self",
",",
"timer_list",
")",
":",
"if",
"isinstance",
"(",
"timer_list",
",",
"str",
")",
":",
"timer_list",
"=",
"timer_list",
".",
"splitlines",
"(",
")",
"for",
"line",
"in",
"timer_list",
":",
"if",
"line",
".",
"sta... | https://github.com/ChromiumWebApps/chromium/blob/c7361d39be8abd1574e6ce8957c8dbddd4c6ccf7/tools/telemetry/telemetry/core/platform/proc_supporting_platform_backend.py#L103-L114 | ||
aws/lumberyard | f85344403c1c2e77ec8c75deb2c116e97b713217 | dev/Gems/CloudGemMetric/v1/AWS/common-code/Lib/fsspec/spec.py | python | AbstractFileSystem.start_transaction | (self) | return self.transaction | Begin write transaction for deferring files, non-context version | Begin write transaction for deferring files, non-context version | [
"Begin",
"write",
"transaction",
"for",
"deferring",
"files",
"non",
"-",
"context",
"version"
] | def start_transaction(self):
"""Begin write transaction for deferring files, non-context version"""
self._intrans = True
self._transaction = Transaction(self)
return self.transaction | [
"def",
"start_transaction",
"(",
"self",
")",
":",
"self",
".",
"_intrans",
"=",
"True",
"self",
".",
"_transaction",
"=",
"Transaction",
"(",
"self",
")",
"return",
"self",
".",
"transaction"
] | https://github.com/aws/lumberyard/blob/f85344403c1c2e77ec8c75deb2c116e97b713217/dev/Gems/CloudGemMetric/v1/AWS/common-code/Lib/fsspec/spec.py#L197-L201 | |
GJDuck/LowFat | ecf6a0f0fa1b73a27a626cf493cc39e477b6faea | llvm-4.0.0.src/examples/Kaleidoscope/MCJIT/lazy/genk-timing.py | python | KScriptGenerator.updateCalledFunctionList | (self, callee) | Maintains a list of functions that will actually be called | Maintains a list of functions that will actually be called | [
"Maintains",
"a",
"list",
"of",
"functions",
"that",
"will",
"actually",
"be",
"called"
] | def updateCalledFunctionList(self, callee):
"""Maintains a list of functions that will actually be called"""
# Update the total call count
self.updateTotalCallCount(callee)
# If this function is already in the list, don't do anything else
if callee in self.calledFunctions:
... | [
"def",
"updateCalledFunctionList",
"(",
"self",
",",
"callee",
")",
":",
"# Update the total call count",
"self",
".",
"updateTotalCallCount",
"(",
"callee",
")",
"# If this function is already in the list, don't do anything else",
"if",
"callee",
"in",
"self",
".",
"called... | https://github.com/GJDuck/LowFat/blob/ecf6a0f0fa1b73a27a626cf493cc39e477b6faea/llvm-4.0.0.src/examples/Kaleidoscope/MCJIT/lazy/genk-timing.py#L66-L78 | ||
wlanjie/AndroidFFmpeg | 7baf9122f4b8e1c74e7baf4be5c422c7a5ba5aaf | tools/fdk-aac-build/armeabi-v7a/toolchain/lib/python2.7/mhlib.py | python | Folder.parsesequence | (self, seq) | Parse an MH sequence specification into a message list.
Attempt to mimic mh-sequence(5) as close as possible.
Also attempt to mimic observed behavior regarding which
conditions cause which error messages. | Parse an MH sequence specification into a message list.
Attempt to mimic mh-sequence(5) as close as possible.
Also attempt to mimic observed behavior regarding which
conditions cause which error messages. | [
"Parse",
"an",
"MH",
"sequence",
"specification",
"into",
"a",
"message",
"list",
".",
"Attempt",
"to",
"mimic",
"mh",
"-",
"sequence",
"(",
"5",
")",
"as",
"close",
"as",
"possible",
".",
"Also",
"attempt",
"to",
"mimic",
"observed",
"behavior",
"regardin... | def parsesequence(self, seq):
"""Parse an MH sequence specification into a message list.
Attempt to mimic mh-sequence(5) as close as possible.
Also attempt to mimic observed behavior regarding which
conditions cause which error messages."""
# XXX Still not complete (see mh-format... | [
"def",
"parsesequence",
"(",
"self",
",",
"seq",
")",
":",
"# XXX Still not complete (see mh-format(5)).",
"# Missing are:",
"# - 'prev', 'next' as count",
"# - Sequence-Negation option",
"all",
"=",
"self",
".",
"listmessages",
"(",
")",
"# Observed behavior: test for empty fo... | https://github.com/wlanjie/AndroidFFmpeg/blob/7baf9122f4b8e1c74e7baf4be5c422c7a5ba5aaf/tools/fdk-aac-build/armeabi-v7a/toolchain/lib/python2.7/mhlib.py#L346-L428 | ||
benoitsteiner/tensorflow-opencl | cb7cb40a57fde5cfd4731bc551e82a1e2fef43a5 | tensorflow/python/keras/_impl/keras/applications/mobilenet.py | python | _depthwise_conv_block | (inputs,
pointwise_conv_filters,
alpha,
depth_multiplier=1,
strides=(1, 1),
block_id=1) | return Activation(relu6, name='conv_pw_%d_relu' % block_id)(x) | Adds a depthwise convolution block.
A depthwise convolution block consists of a depthwise conv,
batch normalization, relu6, pointwise convolution,
batch normalization and relu6 activation.
Arguments:
inputs: Input tensor of shape `(rows, cols, channels)`
(with `channels_last` data format) or
... | Adds a depthwise convolution block. | [
"Adds",
"a",
"depthwise",
"convolution",
"block",
"."
] | def _depthwise_conv_block(inputs,
pointwise_conv_filters,
alpha,
depth_multiplier=1,
strides=(1, 1),
block_id=1):
"""Adds a depthwise convolution block.
A depthwise convolution block co... | [
"def",
"_depthwise_conv_block",
"(",
"inputs",
",",
"pointwise_conv_filters",
",",
"alpha",
",",
"depth_multiplier",
"=",
"1",
",",
"strides",
"=",
"(",
"1",
",",
"1",
")",
",",
"block_id",
"=",
"1",
")",
":",
"channel_axis",
"=",
"1",
"if",
"K",
".",
... | https://github.com/benoitsteiner/tensorflow-opencl/blob/cb7cb40a57fde5cfd4731bc551e82a1e2fef43a5/tensorflow/python/keras/_impl/keras/applications/mobilenet.py#L596-L669 | |
cathywu/Sentiment-Analysis | eb501fd1375c0c3f3ab430f963255f1bb858e659 | PyML-0.7.9/PyML/utils/misc.py | python | update | (x, **entries) | Update a dict or an object with according to entries.
>>> update({'a': 1}, a=10, b=20)
{'a': 10, 'b': 20}
>>> update(Struct(a=1), a=10, b=20)
Struct(a=10, b=20) | Update a dict or an object with according to entries.
>>> update({'a': 1}, a=10, b=20)
{'a': 10, 'b': 20}
>>> update(Struct(a=1), a=10, b=20)
Struct(a=10, b=20) | [
"Update",
"a",
"dict",
"or",
"an",
"object",
"with",
"according",
"to",
"entries",
".",
">>>",
"update",
"(",
"{",
"a",
":",
"1",
"}",
"a",
"=",
"10",
"b",
"=",
"20",
")",
"{",
"a",
":",
"10",
"b",
":",
"20",
"}",
">>>",
"update",
"(",
"Struc... | def update(x, **entries):
"""Update a dict or an object with according to entries.
>>> update({'a': 1}, a=10, b=20)
{'a': 10, 'b': 20}
>>> update(Struct(a=1), a=10, b=20)
Struct(a=10, b=20)
"""
if isinstance(x, dict):
x.update(entries)
else :
for attribute in entries :... | [
"def",
"update",
"(",
"x",
",",
"*",
"*",
"entries",
")",
":",
"if",
"isinstance",
"(",
"x",
",",
"dict",
")",
":",
"x",
".",
"update",
"(",
"entries",
")",
"else",
":",
"for",
"attribute",
"in",
"entries",
":",
"setattr",
"(",
"x",
",",
"attribu... | https://github.com/cathywu/Sentiment-Analysis/blob/eb501fd1375c0c3f3ab430f963255f1bb858e659/PyML-0.7.9/PyML/utils/misc.py#L676-L687 | ||
facebook/proxygen | a9ca025af207787815cb01eee1971cd572c7a81e | build/fbcode_builder/getdeps/manifest.py | python | ManifestParser.is_first_party_project | (self) | return self.shipit_project is not None | returns true if this is an FB first-party project | returns true if this is an FB first-party project | [
"returns",
"true",
"if",
"this",
"is",
"an",
"FB",
"first",
"-",
"party",
"project"
] | def is_first_party_project(self):
"""returns true if this is an FB first-party project"""
return self.shipit_project is not None | [
"def",
"is_first_party_project",
"(",
"self",
")",
":",
"return",
"self",
".",
"shipit_project",
"is",
"not",
"None"
] | https://github.com/facebook/proxygen/blob/a9ca025af207787815cb01eee1971cd572c7a81e/build/fbcode_builder/getdeps/manifest.py#L354-L356 | |
bulletphysics/bullet3 | f0f2a952e146f016096db6f85cf0c44ed75b0b9a | examples/pybullet/gym/pybullet_envs/minitaur/envs/minitaur.py | python | Minitaur._ResetPoseForLeg | (self, leg_id, add_constraint) | Reset the initial pose for the leg.
Args:
leg_id: It should be 0, 1, 2, or 3, which represents the leg at
front_left, back_left, front_right and back_right.
add_constraint: Whether to add a constraint at the joints of two feet. | Reset the initial pose for the leg. | [
"Reset",
"the",
"initial",
"pose",
"for",
"the",
"leg",
"."
] | def _ResetPoseForLeg(self, leg_id, add_constraint):
"""Reset the initial pose for the leg.
Args:
leg_id: It should be 0, 1, 2, or 3, which represents the leg at
front_left, back_left, front_right and back_right.
add_constraint: Whether to add a constraint at the joints of two feet.
"""
... | [
"def",
"_ResetPoseForLeg",
"(",
"self",
",",
"leg_id",
",",
"add_constraint",
")",
":",
"knee_friction_force",
"=",
"0",
"half_pi",
"=",
"math",
".",
"pi",
"/",
"2.0",
"knee_angle",
"=",
"-",
"2.1834",
"leg_position",
"=",
"LEG_POSITION",
"[",
"leg_id",
"]",... | https://github.com/bulletphysics/bullet3/blob/f0f2a952e146f016096db6f85cf0c44ed75b0b9a/examples/pybullet/gym/pybullet_envs/minitaur/envs/minitaur.py#L345-L417 | ||
miyosuda/TensorFlowAndroidDemo | 35903e0221aa5f109ea2dbef27f20b52e317f42d | jni-build/jni/include/tensorflow/python/ops/math_ops.py | python | imag | (input, name=None) | Returns the imaginary part of a complex number.
Given a tensor `input` of complex numbers, this operation returns a tensor of
type `float32` or `float64` that is the imaginary part of each element in
`input`. All elements in `input` must be complex numbers of the form \\(a +
bj\\), where *a* is the real part a... | Returns the imaginary part of a complex number. | [
"Returns",
"the",
"imaginary",
"part",
"of",
"a",
"complex",
"number",
"."
] | def imag(input, name=None):
"""Returns the imaginary part of a complex number.
Given a tensor `input` of complex numbers, this operation returns a tensor of
type `float32` or `float64` that is the imaginary part of each element in
`input`. All elements in `input` must be complex numbers of the form \\(a +
bj... | [
"def",
"imag",
"(",
"input",
",",
"name",
"=",
"None",
")",
":",
"with",
"ops",
".",
"op_scope",
"(",
"[",
"input",
"]",
",",
"name",
",",
"\"Imag\"",
")",
"as",
"name",
":",
"return",
"gen_math_ops",
".",
"imag",
"(",
"input",
",",
"Tout",
"=",
... | https://github.com/miyosuda/TensorFlowAndroidDemo/blob/35903e0221aa5f109ea2dbef27f20b52e317f42d/jni-build/jni/include/tensorflow/python/ops/math_ops.py#L536-L560 | ||
wxWidgets/wxPython-Classic | 19571e1ae65f1ac445f5491474121998c97a1bf0 | wx/lib/agw/aui/auibar.py | python | AuiToolBar.OnIdle | (self, event) | Handles the ``wx.EVT_IDLE`` event for :class:`AuiToolBar`.
:param `event`: a :class:`IdleEvent` event to be processed. | Handles the ``wx.EVT_IDLE`` event for :class:`AuiToolBar`. | [
"Handles",
"the",
"wx",
".",
"EVT_IDLE",
"event",
"for",
":",
"class",
":",
"AuiToolBar",
"."
] | def OnIdle(self, event):
"""
Handles the ``wx.EVT_IDLE`` event for :class:`AuiToolBar`.
:param `event`: a :class:`IdleEvent` event to be processed.
"""
self.DoIdleUpdate()
event.Skip() | [
"def",
"OnIdle",
"(",
"self",
",",
"event",
")",
":",
"self",
".",
"DoIdleUpdate",
"(",
")",
"event",
".",
"Skip",
"(",
")"
] | https://github.com/wxWidgets/wxPython-Classic/blob/19571e1ae65f1ac445f5491474121998c97a1bf0/wx/lib/agw/aui/auibar.py#L3390-L3398 | ||
gimli-org/gimli | 17aa2160de9b15ababd9ef99e89b1bc3277bbb23 | pygimli/frameworks/methodManager.py | python | MethodManager.checkData | (self, data) | return data | Overwrite for special checks to return data values | Overwrite for special checks to return data values | [
"Overwrite",
"for",
"special",
"checks",
"to",
"return",
"data",
"values"
] | def checkData(self, data):
"""Overwrite for special checks to return data values"""
# if self._dataToken == 'nan':
# pg.critical('self._dataToken nan, should be set in class', self)
# return data(self._dataToken)
return data | [
"def",
"checkData",
"(",
"self",
",",
"data",
")",
":",
"# if self._dataToken == 'nan':",
"# pg.critical('self._dataToken nan, should be set in class', self)",
"# return data(self._dataToken)",
"return",
"data"
] | https://github.com/gimli-org/gimli/blob/17aa2160de9b15ababd9ef99e89b1bc3277bbb23/pygimli/frameworks/methodManager.py#L312-L317 | |
FEniCS/dolfinx | 3dfdf038cccdb70962865b58a63bf29c2e55ec6e | python/dolfinx/io.py | python | extract_gmsh_geometry | (gmsh_model, model_name=None) | return points[perm_sort] | For a given gmsh model, extract the mesh geometry as a numpy
(N,3) array where the i-th row corresponds to the i-th node in the
mesh. | For a given gmsh model, extract the mesh geometry as a numpy
(N,3) array where the i-th row corresponds to the i-th node in the
mesh. | [
"For",
"a",
"given",
"gmsh",
"model",
"extract",
"the",
"mesh",
"geometry",
"as",
"a",
"numpy",
"(",
"N",
"3",
")",
"array",
"where",
"the",
"i",
"-",
"th",
"row",
"corresponds",
"to",
"the",
"i",
"-",
"th",
"node",
"in",
"the",
"mesh",
"."
] | def extract_gmsh_geometry(gmsh_model, model_name=None):
"""For a given gmsh model, extract the mesh geometry as a numpy
(N,3) array where the i-th row corresponds to the i-th node in the
mesh.
"""
if model_name is not None:
gmsh_model.setCurrent(model_name)
# Get the unique tag and coo... | [
"def",
"extract_gmsh_geometry",
"(",
"gmsh_model",
",",
"model_name",
"=",
"None",
")",
":",
"if",
"model_name",
"is",
"not",
"None",
":",
"gmsh_model",
".",
"setCurrent",
"(",
"model_name",
")",
"# Get the unique tag and coordinates for nodes",
"# in mesh",
"indices"... | https://github.com/FEniCS/dolfinx/blob/3dfdf038cccdb70962865b58a63bf29c2e55ec6e/python/dolfinx/io.py#L130-L150 | |
y123456yz/reading-and-annotate-mongodb-3.6 | 93280293672ca7586dc24af18132aa61e4ed7fcf | mongo/src/third_party/scons-2.5.0/scons-local-2.5.0/SCons/Node/FS.py | python | sconsign_dir | (node) | return node._sconsign | Return the .sconsign file info for this directory,
creating it first if necessary. | Return the .sconsign file info for this directory,
creating it first if necessary. | [
"Return",
"the",
".",
"sconsign",
"file",
"info",
"for",
"this",
"directory",
"creating",
"it",
"first",
"if",
"necessary",
"."
] | def sconsign_dir(node):
"""Return the .sconsign file info for this directory,
creating it first if necessary."""
if not node._sconsign:
import SCons.SConsign
node._sconsign = SCons.SConsign.ForDirectory(node)
return node._sconsign | [
"def",
"sconsign_dir",
"(",
"node",
")",
":",
"if",
"not",
"node",
".",
"_sconsign",
":",
"import",
"SCons",
".",
"SConsign",
"node",
".",
"_sconsign",
"=",
"SCons",
".",
"SConsign",
".",
"ForDirectory",
"(",
"node",
")",
"return",
"node",
".",
"_sconsig... | https://github.com/y123456yz/reading-and-annotate-mongodb-3.6/blob/93280293672ca7586dc24af18132aa61e4ed7fcf/mongo/src/third_party/scons-2.5.0/scons-local-2.5.0/SCons/Node/FS.py#L74-L80 | |
ApolloAuto/apollo-platform | 86d9dc6743b496ead18d597748ebabd34a513289 | ros/ros_comm/rosbag/src/rosbag/bag.py | python | Bag.reindex | (self) | return self._reader.reindex() | Reindexes the bag file. Yields position of each chunk for progress. | Reindexes the bag file. Yields position of each chunk for progress. | [
"Reindexes",
"the",
"bag",
"file",
".",
"Yields",
"position",
"of",
"each",
"chunk",
"for",
"progress",
"."
] | def reindex(self):
"""
Reindexes the bag file. Yields position of each chunk for progress.
"""
self._clear_index()
return self._reader.reindex() | [
"def",
"reindex",
"(",
"self",
")",
":",
"self",
".",
"_clear_index",
"(",
")",
"return",
"self",
".",
"_reader",
".",
"reindex",
"(",
")"
] | https://github.com/ApolloAuto/apollo-platform/blob/86d9dc6743b496ead18d597748ebabd34a513289/ros/ros_comm/rosbag/src/rosbag/bag.py#L408-L413 | |
adobe/chromium | cfe5bf0b51b1f6b9fe239c2a3c2f2364da9967d7 | third_party/protobuf/python/google/protobuf/internal/decoder.py | python | _EndGroup | (buffer, pos, end) | return -1 | Skipping an END_GROUP tag returns -1 to tell the parent loop to break. | Skipping an END_GROUP tag returns -1 to tell the parent loop to break. | [
"Skipping",
"an",
"END_GROUP",
"tag",
"returns",
"-",
"1",
"to",
"tell",
"the",
"parent",
"loop",
"to",
"break",
"."
] | def _EndGroup(buffer, pos, end):
"""Skipping an END_GROUP tag returns -1 to tell the parent loop to break."""
return -1 | [
"def",
"_EndGroup",
"(",
"buffer",
",",
"pos",
",",
"end",
")",
":",
"return",
"-",
"1"
] | https://github.com/adobe/chromium/blob/cfe5bf0b51b1f6b9fe239c2a3c2f2364da9967d7/third_party/protobuf/python/google/protobuf/internal/decoder.py#L663-L666 | |
catboost/catboost | 167f64f237114a4d10b2b4ee42adb4569137debe | contrib/python/scipy/py2/scipy/stats/_distn_infrastructure.py | python | _expect | (fun, lb, ub, x0, inc, maxcount=1000, tolerance=1e-10,
chunksize=32) | return tot | Helper for computing the expectation value of `fun`. | Helper for computing the expectation value of `fun`. | [
"Helper",
"for",
"computing",
"the",
"expectation",
"value",
"of",
"fun",
"."
] | def _expect(fun, lb, ub, x0, inc, maxcount=1000, tolerance=1e-10,
chunksize=32):
"""Helper for computing the expectation value of `fun`."""
# short-circuit if the support size is small enough
if (ub - lb) <= chunksize:
supp = np.arange(lb, ub+1, inc)
vals = fun(supp)
ret... | [
"def",
"_expect",
"(",
"fun",
",",
"lb",
",",
"ub",
",",
"x0",
",",
"inc",
",",
"maxcount",
"=",
"1000",
",",
"tolerance",
"=",
"1e-10",
",",
"chunksize",
"=",
"32",
")",
":",
"# short-circuit if the support size is small enough",
"if",
"(",
"ub",
"-",
"... | https://github.com/catboost/catboost/blob/167f64f237114a4d10b2b4ee42adb4569137debe/contrib/python/scipy/py2/scipy/stats/_distn_infrastructure.py#L3256-L3295 | |
pmq20/node-packer | 12c46c6e44fbc14d9ee645ebd17d5296b324f7e0 | lts/deps/v8/third_party/jinja2/compiler.py | python | CodeGenerator.write_commons | (self) | Writes a common preamble that is used by root and block functions.
Primarily this sets up common local helpers and enforces a generator
through a dead branch. | Writes a common preamble that is used by root and block functions.
Primarily this sets up common local helpers and enforces a generator
through a dead branch. | [
"Writes",
"a",
"common",
"preamble",
"that",
"is",
"used",
"by",
"root",
"and",
"block",
"functions",
".",
"Primarily",
"this",
"sets",
"up",
"common",
"local",
"helpers",
"and",
"enforces",
"a",
"generator",
"through",
"a",
"dead",
"branch",
"."
] | def write_commons(self):
"""Writes a common preamble that is used by root and block functions.
Primarily this sets up common local helpers and enforces a generator
through a dead branch.
"""
self.writeline('resolve = context.resolve_or_missing')
self.writeline('undefined ... | [
"def",
"write_commons",
"(",
"self",
")",
":",
"self",
".",
"writeline",
"(",
"'resolve = context.resolve_or_missing'",
")",
"self",
".",
"writeline",
"(",
"'undefined = environment.undefined'",
")",
"self",
".",
"writeline",
"(",
"'if 0: yield None'",
")"
] | https://github.com/pmq20/node-packer/blob/12c46c6e44fbc14d9ee645ebd17d5296b324f7e0/lts/deps/v8/third_party/jinja2/compiler.py#L605-L612 | ||
wlanjie/AndroidFFmpeg | 7baf9122f4b8e1c74e7baf4be5c422c7a5ba5aaf | tools/fdk-aac-build/armeabi/toolchain/lib/python2.7/lib-tk/Tkinter.py | python | BaseWidget.destroy | (self) | Destroy this and all descendants widgets. | Destroy this and all descendants widgets. | [
"Destroy",
"this",
"and",
"all",
"descendants",
"widgets",
"."
] | def destroy(self):
"""Destroy this and all descendants widgets."""
for c in self.children.values(): c.destroy()
self.tk.call('destroy', self._w)
if self._name in self.master.children:
del self.master.children[self._name]
Misc.destroy(self) | [
"def",
"destroy",
"(",
"self",
")",
":",
"for",
"c",
"in",
"self",
".",
"children",
".",
"values",
"(",
")",
":",
"c",
".",
"destroy",
"(",
")",
"self",
".",
"tk",
".",
"call",
"(",
"'destroy'",
",",
"self",
".",
"_w",
")",
"if",
"self",
".",
... | https://github.com/wlanjie/AndroidFFmpeg/blob/7baf9122f4b8e1c74e7baf4be5c422c7a5ba5aaf/tools/fdk-aac-build/armeabi/toolchain/lib/python2.7/lib-tk/Tkinter.py#L2039-L2045 | ||
livecode/livecode | 4606a10ea10b16d5071d0f9f263ccdd7ede8b31d | gyp/pylib/gyp/mac_tool.py | python | MacTool._GetCFBundleIdentifier | (self) | return info_plist_data['CFBundleIdentifier'] | Extracts CFBundleIdentifier value from Info.plist in the bundle.
Returns:
Value of CFBundleIdentifier in the Info.plist located in the bundle. | Extracts CFBundleIdentifier value from Info.plist in the bundle. | [
"Extracts",
"CFBundleIdentifier",
"value",
"from",
"Info",
".",
"plist",
"in",
"the",
"bundle",
"."
] | def _GetCFBundleIdentifier(self):
"""Extracts CFBundleIdentifier value from Info.plist in the bundle.
Returns:
Value of CFBundleIdentifier in the Info.plist located in the bundle.
"""
info_plist_path = os.path.join(
os.environ['TARGET_BUILD_DIR'],
os.environ['INFOPLIST_PATH'])
... | [
"def",
"_GetCFBundleIdentifier",
"(",
"self",
")",
":",
"info_plist_path",
"=",
"os",
".",
"path",
".",
"join",
"(",
"os",
".",
"environ",
"[",
"'TARGET_BUILD_DIR'",
"]",
",",
"os",
".",
"environ",
"[",
"'INFOPLIST_PATH'",
"]",
")",
"info_plist_data",
"=",
... | https://github.com/livecode/livecode/blob/4606a10ea10b16d5071d0f9f263ccdd7ede8b31d/gyp/pylib/gyp/mac_tool.py#L541-L551 | |
NVIDIAGameWorks/kaolin | e5148d05e9c1e2ce92a07881ce3593b1c5c3f166 | kaolin/ops/voxelgrid.py | python | extract_surface | (voxelgrids, mode="wide") | return output | r"""Removes any internal structure(s) from a voxelgrids.
Args:
voxelgrids (torch.Tensor): Binary voxelgrids of shape (N, X, Y ,Z)
from which to extract surface
mode (str): Either "wide" or "thin". Each voxel can be seen as a cube in a grid.
"wi... | r"""Removes any internal structure(s) from a voxelgrids. | [
"r",
"Removes",
"any",
"internal",
"structure",
"(",
"s",
")",
"from",
"a",
"voxelgrids",
"."
] | def extract_surface(voxelgrids, mode="wide"):
r"""Removes any internal structure(s) from a voxelgrids.
Args:
voxelgrids (torch.Tensor): Binary voxelgrids of shape (N, X, Y ,Z)
from which to extract surface
mode (str): Either "wide" or "thin". Each voxel can be... | [
"def",
"extract_surface",
"(",
"voxelgrids",
",",
"mode",
"=",
"\"wide\"",
")",
":",
"voxelgrids",
"=",
"_force_float",
"(",
"voxelgrids",
")",
"if",
"voxelgrids",
".",
"ndim",
"!=",
"4",
":",
"voxelgrids_dim",
"=",
"voxelgrids",
".",
"ndim",
"raise",
"Value... | https://github.com/NVIDIAGameWorks/kaolin/blob/e5148d05e9c1e2ce92a07881ce3593b1c5c3f166/kaolin/ops/voxelgrid.py#L92-L140 | |
catboost/catboost | 167f64f237114a4d10b2b4ee42adb4569137debe | contrib/python/protobuf/py3/google/protobuf/service.py | python | RpcController.Failed | (self) | Returns true if the call failed.
After a call has finished, returns true if the call failed. The possible
reasons for failure depend on the RPC implementation. Failed() must not
be called before a call has finished. If Failed() returns true, the
contents of the response message are undefined. | Returns true if the call failed. | [
"Returns",
"true",
"if",
"the",
"call",
"failed",
"."
] | def Failed(self):
"""Returns true if the call failed.
After a call has finished, returns true if the call failed. The possible
reasons for failure depend on the RPC implementation. Failed() must not
be called before a call has finished. If Failed() returns true, the
contents of the response mess... | [
"def",
"Failed",
"(",
"self",
")",
":",
"raise",
"NotImplementedError"
] | https://github.com/catboost/catboost/blob/167f64f237114a4d10b2b4ee42adb4569137debe/contrib/python/protobuf/py3/google/protobuf/service.py#L142-L150 | ||
ApolloAuto/apollo-platform | 86d9dc6743b496ead18d597748ebabd34a513289 | ros/ros_comm/rospy/src/rospy/topics.py | python | _SubscriberImpl.set_buff_size | (self, buff_size) | Set the receive buffer size. The exact meaning of this is
transport dependent.
@param buff_size: receive buffer size
@type buff_size: int | Set the receive buffer size. The exact meaning of this is
transport dependent. | [
"Set",
"the",
"receive",
"buffer",
"size",
".",
"The",
"exact",
"meaning",
"of",
"this",
"is",
"transport",
"dependent",
"."
] | def set_buff_size(self, buff_size):
"""
Set the receive buffer size. The exact meaning of this is
transport dependent.
@param buff_size: receive buffer size
@type buff_size: int
"""
if type(buff_size) != int:
raise ROSException("buffer size must be an... | [
"def",
"set_buff_size",
"(",
"self",
",",
"buff_size",
")",
":",
"if",
"type",
"(",
"buff_size",
")",
"!=",
"int",
":",
"raise",
"ROSException",
"(",
"\"buffer size must be an integer\"",
")",
"elif",
"buff_size",
"<=",
"0",
":",
"raise",
"ROSException",
"(",
... | https://github.com/ApolloAuto/apollo-platform/blob/86d9dc6743b496ead18d597748ebabd34a513289/ros/ros_comm/rospy/src/rospy/topics.py#L657-L668 | ||
amd/OpenCL-caffe | 638543108517265366c18ae5821f3096cf5cf34a | python/caffe/io.py | python | array_to_blobproto | (arr, diff=None) | return blob | Converts a 4-dimensional array to blob proto. If diff is given, also
convert the diff. You need to make sure that arr and diff have the same
shape, and this function does not do sanity check. | Converts a 4-dimensional array to blob proto. If diff is given, also
convert the diff. You need to make sure that arr and diff have the same
shape, and this function does not do sanity check. | [
"Converts",
"a",
"4",
"-",
"dimensional",
"array",
"to",
"blob",
"proto",
".",
"If",
"diff",
"is",
"given",
"also",
"convert",
"the",
"diff",
".",
"You",
"need",
"to",
"make",
"sure",
"that",
"arr",
"and",
"diff",
"have",
"the",
"same",
"shape",
"and",... | def array_to_blobproto(arr, diff=None):
"""Converts a 4-dimensional array to blob proto. If diff is given, also
convert the diff. You need to make sure that arr and diff have the same
shape, and this function does not do sanity check.
"""
if arr.ndim != 4:
raise ValueError('Incorrect array s... | [
"def",
"array_to_blobproto",
"(",
"arr",
",",
"diff",
"=",
"None",
")",
":",
"if",
"arr",
".",
"ndim",
"!=",
"4",
":",
"raise",
"ValueError",
"(",
"'Incorrect array shape.'",
")",
"blob",
"=",
"caffe_pb2",
".",
"BlobProto",
"(",
")",
"blob",
".",
"num",
... | https://github.com/amd/OpenCL-caffe/blob/638543108517265366c18ae5821f3096cf5cf34a/python/caffe/io.py#L31-L43 | |
BlzFans/wke | b0fa21158312e40c5fbd84682d643022b6c34a93 | cygwin/lib/python2.6/ssl.py | python | SSLSocket.do_handshake | (self) | Perform a TLS/SSL handshake. | Perform a TLS/SSL handshake. | [
"Perform",
"a",
"TLS",
"/",
"SSL",
"handshake",
"."
] | def do_handshake(self):
"""Perform a TLS/SSL handshake."""
self._sslobj.do_handshake() | [
"def",
"do_handshake",
"(",
"self",
")",
":",
"self",
".",
"_sslobj",
".",
"do_handshake",
"(",
")"
] | https://github.com/BlzFans/wke/blob/b0fa21158312e40c5fbd84682d643022b6c34a93/cygwin/lib/python2.6/ssl.py#L289-L293 | ||
FreeCAD/FreeCAD | ba42231b9c6889b89e064d6d563448ed81e376ec | src/Mod/Draft/drafttaskpanels/task_scale.py | python | ScaleTaskPanel.setValue | (self, val=None) | Set the value of the points. | Set the value of the points. | [
"Set",
"the",
"value",
"of",
"the",
"points",
"."
] | def setValue(self, val=None):
"""Set the value of the points."""
if self.lock.isChecked():
if not self.xValue.hasFocus():
self.xValue.setValue(val)
if not self.yValue.hasFocus():
self.yValue.setValue(val)
if not self.zValue.hasFocus():
... | [
"def",
"setValue",
"(",
"self",
",",
"val",
"=",
"None",
")",
":",
"if",
"self",
".",
"lock",
".",
"isChecked",
"(",
")",
":",
"if",
"not",
"self",
".",
"xValue",
".",
"hasFocus",
"(",
")",
":",
"self",
".",
"xValue",
".",
"setValue",
"(",
"val",... | https://github.com/FreeCAD/FreeCAD/blob/ba42231b9c6889b89e064d6d563448ed81e376ec/src/Mod/Draft/drafttaskpanels/task_scale.py#L137-L147 | ||
wxWidgets/wxPython-Classic | 19571e1ae65f1ac445f5491474121998c97a1bf0 | wx/lib/analogclock/analogclock.py | python | AnalogClock.GetTickSize | (self, target=ALL) | return self.Box.GetTickSize(target) | Gets sizes of ticks. | Gets sizes of ticks. | [
"Gets",
"sizes",
"of",
"ticks",
"."
] | def GetTickSize(self, target=ALL):
"""Gets sizes of ticks."""
return self.Box.GetTickSize(target) | [
"def",
"GetTickSize",
"(",
"self",
",",
"target",
"=",
"ALL",
")",
":",
"return",
"self",
".",
"Box",
".",
"GetTickSize",
"(",
"target",
")"
] | https://github.com/wxWidgets/wxPython-Classic/blob/19571e1ae65f1ac445f5491474121998c97a1bf0/wx/lib/analogclock/analogclock.py#L231-L234 | |
hanpfei/chromium-net | 392cc1fa3a8f92f42e4071ab6e674d8e0482f83f | third_party/catapult/third_party/gsutil/gslib/copy_helper.py | python | _CompressFileForUpload | (src_url, src_obj_filestream, src_obj_size, logger) | return StorageUrlFromString(gzip_path), gzip_size | Compresses a to-be-uploaded local file to save bandwidth.
Args:
src_url: Source FileUrl.
src_obj_filestream: Read stream of the source file - will be consumed
and closed.
src_obj_size: Size of the source file.
logger: for outputting log messages.
Returns:
StorageUrl pat... | Compresses a to-be-uploaded local file to save bandwidth. | [
"Compresses",
"a",
"to",
"-",
"be",
"-",
"uploaded",
"local",
"file",
"to",
"save",
"bandwidth",
"."
] | def _CompressFileForUpload(src_url, src_obj_filestream, src_obj_size, logger):
"""Compresses a to-be-uploaded local file to save bandwidth.
Args:
src_url: Source FileUrl.
src_obj_filestream: Read stream of the source file - will be consumed
and closed.
src_obj_size: Size of the ... | [
"def",
"_CompressFileForUpload",
"(",
"src_url",
",",
"src_obj_filestream",
",",
"src_obj_size",
",",
"logger",
")",
":",
"# TODO: Compress using a streaming model as opposed to all at once here.",
"if",
"src_obj_size",
">=",
"MIN_SIZE_COMPUTE_LOGGING",
":",
"logger",
".",
"i... | https://github.com/hanpfei/chromium-net/blob/392cc1fa3a8f92f42e4071ab6e674d8e0482f83f/third_party/catapult/third_party/gsutil/gslib/copy_helper.py#L1488-L1526 | |
blackberry/Boost | fc90c3fde129c62565c023f091eddc4a7ed9902b | tools/build/v2/build/property_set.py | python | PropertySet.add | (self, ps) | return self.added_[ps] | Creates a new property set containing the properties in this one,
plus the ones of the property set passed as argument. | Creates a new property set containing the properties in this one,
plus the ones of the property set passed as argument. | [
"Creates",
"a",
"new",
"property",
"set",
"containing",
"the",
"properties",
"in",
"this",
"one",
"plus",
"the",
"ones",
"of",
"the",
"property",
"set",
"passed",
"as",
"argument",
"."
] | def add (self, ps):
""" Creates a new property set containing the properties in this one,
plus the ones of the property set passed as argument.
"""
if not self.added_.has_key(ps):
self.added_[ps] = create(self.all_ + ps.all())
return self.added_[ps] | [
"def",
"add",
"(",
"self",
",",
"ps",
")",
":",
"if",
"not",
"self",
".",
"added_",
".",
"has_key",
"(",
"ps",
")",
":",
"self",
".",
"added_",
"[",
"ps",
"]",
"=",
"create",
"(",
"self",
".",
"all_",
"+",
"ps",
".",
"all",
"(",
")",
")",
"... | https://github.com/blackberry/Boost/blob/fc90c3fde129c62565c023f091eddc4a7ed9902b/tools/build/v2/build/property_set.py#L401-L407 | |
apple/turicreate | cce55aa5311300e3ce6af93cb45ba791fd1bdf49 | src/python/turicreate/meta/asttools/visitors/graph_visitor.py | python | make_graph | (node, call_deps=False) | return gen.graph, gen.undefined | Create a dependency graph from an ast node.
:param node: ast node.
:param call_deps: if true, then the graph will create a cyclic dependence for all
function calls. (i.e for `a.b(c)` a depends on b and b depends on a)
:returns: a tuple of (graph, undefined) | Create a dependency graph from an ast node. | [
"Create",
"a",
"dependency",
"graph",
"from",
"an",
"ast",
"node",
"."
] | def make_graph(node, call_deps=False):
"""
Create a dependency graph from an ast node.
:param node: ast node.
:param call_deps: if true, then the graph will create a cyclic dependence for all
function calls. (i.e for `a.b(c)` a depends on b and b depends on a)
:returns: a tup... | [
"def",
"make_graph",
"(",
"node",
",",
"call_deps",
"=",
"False",
")",
":",
"gen",
"=",
"GraphGen",
"(",
"call_deps",
"=",
"call_deps",
")",
"gen",
".",
"visit",
"(",
"node",
")",
"return",
"gen",
".",
"graph",
",",
"gen",
".",
"undefined"
] | https://github.com/apple/turicreate/blob/cce55aa5311300e3ce6af93cb45ba791fd1bdf49/src/python/turicreate/meta/asttools/visitors/graph_visitor.py#L392-L406 | |
LiquidPlayer/LiquidCore | 9405979363f2353ac9a71ad8ab59685dd7f919c9 | deps/node-10.15.3/tools/gyp/pylib/gyp/generator/msvs.py | python | _GetLibraryDirs | (config) | return library_dirs | Returns the list of directories to be used for library search paths.
Arguments:
config: The dictionary that defines the special processing to be done
for this configuration.
Returns:
The list of directory paths. | Returns the list of directories to be used for library search paths. | [
"Returns",
"the",
"list",
"of",
"directories",
"to",
"be",
"used",
"for",
"library",
"search",
"paths",
"."
] | def _GetLibraryDirs(config):
"""Returns the list of directories to be used for library search paths.
Arguments:
config: The dictionary that defines the special processing to be done
for this configuration.
Returns:
The list of directory paths.
"""
library_dirs = config.get('library_dirs'... | [
"def",
"_GetLibraryDirs",
"(",
"config",
")",
":",
"library_dirs",
"=",
"config",
".",
"get",
"(",
"'library_dirs'",
",",
"[",
"]",
")",
"library_dirs",
"=",
"_FixPaths",
"(",
"library_dirs",
")",
"return",
"library_dirs"
] | https://github.com/LiquidPlayer/LiquidCore/blob/9405979363f2353ac9a71ad8ab59685dd7f919c9/deps/node-10.15.3/tools/gyp/pylib/gyp/generator/msvs.py#L1250-L1262 | |
wxWidgets/wxPython-Classic | 19571e1ae65f1ac445f5491474121998c97a1bf0 | src/gtk/aui.py | python | AuiManager.DrawHintRect | (*args, **kwargs) | return _aui.AuiManager_DrawHintRect(*args, **kwargs) | DrawHintRect(self, Window paneWindow, Point pt, Point offset) | DrawHintRect(self, Window paneWindow, Point pt, Point offset) | [
"DrawHintRect",
"(",
"self",
"Window",
"paneWindow",
"Point",
"pt",
"Point",
"offset",
")"
] | def DrawHintRect(*args, **kwargs):
"""DrawHintRect(self, Window paneWindow, Point pt, Point offset)"""
return _aui.AuiManager_DrawHintRect(*args, **kwargs) | [
"def",
"DrawHintRect",
"(",
"*",
"args",
",",
"*",
"*",
"kwargs",
")",
":",
"return",
"_aui",
".",
"AuiManager_DrawHintRect",
"(",
"*",
"args",
",",
"*",
"*",
"kwargs",
")"
] | https://github.com/wxWidgets/wxPython-Classic/blob/19571e1ae65f1ac445f5491474121998c97a1bf0/src/gtk/aui.py#L719-L721 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.