nwo stringlengths 5 86 | sha stringlengths 40 40 | path stringlengths 4 189 | language stringclasses 1
value | identifier stringlengths 1 94 | parameters stringlengths 2 4.03k | argument_list stringclasses 1
value | return_statement stringlengths 0 11.5k | docstring stringlengths 1 33.2k | docstring_summary stringlengths 0 5.15k | docstring_tokens list | function stringlengths 34 151k | function_tokens list | url stringlengths 90 278 |
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
wxWidgets/wxPython-Classic | 19571e1ae65f1ac445f5491474121998c97a1bf0 | src/msw/stc.py | python | StyledTextCtrl.GetTargetStart | (*args, **kwargs) | return _stc.StyledTextCtrl_GetTargetStart(*args, **kwargs) | GetTargetStart(self) -> int
Get the position that starts the target. | GetTargetStart(self) -> int | [
"GetTargetStart",
"(",
"self",
")",
"-",
">",
"int"
] | def GetTargetStart(*args, **kwargs):
"""
GetTargetStart(self) -> int
Get the position that starts the target.
"""
return _stc.StyledTextCtrl_GetTargetStart(*args, **kwargs) | [
"def",
"GetTargetStart",
"(",
"*",
"args",
",",
"*",
"*",
"kwargs",
")",
":",
"return",
"_stc",
".",
"StyledTextCtrl_GetTargetStart",
"(",
"*",
"args",
",",
"*",
"*",
"kwargs",
")"
] | https://github.com/wxWidgets/wxPython-Classic/blob/19571e1ae65f1ac445f5491474121998c97a1bf0/src/msw/stc.py#L3722-L3728 | |
aws/lumberyard | f85344403c1c2e77ec8c75deb2c116e97b713217 | dev/Gems/CloudGemMetric/v1/AWS/common-code/Lib/numba/errors.py | python | NumbaError.patch_message | (self, new_message) | Change the error message to the given new message. | Change the error message to the given new message. | [
"Change",
"the",
"error",
"message",
"to",
"the",
"given",
"new",
"message",
"."
] | def patch_message(self, new_message):
"""
Change the error message to the given new message.
"""
self.args = (new_message,) + self.args[1:] | [
"def",
"patch_message",
"(",
"self",
",",
"new_message",
")",
":",
"self",
".",
"args",
"=",
"(",
"new_message",
",",
")",
"+",
"self",
".",
"args",
"[",
"1",
":",
"]"
] | https://github.com/aws/lumberyard/blob/f85344403c1c2e77ec8c75deb2c116e97b713217/dev/Gems/CloudGemMetric/v1/AWS/common-code/Lib/numba/errors.py#L483-L487 | ||
emlid/Navio | 14b96c83ad57a10580655e3af49c9be1f5fc0ad2 | Python/navio/adafruit_i2c.py | python | Adafruit_I2C.writeList | (self, reg, list) | Writes an array of bytes using I2C format | Writes an array of bytes using I2C format | [
"Writes",
"an",
"array",
"of",
"bytes",
"using",
"I2C",
"format"
] | def writeList(self, reg, list):
"Writes an array of bytes using I2C format"
try:
if self.debug:
print "I2C: Writing list to register 0x%02X:" % reg
print list
self.bus.write_i2c_block_data(self.address, reg, list)
except IOError, err:
return self.errMsg() | [
"def",
"writeList",
"(",
"self",
",",
"reg",
",",
"list",
")",
":",
"try",
":",
"if",
"self",
".",
"debug",
":",
"print",
"\"I2C: Writing list to register 0x%02X:\"",
"%",
"reg",
"print",
"list",
"self",
".",
"bus",
".",
"write_i2c_block_data",
"(",
"self",
... | https://github.com/emlid/Navio/blob/14b96c83ad57a10580655e3af49c9be1f5fc0ad2/Python/navio/adafruit_i2c.py#L88-L96 | ||
hanpfei/chromium-net | 392cc1fa3a8f92f42e4071ab6e674d8e0482f83f | third_party/catapult/telemetry/telemetry/internal/platform/network_controller_backend.py | python | NetworkControllerBackend._StopReplayServer | (self) | Stop the replay server only. | Stop the replay server only. | [
"Stop",
"the",
"replay",
"server",
"only",
"."
] | def _StopReplayServer(self):
"""Stop the replay server only."""
if self._wpr_server:
self._wpr_server.StopServer()
self._wpr_server = None | [
"def",
"_StopReplayServer",
"(",
"self",
")",
":",
"if",
"self",
".",
"_wpr_server",
":",
"self",
".",
"_wpr_server",
".",
"StopServer",
"(",
")",
"self",
".",
"_wpr_server",
"=",
"None"
] | https://github.com/hanpfei/chromium-net/blob/392cc1fa3a8f92f42e4071ab6e674d8e0482f83f/third_party/catapult/telemetry/telemetry/internal/platform/network_controller_backend.py#L217-L221 | ||
ucla-vision/xivo | 1b97bf5a3124e62bf4920429af5bb91c7a6de876 | thirdparty/pybind11/pybind11/setup_helpers.py | python | build_ext.build_extensions | (self) | Build extensions, injecting C++ std for Pybind11Extension if needed. | Build extensions, injecting C++ std for Pybind11Extension if needed. | [
"Build",
"extensions",
"injecting",
"C",
"++",
"std",
"for",
"Pybind11Extension",
"if",
"needed",
"."
] | def build_extensions(self):
"""
Build extensions, injecting C++ std for Pybind11Extension if needed.
"""
for ext in self.extensions:
if hasattr(ext, "_cxx_level") and ext._cxx_level == 0:
# Python 2 syntax - old-style distutils class
ext.__cla... | [
"def",
"build_extensions",
"(",
"self",
")",
":",
"for",
"ext",
"in",
"self",
".",
"extensions",
":",
"if",
"hasattr",
"(",
"ext",
",",
"\"_cxx_level\"",
")",
"and",
"ext",
".",
"_cxx_level",
"==",
"0",
":",
"# Python 2 syntax - old-style distutils class",
"ex... | https://github.com/ucla-vision/xivo/blob/1b97bf5a3124e62bf4920429af5bb91c7a6de876/thirdparty/pybind11/pybind11/setup_helpers.py#L296-L308 | ||
wxWidgets/wxPython-Classic | 19571e1ae65f1ac445f5491474121998c97a1bf0 | src/osx_carbon/_windows.py | python | FindReplaceData.SetReplaceString | (*args, **kwargs) | return _windows_.FindReplaceData_SetReplaceString(*args, **kwargs) | SetReplaceString(self, String str)
Set the replacement string (used as initial value by the dialog). | SetReplaceString(self, String str) | [
"SetReplaceString",
"(",
"self",
"String",
"str",
")"
] | def SetReplaceString(*args, **kwargs):
"""
SetReplaceString(self, String str)
Set the replacement string (used as initial value by the dialog).
"""
return _windows_.FindReplaceData_SetReplaceString(*args, **kwargs) | [
"def",
"SetReplaceString",
"(",
"*",
"args",
",",
"*",
"*",
"kwargs",
")",
":",
"return",
"_windows_",
".",
"FindReplaceData_SetReplaceString",
"(",
"*",
"args",
",",
"*",
"*",
"kwargs",
")"
] | https://github.com/wxWidgets/wxPython-Classic/blob/19571e1ae65f1ac445f5491474121998c97a1bf0/src/osx_carbon/_windows.py#L3927-L3933 | |
ceph/ceph | 959663007321a369c83218414a29bd9dbc8bda3a | qa/tasks/cephfs/mount.py | python | CephFSMount.getfattr | (self, path, attr, **kwargs) | return str(p.stdout.getvalue()) | Wrap getfattr: return the values of a named xattr on one file, or
None if the attribute is not found.
:return: a string | Wrap getfattr: return the values of a named xattr on one file, or
None if the attribute is not found. | [
"Wrap",
"getfattr",
":",
"return",
"the",
"values",
"of",
"a",
"named",
"xattr",
"on",
"one",
"file",
"or",
"None",
"if",
"the",
"attribute",
"is",
"not",
"found",
"."
] | def getfattr(self, path, attr, **kwargs):
"""
Wrap getfattr: return the values of a named xattr on one file, or
None if the attribute is not found.
:return: a string
"""
p = self.run_shell(["getfattr", "--only-values", "-n", attr, path], wait=False, **kwargs)
try... | [
"def",
"getfattr",
"(",
"self",
",",
"path",
",",
"attr",
",",
"*",
"*",
"kwargs",
")",
":",
"p",
"=",
"self",
".",
"run_shell",
"(",
"[",
"\"getfattr\"",
",",
"\"--only-values\"",
",",
"\"-n\"",
",",
"attr",
",",
"path",
"]",
",",
"wait",
"=",
"Fa... | https://github.com/ceph/ceph/blob/959663007321a369c83218414a29bd9dbc8bda3a/qa/tasks/cephfs/mount.py#L1310-L1326 | |
hughperkins/tf-coriander | 970d3df6c11400ad68405f22b0c42a52374e94ca | tensorflow/python/training/coordinator.py | python | LooperThread.__init__ | (self, coord, timer_interval_secs, target=None, args=None,
kwargs=None) | Create a LooperThread.
Args:
coord: A Coordinator.
timer_interval_secs: Time boundaries at which to call Run(), or None
if it should be called back to back.
target: Optional callable object that will be executed in the thread.
args: Optional arguments to pass to `target` when callin... | Create a LooperThread. | [
"Create",
"a",
"LooperThread",
"."
] | def __init__(self, coord, timer_interval_secs, target=None, args=None,
kwargs=None):
"""Create a LooperThread.
Args:
coord: A Coordinator.
timer_interval_secs: Time boundaries at which to call Run(), or None
if it should be called back to back.
target: Optional callable... | [
"def",
"__init__",
"(",
"self",
",",
"coord",
",",
"timer_interval_secs",
",",
"target",
"=",
"None",
",",
"args",
"=",
"None",
",",
"kwargs",
"=",
"None",
")",
":",
"if",
"not",
"isinstance",
"(",
"coord",
",",
"Coordinator",
")",
":",
"raise",
"Value... | https://github.com/hughperkins/tf-coriander/blob/970d3df6c11400ad68405f22b0c42a52374e94ca/tensorflow/python/training/coordinator.py#L415-L443 | ||
natanielruiz/android-yolo | 1ebb54f96a67a20ff83ddfc823ed83a13dc3a47f | jni-build/jni/include/tensorflow/python/framework/ops.py | python | Graph.is_feedable | (self, tensor) | return tensor not in self._unfeedable_tensors | Returns `True` if and only if `tensor` is feedable. | Returns `True` if and only if `tensor` is feedable. | [
"Returns",
"True",
"if",
"and",
"only",
"if",
"tensor",
"is",
"feedable",
"."
] | def is_feedable(self, tensor):
"""Returns `True` if and only if `tensor` is feedable."""
return tensor not in self._unfeedable_tensors | [
"def",
"is_feedable",
"(",
"self",
",",
"tensor",
")",
":",
"return",
"tensor",
"not",
"in",
"self",
".",
"_unfeedable_tensors"
] | https://github.com/natanielruiz/android-yolo/blob/1ebb54f96a67a20ff83ddfc823ed83a13dc3a47f/jni-build/jni/include/tensorflow/python/framework/ops.py#L3416-L3418 | |
wxWidgets/wxPython-Classic | 19571e1ae65f1ac445f5491474121998c97a1bf0 | src/osx_carbon/_controls.py | python | FontPickerCtrl.SetSelectedFont | (*args, **kwargs) | return _controls_.FontPickerCtrl_SetSelectedFont(*args, **kwargs) | SetSelectedFont(self, Font f) | SetSelectedFont(self, Font f) | [
"SetSelectedFont",
"(",
"self",
"Font",
"f",
")"
] | def SetSelectedFont(*args, **kwargs):
"""SetSelectedFont(self, Font f)"""
return _controls_.FontPickerCtrl_SetSelectedFont(*args, **kwargs) | [
"def",
"SetSelectedFont",
"(",
"*",
"args",
",",
"*",
"*",
"kwargs",
")",
":",
"return",
"_controls_",
".",
"FontPickerCtrl_SetSelectedFont",
"(",
"*",
"args",
",",
"*",
"*",
"kwargs",
")"
] | https://github.com/wxWidgets/wxPython-Classic/blob/19571e1ae65f1ac445f5491474121998c97a1bf0/src/osx_carbon/_controls.py#L7252-L7254 | |
Xilinx/Vitis-AI | fc74d404563d9951b57245443c73bef389f3657f | tools/Vitis-AI-Quantizer/vai_q_tensorflow1.x/tensorflow/python/keras/optimizer_v2/optimizer_v2.py | python | _deduplicate_indexed_slices | (values, indices) | return (summed_values, unique_indices) | Sums `values` associated with any non-unique `indices`.
Args:
values: A `Tensor` with rank >= 1.
indices: A one-dimensional integer `Tensor`, indexing into the first
dimension of `values` (as in an IndexedSlices object).
Returns:
A tuple of (`summed_values`, `unique_indices`) where `unique_indic... | Sums `values` associated with any non-unique `indices`. | [
"Sums",
"values",
"associated",
"with",
"any",
"non",
"-",
"unique",
"indices",
"."
] | def _deduplicate_indexed_slices(values, indices):
"""Sums `values` associated with any non-unique `indices`.
Args:
values: A `Tensor` with rank >= 1.
indices: A one-dimensional integer `Tensor`, indexing into the first
dimension of `values` (as in an IndexedSlices object).
Returns:
A tuple of ... | [
"def",
"_deduplicate_indexed_slices",
"(",
"values",
",",
"indices",
")",
":",
"unique_indices",
",",
"new_index_positions",
"=",
"array_ops",
".",
"unique",
"(",
"indices",
")",
"summed_values",
"=",
"math_ops",
".",
"unsorted_segment_sum",
"(",
"values",
",",
"n... | https://github.com/Xilinx/Vitis-AI/blob/fc74d404563d9951b57245443c73bef389f3657f/tools/Vitis-AI-Quantizer/vai_q_tensorflow1.x/tensorflow/python/keras/optimizer_v2/optimizer_v2.py#L56-L73 | |
mongodb/mongo | d8ff665343ad29cf286ee2cf4a1960d29371937b | src/third_party/scons-3.1.2/scons-local-3.1.2/SCons/Environment.py | python | Base.ParseConfig | (self, command, function=None, unique=1) | return function(self, self.backtick(command)) | Use the specified function to parse the output of the command
in order to modify the current environment. The 'command' can
be a string or a list of strings representing a command and
its arguments. 'Function' is an optional argument that takes
the environment, the output of the comman... | Use the specified function to parse the output of the command
in order to modify the current environment. The 'command' can
be a string or a list of strings representing a command and
its arguments. 'Function' is an optional argument that takes
the environment, the output of the comman... | [
"Use",
"the",
"specified",
"function",
"to",
"parse",
"the",
"output",
"of",
"the",
"command",
"in",
"order",
"to",
"modify",
"the",
"current",
"environment",
".",
"The",
"command",
"can",
"be",
"a",
"string",
"or",
"a",
"list",
"of",
"strings",
"represent... | def ParseConfig(self, command, function=None, unique=1):
"""
Use the specified function to parse the output of the command
in order to modify the current environment. The 'command' can
be a string or a list of strings representing a command and
its arguments. 'Function' is an o... | [
"def",
"ParseConfig",
"(",
"self",
",",
"command",
",",
"function",
"=",
"None",
",",
"unique",
"=",
"1",
")",
":",
"if",
"function",
"is",
"None",
":",
"def",
"parse_conf",
"(",
"env",
",",
"cmd",
",",
"unique",
"=",
"unique",
")",
":",
"return",
... | https://github.com/mongodb/mongo/blob/d8ff665343ad29cf286ee2cf4a1960d29371937b/src/third_party/scons-3.1.2/scons-local-3.1.2/SCons/Environment.py#L1573-L1591 | |
wxWidgets/wxPython-Classic | 19571e1ae65f1ac445f5491474121998c97a1bf0 | src/osx_cocoa/calendar.py | python | CalendarCtrlBase.EnableHolidayDisplay | (*args, **kwargs) | return _calendar.CalendarCtrlBase_EnableHolidayDisplay(*args, **kwargs) | EnableHolidayDisplay(self, bool display=True)
This function should be used instead of changing CAL_SHOW_HOLIDAYS
style bit directly. It enables or disables the special highlighting of
the holidays. | EnableHolidayDisplay(self, bool display=True) | [
"EnableHolidayDisplay",
"(",
"self",
"bool",
"display",
"=",
"True",
")"
] | def EnableHolidayDisplay(*args, **kwargs):
"""
EnableHolidayDisplay(self, bool display=True)
This function should be used instead of changing CAL_SHOW_HOLIDAYS
style bit directly. It enables or disables the special highlighting of
the holidays.
"""
return _calend... | [
"def",
"EnableHolidayDisplay",
"(",
"*",
"args",
",",
"*",
"*",
"kwargs",
")",
":",
"return",
"_calendar",
".",
"CalendarCtrlBase_EnableHolidayDisplay",
"(",
"*",
"args",
",",
"*",
"*",
"kwargs",
")"
] | https://github.com/wxWidgets/wxPython-Classic/blob/19571e1ae65f1ac445f5491474121998c97a1bf0/src/osx_cocoa/calendar.py#L350-L358 | |
yan99033/CNN-SVO | d5591ea88103f8d1b26e5296129bf3b3196a14f1 | rpg_vikit/vikit_py/src/vikit_py/transformations.py | python | is_same_transform | (matrix0, matrix1) | return numpy.allclose(matrix0, matrix1) | Return True if two matrices perform same transformation.
>>> is_same_transform(numpy.identity(4), numpy.identity(4))
True
>>> is_same_transform(numpy.identity(4), random_rotation_matrix())
False | Return True if two matrices perform same transformation. | [
"Return",
"True",
"if",
"two",
"matrices",
"perform",
"same",
"transformation",
"."
] | def is_same_transform(matrix0, matrix1):
"""Return True if two matrices perform same transformation.
>>> is_same_transform(numpy.identity(4), numpy.identity(4))
True
>>> is_same_transform(numpy.identity(4), random_rotation_matrix())
False
"""
matrix0 = numpy.array(matrix0, dtype=numpy.floa... | [
"def",
"is_same_transform",
"(",
"matrix0",
",",
"matrix1",
")",
":",
"matrix0",
"=",
"numpy",
".",
"array",
"(",
"matrix0",
",",
"dtype",
"=",
"numpy",
".",
"float64",
",",
"copy",
"=",
"True",
")",
"matrix0",
"/=",
"matrix0",
"[",
"3",
",",
"3",
"]... | https://github.com/yan99033/CNN-SVO/blob/d5591ea88103f8d1b26e5296129bf3b3196a14f1/rpg_vikit/vikit_py/src/vikit_py/transformations.py#L1669-L1682 | |
aws/lumberyard | f85344403c1c2e77ec8c75deb2c116e97b713217 | dev/Gems/CloudGemMetric/v1/AWS/python/windows/Lib/numba/cuda/api.py | python | defer_cleanup | () | Temporarily disable memory deallocation.
Use this to prevent resource deallocation breaking asynchronous execution.
For example::
with defer_cleanup():
# all cleanup is deferred in here
do_speed_critical_code()
# cleanup can occur here
Note: this context manager ca... | Temporarily disable memory deallocation.
Use this to prevent resource deallocation breaking asynchronous execution. | [
"Temporarily",
"disable",
"memory",
"deallocation",
".",
"Use",
"this",
"to",
"prevent",
"resource",
"deallocation",
"breaking",
"asynchronous",
"execution",
"."
] | def defer_cleanup():
"""
Temporarily disable memory deallocation.
Use this to prevent resource deallocation breaking asynchronous execution.
For example::
with defer_cleanup():
# all cleanup is deferred in here
do_speed_critical_code()
# cleanup can occur here
... | [
"def",
"defer_cleanup",
"(",
")",
":",
"deallocs",
"=",
"current_context",
"(",
")",
".",
"deallocations",
"with",
"deallocs",
".",
"disable",
"(",
")",
":",
"yield"
] | https://github.com/aws/lumberyard/blob/f85344403c1c2e77ec8c75deb2c116e97b713217/dev/Gems/CloudGemMetric/v1/AWS/python/windows/Lib/numba/cuda/api.py#L394-L410 | ||
idaholab/moose | 9eeebc65e098b4c30f8205fb41591fd5b61eb6ff | python/peacock/Input/BlockInfo.py | python | BlockInfo.renameUserParam | (self, oldname, newname) | Rename a user parameter.
Input:
oldname[str]: Current name of the parameter.
newname[str]: New name of the parameter. | Rename a user parameter.
Input:
oldname[str]: Current name of the parameter.
newname[str]: New name of the parameter. | [
"Rename",
"a",
"user",
"parameter",
".",
"Input",
":",
"oldname",
"[",
"str",
"]",
":",
"Current",
"name",
"of",
"the",
"parameter",
".",
"newname",
"[",
"str",
"]",
":",
"New",
"name",
"of",
"the",
"parameter",
"."
] | def renameUserParam(self, oldname, newname):
"""
Rename a user parameter.
Input:
oldname[str]: Current name of the parameter.
newname[str]: New name of the parameter.
"""
pinfo = self.getParamInfo(oldname)
if pinfo and pinfo.user_added:
... | [
"def",
"renameUserParam",
"(",
"self",
",",
"oldname",
",",
"newname",
")",
":",
"pinfo",
"=",
"self",
".",
"getParamInfo",
"(",
"oldname",
")",
"if",
"pinfo",
"and",
"pinfo",
".",
"user_added",
":",
"del",
"self",
".",
"parameters",
"[",
"oldname",
"]",... | https://github.com/idaholab/moose/blob/9eeebc65e098b4c30f8205fb41591fd5b61eb6ff/python/peacock/Input/BlockInfo.py#L244-L258 | ||
msftguy/ssh-rd | a5f3a79daeac5844edebf01916c9613563f1c390 | _3rd/boost_1_48_0/tools/build/v2/tools/common.py | python | check_init_parameters | (toolset, requirement, *args) | return ['/'.join(condition)] | The rule for checking toolset parameters. Trailing parameters should all be
parameter name/value pairs. The rule will check that each parameter either has
a value in each invocation or has no value in each invocation. Also, the rule
will check that the combination of all parameter values is uniq... | The rule for checking toolset parameters. Trailing parameters should all be
parameter name/value pairs. The rule will check that each parameter either has
a value in each invocation or has no value in each invocation. Also, the rule
will check that the combination of all parameter values is uniq... | [
"The",
"rule",
"for",
"checking",
"toolset",
"parameters",
".",
"Trailing",
"parameters",
"should",
"all",
"be",
"parameter",
"name",
"/",
"value",
"pairs",
".",
"The",
"rule",
"will",
"check",
"that",
"each",
"parameter",
"either",
"has",
"a",
"value",
"in"... | def check_init_parameters(toolset, requirement, *args):
""" The rule for checking toolset parameters. Trailing parameters should all be
parameter name/value pairs. The rule will check that each parameter either has
a value in each invocation or has no value in each invocation. Also, the rule
... | [
"def",
"check_init_parameters",
"(",
"toolset",
",",
"requirement",
",",
"*",
"args",
")",
":",
"# The type checking here is my best guess about",
"# what the types should be.",
"assert",
"(",
"isinstance",
"(",
"toolset",
",",
"str",
")",
")",
"assert",
"(",
"isinsta... | https://github.com/msftguy/ssh-rd/blob/a5f3a79daeac5844edebf01916c9613563f1c390/_3rd/boost_1_48_0/tools/build/v2/tools/common.py#L160-L265 | |
llvm-mirror/lldb | d01083a850f577b85501a0902b52fd0930de72c7 | packages/Python/lldbsuite/support/seven.py | python | unhexlify | (hexstr) | return bitcast_to_string(binascii.unhexlify(hexstr)) | Hex-decode a string. The result is always a string. | Hex-decode a string. The result is always a string. | [
"Hex",
"-",
"decode",
"a",
"string",
".",
"The",
"result",
"is",
"always",
"a",
"string",
"."
] | def unhexlify(hexstr):
"""Hex-decode a string. The result is always a string."""
return bitcast_to_string(binascii.unhexlify(hexstr)) | [
"def",
"unhexlify",
"(",
"hexstr",
")",
":",
"return",
"bitcast_to_string",
"(",
"binascii",
".",
"unhexlify",
"(",
"hexstr",
")",
")"
] | https://github.com/llvm-mirror/lldb/blob/d01083a850f577b85501a0902b52fd0930de72c7/packages/Python/lldbsuite/support/seven.py#L45-L47 | |
rapidsai/cudf | d5b2448fc69f17509304d594f029d0df56984962 | python/cudf/cudf/utils/dtypes.py | python | to_cudf_compatible_scalar | (val, dtype=None) | return val | Converts the value `val` to a numpy/Pandas scalar,
optionally casting to `dtype`.
If `val` is None, returns None. | Converts the value `val` to a numpy/Pandas scalar,
optionally casting to `dtype`. | [
"Converts",
"the",
"value",
"val",
"to",
"a",
"numpy",
"/",
"Pandas",
"scalar",
"optionally",
"casting",
"to",
"dtype",
"."
] | def to_cudf_compatible_scalar(val, dtype=None):
"""
Converts the value `val` to a numpy/Pandas scalar,
optionally casting to `dtype`.
If `val` is None, returns None.
"""
if cudf._lib.scalar._is_null_host_scalar(val) or isinstance(
val, cudf.Scalar
):
return val
if not ... | [
"def",
"to_cudf_compatible_scalar",
"(",
"val",
",",
"dtype",
"=",
"None",
")",
":",
"if",
"cudf",
".",
"_lib",
".",
"scalar",
".",
"_is_null_host_scalar",
"(",
"val",
")",
"or",
"isinstance",
"(",
"val",
",",
"cudf",
".",
"Scalar",
")",
":",
"return",
... | https://github.com/rapidsai/cudf/blob/d5b2448fc69f17509304d594f029d0df56984962/python/cudf/cudf/utils/dtypes.py#L232-L289 | |
PaddlePaddle/Paddle | 1252f4bb3e574df80aa6d18c7ddae1b3a90bd81c | python/paddle/fluid/dygraph/container.py | python | LayerList.append | (self, sublayer) | return self | Appends a sublayer to the end of the list.
Parameters:
sublayer (Layer): sublayer to append
Examples:
.. code-block:: python
import paddle
linears = paddle.nn.LayerList([paddle.nn.Linear(10, 10) for i in range(10)])
another = pa... | Appends a sublayer to the end of the list. | [
"Appends",
"a",
"sublayer",
"to",
"the",
"end",
"of",
"the",
"list",
"."
] | def append(self, sublayer):
"""
Appends a sublayer to the end of the list.
Parameters:
sublayer (Layer): sublayer to append
Examples:
.. code-block:: python
import paddle
linears = paddle.nn.LayerList([paddle.nn.Linear(10, 10) f... | [
"def",
"append",
"(",
"self",
",",
"sublayer",
")",
":",
"self",
".",
"add_sublayer",
"(",
"str",
"(",
"len",
"(",
"self",
")",
")",
",",
"sublayer",
")",
"return",
"self"
] | https://github.com/PaddlePaddle/Paddle/blob/1252f4bb3e574df80aa6d18c7ddae1b3a90bd81c/python/paddle/fluid/dygraph/container.py#L259-L277 | |
neopenx/Dragon | 0e639a7319035ddc81918bd3df059230436ee0a1 | Dragon/python/dragon/io/data_transformer.py | python | DataTransformer.__init__ | (self, **kwargs) | Construct a ``DataTransformer``.
Parameters
----------
mean_values : list
The mean value of each image channel.
scale : float
The scale performed after mean subtraction. Default is ``1.0``.
padding : int
The padding size. Default is ``0`` (Dis... | Construct a ``DataTransformer``. | [
"Construct",
"a",
"DataTransformer",
"."
] | def __init__(self, **kwargs):
"""Construct a ``DataTransformer``.
Parameters
----------
mean_values : list
The mean value of each image channel.
scale : float
The scale performed after mean subtraction. Default is ``1.0``.
padding : int
... | [
"def",
"__init__",
"(",
"self",
",",
"*",
"*",
"kwargs",
")",
":",
"super",
"(",
"DataTransformer",
",",
"self",
")",
".",
"__init__",
"(",
")",
"self",
".",
"_mean_values",
"=",
"GetProperty",
"(",
"kwargs",
",",
"'mean_values'",
",",
"[",
"]",
")",
... | https://github.com/neopenx/Dragon/blob/0e639a7319035ddc81918bd3df059230436ee0a1/Dragon/python/dragon/io/data_transformer.py#L28-L71 | ||
wxWidgets/wxPython-Classic | 19571e1ae65f1ac445f5491474121998c97a1bf0 | wx/lib/agw/flatmenu.py | python | FMRenderer.DrawBitmapShadow | (self, dc, rect, where=BottomShadow|RightShadow) | Draws a shadow using background bitmap.
:param `dc`: an instance of :class:`DC`;
:param `rect`: an instance of :class:`Rect`, representing the bitmap client rectangle;
:param integer `where`: where to draw the shadow. This can be any combination of the
following bits:
=======... | Draws a shadow using background bitmap. | [
"Draws",
"a",
"shadow",
"using",
"background",
"bitmap",
"."
] | def DrawBitmapShadow(self, dc, rect, where=BottomShadow|RightShadow):
"""
Draws a shadow using background bitmap.
:param `dc`: an instance of :class:`DC`;
:param `rect`: an instance of :class:`Rect`, representing the bitmap client rectangle;
:param integer `where`: where to draw... | [
"def",
"DrawBitmapShadow",
"(",
"self",
",",
"dc",
",",
"rect",
",",
"where",
"=",
"BottomShadow",
"|",
"RightShadow",
")",
":",
"shadowSize",
"=",
"5",
"# the rect must be at least 5x5 pixles",
"if",
"rect",
".",
"height",
"<",
"2",
"*",
"shadowSize",
"or",
... | https://github.com/wxWidgets/wxPython-Classic/blob/19571e1ae65f1ac445f5491474121998c97a1bf0/wx/lib/agw/flatmenu.py#L639-L695 | ||
catboost/catboost | 167f64f237114a4d10b2b4ee42adb4569137debe | contrib/tools/python/src/Lib/logging/__init__.py | python | disable | (level) | Disable all logging calls of severity 'level' and below. | Disable all logging calls of severity 'level' and below. | [
"Disable",
"all",
"logging",
"calls",
"of",
"severity",
"level",
"and",
"below",
"."
] | def disable(level):
"""
Disable all logging calls of severity 'level' and below.
"""
root.manager.disable = level | [
"def",
"disable",
"(",
"level",
")",
":",
"root",
".",
"manager",
".",
"disable",
"=",
"level"
] | https://github.com/catboost/catboost/blob/167f64f237114a4d10b2b4ee42adb4569137debe/contrib/tools/python/src/Lib/logging/__init__.py#L1654-L1658 | ||
aws/lumberyard | f85344403c1c2e77ec8c75deb2c116e97b713217 | dev/Gems/CloudGemMetric/v1/AWS/common-code/Lib/numpy/distutils/misc_util.py | python | mingw32 | () | return False | Return true when using mingw32 environment. | Return true when using mingw32 environment. | [
"Return",
"true",
"when",
"using",
"mingw32",
"environment",
"."
] | def mingw32():
"""Return true when using mingw32 environment.
"""
if sys.platform=='win32':
if os.environ.get('OSTYPE', '')=='msys':
return True
if os.environ.get('MSYSTEM', '')=='MINGW32':
return True
return False | [
"def",
"mingw32",
"(",
")",
":",
"if",
"sys",
".",
"platform",
"==",
"'win32'",
":",
"if",
"os",
".",
"environ",
".",
"get",
"(",
"'OSTYPE'",
",",
"''",
")",
"==",
"'msys'",
":",
"return",
"True",
"if",
"os",
".",
"environ",
".",
"get",
"(",
"'MS... | https://github.com/aws/lumberyard/blob/f85344403c1c2e77ec8c75deb2c116e97b713217/dev/Gems/CloudGemMetric/v1/AWS/common-code/Lib/numpy/distutils/misc_util.py#L391-L399 | |
google/usd_from_gltf | 6d288cce8b68744494a226574ae1d7ba6a9c46eb | tools/ufginstall/ufginstall.py | python | ZlibDep.install | (self) | Installs zlib dependency. | Installs zlib dependency. | [
"Installs",
"zlib",
"dependency",
"."
] | def install(self):
"""Installs zlib dependency."""
url = 'https://github.com/madler/zlib/archive/v1.2.11.zip'
path = os.path.join(cfg.src_dir, 'zlib.zip')
force = self.forced()
dl_dir = download_archive(url, path, force)
with cwd(dl_dir):
src_dir = os.getcwd()
build_dir = os.path.joi... | [
"def",
"install",
"(",
"self",
")",
":",
"url",
"=",
"'https://github.com/madler/zlib/archive/v1.2.11.zip'",
"path",
"=",
"os",
".",
"path",
".",
"join",
"(",
"cfg",
".",
"src_dir",
",",
"'zlib.zip'",
")",
"force",
"=",
"self",
".",
"forced",
"(",
")",
"dl... | https://github.com/google/usd_from_gltf/blob/6d288cce8b68744494a226574ae1d7ba6a9c46eb/tools/ufginstall/ufginstall.py#L281-L307 | ||
kushview/Element | 1cc16380caa2ab79461246ba758b9de1f46db2a5 | waflib/extras/dpapi.py | python | dpapi_encrypt_data | (self, input_bytes, entropy = extra_entropy) | Encrypts data and returns byte string
:param input_bytes: The data to be encrypted
:type input_bytes: String or Bytes
:param entropy: Extra entropy to add to the encryption process (optional)
:type entropy: String or Bytes | Encrypts data and returns byte string | [
"Encrypts",
"data",
"and",
"returns",
"byte",
"string"
] | def dpapi_encrypt_data(self, input_bytes, entropy = extra_entropy):
'''
Encrypts data and returns byte string
:param input_bytes: The data to be encrypted
:type input_bytes: String or Bytes
:param entropy: Extra entropy to add to the encryption process (optional)
:type entropy: String or Bytes
'''
if not isins... | [
"def",
"dpapi_encrypt_data",
"(",
"self",
",",
"input_bytes",
",",
"entropy",
"=",
"extra_entropy",
")",
":",
"if",
"not",
"isinstance",
"(",
"input_bytes",
",",
"bytes",
")",
"or",
"not",
"isinstance",
"(",
"entropy",
",",
"bytes",
")",
":",
"self",
".",
... | https://github.com/kushview/Element/blob/1cc16380caa2ab79461246ba758b9de1f46db2a5/waflib/extras/dpapi.py#L42-L63 | ||
aws/lumberyard | f85344403c1c2e77ec8c75deb2c116e97b713217 | dev/Tools/Python/3.7.10/mac/Python.framework/Versions/3.7/lib/python3.7/csv.py | python | Sniffer.sniff | (self, sample, delimiters=None) | return dialect | Returns a dialect (or None) corresponding to the sample | Returns a dialect (or None) corresponding to the sample | [
"Returns",
"a",
"dialect",
"(",
"or",
"None",
")",
"corresponding",
"to",
"the",
"sample"
] | def sniff(self, sample, delimiters=None):
"""
Returns a dialect (or None) corresponding to the sample
"""
quotechar, doublequote, delimiter, skipinitialspace = \
self._guess_quote_and_delimiter(sample, delimiters)
if not delimiter:
delimiter, skipi... | [
"def",
"sniff",
"(",
"self",
",",
"sample",
",",
"delimiters",
"=",
"None",
")",
":",
"quotechar",
",",
"doublequote",
",",
"delimiter",
",",
"skipinitialspace",
"=",
"self",
".",
"_guess_quote_and_delimiter",
"(",
"sample",
",",
"delimiters",
")",
"if",
"no... | https://github.com/aws/lumberyard/blob/f85344403c1c2e77ec8c75deb2c116e97b713217/dev/Tools/Python/3.7.10/mac/Python.framework/Versions/3.7/lib/python3.7/csv.py#L176-L202 | |
nickgillian/grt | 4d4cab1999a349b00d8924da769ff3f0c29d3176 | build/python/examples/RegressionModulesExamples/logistic_regression_example.py | python | main | () | Logistic Regression Example
This examples demonstrates how to initialize, train, and use the LogisticRegression class for regression.
Logistic Regression is a simple but powerful regression algorithm that can map an N-dimensional signal to a 1-dimensional signal.
In this example we create an instance o... | Logistic Regression Example
This examples demonstrates how to initialize, train, and use the LogisticRegression class for regression. | [
"Logistic",
"Regression",
"Example",
"This",
"examples",
"demonstrates",
"how",
"to",
"initialize",
"train",
"and",
"use",
"the",
"LogisticRegression",
"class",
"for",
"regression",
"."
] | def main():
"""Logistic Regression Example
This examples demonstrates how to initialize, train, and use the LogisticRegression class for regression.
Logistic Regression is a simple but powerful regression algorithm that can map an N-dimensional signal to a 1-dimensional signal.
In this example we c... | [
"def",
"main",
"(",
")",
":",
"# Parse the training data filename from the command line",
"parser",
"=",
"argparse",
".",
"ArgumentParser",
"(",
"description",
"=",
"'Process some data.'",
")",
"parser",
".",
"add_argument",
"(",
"'trainingDataFilename'",
",",
"help",
"... | https://github.com/nickgillian/grt/blob/4d4cab1999a349b00d8924da769ff3f0c29d3176/build/python/examples/RegressionModulesExamples/logistic_regression_example.py#L7-L97 | ||
Xilinx/Vitis-AI | fc74d404563d9951b57245443c73bef389f3657f | tools/Vitis-AI-Quantizer/vai_q_tensorflow1.x/tensorflow/python/keras/utils/data_utils.py | python | get_index | (uid, i) | return _SHARED_SEQUENCES[uid][i] | Get the value from the Sequence `uid` at index `i`.
To allow multiple Sequences to be used at the same time, we use `uid` to
get a specific one. A single Sequence would cause the validation to
overwrite the training Sequence.
Arguments:
uid: int, Sequence identifier
i: index
Returns:
The ... | Get the value from the Sequence `uid` at index `i`. | [
"Get",
"the",
"value",
"from",
"the",
"Sequence",
"uid",
"at",
"index",
"i",
"."
] | def get_index(uid, i):
"""Get the value from the Sequence `uid` at index `i`.
To allow multiple Sequences to be used at the same time, we use `uid` to
get a specific one. A single Sequence would cause the validation to
overwrite the training Sequence.
Arguments:
uid: int, Sequence identifier
i: ... | [
"def",
"get_index",
"(",
"uid",
",",
"i",
")",
":",
"return",
"_SHARED_SEQUENCES",
"[",
"uid",
"]",
"[",
"i",
"]"
] | https://github.com/Xilinx/Vitis-AI/blob/fc74d404563d9951b57245443c73bef389f3657f/tools/Vitis-AI-Quantizer/vai_q_tensorflow1.x/tensorflow/python/keras/utils/data_utils.py#L557-L571 | |
wlanjie/AndroidFFmpeg | 7baf9122f4b8e1c74e7baf4be5c422c7a5ba5aaf | tools/fdk-aac-build/x86/toolchain/lib/python2.7/nntplib.py | python | NNTP.xgtitle | (self, group, file=None) | return resp, lines | Process an XGTITLE command (optional server extension) Arguments:
- group: group name wildcard (i.e. news.*)
Returns:
- resp: server response if successful
- list: list of (name,title) strings | Process an XGTITLE command (optional server extension) Arguments:
- group: group name wildcard (i.e. news.*)
Returns:
- resp: server response if successful
- list: list of (name,title) strings | [
"Process",
"an",
"XGTITLE",
"command",
"(",
"optional",
"server",
"extension",
")",
"Arguments",
":",
"-",
"group",
":",
"group",
"name",
"wildcard",
"(",
"i",
".",
"e",
".",
"news",
".",
"*",
")",
"Returns",
":",
"-",
"resp",
":",
"server",
"response"... | def xgtitle(self, group, file=None):
"""Process an XGTITLE command (optional server extension) Arguments:
- group: group name wildcard (i.e. news.*)
Returns:
- resp: server response if successful
- list: list of (name,title) strings"""
line_pat = re.compile("^([^ \t]+)[ ... | [
"def",
"xgtitle",
"(",
"self",
",",
"group",
",",
"file",
"=",
"None",
")",
":",
"line_pat",
"=",
"re",
".",
"compile",
"(",
"\"^([^ \\t]+)[ \\t]+(.*)$\"",
")",
"resp",
",",
"raw_lines",
"=",
"self",
".",
"longcmd",
"(",
"'XGTITLE '",
"+",
"group",
",",
... | https://github.com/wlanjie/AndroidFFmpeg/blob/7baf9122f4b8e1c74e7baf4be5c422c7a5ba5aaf/tools/fdk-aac-build/x86/toolchain/lib/python2.7/nntplib.py#L495-L509 | |
BitMEX/api-connectors | 37a3a5b806ad5d0e0fc975ab86d9ed43c3bcd812 | auto-generated/python/swagger_client/models/index_composite.py | python | IndexComposite.weight | (self, weight) | Sets the weight of this IndexComposite.
:param weight: The weight of this IndexComposite. # noqa: E501
:type: float | Sets the weight of this IndexComposite. | [
"Sets",
"the",
"weight",
"of",
"this",
"IndexComposite",
"."
] | def weight(self, weight):
"""Sets the weight of this IndexComposite.
:param weight: The weight of this IndexComposite. # noqa: E501
:type: float
"""
self._weight = weight | [
"def",
"weight",
"(",
"self",
",",
"weight",
")",
":",
"self",
".",
"_weight",
"=",
"weight"
] | https://github.com/BitMEX/api-connectors/blob/37a3a5b806ad5d0e0fc975ab86d9ed43c3bcd812/auto-generated/python/swagger_client/models/index_composite.py#L197-L205 | ||
aws/lumberyard | f85344403c1c2e77ec8c75deb2c116e97b713217 | dev/Gems/CloudGemMetric/v1/AWS/python/windows/Lib/fsspec/spec.py | python | AbstractBufferedFile.readuntil | (self, char=b"\n", blocks=None) | return b"".join(out) | Return data between current position and first occurrence of char
char is included in the output, except if the end of the tile is
encountered first.
Parameters
----------
char: bytes
Thing to find
blocks: None or int
How much to read in each go.... | Return data between current position and first occurrence of char | [
"Return",
"data",
"between",
"current",
"position",
"and",
"first",
"occurrence",
"of",
"char"
] | def readuntil(self, char=b"\n", blocks=None):
"""Return data between current position and first occurrence of char
char is included in the output, except if the end of the tile is
encountered first.
Parameters
----------
char: bytes
Thing to find
blo... | [
"def",
"readuntil",
"(",
"self",
",",
"char",
"=",
"b\"\\n\"",
",",
"blocks",
"=",
"None",
")",
":",
"out",
"=",
"[",
"]",
"while",
"True",
":",
"start",
"=",
"self",
".",
"tell",
"(",
")",
"part",
"=",
"self",
".",
"read",
"(",
"blocks",
"or",
... | https://github.com/aws/lumberyard/blob/f85344403c1c2e77ec8c75deb2c116e97b713217/dev/Gems/CloudGemMetric/v1/AWS/python/windows/Lib/fsspec/spec.py#L1243-L1269 | |
KratosMultiphysics/Kratos | 0000833054ed0503424eb28205d6508d9ca6cbbc | kratos/python_interface/kratos_globals.py | python | KratosGlobalsImpl.GetVariableType | (self, VarName) | This method checks the type of variable
Keyword arguments:
self -- It signifies an instance of a class.
VarName -- The name of the variable to check | This method checks the type of variable | [
"This",
"method",
"checks",
"the",
"type",
"of",
"variable"
] | def GetVariableType(self, VarName):
""" This method checks the type of variable
Keyword arguments:
self -- It signifies an instance of a class.
VarName -- The name of the variable to check
"""
kernel = self.Kernel
if kernel.HasBoolVariable(VarName):
... | [
"def",
"GetVariableType",
"(",
"self",
",",
"VarName",
")",
":",
"kernel",
"=",
"self",
".",
"Kernel",
"if",
"kernel",
".",
"HasBoolVariable",
"(",
"VarName",
")",
":",
"return",
"\"Bool\"",
"elif",
"kernel",
".",
"HasIntVariable",
"(",
"VarName",
")",
":"... | https://github.com/KratosMultiphysics/Kratos/blob/0000833054ed0503424eb28205d6508d9ca6cbbc/kratos/python_interface/kratos_globals.py#L102-L136 | ||
microsoft/TSS.MSR | 0f2516fca2cd9929c31d5450e39301c9bde43688 | TSS.Py/src/TpmTypes.py | python | TPMS_SCHEME_ECDAA.fromBytes | (buffer) | return TpmBuffer(buffer).createObj(TPMS_SCHEME_ECDAA) | Returns new TPMS_SCHEME_ECDAA object constructed from its marshaled
representation in the given byte buffer | Returns new TPMS_SCHEME_ECDAA object constructed from its marshaled
representation in the given byte buffer | [
"Returns",
"new",
"TPMS_SCHEME_ECDAA",
"object",
"constructed",
"from",
"its",
"marshaled",
"representation",
"in",
"the",
"given",
"byte",
"buffer"
] | def fromBytes(buffer):
""" Returns new TPMS_SCHEME_ECDAA object constructed from its marshaled
representation in the given byte buffer
"""
return TpmBuffer(buffer).createObj(TPMS_SCHEME_ECDAA) | [
"def",
"fromBytes",
"(",
"buffer",
")",
":",
"return",
"TpmBuffer",
"(",
"buffer",
")",
".",
"createObj",
"(",
"TPMS_SCHEME_ECDAA",
")"
] | https://github.com/microsoft/TSS.MSR/blob/0f2516fca2cd9929c31d5450e39301c9bde43688/TSS.Py/src/TpmTypes.py#L6255-L6259 | |
wxWidgets/wxPython-Classic | 19571e1ae65f1ac445f5491474121998c97a1bf0 | wx/lib/agw/ultimatelistctrl.py | python | UltimateListCtrl.EnableSelectionVista | (self, enable=True) | Globally enables/disables drawing of Windows Vista selections.
:param `enable`: ``True`` to enable Vista-style selections, ``False`` to
disable it.
:note: Calling this method disables any gradient-style selection previously
enabled. | Globally enables/disables drawing of Windows Vista selections. | [
"Globally",
"enables",
"/",
"disables",
"drawing",
"of",
"Windows",
"Vista",
"selections",
"."
] | def EnableSelectionVista(self, enable=True):
"""
Globally enables/disables drawing of Windows Vista selections.
:param `enable`: ``True`` to enable Vista-style selections, ``False`` to
disable it.
:note: Calling this method disables any gradient-style selection previously
... | [
"def",
"EnableSelectionVista",
"(",
"self",
",",
"enable",
"=",
"True",
")",
":",
"self",
".",
"_mainWin",
".",
"EnableSelectionVista",
"(",
"enable",
")"
] | https://github.com/wxWidgets/wxPython-Classic/blob/19571e1ae65f1ac445f5491474121998c97a1bf0/wx/lib/agw/ultimatelistctrl.py#L13229-L13240 | ||
catboost/catboost | 167f64f237114a4d10b2b4ee42adb4569137debe | contrib/python/scikit-learn/py3/sklearn/utils/validation.py | python | check_memory | (memory) | return memory | Check that ``memory`` is joblib.Memory-like.
joblib.Memory-like means that ``memory`` can be converted into a
joblib.Memory instance (typically a str denoting the ``location``)
or has the same interface (has a ``cache`` method).
Parameters
----------
memory : None, str or object with the jobli... | Check that ``memory`` is joblib.Memory-like. | [
"Check",
"that",
"memory",
"is",
"joblib",
".",
"Memory",
"-",
"like",
"."
] | def check_memory(memory):
"""Check that ``memory`` is joblib.Memory-like.
joblib.Memory-like means that ``memory`` can be converted into a
joblib.Memory instance (typically a str denoting the ``location``)
or has the same interface (has a ``cache`` method).
Parameters
----------
memory : N... | [
"def",
"check_memory",
"(",
"memory",
")",
":",
"if",
"memory",
"is",
"None",
"or",
"isinstance",
"(",
"memory",
",",
"str",
")",
":",
"if",
"LooseVersion",
"(",
"joblib",
".",
"__version__",
")",
"<",
"'0.12'",
":",
"memory",
"=",
"joblib",
".",
"Memo... | https://github.com/catboost/catboost/blob/167f64f237114a4d10b2b4ee42adb4569137debe/contrib/python/scikit-learn/py3/sklearn/utils/validation.py#L164-L194 | |
tensorflow/tensorflow | 419e3a6b650ea4bd1b0cba23c4348f8a69f3272e | tensorflow/python/framework/convert_to_constants.py | python | _Convertible.convert_variable_to_constant | (self, incoming_edge, tensor_data) | Converts a variable in this Convertible and its dependencies.
This method should make sure that a converted copy of itself is present in
the converted graph, and that all Convertibles depending on this one also go
through the same process.
Args:
incoming_edge: The graph edge into this Convertibl... | Converts a variable in this Convertible and its dependencies. | [
"Converts",
"a",
"variable",
"in",
"this",
"Convertible",
"and",
"its",
"dependencies",
"."
] | def convert_variable_to_constant(self, incoming_edge, tensor_data):
"""Converts a variable in this Convertible and its dependencies.
This method should make sure that a converted copy of itself is present in
the converted graph, and that all Convertibles depending on this one also go
through the same p... | [
"def",
"convert_variable_to_constant",
"(",
"self",
",",
"incoming_edge",
",",
"tensor_data",
")",
":",
"raise",
"NotImplementedError"
] | https://github.com/tensorflow/tensorflow/blob/419e3a6b650ea4bd1b0cba23c4348f8a69f3272e/tensorflow/python/framework/convert_to_constants.py#L100-L112 | ||
Xilinx/Vitis-AI | fc74d404563d9951b57245443c73bef389f3657f | tools/Vitis-AI-Quantizer/vai_q_tensorflow1.x/tensorflow/contrib/factorization/python/ops/factorization_ops.py | python | WALSModel._process_input_helper | (self,
update_row_factors,
sp_input=None,
transpose_input=False,
row_weights=None) | return (new_left_values, update_op, unregularized_loss, regularization,
sum_weights) | Creates the graph for processing a sparse slice of input.
Args:
update_row_factors: if True, update or project the row_factors, else
update or project the column factors.
sp_input: Please refer to comments for update_row_factors,
update_col_factors, project_row_factors, and project_col_... | Creates the graph for processing a sparse slice of input. | [
"Creates",
"the",
"graph",
"for",
"processing",
"a",
"sparse",
"slice",
"of",
"input",
"."
] | def _process_input_helper(self,
update_row_factors,
sp_input=None,
transpose_input=False,
row_weights=None):
"""Creates the graph for processing a sparse slice of input.
Args:
update_row_factor... | [
"def",
"_process_input_helper",
"(",
"self",
",",
"update_row_factors",
",",
"sp_input",
"=",
"None",
",",
"transpose_input",
"=",
"False",
",",
"row_weights",
"=",
"None",
")",
":",
"assert",
"isinstance",
"(",
"sp_input",
",",
"sparse_tensor",
".",
"SparseTens... | https://github.com/Xilinx/Vitis-AI/blob/fc74d404563d9951b57245443c73bef389f3657f/tools/Vitis-AI-Quantizer/vai_q_tensorflow1.x/tensorflow/contrib/factorization/python/ops/factorization_ops.py#L808-L1017 | |
catboost/catboost | 167f64f237114a4d10b2b4ee42adb4569137debe | contrib/tools/python3/src/Lib/enum.py | python | _is_descriptor | (obj) | return (
hasattr(obj, '__get__') or
hasattr(obj, '__set__') or
hasattr(obj, '__delete__')
) | Returns True if obj is a descriptor, False otherwise. | Returns True if obj is a descriptor, False otherwise. | [
"Returns",
"True",
"if",
"obj",
"is",
"a",
"descriptor",
"False",
"otherwise",
"."
] | def _is_descriptor(obj):
"""
Returns True if obj is a descriptor, False otherwise.
"""
return (
hasattr(obj, '__get__') or
hasattr(obj, '__set__') or
hasattr(obj, '__delete__')
) | [
"def",
"_is_descriptor",
"(",
"obj",
")",
":",
"return",
"(",
"hasattr",
"(",
"obj",
",",
"'__get__'",
")",
"or",
"hasattr",
"(",
"obj",
",",
"'__set__'",
")",
"or",
"hasattr",
"(",
"obj",
",",
"'__delete__'",
")",
")"
] | https://github.com/catboost/catboost/blob/167f64f237114a4d10b2b4ee42adb4569137debe/contrib/tools/python3/src/Lib/enum.py#L12-L20 | |
aws/lumberyard | f85344403c1c2e77ec8c75deb2c116e97b713217 | dev/Tools/Python/3.7.10/windows/Lib/site-packages/urllib3/packages/six.py | python | add_metaclass | (metaclass) | return wrapper | Class decorator for creating a class with a metaclass. | Class decorator for creating a class with a metaclass. | [
"Class",
"decorator",
"for",
"creating",
"a",
"class",
"with",
"a",
"metaclass",
"."
] | def add_metaclass(metaclass):
"""Class decorator for creating a class with a metaclass."""
def wrapper(cls):
orig_vars = cls.__dict__.copy()
slots = orig_vars.get("__slots__")
if slots is not None:
if isinstance(slots, str):
slots = [slots]
for sl... | [
"def",
"add_metaclass",
"(",
"metaclass",
")",
":",
"def",
"wrapper",
"(",
"cls",
")",
":",
"orig_vars",
"=",
"cls",
".",
"__dict__",
".",
"copy",
"(",
")",
"slots",
"=",
"orig_vars",
".",
"get",
"(",
"\"__slots__\"",
")",
"if",
"slots",
"is",
"not",
... | https://github.com/aws/lumberyard/blob/f85344403c1c2e77ec8c75deb2c116e97b713217/dev/Tools/Python/3.7.10/windows/Lib/site-packages/urllib3/packages/six.py#L900-L917 | |
wxWidgets/wxPython-Classic | 19571e1ae65f1ac445f5491474121998c97a1bf0 | src/osx_carbon/_controls.py | python | StaticLine.GetClassDefaultAttributes | (*args, **kwargs) | return _controls_.StaticLine_GetClassDefaultAttributes(*args, **kwargs) | GetClassDefaultAttributes(int variant=WINDOW_VARIANT_NORMAL) -> VisualAttributes
Get the default attributes for this class. This is useful if you want
to use the same font or colour in your own control as in a standard
control -- which is a much better idea than hard coding specific
co... | GetClassDefaultAttributes(int variant=WINDOW_VARIANT_NORMAL) -> VisualAttributes | [
"GetClassDefaultAttributes",
"(",
"int",
"variant",
"=",
"WINDOW_VARIANT_NORMAL",
")",
"-",
">",
"VisualAttributes"
] | def GetClassDefaultAttributes(*args, **kwargs):
"""
GetClassDefaultAttributes(int variant=WINDOW_VARIANT_NORMAL) -> VisualAttributes
Get the default attributes for this class. This is useful if you want
to use the same font or colour in your own control as in a standard
control... | [
"def",
"GetClassDefaultAttributes",
"(",
"*",
"args",
",",
"*",
"*",
"kwargs",
")",
":",
"return",
"_controls_",
".",
"StaticLine_GetClassDefaultAttributes",
"(",
"*",
"args",
",",
"*",
"*",
"kwargs",
")"
] | https://github.com/wxWidgets/wxPython-Classic/blob/19571e1ae65f1ac445f5491474121998c97a1bf0/src/osx_carbon/_controls.py#L935-L950 | |
kamyu104/LeetCode-Solutions | 77605708a927ea3b85aee5a479db733938c7c211 | Python/maximum-product-difference-between-two-pairs.py | python | Solution.maxProductDifference | (self, nums) | return largest[0]*largest[1] - smallest[0]*smallest[1] | :type nums: List[int]
:rtype: int | :type nums: List[int]
:rtype: int | [
":",
"type",
"nums",
":",
"List",
"[",
"int",
"]",
":",
"rtype",
":",
"int"
] | def maxProductDifference(self, nums):
"""
:type nums: List[int]
:rtype: int
"""
largest, smallest = [0]*2, [float("inf")]*2
for x in nums:
if x >= largest[0]:
largest[:] = [x, largest[0]]
elif x > largest[1]:
largest... | [
"def",
"maxProductDifference",
"(",
"self",
",",
"nums",
")",
":",
"largest",
",",
"smallest",
"=",
"[",
"0",
"]",
"*",
"2",
",",
"[",
"float",
"(",
"\"inf\"",
")",
"]",
"*",
"2",
"for",
"x",
"in",
"nums",
":",
"if",
"x",
">=",
"largest",
"[",
... | https://github.com/kamyu104/LeetCode-Solutions/blob/77605708a927ea3b85aee5a479db733938c7c211/Python/maximum-product-difference-between-two-pairs.py#L5-L20 | |
esa/pagmo | 80281d549c8f1b470e1489a5d37c8f06b2e429c0 | PyGMO/problem/__init__.py | python | _cec2006_ctor | (self, prob_id=1) | Constructs one of the 24 CEC2006 Competition Problems (Constrained Continuous Single-Objective)
USAGE: problem.cec2006(prob_id=1)
* prob_id: Problem number, one of [1,2,...24] | Constructs one of the 24 CEC2006 Competition Problems (Constrained Continuous Single-Objective) | [
"Constructs",
"one",
"of",
"the",
"24",
"CEC2006",
"Competition",
"Problems",
"(",
"Constrained",
"Continuous",
"Single",
"-",
"Objective",
")"
] | def _cec2006_ctor(self, prob_id=1):
"""
Constructs one of the 24 CEC2006 Competition Problems (Constrained Continuous Single-Objective)
USAGE: problem.cec2006(prob_id=1)
* prob_id: Problem number, one of [1,2,...24]
"""
# We construct the arg list for the original constructor exposed by
#... | [
"def",
"_cec2006_ctor",
"(",
"self",
",",
"prob_id",
"=",
"1",
")",
":",
"# We construct the arg list for the original constructor exposed by",
"# boost_python",
"arg_list",
"=",
"[",
"]",
"arg_list",
".",
"append",
"(",
"prob_id",
")",
"self",
".",
"_orig_init",
"(... | https://github.com/esa/pagmo/blob/80281d549c8f1b470e1489a5d37c8f06b2e429c0/PyGMO/problem/__init__.py#L399-L412 | ||
ukoethe/vigra | 093d57d15c8c237adf1704d96daa6393158ce299 | vigranumpy/lib/arraytypes.py | python | VigraArray.permutationToNormalOrder | (self, types=AxisType.AllAxes) | return list(self.axistags.permutationToNormalOrder(types)) | Create the permutation that would transpose this array to
normal order (that is, from the current axis order into
ascending order, e.g. 'x y c' into 'c x y').
If 'types' is not 'AxisType.AllAxes', only the axes with the
desired types are considered. | Create the permutation that would transpose this array to
normal order (that is, from the current axis order into
ascending order, e.g. 'x y c' into 'c x y').
If 'types' is not 'AxisType.AllAxes', only the axes with the
desired types are considered. | [
"Create",
"the",
"permutation",
"that",
"would",
"transpose",
"this",
"array",
"to",
"normal",
"order",
"(",
"that",
"is",
"from",
"the",
"current",
"axis",
"order",
"into",
"ascending",
"order",
"e",
".",
"g",
".",
"x",
"y",
"c",
"into",
"c",
"x",
"y"... | def permutationToNormalOrder(self, types=AxisType.AllAxes):
'''Create the permutation that would transpose this array to
normal order (that is, from the current axis order into
ascending order, e.g. 'x y c' into 'c x y').
If 'types' is not 'AxisType.AllAxes', only the axes with ... | [
"def",
"permutationToNormalOrder",
"(",
"self",
",",
"types",
"=",
"AxisType",
".",
"AllAxes",
")",
":",
"return",
"list",
"(",
"self",
".",
"axistags",
".",
"permutationToNormalOrder",
"(",
"types",
")",
")"
] | https://github.com/ukoethe/vigra/blob/093d57d15c8c237adf1704d96daa6393158ce299/vigranumpy/lib/arraytypes.py#L1154-L1161 | |
catboost/catboost | 167f64f237114a4d10b2b4ee42adb4569137debe | contrib/tools/python3/src/Lib/pydoc.py | python | _get_revised_path | (given_path, argv0) | return revised_path | Ensures current directory is on returned path, and argv0 directory is not
Exception: argv0 dir is left alone if it's also pydoc's directory.
Returns a new path entry list, or None if no adjustment is needed. | Ensures current directory is on returned path, and argv0 directory is not | [
"Ensures",
"current",
"directory",
"is",
"on",
"returned",
"path",
"and",
"argv0",
"directory",
"is",
"not"
] | def _get_revised_path(given_path, argv0):
"""Ensures current directory is on returned path, and argv0 directory is not
Exception: argv0 dir is left alone if it's also pydoc's directory.
Returns a new path entry list, or None if no adjustment is needed.
"""
# Scripts may get the current directory i... | [
"def",
"_get_revised_path",
"(",
"given_path",
",",
"argv0",
")",
":",
"# Scripts may get the current directory in their path by default if they're",
"# run with the -m switch, or directly from the current directory.",
"# The interactive prompt also allows imports from the current directory.",
... | https://github.com/catboost/catboost/blob/167f64f237114a4d10b2b4ee42adb4569137debe/contrib/tools/python3/src/Lib/pydoc.py#L2714-L2738 | |
windystrife/UnrealEngine_NVIDIAGameWorks | b50e6338a7c5b26374d66306ebc7807541ff815e | Engine/Extras/Maya_AnimationRiggingTools/ARTv1/MayaTools/General/Scripts/ART_skeletonBuilder_UI.py | python | SkeletonBuilder_UI.publish | (self, project, characterName, handCtrlSpace, *args) | cmds.select("root", hi = True)
joints = cmds.ls(sl = True)
for joint in joints:
cmds.setAttr(joint + ".rx", 0)
cmds.setAttr(joint + ".ry", 0)
cmds.setAttr(joint + ".rz", 0) | cmds.select("root", hi = True)
joints = cmds.ls(sl = True)
for joint in joints:
cmds.setAttr(joint + ".rx", 0)
cmds.setAttr(joint + ".ry", 0)
cmds.setAttr(joint + ".rz", 0) | [
"cmds",
".",
"select",
"(",
"root",
"hi",
"=",
"True",
")",
"joints",
"=",
"cmds",
".",
"ls",
"(",
"sl",
"=",
"True",
")",
"for",
"joint",
"in",
"joints",
":",
"cmds",
".",
"setAttr",
"(",
"joint",
"+",
".",
"rx",
"0",
")",
"cmds",
".",
"setAtt... | def publish(self, project, characterName, handCtrlSpace, *args):
#unconstrain face so that the driver skeleton can drive the deforming and later i can drive the driver with sdks
self.unConstrainFacialJoints()
sourceControl = False
#unlock joints
cmds.select("root", hi = True)
... | [
"def",
"publish",
"(",
"self",
",",
"project",
",",
"characterName",
",",
"handCtrlSpace",
",",
"*",
"args",
")",
":",
"#unconstrain face so that the driver skeleton can drive the deforming and later i can drive the driver with sdks",
"self",
".",
"unConstrainFacialJoints",
"("... | https://github.com/windystrife/UnrealEngine_NVIDIAGameWorks/blob/b50e6338a7c5b26374d66306ebc7807541ff815e/Engine/Extras/Maya_AnimationRiggingTools/ARTv1/MayaTools/General/Scripts/ART_skeletonBuilder_UI.py#L7614-L7957 | ||
tensorflow/tensorflow | 419e3a6b650ea4bd1b0cba23c4348f8a69f3272e | tensorflow/python/ops/math_ops.py | python | reduced_shape | (input_shape, axes) | return gen_data_flow_ops.dynamic_stitch( # [2, 1, 1, 7]
[
range(input_rank), # [0, 1, 2, 3]
axes
], # [1, 2]
[
input_shape, # [2, 3, 5, 7]
array_ops.ones(axes_shape, dtype=dtypes.int32)
]) | Helper function for reduction ops.
Args:
input_shape: 1-D Tensor, the shape of the Tensor being reduced.
axes: 1-D Tensor, the reduction axes.
Returns:
A 1-D Tensor, the output shape as if keepdims were set to True. | Helper function for reduction ops. | [
"Helper",
"function",
"for",
"reduction",
"ops",
"."
] | def reduced_shape(input_shape, axes):
"""Helper function for reduction ops.
Args:
input_shape: 1-D Tensor, the shape of the Tensor being reduced.
axes: 1-D Tensor, the reduction axes.
Returns:
A 1-D Tensor, the output shape as if keepdims were set to True.
"""
# TODO(allenl): Refactor `reduced_s... | [
"def",
"reduced_shape",
"(",
"input_shape",
",",
"axes",
")",
":",
"# TODO(allenl): Refactor `reduced_shape` to take the tensor corresponding to",
"# `input_shape` rather than `tf.shape` of it. Then we can check if the shape",
"# is fully defined here, which may be faster executing eagerly than ... | https://github.com/tensorflow/tensorflow/blob/419e3a6b650ea4bd1b0cba23c4348f8a69f3272e/tensorflow/python/ops/math_ops.py#L4481-L4520 | |
wxWidgets/wxPython-Classic | 19571e1ae65f1ac445f5491474121998c97a1bf0 | src/osx_carbon/_misc.py | python | Process.IsRedirected | (*args, **kwargs) | return _misc_.Process_IsRedirected(*args, **kwargs) | IsRedirected(self) -> bool | IsRedirected(self) -> bool | [
"IsRedirected",
"(",
"self",
")",
"-",
">",
"bool"
] | def IsRedirected(*args, **kwargs):
"""IsRedirected(self) -> bool"""
return _misc_.Process_IsRedirected(*args, **kwargs) | [
"def",
"IsRedirected",
"(",
"*",
"args",
",",
"*",
"*",
"kwargs",
")",
":",
"return",
"_misc_",
".",
"Process_IsRedirected",
"(",
"*",
"args",
",",
"*",
"*",
"kwargs",
")"
] | https://github.com/wxWidgets/wxPython-Classic/blob/19571e1ae65f1ac445f5491474121998c97a1bf0/src/osx_carbon/_misc.py#L2011-L2013 | |
hfinkel/llvm-project-cxxjit | 91084ef018240bbb8e24235ff5cd8c355a9c1a1e | clang/tools/scan-build-py/libscanbuild/clang.py | python | get_version | (clang) | return output[0] | Returns the compiler version as string.
:param clang: the compiler we are using
:return: the version string printed to stderr | Returns the compiler version as string. | [
"Returns",
"the",
"compiler",
"version",
"as",
"string",
"."
] | def get_version(clang):
""" Returns the compiler version as string.
:param clang: the compiler we are using
:return: the version string printed to stderr """
output = run_command([clang, '-v'])
# the relevant version info is in the first line
return output[0] | [
"def",
"get_version",
"(",
"clang",
")",
":",
"output",
"=",
"run_command",
"(",
"[",
"clang",
",",
"'-v'",
"]",
")",
"# the relevant version info is in the first line",
"return",
"output",
"[",
"0",
"]"
] | https://github.com/hfinkel/llvm-project-cxxjit/blob/91084ef018240bbb8e24235ff5cd8c355a9c1a1e/clang/tools/scan-build-py/libscanbuild/clang.py#L22-L30 | |
aws/lumberyard | f85344403c1c2e77ec8c75deb2c116e97b713217 | dev/Gems/CloudGemMetric/v1/AWS/common-code/Lib/pandas/core/indexes/datetimes.py | python | date_range | (
start=None,
end=None,
periods=None,
freq=None,
tz=None,
normalize=False,
name=None,
closed=None,
**kwargs,
) | return DatetimeIndex._simple_new(dtarr, tz=dtarr.tz, freq=dtarr.freq, name=name) | Return a fixed frequency DatetimeIndex.
Parameters
----------
start : str or datetime-like, optional
Left bound for generating dates.
end : str or datetime-like, optional
Right bound for generating dates.
periods : int, optional
Number of periods to generate.
freq : str ... | Return a fixed frequency DatetimeIndex. | [
"Return",
"a",
"fixed",
"frequency",
"DatetimeIndex",
"."
] | def date_range(
start=None,
end=None,
periods=None,
freq=None,
tz=None,
normalize=False,
name=None,
closed=None,
**kwargs,
) -> DatetimeIndex:
"""
Return a fixed frequency DatetimeIndex.
Parameters
----------
start : str or datetime-like, optional
Left bo... | [
"def",
"date_range",
"(",
"start",
"=",
"None",
",",
"end",
"=",
"None",
",",
"periods",
"=",
"None",
",",
"freq",
"=",
"None",
",",
"tz",
"=",
"None",
",",
"normalize",
"=",
"False",
",",
"name",
"=",
"None",
",",
"closed",
"=",
"None",
",",
"*"... | https://github.com/aws/lumberyard/blob/f85344403c1c2e77ec8c75deb2c116e97b713217/dev/Gems/CloudGemMetric/v1/AWS/common-code/Lib/pandas/core/indexes/datetimes.py#L1021-L1182 | |
aws/lumberyard | f85344403c1c2e77ec8c75deb2c116e97b713217 | dev/Tools/Python/3.7.10/mac/Python.framework/Versions/3.7/lib/python3.7/site-packages/pip/_vendor/distlib/_backport/tarfile.py | python | nts | (s, encoding, errors) | return s.decode(encoding, errors) | Convert a null-terminated bytes object to a string. | Convert a null-terminated bytes object to a string. | [
"Convert",
"a",
"null",
"-",
"terminated",
"bytes",
"object",
"to",
"a",
"string",
"."
] | def nts(s, encoding, errors):
"""Convert a null-terminated bytes object to a string.
"""
p = s.find(b"\0")
if p != -1:
s = s[:p]
return s.decode(encoding, errors) | [
"def",
"nts",
"(",
"s",
",",
"encoding",
",",
"errors",
")",
":",
"p",
"=",
"s",
".",
"find",
"(",
"b\"\\0\"",
")",
"if",
"p",
"!=",
"-",
"1",
":",
"s",
"=",
"s",
"[",
":",
"p",
"]",
"return",
"s",
".",
"decode",
"(",
"encoding",
",",
"erro... | https://github.com/aws/lumberyard/blob/f85344403c1c2e77ec8c75deb2c116e97b713217/dev/Tools/Python/3.7.10/mac/Python.framework/Versions/3.7/lib/python3.7/site-packages/pip/_vendor/distlib/_backport/tarfile.py#L191-L197 | |
larroy/clearskies_core | 3574ddf0edc8555454c7044126e786a6c29444dc | tools/gyp/pylib/gyp/generator/ninja.py | python | _AddWinLinkRules | (master_ninja, embed_manifest) | Adds link rules for Windows platform to |master_ninja|. | Adds link rules for Windows platform to |master_ninja|. | [
"Adds",
"link",
"rules",
"for",
"Windows",
"platform",
"to",
"|master_ninja|",
"."
] | def _AddWinLinkRules(master_ninja, embed_manifest):
"""Adds link rules for Windows platform to |master_ninja|."""
def FullLinkCommand(ldcmd, out, binary_type):
resource_name = {
'exe': '1',
'dll': '2',
}[binary_type]
return '%(python)s gyp-win-tool link-with-manifests $arch %(embed)s ' \
... | [
"def",
"_AddWinLinkRules",
"(",
"master_ninja",
",",
"embed_manifest",
")",
":",
"def",
"FullLinkCommand",
"(",
"ldcmd",
",",
"out",
",",
"binary_type",
")",
":",
"resource_name",
"=",
"{",
"'exe'",
":",
"'1'",
",",
"'dll'",
":",
"'2'",
",",
"}",
"[",
"b... | https://github.com/larroy/clearskies_core/blob/3574ddf0edc8555454c7044126e786a6c29444dc/tools/gyp/pylib/gyp/generator/ninja.py#L1594-L1640 | ||
hanpfei/chromium-net | 392cc1fa3a8f92f42e4071ab6e674d8e0482f83f | tools/auto_bisect/bisect_utils.py | python | _CreateAndChangeToSourceDirectory | (working_directory) | return True | Creates a directory 'bisect' as a subdirectory of |working_directory|.
If successful, the current working directory will be changed to the new
'bisect' directory.
Args:
working_directory: The directory to create the new 'bisect' directory in.
Returns:
True if the directory was successfully created (o... | Creates a directory 'bisect' as a subdirectory of |working_directory|. | [
"Creates",
"a",
"directory",
"bisect",
"as",
"a",
"subdirectory",
"of",
"|working_directory|",
"."
] | def _CreateAndChangeToSourceDirectory(working_directory):
"""Creates a directory 'bisect' as a subdirectory of |working_directory|.
If successful, the current working directory will be changed to the new
'bisect' directory.
Args:
working_directory: The directory to create the new 'bisect' directory in.
... | [
"def",
"_CreateAndChangeToSourceDirectory",
"(",
"working_directory",
")",
":",
"cwd",
"=",
"os",
".",
"getcwd",
"(",
")",
"os",
".",
"chdir",
"(",
"working_directory",
")",
"try",
":",
"os",
".",
"mkdir",
"(",
"BISECT_DIR",
")",
"except",
"OSError",
",",
... | https://github.com/hanpfei/chromium-net/blob/392cc1fa3a8f92f42e4071ab6e674d8e0482f83f/tools/auto_bisect/bisect_utils.py#L239-L260 | |
openthread/openthread | 9fcdbed9c526c70f1556d1ed84099c1535c7cd32 | tools/otci/otci/otci.py | python | OTCI.scan_energy | (self, duration: float = None, channel: int = None) | return channels | Perform an IEEE 802.15.4 Energy Scan. | Perform an IEEE 802.15.4 Energy Scan. | [
"Perform",
"an",
"IEEE",
"802",
".",
"15",
".",
"4",
"Energy",
"Scan",
"."
] | def scan_energy(self, duration: float = None, channel: int = None) -> Dict[int, int]:
"""Perform an IEEE 802.15.4 Energy Scan."""
cmd = 'scan energy'
if duration is not None:
cmd += f' {duration * 1000:d}'
if channel is not None:
cmd += f' {channel}'
out... | [
"def",
"scan_energy",
"(",
"self",
",",
"duration",
":",
"float",
"=",
"None",
",",
"channel",
":",
"int",
"=",
"None",
")",
"->",
"Dict",
"[",
"int",
",",
"int",
"]",
":",
"cmd",
"=",
"'scan energy'",
"if",
"duration",
"is",
"not",
"None",
":",
"c... | https://github.com/openthread/openthread/blob/9fcdbed9c526c70f1556d1ed84099c1535c7cd32/tools/otci/otci/otci.py#L302-L322 | |
OkCupid/okws | 1c337392c676ccb4e9a4c92d11d5d2fada6427d2 | contrib/pub3-upgrade.py | python | Pub1Parser.p_html | (self, p) | html : html_frags | html : html_frags | [
"html",
":",
"html_frags"
] | def p_html (self, p):
'''html : html_frags'''
p[0] = HtmlText (''.join (p[1])) | [
"def",
"p_html",
"(",
"self",
",",
"p",
")",
":",
"p",
"[",
"0",
"]",
"=",
"HtmlText",
"(",
"''",
".",
"join",
"(",
"p",
"[",
"1",
"]",
")",
")"
] | https://github.com/OkCupid/okws/blob/1c337392c676ccb4e9a4c92d11d5d2fada6427d2/contrib/pub3-upgrade.py#L854-L856 | ||
aws/lumberyard | f85344403c1c2e77ec8c75deb2c116e97b713217 | dev/Tools/Python/3.7.10/mac/Python.framework/Versions/3.7/lib/python3.7/pickletools.py | python | read_decimalnl_long | (f) | return int(s) | r"""
>>> import io
>>> read_decimalnl_long(io.BytesIO(b"1234L\n56"))
1234
>>> read_decimalnl_long(io.BytesIO(b"123456789012345678901234L\n6"))
123456789012345678901234 | r"""
>>> import io | [
"r",
">>>",
"import",
"io"
] | def read_decimalnl_long(f):
r"""
>>> import io
>>> read_decimalnl_long(io.BytesIO(b"1234L\n56"))
1234
>>> read_decimalnl_long(io.BytesIO(b"123456789012345678901234L\n6"))
123456789012345678901234
"""
s = read_stringnl(f, decode=False, stripquotes=False)
if s[-1:] == b'L':
... | [
"def",
"read_decimalnl_long",
"(",
"f",
")",
":",
"s",
"=",
"read_stringnl",
"(",
"f",
",",
"decode",
"=",
"False",
",",
"stripquotes",
"=",
"False",
")",
"if",
"s",
"[",
"-",
"1",
":",
"]",
"==",
"b'L'",
":",
"s",
"=",
"s",
"[",
":",
"-",
"1",... | https://github.com/aws/lumberyard/blob/f85344403c1c2e77ec8c75deb2c116e97b713217/dev/Tools/Python/3.7.10/mac/Python.framework/Versions/3.7/lib/python3.7/pickletools.py#L737-L751 | |
aws/lumberyard | f85344403c1c2e77ec8c75deb2c116e97b713217 | dev/Gems/CloudGemMetric/v1/AWS/python/windows/Lib/numba/types/functions.py | python | BaseFunction.get_impl_key | (self, sig) | return self._impl_keys[sig.args] | Get the implementation key (used by the target context) for the
given signature. | Get the implementation key (used by the target context) for the
given signature. | [
"Get",
"the",
"implementation",
"key",
"(",
"used",
"by",
"the",
"target",
"context",
")",
"for",
"the",
"given",
"signature",
"."
] | def get_impl_key(self, sig):
"""
Get the implementation key (used by the target context) for the
given signature.
"""
return self._impl_keys[sig.args] | [
"def",
"get_impl_key",
"(",
"self",
",",
"sig",
")",
":",
"return",
"self",
".",
"_impl_keys",
"[",
"sig",
".",
"args",
"]"
] | https://github.com/aws/lumberyard/blob/f85344403c1c2e77ec8c75deb2c116e97b713217/dev/Gems/CloudGemMetric/v1/AWS/python/windows/Lib/numba/types/functions.py#L115-L120 | |
hanpfei/chromium-net | 392cc1fa3a8f92f42e4071ab6e674d8e0482f83f | tools/auto_bisect/fetch_build.py | python | FullBuildArchive._ArchiveDirectory | (self) | return platform_to_directory.get(self._platform) | Returns the remote directory to download builds from. | Returns the remote directory to download builds from. | [
"Returns",
"the",
"remote",
"directory",
"to",
"download",
"builds",
"from",
"."
] | def _ArchiveDirectory(self):
"""Returns the remote directory to download builds from."""
platform_to_directory = {
'android': 'android_main_rel',
'linux': 'chromium.linux/Linux Builder',
'mac': 'chromium.mac/Mac Builder',
'win64': 'chromium.win/Win x64 Builder',
'win': 'c... | [
"def",
"_ArchiveDirectory",
"(",
"self",
")",
":",
"platform_to_directory",
"=",
"{",
"'android'",
":",
"'android_main_rel'",
",",
"'linux'",
":",
"'chromium.linux/Linux Builder'",
",",
"'mac'",
":",
"'chromium.mac/Mac Builder'",
",",
"'win64'",
":",
"'chromium.win/Win ... | https://github.com/hanpfei/chromium-net/blob/392cc1fa3a8f92f42e4071ab6e674d8e0482f83f/tools/auto_bisect/fetch_build.py#L273-L283 | |
pytorch/pytorch | 7176c92687d3cc847cc046bf002269c6949a21c2 | torch/distributed/optim/zero_redundancy_optimizer.py | python | _is_trainable | (param: torch.Tensor) | return param.requires_grad | r"""
Returns if a parameter is trainable, where trainability is equivalent to
requiring a gradient. | r"""
Returns if a parameter is trainable, where trainability is equivalent to
requiring a gradient. | [
"r",
"Returns",
"if",
"a",
"parameter",
"is",
"trainable",
"where",
"trainability",
"is",
"equivalent",
"to",
"requiring",
"a",
"gradient",
"."
] | def _is_trainable(param: torch.Tensor) -> bool:
r"""
Returns if a parameter is trainable, where trainability is equivalent to
requiring a gradient.
"""
return param.requires_grad | [
"def",
"_is_trainable",
"(",
"param",
":",
"torch",
".",
"Tensor",
")",
"->",
"bool",
":",
"return",
"param",
".",
"requires_grad"
] | https://github.com/pytorch/pytorch/blob/7176c92687d3cc847cc046bf002269c6949a21c2/torch/distributed/optim/zero_redundancy_optimizer.py#L53-L58 | |
naver/sling | 5671cd445a2caae0b4dd0332299e4cfede05062c | webkit/Tools/Scripts/webkitpy/port/base.py | python | Port._driver_class | (self) | return driver.Driver | Returns the port's driver implementation. | Returns the port's driver implementation. | [
"Returns",
"the",
"port",
"s",
"driver",
"implementation",
"."
] | def _driver_class(self):
"""Returns the port's driver implementation."""
return driver.Driver | [
"def",
"_driver_class",
"(",
"self",
")",
":",
"return",
"driver",
".",
"Driver"
] | https://github.com/naver/sling/blob/5671cd445a2caae0b4dd0332299e4cfede05062c/webkit/Tools/Scripts/webkitpy/port/base.py#L1271-L1273 | |
wlanjie/AndroidFFmpeg | 7baf9122f4b8e1c74e7baf4be5c422c7a5ba5aaf | tools/fdk-aac-build/armeabi/toolchain/lib/python2.7/ConfigParser.py | python | SafeConfigParser.set | (self, section, option, value=None) | Set an option. Extend ConfigParser.set: check for string values. | Set an option. Extend ConfigParser.set: check for string values. | [
"Set",
"an",
"option",
".",
"Extend",
"ConfigParser",
".",
"set",
":",
"check",
"for",
"string",
"values",
"."
] | def set(self, section, option, value=None):
"""Set an option. Extend ConfigParser.set: check for string values."""
# The only legal non-string value if we allow valueless
# options is None, so we need to check if the value is a
# string if:
# - we do not allow valueless options,... | [
"def",
"set",
"(",
"self",
",",
"section",
",",
"option",
",",
"value",
"=",
"None",
")",
":",
"# The only legal non-string value if we allow valueless",
"# options is None, so we need to check if the value is a",
"# string if:",
"# - we do not allow valueless options, or",
"# - ... | https://github.com/wlanjie/AndroidFFmpeg/blob/7baf9122f4b8e1c74e7baf4be5c422c7a5ba5aaf/tools/fdk-aac-build/armeabi/toolchain/lib/python2.7/ConfigParser.py#L734-L753 | ||
Xilinx/Vitis-AI | fc74d404563d9951b57245443c73bef389f3657f | tools/Vitis-AI-Quantizer/vai_q_tensorflow1.x/tensorflow/contrib/legacy_seq2seq/python/ops/seq2seq.py | python | rnn_decoder | (decoder_inputs,
initial_state,
cell,
loop_function=None,
scope=None) | return outputs, state | RNN decoder for the sequence-to-sequence model.
Args:
decoder_inputs: A list of 2D Tensors [batch_size x input_size].
initial_state: 2D Tensor with shape [batch_size x cell.state_size].
cell: rnn_cell.RNNCell defining the cell function and size.
loop_function: If not None, this function will be appli... | RNN decoder for the sequence-to-sequence model. | [
"RNN",
"decoder",
"for",
"the",
"sequence",
"-",
"to",
"-",
"sequence",
"model",
"."
] | def rnn_decoder(decoder_inputs,
initial_state,
cell,
loop_function=None,
scope=None):
"""RNN decoder for the sequence-to-sequence model.
Args:
decoder_inputs: A list of 2D Tensors [batch_size x input_size].
initial_state: 2D Tensor with shape ... | [
"def",
"rnn_decoder",
"(",
"decoder_inputs",
",",
"initial_state",
",",
"cell",
",",
"loop_function",
"=",
"None",
",",
"scope",
"=",
"None",
")",
":",
"with",
"variable_scope",
".",
"variable_scope",
"(",
"scope",
"or",
"\"rnn_decoder\"",
")",
":",
"state",
... | https://github.com/Xilinx/Vitis-AI/blob/fc74d404563d9951b57245443c73bef389f3657f/tools/Vitis-AI-Quantizer/vai_q_tensorflow1.x/tensorflow/contrib/legacy_seq2seq/python/ops/seq2seq.py#L112-L156 | |
wlanjie/AndroidFFmpeg | 7baf9122f4b8e1c74e7baf4be5c422c7a5ba5aaf | tools/fdk-aac-build/armeabi-v7a/toolchain/lib/python2.7/telnetlib.py | python | Telnet._read_until_with_select | (self, match, timeout=None) | return self.read_very_lazy() | Read until a given string is encountered or until timeout.
The timeout is implemented using select.select(). | Read until a given string is encountered or until timeout. | [
"Read",
"until",
"a",
"given",
"string",
"is",
"encountered",
"or",
"until",
"timeout",
"."
] | def _read_until_with_select(self, match, timeout=None):
"""Read until a given string is encountered or until timeout.
The timeout is implemented using select.select().
"""
n = len(match)
self.process_rawq()
i = self.cookedq.find(match)
if i >= 0:
i = ... | [
"def",
"_read_until_with_select",
"(",
"self",
",",
"match",
",",
"timeout",
"=",
"None",
")",
":",
"n",
"=",
"len",
"(",
"match",
")",
"self",
".",
"process_rawq",
"(",
")",
"i",
"=",
"self",
".",
"cookedq",
".",
"find",
"(",
"match",
")",
"if",
"... | https://github.com/wlanjie/AndroidFFmpeg/blob/7baf9122f4b8e1c74e7baf4be5c422c7a5ba5aaf/tools/fdk-aac-build/armeabi-v7a/toolchain/lib/python2.7/telnetlib.py#L342-L376 | |
stulp/dmpbbo | ca900e3b851d25faaf59ea296650370c70ed7d0f | python/bbo/bbo_plotting.py | python | plotExplorationCurve | (exploration_curve,ax) | return line | Plot an exploration curve.
\param[in] exploration An exploration curve that has the following format
#rows is number of optimization updates
column 0: Number of samples at which the cost was evaluated
column 1: The exploration at that update
column 2...: Individual cost components (... | Plot an exploration curve.
\param[in] exploration An exploration curve that has the following format
#rows is number of optimization updates
column 0: Number of samples at which the cost was evaluated
column 1: The exploration at that update
column 2...: Individual cost components (... | [
"Plot",
"an",
"exploration",
"curve",
".",
"\\",
"param",
"[",
"in",
"]",
"exploration",
"An",
"exploration",
"curve",
"that",
"has",
"the",
"following",
"format",
"#rows",
"is",
"number",
"of",
"optimization",
"updates",
"column",
"0",
":",
"Number",
"of",
... | def plotExplorationCurve(exploration_curve,ax):
""" Plot an exploration curve.
\param[in] exploration An exploration curve that has the following format
#rows is number of optimization updates
column 0: Number of samples at which the cost was evaluated
column 1: The exploration at th... | [
"def",
"plotExplorationCurve",
"(",
"exploration_curve",
",",
"ax",
")",
":",
"exploration_curve",
"=",
"np",
".",
"array",
"(",
"exploration_curve",
")",
"samples_eval",
"=",
"exploration_curve",
"[",
":",
",",
"0",
"]",
"explo",
"=",
"exploration_curve",
"[",
... | https://github.com/stulp/dmpbbo/blob/ca900e3b851d25faaf59ea296650370c70ed7d0f/python/bbo/bbo_plotting.py#L122-L142 | |
microsoft/onnxruntime | f92e47e95b13a240e37caf7b36577983544f98fc | orttraining/orttraining/python/training/ortmodule/_torch_module_ort.py | python | TorchModuleORT._apply | (self, fn) | return self | Override original method to delegate execution to the flattened PyTorch user module | Override original method to delegate execution to the flattened PyTorch user module | [
"Override",
"original",
"method",
"to",
"delegate",
"execution",
"to",
"the",
"flattened",
"PyTorch",
"user",
"module"
] | def _apply(self, fn):
"""Override original method to delegate execution to the flattened PyTorch user module"""
# Delegation must happen to _flattened_module since methods depend on
# _apply to recursively apply the internal setting changes
self._flattened_module._apply(fn)
retu... | [
"def",
"_apply",
"(",
"self",
",",
"fn",
")",
":",
"# Delegation must happen to _flattened_module since methods depend on",
"# _apply to recursively apply the internal setting changes",
"self",
".",
"_flattened_module",
".",
"_apply",
"(",
"fn",
")",
"return",
"self"
] | https://github.com/microsoft/onnxruntime/blob/f92e47e95b13a240e37caf7b36577983544f98fc/orttraining/orttraining/python/training/ortmodule/_torch_module_ort.py#L27-L33 | |
catboost/catboost | 167f64f237114a4d10b2b4ee42adb4569137debe | contrib/python/setuptools/py3/setuptools/_vendor/pyparsing.py | python | ParserElement.inlineLiteralsUsing | (cls) | Set class to be used for inclusion of string literals into a parser.
Example::
# default literal class used is Literal
integer = Word(nums)
date_str = integer("year") + '/' + integer("month") + '/' + integer("day")
date_str.parseString("1999/1... | Set class to be used for inclusion of string literals into a parser.
Example::
# default literal class used is Literal
integer = Word(nums)
date_str = integer("year") + '/' + integer("month") + '/' + integer("day") | [
"Set",
"class",
"to",
"be",
"used",
"for",
"inclusion",
"of",
"string",
"literals",
"into",
"a",
"parser",
".",
"Example",
"::",
"#",
"default",
"literal",
"class",
"used",
"is",
"Literal",
"integer",
"=",
"Word",
"(",
"nums",
")",
"date_str",
"=",
"inte... | def inlineLiteralsUsing(cls):
"""
Set class to be used for inclusion of string literals into a parser.
Example::
# default literal class used is Literal
integer = Word(nums)
date_str = integer("year") + '/' + integer("month") + '/' + integer("day") ... | [
"def",
"inlineLiteralsUsing",
"(",
"cls",
")",
":",
"ParserElement",
".",
"_literalStringClass",
"=",
"cls"
] | https://github.com/catboost/catboost/blob/167f64f237114a4d10b2b4ee42adb4569137debe/contrib/python/setuptools/py3/setuptools/_vendor/pyparsing.py#L1124-L1142 | ||
MhLiao/TextBoxes_plusplus | 39d4898de1504c53a2ed3d67966a57b3595836d0 | scripts/cpp_lint.py | python | CheckAltTokens | (filename, clean_lines, linenum, error) | Check alternative keywords being used in boolean expressions.
Args:
filename: The name of the current file.
clean_lines: A CleansedLines instance containing the file.
linenum: The number of the line to check.
error: The function to call with any errors found. | Check alternative keywords being used in boolean expressions. | [
"Check",
"alternative",
"keywords",
"being",
"used",
"in",
"boolean",
"expressions",
"."
] | def CheckAltTokens(filename, clean_lines, linenum, error):
"""Check alternative keywords being used in boolean expressions.
Args:
filename: The name of the current file.
clean_lines: A CleansedLines instance containing the file.
linenum: The number of the line to check.
error: The function to call ... | [
"def",
"CheckAltTokens",
"(",
"filename",
",",
"clean_lines",
",",
"linenum",
",",
"error",
")",
":",
"line",
"=",
"clean_lines",
".",
"elided",
"[",
"linenum",
"]",
"# Avoid preprocessor lines",
"if",
"Match",
"(",
"r'^\\s*#'",
",",
"line",
")",
":",
"retur... | https://github.com/MhLiao/TextBoxes_plusplus/blob/39d4898de1504c53a2ed3d67966a57b3595836d0/scripts/cpp_lint.py#L3409-L3438 | ||
fatih/subvim | 241b6d170597857105da219c9b7d36059e9f11fb | vim/base/YouCompleteMe/third_party/retries/retries.py | python | example_exc_handler | (tries_remaining, exception, delay) | Example exception handler; prints a warning to stderr.
tries_remaining: The number of tries remaining.
exception: The exception instance which was raised. | Example exception handler; prints a warning to stderr. | [
"Example",
"exception",
"handler",
";",
"prints",
"a",
"warning",
"to",
"stderr",
"."
] | def example_exc_handler(tries_remaining, exception, delay):
"""Example exception handler; prints a warning to stderr.
tries_remaining: The number of tries remaining.
exception: The exception instance which was raised.
"""
print >> sys.stderr, "Caught '%s', %d tries remaining, sleeping for %s second... | [
"def",
"example_exc_handler",
"(",
"tries_remaining",
",",
"exception",
",",
"delay",
")",
":",
"print",
">>",
"sys",
".",
"stderr",
",",
"\"Caught '%s', %d tries remaining, sleeping for %s seconds\"",
"%",
"(",
"exception",
",",
"tries_remaining",
",",
"delay",
")"
] | https://github.com/fatih/subvim/blob/241b6d170597857105da219c9b7d36059e9f11fb/vim/base/YouCompleteMe/third_party/retries/retries.py#L29-L35 | ||
wxWidgets/wxPython-Classic | 19571e1ae65f1ac445f5491474121998c97a1bf0 | contrib/gizmos/msw/gizmos.py | python | TreeListCtrl._setCallbackInfo | (*args, **kwargs) | return _gizmos.TreeListCtrl__setCallbackInfo(*args, **kwargs) | _setCallbackInfo(self, PyObject self, PyObject _class) | _setCallbackInfo(self, PyObject self, PyObject _class) | [
"_setCallbackInfo",
"(",
"self",
"PyObject",
"self",
"PyObject",
"_class",
")"
] | def _setCallbackInfo(*args, **kwargs):
"""_setCallbackInfo(self, PyObject self, PyObject _class)"""
return _gizmos.TreeListCtrl__setCallbackInfo(*args, **kwargs) | [
"def",
"_setCallbackInfo",
"(",
"*",
"args",
",",
"*",
"*",
"kwargs",
")",
":",
"return",
"_gizmos",
".",
"TreeListCtrl__setCallbackInfo",
"(",
"*",
"args",
",",
"*",
"*",
"kwargs",
")"
] | https://github.com/wxWidgets/wxPython-Classic/blob/19571e1ae65f1ac445f5491474121998c97a1bf0/contrib/gizmos/msw/gizmos.py#L495-L497 | |
nyuwireless-unipd/ns3-mmwave | 4ff9e87e8079764e04cbeccd8e85bff15ae16fb3 | utils/check-style.py | python | PatchChunkLine.line | (self) | return self.__line | ! Get line
@param self The current class
@return line | ! Get line | [
"!",
"Get",
"line"
] | def line(self):
"""! Get line
@param self The current class
@return line
"""
return self.__line | [
"def",
"line",
"(",
"self",
")",
":",
"return",
"self",
".",
"__line"
] | https://github.com/nyuwireless-unipd/ns3-mmwave/blob/4ff9e87e8079764e04cbeccd8e85bff15ae16fb3/utils/check-style.py#L186-L191 | |
catboost/catboost | 167f64f237114a4d10b2b4ee42adb4569137debe | contrib/tools/python/src/Lib/imaplib.py | python | IMAP4.recent | (self) | return self._untagged_response(typ, dat, name) | Return most recent 'RECENT' responses if any exist,
else prompt server for an update using the 'NOOP' command.
(typ, [data]) = <instance>.recent()
'data' is None if no new messages,
else list of RECENT responses, most recent last. | Return most recent 'RECENT' responses if any exist,
else prompt server for an update using the 'NOOP' command. | [
"Return",
"most",
"recent",
"RECENT",
"responses",
"if",
"any",
"exist",
"else",
"prompt",
"server",
"for",
"an",
"update",
"using",
"the",
"NOOP",
"command",
"."
] | def recent(self):
"""Return most recent 'RECENT' responses if any exist,
else prompt server for an update using the 'NOOP' command.
(typ, [data]) = <instance>.recent()
'data' is None if no new messages,
else list of RECENT responses, most recent last.
"""
name =... | [
"def",
"recent",
"(",
"self",
")",
":",
"name",
"=",
"'RECENT'",
"typ",
",",
"dat",
"=",
"self",
".",
"_untagged_response",
"(",
"'OK'",
",",
"[",
"None",
"]",
",",
"name",
")",
"if",
"dat",
"[",
"-",
"1",
"]",
":",
"return",
"typ",
",",
"dat",
... | https://github.com/catboost/catboost/blob/167f64f237114a4d10b2b4ee42adb4569137debe/contrib/tools/python/src/Lib/imaplib.py#L289-L303 | |
h2oai/datatable | 753197c3f76041dd6468e0f6a9708af92d80f6aa | ci/xbuild/extension.py | python | Extension._scan_file | (self, src_file) | Scan file `src_file` and detect its list of includes.
The includes are lines of form `#include "header.h"`, where
the file `header.h` may be either in the same directory as
the source file, or relative to one of the "include"
directories.
This method will resolve the list of in... | Scan file `src_file` and detect its list of includes. | [
"Scan",
"file",
"src_file",
"and",
"detect",
"its",
"list",
"of",
"includes",
"."
] | def _scan_file(self, src_file):
"""
Scan file `src_file` and detect its list of includes.
The includes are lines of form `#include "header.h"`, where
the file `header.h` may be either in the same directory as
the source file, or relative to one of the "include"
directori... | [
"def",
"_scan_file",
"(",
"self",
",",
"src_file",
")",
":",
"# If a file was removed, then there's nothing to scan",
"if",
"not",
"os",
".",
"path",
".",
"exists",
"(",
"src_file",
")",
":",
"return",
"src_path",
"=",
"os",
".",
"path",
".",
"dirname",
"(",
... | https://github.com/h2oai/datatable/blob/753197c3f76041dd6468e0f6a9708af92d80f6aa/ci/xbuild/extension.py#L580-L619 | ||
catboost/catboost | 167f64f237114a4d10b2b4ee42adb4569137debe | contrib/python/numpy/py3/numpy/distutils/fcompiler/__init__.py | python | FCompiler.find_executables | (self) | Go through the self.executables dictionary, and attempt to
find and assign appropriate executables.
Executable names are looked for in the environment (environment
variables, the distutils.cfg, and command line), the 0th-element of
the command list, and the self.possible_executables lis... | Go through the self.executables dictionary, and attempt to
find and assign appropriate executables. | [
"Go",
"through",
"the",
"self",
".",
"executables",
"dictionary",
"and",
"attempt",
"to",
"find",
"and",
"assign",
"appropriate",
"executables",
"."
] | def find_executables(self):
"""Go through the self.executables dictionary, and attempt to
find and assign appropriate executables.
Executable names are looked for in the environment (environment
variables, the distutils.cfg, and command line), the 0th-element of
the command list... | [
"def",
"find_executables",
"(",
"self",
")",
":",
"assert",
"self",
".",
"_is_customised",
"exe_cache",
"=",
"self",
".",
"_exe_cache",
"def",
"cached_find_executable",
"(",
"exe",
")",
":",
"if",
"exe",
"in",
"exe_cache",
":",
"return",
"exe_cache",
"[",
"e... | https://github.com/catboost/catboost/blob/167f64f237114a4d10b2b4ee42adb4569137debe/contrib/python/numpy/py3/numpy/distutils/fcompiler/__init__.py#L280-L357 | ||
apple/turicreate | cce55aa5311300e3ce6af93cb45ba791fd1bdf49 | deps/src/libxml2-2.9.1/python/libxml2.py | python | xpathContext.xpathVariableLookup | (self, name) | return xpathObjectRet(ret) | Search in the Variable array of the context for the given
variable value. | Search in the Variable array of the context for the given
variable value. | [
"Search",
"in",
"the",
"Variable",
"array",
"of",
"the",
"context",
"for",
"the",
"given",
"variable",
"value",
"."
] | def xpathVariableLookup(self, name):
"""Search in the Variable array of the context for the given
variable value. """
ret = libxml2mod.xmlXPathVariableLookup(self._o, name)
if ret is None:raise xpathError('xmlXPathVariableLookup() failed')
return xpathObjectRet(ret) | [
"def",
"xpathVariableLookup",
"(",
"self",
",",
"name",
")",
":",
"ret",
"=",
"libxml2mod",
".",
"xmlXPathVariableLookup",
"(",
"self",
".",
"_o",
",",
"name",
")",
"if",
"ret",
"is",
"None",
":",
"raise",
"xpathError",
"(",
"'xmlXPathVariableLookup() failed'"... | https://github.com/apple/turicreate/blob/cce55aa5311300e3ce6af93cb45ba791fd1bdf49/deps/src/libxml2-2.9.1/python/libxml2.py#L7391-L7396 | |
benoitsteiner/tensorflow-opencl | cb7cb40a57fde5cfd4731bc551e82a1e2fef43a5 | tensorflow/contrib/distributions/python/ops/vector_diffeomixture.py | python | VectorDiffeomixture.mixture_distribution | (self) | return self._mixture_distribution | Distribution used to select a convex combination of affine transforms. | Distribution used to select a convex combination of affine transforms. | [
"Distribution",
"used",
"to",
"select",
"a",
"convex",
"combination",
"of",
"affine",
"transforms",
"."
] | def mixture_distribution(self):
"""Distribution used to select a convex combination of affine transforms."""
return self._mixture_distribution | [
"def",
"mixture_distribution",
"(",
"self",
")",
":",
"return",
"self",
".",
"_mixture_distribution"
] | https://github.com/benoitsteiner/tensorflow-opencl/blob/cb7cb40a57fde5cfd4731bc551e82a1e2fef43a5/tensorflow/contrib/distributions/python/ops/vector_diffeomixture.py#L396-L398 | |
wlanjie/AndroidFFmpeg | 7baf9122f4b8e1c74e7baf4be5c422c7a5ba5aaf | tools/fdk-aac-build/x86/toolchain/lib/python2.7/traceback.py | python | format_list | (extracted_list) | return list | Format a list of traceback entry tuples for printing.
Given a list of tuples as returned by extract_tb() or
extract_stack(), return a list of strings ready for printing.
Each string in the resulting list corresponds to the item with the
same index in the argument list. Each string ends in a newline;
... | Format a list of traceback entry tuples for printing. | [
"Format",
"a",
"list",
"of",
"traceback",
"entry",
"tuples",
"for",
"printing",
"."
] | def format_list(extracted_list):
"""Format a list of traceback entry tuples for printing.
Given a list of tuples as returned by extract_tb() or
extract_stack(), return a list of strings ready for printing.
Each string in the resulting list corresponds to the item with the
same index in the argument... | [
"def",
"format_list",
"(",
"extracted_list",
")",
":",
"list",
"=",
"[",
"]",
"for",
"filename",
",",
"lineno",
",",
"name",
",",
"line",
"in",
"extracted_list",
":",
"item",
"=",
"' File \"%s\", line %d, in %s\\n'",
"%",
"(",
"filename",
",",
"lineno",
","... | https://github.com/wlanjie/AndroidFFmpeg/blob/7baf9122f4b8e1c74e7baf4be5c422c7a5ba5aaf/tools/fdk-aac-build/x86/toolchain/lib/python2.7/traceback.py#L27-L43 | |
idaholab/moose | 9eeebc65e098b4c30f8205fb41591fd5b61eb6ff | python/peacock/Input/ParamsTable.py | python | EditingDelegate.createEditor | (self, parent, option, index) | return self.current_editor | Override the default implementation to emit a signal and store the created editor. | Override the default implementation to emit a signal and store the created editor. | [
"Override",
"the",
"default",
"implementation",
"to",
"emit",
"a",
"signal",
"and",
"store",
"the",
"created",
"editor",
"."
] | def createEditor(self, parent, option, index):
"""
Override the default implementation to emit a signal and store the created editor.
"""
self.startedEditing.emit()
self.current_editor = super(EditingDelegate, self).createEditor(parent, option, index)
return self.current_... | [
"def",
"createEditor",
"(",
"self",
",",
"parent",
",",
"option",
",",
"index",
")",
":",
"self",
".",
"startedEditing",
".",
"emit",
"(",
")",
"self",
".",
"current_editor",
"=",
"super",
"(",
"EditingDelegate",
",",
"self",
")",
".",
"createEditor",
"(... | https://github.com/idaholab/moose/blob/9eeebc65e098b4c30f8205fb41591fd5b61eb6ff/python/peacock/Input/ParamsTable.py#L33-L39 | |
google/earthenterprise | 0fe84e29be470cd857e3a0e52e5d0afd5bb8cee9 | earth_enterprise/src/fusion/portableglobe/cutter/cgi-bin/common/utils.py | python | CreateDirectory | (directory) | Create entire directory path. | Create entire directory path. | [
"Create",
"entire",
"directory",
"path",
"."
] | def CreateDirectory(directory):
"""Create entire directory path."""
if os.path.exists(directory):
return
try:
os.makedirs(directory)
except OSError:
PrintAndLog("Raising error: Cannot create directory \'%s\'" % directory)
raise | [
"def",
"CreateDirectory",
"(",
"directory",
")",
":",
"if",
"os",
".",
"path",
".",
"exists",
"(",
"directory",
")",
":",
"return",
"try",
":",
"os",
".",
"makedirs",
"(",
"directory",
")",
"except",
"OSError",
":",
"PrintAndLog",
"(",
"\"Raising error: Ca... | https://github.com/google/earthenterprise/blob/0fe84e29be470cd857e3a0e52e5d0afd5bb8cee9/earth_enterprise/src/fusion/portableglobe/cutter/cgi-bin/common/utils.py#L108-L116 | ||
Genius-x/genius-x | 9fc9f194e6d1fb92dd0e33d43db19ddb67cda7b0 | cocos2d/build/android-build.py | python | get_num_of_cpu | () | The build process can be accelerated by running multiple concurrent job processes using the -j-option. | The build process can be accelerated by running multiple concurrent job processes using the -j-option. | [
"The",
"build",
"process",
"can",
"be",
"accelerated",
"by",
"running",
"multiple",
"concurrent",
"job",
"processes",
"using",
"the",
"-",
"j",
"-",
"option",
"."
] | def get_num_of_cpu():
''' The build process can be accelerated by running multiple concurrent job processes using the -j-option.
'''
try:
platform = sys.platform
if platform == 'win32':
if 'NUMBER_OF_PROCESSORS' in os.environ:
return int(os.environ['NUMBER_OF_PROC... | [
"def",
"get_num_of_cpu",
"(",
")",
":",
"try",
":",
"platform",
"=",
"sys",
".",
"platform",
"if",
"platform",
"==",
"'win32'",
":",
"if",
"'NUMBER_OF_PROCESSORS'",
"in",
"os",
".",
"environ",
":",
"return",
"int",
"(",
"os",
".",
"environ",
"[",
"'NUMBE... | https://github.com/Genius-x/genius-x/blob/9fc9f194e6d1fb92dd0e33d43db19ddb67cda7b0/cocos2d/build/android-build.py#L14-L29 | ||
openthread/openthread | 9fcdbed9c526c70f1556d1ed84099c1535c7cd32 | tools/harness-thci/OpenThread_WpanCtl.py | python | OpenThread_WpanCtl.setOutBoundLinkQuality | (self, LinkQuality) | set custom LinkQualityIn for all receiving messages from the any address
Args:
LinkQuality: a given custom link quality
link quality/link margin mapping table
3: 21 - 255 (dB)
2: 11 - 20 (dB)
1: 3 - ... | set custom LinkQualityIn for all receiving messages from the any address | [
"set",
"custom",
"LinkQualityIn",
"for",
"all",
"receiving",
"messages",
"from",
"the",
"any",
"address"
] | def setOutBoundLinkQuality(self, LinkQuality):
"""set custom LinkQualityIn for all receiving messages from the any address
Args:
LinkQuality: a given custom link quality
link quality/link margin mapping table
3: 21 - 255 (dB)
... | [
"def",
"setOutBoundLinkQuality",
"(",
"self",
",",
"LinkQuality",
")",
":"
] | https://github.com/openthread/openthread/blob/9fcdbed9c526c70f1556d1ed84099c1535c7cd32/tools/harness-thci/OpenThread_WpanCtl.py#L1546-L1562 | ||
hanpfei/chromium-net | 392cc1fa3a8f92f42e4071ab6e674d8e0482f83f | third_party/catapult/third_party/gsutil/third_party/boto/boto/sdb/db/manager/sdbmanager.py | python | SDBConverter.encode_float | (self, value) | return '%s %s %s' % (case, exponent, mantissa) | See http://tools.ietf.org/html/draft-wood-ldapext-float-00. | See http://tools.ietf.org/html/draft-wood-ldapext-float-00. | [
"See",
"http",
":",
"//",
"tools",
".",
"ietf",
".",
"org",
"/",
"html",
"/",
"draft",
"-",
"wood",
"-",
"ldapext",
"-",
"float",
"-",
"00",
"."
] | def encode_float(self, value):
"""
See http://tools.ietf.org/html/draft-wood-ldapext-float-00.
"""
s = '%e' % value
l = s.split('e')
mantissa = l[0].ljust(18, '0')
exponent = l[1]
if value == 0.0:
case = '3'
exponent = '000'
... | [
"def",
"encode_float",
"(",
"self",
",",
"value",
")",
":",
"s",
"=",
"'%e'",
"%",
"value",
"l",
"=",
"s",
".",
"split",
"(",
"'e'",
")",
"mantissa",
"=",
"l",
"[",
"0",
"]",
".",
"ljust",
"(",
"18",
",",
"'0'",
")",
"exponent",
"=",
"l",
"["... | https://github.com/hanpfei/chromium-net/blob/392cc1fa3a8f92f42e4071ab6e674d8e0482f83f/third_party/catapult/third_party/gsutil/third_party/boto/boto/sdb/db/manager/sdbmanager.py#L219-L248 | |
natanielruiz/android-yolo | 1ebb54f96a67a20ff83ddfc823ed83a13dc3a47f | jni-build/jni/include/tensorflow/contrib/factorization/python/ops/factorization_ops.py | python | WALSModel.update_row_factors | (self, sp_input=None, transpose_input=False) | return self._process_input_helper(True, sp_input=sp_input,
transpose_input=transpose_input) | Updates the row factors.
Args:
sp_input: A SparseTensor representing a subset of rows of the full input
in any order. Please note that this SparseTensor must retain the
indexing as the original input.
transpose_input: If true, logically transposes the input.
Returns:
A tuple co... | Updates the row factors. | [
"Updates",
"the",
"row",
"factors",
"."
] | def update_row_factors(self, sp_input=None, transpose_input=False):
"""Updates the row factors.
Args:
sp_input: A SparseTensor representing a subset of rows of the full input
in any order. Please note that this SparseTensor must retain the
indexing as the original input.
transpose_inp... | [
"def",
"update_row_factors",
"(",
"self",
",",
"sp_input",
"=",
"None",
",",
"transpose_input",
"=",
"False",
")",
":",
"return",
"self",
".",
"_process_input_helper",
"(",
"True",
",",
"sp_input",
"=",
"sp_input",
",",
"transpose_input",
"=",
"transpose_input",... | https://github.com/natanielruiz/android-yolo/blob/1ebb54f96a67a20ff83ddfc823ed83a13dc3a47f/jni-build/jni/include/tensorflow/contrib/factorization/python/ops/factorization_ops.py#L333-L349 | |
wxWidgets/wxPython-Classic | 19571e1ae65f1ac445f5491474121998c97a1bf0 | src/gtk/_core.py | python | Sizer.GetSize | (*args, **kwargs) | return _core_.Sizer_GetSize(*args, **kwargs) | GetSize(self) -> Size
Returns the current size of the space managed by the sizer. | GetSize(self) -> Size | [
"GetSize",
"(",
"self",
")",
"-",
">",
"Size"
] | def GetSize(*args, **kwargs):
"""
GetSize(self) -> Size
Returns the current size of the space managed by the sizer.
"""
return _core_.Sizer_GetSize(*args, **kwargs) | [
"def",
"GetSize",
"(",
"*",
"args",
",",
"*",
"*",
"kwargs",
")",
":",
"return",
"_core_",
".",
"Sizer_GetSize",
"(",
"*",
"args",
",",
"*",
"*",
"kwargs",
")"
] | https://github.com/wxWidgets/wxPython-Classic/blob/19571e1ae65f1ac445f5491474121998c97a1bf0/src/gtk/_core.py#L14772-L14778 | |
BlzFans/wke | b0fa21158312e40c5fbd84682d643022b6c34a93 | cygwin/lib/python2.6/decimal.py | python | Context.multiply | (self, a, b) | return a.__mul__(b, context=self) | multiply multiplies two operands.
If either operand is a special value then the general rules apply.
Otherwise, the operands are multiplied together ('long multiplication'),
resulting in a number which may be as long as the sum of the lengths
of the two operands.
>>> ExtendedCo... | multiply multiplies two operands. | [
"multiply",
"multiplies",
"two",
"operands",
"."
] | def multiply(self, a, b):
"""multiply multiplies two operands.
If either operand is a special value then the general rules apply.
Otherwise, the operands are multiplied together ('long multiplication'),
resulting in a number which may be as long as the sum of the lengths
of the ... | [
"def",
"multiply",
"(",
"self",
",",
"a",
",",
"b",
")",
":",
"return",
"a",
".",
"__mul__",
"(",
"b",
",",
"context",
"=",
"self",
")"
] | https://github.com/BlzFans/wke/blob/b0fa21158312e40c5fbd84682d643022b6c34a93/cygwin/lib/python2.6/decimal.py#L4389-L4408 | |
calamares/calamares | 9f6f82405b3074af7c99dc26487d2e46e4ece3e5 | src/modules/packages/main.py | python | subst_locale | (plist) | return ret | Returns a locale-aware list of packages, based on @p plist.
Package names that contain LOCALE are localized with the
BCP47 name of the chosen system locale; if the system
locale is 'en' (e.g. English, US) then these localized
packages are dropped from the list.
@param plist: list[str|dict]
... | Returns a locale-aware list of packages, based on @p plist.
Package names that contain LOCALE are localized with the
BCP47 name of the chosen system locale; if the system
locale is 'en' (e.g. English, US) then these localized
packages are dropped from the list. | [
"Returns",
"a",
"locale",
"-",
"aware",
"list",
"of",
"packages",
"based",
"on",
"@p",
"plist",
".",
"Package",
"names",
"that",
"contain",
"LOCALE",
"are",
"localized",
"with",
"the",
"BCP47",
"name",
"of",
"the",
"chosen",
"system",
"locale",
";",
"if",
... | def subst_locale(plist):
"""
Returns a locale-aware list of packages, based on @p plist.
Package names that contain LOCALE are localized with the
BCP47 name of the chosen system locale; if the system
locale is 'en' (e.g. English, US) then these localized
packages are dropped from the list.
... | [
"def",
"subst_locale",
"(",
"plist",
")",
":",
"locale",
"=",
"libcalamares",
".",
"globalstorage",
".",
"value",
"(",
"\"locale\"",
")",
"if",
"not",
"locale",
":",
"# It is possible to skip the locale-setting entirely.",
"# Then pretend it is \"en\", so that {LOCALE}-deco... | https://github.com/calamares/calamares/blob/9f6f82405b3074af7c99dc26487d2e46e4ece3e5/src/modules/packages/main.py#L602-L644 | |
kushview/Element | 1cc16380caa2ab79461246ba758b9de1f46db2a5 | waflib/extras/review.py | python | ReviewContext.invalidate_cache | (self) | Invalidate the cache to prevent bad builds. | Invalidate the cache to prevent bad builds. | [
"Invalidate",
"the",
"cache",
"to",
"prevent",
"bad",
"builds",
"."
] | def invalidate_cache(self):
"""Invalidate the cache to prevent bad builds."""
try:
Logs.warn("Removing the cached configuration since the options have changed")
shutil.rmtree(self.cache_path)
except:
pass | [
"def",
"invalidate_cache",
"(",
"self",
")",
":",
"try",
":",
"Logs",
".",
"warn",
"(",
"\"Removing the cached configuration since the options have changed\"",
")",
"shutil",
".",
"rmtree",
"(",
"self",
".",
"cache_path",
")",
"except",
":",
"pass"
] | https://github.com/kushview/Element/blob/1cc16380caa2ab79461246ba758b9de1f46db2a5/waflib/extras/review.py#L166-L172 | ||
wxWidgets/wxPython-Classic | 19571e1ae65f1ac445f5491474121998c97a1bf0 | wx/tools/Editra/src/ed_shelf.py | python | EdShelfDelegate.RaiseItem | (self, item_name) | Set the selection in the notebook to be the that of the first
instance of item_name that is found in the shelf.
@param item_name: ShelfI name
@return: reference to the selected page or None if no instance is | Set the selection in the notebook to be the that of the first
instance of item_name that is found in the shelf.
@param item_name: ShelfI name
@return: reference to the selected page or None if no instance is | [
"Set",
"the",
"selection",
"in",
"the",
"notebook",
"to",
"be",
"the",
"that",
"of",
"the",
"first",
"instance",
"of",
"item_name",
"that",
"is",
"found",
"in",
"the",
"shelf",
".",
"@param",
"item_name",
":",
"ShelfI",
"name",
"@return",
":",
"reference",... | def RaiseItem(self, item_name):
"""Set the selection in the notebook to be the that of the first
instance of item_name that is found in the shelf.
@param item_name: ShelfI name
@return: reference to the selected page or None if no instance is
"""
for page in range(self._... | [
"def",
"RaiseItem",
"(",
"self",
",",
"item_name",
")",
":",
"for",
"page",
"in",
"range",
"(",
"self",
".",
"_shelf",
".",
"GetPageCount",
"(",
")",
")",
":",
"if",
"self",
".",
"_shelf",
".",
"GetPageText",
"(",
"page",
")",
".",
"startswith",
"(",... | https://github.com/wxWidgets/wxPython-Classic/blob/19571e1ae65f1ac445f5491474121998c97a1bf0/wx/tools/Editra/src/ed_shelf.py#L580-L592 | ||
y123456yz/reading-and-annotate-mongodb-3.6 | 93280293672ca7586dc24af18132aa61e4ed7fcf | mongo/buildscripts/resmokelib/logging/loggers.py | python | JobLogger.new_test_logger | (self, test_shortname, test_basename, command, parent) | return TestLogger(test_shortname, parent) | Create a new test logger that will be a child of the given parent. | Create a new test logger that will be a child of the given parent. | [
"Create",
"a",
"new",
"test",
"logger",
"that",
"will",
"be",
"a",
"child",
"of",
"the",
"given",
"parent",
"."
] | def new_test_logger(self, test_shortname, test_basename, command, parent):
"""Create a new test logger that will be a child of the given parent."""
if self.build_id:
test_id = self.build_logger_server.new_test_id(self.build_id, test_basename, command)
if test_id:
... | [
"def",
"new_test_logger",
"(",
"self",
",",
"test_shortname",
",",
"test_basename",
",",
"command",
",",
"parent",
")",
":",
"if",
"self",
".",
"build_id",
":",
"test_id",
"=",
"self",
".",
"build_logger_server",
".",
"new_test_id",
"(",
"self",
".",
"build_... | https://github.com/y123456yz/reading-and-annotate-mongodb-3.6/blob/93280293672ca7586dc24af18132aa61e4ed7fcf/mongo/buildscripts/resmokelib/logging/loggers.py#L185-L196 | |
LLNL/lbann | 26083e6c86050302ce33148aea70f62e61cacb92 | applications/graph/node2vec/utils/snap.py | python | node2vec_walk | (graph_file,
walk_file,
walk_length,
walks_per_node,
return_param=1.0,
inout_param=1.0,
directed=False,
weighted=False,
verbose=False) | return subprocess.call(command) | Perform random walk on graph for node2vec.
See https://cs.stanford.edu/~jure/pubs/node2vec-kdd16.pdf
Args:
graph_file (str): Uncompressed edge list file.
walk_file (str): File where random walks will be saved.
walk_length (int): Walk length.
walks_per_node (int): Number of walk... | Perform random walk on graph for node2vec. | [
"Perform",
"random",
"walk",
"on",
"graph",
"for",
"node2vec",
"."
] | def node2vec_walk(graph_file,
walk_file,
walk_length,
walks_per_node,
return_param=1.0,
inout_param=1.0,
directed=False,
weighted=False,
verbose=False):
"""Perform random w... | [
"def",
"node2vec_walk",
"(",
"graph_file",
",",
"walk_file",
",",
"walk_length",
",",
"walks_per_node",
",",
"return_param",
"=",
"1.0",
",",
"inout_param",
"=",
"1.0",
",",
"directed",
"=",
"False",
",",
"weighted",
"=",
"False",
",",
"verbose",
"=",
"False... | https://github.com/LLNL/lbann/blob/26083e6c86050302ce33148aea70f62e61cacb92/applications/graph/node2vec/utils/snap.py#L76-L141 | |
CanalTP/navitia | cb84ce9859070187e708818b058e6a7e0b7f891b | source/jormungandr/jormungandr/scenarios/ridesharing/ridesharing_service_manager.py | python | RidesharingServiceManager._init_class | (self, klass, arguments) | Create an instance of a provider according to config
:param klass: name of the class configured in the database (Kros, Klaxit, Blablalines, ...)
:param arguments: parameters from the database required to create the Ridesharing class
:return: instance of Ridesharing service | Create an instance of a provider according to config
:param klass: name of the class configured in the database (Kros, Klaxit, Blablalines, ...)
:param arguments: parameters from the database required to create the Ridesharing class
:return: instance of Ridesharing service | [
"Create",
"an",
"instance",
"of",
"a",
"provider",
"according",
"to",
"config",
":",
"param",
"klass",
":",
"name",
"of",
"the",
"class",
"configured",
"in",
"the",
"database",
"(",
"Kros",
"Klaxit",
"Blablalines",
"...",
")",
":",
"param",
"arguments",
":... | def _init_class(self, klass, arguments):
"""
Create an instance of a provider according to config
:param klass: name of the class configured in the database (Kros, Klaxit, Blablalines, ...)
:param arguments: parameters from the database required to create the Ridesharing class
:r... | [
"def",
"_init_class",
"(",
"self",
",",
"klass",
",",
"arguments",
")",
":",
"try",
":",
"if",
"'.'",
"not",
"in",
"klass",
":",
"self",
".",
"logger",
".",
"warning",
"(",
"'impossible to build, wrongly formated class: {}'",
".",
"format",
"(",
"klass",
")"... | https://github.com/CanalTP/navitia/blob/cb84ce9859070187e708818b058e6a7e0b7f891b/source/jormungandr/jormungandr/scenarios/ridesharing/ridesharing_service_manager.py#L96-L112 | ||
iam-abbas/cs-algorithms | d04aa8fd9a1fa290266dde96afe9b90ee23c5a92 | Backtracking/KnightTour/py/KnightTour.py | python | solveKTUtil | (board,curr_x,curr_y,move_x,move_y,pos) | return False | A recursive utility function to solve Knight Tour
problem | A recursive utility function to solve Knight Tour
problem | [
"A",
"recursive",
"utility",
"function",
"to",
"solve",
"Knight",
"Tour",
"problem"
] | def solveKTUtil(board,curr_x,curr_y,move_x,move_y,pos):
'''
A recursive utility function to solve Knight Tour
problem
'''
if(pos == n**2):
return True
# Try all next moves from the current coordinate x, y
for i in range(8):
new_x = curr_x + move_x[i]
new_y = curr_y + move_y[i]
if(isSafe(ne... | [
"def",
"solveKTUtil",
"(",
"board",
",",
"curr_x",
",",
"curr_y",
",",
"move_x",
",",
"move_y",
",",
"pos",
")",
":",
"if",
"(",
"pos",
"==",
"n",
"**",
"2",
")",
":",
"return",
"True",
"# Try all next moves from the current coordinate x, y ",
"for",
"i",
... | https://github.com/iam-abbas/cs-algorithms/blob/d04aa8fd9a1fa290266dde96afe9b90ee23c5a92/Backtracking/KnightTour/py/KnightTour.py#L57-L77 | |
BlzFans/wke | b0fa21158312e40c5fbd84682d643022b6c34a93 | cygwin/lib/python2.6/site.py | python | setBEGINLIBPATH | () | The OS/2 EMX port has optional extension modules that do double duty
as DLLs (and must use the .DLL file extension) for other extensions.
The library search path needs to be amended so these will be found
during module import. Use BEGINLIBPATH so that these are at the start
of the library search path. | The OS/2 EMX port has optional extension modules that do double duty
as DLLs (and must use the .DLL file extension) for other extensions.
The library search path needs to be amended so these will be found
during module import. Use BEGINLIBPATH so that these are at the start
of the library search path. | [
"The",
"OS",
"/",
"2",
"EMX",
"port",
"has",
"optional",
"extension",
"modules",
"that",
"do",
"double",
"duty",
"as",
"DLLs",
"(",
"and",
"must",
"use",
"the",
".",
"DLL",
"file",
"extension",
")",
"for",
"other",
"extensions",
".",
"The",
"library",
... | def setBEGINLIBPATH():
"""The OS/2 EMX port has optional extension modules that do double duty
as DLLs (and must use the .DLL file extension) for other extensions.
The library search path needs to be amended so these will be found
during module import. Use BEGINLIBPATH so that these are at the start
... | [
"def",
"setBEGINLIBPATH",
"(",
")",
":",
"dllpath",
"=",
"os",
".",
"path",
".",
"join",
"(",
"sys",
".",
"prefix",
",",
"\"Lib\"",
",",
"\"lib-dynload\"",
")",
"libpath",
"=",
"os",
".",
"environ",
"[",
"'BEGINLIBPATH'",
"]",
".",
"split",
"(",
"';'",... | https://github.com/BlzFans/wke/blob/b0fa21158312e40c5fbd84682d643022b6c34a93/cygwin/lib/python2.6/site.py#L293-L307 | ||
adobe/chromium | cfe5bf0b51b1f6b9fe239c2a3c2f2364da9967d7 | chrome/common/extensions/docs/examples/apps/hello-python/oauth2/__init__.py | python | SignatureMethod.check | (self, request, consumer, token, signature) | return built == signature | Returns whether the given signature is the correct signature for
the given consumer and token signing the given request. | Returns whether the given signature is the correct signature for
the given consumer and token signing the given request. | [
"Returns",
"whether",
"the",
"given",
"signature",
"is",
"the",
"correct",
"signature",
"for",
"the",
"given",
"consumer",
"and",
"token",
"signing",
"the",
"given",
"request",
"."
] | def check(self, request, consumer, token, signature):
"""Returns whether the given signature is the correct signature for
the given consumer and token signing the given request."""
built = self.sign(request, consumer, token)
return built == signature | [
"def",
"check",
"(",
"self",
",",
"request",
",",
"consumer",
",",
"token",
",",
"signature",
")",
":",
"built",
"=",
"self",
".",
"sign",
"(",
"request",
",",
"consumer",
",",
"token",
")",
"return",
"built",
"==",
"signature"
] | https://github.com/adobe/chromium/blob/cfe5bf0b51b1f6b9fe239c2a3c2f2364da9967d7/chrome/common/extensions/docs/examples/apps/hello-python/oauth2/__init__.py#L702-L706 | |
wlanjie/AndroidFFmpeg | 7baf9122f4b8e1c74e7baf4be5c422c7a5ba5aaf | tools/fdk-aac-build/armeabi-v7a/toolchain/lib/python2.7/distutils/ccompiler.py | python | CCompiler._need_link | (self, objects, output_file) | Return true if we need to relink the files listed in 'objects'
to recreate 'output_file'. | Return true if we need to relink the files listed in 'objects'
to recreate 'output_file'. | [
"Return",
"true",
"if",
"we",
"need",
"to",
"relink",
"the",
"files",
"listed",
"in",
"objects",
"to",
"recreate",
"output_file",
"."
] | def _need_link(self, objects, output_file):
"""Return true if we need to relink the files listed in 'objects'
to recreate 'output_file'.
"""
if self.force:
return 1
else:
if self.dry_run:
newer = newer_group (objects, output_file, missing='... | [
"def",
"_need_link",
"(",
"self",
",",
"objects",
",",
"output_file",
")",
":",
"if",
"self",
".",
"force",
":",
"return",
"1",
"else",
":",
"if",
"self",
".",
"dry_run",
":",
"newer",
"=",
"newer_group",
"(",
"objects",
",",
"output_file",
",",
"missi... | https://github.com/wlanjie/AndroidFFmpeg/blob/7baf9122f4b8e1c74e7baf4be5c422c7a5ba5aaf/tools/fdk-aac-build/armeabi-v7a/toolchain/lib/python2.7/distutils/ccompiler.py#L461-L472 | ||
windystrife/UnrealEngine_NVIDIAGameWorks | b50e6338a7c5b26374d66306ebc7807541ff815e | Engine/Extras/ThirdPartyNotUE/emsdk/Win64/python/2.7.5.3_64bit/Lib/rfc822.py | python | Message.getheaders | (self, name) | return result | Get all values for a header.
This returns a list of values for headers given more than once; each
value in the result list is stripped in the same way as the result of
getheader(). If the header is not given, return an empty list. | Get all values for a header. | [
"Get",
"all",
"values",
"for",
"a",
"header",
"."
] | def getheaders(self, name):
"""Get all values for a header.
This returns a list of values for headers given more than once; each
value in the result list is stripped in the same way as the result of
getheader(). If the header is not given, return an empty list.
"""
resu... | [
"def",
"getheaders",
"(",
"self",
",",
"name",
")",
":",
"result",
"=",
"[",
"]",
"current",
"=",
"''",
"have_header",
"=",
"0",
"for",
"s",
"in",
"self",
".",
"getallmatchingheaders",
"(",
"name",
")",
":",
"if",
"s",
"[",
"0",
"]",
".",
"isspace"... | https://github.com/windystrife/UnrealEngine_NVIDIAGameWorks/blob/b50e6338a7c5b26374d66306ebc7807541ff815e/Engine/Extras/ThirdPartyNotUE/emsdk/Win64/python/2.7.5.3_64bit/Lib/rfc822.py#L295-L318 | |
cms-sw/cmssw | fd9de012d503d3405420bcbeec0ec879baa57cf2 | PhysicsTools/HeppyCore/python/utils/edmIntegrityCheck.py | python | IntegrityCheck.listFiles | (self,dir) | return castortools.listFiles(dir,self.options.resursive) | Recursively list a file or directory on castor | Recursively list a file or directory on castor | [
"Recursively",
"list",
"a",
"file",
"or",
"directory",
"on",
"castor"
] | def listFiles(self,dir):
"""Recursively list a file or directory on castor"""
return castortools.listFiles(dir,self.options.resursive) | [
"def",
"listFiles",
"(",
"self",
",",
"dir",
")",
":",
"return",
"castortools",
".",
"listFiles",
"(",
"dir",
",",
"self",
".",
"options",
".",
"resursive",
")"
] | https://github.com/cms-sw/cmssw/blob/fd9de012d503d3405420bcbeec0ec879baa57cf2/PhysicsTools/HeppyCore/python/utils/edmIntegrityCheck.py#L295-L297 | |
OpenXRay/xray-15 | 1390dfb08ed20997d7e8c95147ea8e8cb71f5e86 | cs/sdk/3d_sdk/maya/ver-8.5/devkit/plug-ins/scripted/torusField.py | python | TorusField.__noiseFunction | (self, inNoise) | return interpolate(0, 3) | A noise function | A noise function | [
"A",
"noise",
"function"
] | def __noiseFunction(self, inNoise):
"""
A noise function
"""
# Shared data for noise computation
#
xlim = [ [0,0], [0,0], [0,0] ] # integer bound for point
xarg = [0.0, 0.0, 0.0 ] # fractional part
# Helper functions to compute noise
#
rand3a = lambda x,y,z: frand(67*(x)+59*(y)+71*(z))
rand3b = l... | [
"def",
"__noiseFunction",
"(",
"self",
",",
"inNoise",
")",
":",
"# Shared data for noise computation",
"#",
"xlim",
"=",
"[",
"[",
"0",
",",
"0",
"]",
",",
"[",
"0",
",",
"0",
"]",
",",
"[",
"0",
",",
"0",
"]",
"]",
"# integer bound for point",
"xarg"... | https://github.com/OpenXRay/xray-15/blob/1390dfb08ed20997d7e8c95147ea8e8cb71f5e86/cs/sdk/3d_sdk/maya/ver-8.5/devkit/plug-ins/scripted/torusField.py#L539-L600 | |
wxWidgets/wxPython-Classic | 19571e1ae65f1ac445f5491474121998c97a1bf0 | src/osx_cocoa/_core.py | python | Menu.GetEventHandler | (*args, **kwargs) | return _core_.Menu_GetEventHandler(*args, **kwargs) | GetEventHandler(self) -> EvtHandler | GetEventHandler(self) -> EvtHandler | [
"GetEventHandler",
"(",
"self",
")",
"-",
">",
"EvtHandler"
] | def GetEventHandler(*args, **kwargs):
"""GetEventHandler(self) -> EvtHandler"""
return _core_.Menu_GetEventHandler(*args, **kwargs) | [
"def",
"GetEventHandler",
"(",
"*",
"args",
",",
"*",
"*",
"kwargs",
")",
":",
"return",
"_core_",
".",
"Menu_GetEventHandler",
"(",
"*",
"args",
",",
"*",
"*",
"kwargs",
")"
] | https://github.com/wxWidgets/wxPython-Classic/blob/19571e1ae65f1ac445f5491474121998c97a1bf0/src/osx_cocoa/_core.py#L12202-L12204 | |
aws/lumberyard | f85344403c1c2e77ec8c75deb2c116e97b713217 | dev/Tools/Python/3.7.10/windows/Lib/logging/handlers.py | python | MemoryHandler.flush | (self) | For a MemoryHandler, flushing means just sending the buffered
records to the target, if there is one. Override if you want
different behaviour.
The record buffer is also cleared by this operation. | For a MemoryHandler, flushing means just sending the buffered
records to the target, if there is one. Override if you want
different behaviour. | [
"For",
"a",
"MemoryHandler",
"flushing",
"means",
"just",
"sending",
"the",
"buffered",
"records",
"to",
"the",
"target",
"if",
"there",
"is",
"one",
".",
"Override",
"if",
"you",
"want",
"different",
"behaviour",
"."
] | def flush(self):
"""
For a MemoryHandler, flushing means just sending the buffered
records to the target, if there is one. Override if you want
different behaviour.
The record buffer is also cleared by this operation.
"""
self.acquire()
try:
i... | [
"def",
"flush",
"(",
"self",
")",
":",
"self",
".",
"acquire",
"(",
")",
"try",
":",
"if",
"self",
".",
"target",
":",
"for",
"record",
"in",
"self",
".",
"buffer",
":",
"self",
".",
"target",
".",
"handle",
"(",
"record",
")",
"self",
".",
"buff... | https://github.com/aws/lumberyard/blob/f85344403c1c2e77ec8c75deb2c116e97b713217/dev/Tools/Python/3.7.10/windows/Lib/logging/handlers.py#L1299-L1314 | ||
facebookresearch/ELF | 1f790173095cd910976d9f651b80beb872ec5d12 | rlpytorch/methods/rnn_actor_critic.py | python | RNNActorCritic.update | (self, mi, batch, hiddens, stats) | Actor critic model | Actor critic model | [
"Actor",
"critic",
"model"
] | def update(self, mi, batch, hiddens, stats):
''' Actor critic model '''
m = mi["model"]
args = self.args
value_node = self.args.value_node
T = batch["a"].size(0)
h = Variable(hiddens)
hs = [ ]
ss = [ ]
# Forward to compute LSTM.
for t in... | [
"def",
"update",
"(",
"self",
",",
"mi",
",",
"batch",
",",
"hiddens",
",",
"stats",
")",
":",
"m",
"=",
"mi",
"[",
"\"model\"",
"]",
"args",
"=",
"self",
".",
"args",
"value_node",
"=",
"self",
".",
"args",
".",
"value_node",
"T",
"=",
"batch",
... | https://github.com/facebookresearch/ELF/blob/1f790173095cd910976d9f651b80beb872ec5d12/rlpytorch/methods/rnn_actor_critic.py#L34-L78 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.