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 |
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
OpenLightingProject/ola | d1433a1bed73276fbe55ce18c03b1c208237decc | python/ola/OlaClient.py | python | RDMResponse.__init__ | (self, controller, response) | Create a new RDMResponse object.
Args:
controller: The RpcController
response: A RDMResponse proto message. | Create a new RDMResponse object. | [
"Create",
"a",
"new",
"RDMResponse",
"object",
"."
] | def __init__(self, controller, response):
"""
Create a new RDMResponse object.
Args:
controller: The RpcController
response: A RDMResponse proto message.
"""
self._frames = []
self.status = RequestStatus(controller)
if self.status.Succeeded() and response is not None:
sel... | [
"def",
"__init__",
"(",
"self",
",",
"controller",
",",
"response",
")",
":",
"self",
".",
"_frames",
"=",
"[",
"]",
"self",
".",
"status",
"=",
"RequestStatus",
"(",
"controller",
")",
"if",
"self",
".",
"status",
".",
"Succeeded",
"(",
")",
"and",
... | https://github.com/OpenLightingProject/ola/blob/d1433a1bed73276fbe55ce18c03b1c208237decc/python/ola/OlaClient.py#L638-L678 | ||
aws/lumberyard | f85344403c1c2e77ec8c75deb2c116e97b713217 | dev/Gems/CloudGemMetric/v1/AWS/python/windows/Lib/pandas/core/arrays/_arrow_utils.py | python | pyarrow_array_to_numpy_and_mask | (arr, dtype) | return data, mask | Convert a primitive pyarrow.Array to a numpy array and boolean mask based
on the buffers of the Array.
Parameters
----------
arr : pyarrow.Array
dtype : numpy.dtype
Returns
-------
(data, mask)
Tuple of two numpy arrays with the raw data (with specified dtype) and
a boo... | Convert a primitive pyarrow.Array to a numpy array and boolean mask based
on the buffers of the Array. | [
"Convert",
"a",
"primitive",
"pyarrow",
".",
"Array",
"to",
"a",
"numpy",
"array",
"and",
"boolean",
"mask",
"based",
"on",
"the",
"buffers",
"of",
"the",
"Array",
"."
] | def pyarrow_array_to_numpy_and_mask(arr, dtype):
"""
Convert a primitive pyarrow.Array to a numpy array and boolean mask based
on the buffers of the Array.
Parameters
----------
arr : pyarrow.Array
dtype : numpy.dtype
Returns
-------
(data, mask)
Tuple of two numpy arra... | [
"def",
"pyarrow_array_to_numpy_and_mask",
"(",
"arr",
",",
"dtype",
")",
":",
"buflist",
"=",
"arr",
".",
"buffers",
"(",
")",
"data",
"=",
"np",
".",
"frombuffer",
"(",
"buflist",
"[",
"1",
"]",
",",
"dtype",
"=",
"dtype",
")",
"[",
"arr",
".",
"off... | https://github.com/aws/lumberyard/blob/f85344403c1c2e77ec8c75deb2c116e97b713217/dev/Gems/CloudGemMetric/v1/AWS/python/windows/Lib/pandas/core/arrays/_arrow_utils.py#L12-L38 | |
ricardoquesada/Spidermonkey | 4a75ea2543408bd1b2c515aa95901523eeef7858 | python/mozbuild/mozpack/chrome/manifest.py | python | ManifestEntry.move | (self, base) | return parse_manifest_line(base, str(self)) | Return a new manifest entry with a different base path. | Return a new manifest entry with a different base path. | [
"Return",
"a",
"new",
"manifest",
"entry",
"with",
"a",
"different",
"base",
"path",
"."
] | def move(self, base):
'''
Return a new manifest entry with a different base path.
'''
return parse_manifest_line(base, str(self)) | [
"def",
"move",
"(",
"self",
",",
"base",
")",
":",
"return",
"parse_manifest_line",
"(",
"base",
",",
"str",
"(",
"self",
")",
")"
] | https://github.com/ricardoquesada/Spidermonkey/blob/4a75ea2543408bd1b2c515aa95901523eeef7858/python/mozbuild/mozpack/chrome/manifest.py#L70-L74 | |
wlanjie/AndroidFFmpeg | 7baf9122f4b8e1c74e7baf4be5c422c7a5ba5aaf | tools/fdk-aac-build/x86/toolchain/lib/python2.7/lib-tk/ttk.py | python | Radiobutton.invoke | (self) | return self.tk.call(self._w, "invoke") | Sets the option variable to the option value, selects the
widget, and invokes the associated command.
Returns the result of the command, or an empty string if
no command is specified. | Sets the option variable to the option value, selects the
widget, and invokes the associated command. | [
"Sets",
"the",
"option",
"variable",
"to",
"the",
"option",
"value",
"selects",
"the",
"widget",
"and",
"invokes",
"the",
"associated",
"command",
"."
] | def invoke(self):
"""Sets the option variable to the option value, selects the
widget, and invokes the associated command.
Returns the result of the command, or an empty string if
no command is specified."""
return self.tk.call(self._w, "invoke") | [
"def",
"invoke",
"(",
"self",
")",
":",
"return",
"self",
".",
"tk",
".",
"call",
"(",
"self",
".",
"_w",
",",
"\"invoke\"",
")"
] | https://github.com/wlanjie/AndroidFFmpeg/blob/7baf9122f4b8e1c74e7baf4be5c422c7a5ba5aaf/tools/fdk-aac-build/x86/toolchain/lib/python2.7/lib-tk/ttk.py#L1050-L1056 | |
wxWidgets/wxPython-Classic | 19571e1ae65f1ac445f5491474121998c97a1bf0 | wx/tools/Editra/src/ed_main.py | python | MainWindow.DispatchToControl | (self, evt) | return | Catches events that need to be passed to the current
text control for processing.
@param evt: wx.MenuEvent | Catches events that need to be passed to the current
text control for processing.
@param evt: wx.MenuEvent | [
"Catches",
"events",
"that",
"need",
"to",
"be",
"passed",
"to",
"the",
"current",
"text",
"control",
"for",
"processing",
".",
"@param",
"evt",
":",
"wx",
".",
"MenuEvent"
] | def DispatchToControl(self, evt):
"""Catches events that need to be passed to the current
text control for processing.
@param evt: wx.MenuEvent
"""
if not self.IsActive():
evt.Skip()
return
e_id = evt.Id
ctrl = self.nb.GetCurrentCtrl()
... | [
"def",
"DispatchToControl",
"(",
"self",
",",
"evt",
")",
":",
"if",
"not",
"self",
".",
"IsActive",
"(",
")",
":",
"evt",
".",
"Skip",
"(",
")",
"return",
"e_id",
"=",
"evt",
".",
"Id",
"ctrl",
"=",
"self",
".",
"nb",
".",
"GetCurrentCtrl",
"(",
... | https://github.com/wxWidgets/wxPython-Classic/blob/19571e1ae65f1ac445f5491474121998c97a1bf0/wx/tools/Editra/src/ed_main.py#L1125-L1225 | |
adobe/chromium | cfe5bf0b51b1f6b9fe239c2a3c2f2364da9967d7 | gpu/command_buffer/build_gles2_cmd_buffer.py | python | GETnHandler.WriteGLES2ImplementationHeader | (self, func, file) | Overrriden from TypeHandler. | Overrriden from TypeHandler. | [
"Overrriden",
"from",
"TypeHandler",
"."
] | def WriteGLES2ImplementationHeader(self, func, file):
"""Overrriden from TypeHandler."""
impl_decl = func.GetInfo('impl_decl')
if impl_decl == None or impl_decl == True:
file.Write("%s %s(%s) {\n" %
(func.return_type, func.original_name,
func.MakeTypedOriginalArgStri... | [
"def",
"WriteGLES2ImplementationHeader",
"(",
"self",
",",
"func",
",",
"file",
")",
":",
"impl_decl",
"=",
"func",
".",
"GetInfo",
"(",
"'impl_decl'",
")",
"if",
"impl_decl",
"==",
"None",
"or",
"impl_decl",
"==",
"True",
":",
"file",
".",
"Write",
"(",
... | https://github.com/adobe/chromium/blob/cfe5bf0b51b1f6b9fe239c2a3c2f2364da9967d7/gpu/command_buffer/build_gles2_cmd_buffer.py#L3385-L3426 | ||
H-uru/Plasma | c2140ea046e82e9c199e257a7f2e7edb42602871 | Scripts/Python/xOptionsMenu.py | python | xOptionsMenu.IRefreshAdvSettings | (self) | refresh the volume settings to the current settings | refresh the volume settings to the current settings | [
"refresh",
"the",
"volume",
"settings",
"to",
"the",
"current",
"settings"
] | def IRefreshAdvSettings(self):
"refresh the volume settings to the current settings"
# shadows
# We'll have to do this later, since it's no longer part of the AdvDisplaySettings Dialog
#~ shadowDistKnob = ptGUIControlValue(AdvGameSettingDlg.dialog.getControlFromTag(kGSDisplaySha... | [
"def",
"IRefreshAdvSettings",
"(",
"self",
")",
":",
"# shadows",
"# We'll have to do this later, since it's no longer part of the AdvDisplaySettings Dialog",
"#~ shadowDistKnob = ptGUIControlValue(AdvGameSettingDlg.dialog.getControlFromTag(kGSDisplayShadowDistSlider))",
"#~ setting = PtGetShadowV... | https://github.com/H-uru/Plasma/blob/c2140ea046e82e9c199e257a7f2e7edb42602871/Scripts/Python/xOptionsMenu.py#L1785-L1826 | ||
snap-stanford/snap-python | d53c51b0a26aa7e3e7400b014cdf728948fde80a | setup/snap.py | python | TMOut.__init__ | (self, *args) | __init__(TMOut self, int const & _MxBfL=1024) -> TMOut
Parameters:
_MxBfL: int const &
__init__(TMOut self) -> TMOut
__init__(TMOut self, char * _Bf, int const & _MxBfL) -> TMOut
Parameters:
_Bf: char *
_MxBfL: int const & | __init__(TMOut self, int const & _MxBfL=1024) -> TMOut | [
"__init__",
"(",
"TMOut",
"self",
"int",
"const",
"&",
"_MxBfL",
"=",
"1024",
")",
"-",
">",
"TMOut"
] | def __init__(self, *args):
"""
__init__(TMOut self, int const & _MxBfL=1024) -> TMOut
Parameters:
_MxBfL: int const &
__init__(TMOut self) -> TMOut
__init__(TMOut self, char * _Bf, int const & _MxBfL) -> TMOut
Parameters:
_Bf: char *
... | [
"def",
"__init__",
"(",
"self",
",",
"*",
"args",
")",
":",
"_snap",
".",
"TMOut_swiginit",
"(",
"self",
",",
"_snap",
".",
"new_TMOut",
"(",
"*",
"args",
")",
")"
] | https://github.com/snap-stanford/snap-python/blob/d53c51b0a26aa7e3e7400b014cdf728948fde80a/setup/snap.py#L2990-L3005 | ||
Xilinx/Vitis-AI | fc74d404563d9951b57245443c73bef389f3657f | tools/Vitis-AI-Quantizer/vai_q_tensorflow1.x/tensorflow/python/autograph/pyct/inspect_utils.py | python | getimmediatesource | (obj) | A variant of inspect.getsource that ignores the __wrapped__ property. | A variant of inspect.getsource that ignores the __wrapped__ property. | [
"A",
"variant",
"of",
"inspect",
".",
"getsource",
"that",
"ignores",
"the",
"__wrapped__",
"property",
"."
] | def getimmediatesource(obj):
"""A variant of inspect.getsource that ignores the __wrapped__ property."""
with _linecache_lock:
_fix_linecache_record(obj)
lines, lnum = inspect.findsource(obj)
return ''.join(inspect.getblock(lines[lnum:])) | [
"def",
"getimmediatesource",
"(",
"obj",
")",
":",
"with",
"_linecache_lock",
":",
"_fix_linecache_record",
"(",
"obj",
")",
"lines",
",",
"lnum",
"=",
"inspect",
".",
"findsource",
"(",
"obj",
")",
"return",
"''",
".",
"join",
"(",
"inspect",
".",
"getblo... | https://github.com/Xilinx/Vitis-AI/blob/fc74d404563d9951b57245443c73bef389f3657f/tools/Vitis-AI-Quantizer/vai_q_tensorflow1.x/tensorflow/python/autograph/pyct/inspect_utils.py#L123-L128 | ||
aws/lumberyard | f85344403c1c2e77ec8c75deb2c116e97b713217 | dev/Tools/Python/3.7.10/mac/Python.framework/Versions/3.7/lib/python3.7/fractions.py | python | Fraction.__pow__ | (a, b) | a ** b
If b is not an integer, the result will be a float or complex
since roots are generally irrational. If b is an integer, the
result will be rational. | a ** b | [
"a",
"**",
"b"
] | def __pow__(a, b):
"""a ** b
If b is not an integer, the result will be a float or complex
since roots are generally irrational. If b is an integer, the
result will be rational.
"""
if isinstance(b, numbers.Rational):
if b.denominator == 1:
p... | [
"def",
"__pow__",
"(",
"a",
",",
"b",
")",
":",
"if",
"isinstance",
"(",
"b",
",",
"numbers",
".",
"Rational",
")",
":",
"if",
"b",
".",
"denominator",
"==",
"1",
":",
"power",
"=",
"b",
".",
"numerator",
"if",
"power",
">=",
"0",
":",
"return",
... | https://github.com/aws/lumberyard/blob/f85344403c1c2e77ec8c75deb2c116e97b713217/dev/Tools/Python/3.7.10/mac/Python.framework/Versions/3.7/lib/python3.7/fractions.py#L448-L476 | ||
aws/lumberyard | f85344403c1c2e77ec8c75deb2c116e97b713217 | dev/Gems/CloudGemFramework/v1/AWS/resource-manager-code/lib/pyrsistent/_pmap.py | python | PMap.transform | (self, *transformations) | return transform(self, transformations) | Transform arbitrarily complex combinations of PVectors and PMaps. A transformation
consists of two parts. One match expression that specifies which elements to transform
and one transformation function that performs the actual transformation.
>>> from pyrsistent import freeze, ny
>>> ne... | Transform arbitrarily complex combinations of PVectors and PMaps. A transformation
consists of two parts. One match expression that specifies which elements to transform
and one transformation function that performs the actual transformation. | [
"Transform",
"arbitrarily",
"complex",
"combinations",
"of",
"PVectors",
"and",
"PMaps",
".",
"A",
"transformation",
"consists",
"of",
"two",
"parts",
".",
"One",
"match",
"expression",
"that",
"specifies",
"which",
"elements",
"to",
"transform",
"and",
"one",
"... | def transform(self, *transformations):
"""
Transform arbitrarily complex combinations of PVectors and PMaps. A transformation
consists of two parts. One match expression that specifies which elements to transform
and one transformation function that performs the actual transformation.
... | [
"def",
"transform",
"(",
"self",
",",
"*",
"transformations",
")",
":",
"return",
"transform",
"(",
"self",
",",
"transformations",
")"
] | https://github.com/aws/lumberyard/blob/f85344403c1c2e77ec8c75deb2c116e97b713217/dev/Gems/CloudGemFramework/v1/AWS/resource-manager-code/lib/pyrsistent/_pmap.py#L252-L278 | |
facebookincubator/BOLT | 88c70afe9d388ad430cc150cc158641701397f70 | lldb/third_party/Python/module/pexpect-4.6/pexpect/screen.py | python | screen._decode | (self, s) | This converts from the external coding system (as passed to
the constructor) to the internal one (unicode). | This converts from the external coding system (as passed to
the constructor) to the internal one (unicode). | [
"This",
"converts",
"from",
"the",
"external",
"coding",
"system",
"(",
"as",
"passed",
"to",
"the",
"constructor",
")",
"to",
"the",
"internal",
"one",
"(",
"unicode",
")",
"."
] | def _decode(self, s):
'''This converts from the external coding system (as passed to
the constructor) to the internal one (unicode). '''
if self.decoder is not None:
return self.decoder.decode(s)
else:
raise TypeError("This screen was constructed with encoding=Non... | [
"def",
"_decode",
"(",
"self",
",",
"s",
")",
":",
"if",
"self",
".",
"decoder",
"is",
"not",
"None",
":",
"return",
"self",
".",
"decoder",
".",
"decode",
"(",
"s",
")",
"else",
":",
"raise",
"TypeError",
"(",
"\"This screen was constructed with encoding=... | https://github.com/facebookincubator/BOLT/blob/88c70afe9d388ad430cc150cc158641701397f70/lldb/third_party/Python/module/pexpect-4.6/pexpect/screen.py#L104-L111 | ||
catboost/catboost | 167f64f237114a4d10b2b4ee42adb4569137debe | contrib/python/pandas/py2/pandas/core/arrays/categorical.py | python | Categorical.view | (self) | return self | Return a view of myself.
For internal compatibility with numpy arrays.
Returns
-------
view : Categorical
Returns `self`! | Return a view of myself. | [
"Return",
"a",
"view",
"of",
"myself",
"."
] | def view(self):
"""
Return a view of myself.
For internal compatibility with numpy arrays.
Returns
-------
view : Categorical
Returns `self`!
"""
return self | [
"def",
"view",
"(",
"self",
")",
":",
"return",
"self"
] | https://github.com/catboost/catboost/blob/167f64f237114a4d10b2b4ee42adb4569137debe/contrib/python/pandas/py2/pandas/core/arrays/categorical.py#L1694-L1705 | |
wxWidgets/wxPython-Classic | 19571e1ae65f1ac445f5491474121998c97a1bf0 | wx/lib/agw/aui/auibar.py | python | AuiToolBar.SetToolLabel | (self, tool_id, label) | Sets the tool label for the tool identified by `tool_id`.
:param integer `tool_id`: the tool identifier;
:param string `label`: the new toolbar item label. | Sets the tool label for the tool identified by `tool_id`. | [
"Sets",
"the",
"tool",
"label",
"for",
"the",
"tool",
"identified",
"by",
"tool_id",
"."
] | def SetToolLabel(self, tool_id, label):
"""
Sets the tool label for the tool identified by `tool_id`.
:param integer `tool_id`: the tool identifier;
:param string `label`: the new toolbar item label.
"""
tool = self.FindTool(tool_id)
if tool:
... | [
"def",
"SetToolLabel",
"(",
"self",
",",
"tool_id",
",",
"label",
")",
":",
"tool",
"=",
"self",
".",
"FindTool",
"(",
"tool_id",
")",
"if",
"tool",
":",
"tool",
".",
"label",
"=",
"label"
] | https://github.com/wxWidgets/wxPython-Classic/blob/19571e1ae65f1ac445f5491474121998c97a1bf0/wx/lib/agw/aui/auibar.py#L2727-L2737 | ||
aws/lumberyard | f85344403c1c2e77ec8c75deb2c116e97b713217 | dev/Tools/Python/3.7.10/mac/Python.framework/Versions/3.7/lib/python3.7/importlib/__init__.py | python | reload | (module) | Reload the module and return it.
The module must have been successfully imported before. | Reload the module and return it. | [
"Reload",
"the",
"module",
"and",
"return",
"it",
"."
] | def reload(module):
"""Reload the module and return it.
The module must have been successfully imported before.
"""
if not module or not isinstance(module, types.ModuleType):
raise TypeError("reload() argument must be a module")
try:
name = module.__spec__.name
except Attribute... | [
"def",
"reload",
"(",
"module",
")",
":",
"if",
"not",
"module",
"or",
"not",
"isinstance",
"(",
"module",
",",
"types",
".",
"ModuleType",
")",
":",
"raise",
"TypeError",
"(",
"\"reload() argument must be a module\"",
")",
"try",
":",
"name",
"=",
"module",... | https://github.com/aws/lumberyard/blob/f85344403c1c2e77ec8c75deb2c116e97b713217/dev/Tools/Python/3.7.10/mac/Python.framework/Versions/3.7/lib/python3.7/importlib/__init__.py#L133-L176 | ||
wlanjie/AndroidFFmpeg | 7baf9122f4b8e1c74e7baf4be5c422c7a5ba5aaf | tools/fdk-aac-build/armeabi/toolchain/lib/python2.7/cookielib.py | python | FileCookieJar.revert | (self, filename=None,
ignore_discard=False, ignore_expires=False) | Clear all cookies and reload cookies from a saved file.
Raises LoadError (or IOError) if reversion is not successful; the
object's state will not be altered if this happens. | Clear all cookies and reload cookies from a saved file. | [
"Clear",
"all",
"cookies",
"and",
"reload",
"cookies",
"from",
"a",
"saved",
"file",
"."
] | def revert(self, filename=None,
ignore_discard=False, ignore_expires=False):
"""Clear all cookies and reload cookies from a saved file.
Raises LoadError (or IOError) if reversion is not successful; the
object's state will not be altered if this happens.
"""
if fi... | [
"def",
"revert",
"(",
"self",
",",
"filename",
"=",
"None",
",",
"ignore_discard",
"=",
"False",
",",
"ignore_expires",
"=",
"False",
")",
":",
"if",
"filename",
"is",
"None",
":",
"if",
"self",
".",
"filename",
"is",
"not",
"None",
":",
"filename",
"=... | https://github.com/wlanjie/AndroidFFmpeg/blob/7baf9122f4b8e1c74e7baf4be5c422c7a5ba5aaf/tools/fdk-aac-build/armeabi/toolchain/lib/python2.7/cookielib.py#L1767-L1791 | ||
MythTV/mythtv | d282a209cb8be85d036f85a62a8ec971b67d45f4 | platform/win32/msvc/external/exiv2/msvc64/setbuild.py | python | save | (path) | save - make a backup (or restore the backup) | save - make a backup (or restore the backup) | [
"save",
"-",
"make",
"a",
"backup",
"(",
"or",
"restore",
"the",
"backup",
")"
] | def save(path):
"""save - make a backup (or restore the backup)"""
orig = path+'.orig'
if os.path.exists(orig):
cp(orig,path)
else:
cp(path,orig) | [
"def",
"save",
"(",
"path",
")",
":",
"orig",
"=",
"path",
"+",
"'.orig'",
"if",
"os",
".",
"path",
".",
"exists",
"(",
"orig",
")",
":",
"cp",
"(",
"orig",
",",
"path",
")",
"else",
":",
"cp",
"(",
"path",
",",
"orig",
")"
] | https://github.com/MythTV/mythtv/blob/d282a209cb8be85d036f85a62a8ec971b67d45f4/platform/win32/msvc/external/exiv2/msvc64/setbuild.py#L42-L48 | ||
mindspore-ai/mindspore | fb8fd3338605bb34fa5cea054e535a8b1d753fab | mindspore/python/mindspore/ops/composite/multitype_ops/div_impl.py | python | _tuple_div_tensor | (x, y) | return F.tensor_div(x, y) | Tuple divided by tensor.
Args:
x (Tuple): x
y (Tensor): The dtype is same as x.
Returns:
Tensor, has the same dtype as x. | Tuple divided by tensor. | [
"Tuple",
"divided",
"by",
"tensor",
"."
] | def _tuple_div_tensor(x, y):
"""
Tuple divided by tensor.
Args:
x (Tuple): x
y (Tensor): The dtype is same as x.
Returns:
Tensor, has the same dtype as x.
"""
x = utils.sequence_to_tensor(x, y.dtype)
return F.tensor_div(x, y) | [
"def",
"_tuple_div_tensor",
"(",
"x",
",",
"y",
")",
":",
"x",
"=",
"utils",
".",
"sequence_to_tensor",
"(",
"x",
",",
"y",
".",
"dtype",
")",
"return",
"F",
".",
"tensor_div",
"(",
"x",
",",
"y",
")"
] | https://github.com/mindspore-ai/mindspore/blob/fb8fd3338605bb34fa5cea054e535a8b1d753fab/mindspore/python/mindspore/ops/composite/multitype_ops/div_impl.py#L91-L103 | |
LiquidPlayer/LiquidCore | 9405979363f2353ac9a71ad8ab59685dd7f919c9 | deps/boost_1_66_0/tools/build/src/build/generators.py | python | Generator.requirements | (self) | return self.requirements_ | Returns the required properties for this generator. Properties
in returned set must be present in build properties if this
generator is to be used. If result has grist-only element,
that build properties must include some value of that feature. | Returns the required properties for this generator. Properties
in returned set must be present in build properties if this
generator is to be used. If result has grist-only element,
that build properties must include some value of that feature. | [
"Returns",
"the",
"required",
"properties",
"for",
"this",
"generator",
".",
"Properties",
"in",
"returned",
"set",
"must",
"be",
"present",
"in",
"build",
"properties",
"if",
"this",
"generator",
"is",
"to",
"be",
"used",
".",
"If",
"result",
"has",
"grist"... | def requirements (self):
""" Returns the required properties for this generator. Properties
in returned set must be present in build properties if this
generator is to be used. If result has grist-only element,
that build properties must include some value of that feature.
... | [
"def",
"requirements",
"(",
"self",
")",
":",
"return",
"self",
".",
"requirements_"
] | https://github.com/LiquidPlayer/LiquidCore/blob/9405979363f2353ac9a71ad8ab59685dd7f919c9/deps/boost_1_66_0/tools/build/src/build/generators.py#L293-L299 | |
ceph/ceph | 959663007321a369c83218414a29bd9dbc8bda3a | qa/tasks/cephfs/mount.py | python | CephFSMount.df | (self) | return {
"total": int(total),
"used": int(used),
"available": int(avail)
} | Wrap df: return a dict of usage fields in bytes | Wrap df: return a dict of usage fields in bytes | [
"Wrap",
"df",
":",
"return",
"a",
"dict",
"of",
"usage",
"fields",
"in",
"bytes"
] | def df(self):
"""
Wrap df: return a dict of usage fields in bytes
"""
p = self.run_shell(["df", "-B1", "."])
lines = p.stdout.getvalue().strip().split("\n")
fs, total, used, avail = lines[1].split()[:4]
log.warning(lines)
return {
"total": in... | [
"def",
"df",
"(",
"self",
")",
":",
"p",
"=",
"self",
".",
"run_shell",
"(",
"[",
"\"df\"",
",",
"\"-B1\"",
",",
"\".\"",
"]",
")",
"lines",
"=",
"p",
".",
"stdout",
".",
"getvalue",
"(",
")",
".",
"strip",
"(",
")",
".",
"split",
"(",
"\"\\n\"... | https://github.com/ceph/ceph/blob/959663007321a369c83218414a29bd9dbc8bda3a/qa/tasks/cephfs/mount.py#L1328-L1342 | |
wxWidgets/wxPython-Classic | 19571e1ae65f1ac445f5491474121998c97a1bf0 | src/msw/stc.py | python | StyledTextCtrl.DeleteBack | (*args, **kwargs) | return _stc.StyledTextCtrl_DeleteBack(*args, **kwargs) | DeleteBack(self)
Delete the selection or if no selection, the character before the caret. | DeleteBack(self) | [
"DeleteBack",
"(",
"self",
")"
] | def DeleteBack(*args, **kwargs):
"""
DeleteBack(self)
Delete the selection or if no selection, the character before the caret.
"""
return _stc.StyledTextCtrl_DeleteBack(*args, **kwargs) | [
"def",
"DeleteBack",
"(",
"*",
"args",
",",
"*",
"*",
"kwargs",
")",
":",
"return",
"_stc",
".",
"StyledTextCtrl_DeleteBack",
"(",
"*",
"args",
",",
"*",
"*",
"kwargs",
")"
] | https://github.com/wxWidgets/wxPython-Classic/blob/19571e1ae65f1ac445f5491474121998c97a1bf0/src/msw/stc.py#L4538-L4544 | |
aws/lumberyard | f85344403c1c2e77ec8c75deb2c116e97b713217 | dev/Gems/CloudGemMetric/v1/AWS/python/windows/Lib/llvmlite/ir/types.py | python | ArrayType.gep | (self, i) | return self.element | Resolve the type of the i-th element (for getelementptr lookups). | Resolve the type of the i-th element (for getelementptr lookups). | [
"Resolve",
"the",
"type",
"of",
"the",
"i",
"-",
"th",
"element",
"(",
"for",
"getelementptr",
"lookups",
")",
"."
] | def gep(self, i):
"""
Resolve the type of the i-th element (for getelementptr lookups).
"""
if not isinstance(i.type, IntType):
raise TypeError(i.type)
return self.element | [
"def",
"gep",
"(",
"self",
",",
"i",
")",
":",
"if",
"not",
"isinstance",
"(",
"i",
".",
"type",
",",
"IntType",
")",
":",
"raise",
"TypeError",
"(",
"i",
".",
"type",
")",
"return",
"self",
".",
"element"
] | https://github.com/aws/lumberyard/blob/f85344403c1c2e77ec8c75deb2c116e97b713217/dev/Gems/CloudGemMetric/v1/AWS/python/windows/Lib/llvmlite/ir/types.py#L458-L464 | |
hughperkins/tf-coriander | 970d3df6c11400ad68405f22b0c42a52374e94ca | tensorflow/contrib/lookup/lookup_ops.py | python | TextFileIdTableInitializer.__init__ | (self,
filename,
key_column_index=TextFileIndex.WHOLE_LINE,
value_column_index=TextFileIndex.LINE_NUMBER,
vocab_size=None,
delimiter="\t",
name="text_file_id_table_init") | Constructs an initializer for an string-to-id table from a text file.
It populates a table that its key and value types are string and int64,
respectively. It generates one key-value pair per line.
The content of the key and value are specified by the key_index
and value_index.
- TextFileIndex.LIN... | Constructs an initializer for an string-to-id table from a text file. | [
"Constructs",
"an",
"initializer",
"for",
"an",
"string",
"-",
"to",
"-",
"id",
"table",
"from",
"a",
"text",
"file",
"."
] | def __init__(self,
filename,
key_column_index=TextFileIndex.WHOLE_LINE,
value_column_index=TextFileIndex.LINE_NUMBER,
vocab_size=None,
delimiter="\t",
name="text_file_id_table_init"):
"""Constructs an initializer for an string... | [
"def",
"__init__",
"(",
"self",
",",
"filename",
",",
"key_column_index",
"=",
"TextFileIndex",
".",
"WHOLE_LINE",
",",
"value_column_index",
"=",
"TextFileIndex",
".",
"LINE_NUMBER",
",",
"vocab_size",
"=",
"None",
",",
"delimiter",
"=",
"\"\\t\"",
",",
"name",... | https://github.com/hughperkins/tf-coriander/blob/970d3df6c11400ad68405f22b0c42a52374e94ca/tensorflow/contrib/lookup/lookup_ops.py#L531-L575 | ||
okex/V3-Open-API-SDK | c5abb0db7e2287718e0055e17e57672ce0ec7fd9 | okex-python-sdk-api/venv/Lib/site-packages/pip-19.0.3-py3.8.egg/pip/_vendor/pkg_resources/__init__.py | python | WorkingSet.add_entry | (self, entry) | Add a path item to ``.entries``, finding any distributions on it
``find_distributions(entry, True)`` is used to find distributions
corresponding to the path entry, and they are added. `entry` is
always appended to ``.entries``, even if it is already present.
(This is because ``sys.path... | Add a path item to ``.entries``, finding any distributions on it | [
"Add",
"a",
"path",
"item",
"to",
".",
"entries",
"finding",
"any",
"distributions",
"on",
"it"
] | def add_entry(self, entry):
"""Add a path item to ``.entries``, finding any distributions on it
``find_distributions(entry, True)`` is used to find distributions
corresponding to the path entry, and they are added. `entry` is
always appended to ``.entries``, even if it is already prese... | [
"def",
"add_entry",
"(",
"self",
",",
"entry",
")",
":",
"self",
".",
"entry_keys",
".",
"setdefault",
"(",
"entry",
",",
"[",
"]",
")",
"self",
".",
"entries",
".",
"append",
"(",
"entry",
")",
"for",
"dist",
"in",
"find_distributions",
"(",
"entry",
... | https://github.com/okex/V3-Open-API-SDK/blob/c5abb0db7e2287718e0055e17e57672ce0ec7fd9/okex-python-sdk-api/venv/Lib/site-packages/pip-19.0.3-py3.8.egg/pip/_vendor/pkg_resources/__init__.py#L609-L622 | ||
hpi-xnor/BMXNet-v2 | af2b1859eafc5c721b1397cef02f946aaf2ce20d | python/mxnet/contrib/onnx/onnx2mx/_op_translations.py | python | clip | (attrs, inputs, proto_obj) | return 'clip', new_attrs, inputs | Clips (limits) the values in an array. | Clips (limits) the values in an array. | [
"Clips",
"(",
"limits",
")",
"the",
"values",
"in",
"an",
"array",
"."
] | def clip(attrs, inputs, proto_obj):
"""Clips (limits) the values in an array."""
new_attrs = translation_utils._fix_attribute_names(attrs, {'min' : 'a_min',
'max' : 'a_max'})
if 'a_max' not in new_attrs:
new_attrs = translation_utils._ad... | [
"def",
"clip",
"(",
"attrs",
",",
"inputs",
",",
"proto_obj",
")",
":",
"new_attrs",
"=",
"translation_utils",
".",
"_fix_attribute_names",
"(",
"attrs",
",",
"{",
"'min'",
":",
"'a_min'",
",",
"'max'",
":",
"'a_max'",
"}",
")",
"if",
"'a_max'",
"not",
"... | https://github.com/hpi-xnor/BMXNet-v2/blob/af2b1859eafc5c721b1397cef02f946aaf2ce20d/python/mxnet/contrib/onnx/onnx2mx/_op_translations.py#L546-L554 | |
tensorflow/tensorflow | 419e3a6b650ea4bd1b0cba23c4348f8a69f3272e | tensorflow/python/framework/function.py | python | _DefinedFunction.declared_input_types | (self) | return self._input_types | Returns the list of data types of explicit declared inputs. | Returns the list of data types of explicit declared inputs. | [
"Returns",
"the",
"list",
"of",
"data",
"types",
"of",
"explicit",
"declared",
"inputs",
"."
] | def declared_input_types(self):
"""Returns the list of data types of explicit declared inputs."""
return self._input_types | [
"def",
"declared_input_types",
"(",
"self",
")",
":",
"return",
"self",
".",
"_input_types"
] | https://github.com/tensorflow/tensorflow/blob/419e3a6b650ea4bd1b0cba23c4348f8a69f3272e/tensorflow/python/framework/function.py#L353-L355 | |
PixarAnimationStudios/USD | faed18ce62c8736b02413635b584a2f637156bad | pxr/usdImaging/usdviewq/appController.py | python | AppController._primViewExpanded | (self, index) | Signal handler for expanded(index), facilitates lazy tree population | Signal handler for expanded(index), facilitates lazy tree population | [
"Signal",
"handler",
"for",
"expanded",
"(",
"index",
")",
"facilitates",
"lazy",
"tree",
"population"
] | def _primViewExpanded(self, index):
"""Signal handler for expanded(index), facilitates lazy tree population
"""
self._populateChildren(self._ui.primView.itemFromIndex(index))
self._scheduleResizePrimView() | [
"def",
"_primViewExpanded",
"(",
"self",
",",
"index",
")",
":",
"self",
".",
"_populateChildren",
"(",
"self",
".",
"_ui",
".",
"primView",
".",
"itemFromIndex",
"(",
"index",
")",
")",
"self",
".",
"_scheduleResizePrimView",
"(",
")"
] | https://github.com/PixarAnimationStudios/USD/blob/faed18ce62c8736b02413635b584a2f637156bad/pxr/usdImaging/usdviewq/appController.py#L2970-L2974 | ||
D-X-Y/caffe-faster-rcnn | eb50c97ff48f3df115d0e85fe0a32b0c7e2aa4cb | python/caffe/io.py | python | array_to_datum | (arr, label=None) | return datum | Converts a 3-dimensional array to datum. If the array has dtype uint8,
the output data will be encoded as a string. Otherwise, the output data
will be stored in float format. | Converts a 3-dimensional array to datum. If the array has dtype uint8,
the output data will be encoded as a string. Otherwise, the output data
will be stored in float format. | [
"Converts",
"a",
"3",
"-",
"dimensional",
"array",
"to",
"datum",
".",
"If",
"the",
"array",
"has",
"dtype",
"uint8",
"the",
"output",
"data",
"will",
"be",
"encoded",
"as",
"a",
"string",
".",
"Otherwise",
"the",
"output",
"data",
"will",
"be",
"stored"... | def array_to_datum(arr, label=None):
"""Converts a 3-dimensional array to datum. If the array has dtype uint8,
the output data will be encoded as a string. Otherwise, the output data
will be stored in float format.
"""
if arr.ndim != 3:
raise ValueError('Incorrect array shape.')
datum = ... | [
"def",
"array_to_datum",
"(",
"arr",
",",
"label",
"=",
"None",
")",
":",
"if",
"arr",
".",
"ndim",
"!=",
"3",
":",
"raise",
"ValueError",
"(",
"'Incorrect array shape.'",
")",
"datum",
"=",
"caffe_pb2",
".",
"Datum",
"(",
")",
"datum",
".",
"channels",
... | https://github.com/D-X-Y/caffe-faster-rcnn/blob/eb50c97ff48f3df115d0e85fe0a32b0c7e2aa4cb/python/caffe/io.py#L66-L81 | |
wlanjie/AndroidFFmpeg | 7baf9122f4b8e1c74e7baf4be5c422c7a5ba5aaf | tools/fdk-aac-build/armeabi-v7a/toolchain/lib/python2.7/lib-tk/Tkinter.py | python | Checkbutton.deselect | (self) | Put the button in off-state. | Put the button in off-state. | [
"Put",
"the",
"button",
"in",
"off",
"-",
"state",
"."
] | def deselect(self):
"""Put the button in off-state."""
self.tk.call(self._w, 'deselect') | [
"def",
"deselect",
"(",
"self",
")",
":",
"self",
".",
"tk",
".",
"call",
"(",
"self",
".",
"_w",
",",
"'deselect'",
")"
] | https://github.com/wlanjie/AndroidFFmpeg/blob/7baf9122f4b8e1c74e7baf4be5c422c7a5ba5aaf/tools/fdk-aac-build/armeabi-v7a/toolchain/lib/python2.7/lib-tk/Tkinter.py#L2418-L2420 | ||
wlanjie/AndroidFFmpeg | 7baf9122f4b8e1c74e7baf4be5c422c7a5ba5aaf | tools/fdk-aac-build/armeabi/toolchain/lib/python2.7/mailbox.py | python | BabylMessage.__init__ | (self, message=None) | Initialize an BabylMessage instance. | Initialize an BabylMessage instance. | [
"Initialize",
"an",
"BabylMessage",
"instance",
"."
] | def __init__(self, message=None):
"""Initialize an BabylMessage instance."""
self._labels = []
self._visible = Message()
Message.__init__(self, message) | [
"def",
"__init__",
"(",
"self",
",",
"message",
"=",
"None",
")",
":",
"self",
".",
"_labels",
"=",
"[",
"]",
"self",
".",
"_visible",
"=",
"Message",
"(",
")",
"Message",
".",
"__init__",
"(",
"self",
",",
"message",
")"
] | https://github.com/wlanjie/AndroidFFmpeg/blob/7baf9122f4b8e1c74e7baf4be5c422c7a5ba5aaf/tools/fdk-aac-build/armeabi/toolchain/lib/python2.7/mailbox.py#L1766-L1770 | ||
aws/lumberyard | f85344403c1c2e77ec8c75deb2c116e97b713217 | dev/Tools/Python/3.7.10/linux_x64/lib/python3.7/importlib/util.py | python | _LazyModule.__delattr__ | (self, attr) | Trigger the load and then perform the deletion. | Trigger the load and then perform the deletion. | [
"Trigger",
"the",
"load",
"and",
"then",
"perform",
"the",
"deletion",
"."
] | def __delattr__(self, attr):
"""Trigger the load and then perform the deletion."""
# To trigger the load and raise an exception if the attribute
# doesn't exist.
self.__getattribute__(attr)
delattr(self, attr) | [
"def",
"__delattr__",
"(",
"self",
",",
"attr",
")",
":",
"# To trigger the load and raise an exception if the attribute",
"# doesn't exist.",
"self",
".",
"__getattribute__",
"(",
"attr",
")",
"delattr",
"(",
"self",
",",
"attr",
")"
] | https://github.com/aws/lumberyard/blob/f85344403c1c2e77ec8c75deb2c116e97b713217/dev/Tools/Python/3.7.10/linux_x64/lib/python3.7/importlib/util.py#L258-L263 | ||
wxWidgets/wxPython-Classic | 19571e1ae65f1ac445f5491474121998c97a1bf0 | src/osx_carbon/_misc.py | python | Caret.SetBlinkTime | (*args, **kwargs) | return _misc_.Caret_SetBlinkTime(*args, **kwargs) | SetBlinkTime(int milliseconds) | SetBlinkTime(int milliseconds) | [
"SetBlinkTime",
"(",
"int",
"milliseconds",
")"
] | def SetBlinkTime(*args, **kwargs):
"""SetBlinkTime(int milliseconds)"""
return _misc_.Caret_SetBlinkTime(*args, **kwargs) | [
"def",
"SetBlinkTime",
"(",
"*",
"args",
",",
"*",
"*",
"kwargs",
")",
":",
"return",
"_misc_",
".",
"Caret_SetBlinkTime",
"(",
"*",
"args",
",",
"*",
"*",
"kwargs",
")"
] | https://github.com/wxWidgets/wxPython-Classic/blob/19571e1ae65f1ac445f5491474121998c97a1bf0/src/osx_carbon/_misc.py#L804-L806 | |
apple/swift-clang | d7403439fc6641751840b723e7165fb02f52db95 | tools/scan-build-py/libscanbuild/arguments.py | python | create_default_parser | () | return parser | Creates command line parser for all build wrapper commands. | Creates command line parser for all build wrapper commands. | [
"Creates",
"command",
"line",
"parser",
"for",
"all",
"build",
"wrapper",
"commands",
"."
] | def create_default_parser():
""" Creates command line parser for all build wrapper commands. """
parser = argparse.ArgumentParser(
formatter_class=argparse.ArgumentDefaultsHelpFormatter)
parser.add_argument(
'--verbose',
'-v',
action='count',
default=0,
help... | [
"def",
"create_default_parser",
"(",
")",
":",
"parser",
"=",
"argparse",
".",
"ArgumentParser",
"(",
"formatter_class",
"=",
"argparse",
".",
"ArgumentDefaultsHelpFormatter",
")",
"parser",
".",
"add_argument",
"(",
"'--verbose'",
",",
"'-v'",
",",
"action",
"=",... | https://github.com/apple/swift-clang/blob/d7403439fc6641751840b723e7165fb02f52db95/tools/scan-build-py/libscanbuild/arguments.py#L409-L422 | |
krishauser/Klampt | 972cc83ea5befac3f653c1ba20f80155768ad519 | Python/klampt/control/motion_generation.py | python | AccelerationBoundedMotionGeneration.update | (self,dt,xtarget=None,vtarget=None) | return x,v | Updates the motion generator. Optionally sets the new target and velocity.
If velocity is None, ends in 0 velocity.
Returns:
tuple: (x,v) giving the new state | Updates the motion generator. Optionally sets the new target and velocity.
If velocity is None, ends in 0 velocity. | [
"Updates",
"the",
"motion",
"generator",
".",
"Optionally",
"sets",
"the",
"new",
"target",
"and",
"velocity",
".",
"If",
"velocity",
"is",
"None",
"ends",
"in",
"0",
"velocity",
"."
] | def update(self,dt,xtarget=None,vtarget=None):
"""Updates the motion generator. Optionally sets the new target and velocity.
If velocity is None, ends in 0 velocity.
Returns:
tuple: (x,v) giving the new state
"""
if dt <= 0:
raise ValueError("Invalid dt"... | [
"def",
"update",
"(",
"self",
",",
"dt",
",",
"xtarget",
"=",
"None",
",",
"vtarget",
"=",
"None",
")",
":",
"if",
"dt",
"<=",
"0",
":",
"raise",
"ValueError",
"(",
"\"Invalid dt\"",
")",
"if",
"xtarget",
"is",
"not",
"None",
":",
"self",
".",
"set... | https://github.com/krishauser/Klampt/blob/972cc83ea5befac3f653c1ba20f80155768ad519/Python/klampt/control/motion_generation.py#L236-L253 | |
ArduPilot/ardupilot | 6e684b3496122b8158ac412b609d00004b7ac306 | libraries/AP_Math/tools/geodesic_grid/icosahedron.py | python | neighbor_triangle | (t, edge) | return None | Return the neighbor triangle of t with respect to edge = (a, b) | Return the neighbor triangle of t with respect to edge = (a, b) | [
"Return",
"the",
"neighbor",
"triangle",
"of",
"t",
"with",
"respect",
"to",
"edge",
"=",
"(",
"a",
"b",
")"
] | def neighbor_triangle(t, edge):
""" Return the neighbor triangle of t with respect to edge = (a, b) """
e = frozenset(edge)
if (t, e) in _neighbor_triangle_data:
return _neighbor_triangle_data[(t, e)]
a, b = edge
if a not in t or b not in t:
return None
for w in triangles:
... | [
"def",
"neighbor_triangle",
"(",
"t",
",",
"edge",
")",
":",
"e",
"=",
"frozenset",
"(",
"edge",
")",
"if",
"(",
"t",
",",
"e",
")",
"in",
"_neighbor_triangle_data",
":",
"return",
"_neighbor_triangle_data",
"[",
"(",
"t",
",",
"e",
")",
"]",
"a",
",... | https://github.com/ArduPilot/ardupilot/blob/6e684b3496122b8158ac412b609d00004b7ac306/libraries/AP_Math/tools/geodesic_grid/icosahedron.py#L108-L123 | |
intel/llvm | e6d0547e9d99b5a56430c4749f6c7e328bf221ab | clang/docs/tools/generate_formatted_state.py | python | get_style | (count, passed) | return ":none:" | Determine if this directory is good based on the number of clean
files vs the number of files in total. | Determine if this directory is good based on the number of clean
files vs the number of files in total. | [
"Determine",
"if",
"this",
"directory",
"is",
"good",
"based",
"on",
"the",
"number",
"of",
"clean",
"files",
"vs",
"the",
"number",
"of",
"files",
"in",
"total",
"."
] | def get_style(count, passed):
""" Determine if this directory is good based on the number of clean
files vs the number of files in total. """
if passed == count:
return ":good:"
if passed != 0:
return ":part:"
return ":none:" | [
"def",
"get_style",
"(",
"count",
",",
"passed",
")",
":",
"if",
"passed",
"==",
"count",
":",
"return",
"\":good:\"",
"if",
"passed",
"!=",
"0",
":",
"return",
"\":part:\"",
"return",
"\":none:\""
] | https://github.com/intel/llvm/blob/e6d0547e9d99b5a56430c4749f6c7e328bf221ab/clang/docs/tools/generate_formatted_state.py#L17-L24 | |
wxWidgets/wxPython-Classic | 19571e1ae65f1ac445f5491474121998c97a1bf0 | src/gtk/_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/gtk/_misc.py#L2011-L2013 | |
catboost/catboost | 167f64f237114a4d10b2b4ee42adb4569137debe | contrib/python/ipython/py2/IPython/core/magic.py | python | MagicsManager.register_alias | (self, alias_name, magic_name, magic_kind='line') | Register an alias to a magic function.
The alias is an instance of :class:`MagicAlias`, which holds the
name and kind of the magic it should call. Binding is done at
call time, so if the underlying magic function is changed the alias
will call the new function.
Parameters
... | Register an alias to a magic function. | [
"Register",
"an",
"alias",
"to",
"a",
"magic",
"function",
"."
] | def register_alias(self, alias_name, magic_name, magic_kind='line'):
"""Register an alias to a magic function.
The alias is an instance of :class:`MagicAlias`, which holds the
name and kind of the magic it should call. Binding is done at
call time, so if the underlying magic function is... | [
"def",
"register_alias",
"(",
"self",
",",
"alias_name",
",",
"magic_name",
",",
"magic_kind",
"=",
"'line'",
")",
":",
"# `validate_type` is too permissive, as it allows 'line_cell'",
"# which we do not handle.",
"if",
"magic_kind",
"not",
"in",
"magic_kinds",
":",
"rais... | https://github.com/catboost/catboost/blob/167f64f237114a4d10b2b4ee42adb4569137debe/contrib/python/ipython/py2/IPython/core/magic.py#L429-L457 | ||
mindspore-ai/mindspore | fb8fd3338605bb34fa5cea054e535a8b1d753fab | mindspore/python/mindspore/_extends/parallel_compile/tbe_compiler/tbe_helper.py | python | check_job_json | (job_info) | Check tne compilation job json's required element
:param job_info:tne compilation job json
:return: raise value error if wrong | Check tne compilation job json's required element
:param job_info:tne compilation job json
:return: raise value error if wrong | [
"Check",
"tne",
"compilation",
"job",
"json",
"s",
"required",
"element",
":",
"param",
"job_info",
":",
"tne",
"compilation",
"job",
"json",
":",
"return",
":",
"raise",
"value",
"error",
"if",
"wrong"
] | def check_job_json(job_info):
"""
Check tne compilation job json's required element
:param job_info:tne compilation job json
:return: raise value error if wrong
"""
if 'source_id' not in job_info:
raise ValueError("Json string Errors, key:source_id not found.")
if 'job_id' not in job... | [
"def",
"check_job_json",
"(",
"job_info",
")",
":",
"if",
"'source_id'",
"not",
"in",
"job_info",
":",
"raise",
"ValueError",
"(",
"\"Json string Errors, key:source_id not found.\"",
")",
"if",
"'job_id'",
"not",
"in",
"job_info",
":",
"raise",
"ValueError",
"(",
... | https://github.com/mindspore-ai/mindspore/blob/fb8fd3338605bb34fa5cea054e535a8b1d753fab/mindspore/python/mindspore/_extends/parallel_compile/tbe_compiler/tbe_helper.py#L32-L47 | ||
SpenceKonde/megaTinyCore | 1c4a70b18a149fe6bcb551dfa6db11ca50b8997b | megaavr/tools/libs/pyedbglib/util/print_helpers.py | python | bytelist_to_hex_string | (bytelist) | return '[' + ', '.join("0x%02X" % x for x in bytelist) + ']' | :param bytelist: list of byte values
:return: String representation of the bytelist with each item as a byte value on the format 0xXX | :param bytelist: list of byte values
:return: String representation of the bytelist with each item as a byte value on the format 0xXX | [
":",
"param",
"bytelist",
":",
"list",
"of",
"byte",
"values",
":",
"return",
":",
"String",
"representation",
"of",
"the",
"bytelist",
"with",
"each",
"item",
"as",
"a",
"byte",
"value",
"on",
"the",
"format",
"0xXX"
] | def bytelist_to_hex_string(bytelist):
"""
:param bytelist: list of byte values
:return: String representation of the bytelist with each item as a byte value on the format 0xXX
"""
return '[' + ', '.join("0x%02X" % x for x in bytelist) + ']' | [
"def",
"bytelist_to_hex_string",
"(",
"bytelist",
")",
":",
"return",
"'['",
"+",
"', '",
".",
"join",
"(",
"\"0x%02X\"",
"%",
"x",
"for",
"x",
"in",
"bytelist",
")",
"+",
"']'"
] | https://github.com/SpenceKonde/megaTinyCore/blob/1c4a70b18a149fe6bcb551dfa6db11ca50b8997b/megaavr/tools/libs/pyedbglib/util/print_helpers.py#L3-L8 | |
wxWidgets/wxPython-Classic | 19571e1ae65f1ac445f5491474121998c97a1bf0 | src/osx_carbon/grid.py | python | Grid.CellToRect | (*args, **kwargs) | return _grid.Grid_CellToRect(*args, **kwargs) | CellToRect(self, int row, int col) -> Rect | CellToRect(self, int row, int col) -> Rect | [
"CellToRect",
"(",
"self",
"int",
"row",
"int",
"col",
")",
"-",
">",
"Rect"
] | def CellToRect(*args, **kwargs):
"""CellToRect(self, int row, int col) -> Rect"""
return _grid.Grid_CellToRect(*args, **kwargs) | [
"def",
"CellToRect",
"(",
"*",
"args",
",",
"*",
"*",
"kwargs",
")",
":",
"return",
"_grid",
".",
"Grid_CellToRect",
"(",
"*",
"args",
",",
"*",
"*",
"kwargs",
")"
] | https://github.com/wxWidgets/wxPython-Classic/blob/19571e1ae65f1ac445f5491474121998c97a1bf0/src/osx_carbon/grid.py#L1402-L1404 | |
leela-zero/leela-zero | e3ed6310d33d75078ba74c3adf887d18439fc2e3 | scripts/cpplint.py | python | CheckStyle | (filename, clean_lines, linenum, file_extension, nesting_state,
error) | Checks rules from the 'C++ style rules' section of cppguide.html.
Most of these rules are hard to test (naming, comment style), but we
do what we can. In particular we check for 2-space indents, line lengths,
tab usage, spaces inside code, etc.
Args:
filename: The name of the current file.
clean_line... | Checks rules from the 'C++ style rules' section of cppguide.html. | [
"Checks",
"rules",
"from",
"the",
"C",
"++",
"style",
"rules",
"section",
"of",
"cppguide",
".",
"html",
"."
] | def CheckStyle(filename, clean_lines, linenum, file_extension, nesting_state,
error):
"""Checks rules from the 'C++ style rules' section of cppguide.html.
Most of these rules are hard to test (naming, comment style), but we
do what we can. In particular we check for 2-space indents, line lengths,... | [
"def",
"CheckStyle",
"(",
"filename",
",",
"clean_lines",
",",
"linenum",
",",
"file_extension",
",",
"nesting_state",
",",
"error",
")",
":",
"# Don't use \"elided\" lines here, otherwise we can't check commented lines.",
"# Don't want to use \"raw\" either, because we don't want ... | https://github.com/leela-zero/leela-zero/blob/e3ed6310d33d75078ba74c3adf887d18439fc2e3/scripts/cpplint.py#L4362-L4481 | ||
aws/lumberyard | f85344403c1c2e77ec8c75deb2c116e97b713217 | dev/Gems/CloudGemFramework/v1/AWS/common-code/lib/chardet/chardistribution.py | python | CharDistributionAnalysis.get_confidence | (self) | return self.SURE_YES | return confidence based on existing data | return confidence based on existing data | [
"return",
"confidence",
"based",
"on",
"existing",
"data"
] | def get_confidence(self):
"""return confidence based on existing data"""
# if we didn't receive any character in our consideration range,
# return negative answer
if self._total_chars <= 0 or self._freq_chars <= self.MINIMUM_DATA_THRESHOLD:
return self.SURE_NO
if sel... | [
"def",
"get_confidence",
"(",
"self",
")",
":",
"# if we didn't receive any character in our consideration range,",
"# return negative answer",
"if",
"self",
".",
"_total_chars",
"<=",
"0",
"or",
"self",
".",
"_freq_chars",
"<=",
"self",
".",
"MINIMUM_DATA_THRESHOLD",
":"... | https://github.com/aws/lumberyard/blob/f85344403c1c2e77ec8c75deb2c116e97b713217/dev/Gems/CloudGemFramework/v1/AWS/common-code/lib/chardet/chardistribution.py#L84-L98 | |
psi4/psi4 | be533f7f426b6ccc263904e55122899b16663395 | psi4/driver/qcdb/libmintscoordentry.py | python | VariableValue.rset | (self, val) | Resets value of coordinate if not fixed | Resets value of coordinate if not fixed | [
"Resets",
"value",
"of",
"coordinate",
"if",
"not",
"fixed"
] | def rset(self, val):
"""Resets value of coordinate if not fixed"""
if not self.PYfixed:
if self.negate:
self.geometryVariables[self.PYname] = val * -1.0
else:
self.geometryVariables[self.PYname] = val | [
"def",
"rset",
"(",
"self",
",",
"val",
")",
":",
"if",
"not",
"self",
".",
"PYfixed",
":",
"if",
"self",
".",
"negate",
":",
"self",
".",
"geometryVariables",
"[",
"self",
".",
"PYname",
"]",
"=",
"val",
"*",
"-",
"1.0",
"else",
":",
"self",
"."... | https://github.com/psi4/psi4/blob/be533f7f426b6ccc263904e55122899b16663395/psi4/driver/qcdb/libmintscoordentry.py#L134-L140 | ||
aws/lumberyard | f85344403c1c2e77ec8c75deb2c116e97b713217 | dev/Tools/Python/3.7.10/windows/Lib/idlelib/textview.py | python | ViewFrame.__init__ | (self, parent, contents, wrap='word') | Create a frame for viewing text with a "Close" button.
parent - parent widget for this frame
contents - text to display
wrap - type of text wrapping to use ('word', 'char' or 'none')
The Text widget is accessible via the 'text' attribute. | Create a frame for viewing text with a "Close" button. | [
"Create",
"a",
"frame",
"for",
"viewing",
"text",
"with",
"a",
"Close",
"button",
"."
] | def __init__(self, parent, contents, wrap='word'):
"""Create a frame for viewing text with a "Close" button.
parent - parent widget for this frame
contents - text to display
wrap - type of text wrapping to use ('word', 'char' or 'none')
The Text widget is accessible via the 'te... | [
"def",
"__init__",
"(",
"self",
",",
"parent",
",",
"contents",
",",
"wrap",
"=",
"'word'",
")",
":",
"super",
"(",
")",
".",
"__init__",
"(",
"parent",
")",
"self",
".",
"parent",
"=",
"parent",
"self",
".",
"bind",
"(",
"'<Return>'",
",",
"self",
... | https://github.com/aws/lumberyard/blob/f85344403c1c2e77ec8c75deb2c116e97b713217/dev/Tools/Python/3.7.10/windows/Lib/idlelib/textview.py#L74-L98 | ||
ZhouWeikuan/DouDiZhu | 0d84ff6c0bc54dba6ae37955de9ae9307513dc99 | code/frameworks/cocos2d-x/tools/bindings-generator/clang/cindex.py | python | Cursor.type | (self) | return self._type | Retrieve the Type (if any) of the entity pointed at by the cursor. | Retrieve the Type (if any) of the entity pointed at by the cursor. | [
"Retrieve",
"the",
"Type",
"(",
"if",
"any",
")",
"of",
"the",
"entity",
"pointed",
"at",
"by",
"the",
"cursor",
"."
] | def type(self):
"""
Retrieve the Type (if any) of the entity pointed at by the cursor.
"""
if not hasattr(self, '_type'):
self._type = conf.lib.clang_getCursorType(self)
return self._type | [
"def",
"type",
"(",
"self",
")",
":",
"if",
"not",
"hasattr",
"(",
"self",
",",
"'_type'",
")",
":",
"self",
".",
"_type",
"=",
"conf",
".",
"lib",
".",
"clang_getCursorType",
"(",
"self",
")",
"return",
"self",
".",
"_type"
] | https://github.com/ZhouWeikuan/DouDiZhu/blob/0d84ff6c0bc54dba6ae37955de9ae9307513dc99/code/frameworks/cocos2d-x/tools/bindings-generator/clang/cindex.py#L1303-L1310 | |
adobe/chromium | cfe5bf0b51b1f6b9fe239c2a3c2f2364da9967d7 | gpu/command_buffer/build_gles2_cmd_buffer.py | python | CreateHandler.WriteHandlerImplementation | (self, func, file) | Overrriden from TypeHandler. | Overrriden from TypeHandler. | [
"Overrriden",
"from",
"TypeHandler",
"."
] | def WriteHandlerImplementation (self, func, file):
"""Overrriden from TypeHandler."""
file.Write(" uint32 client_id = c.client_id;\n")
file.Write(" if (!%sHelper(%s)) {\n" %
(func.name, func.MakeCmdArgString("")))
file.Write(" return error::kInvalidArguments;\n")
file.Write(" }\... | [
"def",
"WriteHandlerImplementation",
"(",
"self",
",",
"func",
",",
"file",
")",
":",
"file",
".",
"Write",
"(",
"\" uint32 client_id = c.client_id;\\n\"",
")",
"file",
".",
"Write",
"(",
"\" if (!%sHelper(%s)) {\\n\"",
"%",
"(",
"func",
".",
"name",
",",
"fun... | https://github.com/adobe/chromium/blob/cfe5bf0b51b1f6b9fe239c2a3c2f2364da9967d7/gpu/command_buffer/build_gles2_cmd_buffer.py#L3034-L3040 | ||
FreeCAD/FreeCAD | ba42231b9c6889b89e064d6d563448ed81e376ec | src/Mod/Draft/draftguitools/gui_snapper.py | python | Snapper.snapToAngles | (self, shape) | return snaps | Return a list of angle snap locations. | Return a list of angle snap locations. | [
"Return",
"a",
"list",
"of",
"angle",
"snap",
"locations",
"."
] | def snapToAngles(self, shape):
"""Return a list of angle snap locations."""
snaps = []
if self.isEnabled("Angle"):
place = App.Placement()
place.Base = shape.Curve.Center
place.Rotation = App.Rotation(App.Vector(1, 0, 0),
... | [
"def",
"snapToAngles",
"(",
"self",
",",
"shape",
")",
":",
"snaps",
"=",
"[",
"]",
"if",
"self",
".",
"isEnabled",
"(",
"\"Angle\"",
")",
":",
"place",
"=",
"App",
".",
"Placement",
"(",
")",
"place",
".",
"Base",
"=",
"shape",
".",
"Curve",
".",
... | https://github.com/FreeCAD/FreeCAD/blob/ba42231b9c6889b89e064d6d563448ed81e376ec/src/Mod/Draft/draftguitools/gui_snapper.py#L944-L963 | |
aws/lumberyard | f85344403c1c2e77ec8c75deb2c116e97b713217 | dev/Gems/CloudGemMetric/v1/AWS/common-code/Lib/pkg_resources/__init__.py | python | _always_object | (classes) | return classes | Ensure object appears in the mro even
for old-style classes. | Ensure object appears in the mro even
for old-style classes. | [
"Ensure",
"object",
"appears",
"in",
"the",
"mro",
"even",
"for",
"old",
"-",
"style",
"classes",
"."
] | def _always_object(classes):
"""
Ensure object appears in the mro even
for old-style classes.
"""
if object not in classes:
return classes + (object,)
return classes | [
"def",
"_always_object",
"(",
"classes",
")",
":",
"if",
"object",
"not",
"in",
"classes",
":",
"return",
"classes",
"+",
"(",
"object",
",",
")",
"return",
"classes"
] | https://github.com/aws/lumberyard/blob/f85344403c1c2e77ec8c75deb2c116e97b713217/dev/Gems/CloudGemMetric/v1/AWS/common-code/Lib/pkg_resources/__init__.py#L3159-L3166 | |
catboost/catboost | 167f64f237114a4d10b2b4ee42adb4569137debe | catboost/python-package/catboost/core.py | python | CatBoost.get_params | (self, deep=True) | Get all params from CatBoost model.
Returns
-------
result : dict
Dictionary of {param_key: param_value}. | Get all params from CatBoost model. | [
"Get",
"all",
"params",
"from",
"CatBoost",
"model",
"."
] | def get_params(self, deep=True):
"""
Get all params from CatBoost model.
Returns
-------
result : dict
Dictionary of {param_key: param_value}.
"""
params = self._init_params.copy()
if deep:
return deepcopy(params)
else:
... | [
"def",
"get_params",
"(",
"self",
",",
"deep",
"=",
"True",
")",
":",
"params",
"=",
"self",
".",
"_init_params",
".",
"copy",
"(",
")",
"if",
"deep",
":",
"return",
"deepcopy",
"(",
"params",
")",
"else",
":",
"return",
"params"
] | https://github.com/catboost/catboost/blob/167f64f237114a4d10b2b4ee42adb4569137debe/catboost/python-package/catboost/core.py#L3196-L3209 | ||
cms-sw/cmssw | fd9de012d503d3405420bcbeec0ec879baa57cf2 | CondCore/Utilities/python/CondDBFW/utils.py | python | to_datetime | (date_string) | return datetime.datetime.strptime(date_string.replace(",", "."), "%d-%b-%y %I:%M:%S.%f %p") | Takes a date string with the format Y-m-d H:m:S.f and gives back a datetime.datetime object | Takes a date string with the format Y-m-d H:m:S.f and gives back a datetime.datetime object | [
"Takes",
"a",
"date",
"string",
"with",
"the",
"format",
"Y",
"-",
"m",
"-",
"d",
"H",
":",
"m",
":",
"S",
".",
"f",
"and",
"gives",
"back",
"a",
"datetime",
".",
"datetime",
"object"
] | def to_datetime(date_string):
"""
Takes a date string with the format Y-m-d H:m:S.f and gives back a datetime.datetime object
"""
return datetime.datetime.strptime(date_string.replace(",", "."), "%d-%b-%y %I:%M:%S.%f %p") | [
"def",
"to_datetime",
"(",
"date_string",
")",
":",
"return",
"datetime",
".",
"datetime",
".",
"strptime",
"(",
"date_string",
".",
"replace",
"(",
"\",\"",
",",
"\".\"",
")",
",",
"\"%d-%b-%y %I:%M:%S.%f %p\"",
")"
] | https://github.com/cms-sw/cmssw/blob/fd9de012d503d3405420bcbeec0ec879baa57cf2/CondCore/Utilities/python/CondDBFW/utils.py#L12-L16 | |
windystrife/UnrealEngine_NVIDIAGameWorks | b50e6338a7c5b26374d66306ebc7807541ff815e | Engine/Extras/ThirdPartyNotUE/emsdk/Win64/python/2.7.5.3_64bit/Lib/site-packages/pip/vendor/distlib/markers.py | python | Evaluator.get_handler | (self, node_type) | return getattr(self, 'do_%s' % node_type, None) | Get a handler for the specified AST node type. | Get a handler for the specified AST node type. | [
"Get",
"a",
"handler",
"for",
"the",
"specified",
"AST",
"node",
"type",
"."
] | def get_handler(self, node_type):
"""
Get a handler for the specified AST node type.
"""
return getattr(self, 'do_%s' % node_type, None) | [
"def",
"get_handler",
"(",
"self",
",",
"node_type",
")",
":",
"return",
"getattr",
"(",
"self",
",",
"'do_%s'",
"%",
"node_type",
",",
"None",
")"
] | https://github.com/windystrife/UnrealEngine_NVIDIAGameWorks/blob/b50e6338a7c5b26374d66306ebc7807541ff815e/Engine/Extras/ThirdPartyNotUE/emsdk/Win64/python/2.7.5.3_64bit/Lib/site-packages/pip/vendor/distlib/markers.py#L68-L72 | |
oracle/graaljs | 36a56e8e993d45fc40939a3a4d9c0c24990720f1 | graal-nodejs/deps/npm/node_modules/node-gyp/gyp/pylib/gyp/msvs_emulation.py | python | MsvsSettings.IsLinkIncremental | (self, config) | return link_inc != "1" | Returns whether the target should be linked incrementally. | Returns whether the target should be linked incrementally. | [
"Returns",
"whether",
"the",
"target",
"should",
"be",
"linked",
"incrementally",
"."
] | def IsLinkIncremental(self, config):
"""Returns whether the target should be linked incrementally."""
config = self._TargetConfig(config)
link_inc = self._Setting(("VCLinkerTool", "LinkIncremental"), config)
return link_inc != "1" | [
"def",
"IsLinkIncremental",
"(",
"self",
",",
"config",
")",
":",
"config",
"=",
"self",
".",
"_TargetConfig",
"(",
"config",
")",
"link_inc",
"=",
"self",
".",
"_Setting",
"(",
"(",
"\"VCLinkerTool\"",
",",
"\"LinkIncremental\"",
")",
",",
"config",
")",
... | https://github.com/oracle/graaljs/blob/36a56e8e993d45fc40939a3a4d9c0c24990720f1/graal-nodejs/deps/npm/node_modules/node-gyp/gyp/pylib/gyp/msvs_emulation.py#L901-L905 | |
hanpfei/chromium-net | 392cc1fa3a8f92f42e4071ab6e674d8e0482f83f | third_party/catapult/devil/devil/android/battery_utils.py | python | BatteryUtils.GetCharging | (self, timeout=None, retries=None) | return False | Gets the charging state of the device.
Args:
timeout: timeout in seconds
retries: number of retries
Returns:
True if the device is charging, false otherwise. | Gets the charging state of the device. | [
"Gets",
"the",
"charging",
"state",
"of",
"the",
"device",
"."
] | def GetCharging(self, timeout=None, retries=None):
"""Gets the charging state of the device.
Args:
timeout: timeout in seconds
retries: number of retries
Returns:
True if the device is charging, false otherwise.
"""
battery_info = self.GetBatteryInfo()
for k in ('AC powered', ... | [
"def",
"GetCharging",
"(",
"self",
",",
"timeout",
"=",
"None",
",",
"retries",
"=",
"None",
")",
":",
"battery_info",
"=",
"self",
".",
"GetBatteryInfo",
"(",
")",
"for",
"k",
"in",
"(",
"'AC powered'",
",",
"'USB powered'",
",",
"'Wireless powered'",
")"... | https://github.com/hanpfei/chromium-net/blob/392cc1fa3a8f92f42e4071ab6e674d8e0482f83f/third_party/catapult/devil/devil/android/battery_utils.py#L324-L338 | |
wlanjie/AndroidFFmpeg | 7baf9122f4b8e1c74e7baf4be5c422c7a5ba5aaf | tools/fdk-aac-build/armeabi-v7a/toolchain/lib/python2.7/difflib.py | python | HtmlDiff._format_line | (self,side,flag,linenum,text) | return '<td class="diff_header"%s>%s</td><td nowrap="nowrap">%s</td>' \
% (id,linenum,text) | Returns HTML markup of "from" / "to" text lines
side -- 0 or 1 indicating "from" or "to" text
flag -- indicates if difference on line
linenum -- line number (used for line number column)
text -- line text to be marked up | Returns HTML markup of "from" / "to" text lines | [
"Returns",
"HTML",
"markup",
"of",
"from",
"/",
"to",
"text",
"lines"
] | def _format_line(self,side,flag,linenum,text):
"""Returns HTML markup of "from" / "to" text lines
side -- 0 or 1 indicating "from" or "to" text
flag -- indicates if difference on line
linenum -- line number (used for line number column)
text -- line text to be marked up
... | [
"def",
"_format_line",
"(",
"self",
",",
"side",
",",
"flag",
",",
"linenum",
",",
"text",
")",
":",
"try",
":",
"linenum",
"=",
"'%d'",
"%",
"linenum",
"id",
"=",
"' id=\"%s%s\"'",
"%",
"(",
"self",
".",
"_prefix",
"[",
"side",
"]",
",",
"linenum",
... | https://github.com/wlanjie/AndroidFFmpeg/blob/7baf9122f4b8e1c74e7baf4be5c422c7a5ba5aaf/tools/fdk-aac-build/armeabi-v7a/toolchain/lib/python2.7/difflib.py#L1862-L1883 | |
wxWidgets/wxPython-Classic | 19571e1ae65f1ac445f5491474121998c97a1bf0 | src/osx_carbon/propgrid.py | python | PropertyGridManager.SelectPage | (*args) | return _propgrid.PropertyGridManager_SelectPage(*args) | SelectPage(self, int index)
SelectPage(self, String label)
SelectPage(self, PropertyGridPage ptr) | SelectPage(self, int index)
SelectPage(self, String label)
SelectPage(self, PropertyGridPage ptr) | [
"SelectPage",
"(",
"self",
"int",
"index",
")",
"SelectPage",
"(",
"self",
"String",
"label",
")",
"SelectPage",
"(",
"self",
"PropertyGridPage",
"ptr",
")"
] | def SelectPage(*args):
"""
SelectPage(self, int index)
SelectPage(self, String label)
SelectPage(self, PropertyGridPage ptr)
"""
return _propgrid.PropertyGridManager_SelectPage(*args) | [
"def",
"SelectPage",
"(",
"*",
"args",
")",
":",
"return",
"_propgrid",
".",
"PropertyGridManager_SelectPage",
"(",
"*",
"args",
")"
] | https://github.com/wxWidgets/wxPython-Classic/blob/19571e1ae65f1ac445f5491474121998c97a1bf0/src/osx_carbon/propgrid.py#L3555-L3561 | |
hanpfei/chromium-net | 392cc1fa3a8f92f42e4071ab6e674d8e0482f83f | tools/site_compare/scrapers/chrome/__init__.py | python | GetScraper | (version) | return __import__(scraper_version, globals(), locals(), ['']) | Returns the scraper module for the given version.
Args:
version: version string of Chrome, or None for most recent
Returns:
scrape module for given version | Returns the scraper module for the given version. | [
"Returns",
"the",
"scraper",
"module",
"for",
"the",
"given",
"version",
"."
] | def GetScraper(version):
"""Returns the scraper module for the given version.
Args:
version: version string of Chrome, or None for most recent
Returns:
scrape module for given version
"""
if version is None:
version = "0.1.101.0"
parsed_version = [int(x) for x in version.split(".")]
if (pa... | [
"def",
"GetScraper",
"(",
"version",
")",
":",
"if",
"version",
"is",
"None",
":",
"version",
"=",
"\"0.1.101.0\"",
"parsed_version",
"=",
"[",
"int",
"(",
"x",
")",
"for",
"x",
"in",
"version",
".",
"split",
"(",
"\".\"",
")",
"]",
"if",
"(",
"parse... | https://github.com/hanpfei/chromium-net/blob/392cc1fa3a8f92f42e4071ab6e674d8e0482f83f/tools/site_compare/scrapers/chrome/__init__.py#L9-L31 | |
mindspore-ai/mindspore | fb8fd3338605bb34fa5cea054e535a8b1d753fab | mindspore/python/mindspore/nn/layer/thor_layer.py | python | EmbeddingLookupThor.save_gradient | (self, dout) | return out | this function only for thor optimizer
save_gradient | this function only for thor optimizer
save_gradient | [
"this",
"function",
"only",
"for",
"thor",
"optimizer",
"save_gradient"
] | def save_gradient(self, dout):
"""
this function only for thor optimizer
save_gradient
"""
out = dout
shape = self.shape(dout)
normalizer = self.cast(shape[0], mstype.float16)
dout = self.reshape(dout, (-1, self.embedding_size))
matrix_g = se... | [
"def",
"save_gradient",
"(",
"self",
",",
"dout",
")",
":",
"out",
"=",
"dout",
"shape",
"=",
"self",
".",
"shape",
"(",
"dout",
")",
"normalizer",
"=",
"self",
".",
"cast",
"(",
"shape",
"[",
"0",
"]",
",",
"mstype",
".",
"float16",
")",
"dout",
... | https://github.com/mindspore-ai/mindspore/blob/fb8fd3338605bb34fa5cea054e535a8b1d753fab/mindspore/python/mindspore/nn/layer/thor_layer.py#L830-L843 | |
apache/incubator-mxnet | f03fb23f1d103fec9541b5ae59ee06b1734a51d9 | python/mxnet/ndarray/ndarray.py | python | lesser | (lhs, rhs) | return _ufunc_helper(
lhs,
rhs,
op.broadcast_lesser,
lambda x, y: 1 if x < y else 0,
_internal._lesser_scalar,
_internal._greater_scalar) | Returns the result of element-wise **lesser than** (<) comparison operation
with broadcasting.
For each element in input arrays, return 1(true) if lhs elements are less than rhs,
otherwise return 0(false).
Equivalent to ``lhs < rhs`` and ``mx.nd.broadcast_lesser(lhs, rhs)``.
.. note::
If ... | Returns the result of element-wise **lesser than** (<) comparison operation
with broadcasting. | [
"Returns",
"the",
"result",
"of",
"element",
"-",
"wise",
"**",
"lesser",
"than",
"**",
"(",
"<",
")",
"comparison",
"operation",
"with",
"broadcasting",
"."
] | def lesser(lhs, rhs):
"""Returns the result of element-wise **lesser than** (<) comparison operation
with broadcasting.
For each element in input arrays, return 1(true) if lhs elements are less than rhs,
otherwise return 0(false).
Equivalent to ``lhs < rhs`` and ``mx.nd.broadcast_lesser(lhs, rhs)`... | [
"def",
"lesser",
"(",
"lhs",
",",
"rhs",
")",
":",
"# pylint: disable= no-member, protected-access",
"return",
"_ufunc_helper",
"(",
"lhs",
",",
"rhs",
",",
"op",
".",
"broadcast_lesser",
",",
"lambda",
"x",
",",
"y",
":",
"1",
"if",
"x",
"<",
"y",
"else",... | https://github.com/apache/incubator-mxnet/blob/f03fb23f1d103fec9541b5ae59ee06b1734a51d9/python/mxnet/ndarray/ndarray.py#L4393-L4453 | |
LiquidPlayer/LiquidCore | 9405979363f2353ac9a71ad8ab59685dd7f919c9 | deps/node-10.15.3/tools/gyp/pylib/gyp/generator/msvs.py | python | _GetOutputTargetExt | (spec) | return None | Returns the extension for this target, including the dot
If product_extension is specified, set target_extension to this to avoid
MSB8012, returns None otherwise. Ignores any target_extension settings in
the input files.
Arguments:
spec: The target dictionary containing the properties of the target.
Ret... | Returns the extension for this target, including the dot | [
"Returns",
"the",
"extension",
"for",
"this",
"target",
"including",
"the",
"dot"
] | def _GetOutputTargetExt(spec):
"""Returns the extension for this target, including the dot
If product_extension is specified, set target_extension to this to avoid
MSB8012, returns None otherwise. Ignores any target_extension settings in
the input files.
Arguments:
spec: The target dictionary containing... | [
"def",
"_GetOutputTargetExt",
"(",
"spec",
")",
":",
"target_extension",
"=",
"spec",
".",
"get",
"(",
"'product_extension'",
")",
"if",
"target_extension",
":",
"return",
"'.'",
"+",
"target_extension",
"return",
"None"
] | https://github.com/LiquidPlayer/LiquidCore/blob/9405979363f2353ac9a71ad8ab59685dd7f919c9/deps/node-10.15.3/tools/gyp/pylib/gyp/generator/msvs.py#L1330-L1345 | |
cinder/Cinder | e83f5bb9c01a63eec20168d02953a0879e5100f7 | docs/libs/pystache/renderer.py | python | Renderer._escape_to_unicode | (self, s) | return unicode(self.escape(self._to_unicode_soft(s))) | Convert a basestring to unicode (preserving any unicode subclass), and escape it.
Returns a unicode string (not subclass). | Convert a basestring to unicode (preserving any unicode subclass), and escape it. | [
"Convert",
"a",
"basestring",
"to",
"unicode",
"(",
"preserving",
"any",
"unicode",
"subclass",
")",
"and",
"escape",
"it",
"."
] | def _escape_to_unicode(self, s):
"""
Convert a basestring to unicode (preserving any unicode subclass), and escape it.
Returns a unicode string (not subclass).
"""
return unicode(self.escape(self._to_unicode_soft(s))) | [
"def",
"_escape_to_unicode",
"(",
"self",
",",
"s",
")",
":",
"return",
"unicode",
"(",
"self",
".",
"escape",
"(",
"self",
".",
"_to_unicode_soft",
"(",
"s",
")",
")",
")"
] | https://github.com/cinder/Cinder/blob/e83f5bb9c01a63eec20168d02953a0879e5100f7/docs/libs/pystache/renderer.py#L191-L198 | |
ValveSoftware/source-sdk-2013 | 0d8dceea4310fde5706b3ce1c70609d72a38efdf | mp/src/thirdparty/protobuf-2.3.0/python/google/protobuf/text_format.py | python | _Tokenizer.ConsumeBool | (self) | Consumes a boolean value.
Returns:
The bool parsed.
Raises:
ParseError: If a boolean value couldn't be consumed. | Consumes a boolean value. | [
"Consumes",
"a",
"boolean",
"value",
"."
] | def ConsumeBool(self):
"""Consumes a boolean value.
Returns:
The bool parsed.
Raises:
ParseError: If a boolean value couldn't be consumed.
"""
if self.token == 'true':
self.NextToken()
return True
elif self.token == 'false':
self.NextToken()
return False
... | [
"def",
"ConsumeBool",
"(",
"self",
")",
":",
"if",
"self",
".",
"token",
"==",
"'true'",
":",
"self",
".",
"NextToken",
"(",
")",
"return",
"True",
"elif",
"self",
".",
"token",
"==",
"'false'",
":",
"self",
".",
"NextToken",
"(",
")",
"return",
"Fal... | https://github.com/ValveSoftware/source-sdk-2013/blob/0d8dceea4310fde5706b3ce1c70609d72a38efdf/mp/src/thirdparty/protobuf-2.3.0/python/google/protobuf/text_format.py#L501-L517 | ||
wxWidgets/wxPython-Classic | 19571e1ae65f1ac445f5491474121998c97a1bf0 | wx/lib/agw/aui/framemanager.py | python | AuiPaneInfo.MinSize | (self, arg1=None, arg2=None) | return ret | Sets the minimum size of the pane.
This method is split in 2 versions depending on the input type. If `arg1` is
a :class:`Size` object, then :meth:`~AuiPaneInfo.MinSize1` is called. Otherwise, :meth:`~AuiPaneInfo.MinSize2` is called.
:param `arg1`: a :class:`Size` object, a (x, y) tuple or or ... | Sets the minimum size of the pane. | [
"Sets",
"the",
"minimum",
"size",
"of",
"the",
"pane",
"."
] | def MinSize(self, arg1=None, arg2=None):
"""
Sets the minimum size of the pane.
This method is split in 2 versions depending on the input type. If `arg1` is
a :class:`Size` object, then :meth:`~AuiPaneInfo.MinSize1` is called. Otherwise, :meth:`~AuiPaneInfo.MinSize2` is called.
... | [
"def",
"MinSize",
"(",
"self",
",",
"arg1",
"=",
"None",
",",
"arg2",
"=",
"None",
")",
":",
"if",
"isinstance",
"(",
"arg1",
",",
"wx",
".",
"Size",
")",
":",
"ret",
"=",
"self",
".",
"MinSize1",
"(",
"arg1",
")",
"elif",
"isinstance",
"(",
"arg... | https://github.com/wxWidgets/wxPython-Classic/blob/19571e1ae65f1ac445f5491474121998c97a1bf0/wx/lib/agw/aui/framemanager.py#L1038-L1058 | |
catboost/catboost | 167f64f237114a4d10b2b4ee42adb4569137debe | contrib/python/pandas/py3/pandas/plotting/_matplotlib/tools.py | python | do_adjust_figure | (fig: Figure) | return not fig.get_constrained_layout() | Whether fig has constrained_layout enabled. | Whether fig has constrained_layout enabled. | [
"Whether",
"fig",
"has",
"constrained_layout",
"enabled",
"."
] | def do_adjust_figure(fig: Figure):
"""Whether fig has constrained_layout enabled."""
if not hasattr(fig, "get_constrained_layout"):
return False
return not fig.get_constrained_layout() | [
"def",
"do_adjust_figure",
"(",
"fig",
":",
"Figure",
")",
":",
"if",
"not",
"hasattr",
"(",
"fig",
",",
"\"get_constrained_layout\"",
")",
":",
"return",
"False",
"return",
"not",
"fig",
".",
"get_constrained_layout",
"(",
")"
] | https://github.com/catboost/catboost/blob/167f64f237114a4d10b2b4ee42adb4569137debe/contrib/python/pandas/py3/pandas/plotting/_matplotlib/tools.py#L35-L39 | |
aws/lumberyard | f85344403c1c2e77ec8c75deb2c116e97b713217 | dev/Gems/CloudGemMetric/v1/AWS/common-code/Lib/numba/array_analysis.py | python | ShapeEquivSet.clone | (self) | return ShapeEquivSet(
self.typemap,
defs=copy.copy(self.defs),
ind_to_var=copy.copy(self.ind_to_var),
obj_to_ind=copy.deepcopy(self.obj_to_ind),
ind_to_obj=copy.deepcopy(self.ind_to_obj),
next_id=self.next_ind,
ind_to_const=copy.deepcop... | Return a new copy. | Return a new copy. | [
"Return",
"a",
"new",
"copy",
"."
] | def clone(self):
"""Return a new copy.
"""
return ShapeEquivSet(
self.typemap,
defs=copy.copy(self.defs),
ind_to_var=copy.copy(self.ind_to_var),
obj_to_ind=copy.deepcopy(self.obj_to_ind),
ind_to_obj=copy.deepcopy(self.ind_to_obj),
... | [
"def",
"clone",
"(",
"self",
")",
":",
"return",
"ShapeEquivSet",
"(",
"self",
".",
"typemap",
",",
"defs",
"=",
"copy",
".",
"copy",
"(",
"self",
".",
"defs",
")",
",",
"ind_to_var",
"=",
"copy",
".",
"copy",
"(",
"self",
".",
"ind_to_var",
")",
"... | https://github.com/aws/lumberyard/blob/f85344403c1c2e77ec8c75deb2c116e97b713217/dev/Gems/CloudGemMetric/v1/AWS/common-code/Lib/numba/array_analysis.py#L344-L354 | |
luliyucoordinate/Leetcode | 96afcdc54807d1d184e881a075d1dbf3371e31fb | src/0525-Contiguous-Array/0525.py | python | Solution.findMaxLength | (self, nums) | return res | :type nums: List[int]
:rtype: int | :type nums: List[int]
:rtype: int | [
":",
"type",
"nums",
":",
"List",
"[",
"int",
"]",
":",
"rtype",
":",
"int"
] | def findMaxLength(self, nums):
"""
:type nums: List[int]
:rtype: int
"""
pre_sum, res = 0, 0
dic = {0:-1}
for i in range(len(nums)):
pre_sum += -1 if nums[i] == 0 else 1
if pre_sum in dic:
res = max(res, i - dic[pre... | [
"def",
"findMaxLength",
"(",
"self",
",",
"nums",
")",
":",
"pre_sum",
",",
"res",
"=",
"0",
",",
"0",
"dic",
"=",
"{",
"0",
":",
"-",
"1",
"}",
"for",
"i",
"in",
"range",
"(",
"len",
"(",
"nums",
")",
")",
":",
"pre_sum",
"+=",
"-",
"1",
"... | https://github.com/luliyucoordinate/Leetcode/blob/96afcdc54807d1d184e881a075d1dbf3371e31fb/src/0525-Contiguous-Array/0525.py#L2-L17 | |
RamadhanAmizudin/malware | 2c6c53c8b0d556f5d8078d6ca0fc4448f4697cf1 | Mazar/MazAr_Admin/apps/smsg_r/smsapp/idgen.py | python | _docache | () | (re)build cache using cPickle. This will be automatically called if the
cachefile is not found, so you can recreate the cache by simply deleting
the existing one | (re)build cache using cPickle. This will be automatically called if the
cachefile is not found, so you can recreate the cache by simply deleting
the existing one | [
"(",
"re",
")",
"build",
"cache",
"using",
"cPickle",
".",
"This",
"will",
"be",
"automatically",
"called",
"if",
"the",
"cachefile",
"is",
"not",
"found",
"so",
"you",
"can",
"recreate",
"the",
"cache",
"by",
"simply",
"deleting",
"the",
"existing",
"one"... | def _docache():
"""
(re)build cache using cPickle. This will be automatically called if the
cachefile is not found, so you can recreate the cache by simply deleting
the existing one
"""
# load tris
# calculate the sigma value: the probability total of the trigraph set
# sigma calculatio... | [
"def",
"_docache",
"(",
")",
":",
"# load tris ",
"# calculate the sigma value: the probability total of the trigraph set",
"# sigma calculation result is cached, since source is relatively static.",
"from",
"smsapp",
".",
"idgen_tris",
"import",
"tris",
"sigma",
"=",
"0",
"for",
... | https://github.com/RamadhanAmizudin/malware/blob/2c6c53c8b0d556f5d8078d6ca0fc4448f4697cf1/Mazar/MazAr_Admin/apps/smsg_r/smsapp/idgen.py#L43-L63 | ||
aws/lumberyard | f85344403c1c2e77ec8c75deb2c116e97b713217 | dev/Tools/Python/3.7.10/linux_x64/lib/python3.7/zipfile.py | python | ZipFile._writecheck | (self, zinfo) | Check for errors before writing a file to the archive. | Check for errors before writing a file to the archive. | [
"Check",
"for",
"errors",
"before",
"writing",
"a",
"file",
"to",
"the",
"archive",
"."
] | def _writecheck(self, zinfo):
"""Check for errors before writing a file to the archive."""
if zinfo.filename in self.NameToInfo:
import warnings
warnings.warn('Duplicate name: %r' % zinfo.filename, stacklevel=3)
if self.mode not in ('w', 'x', 'a'):
raise Value... | [
"def",
"_writecheck",
"(",
"self",
",",
"zinfo",
")",
":",
"if",
"zinfo",
".",
"filename",
"in",
"self",
".",
"NameToInfo",
":",
"import",
"warnings",
"warnings",
".",
"warn",
"(",
"'Duplicate name: %r'",
"%",
"zinfo",
".",
"filename",
",",
"stacklevel",
"... | https://github.com/aws/lumberyard/blob/f85344403c1c2e77ec8c75deb2c116e97b713217/dev/Tools/Python/3.7.10/linux_x64/lib/python3.7/zipfile.py#L1695-L1716 | ||
ChromiumWebApps/chromium | c7361d39be8abd1574e6ce8957c8dbddd4c6ccf7 | build/android/buildbot/bb_annotations.py | python | PrintMsg | (msg) | Appends |msg| to the current buildbot step text.
Args:
msg: String to be appended. | Appends |msg| to the current buildbot step text. | [
"Appends",
"|msg|",
"to",
"the",
"current",
"buildbot",
"step",
"text",
"."
] | def PrintMsg(msg):
"""Appends |msg| to the current buildbot step text.
Args:
msg: String to be appended.
"""
print '@@@STEP_TEXT@%s@@@' % msg | [
"def",
"PrintMsg",
"(",
"msg",
")",
":",
"print",
"'@@@STEP_TEXT@%s@@@'",
"%",
"msg"
] | https://github.com/ChromiumWebApps/chromium/blob/c7361d39be8abd1574e6ce8957c8dbddd4c6ccf7/build/android/buildbot/bb_annotations.py#L17-L23 | ||
wxWidgets/wxPython-Classic | 19571e1ae65f1ac445f5491474121998c97a1bf0 | src/osx_cocoa/dataview.py | python | DataViewEvent.SetDataFormat | (*args, **kwargs) | return _dataview.DataViewEvent_SetDataFormat(*args, **kwargs) | SetDataFormat(self, wxDataFormat format) | SetDataFormat(self, wxDataFormat format) | [
"SetDataFormat",
"(",
"self",
"wxDataFormat",
"format",
")"
] | def SetDataFormat(*args, **kwargs):
"""SetDataFormat(self, wxDataFormat format)"""
return _dataview.DataViewEvent_SetDataFormat(*args, **kwargs) | [
"def",
"SetDataFormat",
"(",
"*",
"args",
",",
"*",
"*",
"kwargs",
")",
":",
"return",
"_dataview",
".",
"DataViewEvent_SetDataFormat",
"(",
"*",
"args",
",",
"*",
"*",
"kwargs",
")"
] | https://github.com/wxWidgets/wxPython-Classic/blob/19571e1ae65f1ac445f5491474121998c97a1bf0/src/osx_cocoa/dataview.py#L1976-L1978 | |
apache/incubator-mxnet | f03fb23f1d103fec9541b5ae59ee06b1734a51d9 | python/mxnet/onnx/mx2onnx/_op_translations/_op_translations_opset12.py | python | get_inputs | (node, kwargs) | return name, input_nodes, attrs | Helper function to get inputs | Helper function to get inputs | [
"Helper",
"function",
"to",
"get",
"inputs"
] | def get_inputs(node, kwargs):
"""Helper function to get inputs"""
name = node["name"]
outputs_lookup = kwargs["outputs_lookup"]
inputs = node["inputs"]
attrs = node.get("attrs", {})
input_nodes = []
for ip in inputs:
input_node_name = outputs_lookup[ip[0]][ip[1]].name
input_... | [
"def",
"get_inputs",
"(",
"node",
",",
"kwargs",
")",
":",
"name",
"=",
"node",
"[",
"\"name\"",
"]",
"outputs_lookup",
"=",
"kwargs",
"[",
"\"outputs_lookup\"",
"]",
"inputs",
"=",
"node",
"[",
"\"inputs\"",
"]",
"attrs",
"=",
"node",
".",
"get",
"(",
... | https://github.com/apache/incubator-mxnet/blob/f03fb23f1d103fec9541b5ae59ee06b1734a51d9/python/mxnet/onnx/mx2onnx/_op_translations/_op_translations_opset12.py#L116-L128 | |
aws/lumberyard | f85344403c1c2e77ec8c75deb2c116e97b713217 | dev/Gems/CloudGemMetric/v1/AWS/common-code/Lib/numpy/core/records.py | python | record.pprint | (self) | return "\n".join(rows) | Pretty-print all fields. | Pretty-print all fields. | [
"Pretty",
"-",
"print",
"all",
"fields",
"."
] | def pprint(self):
"""Pretty-print all fields."""
# pretty-print all fields
names = self.dtype.names
maxlen = max(len(name) for name in names)
fmt = '%% %ds: %%s' % maxlen
rows = [fmt % (name, getattr(self, name)) for name in names]
return "\n".join(rows) | [
"def",
"pprint",
"(",
"self",
")",
":",
"# pretty-print all fields",
"names",
"=",
"self",
".",
"dtype",
".",
"names",
"maxlen",
"=",
"max",
"(",
"len",
"(",
"name",
")",
"for",
"name",
"in",
"names",
")",
"fmt",
"=",
"'%% %ds: %%s'",
"%",
"maxlen",
"r... | https://github.com/aws/lumberyard/blob/f85344403c1c2e77ec8c75deb2c116e97b713217/dev/Gems/CloudGemMetric/v1/AWS/common-code/Lib/numpy/core/records.py#L302-L309 | |
pytorch/pytorch | 7176c92687d3cc847cc046bf002269c6949a21c2 | torch/utils/benchmark/utils/sparse_fuzzer.py | python | FuzzedSparseTensor.sparse_tensor_constructor | (size, dtype, sparse_dim, nnz, is_coalesced) | return x | sparse_tensor_constructor creates a sparse tensor with coo format.
Note that when `is_coalesced` is False, the number of elements is doubled but the number of indices
represents the same amount of number of non zeros `nnz`, i.e, this is virtually the same tensor
with the same sparsity pattern. ... | sparse_tensor_constructor creates a sparse tensor with coo format. | [
"sparse_tensor_constructor",
"creates",
"a",
"sparse",
"tensor",
"with",
"coo",
"format",
"."
] | def sparse_tensor_constructor(size, dtype, sparse_dim, nnz, is_coalesced):
"""sparse_tensor_constructor creates a sparse tensor with coo format.
Note that when `is_coalesced` is False, the number of elements is doubled but the number of indices
represents the same amount of number of non zeros ... | [
"def",
"sparse_tensor_constructor",
"(",
"size",
",",
"dtype",
",",
"sparse_dim",
",",
"nnz",
",",
"is_coalesced",
")",
":",
"if",
"isinstance",
"(",
"size",
",",
"Number",
")",
":",
"size",
"=",
"[",
"size",
"]",
"*",
"sparse_dim",
"assert",
"all",
"(",... | https://github.com/pytorch/pytorch/blob/7176c92687d3cc847cc046bf002269c6949a21c2/torch/utils/benchmark/utils/sparse_fuzzer.py#L58-L90 | |
wxWidgets/wxPython-Classic | 19571e1ae65f1ac445f5491474121998c97a1bf0 | wx/lib/agw/aquabutton.py | python | AquaButton.LightColour | (self, colour, percent) | return wx.Colour(r, g, b) | Return light contrast of `colour`. The colour returned is from the scale of
`colour` ==> white.
:param `colour`: the input colour to be brightened, a valid instance of :class:`Colour`;
:param integer `percent`: determines how light the colour will be. `percent` = ``100``
returns white,... | Return light contrast of `colour`. The colour returned is from the scale of
`colour` ==> white. | [
"Return",
"light",
"contrast",
"of",
"colour",
".",
"The",
"colour",
"returned",
"is",
"from",
"the",
"scale",
"of",
"colour",
"==",
">",
"white",
"."
] | def LightColour(self, colour, percent):
"""
Return light contrast of `colour`. The colour returned is from the scale of
`colour` ==> white.
:param `colour`: the input colour to be brightened, a valid instance of :class:`Colour`;
:param integer `percent`: determines how light the... | [
"def",
"LightColour",
"(",
"self",
",",
"colour",
",",
"percent",
")",
":",
"end_colour",
"=",
"wx",
".",
"WHITE",
"rd",
"=",
"end_colour",
".",
"Red",
"(",
")",
"-",
"colour",
".",
"Red",
"(",
")",
"gd",
"=",
"end_colour",
".",
"Green",
"(",
")",
... | https://github.com/wxWidgets/wxPython-Classic/blob/19571e1ae65f1ac445f5491474121998c97a1bf0/wx/lib/agw/aquabutton.py#L241-L265 | |
microsoft/ELL | a1d6bacc37a14879cc025d9be2ba40b1a0632315 | tools/importers/onnx/lib/onnx_converters.py | python | OnnxNodeConverter.get_padding | (self) | return {"size": pad, "scheme": ell.neural.PaddingScheme.zeros} | Derived classes can override. Return is a dict:
{"size": size_value, "scheme": scheme_value}
where:
size - size of padding
scheme - padding scheme to use, see ell.neural.PaddingScheme | Derived classes can override. Return is a dict:
{"size": size_value, "scheme": scheme_value}
where:
size - size of padding
scheme - padding scheme to use, see ell.neural.PaddingScheme | [
"Derived",
"classes",
"can",
"override",
".",
"Return",
"is",
"a",
"dict",
":",
"{",
"size",
":",
"size_value",
"scheme",
":",
"scheme_value",
"}",
"where",
":",
"size",
"-",
"size",
"of",
"padding",
"scheme",
"-",
"padding",
"scheme",
"to",
"use",
"see"... | def get_padding(self):
"""
Derived classes can override. Return is a dict:
{"size": size_value, "scheme": scheme_value}
where:
size - size of padding
scheme - padding scheme to use, see ell.neural.PaddingScheme
"""
pad = 0 # default padding
if 'pa... | [
"def",
"get_padding",
"(",
"self",
")",
":",
"pad",
"=",
"0",
"# default padding",
"if",
"'padding'",
"in",
"self",
".",
"node",
".",
"attributes",
":",
"pad",
"=",
"self",
".",
"node",
".",
"attributes",
"[",
"'padding'",
"]",
"return",
"{",
"\"size\"",... | https://github.com/microsoft/ELL/blob/a1d6bacc37a14879cc025d9be2ba40b1a0632315/tools/importers/onnx/lib/onnx_converters.py#L139-L151 | |
tum-vision/fusenet | a1451be2971b348a01b0f525c2a3a7a0e215a591 | tools/extra/parse_log.py | python | save_csv_files | (logfile_path, output_dir, train_dict_list, test_dict_list,
delimiter=',', verbose=False) | Save CSV files to output_dir
If the input log file is, e.g., caffe.INFO, the names will be
caffe.INFO.train and caffe.INFO.test | Save CSV files to output_dir | [
"Save",
"CSV",
"files",
"to",
"output_dir"
] | def save_csv_files(logfile_path, output_dir, train_dict_list, test_dict_list,
delimiter=',', verbose=False):
"""Save CSV files to output_dir
If the input log file is, e.g., caffe.INFO, the names will be
caffe.INFO.train and caffe.INFO.test
"""
log_basename = os.path.basename(log... | [
"def",
"save_csv_files",
"(",
"logfile_path",
",",
"output_dir",
",",
"train_dict_list",
",",
"test_dict_list",
",",
"delimiter",
"=",
"','",
",",
"verbose",
"=",
"False",
")",
":",
"log_basename",
"=",
"os",
".",
"path",
".",
"basename",
"(",
"logfile_path",
... | https://github.com/tum-vision/fusenet/blob/a1451be2971b348a01b0f525c2a3a7a0e215a591/tools/extra/parse_log.py#L132-L145 | ||
krishauser/Klampt | 972cc83ea5befac3f653c1ba20f80155768ad519 | Python/klampt/model/collide.py | python | bb_empty | (bb: BBType) | return any((a > b) for (a,b) in zip(bb[0],bb[1])) | Returns True if the bounding box is empty | Returns True if the bounding box is empty | [
"Returns",
"True",
"if",
"the",
"bounding",
"box",
"is",
"empty"
] | def bb_empty(bb: BBType) -> bool:
"""Returns True if the bounding box is empty"""
return any((a > b) for (a,b) in zip(bb[0],bb[1])) | [
"def",
"bb_empty",
"(",
"bb",
":",
"BBType",
")",
"->",
"bool",
":",
"return",
"any",
"(",
"(",
"a",
">",
"b",
")",
"for",
"(",
"a",
",",
"b",
")",
"in",
"zip",
"(",
"bb",
"[",
"0",
"]",
",",
"bb",
"[",
"1",
"]",
")",
")"
] | https://github.com/krishauser/Klampt/blob/972cc83ea5befac3f653c1ba20f80155768ad519/Python/klampt/model/collide.py#L37-L39 | |
hanpfei/chromium-net | 392cc1fa3a8f92f42e4071ab6e674d8e0482f83f | third_party/catapult/third_party/gsutil/third_party/apitools/apitools/base/py/http_wrapper.py | python | MakeRequest | (http, http_request, retries=7, max_retry_wait=60,
redirections=5,
retry_func=HandleExceptionsAndRebuildHttpConnections,
check_response_func=CheckResponse) | Send http_request via the given http, performing error/retry handling.
Args:
http: An httplib2.Http instance, or a http multiplexer that delegates to
an underlying http, for example, HTTPMultiplexer.
http_request: A Request to send.
retries: (int, default 7) Number of retries to attempt... | Send http_request via the given http, performing error/retry handling. | [
"Send",
"http_request",
"via",
"the",
"given",
"http",
"performing",
"error",
"/",
"retry",
"handling",
"."
] | def MakeRequest(http, http_request, retries=7, max_retry_wait=60,
redirections=5,
retry_func=HandleExceptionsAndRebuildHttpConnections,
check_response_func=CheckResponse):
"""Send http_request via the given http, performing error/retry handling.
Args:
http:... | [
"def",
"MakeRequest",
"(",
"http",
",",
"http_request",
",",
"retries",
"=",
"7",
",",
"max_retry_wait",
"=",
"60",
",",
"redirections",
"=",
"5",
",",
"retry_func",
"=",
"HandleExceptionsAndRebuildHttpConnections",
",",
"check_response_func",
"=",
"CheckResponse",
... | https://github.com/hanpfei/chromium-net/blob/392cc1fa3a8f92f42e4071ab6e674d8e0482f83f/third_party/catapult/third_party/gsutil/third_party/apitools/apitools/base/py/http_wrapper.py#L284-L325 | ||
aws/lumberyard | f85344403c1c2e77ec8c75deb2c116e97b713217 | dev/Tools/Python/3.7.10/mac/Python.framework/Versions/3.7/lib/python3.7/difflib.py | python | IS_LINE_JUNK | (line, pat=re.compile(r"\s*(?:#\s*)?$").match) | return pat(line) is not None | r"""
Return True for ignorable line: iff `line` is blank or contains a single '#'.
Examples:
>>> IS_LINE_JUNK('\n')
True
>>> IS_LINE_JUNK(' # \n')
True
>>> IS_LINE_JUNK('hello\n')
False | r"""
Return True for ignorable line: iff `line` is blank or contains a single '#'. | [
"r",
"Return",
"True",
"for",
"ignorable",
"line",
":",
"iff",
"line",
"is",
"blank",
"or",
"contains",
"a",
"single",
"#",
"."
] | def IS_LINE_JUNK(line, pat=re.compile(r"\s*(?:#\s*)?$").match):
r"""
Return True for ignorable line: iff `line` is blank or contains a single '#'.
Examples:
>>> IS_LINE_JUNK('\n')
True
>>> IS_LINE_JUNK(' # \n')
True
>>> IS_LINE_JUNK('hello\n')
False
"""
return pat(line)... | [
"def",
"IS_LINE_JUNK",
"(",
"line",
",",
"pat",
"=",
"re",
".",
"compile",
"(",
"r\"\\s*(?:#\\s*)?$\"",
")",
".",
"match",
")",
":",
"return",
"pat",
"(",
"line",
")",
"is",
"not",
"None"
] | https://github.com/aws/lumberyard/blob/f85344403c1c2e77ec8c75deb2c116e97b713217/dev/Tools/Python/3.7.10/mac/Python.framework/Versions/3.7/lib/python3.7/difflib.py#L1086-L1100 | |
weolar/miniblink49 | 1c4678db0594a4abde23d3ebbcc7cd13c3170777 | third_party/WebKit/Tools/Scripts/webkitpy/thirdparty/irc/irclib.py | python | SimpleIRCClient.connect | (self, server, port, nickname, password=None, username=None,
ircname=None, localaddress="", localport=0, ssl=False, ipv6=False) | Connect/reconnect to a server.
Arguments:
server -- Server name.
port -- Port number.
nickname -- The nickname.
password -- Password (if any).
username -- The username.
ircname -- The IRC name.
localaddress -- Bind the c... | Connect/reconnect to a server. | [
"Connect",
"/",
"reconnect",
"to",
"a",
"server",
"."
] | def connect(self, server, port, nickname, password=None, username=None,
ircname=None, localaddress="", localport=0, ssl=False, ipv6=False):
"""Connect/reconnect to a server.
Arguments:
server -- Server name.
port -- Port number.
nickname -- The nic... | [
"def",
"connect",
"(",
"self",
",",
"server",
",",
"port",
",",
"nickname",
",",
"password",
"=",
"None",
",",
"username",
"=",
"None",
",",
"ircname",
"=",
"None",
",",
"localaddress",
"=",
"\"\"",
",",
"localport",
"=",
"0",
",",
"ssl",
"=",
"False... | https://github.com/weolar/miniblink49/blob/1c4678db0594a4abde23d3ebbcc7cd13c3170777/third_party/WebKit/Tools/Scripts/webkitpy/thirdparty/irc/irclib.py#L1054-L1084 | ||
wlanjie/AndroidFFmpeg | 7baf9122f4b8e1c74e7baf4be5c422c7a5ba5aaf | tools/fdk-aac-build/armeabi/toolchain/lib/python2.7/platform.py | python | _syscmd_uname | (option,default='') | Interface to the system's uname command. | Interface to the system's uname command. | [
"Interface",
"to",
"the",
"system",
"s",
"uname",
"command",
"."
] | def _syscmd_uname(option,default=''):
""" Interface to the system's uname command.
"""
if sys.platform in ('dos','win32','win16','os2'):
# XXX Others too ?
return default
try:
f = os.popen('uname %s 2> %s' % (option, DEV_NULL))
except (AttributeError,os.error):
retur... | [
"def",
"_syscmd_uname",
"(",
"option",
",",
"default",
"=",
"''",
")",
":",
"if",
"sys",
".",
"platform",
"in",
"(",
"'dos'",
",",
"'win32'",
",",
"'win16'",
",",
"'os2'",
")",
":",
"# XXX Others too ?",
"return",
"default",
"try",
":",
"f",
"=",
"os",... | https://github.com/wlanjie/AndroidFFmpeg/blob/7baf9122f4b8e1c74e7baf4be5c422c7a5ba5aaf/tools/fdk-aac-build/armeabi/toolchain/lib/python2.7/platform.py#L1000-L1016 | ||
catboost/catboost | 167f64f237114a4d10b2b4ee42adb4569137debe | contrib/tools/python3/src/Lib/xml/dom/pulldom.py | python | DOMEventStream.clear | (self) | clear(): Explicitly release parsing objects | clear(): Explicitly release parsing objects | [
"clear",
"()",
":",
"Explicitly",
"release",
"parsing",
"objects"
] | def clear(self):
"""clear(): Explicitly release parsing objects"""
self.pulldom.clear()
del self.pulldom
self.parser = None
self.stream = None | [
"def",
"clear",
"(",
"self",
")",
":",
"self",
".",
"pulldom",
".",
"clear",
"(",
")",
"del",
"self",
".",
"pulldom",
"self",
".",
"parser",
"=",
"None",
"self",
".",
"stream",
"=",
"None"
] | https://github.com/catboost/catboost/blob/167f64f237114a4d10b2b4ee42adb4569137debe/contrib/tools/python3/src/Lib/xml/dom/pulldom.py#L289-L294 | ||
Xilinx/Vitis-AI | fc74d404563d9951b57245443c73bef389f3657f | tools/Vitis-AI-Quantizer/vai_q_tensorflow2.x/tensorflow_model_optimization/python/core/quantization/keras/vitis/optimizations/vitis_optimize_transforms.py | python | _get_weights | (bn_layer_node) | return collections.OrderedDict(
list(bn_layer_node.input_layers[0].weights.items()) +
list(bn_layer_node.weights.items())) | Returns weight values for fused layer, including copying original values in unfused version. | Returns weight values for fused layer, including copying original values in unfused version. | [
"Returns",
"weight",
"values",
"for",
"fused",
"layer",
"including",
"copying",
"original",
"values",
"in",
"unfused",
"version",
"."
] | def _get_weights(bn_layer_node):
"""Returns weight values for fused layer, including copying original values in unfused version."""
return collections.OrderedDict(
list(bn_layer_node.input_layers[0].weights.items()) +
list(bn_layer_node.weights.items())) | [
"def",
"_get_weights",
"(",
"bn_layer_node",
")",
":",
"return",
"collections",
".",
"OrderedDict",
"(",
"list",
"(",
"bn_layer_node",
".",
"input_layers",
"[",
"0",
"]",
".",
"weights",
".",
"items",
"(",
")",
")",
"+",
"list",
"(",
"bn_layer_node",
".",
... | https://github.com/Xilinx/Vitis-AI/blob/fc74d404563d9951b57245443c73bef389f3657f/tools/Vitis-AI-Quantizer/vai_q_tensorflow2.x/tensorflow_model_optimization/python/core/quantization/keras/vitis/optimizations/vitis_optimize_transforms.py#L40-L45 | |
catboost/catboost | 167f64f237114a4d10b2b4ee42adb4569137debe | contrib/python/prompt-toolkit/py3/prompt_toolkit/layout/layout.py | python | walk | (container: Container, skip_hidden: bool = False) | Walk through layout, starting at this container. | Walk through layout, starting at this container. | [
"Walk",
"through",
"layout",
"starting",
"at",
"this",
"container",
"."
] | def walk(container: Container, skip_hidden: bool = False) -> Iterable[Container]:
"""
Walk through layout, starting at this container.
"""
# When `skip_hidden` is set, don't go into disabled ConditionalContainer containers.
if (
skip_hidden
and isinstance(container, ConditionalContai... | [
"def",
"walk",
"(",
"container",
":",
"Container",
",",
"skip_hidden",
":",
"bool",
"=",
"False",
")",
"->",
"Iterable",
"[",
"Container",
"]",
":",
"# When `skip_hidden` is set, don't go into disabled ConditionalContainer containers.",
"if",
"(",
"skip_hidden",
"and",
... | https://github.com/catboost/catboost/blob/167f64f237114a4d10b2b4ee42adb4569137debe/contrib/python/prompt-toolkit/py3/prompt_toolkit/layout/layout.py#L401-L417 | ||
lyxok1/Tiny-DSOD | 94d15450699bea0dd3720e75e2d273e476174fba | scripts/cpp_lint.py | python | _IncludeState.IsInAlphabeticalOrder | (self, clean_lines, linenum, header_path) | return True | Check if a header is in alphabetical order with the previous header.
Args:
clean_lines: A CleansedLines instance containing the file.
linenum: The number of the line to check.
header_path: Canonicalized header to be checked.
Returns:
Returns true if the header is in alphabetical order. | Check if a header is in alphabetical order with the previous header. | [
"Check",
"if",
"a",
"header",
"is",
"in",
"alphabetical",
"order",
"with",
"the",
"previous",
"header",
"."
] | def IsInAlphabeticalOrder(self, clean_lines, linenum, header_path):
"""Check if a header is in alphabetical order with the previous header.
Args:
clean_lines: A CleansedLines instance containing the file.
linenum: The number of the line to check.
header_path: Canonicalized header to be checke... | [
"def",
"IsInAlphabeticalOrder",
"(",
"self",
",",
"clean_lines",
",",
"linenum",
",",
"header_path",
")",
":",
"# If previous section is different from current section, _last_header will",
"# be reset to empty string, so it's always less than current header.",
"#",
"# If previous line ... | https://github.com/lyxok1/Tiny-DSOD/blob/94d15450699bea0dd3720e75e2d273e476174fba/scripts/cpp_lint.py#L612-L631 | |
benoitsteiner/tensorflow-opencl | cb7cb40a57fde5cfd4731bc551e82a1e2fef43a5 | tensorflow/python/profiler/model_analyzer.py | python | Profiler.__init__ | (self, graph, op_log=None) | Constructor.
Args:
graph: tf.Graph.
op_log: optional. tensorflow::tfprof::OpLogProto proto. Used to define
extra op types. | Constructor. | [
"Constructor",
"."
] | def __init__(self, graph, op_log=None):
"""Constructor.
Args:
graph: tf.Graph.
op_log: optional. tensorflow::tfprof::OpLogProto proto. Used to define
extra op types.
"""
self._graph = graph
# pylint: disable=protected-access
op_log = tfprof_logger._merge_default_with_oplog... | [
"def",
"__init__",
"(",
"self",
",",
"graph",
",",
"op_log",
"=",
"None",
")",
":",
"self",
".",
"_graph",
"=",
"graph",
"# pylint: disable=protected-access",
"op_log",
"=",
"tfprof_logger",
".",
"_merge_default_with_oplog",
"(",
"self",
".",
"_graph",
",",
"o... | https://github.com/benoitsteiner/tensorflow-opencl/blob/cb7cb40a57fde5cfd4731bc551e82a1e2fef43a5/tensorflow/python/profiler/model_analyzer.py#L152-L168 | ||
wxWidgets/wxPython-Classic | 19571e1ae65f1ac445f5491474121998c97a1bf0 | wx/tools/Editra/src/ed_main.py | python | MainWindow.OnOpen | (self, evt) | Open a File
@param evt: wx.MenuEvent | Open a File
@param evt: wx.MenuEvent | [
"Open",
"a",
"File",
"@param",
"evt",
":",
"wx",
".",
"MenuEvent"
] | def OnOpen(self, evt):
"""Open a File
@param evt: wx.MenuEvent
"""
if evt.GetId() == ID_OPEN:
self.DoOpen(evt)
else:
evt.Skip() | [
"def",
"OnOpen",
"(",
"self",
",",
"evt",
")",
":",
"if",
"evt",
".",
"GetId",
"(",
")",
"==",
"ID_OPEN",
":",
"self",
".",
"DoOpen",
"(",
"evt",
")",
"else",
":",
"evt",
".",
"Skip",
"(",
")"
] | https://github.com/wxWidgets/wxPython-Classic/blob/19571e1ae65f1ac445f5491474121998c97a1bf0/wx/tools/Editra/src/ed_main.py#L564-L572 | ||
freeorion/freeorion | c266a40eccd3a99a17de8fe57c36ef6ba3771665 | default/python/AI/FleetUtilsAI.py | python | get_fighter_capacity_of_fleet | (fleet_id: int) | return cur_capacity, max_capacity | Return current and max fighter capacity. | Return current and max fighter capacity. | [
"Return",
"current",
"and",
"max",
"fighter",
"capacity",
"."
] | def get_fighter_capacity_of_fleet(fleet_id: int) -> Tuple[int, int]:
"""
Return current and max fighter capacity.
"""
universe = fo.getUniverse()
fleet = universe.getFleet(fleet_id)
cur_capacity = 0
max_capacity = 0
ships = (universe.getShip(ship_id) for ship_id in (fleet.shipIDs if flee... | [
"def",
"get_fighter_capacity_of_fleet",
"(",
"fleet_id",
":",
"int",
")",
"->",
"Tuple",
"[",
"int",
",",
"int",
"]",
":",
"universe",
"=",
"fo",
".",
"getUniverse",
"(",
")",
"fleet",
"=",
"universe",
".",
"getFleet",
"(",
"fleet_id",
")",
"cur_capacity",... | https://github.com/freeorion/freeorion/blob/c266a40eccd3a99a17de8fe57c36ef6ba3771665/default/python/AI/FleetUtilsAI.py#L622-L639 | |
tensorflow/tensorflow | 419e3a6b650ea4bd1b0cba23c4348f8a69f3272e | tensorflow/python/ops/linalg/linear_operator_util.py | python | use_operator_or_provided_hint_unless_contradicting | (
operator, hint_attr_name, provided_hint_value, message) | return None | Get combined hint in the case where operator.hint should equal hint.
Args:
operator: LinearOperator that a meta-operator was initialized with.
hint_attr_name: String name for the attribute.
provided_hint_value: Bool or None. Value passed by user in initialization.
message: Error message to print ... | Get combined hint in the case where operator.hint should equal hint. | [
"Get",
"combined",
"hint",
"in",
"the",
"case",
"where",
"operator",
".",
"hint",
"should",
"equal",
"hint",
"."
] | def use_operator_or_provided_hint_unless_contradicting(
operator, hint_attr_name, provided_hint_value, message):
"""Get combined hint in the case where operator.hint should equal hint.
Args:
operator: LinearOperator that a meta-operator was initialized with.
hint_attr_name: String name for the attrib... | [
"def",
"use_operator_or_provided_hint_unless_contradicting",
"(",
"operator",
",",
"hint_attr_name",
",",
"provided_hint_value",
",",
"message",
")",
":",
"op_hint",
"=",
"getattr",
"(",
"operator",
",",
"hint_attr_name",
")",
"# pylint: disable=g-bool-id-comparison",
"if",... | https://github.com/tensorflow/tensorflow/blob/419e3a6b650ea4bd1b0cba23c4348f8a69f3272e/tensorflow/python/ops/linalg/linear_operator_util.py#L482-L509 | |
hanpfei/chromium-net | 392cc1fa3a8f92f42e4071ab6e674d8e0482f83f | third_party/catapult/third_party/mapreduce/mapreduce/model.py | python | ShardState.create_new | (cls, mapreduce_id, shard_number) | return state | Create new shard state.
Args:
mapreduce_id: unique mapreduce id as string.
shard_number: shard number for which to create shard state.
Returns:
new instance of ShardState ready to put into datastore. | Create new shard state. | [
"Create",
"new",
"shard",
"state",
"."
] | def create_new(cls, mapreduce_id, shard_number):
"""Create new shard state.
Args:
mapreduce_id: unique mapreduce id as string.
shard_number: shard number for which to create shard state.
Returns:
new instance of ShardState ready to put into datastore.
"""
shard_id = cls.shard_id_... | [
"def",
"create_new",
"(",
"cls",
",",
"mapreduce_id",
",",
"shard_number",
")",
":",
"shard_id",
"=",
"cls",
".",
"shard_id_from_number",
"(",
"mapreduce_id",
",",
"shard_number",
")",
"state",
"=",
"cls",
"(",
"key_name",
"=",
"shard_id",
",",
"mapreduce_id",... | https://github.com/hanpfei/chromium-net/blob/392cc1fa3a8f92f42e4071ab6e674d8e0482f83f/third_party/catapult/third_party/mapreduce/mapreduce/model.py#L1150-L1163 | |
ycm-core/ycmd | fc0fb7e5e15176cc5a2a30c80956335988c6b59a | ycmd/server_state.py | python | ServerState.CurrentFiletypeCompletionEnabled | ( self, current_filetypes ) | Return False if all filetypes in the list |current_filetypes| are
disabled by the user option 'filetype_specific_completion_to_disable'. | Return False if all filetypes in the list |current_filetypes| are
disabled by the user option 'filetype_specific_completion_to_disable'. | [
"Return",
"False",
"if",
"all",
"filetypes",
"in",
"the",
"list",
"|current_filetypes|",
"are",
"disabled",
"by",
"the",
"user",
"option",
"filetype_specific_completion_to_disable",
"."
] | def CurrentFiletypeCompletionEnabled( self, current_filetypes ):
"""Return False if all filetypes in the list |current_filetypes| are
disabled by the user option 'filetype_specific_completion_to_disable'."""
filetype_to_disable = self._user_options[
'filetype_specific_completion_to_disable' ]
if... | [
"def",
"CurrentFiletypeCompletionEnabled",
"(",
"self",
",",
"current_filetypes",
")",
":",
"filetype_to_disable",
"=",
"self",
".",
"_user_options",
"[",
"'filetype_specific_completion_to_disable'",
"]",
"if",
"'*'",
"in",
"filetype_to_disable",
":",
"return",
"False",
... | https://github.com/ycm-core/ycmd/blob/fc0fb7e5e15176cc5a2a30c80956335988c6b59a/ycmd/server_state.py#L144-L152 | ||
wlanjie/AndroidFFmpeg | 7baf9122f4b8e1c74e7baf4be5c422c7a5ba5aaf | tools/fdk-aac-build/armeabi-v7a/toolchain/lib/python2.7/lib-tk/Tkinter.py | python | _tkerror | (err) | Internal function. | Internal function. | [
"Internal",
"function",
"."
] | def _tkerror(err):
"""Internal function."""
pass | [
"def",
"_tkerror",
"(",
"err",
")",
":",
"pass"
] | https://github.com/wlanjie/AndroidFFmpeg/blob/7baf9122f4b8e1c74e7baf4be5c422c7a5ba5aaf/tools/fdk-aac-build/armeabi-v7a/toolchain/lib/python2.7/lib-tk/Tkinter.py#L185-L187 | ||
cinder/Cinder | e83f5bb9c01a63eec20168d02953a0879e5100f7 | docs/libs/bs4/__init__.py | python | BeautifulSoup.new_string | (self, s, subclass=NavigableString) | return navigable | Create a new NavigableString associated with this soup. | Create a new NavigableString associated with this soup. | [
"Create",
"a",
"new",
"NavigableString",
"associated",
"with",
"this",
"soup",
"."
] | def new_string(self, s, subclass=NavigableString):
"""Create a new NavigableString associated with this soup."""
navigable = subclass(s)
navigable.setup()
return navigable | [
"def",
"new_string",
"(",
"self",
",",
"s",
",",
"subclass",
"=",
"NavigableString",
")",
":",
"navigable",
"=",
"subclass",
"(",
"s",
")",
"navigable",
".",
"setup",
"(",
")",
"return",
"navigable"
] | https://github.com/cinder/Cinder/blob/e83f5bb9c01a63eec20168d02953a0879e5100f7/docs/libs/bs4/__init__.py#L230-L234 | |
apple/turicreate | cce55aa5311300e3ce6af93cb45ba791fd1bdf49 | src/python/turicreate/toolkits/recommender/util.py | python | _Recommender._set_current_options | (self, options) | return response | Set current options for a model.
Parameters
----------
options : dict
A dictionary of the desired option settings. The key should be the name
of the option and each value is the desired value of the option. | Set current options for a model. | [
"Set",
"current",
"options",
"for",
"a",
"model",
"."
] | def _set_current_options(self, options):
"""
Set current options for a model.
Parameters
----------
options : dict
A dictionary of the desired option settings. The key should be the name
of the option and each value is the desired value of the option.
... | [
"def",
"_set_current_options",
"(",
"self",
",",
"options",
")",
":",
"opts",
"=",
"self",
".",
"_get_current_options",
"(",
")",
"opts",
".",
"update",
"(",
"options",
")",
"response",
"=",
"self",
".",
"__proxy__",
".",
"set_current_options",
"(",
"opts",
... | https://github.com/apple/turicreate/blob/cce55aa5311300e3ce6af93cb45ba791fd1bdf49/src/python/turicreate/toolkits/recommender/util.py#L813-L827 | |
tensorflow/tensorflow | 419e3a6b650ea4bd1b0cba23c4348f8a69f3272e | tensorflow/python/framework/ops.py | python | enable_tensor_equality | () | Compare Tensors with element-wise comparison and thus be unhashable.
Comparing tensors with element-wise allows comparisons such as
tf.Variable(1.0) == 1.0. Element-wise equality implies that tensors are
unhashable. Thus tensors can no longer be directly used in sets or as a key in
a dictionary. | Compare Tensors with element-wise comparison and thus be unhashable. | [
"Compare",
"Tensors",
"with",
"element",
"-",
"wise",
"comparison",
"and",
"thus",
"be",
"unhashable",
"."
] | def enable_tensor_equality():
"""Compare Tensors with element-wise comparison and thus be unhashable.
Comparing tensors with element-wise allows comparisons such as
tf.Variable(1.0) == 1.0. Element-wise equality implies that tensors are
unhashable. Thus tensors can no longer be directly used in sets or as a ke... | [
"def",
"enable_tensor_equality",
"(",
")",
":",
"logging",
".",
"vlog",
"(",
"1",
",",
"\"Enabling tensor equality\"",
")",
"_tensor_equality_api_usage_gauge",
".",
"get_cell",
"(",
")",
".",
"set",
"(",
"True",
")",
"Tensor",
".",
"_USE_EQUALITY",
"=",
"True"
] | https://github.com/tensorflow/tensorflow/blob/419e3a6b650ea4bd1b0cba23c4348f8a69f3272e/tensorflow/python/framework/ops.py#L263-L273 | ||
tensorflow/tensorflow | 419e3a6b650ea4bd1b0cba23c4348f8a69f3272e | tensorflow/python/ops/math_grad.py | python | _AtanGrad | (op, grad) | Returns grad * 1/ (1 + x^2). | Returns grad * 1/ (1 + x^2). | [
"Returns",
"grad",
"*",
"1",
"/",
"(",
"1",
"+",
"x^2",
")",
"."
] | def _AtanGrad(op, grad):
"""Returns grad * 1/ (1 + x^2)."""
x = op.inputs[0]
with ops.control_dependencies([grad]):
x = math_ops.conj(x)
x2 = math_ops.square(x)
one = constant_op.constant(1, dtype=grad.dtype)
inv = math_ops.reciprocal(math_ops.add(one, x2))
return grad * inv | [
"def",
"_AtanGrad",
"(",
"op",
",",
"grad",
")",
":",
"x",
"=",
"op",
".",
"inputs",
"[",
"0",
"]",
"with",
"ops",
".",
"control_dependencies",
"(",
"[",
"grad",
"]",
")",
":",
"x",
"=",
"math_ops",
".",
"conj",
"(",
"x",
")",
"x2",
"=",
"math_... | https://github.com/tensorflow/tensorflow/blob/419e3a6b650ea4bd1b0cba23c4348f8a69f3272e/tensorflow/python/ops/math_grad.py#L1245-L1253 | ||
hanpfei/chromium-net | 392cc1fa3a8f92f42e4071ab6e674d8e0482f83f | third_party/catapult/third_party/coverage/coverage/results.py | python | Numbers.n_executed_branches | (self) | return self.n_branches - self.n_missing_branches | Returns the number of executed branches. | Returns the number of executed branches. | [
"Returns",
"the",
"number",
"of",
"executed",
"branches",
"."
] | def n_executed_branches(self):
"""Returns the number of executed branches."""
return self.n_branches - self.n_missing_branches | [
"def",
"n_executed_branches",
"(",
"self",
")",
":",
"return",
"self",
".",
"n_branches",
"-",
"self",
".",
"n_missing_branches"
] | https://github.com/hanpfei/chromium-net/blob/392cc1fa3a8f92f42e4071ab6e674d8e0482f83f/third_party/catapult/third_party/coverage/coverage/results.py#L207-L209 | |
Z3Prover/z3 | d745d03afdfdf638d66093e2bfbacaf87187f35b | src/api/python/z3/z3.py | python | QuantifierRef.num_no_patterns | (self) | return Z3_get_quantifier_num_no_patterns(self.ctx_ref(), self.ast) | Return the number of no-patterns. | Return the number of no-patterns. | [
"Return",
"the",
"number",
"of",
"no",
"-",
"patterns",
"."
] | def num_no_patterns(self):
"""Return the number of no-patterns."""
return Z3_get_quantifier_num_no_patterns(self.ctx_ref(), self.ast) | [
"def",
"num_no_patterns",
"(",
"self",
")",
":",
"return",
"Z3_get_quantifier_num_no_patterns",
"(",
"self",
".",
"ctx_ref",
"(",
")",
",",
"self",
".",
"ast",
")"
] | https://github.com/Z3Prover/z3/blob/d745d03afdfdf638d66093e2bfbacaf87187f35b/src/api/python/z3/z3.py#L2064-L2066 | |
wxWidgets/wxPython-Classic | 19571e1ae65f1ac445f5491474121998c97a1bf0 | src/msw/_windows.py | python | FindDialogEvent.SetFindString | (*args, **kwargs) | return _windows_.FindDialogEvent_SetFindString(*args, **kwargs) | SetFindString(self, String str) | SetFindString(self, String str) | [
"SetFindString",
"(",
"self",
"String",
"str",
")"
] | def SetFindString(*args, **kwargs):
"""SetFindString(self, String str)"""
return _windows_.FindDialogEvent_SetFindString(*args, **kwargs) | [
"def",
"SetFindString",
"(",
"*",
"args",
",",
"*",
"*",
"kwargs",
")",
":",
"return",
"_windows_",
".",
"FindDialogEvent_SetFindString",
"(",
"*",
"args",
",",
"*",
"*",
"kwargs",
")"
] | https://github.com/wxWidgets/wxPython-Classic/blob/19571e1ae65f1ac445f5491474121998c97a1bf0/src/msw/_windows.py#L3851-L3853 | |
krishauser/Klampt | 972cc83ea5befac3f653c1ba20f80155768ad519 | Python/klampt/src/robotsim.py | python | SimRobotSensor.kinematicSimulate | (self, *args) | return _robotsim.SimRobotSensor_kinematicSimulate(self, *args) | r"""
kinematicSimulate(SimRobotSensor self, WorldModel world, double dt)
kinematicSimulate(SimRobotSensor self, double dt) | r"""
kinematicSimulate(SimRobotSensor self, WorldModel world, double dt)
kinematicSimulate(SimRobotSensor self, double dt) | [
"r",
"kinematicSimulate",
"(",
"SimRobotSensor",
"self",
"WorldModel",
"world",
"double",
"dt",
")",
"kinematicSimulate",
"(",
"SimRobotSensor",
"self",
"double",
"dt",
")"
] | def kinematicSimulate(self, *args) -> "void":
r"""
kinematicSimulate(SimRobotSensor self, WorldModel world, double dt)
kinematicSimulate(SimRobotSensor self, double dt)
"""
return _robotsim.SimRobotSensor_kinematicSimulate(self, *args) | [
"def",
"kinematicSimulate",
"(",
"self",
",",
"*",
"args",
")",
"->",
"\"void\"",
":",
"return",
"_robotsim",
".",
"SimRobotSensor_kinematicSimulate",
"(",
"self",
",",
"*",
"args",
")"
] | https://github.com/krishauser/Klampt/blob/972cc83ea5befac3f653c1ba20f80155768ad519/Python/klampt/src/robotsim.py#L7317-L7324 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.