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 |
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
cms-sw/cmssw | fd9de012d503d3405420bcbeec0ec879baa57cf2 | Configuration/DataProcessing/python/Utils.py | python | stepSKIMPRODUCER | (PhysicsSkims) | return step | _stepSKIMPRODUCER_
Creates and returns the configuration string for the SKIM step
starting from the list of skims to be run. | _stepSKIMPRODUCER_ | [
"_stepSKIMPRODUCER_"
] | def stepSKIMPRODUCER(PhysicsSkims):
"""
_stepSKIMPRODUCER_
Creates and returns the configuration string for the SKIM step
starting from the list of skims to be run.
"""
step = ''
if len(PhysicsSkims) >0 :
step = ',SKIM:'+('+'.join(PhysicsSkims))
return step | [
"def",
"stepSKIMPRODUCER",
"(",
"PhysicsSkims",
")",
":",
"step",
"=",
"''",
"if",
"len",
"(",
"PhysicsSkims",
")",
">",
"0",
":",
"step",
"=",
"',SKIM:'",
"+",
"(",
"'+'",
".",
"join",
"(",
"PhysicsSkims",
")",
")",
"return",
"step"
] | https://github.com/cms-sw/cmssw/blob/fd9de012d503d3405420bcbeec0ec879baa57cf2/Configuration/DataProcessing/python/Utils.py#L24-L36 | |
google/tink | 59bb34495d1cb8f9d9dbc0f0a52c4f9e21491a14 | python/tink/jwt/_raw_jwt.py | python | raw_jwt_from_json | (type_header: Optional[str], payload: str) | return RawJwt._from_json(type_header, payload) | Internal function used to verify JWT token. | Internal function used to verify JWT token. | [
"Internal",
"function",
"used",
"to",
"verify",
"JWT",
"token",
"."
] | def raw_jwt_from_json(type_header: Optional[str], payload: str) -> RawJwt:
"""Internal function used to verify JWT token."""
return RawJwt._from_json(type_header, payload) | [
"def",
"raw_jwt_from_json",
"(",
"type_header",
":",
"Optional",
"[",
"str",
"]",
",",
"payload",
":",
"str",
")",
"->",
"RawJwt",
":",
"return",
"RawJwt",
".",
"_from_json",
"(",
"type_header",
",",
"payload",
")"
] | https://github.com/google/tink/blob/59bb34495d1cb8f9d9dbc0f0a52c4f9e21491a14/python/tink/jwt/_raw_jwt.py#L263-L265 | |
aws/lumberyard | f85344403c1c2e77ec8c75deb2c116e97b713217 | dev/Gems/CloudGemMetric/v1/AWS/python/windows/Lib/psutil/_psosx.py | python | net_if_stats | () | return ret | Get NIC stats (isup, duplex, speed, mtu). | Get NIC stats (isup, duplex, speed, mtu). | [
"Get",
"NIC",
"stats",
"(",
"isup",
"duplex",
"speed",
"mtu",
")",
"."
] | def net_if_stats():
"""Get NIC stats (isup, duplex, speed, mtu)."""
names = net_io_counters().keys()
ret = {}
for name in names:
try:
mtu = cext_posix.net_if_mtu(name)
isup = cext_posix.net_if_flags(name)
duplex, speed = cext_posix.net_if_duplex_speed(name)
... | [
"def",
"net_if_stats",
"(",
")",
":",
"names",
"=",
"net_io_counters",
"(",
")",
".",
"keys",
"(",
")",
"ret",
"=",
"{",
"}",
"for",
"name",
"in",
"names",
":",
"try",
":",
"mtu",
"=",
"cext_posix",
".",
"net_if_mtu",
"(",
"name",
")",
"isup",
"=",... | https://github.com/aws/lumberyard/blob/f85344403c1c2e77ec8c75deb2c116e97b713217/dev/Gems/CloudGemMetric/v1/AWS/python/windows/Lib/psutil/_psosx.py#L258-L275 | |
pmq20/node-packer | 12c46c6e44fbc14d9ee645ebd17d5296b324f7e0 | lts/deps/npm/node_modules/node-gyp/gyp/pylib/gyp/generator/ninja.py | python | NinjaWriter.WriteMacInfoPlist | (self, partial_info_plist, bundle_depends) | Write build rules for bundle Info.plist files. | Write build rules for bundle Info.plist files. | [
"Write",
"build",
"rules",
"for",
"bundle",
"Info",
".",
"plist",
"files",
"."
] | def WriteMacInfoPlist(self, partial_info_plist, bundle_depends):
"""Write build rules for bundle Info.plist files."""
info_plist, out, defines, extra_env = gyp.xcode_emulation.GetMacInfoPlist(
generator_default_variables['PRODUCT_DIR'],
self.xcode_settings, self.GypPathToNinja)
if not info_p... | [
"def",
"WriteMacInfoPlist",
"(",
"self",
",",
"partial_info_plist",
",",
"bundle_depends",
")",
":",
"info_plist",
",",
"out",
",",
"defines",
",",
"extra_env",
"=",
"gyp",
".",
"xcode_emulation",
".",
"GetMacInfoPlist",
"(",
"generator_default_variables",
"[",
"'... | https://github.com/pmq20/node-packer/blob/12c46c6e44fbc14d9ee645ebd17d5296b324f7e0/lts/deps/npm/node_modules/node-gyp/gyp/pylib/gyp/generator/ninja.py#L832-L864 | ||
LiXizhi/NPLRuntime | a42720e5fe9a6960e0a9ce40bbbcd809192906be | Client/trunk/externals/assimp-4.0.0/port/PyAssimp/scripts/transformations.py | python | unit_vector | (data, axis=None, out=None) | Return ndarray normalized by length, i.e. eucledian norm, along axis.
>>> v0 = numpy.random.random(3)
>>> v1 = unit_vector(v0)
>>> numpy.allclose(v1, v0 / numpy.linalg.norm(v0))
True
>>> v0 = numpy.random.rand(5, 4, 3)
>>> v1 = unit_vector(v0, axis=-1)
>>> v2 = v0 / numpy.expand_dims(numpy.... | Return ndarray normalized by length, i.e. eucledian norm, along axis. | [
"Return",
"ndarray",
"normalized",
"by",
"length",
"i",
".",
"e",
".",
"eucledian",
"norm",
"along",
"axis",
"."
] | def unit_vector(data, axis=None, out=None):
"""Return ndarray normalized by length, i.e. eucledian norm, along axis.
>>> v0 = numpy.random.random(3)
>>> v1 = unit_vector(v0)
>>> numpy.allclose(v1, v0 / numpy.linalg.norm(v0))
True
>>> v0 = numpy.random.rand(5, 4, 3)
>>> v1 = unit_vector(v0, ... | [
"def",
"unit_vector",
"(",
"data",
",",
"axis",
"=",
"None",
",",
"out",
"=",
"None",
")",
":",
"if",
"out",
"is",
"None",
":",
"data",
"=",
"numpy",
".",
"array",
"(",
"data",
",",
"dtype",
"=",
"numpy",
".",
"float64",
",",
"copy",
"=",
"True",... | https://github.com/LiXizhi/NPLRuntime/blob/a42720e5fe9a6960e0a9ce40bbbcd809192906be/Client/trunk/externals/assimp-4.0.0/port/PyAssimp/scripts/transformations.py#L1574-L1615 | ||
miyosuda/TensorFlowAndroidDemo | 35903e0221aa5f109ea2dbef27f20b52e317f42d | jni-build/jni/include/tensorflow/python/ops/tensor_array_ops.py | python | TensorArray.write | (self, index, value, name=None) | Write `value` into index `index` of the TensorArray.
Args:
index: 0-D. int32 scalar with the index to write to.
value: N-D. Tensor of type `dtype`. The Tensor to write to this index.
name: A name for the operation (optional).
Returns:
A new TensorArray object with flow that ensures ... | Write `value` into index `index` of the TensorArray. | [
"Write",
"value",
"into",
"index",
"index",
"of",
"the",
"TensorArray",
"."
] | def write(self, index, value, name=None):
"""Write `value` into index `index` of the TensorArray.
Args:
index: 0-D. int32 scalar with the index to write to.
value: N-D. Tensor of type `dtype`. The Tensor to write to this index.
name: A name for the operation (optional).
Returns:
... | [
"def",
"write",
"(",
"self",
",",
"index",
",",
"value",
",",
"name",
"=",
"None",
")",
":",
"with",
"ops",
".",
"colocate_with",
"(",
"self",
".",
"_handle",
")",
":",
"flow_out",
"=",
"gen_data_flow_ops",
".",
"_tensor_array_write",
"(",
"handle",
"=",... | https://github.com/miyosuda/TensorFlowAndroidDemo/blob/35903e0221aa5f109ea2dbef27f20b52e317f42d/jni-build/jni/include/tensorflow/python/ops/tensor_array_ops.py#L196-L228 | ||
krishauser/Klampt | 972cc83ea5befac3f653c1ba20f80155768ad519 | Python/klampt/model/contact.py | python | ContactPoint.fromlist | (self,v) | Reads the values x,n, and kFriction from the 7-list v. | Reads the values x,n, and kFriction from the 7-list v. | [
"Reads",
"the",
"values",
"x",
"n",
"and",
"kFriction",
"from",
"the",
"7",
"-",
"list",
"v",
"."
] | def fromlist(self,v):
"""Reads the values x,n, and kFriction from the 7-list v."""
if len(v) != 7: raise ValueError("ContactPoint can only be converted from a 7-element list")
self.x = v[0:3]
self.n = v[3:6]
self.kFriction = v[6] | [
"def",
"fromlist",
"(",
"self",
",",
"v",
")",
":",
"if",
"len",
"(",
"v",
")",
"!=",
"7",
":",
"raise",
"ValueError",
"(",
"\"ContactPoint can only be converted from a 7-element list\"",
")",
"self",
".",
"x",
"=",
"v",
"[",
"0",
":",
"3",
"]",
"self",
... | https://github.com/krishauser/Klampt/blob/972cc83ea5befac3f653c1ba20f80155768ad519/Python/klampt/model/contact.py#L69-L74 | ||
openvinotoolkit/openvino | dedcbeafa8b84cccdc55ca64b8da516682b381c7 | tools/mo/openvino/tools/mo/middle/InterpolateSequenceToInterpolate.py | python | replace_sequence | (seq: List[Node], graph: Graph) | This function replaces a sequence of consecutive Interpolate layers with one Interpolate layer,
if modes of all nodes of a sequence are the same.
:param seq: sequence of Interpolate layers
:param graph: graph to which nodes of seq belong
:return: Nothing | This function replaces a sequence of consecutive Interpolate layers with one Interpolate layer,
if modes of all nodes of a sequence are the same.
:param seq: sequence of Interpolate layers
:param graph: graph to which nodes of seq belong
:return: Nothing | [
"This",
"function",
"replaces",
"a",
"sequence",
"of",
"consecutive",
"Interpolate",
"layers",
"with",
"one",
"Interpolate",
"layer",
"if",
"modes",
"of",
"all",
"nodes",
"of",
"a",
"sequence",
"are",
"the",
"same",
".",
":",
"param",
"seq",
":",
"sequence",... | def replace_sequence(seq: List[Node], graph: Graph):
"""
This function replaces a sequence of consecutive Interpolate layers with one Interpolate layer,
if modes of all nodes of a sequence are the same.
:param seq: sequence of Interpolate layers
:param graph: graph to which nodes of seq belong
:... | [
"def",
"replace_sequence",
"(",
"seq",
":",
"List",
"[",
"Node",
"]",
",",
"graph",
":",
"Graph",
")",
":",
"if",
"not",
"seq",
":",
"return",
"if",
"len",
"(",
"seq",
")",
"==",
"1",
":",
"return",
"modes",
"=",
"set",
"(",
"[",
"n",
".",
"mod... | https://github.com/openvinotoolkit/openvino/blob/dedcbeafa8b84cccdc55ca64b8da516682b381c7/tools/mo/openvino/tools/mo/middle/InterpolateSequenceToInterpolate.py#L176-L243 | ||
yuxng/DA-RNN | 77fbb50b4272514588a10a9f90b7d5f8d46974fb | lib/datasets/shapenet_single.py | python | shapenet_single._get_default_path | (self) | return os.path.join(datasets.ROOT_DIR, 'data', 'ShapeNetSingle') | Return the default path where KITTI is expected to be installed. | Return the default path where KITTI is expected to be installed. | [
"Return",
"the",
"default",
"path",
"where",
"KITTI",
"is",
"expected",
"to",
"be",
"installed",
"."
] | def _get_default_path(self):
"""
Return the default path where KITTI is expected to be installed.
"""
return os.path.join(datasets.ROOT_DIR, 'data', 'ShapeNetSingle') | [
"def",
"_get_default_path",
"(",
"self",
")",
":",
"return",
"os",
".",
"path",
".",
"join",
"(",
"datasets",
".",
"ROOT_DIR",
",",
"'data'",
",",
"'ShapeNetSingle'",
")"
] | https://github.com/yuxng/DA-RNN/blob/77fbb50b4272514588a10a9f90b7d5f8d46974fb/lib/datasets/shapenet_single.py#L130-L134 | |
H-uru/Plasma | c2140ea046e82e9c199e257a7f2e7edb42602871 | Scripts/Python/xSitAugment.py | python | xSitAugment.OnControlKeyEvent | (self,controlKey,activeFlag) | Control key events... anything we're interested in? | Control key events... anything we're interested in? | [
"Control",
"key",
"events",
"...",
"anything",
"we",
"re",
"interested",
"in?"
] | def OnControlKeyEvent(self,controlKey,activeFlag):
"Control key events... anything we're interested in?"
PtDebugPrint("Got controlKey event %d and its activeFlage is %d" % (controlKey,activeFlag))
if controlKey == PlasmaControlKeys.kKeyExitMode:
self.IQuitDialog() | [
"def",
"OnControlKeyEvent",
"(",
"self",
",",
"controlKey",
",",
"activeFlag",
")",
":",
"PtDebugPrint",
"(",
"\"Got controlKey event %d and its activeFlage is %d\"",
"%",
"(",
"controlKey",
",",
"activeFlag",
")",
")",
"if",
"controlKey",
"==",
"PlasmaControlKeys",
"... | https://github.com/H-uru/Plasma/blob/c2140ea046e82e9c199e257a7f2e7edb42602871/Scripts/Python/xSitAugment.py#L121-L125 | ||
hanpfei/chromium-net | 392cc1fa3a8f92f42e4071ab6e674d8e0482f83f | third_party/catapult/third_party/closure_linter/closure_linter/statetracker.py | python | DocComment.IsInvalidated | (self) | return self.invalidated | Test whether Invalidate() has been called. | Test whether Invalidate() has been called. | [
"Test",
"whether",
"Invalidate",
"()",
"has",
"been",
"called",
"."
] | def IsInvalidated(self):
"""Test whether Invalidate() has been called."""
return self.invalidated | [
"def",
"IsInvalidated",
"(",
"self",
")",
":",
"return",
"self",
".",
"invalidated"
] | https://github.com/hanpfei/chromium-net/blob/392cc1fa3a8f92f42e4071ab6e674d8e0482f83f/third_party/catapult/third_party/closure_linter/closure_linter/statetracker.py#L346-L348 | |
quantOS-org/DataCore | e2ef9bd2c22ee9e2845675b6435a14fa607f3551 | mdlink/deps/windows/protobuf-2.5.0/python/google/protobuf/message.py | python | Message.ListFields | (self) | Returns a list of (FieldDescriptor, value) tuples for all
fields in the message which are not empty. A singular field is non-empty
if HasField() would return true, and a repeated field is non-empty if
it contains at least one element. The fields are ordered by field
number | Returns a list of (FieldDescriptor, value) tuples for all
fields in the message which are not empty. A singular field is non-empty
if HasField() would return true, and a repeated field is non-empty if
it contains at least one element. The fields are ordered by field
number | [
"Returns",
"a",
"list",
"of",
"(",
"FieldDescriptor",
"value",
")",
"tuples",
"for",
"all",
"fields",
"in",
"the",
"message",
"which",
"are",
"not",
"empty",
".",
"A",
"singular",
"field",
"is",
"non",
"-",
"empty",
"if",
"HasField",
"()",
"would",
"retu... | def ListFields(self):
"""Returns a list of (FieldDescriptor, value) tuples for all
fields in the message which are not empty. A singular field is non-empty
if HasField() would return true, and a repeated field is non-empty if
it contains at least one element. The fields are ordered by field
number... | [
"def",
"ListFields",
"(",
"self",
")",
":",
"raise",
"NotImplementedError"
] | https://github.com/quantOS-org/DataCore/blob/e2ef9bd2c22ee9e2845675b6435a14fa607f3551/mdlink/deps/windows/protobuf-2.5.0/python/google/protobuf/message.py#L223-L229 | ||
cathywu/Sentiment-Analysis | eb501fd1375c0c3f3ab430f963255f1bb858e659 | PyML-0.7.9/PyML/containers/ker.py | python | expandKernel | (inKernelFile, referenceKernelFile, outKernelFile, **args) | Given a kernel matrix that might have missing entries, fill those as 0
on the basis of the patterns in a reference kernel (it is checked that
the reference kernel is sorted).
:Parameters:
- `inKernelFile` - input kernel file name
- `referenceKernelFile` - file name for the reference kernel
... | Given a kernel matrix that might have missing entries, fill those as 0
on the basis of the patterns in a reference kernel (it is checked that
the reference kernel is sorted).
:Parameters:
- `inKernelFile` - input kernel file name
- `referenceKernelFile` - file name for the reference kernel
... | [
"Given",
"a",
"kernel",
"matrix",
"that",
"might",
"have",
"missing",
"entries",
"fill",
"those",
"as",
"0",
"on",
"the",
"basis",
"of",
"the",
"patterns",
"in",
"a",
"reference",
"kernel",
"(",
"it",
"is",
"checked",
"that",
"the",
"reference",
"kernel",
... | def expandKernel(inKernelFile, referenceKernelFile, outKernelFile, **args) :
"""
Given a kernel matrix that might have missing entries, fill those as 0
on the basis of the patterns in a reference kernel (it is checked that
the reference kernel is sorted).
:Parameters:
- `inKernelFile` - ... | [
"def",
"expandKernel",
"(",
"inKernelFile",
",",
"referenceKernelFile",
",",
"outKernelFile",
",",
"*",
"*",
"args",
")",
":",
"if",
"'format'",
"in",
"args",
":",
"format",
"=",
"args",
"[",
"'format'",
"]",
"else",
":",
"format",
"=",
"'gist'",
"delim",
... | https://github.com/cathywu/Sentiment-Analysis/blob/eb501fd1375c0c3f3ab430f963255f1bb858e659/PyML-0.7.9/PyML/containers/ker.py#L448-L493 | ||
wlanjie/AndroidFFmpeg | 7baf9122f4b8e1c74e7baf4be5c422c7a5ba5aaf | tools/fdk-aac-build/x86/toolchain/lib/python2.7/lib-tk/Tkinter.py | python | Misc.winfo_reqheight | (self) | return getint(
self.tk.call('winfo', 'reqheight', self._w)) | Return requested height of this widget. | Return requested height of this widget. | [
"Return",
"requested",
"height",
"of",
"this",
"widget",
"."
] | def winfo_reqheight(self):
"""Return requested height of this widget."""
return getint(
self.tk.call('winfo', 'reqheight', self._w)) | [
"def",
"winfo_reqheight",
"(",
"self",
")",
":",
"return",
"getint",
"(",
"self",
".",
"tk",
".",
"call",
"(",
"'winfo'",
",",
"'reqheight'",
",",
"self",
".",
"_w",
")",
")"
] | https://github.com/wlanjie/AndroidFFmpeg/blob/7baf9122f4b8e1c74e7baf4be5c422c7a5ba5aaf/tools/fdk-aac-build/x86/toolchain/lib/python2.7/lib-tk/Tkinter.py#L825-L828 | |
ptrkrysik/gr-gsm | 2de47e28ce1fb9a518337bfc0add36c8e3cff5eb | python/receiver/chirpz.py | python | CZT.__call__ | (self, x, axis=-1) | return y.transpose(*trnsp) | Parameters:
----------
x: array
The signal to transform.
axis: int
Array dimension to operate over. The default is the final
dimension.
Returns:
-------
An array of the same dimensions as x, but with the length of the
transform... | Parameters:
----------
x: array
The signal to transform.
axis: int
Array dimension to operate over. The default is the final
dimension. | [
"Parameters",
":",
"----------",
"x",
":",
"array",
"The",
"signal",
"to",
"transform",
".",
"axis",
":",
"int",
"Array",
"dimension",
"to",
"operate",
"over",
".",
"The",
"default",
"is",
"the",
"final",
"dimension",
"."
] | def __call__(self, x, axis=-1):
"""
Parameters:
----------
x: array
The signal to transform.
axis: int
Array dimension to operate over. The default is the final
dimension.
Returns:
-------
An array of the same dimensions ... | [
"def",
"__call__",
"(",
"self",
",",
"x",
",",
"axis",
"=",
"-",
"1",
")",
":",
"x",
"=",
"np",
".",
"asarray",
"(",
"x",
")",
"if",
"x",
".",
"shape",
"[",
"axis",
"]",
"!=",
"self",
".",
"n",
":",
"raise",
"ValueError",
"(",
"\"CZT defined fo... | https://github.com/ptrkrysik/gr-gsm/blob/2de47e28ce1fb9a518337bfc0add36c8e3cff5eb/python/receiver/chirpz.py#L96-L123 | |
catboost/catboost | 167f64f237114a4d10b2b4ee42adb4569137debe | contrib/python/scipy/scipy/stats/_multivariate.py | python | matrix_normal_frozen.__init__ | (self, mean=None, rowcov=1, colcov=1, seed=None) | Create a frozen matrix normal distribution.
Parameters
----------
%(_matnorm_doc_default_callparams)s
seed : None or int or np.random.RandomState instance, optional
If int or RandomState, use it for drawing the random variates.
If None (or np.random), the global ... | Create a frozen matrix normal distribution. | [
"Create",
"a",
"frozen",
"matrix",
"normal",
"distribution",
"."
] | def __init__(self, mean=None, rowcov=1, colcov=1, seed=None):
"""
Create a frozen matrix normal distribution.
Parameters
----------
%(_matnorm_doc_default_callparams)s
seed : None or int or np.random.RandomState instance, optional
If int or RandomState, use i... | [
"def",
"__init__",
"(",
"self",
",",
"mean",
"=",
"None",
",",
"rowcov",
"=",
"1",
",",
"colcov",
"=",
"1",
",",
"seed",
"=",
"None",
")",
":",
"self",
".",
"_dist",
"=",
"matrix_normal_gen",
"(",
"seed",
")",
"self",
".",
"dims",
",",
"self",
".... | https://github.com/catboost/catboost/blob/167f64f237114a4d10b2b4ee42adb4569137debe/contrib/python/scipy/scipy/stats/_multivariate.py#L994-L1024 | ||
taichi-dev/taichi | 973c04d6ba40f34e9e3bd5a28ae0ee0802f136a6 | python/taichi/_snode/fields_builder.py | python | FieldsBuilder.finalized_roots | (cls) | return roots_ptr | Gets all the roots of the finalized SNodeTree.
Returns:
A list of the roots of the finalized SNodeTree. | Gets all the roots of the finalized SNodeTree. | [
"Gets",
"all",
"the",
"roots",
"of",
"the",
"finalized",
"SNodeTree",
"."
] | def finalized_roots(cls):
"""Gets all the roots of the finalized SNodeTree.
Returns:
A list of the roots of the finalized SNodeTree.
"""
roots_ptr = []
size = impl.get_runtime().prog.get_snode_tree_size()
for i in range(size):
res = impl.get_runti... | [
"def",
"finalized_roots",
"(",
"cls",
")",
":",
"roots_ptr",
"=",
"[",
"]",
"size",
"=",
"impl",
".",
"get_runtime",
"(",
")",
".",
"prog",
".",
"get_snode_tree_size",
"(",
")",
"for",
"i",
"in",
"range",
"(",
"size",
")",
":",
"res",
"=",
"impl",
... | https://github.com/taichi-dev/taichi/blob/973c04d6ba40f34e9e3bd5a28ae0ee0802f136a6/python/taichi/_snode/fields_builder.py#L44-L55 | |
sonyxperiadev/WebGL | 0299b38196f78c6d5f74bcf6fa312a3daee6de60 | Tools/Scripts/webkitpy/thirdparty/simplejson/encoder.py | python | JSONEncoder.encode | (self, o) | return ''.join(chunks) | Return a JSON string representation of a Python data structure.
>>> JSONEncoder().encode({"foo": ["bar", "baz"]})
'{"foo":["bar", "baz"]}' | Return a JSON string representation of a Python data structure. | [
"Return",
"a",
"JSON",
"string",
"representation",
"of",
"a",
"Python",
"data",
"structure",
"."
] | def encode(self, o):
"""
Return a JSON string representation of a Python data structure.
>>> JSONEncoder().encode({"foo": ["bar", "baz"]})
'{"foo":["bar", "baz"]}'
"""
# This is for extremely simple cases and benchmarks...
if isinstance(o, basestring):
... | [
"def",
"encode",
"(",
"self",
",",
"o",
")",
":",
"# This is for extremely simple cases and benchmarks...",
"if",
"isinstance",
"(",
"o",
",",
"basestring",
")",
":",
"if",
"isinstance",
"(",
"o",
",",
"str",
")",
":",
"_encoding",
"=",
"self",
".",
"encodin... | https://github.com/sonyxperiadev/WebGL/blob/0299b38196f78c6d5f74bcf6fa312a3daee6de60/Tools/Scripts/webkitpy/thirdparty/simplejson/encoder.py#L334-L353 | |
catboost/catboost | 167f64f237114a4d10b2b4ee42adb4569137debe | contrib/python/pandas/py3/pandas/io/pytables.py | python | GenericFixed.validate_read | (self, columns, where) | raise if any keywords are passed which are not-None | raise if any keywords are passed which are not-None | [
"raise",
"if",
"any",
"keywords",
"are",
"passed",
"which",
"are",
"not",
"-",
"None"
] | def validate_read(self, columns, where):
"""
raise if any keywords are passed which are not-None
"""
if columns is not None:
raise TypeError(
"cannot pass a column specification when reading "
"a Fixed format store. this store must be selected ... | [
"def",
"validate_read",
"(",
"self",
",",
"columns",
",",
"where",
")",
":",
"if",
"columns",
"is",
"not",
"None",
":",
"raise",
"TypeError",
"(",
"\"cannot pass a column specification when reading \"",
"\"a Fixed format store. this store must be selected in its entirety\"",
... | https://github.com/catboost/catboost/blob/167f64f237114a4d10b2b4ee42adb4569137debe/contrib/python/pandas/py3/pandas/io/pytables.py#L2820-L2833 | ||
wxWidgets/wxPython-Classic | 19571e1ae65f1ac445f5491474121998c97a1bf0 | wx/lib/agw/flatmenu.py | python | FlatMenu.DrawSelection | (self, dc, oldSelection=-1) | Redraws the menu.
:param `dc`: an instance of :class:`DC`;
:param integer `oldSelection`: if non-negative, the index representing the previous selected
menu item. | Redraws the menu. | [
"Redraws",
"the",
"menu",
"."
] | def DrawSelection(self, dc, oldSelection=-1):
"""
Redraws the menu.
:param `dc`: an instance of :class:`DC`;
:param integer `oldSelection`: if non-negative, the index representing the previous selected
menu item.
"""
self.Refresh() | [
"def",
"DrawSelection",
"(",
"self",
",",
"dc",
",",
"oldSelection",
"=",
"-",
"1",
")",
":",
"self",
".",
"Refresh",
"(",
")"
] | https://github.com/wxWidgets/wxPython-Classic/blob/19571e1ae65f1ac445f5491474121998c97a1bf0/wx/lib/agw/flatmenu.py#L5803-L5812 | ||
stellar-deprecated/stellard | 67eabb2217bdfa9a6ea317f62338fb6bca458c90 | src/protobuf/python/google/protobuf/internal/encoder.py | python | MessageEncoder | (field_number, is_repeated, is_packed) | Returns an encoder for a message field. | Returns an encoder for a message field. | [
"Returns",
"an",
"encoder",
"for",
"a",
"message",
"field",
"."
] | def MessageEncoder(field_number, is_repeated, is_packed):
"""Returns an encoder for a message field."""
tag = TagBytes(field_number, wire_format.WIRETYPE_LENGTH_DELIMITED)
local_EncodeVarint = _EncodeVarint
assert not is_packed
if is_repeated:
def EncodeRepeatedField(write, value):
for element in v... | [
"def",
"MessageEncoder",
"(",
"field_number",
",",
"is_repeated",
",",
"is_packed",
")",
":",
"tag",
"=",
"TagBytes",
"(",
"field_number",
",",
"wire_format",
".",
"WIRETYPE_LENGTH_DELIMITED",
")",
"local_EncodeVarint",
"=",
"_EncodeVarint",
"assert",
"not",
"is_pac... | https://github.com/stellar-deprecated/stellard/blob/67eabb2217bdfa9a6ea317f62338fb6bca458c90/src/protobuf/python/google/protobuf/internal/encoder.py#L719-L737 | ||
pytorch/pytorch | 7176c92687d3cc847cc046bf002269c6949a21c2 | caffe2/experiments/python/net_construct_bench.py | python | AddMomentumParameterUpdate | (train_model, LR) | Add the momentum-SGD update. | Add the momentum-SGD update. | [
"Add",
"the",
"momentum",
"-",
"SGD",
"update",
"."
] | def AddMomentumParameterUpdate(train_model, LR):
'''
Add the momentum-SGD update.
'''
params = train_model.GetParams()
assert(len(params) > 0)
ONE = train_model.param_init_net.ConstantFill(
[], "ONE", shape=[1], value=1.0,
)
NEGONE = train_model.param_init_net.ConstantFill(
... | [
"def",
"AddMomentumParameterUpdate",
"(",
"train_model",
",",
"LR",
")",
":",
"params",
"=",
"train_model",
".",
"GetParams",
"(",
")",
"assert",
"(",
"len",
"(",
"params",
")",
">",
"0",
")",
"ONE",
"=",
"train_model",
".",
"param_init_net",
".",
"Constan... | https://github.com/pytorch/pytorch/blob/7176c92687d3cc847cc046bf002269c6949a21c2/caffe2/experiments/python/net_construct_bench.py#L43-L74 | ||
aws/lumberyard | f85344403c1c2e77ec8c75deb2c116e97b713217 | dev/Tools/Python/3.7.10/mac/Python.framework/Versions/3.7/lib/python3.7/site-packages/pip/_vendor/urllib3/packages/six.py | python | python_2_unicode_compatible | (klass) | return klass | A decorator that defines __unicode__ and __str__ methods under Python 2.
Under Python 3 it does nothing.
To support Python 2 and 3 with a single code base, define a __str__ method
returning text and apply this decorator to the class. | A decorator that defines __unicode__ and __str__ methods under Python 2.
Under Python 3 it does nothing. | [
"A",
"decorator",
"that",
"defines",
"__unicode__",
"and",
"__str__",
"methods",
"under",
"Python",
"2",
".",
"Under",
"Python",
"3",
"it",
"does",
"nothing",
"."
] | def python_2_unicode_compatible(klass):
"""
A decorator that defines __unicode__ and __str__ methods under Python 2.
Under Python 3 it does nothing.
To support Python 2 and 3 with a single code base, define a __str__ method
returning text and apply this decorator to the class.
"""
if PY2:
... | [
"def",
"python_2_unicode_compatible",
"(",
"klass",
")",
":",
"if",
"PY2",
":",
"if",
"\"__str__\"",
"not",
"in",
"klass",
".",
"__dict__",
":",
"raise",
"ValueError",
"(",
"\"@python_2_unicode_compatible cannot be applied \"",
"\"to %s because it doesn't define __str__().\... | https://github.com/aws/lumberyard/blob/f85344403c1c2e77ec8c75deb2c116e97b713217/dev/Tools/Python/3.7.10/mac/Python.framework/Versions/3.7/lib/python3.7/site-packages/pip/_vendor/urllib3/packages/six.py#L978-L994 | |
pmq20/node-packer | 12c46c6e44fbc14d9ee645ebd17d5296b324f7e0 | current/deps/v8/tools/grokdump.py | python | InspectionShell.do_search | (self, word) | Search for a given word in available memory regions.
The given word is expanded to full pointer size and searched at aligned
as well as un-aligned memory locations. Use 'sa' to search aligned locations
only. | Search for a given word in available memory regions. | [
"Search",
"for",
"a",
"given",
"word",
"in",
"available",
"memory",
"regions",
"."
] | def do_search(self, word):
"""
Search for a given word in available memory regions.
The given word is expanded to full pointer size and searched at aligned
as well as un-aligned memory locations. Use 'sa' to search aligned locations
only.
"""
try:
word = self.ParseAddressExpr(word... | [
"def",
"do_search",
"(",
"self",
",",
"word",
")",
":",
"try",
":",
"word",
"=",
"self",
".",
"ParseAddressExpr",
"(",
"word",
")",
"except",
"ValueError",
":",
"print",
"(",
"\"Malformed word, prefix with '0x' to use hexadecimal format.\"",
")",
"return",
"print"... | https://github.com/pmq20/node-packer/blob/12c46c6e44fbc14d9ee645ebd17d5296b324f7e0/current/deps/v8/tools/grokdump.py#L3714-L3729 | ||
Z3Prover/z3 | d745d03afdfdf638d66093e2bfbacaf87187f35b | src/api/python/z3/z3.py | python | If | (a, b, c, ctx=None) | Create a Z3 if-then-else expression.
>>> x = Int('x')
>>> y = Int('y')
>>> max = If(x > y, x, y)
>>> max
If(x > y, x, y)
>>> simplify(max)
If(x <= y, y, x) | Create a Z3 if-then-else expression. | [
"Create",
"a",
"Z3",
"if",
"-",
"then",
"-",
"else",
"expression",
"."
] | def If(a, b, c, ctx=None):
"""Create a Z3 if-then-else expression.
>>> x = Int('x')
>>> y = Int('y')
>>> max = If(x > y, x, y)
>>> max
If(x > y, x, y)
>>> simplify(max)
If(x <= y, y, x)
"""
if isinstance(a, Probe) or isinstance(b, Tactic) or isinstance(c, Tactic):
return... | [
"def",
"If",
"(",
"a",
",",
"b",
",",
"c",
",",
"ctx",
"=",
"None",
")",
":",
"if",
"isinstance",
"(",
"a",
",",
"Probe",
")",
"or",
"isinstance",
"(",
"b",
",",
"Tactic",
")",
"or",
"isinstance",
"(",
"c",
",",
"Tactic",
")",
":",
"return",
... | https://github.com/Z3Prover/z3/blob/d745d03afdfdf638d66093e2bfbacaf87187f35b/src/api/python/z3/z3.py#L1353-L1373 | ||
infinit/memo | 3a8394d0f647efe03ccb8bfe885a7279cb8be8a6 | elle/drake/src/drake/go/__init__.py | python | Toolkit.__init__ | (self,
tk = None,
path = None,
root = None,
os = None,
arch = None,
cxx_toolkit = drake.cxx.Toolkit()) | Create a toolkit or clone an existing one.
:param tk: The toolkit to clone. If specified, other arguments must be None
:type tk: Toolkit
:param path: The home of your go environment (override GOPATH).
:type path: str
:param root: The root of your go installation (override GOROOT).
:type root: s... | Create a toolkit or clone an existing one. | [
"Create",
"a",
"toolkit",
"or",
"clone",
"an",
"existing",
"one",
"."
] | def __init__(self,
tk = None,
path = None,
root = None,
os = None,
arch = None,
cxx_toolkit = drake.cxx.Toolkit()):
"""
Create a toolkit or clone an existing one.
:param tk: The toolkit to clone. If specified, other a... | [
"def",
"__init__",
"(",
"self",
",",
"tk",
"=",
"None",
",",
"path",
"=",
"None",
",",
"root",
"=",
"None",
",",
"os",
"=",
"None",
",",
"arch",
"=",
"None",
",",
"cxx_toolkit",
"=",
"drake",
".",
"cxx",
".",
"Toolkit",
"(",
")",
")",
":",
"if"... | https://github.com/infinit/memo/blob/3a8394d0f647efe03ccb8bfe885a7279cb8be8a6/elle/drake/src/drake/go/__init__.py#L168-L221 | ||
hanpfei/chromium-net | 392cc1fa3a8f92f42e4071ab6e674d8e0482f83f | tools/perf/metrics/speedindex.py | python | SpeedIndexImpl.CalculateSpeedIndex | (self, tab) | return int(speed_index) | Calculate the speed index.
The speed index number conceptually represents the number of milliseconds
that the page was "visually incomplete". If the page were 0% complete for
1000 ms, then the score would be 1000; if it were 0% complete for 100 ms
then 90% complete (ie 10% incomplete) for 900 ms, then ... | Calculate the speed index. | [
"Calculate",
"the",
"speed",
"index",
"."
] | def CalculateSpeedIndex(self, tab):
"""Calculate the speed index.
The speed index number conceptually represents the number of milliseconds
that the page was "visually incomplete". If the page were 0% complete for
1000 ms, then the score would be 1000; if it were 0% complete for 100 ms
then 90% com... | [
"def",
"CalculateSpeedIndex",
"(",
"self",
",",
"tab",
")",
":",
"time_completeness_list",
"=",
"self",
".",
"GetTimeCompletenessList",
"(",
"tab",
")",
"prev_completeness",
"=",
"0.0",
"speed_index",
"=",
"0.0",
"prev_time",
"=",
"time_completeness_list",
"[",
"0... | https://github.com/hanpfei/chromium-net/blob/392cc1fa3a8f92f42e4071ab6e674d8e0482f83f/tools/perf/metrics/speedindex.py#L116-L141 | |
catboost/catboost | 167f64f237114a4d10b2b4ee42adb4569137debe | contrib/python/scipy/py3/scipy/stats/stats.py | python | tvar | (a, limits=None, inclusive=(True, True), axis=0, ddof=1) | return np.ma.var(am, ddof=ddof, axis=axis) | Compute the trimmed variance.
This function computes the sample variance of an array of values,
while ignoring values which are outside of given `limits`.
Parameters
----------
a : array_like
Array of values.
limits : None or (lower limit, upper limit), optional
Values in the i... | Compute the trimmed variance. | [
"Compute",
"the",
"trimmed",
"variance",
"."
] | def tvar(a, limits=None, inclusive=(True, True), axis=0, ddof=1):
"""
Compute the trimmed variance.
This function computes the sample variance of an array of values,
while ignoring values which are outside of given `limits`.
Parameters
----------
a : array_like
Array of values.
... | [
"def",
"tvar",
"(",
"a",
",",
"limits",
"=",
"None",
",",
"inclusive",
"=",
"(",
"True",
",",
"True",
")",
",",
"axis",
"=",
"0",
",",
"ddof",
"=",
"1",
")",
":",
"a",
"=",
"asarray",
"(",
"a",
")",
"a",
"=",
"a",
".",
"astype",
"(",
"float... | https://github.com/catboost/catboost/blob/167f64f237114a4d10b2b4ee42adb4569137debe/contrib/python/scipy/py3/scipy/stats/stats.py#L574-L626 | |
wxWidgets/wxPython-Classic | 19571e1ae65f1ac445f5491474121998c97a1bf0 | src/gtk/_misc.py | python | BusyCursor.__init__ | (self, *args, **kwargs) | __init__(self, Cursor cursor=wxHOURGLASS_CURSOR) -> BusyCursor | __init__(self, Cursor cursor=wxHOURGLASS_CURSOR) -> BusyCursor | [
"__init__",
"(",
"self",
"Cursor",
"cursor",
"=",
"wxHOURGLASS_CURSOR",
")",
"-",
">",
"BusyCursor"
] | def __init__(self, *args, **kwargs):
"""__init__(self, Cursor cursor=wxHOURGLASS_CURSOR) -> BusyCursor"""
_misc_.BusyCursor_swiginit(self,_misc_.new_BusyCursor(*args, **kwargs)) | [
"def",
"__init__",
"(",
"self",
",",
"*",
"args",
",",
"*",
"*",
"kwargs",
")",
":",
"_misc_",
".",
"BusyCursor_swiginit",
"(",
"self",
",",
"_misc_",
".",
"new_BusyCursor",
"(",
"*",
"args",
",",
"*",
"*",
"kwargs",
")",
")"
] | https://github.com/wxWidgets/wxPython-Classic/blob/19571e1ae65f1ac445f5491474121998c97a1bf0/src/gtk/_misc.py#L826-L828 | ||
aws/lumberyard | f85344403c1c2e77ec8c75deb2c116e97b713217 | dev/Gems/CloudGemMetric/v1/AWS/common-code/Lib/numba/transforms.py | python | _cfg_nodes_in_region | (cfg, region_begin, region_end) | return region_nodes | Find the set of CFG nodes that are in the given region | Find the set of CFG nodes that are in the given region | [
"Find",
"the",
"set",
"of",
"CFG",
"nodes",
"that",
"are",
"in",
"the",
"given",
"region"
] | def _cfg_nodes_in_region(cfg, region_begin, region_end):
"""Find the set of CFG nodes that are in the given region
"""
region_nodes = set()
stack = [region_begin]
while stack:
tos = stack.pop()
succs, _ = zip(*cfg.successors(tos))
nodes = set([node for node in succs
... | [
"def",
"_cfg_nodes_in_region",
"(",
"cfg",
",",
"region_begin",
",",
"region_end",
")",
":",
"region_nodes",
"=",
"set",
"(",
")",
"stack",
"=",
"[",
"region_begin",
"]",
"while",
"stack",
":",
"tos",
"=",
"stack",
".",
"pop",
"(",
")",
"succs",
",",
"... | https://github.com/aws/lumberyard/blob/f85344403c1c2e77ec8c75deb2c116e97b713217/dev/Gems/CloudGemMetric/v1/AWS/common-code/Lib/numba/transforms.py#L460-L474 | |
wxWidgets/wxPython-Classic | 19571e1ae65f1ac445f5491474121998c97a1bf0 | src/gtk/_core.py | python | WithImages.AssignImageList | (*args, **kwargs) | return _core_.WithImages_AssignImageList(*args, **kwargs) | AssignImageList(self, ImageList imageList) | AssignImageList(self, ImageList imageList) | [
"AssignImageList",
"(",
"self",
"ImageList",
"imageList",
")"
] | def AssignImageList(*args, **kwargs):
"""AssignImageList(self, ImageList imageList)"""
return _core_.WithImages_AssignImageList(*args, **kwargs) | [
"def",
"AssignImageList",
"(",
"*",
"args",
",",
"*",
"*",
"kwargs",
")",
":",
"return",
"_core_",
".",
"WithImages_AssignImageList",
"(",
"*",
"args",
",",
"*",
"*",
"kwargs",
")"
] | https://github.com/wxWidgets/wxPython-Classic/blob/19571e1ae65f1ac445f5491474121998c97a1bf0/src/gtk/_core.py#L13502-L13504 | |
pytorch/pytorch | 7176c92687d3cc847cc046bf002269c6949a21c2 | benchmarks/functional_autograd_benchmark/torchvision_models.py | python | accuracy | (output, target, topk=(1,)) | return res | Computes the precision@k for the specified values of k | Computes the precision | [
"Computes",
"the",
"precision"
] | def accuracy(output, target, topk=(1,)):
"""Computes the precision@k for the specified values of k"""
if target.numel() == 0:
return [torch.zeros([], device=output.device)]
maxk = max(topk)
batch_size = target.size(0)
_, pred = output.topk(maxk, 1, True, True)
pred = pred.t()
correc... | [
"def",
"accuracy",
"(",
"output",
",",
"target",
",",
"topk",
"=",
"(",
"1",
",",
")",
")",
":",
"if",
"target",
".",
"numel",
"(",
")",
"==",
"0",
":",
"return",
"[",
"torch",
".",
"zeros",
"(",
"[",
"]",
",",
"device",
"=",
"output",
".",
"... | https://github.com/pytorch/pytorch/blob/7176c92687d3cc847cc046bf002269c6949a21c2/benchmarks/functional_autograd_benchmark/torchvision_models.py#L544-L559 | |
Yaafe/Yaafe | f5ed847bdbf540b47e8fe1980dddfb5509ae7f9d | src_python/yaafelib/dataflow.py | python | DataFlow.loads | (self, buf) | return False | Build DataFlow from buf read from a :ref:`dataflow file
<dataflow-file>`.
:param buf: buffer read from a dataflow file
:type buf: string
:return: True on success, False on fail. | Build DataFlow from buf read from a :ref:`dataflow file
<dataflow-file>`. | [
"Build",
"DataFlow",
"from",
"buf",
"read",
"from",
"a",
":",
"ref",
":",
"dataflow",
"file",
"<dataflow",
"-",
"file",
">",
"."
] | def loads(self, buf):
"""
Build DataFlow from buf read from a :ref:`dataflow file
<dataflow-file>`.
:param buf: buffer read from a dataflow file
:type buf: string
:return: True on success, False on fail.
"""
if yc.dataflow_loads(self.p... | [
"def",
"loads",
"(",
"self",
",",
"buf",
")",
":",
"if",
"yc",
".",
"dataflow_loads",
"(",
"self",
".",
"ptr",
",",
"to_char",
"(",
"buf",
")",
")",
":",
"self",
".",
"update_state",
"(",
")",
"return",
"True",
"return",
"False"
] | https://github.com/Yaafe/Yaafe/blob/f5ed847bdbf540b47e8fe1980dddfb5509ae7f9d/src_python/yaafelib/dataflow.py#L116-L128 | |
gnuradio/gnuradio | 09c3c4fa4bfb1a02caac74cb5334dfe065391e3b | gr-utils/modtool/templates/gr-newmod/docs/doxygen/other/doxypy.py | python | Doxypy.__docstringSummaryToBrief | (self, line) | Adds \\brief to the docstrings summary line.
A \\brief is prepended, provided no other doxygen command is at the
start of the line. | Adds \\brief to the docstrings summary line. | [
"Adds",
"\\\\",
"brief",
"to",
"the",
"docstrings",
"summary",
"line",
"."
] | def __docstringSummaryToBrief(self, line):
"""Adds \\brief to the docstrings summary line.
A \\brief is prepended, provided no other doxygen command is at the
start of the line.
"""
stripped = line.strip()
if stripped and not stripped[0] in ('@', '\\'):
retur... | [
"def",
"__docstringSummaryToBrief",
"(",
"self",
",",
"line",
")",
":",
"stripped",
"=",
"line",
".",
"strip",
"(",
")",
"if",
"stripped",
"and",
"not",
"stripped",
"[",
"0",
"]",
"in",
"(",
"'@'",
",",
"'\\\\'",
")",
":",
"return",
"\"\\\\brief \"",
"... | https://github.com/gnuradio/gnuradio/blob/09c3c4fa4bfb1a02caac74cb5334dfe065391e3b/gr-utils/modtool/templates/gr-newmod/docs/doxygen/other/doxypy.py#L227-L237 | ||
wxWidgets/wxPython-Classic | 19571e1ae65f1ac445f5491474121998c97a1bf0 | src/msw/_misc.py | python | SaveFileSelector | (*args, **kwargs) | return _misc_.SaveFileSelector(*args, **kwargs) | SaveFileSelector(String what, String extension, String default_name=EmptyString,
Window parent=None) -> String | SaveFileSelector(String what, String extension, String default_name=EmptyString,
Window parent=None) -> String | [
"SaveFileSelector",
"(",
"String",
"what",
"String",
"extension",
"String",
"default_name",
"=",
"EmptyString",
"Window",
"parent",
"=",
"None",
")",
"-",
">",
"String"
] | def SaveFileSelector(*args, **kwargs):
"""
SaveFileSelector(String what, String extension, String default_name=EmptyString,
Window parent=None) -> String
"""
return _misc_.SaveFileSelector(*args, **kwargs) | [
"def",
"SaveFileSelector",
"(",
"*",
"args",
",",
"*",
"*",
"kwargs",
")",
":",
"return",
"_misc_",
".",
"SaveFileSelector",
"(",
"*",
"args",
",",
"*",
"*",
"kwargs",
")"
] | https://github.com/wxWidgets/wxPython-Classic/blob/19571e1ae65f1ac445f5491474121998c97a1bf0/src/msw/_misc.py#L439-L444 | |
wxWidgets/wxPython-Classic | 19571e1ae65f1ac445f5491474121998c97a1bf0 | src/msw/propgrid.py | python | PGProperty.GetMainParent | (*args, **kwargs) | return _propgrid.PGProperty_GetMainParent(*args, **kwargs) | GetMainParent(self) -> PGProperty | GetMainParent(self) -> PGProperty | [
"GetMainParent",
"(",
"self",
")",
"-",
">",
"PGProperty"
] | def GetMainParent(*args, **kwargs):
"""GetMainParent(self) -> PGProperty"""
return _propgrid.PGProperty_GetMainParent(*args, **kwargs) | [
"def",
"GetMainParent",
"(",
"*",
"args",
",",
"*",
"*",
"kwargs",
")",
":",
"return",
"_propgrid",
".",
"PGProperty_GetMainParent",
"(",
"*",
"args",
",",
"*",
"*",
"kwargs",
")"
] | https://github.com/wxWidgets/wxPython-Classic/blob/19571e1ae65f1ac445f5491474121998c97a1bf0/src/msw/propgrid.py#L523-L525 | |
hanpfei/chromium-net | 392cc1fa3a8f92f42e4071ab6e674d8e0482f83f | third_party/catapult/third_party/gsutil/third_party/boto/boto/cognito/identity/__init__.py | python | regions | () | return get_regions('cognito-identity',
connection_cls=CognitoIdentityConnection) | Get all available regions for the Amazon Cognito Identity service.
:rtype: list
:return: A list of :class:`boto.regioninfo.RegionInfo` | Get all available regions for the Amazon Cognito Identity service. | [
"Get",
"all",
"available",
"regions",
"for",
"the",
"Amazon",
"Cognito",
"Identity",
"service",
"."
] | def regions():
"""
Get all available regions for the Amazon Cognito Identity service.
:rtype: list
:return: A list of :class:`boto.regioninfo.RegionInfo`
"""
from boto.cognito.identity.layer1 import CognitoIdentityConnection
return get_regions('cognito-identity',
conn... | [
"def",
"regions",
"(",
")",
":",
"from",
"boto",
".",
"cognito",
".",
"identity",
".",
"layer1",
"import",
"CognitoIdentityConnection",
"return",
"get_regions",
"(",
"'cognito-identity'",
",",
"connection_cls",
"=",
"CognitoIdentityConnection",
")"
] | https://github.com/hanpfei/chromium-net/blob/392cc1fa3a8f92f42e4071ab6e674d8e0482f83f/third_party/catapult/third_party/gsutil/third_party/boto/boto/cognito/identity/__init__.py#L26-L35 | |
hpi-xnor/BMXNet-v2 | af2b1859eafc5c721b1397cef02f946aaf2ce20d | python/mxnet/module/module.py | python | Module._sync_params_from_devices | (self) | Synchronizes parameters from devices to CPU. This function should be called after
calling `update` that updates the parameters on the devices, before one can read the
latest parameters from ``self._arg_params`` and ``self._aux_params``.
For row_sparse parameters on devices, ther are pulled from... | Synchronizes parameters from devices to CPU. This function should be called after
calling `update` that updates the parameters on the devices, before one can read the
latest parameters from ``self._arg_params`` and ``self._aux_params``. | [
"Synchronizes",
"parameters",
"from",
"devices",
"to",
"CPU",
".",
"This",
"function",
"should",
"be",
"called",
"after",
"calling",
"update",
"that",
"updates",
"the",
"parameters",
"on",
"the",
"devices",
"before",
"one",
"can",
"read",
"the",
"latest",
"par... | def _sync_params_from_devices(self):
"""Synchronizes parameters from devices to CPU. This function should be called after
calling `update` that updates the parameters on the devices, before one can read the
latest parameters from ``self._arg_params`` and ``self._aux_params``.
For row_sp... | [
"def",
"_sync_params_from_devices",
"(",
"self",
")",
":",
"self",
".",
"_exec_group",
".",
"get_params",
"(",
"self",
".",
"_arg_params",
",",
"self",
".",
"_aux_params",
")",
"if",
"self",
".",
"_kvstore",
"and",
"self",
".",
"_update_on_kvstore",
":",
"fo... | https://github.com/hpi-xnor/BMXNet-v2/blob/af2b1859eafc5c721b1397cef02f946aaf2ce20d/python/mxnet/module/module.py#L777-L791 | ||
apache/incubator-mxnet | f03fb23f1d103fec9541b5ae59ee06b1734a51d9 | python/mxnet/model.py | python | _update_params_on_kvstore | (param_arrays, grad_arrays, kvstore, param_names) | Perform update of param_arrays from grad_arrays on kvstore. | Perform update of param_arrays from grad_arrays on kvstore. | [
"Perform",
"update",
"of",
"param_arrays",
"from",
"grad_arrays",
"on",
"kvstore",
"."
] | def _update_params_on_kvstore(param_arrays, grad_arrays, kvstore, param_names):
"""Perform update of param_arrays from grad_arrays on kvstore."""
for index, pair in enumerate(zip(param_arrays, grad_arrays)):
arg_list, grad_list = pair
if grad_list[0] is None:
continue
name = ... | [
"def",
"_update_params_on_kvstore",
"(",
"param_arrays",
",",
"grad_arrays",
",",
"kvstore",
",",
"param_names",
")",
":",
"for",
"index",
",",
"pair",
"in",
"enumerate",
"(",
"zip",
"(",
"param_arrays",
",",
"grad_arrays",
")",
")",
":",
"arg_list",
",",
"g... | https://github.com/apache/incubator-mxnet/blob/f03fb23f1d103fec9541b5ae59ee06b1734a51d9/python/mxnet/model.py#L144-L157 | ||
wxWidgets/wxPython-Classic | 19571e1ae65f1ac445f5491474121998c97a1bf0 | src/msw/richtext.py | python | RichTextCtrl.CalcScrolledPosition | (*args) | return _richtext.RichTextCtrl_CalcScrolledPosition(*args) | CalcScrolledPosition(self, Point pt) -> Point
CalcScrolledPosition(int x, int y) -> (sx, sy)
Translate between scrolled and unscrolled coordinates. | CalcScrolledPosition(self, Point pt) -> Point
CalcScrolledPosition(int x, int y) -> (sx, sy) | [
"CalcScrolledPosition",
"(",
"self",
"Point",
"pt",
")",
"-",
">",
"Point",
"CalcScrolledPosition",
"(",
"int",
"x",
"int",
"y",
")",
"-",
">",
"(",
"sx",
"sy",
")"
] | def CalcScrolledPosition(*args):
"""
CalcScrolledPosition(self, Point pt) -> Point
CalcScrolledPosition(int x, int y) -> (sx, sy)
Translate between scrolled and unscrolled coordinates.
"""
return _richtext.RichTextCtrl_CalcScrolledPosition(*args) | [
"def",
"CalcScrolledPosition",
"(",
"*",
"args",
")",
":",
"return",
"_richtext",
".",
"RichTextCtrl_CalcScrolledPosition",
"(",
"*",
"args",
")"
] | https://github.com/wxWidgets/wxPython-Classic/blob/19571e1ae65f1ac445f5491474121998c97a1bf0/src/msw/richtext.py#L4180-L4187 | |
Tencent/ncnn | 6f824c57a1f8ee6dd3902fb13bef947cf4e6a73f | python/ncnn/utils/functional.py | python | nms | (boxes, scores, iou_threshold, top_k=-1, candidate_size=200) | return picked | Args:
box_scores (N, 5): boxes in corner-form(x1, y1, x2, y2) and probabilities.
iou_threshold: intersection over union threshold.
top_k: keep top_k results. If k <= 0, keep all the results.
candidate_size: only consider the candidates with the highest scores.
Returns:
picke... | [] | def nms(boxes, scores, iou_threshold, top_k=-1, candidate_size=200):
"""
Args:
box_scores (N, 5): boxes in corner-form(x1, y1, x2, y2) and probabilities.
iou_threshold: intersection over union threshold.
top_k: keep top_k results. If k <= 0, keep all the results.
candidate_size:... | [
"def",
"nms",
"(",
"boxes",
",",
"scores",
",",
"iou_threshold",
",",
"top_k",
"=",
"-",
"1",
",",
"candidate_size",
"=",
"200",
")",
":",
"picked",
"=",
"[",
"]",
"indexes",
"=",
"np",
".",
"argsort",
"(",
"scores",
")",
"indexes",
"=",
"indexes",
... | https://github.com/Tencent/ncnn/blob/6f824c57a1f8ee6dd3902fb13bef947cf4e6a73f/python/ncnn/utils/functional.py#L90-L120 | ||
nest/nest-simulator | f2623eb78518cdbd55e77e0ed486bf1111bcb62f | pynest/nest/lib/hl_api_spatial.py | python | DumpLayerNodes | (layer, outname) | Write `node ID` and position data of `layer` to file.
Write `node ID` and position data to `outname` file. For each node in `layer`,
a line with the following information is written:
::
node ID x-position y-position [z-position]
If `layer` contains several `node IDs`, data for all nod... | Write `node ID` and position data of `layer` to file. | [
"Write",
"node",
"ID",
"and",
"position",
"data",
"of",
"layer",
"to",
"file",
"."
] | def DumpLayerNodes(layer, outname):
"""
Write `node ID` and position data of `layer` to file.
Write `node ID` and position data to `outname` file. For each node in `layer`,
a line with the following information is written:
::
node ID x-position y-position [z-position]
If `laye... | [
"def",
"DumpLayerNodes",
"(",
"layer",
",",
"outname",
")",
":",
"if",
"not",
"isinstance",
"(",
"layer",
",",
"NodeCollection",
")",
":",
"raise",
"TypeError",
"(",
"\"layer must be a NodeCollection\"",
")",
"sli_func",
"(",
"\"\"\"\n (w) file exch DumpLa... | https://github.com/nest/nest-simulator/blob/f2623eb78518cdbd55e77e0ed486bf1111bcb62f/pynest/nest/lib/hl_api_spatial.py#L486-L538 | ||
mantidproject/mantid | 03deeb89254ec4289edb8771e0188c2090a02f32 | Framework/PythonInterface/plugins/algorithms/WorkflowAlgorithms/TimeSlice.py | python | _count_monitors | (raw_file) | Returns the number of monitors and if they're at the start or end of the file | Returns the number of monitors and if they're at the start or end of the file | [
"Returns",
"the",
"number",
"of",
"monitors",
"and",
"if",
"they",
"re",
"at",
"the",
"start",
"or",
"end",
"of",
"the",
"file"
] | def _count_monitors(raw_file):
"""
Returns the number of monitors and if they're at the start or end of the file
"""
raw_file = mtd[raw_file]
num_hist = raw_file.getNumberHistograms()
mon_count = 1
spectrumInfo = raw_file.spectrumInfo()
if spectrumInfo.isMonitor(0):
# Monitors ... | [
"def",
"_count_monitors",
"(",
"raw_file",
")",
":",
"raw_file",
"=",
"mtd",
"[",
"raw_file",
"]",
"num_hist",
"=",
"raw_file",
".",
"getNumberHistograms",
"(",
")",
"mon_count",
"=",
"1",
"spectrumInfo",
"=",
"raw_file",
".",
"spectrumInfo",
"(",
")",
"if",... | https://github.com/mantidproject/mantid/blob/03deeb89254ec4289edb8771e0188c2090a02f32/Framework/PythonInterface/plugins/algorithms/WorkflowAlgorithms/TimeSlice.py#L15-L46 | ||
gimli-org/gimli | 17aa2160de9b15ababd9ef99e89b1bc3277bbb23 | pygimli/_version.py | python | run_command | (commands, args, cwd=None, verbose=False, hide_stderr=False,
env=None) | return stdout, p.returncode | Call the given command(s). | Call the given command(s). | [
"Call",
"the",
"given",
"command",
"(",
"s",
")",
"."
] | def run_command(commands, args, cwd=None, verbose=False, hide_stderr=False,
env=None):
"""Call the given command(s)."""
assert isinstance(commands, list)
p = None
for c in commands:
try:
dispcmd = str([c] + args)
# remember shell=False, so use git.cmd on w... | [
"def",
"run_command",
"(",
"commands",
",",
"args",
",",
"cwd",
"=",
"None",
",",
"verbose",
"=",
"False",
",",
"hide_stderr",
"=",
"False",
",",
"env",
"=",
"None",
")",
":",
"assert",
"isinstance",
"(",
"commands",
",",
"list",
")",
"p",
"=",
"None... | https://github.com/gimli-org/gimli/blob/17aa2160de9b15ababd9ef99e89b1bc3277bbb23/pygimli/_version.py#L70-L104 | |
google/flatbuffers | b3006913369e0a7550795e477011ac5bebb93497 | python/flatbuffers/builder.py | python | Builder.assertStructIsInline | (self, obj) | Structs are always stored inline, so need to be created right
where they are used. You'll get this error if you created it
elsewhere. | Structs are always stored inline, so need to be created right
where they are used. You'll get this error if you created it
elsewhere. | [
"Structs",
"are",
"always",
"stored",
"inline",
"so",
"need",
"to",
"be",
"created",
"right",
"where",
"they",
"are",
"used",
".",
"You",
"ll",
"get",
"this",
"error",
"if",
"you",
"created",
"it",
"elsewhere",
"."
] | def assertStructIsInline(self, obj):
"""
Structs are always stored inline, so need to be created right
where they are used. You'll get this error if you created it
elsewhere.
"""
N.enforce_number(obj, N.UOffsetTFlags)
if obj != self.Offset():
msg = ("... | [
"def",
"assertStructIsInline",
"(",
"self",
",",
"obj",
")",
":",
"N",
".",
"enforce_number",
"(",
"obj",
",",
"N",
".",
"UOffsetTFlags",
")",
"if",
"obj",
"!=",
"self",
".",
"Offset",
"(",
")",
":",
"msg",
"=",
"(",
"\"flatbuffers: Tried to write a Struct... | https://github.com/google/flatbuffers/blob/b3006913369e0a7550795e477011ac5bebb93497/python/flatbuffers/builder.py#L495-L506 | ||
wxWidgets/wxPython-Classic | 19571e1ae65f1ac445f5491474121998c97a1bf0 | src/msw/stc.py | python | StyledTextCtrl.GetTextRange | (*args, **kwargs) | return _stc.StyledTextCtrl_GetTextRange(*args, **kwargs) | GetTextRange(self, int startPos, int endPos) -> String
Retrieve a range of text. | GetTextRange(self, int startPos, int endPos) -> String | [
"GetTextRange",
"(",
"self",
"int",
"startPos",
"int",
"endPos",
")",
"-",
">",
"String"
] | def GetTextRange(*args, **kwargs):
"""
GetTextRange(self, int startPos, int endPos) -> String
Retrieve a range of text.
"""
return _stc.StyledTextCtrl_GetTextRange(*args, **kwargs) | [
"def",
"GetTextRange",
"(",
"*",
"args",
",",
"*",
"*",
"kwargs",
")",
":",
"return",
"_stc",
".",
"StyledTextCtrl_GetTextRange",
"(",
"*",
"args",
",",
"*",
"*",
"kwargs",
")"
] | https://github.com/wxWidgets/wxPython-Classic/blob/19571e1ae65f1ac445f5491474121998c97a1bf0/src/msw/stc.py#L3585-L3591 | |
wxWidgets/wxPython-Classic | 19571e1ae65f1ac445f5491474121998c97a1bf0 | src/osx_cocoa/_gdi.py | python | Locale.GetLanguage | (*args, **kwargs) | return _gdi_.Locale_GetLanguage(*args, **kwargs) | GetLanguage(self) -> int | GetLanguage(self) -> int | [
"GetLanguage",
"(",
"self",
")",
"-",
">",
"int"
] | def GetLanguage(*args, **kwargs):
"""GetLanguage(self) -> int"""
return _gdi_.Locale_GetLanguage(*args, **kwargs) | [
"def",
"GetLanguage",
"(",
"*",
"args",
",",
"*",
"*",
"kwargs",
")",
":",
"return",
"_gdi_",
".",
"Locale_GetLanguage",
"(",
"*",
"args",
",",
"*",
"*",
"kwargs",
")"
] | https://github.com/wxWidgets/wxPython-Classic/blob/19571e1ae65f1ac445f5491474121998c97a1bf0/src/osx_cocoa/_gdi.py#L3021-L3023 | |
ros-drivers/rosserial | c169ae2173dcfda7cee567d64beae45198459400 | rosserial_python/src/rosserial_python/SerialClient.py | python | SerialClient.setupSubscriber | (self, data) | Register a new subscriber. | Register a new subscriber. | [
"Register",
"a",
"new",
"subscriber",
"."
] | def setupSubscriber(self, data):
""" Register a new subscriber. """
try:
msg = TopicInfo()
msg.deserialize(data)
if not msg.topic_name in list(self.subscribers.keys()):
sub = Subscriber(msg, self)
self.subscribers[msg.topic_name] = sub
... | [
"def",
"setupSubscriber",
"(",
"self",
",",
"data",
")",
":",
"try",
":",
"msg",
"=",
"TopicInfo",
"(",
")",
"msg",
".",
"deserialize",
"(",
"data",
")",
"if",
"not",
"msg",
".",
"topic_name",
"in",
"list",
"(",
"self",
".",
"subscribers",
".",
"keys... | https://github.com/ros-drivers/rosserial/blob/c169ae2173dcfda7cee567d64beae45198459400/rosserial_python/src/rosserial_python/SerialClient.py#L582-L600 | ||
aws/lumberyard | f85344403c1c2e77ec8c75deb2c116e97b713217 | dev/Tools/AWSPythonSDK/1.5.8/docutils/core.py | python | publish_parts | (source, source_path=None, source_class=io.StringInput,
destination_path=None,
reader=None, reader_name='standalone',
parser=None, parser_name='restructuredtext',
writer=None, writer_name='pseudoxml',
settings=None, settings_spec=... | return pub.writer.parts | Set up & run a `Publisher`, and return a dictionary of document parts.
Dictionary keys are the names of parts, and values are Unicode strings;
encoding is up to the client. For programmatic use with string I/O.
For encoded string input, be sure to set the 'input_encoding' setting to
the desired encodi... | Set up & run a `Publisher`, and return a dictionary of document parts.
Dictionary keys are the names of parts, and values are Unicode strings;
encoding is up to the client. For programmatic use with string I/O. | [
"Set",
"up",
"&",
"run",
"a",
"Publisher",
"and",
"return",
"a",
"dictionary",
"of",
"document",
"parts",
".",
"Dictionary",
"keys",
"are",
"the",
"names",
"of",
"parts",
"and",
"values",
"are",
"Unicode",
"strings",
";",
"encoding",
"is",
"up",
"to",
"t... | def publish_parts(source, source_path=None, source_class=io.StringInput,
destination_path=None,
reader=None, reader_name='standalone',
parser=None, parser_name='restructuredtext',
writer=None, writer_name='pseudoxml',
settings=Non... | [
"def",
"publish_parts",
"(",
"source",
",",
"source_path",
"=",
"None",
",",
"source_class",
"=",
"io",
".",
"StringInput",
",",
"destination_path",
"=",
"None",
",",
"reader",
"=",
"None",
",",
"reader_name",
"=",
"'standalone'",
",",
"parser",
"=",
"None",... | https://github.com/aws/lumberyard/blob/f85344403c1c2e77ec8c75deb2c116e97b713217/dev/Tools/AWSPythonSDK/1.5.8/docutils/core.py#L419-L451 | |
Z3Prover/z3 | d745d03afdfdf638d66093e2bfbacaf87187f35b | src/api/python/z3/z3.py | python | Solver.help | (self) | Display a string describing all available options. | Display a string describing all available options. | [
"Display",
"a",
"string",
"describing",
"all",
"available",
"options",
"."
] | def help(self):
"""Display a string describing all available options."""
print(Z3_solver_get_help(self.ctx.ref(), self.solver)) | [
"def",
"help",
"(",
"self",
")",
":",
"print",
"(",
"Z3_solver_get_help",
"(",
"self",
".",
"ctx",
".",
"ref",
"(",
")",
",",
"self",
".",
"solver",
")",
")"
] | https://github.com/Z3Prover/z3/blob/d745d03afdfdf638d66093e2bfbacaf87187f35b/src/api/python/z3/z3.py#L7246-L7248 | ||
natanielruiz/android-yolo | 1ebb54f96a67a20ff83ddfc823ed83a13dc3a47f | jni-build/jni/include/tensorflow/python/framework/ops.py | python | SparseTensor.shape | (self) | return self._shape | A 1-D Tensor of int64 representing the shape of the dense tensor. | A 1-D Tensor of int64 representing the shape of the dense tensor. | [
"A",
"1",
"-",
"D",
"Tensor",
"of",
"int64",
"representing",
"the",
"shape",
"of",
"the",
"dense",
"tensor",
"."
] | def shape(self):
"""A 1-D Tensor of int64 representing the shape of the dense tensor."""
return self._shape | [
"def",
"shape",
"(",
"self",
")",
":",
"return",
"self",
".",
"_shape"
] | https://github.com/natanielruiz/android-yolo/blob/1ebb54f96a67a20ff83ddfc823ed83a13dc3a47f/jni-build/jni/include/tensorflow/python/framework/ops.py#L1026-L1028 | |
wxWidgets/wxPython-Classic | 19571e1ae65f1ac445f5491474121998c97a1bf0 | src/msw/_controls.py | python | ComboBox.__init__ | (self, *args, **kwargs) | __init__(Window parent, int id=-1, String value=EmptyString,
Point pos=DefaultPosition, Size size=DefaultSize,
List choices=EmptyList, long style=0, Validator validator=DefaultValidator,
String name=ComboBoxNameStr) -> ComboBox
Constructor, creates and shows a ComboBox contr... | __init__(Window parent, int id=-1, String value=EmptyString,
Point pos=DefaultPosition, Size size=DefaultSize,
List choices=EmptyList, long style=0, Validator validator=DefaultValidator,
String name=ComboBoxNameStr) -> ComboBox | [
"__init__",
"(",
"Window",
"parent",
"int",
"id",
"=",
"-",
"1",
"String",
"value",
"=",
"EmptyString",
"Point",
"pos",
"=",
"DefaultPosition",
"Size",
"size",
"=",
"DefaultSize",
"List",
"choices",
"=",
"EmptyList",
"long",
"style",
"=",
"0",
"Validator",
... | def __init__(self, *args, **kwargs):
"""
__init__(Window parent, int id=-1, String value=EmptyString,
Point pos=DefaultPosition, Size size=DefaultSize,
List choices=EmptyList, long style=0, Validator validator=DefaultValidator,
String name=ComboBoxNameStr) -> ComboBo... | [
"def",
"__init__",
"(",
"self",
",",
"*",
"args",
",",
"*",
"*",
"kwargs",
")",
":",
"_controls_",
".",
"ComboBox_swiginit",
"(",
"self",
",",
"_controls_",
".",
"new_ComboBox",
"(",
"*",
"args",
",",
"*",
"*",
"kwargs",
")",
")",
"self",
".",
"_setO... | https://github.com/wxWidgets/wxPython-Classic/blob/19571e1ae65f1ac445f5491474121998c97a1bf0/src/msw/_controls.py#L588-L598 | ||
zachriggle/ida-splode | a4aee3be415b318a0e051a523ebd0a8d6d5e0026 | py/idasplode/color.py | python | ColorHit | (IP, Count=-1) | Color a single instruction | Color a single instruction | [
"Color",
"a",
"single",
"instruction"
] | def ColorHit(IP, Count=-1):
"""Color a single instruction"""
Hit = query.GetHitInstructions({'IP':IP})
Enhanced = query.GetEnhancedInstructions({'IP':IP})
if Enhanced: SetColor(IP, settings.COLOR_INS_ENHANCED)
elif Hit: SetColor(IP, settings.COLOR_INS_EXECUTED)
else: SetColor(IP,... | [
"def",
"ColorHit",
"(",
"IP",
",",
"Count",
"=",
"-",
"1",
")",
":",
"Hit",
"=",
"query",
".",
"GetHitInstructions",
"(",
"{",
"'IP'",
":",
"IP",
"}",
")",
"Enhanced",
"=",
"query",
".",
"GetEnhancedInstructions",
"(",
"{",
"'IP'",
":",
"IP",
"}",
... | https://github.com/zachriggle/ida-splode/blob/a4aee3be415b318a0e051a523ebd0a8d6d5e0026/py/idasplode/color.py#L22-L29 | ||
mindspore-ai/mindspore | fb8fd3338605bb34fa5cea054e535a8b1d753fab | mindspore/python/mindspore/ops/_op_impl/aicpu/topk.py | python | _top_k_aicpu | () | return | TopK aicpu register | TopK aicpu register | [
"TopK",
"aicpu",
"register"
] | def _top_k_aicpu():
"""TopK aicpu register"""
return | [
"def",
"_top_k_aicpu",
"(",
")",
":",
"return"
] | https://github.com/mindspore-ai/mindspore/blob/fb8fd3338605bb34fa5cea054e535a8b1d753fab/mindspore/python/mindspore/ops/_op_impl/aicpu/topk.py#L32-L34 | |
wlanjie/AndroidFFmpeg | 7baf9122f4b8e1c74e7baf4be5c422c7a5ba5aaf | tools/fdk-aac-build/x86/toolchain/lib/python2.7/compiler/pycodegen.py | python | findOp | (node) | return v.op | Find the op (DELETE, LOAD, STORE) in an AssTuple tree | Find the op (DELETE, LOAD, STORE) in an AssTuple tree | [
"Find",
"the",
"op",
"(",
"DELETE",
"LOAD",
"STORE",
")",
"in",
"an",
"AssTuple",
"tree"
] | def findOp(node):
"""Find the op (DELETE, LOAD, STORE) in an AssTuple tree"""
v = OpFinder()
walk(node, v, verbose=0)
return v.op | [
"def",
"findOp",
"(",
"node",
")",
":",
"v",
"=",
"OpFinder",
"(",
")",
"walk",
"(",
"node",
",",
"v",
",",
"verbose",
"=",
"0",
")",
"return",
"v",
".",
"op"
] | https://github.com/wlanjie/AndroidFFmpeg/blob/7baf9122f4b8e1c74e7baf4be5c422c7a5ba5aaf/tools/fdk-aac-build/x86/toolchain/lib/python2.7/compiler/pycodegen.py#L1497-L1501 | |
benoitsteiner/tensorflow-opencl | cb7cb40a57fde5cfd4731bc551e82a1e2fef43a5 | tensorflow/python/ops/template.py | python | Template.global_variables | (self) | Returns the list of global variables created by the Template. | Returns the list of global variables created by the Template. | [
"Returns",
"the",
"list",
"of",
"global",
"variables",
"created",
"by",
"the",
"Template",
"."
] | def global_variables(self):
"""Returns the list of global variables created by the Template."""
if self._variables_created:
return ops.get_collection(ops.GraphKeys.GLOBAL_VARIABLES,
self.variable_scope_name)
else:
return [] | [
"def",
"global_variables",
"(",
"self",
")",
":",
"if",
"self",
".",
"_variables_created",
":",
"return",
"ops",
".",
"get_collection",
"(",
"ops",
".",
"GraphKeys",
".",
"GLOBAL_VARIABLES",
",",
"self",
".",
"variable_scope_name",
")",
"else",
":",
"return",
... | https://github.com/benoitsteiner/tensorflow-opencl/blob/cb7cb40a57fde5cfd4731bc551e82a1e2fef43a5/tensorflow/python/ops/template.py#L305-L311 | ||
microsoft/onnxruntime | f92e47e95b13a240e37caf7b36577983544f98fc | onnxruntime/python/tools/quantization/quantize.py | python | optimize_model | (model_path: Path) | return optimized_model | Generate model that applies graph optimization (constant folding,etc.)
parameter model_path: path to the original onnx model
return: optimized onnx model | Generate model that applies graph optimization (constant folding,etc.)
parameter model_path: path to the original onnx model
return: optimized onnx model | [
"Generate",
"model",
"that",
"applies",
"graph",
"optimization",
"(",
"constant",
"folding",
"etc",
".",
")",
"parameter",
"model_path",
":",
"path",
"to",
"the",
"original",
"onnx",
"model",
"return",
":",
"optimized",
"onnx",
"model"
] | def optimize_model(model_path: Path):
'''
Generate model that applies graph optimization (constant folding,etc.)
parameter model_path: path to the original onnx model
return: optimized onnx model
'''
opt_model_path = generate_identified_filename(model_path, "-opt")
sess_option = ... | [
"def",
"optimize_model",
"(",
"model_path",
":",
"Path",
")",
":",
"opt_model_path",
"=",
"generate_identified_filename",
"(",
"model_path",
",",
"\"-opt\"",
")",
"sess_option",
"=",
"SessionOptions",
"(",
")",
"sess_option",
".",
"optimized_model_filepath",
"=",
"o... | https://github.com/microsoft/onnxruntime/blob/f92e47e95b13a240e37caf7b36577983544f98fc/onnxruntime/python/tools/quantization/quantize.py#L30-L42 | |
wxWidgets/wxPython-Classic | 19571e1ae65f1ac445f5491474121998c97a1bf0 | src/gtk/_gdi.py | python | RegionFromBitmapColour | (*args, **kwargs) | return val | RegionFromBitmapColour(Bitmap bmp, Colour transColour, int tolerance=0) -> Region | RegionFromBitmapColour(Bitmap bmp, Colour transColour, int tolerance=0) -> Region | [
"RegionFromBitmapColour",
"(",
"Bitmap",
"bmp",
"Colour",
"transColour",
"int",
"tolerance",
"=",
"0",
")",
"-",
">",
"Region"
] | def RegionFromBitmapColour(*args, **kwargs):
"""RegionFromBitmapColour(Bitmap bmp, Colour transColour, int tolerance=0) -> Region"""
val = _gdi_.new_RegionFromBitmapColour(*args, **kwargs)
return val | [
"def",
"RegionFromBitmapColour",
"(",
"*",
"args",
",",
"*",
"*",
"kwargs",
")",
":",
"val",
"=",
"_gdi_",
".",
"new_RegionFromBitmapColour",
"(",
"*",
"args",
",",
"*",
"*",
"kwargs",
")",
"return",
"val"
] | https://github.com/wxWidgets/wxPython-Classic/blob/19571e1ae65f1ac445f5491474121998c97a1bf0/src/gtk/_gdi.py#L1659-L1662 | |
wlanjie/AndroidFFmpeg | 7baf9122f4b8e1c74e7baf4be5c422c7a5ba5aaf | tools/fdk-aac-build/armeabi-v7a/toolchain/lib/python2.7/mailbox.py | python | MaildirMessage.__init__ | (self, message=None) | Initialize a MaildirMessage instance. | Initialize a MaildirMessage instance. | [
"Initialize",
"a",
"MaildirMessage",
"instance",
"."
] | def __init__(self, message=None):
"""Initialize a MaildirMessage instance."""
self._subdir = 'new'
self._info = ''
self._date = time.time()
Message.__init__(self, message) | [
"def",
"__init__",
"(",
"self",
",",
"message",
"=",
"None",
")",
":",
"self",
".",
"_subdir",
"=",
"'new'",
"self",
".",
"_info",
"=",
"''",
"self",
".",
"_date",
"=",
"time",
".",
"time",
"(",
")",
"Message",
".",
"__init__",
"(",
"self",
",",
... | https://github.com/wlanjie/AndroidFFmpeg/blob/7baf9122f4b8e1c74e7baf4be5c422c7a5ba5aaf/tools/fdk-aac-build/armeabi-v7a/toolchain/lib/python2.7/mailbox.py#L1474-L1479 | ||
weolar/miniblink49 | 1c4678db0594a4abde23d3ebbcc7cd13c3170777 | third_party/WebKit/Tools/Scripts/webkitpy/thirdparty/pep8.py | python | Checker.report_invalid_syntax | (self) | Check if the syntax is valid. | Check if the syntax is valid. | [
"Check",
"if",
"the",
"syntax",
"is",
"valid",
"."
] | def report_invalid_syntax(self):
"""Check if the syntax is valid."""
(exc_type, exc) = sys.exc_info()[:2]
if len(exc.args) > 1:
offset = exc.args[1]
if len(offset) > 2:
offset = offset[1:3]
else:
offset = (1, 0)
self.report_erro... | [
"def",
"report_invalid_syntax",
"(",
"self",
")",
":",
"(",
"exc_type",
",",
"exc",
")",
"=",
"sys",
".",
"exc_info",
"(",
")",
"[",
":",
"2",
"]",
"if",
"len",
"(",
"exc",
".",
"args",
")",
">",
"1",
":",
"offset",
"=",
"exc",
".",
"args",
"["... | https://github.com/weolar/miniblink49/blob/1c4678db0594a4abde23d3ebbcc7cd13c3170777/third_party/WebKit/Tools/Scripts/webkitpy/thirdparty/pep8.py#L1250-L1261 | ||
wlanjie/AndroidFFmpeg | 7baf9122f4b8e1c74e7baf4be5c422c7a5ba5aaf | tools/fdk-aac-build/armeabi-v7a/toolchain/lib/python2.7/random.py | python | Random.randint | (self, a, b) | return self.randrange(a, b+1) | Return random integer in range [a, b], including both end points. | Return random integer in range [a, b], including both end points. | [
"Return",
"random",
"integer",
"in",
"range",
"[",
"a",
"b",
"]",
"including",
"both",
"end",
"points",
"."
] | def randint(self, a, b):
"""Return random integer in range [a, b], including both end points.
"""
return self.randrange(a, b+1) | [
"def",
"randint",
"(",
"self",
",",
"a",
",",
"b",
")",
":",
"return",
"self",
".",
"randrange",
"(",
"a",
",",
"b",
"+",
"1",
")"
] | https://github.com/wlanjie/AndroidFFmpeg/blob/7baf9122f4b8e1c74e7baf4be5c422c7a5ba5aaf/tools/fdk-aac-build/armeabi-v7a/toolchain/lib/python2.7/random.py#L237-L241 | |
catboost/catboost | 167f64f237114a4d10b2b4ee42adb4569137debe | contrib/python/scipy/py3/scipy/stats/_multivariate.py | python | invwishart_gen.var | (self, df, scale) | return _squeeze_output(out) if out is not None else out | Variance of the inverse Wishart distribution
Only valid if the degrees of freedom are greater than the dimension of
the scale matrix plus three.
Parameters
----------
%(_doc_default_callparams)s
Returns
-------
var : float
The variance of th... | Variance of the inverse Wishart distribution | [
"Variance",
"of",
"the",
"inverse",
"Wishart",
"distribution"
] | def var(self, df, scale):
"""
Variance of the inverse Wishart distribution
Only valid if the degrees of freedom are greater than the dimension of
the scale matrix plus three.
Parameters
----------
%(_doc_default_callparams)s
Returns
-------
... | [
"def",
"var",
"(",
"self",
",",
"df",
",",
"scale",
")",
":",
"dim",
",",
"df",
",",
"scale",
"=",
"self",
".",
"_process_parameters",
"(",
"df",
",",
"scale",
")",
"out",
"=",
"self",
".",
"_var",
"(",
"dim",
",",
"df",
",",
"scale",
")",
"ret... | https://github.com/catboost/catboost/blob/167f64f237114a4d10b2b4ee42adb4569137debe/contrib/python/scipy/py3/scipy/stats/_multivariate.py#L2666-L2684 | |
magazino/move_base_flex | a8ca484e354a0196b5e9fbda5f0eae311d9b72d3 | git-clang-format.py | python | temporary_index_file | (tree=None) | Context manager for setting GIT_INDEX_FILE to a temporary file and deleting
the file afterward. | Context manager for setting GIT_INDEX_FILE to a temporary file and deleting
the file afterward. | [
"Context",
"manager",
"for",
"setting",
"GIT_INDEX_FILE",
"to",
"a",
"temporary",
"file",
"and",
"deleting",
"the",
"file",
"afterward",
"."
] | def temporary_index_file(tree=None):
"""Context manager for setting GIT_INDEX_FILE to a temporary file and deleting
the file afterward."""
index_path = create_temporary_index(tree)
old_index_path = os.environ.get('GIT_INDEX_FILE')
os.environ['GIT_INDEX_FILE'] = index_path
try:
yield
finally:
if ol... | [
"def",
"temporary_index_file",
"(",
"tree",
"=",
"None",
")",
":",
"index_path",
"=",
"create_temporary_index",
"(",
"tree",
")",
"old_index_path",
"=",
"os",
".",
"environ",
".",
"get",
"(",
"'GIT_INDEX_FILE'",
")",
"os",
".",
"environ",
"[",
"'GIT_INDEX_FILE... | https://github.com/magazino/move_base_flex/blob/a8ca484e354a0196b5e9fbda5f0eae311d9b72d3/git-clang-format.py#L451-L464 | ||
google/llvm-propeller | 45c226984fe8377ebfb2ad7713c680d652ba678d | compiler-rt/lib/sanitizer_common/scripts/cpplint.py | python | IsErrorSuppressedByNolint | (category, linenum) | return (_global_error_suppressions.get(category, False) or
linenum in _error_suppressions.get(category, set()) or
linenum in _error_suppressions.get(None, set())) | Returns true if the specified error category is suppressed on this line.
Consults the global error_suppressions map populated by
ParseNolintSuppressions/ProcessGlobalSuppresions/ResetNolintSuppressions.
Args:
category: str, the category of the error.
linenum: int, the current line number.
Returns:
... | Returns true if the specified error category is suppressed on this line. | [
"Returns",
"true",
"if",
"the",
"specified",
"error",
"category",
"is",
"suppressed",
"on",
"this",
"line",
"."
] | def IsErrorSuppressedByNolint(category, linenum):
"""Returns true if the specified error category is suppressed on this line.
Consults the global error_suppressions map populated by
ParseNolintSuppressions/ProcessGlobalSuppresions/ResetNolintSuppressions.
Args:
category: str, the category of the error.
... | [
"def",
"IsErrorSuppressedByNolint",
"(",
"category",
",",
"linenum",
")",
":",
"return",
"(",
"_global_error_suppressions",
".",
"get",
"(",
"category",
",",
"False",
")",
"or",
"linenum",
"in",
"_error_suppressions",
".",
"get",
"(",
"category",
",",
"set",
"... | https://github.com/google/llvm-propeller/blob/45c226984fe8377ebfb2ad7713c680d652ba678d/compiler-rt/lib/sanitizer_common/scripts/cpplint.py#L639-L654 | |
rootm0s/Protectors | 5b3f4d11687a5955caf9c3af30666c4bfc2c19ab | OWASP-ZSC/module/readline_windows/pyreadline/lineeditor/history.py | python | LineHistory.write_history_file | (self, filename=None) | Save a readline history file. | Save a readline history file. | [
"Save",
"a",
"readline",
"history",
"file",
"."
] | def write_history_file(self, filename=None):
'''Save a readline history file.'''
if filename is None:
filename = self.history_filename
fp = open(filename, 'wb')
for line in self.history[-self.history_length:]:
fp.write(ensure_str(line.get_line_text()))
... | [
"def",
"write_history_file",
"(",
"self",
",",
"filename",
"=",
"None",
")",
":",
"if",
"filename",
"is",
"None",
":",
"filename",
"=",
"self",
".",
"history_filename",
"fp",
"=",
"open",
"(",
"filename",
",",
"'wb'",
")",
"for",
"line",
"in",
"self",
... | https://github.com/rootm0s/Protectors/blob/5b3f4d11687a5955caf9c3af30666c4bfc2c19ab/OWASP-ZSC/module/readline_windows/pyreadline/lineeditor/history.py#L94-L102 | ||
aws/lumberyard | f85344403c1c2e77ec8c75deb2c116e97b713217 | dev/Tools/Python/3.7.10/linux_x64/lib/python3.7/sysconfig.py | python | get_platform | () | return "%s-%s-%s" % (osname, release, machine) | Return a string that identifies the current platform.
This is used mainly to distinguish platform-specific build directories and
platform-specific built distributions. Typically includes the OS name and
version and the architecture (as supplied by 'os.uname()'), although the
exact information included... | Return a string that identifies the current platform. | [
"Return",
"a",
"string",
"that",
"identifies",
"the",
"current",
"platform",
"."
] | def get_platform():
"""Return a string that identifies the current platform.
This is used mainly to distinguish platform-specific build directories and
platform-specific built distributions. Typically includes the OS name and
version and the architecture (as supplied by 'os.uname()'), although the
... | [
"def",
"get_platform",
"(",
")",
":",
"if",
"os",
".",
"name",
"==",
"'nt'",
":",
"if",
"'amd64'",
"in",
"sys",
".",
"version",
".",
"lower",
"(",
")",
":",
"return",
"'win-amd64'",
"return",
"sys",
".",
"platform",
"if",
"os",
".",
"name",
"!=",
"... | https://github.com/aws/lumberyard/blob/f85344403c1c2e77ec8c75deb2c116e97b713217/dev/Tools/Python/3.7.10/linux_x64/lib/python3.7/sysconfig.py#L605-L678 | |
catboost/catboost | 167f64f237114a4d10b2b4ee42adb4569137debe | contrib/python/pluggy/py2/pluggy/manager.py | python | PluginManager.enable_tracing | (self) | return self.add_hookcall_monitoring(before, after) | enable tracing of hook calls and return an undo function. | enable tracing of hook calls and return an undo function. | [
"enable",
"tracing",
"of",
"hook",
"calls",
"and",
"return",
"an",
"undo",
"function",
"."
] | def enable_tracing(self):
""" enable tracing of hook calls and return an undo function. """
hooktrace = self.trace.root.get("hook")
def before(hook_name, methods, kwargs):
hooktrace.root.indent += 1
hooktrace(hook_name, kwargs)
def after(outcome, hook_name, meth... | [
"def",
"enable_tracing",
"(",
"self",
")",
":",
"hooktrace",
"=",
"self",
".",
"trace",
".",
"root",
".",
"get",
"(",
"\"hook\"",
")",
"def",
"before",
"(",
"hook_name",
",",
"methods",
",",
"kwargs",
")",
":",
"hooktrace",
".",
"root",
".",
"indent",
... | https://github.com/catboost/catboost/blob/167f64f237114a4d10b2b4ee42adb4569137debe/contrib/python/pluggy/py2/pluggy/manager.py#L346-L359 | |
krishauser/Klampt | 972cc83ea5befac3f653c1ba20f80155768ad519 | Python/python2_version/klampt/robotsim.py | python | GeneralizedIKSolver.setTolerance | (self, res) | return _robotsim.GeneralizedIKSolver_setTolerance(self, res) | setTolerance(GeneralizedIKSolver self, double res)
Sets the constraint solve tolerance (default 1e-3) | setTolerance(GeneralizedIKSolver self, double res) | [
"setTolerance",
"(",
"GeneralizedIKSolver",
"self",
"double",
"res",
")"
] | def setTolerance(self, res):
"""
setTolerance(GeneralizedIKSolver self, double res)
Sets the constraint solve tolerance (default 1e-3)
"""
return _robotsim.GeneralizedIKSolver_setTolerance(self, res) | [
"def",
"setTolerance",
"(",
"self",
",",
"res",
")",
":",
"return",
"_robotsim",
".",
"GeneralizedIKSolver_setTolerance",
"(",
"self",
",",
"res",
")"
] | https://github.com/krishauser/Klampt/blob/972cc83ea5befac3f653c1ba20f80155768ad519/Python/python2_version/klampt/robotsim.py#L7037-L7046 | |
hanpfei/chromium-net | 392cc1fa3a8f92f42e4071ab6e674d8e0482f83f | third_party/catapult/third_party/closure_linter/closure_linter/typeannotation.py | python | TypeAnnotation.IterIdentifiers | (self) | Iterates over all identifiers in this type and its subtypes. | Iterates over all identifiers in this type and its subtypes. | [
"Iterates",
"over",
"all",
"identifiers",
"in",
"this",
"type",
"and",
"its",
"subtypes",
"."
] | def IterIdentifiers(self):
"""Iterates over all identifiers in this type and its subtypes."""
if self.identifier:
yield self.identifier
for subtype in self.IterTypes():
for identifier in subtype.IterIdentifiers():
yield identifier | [
"def",
"IterIdentifiers",
"(",
"self",
")",
":",
"if",
"self",
".",
"identifier",
":",
"yield",
"self",
".",
"identifier",
"for",
"subtype",
"in",
"self",
".",
"IterTypes",
"(",
")",
":",
"for",
"identifier",
"in",
"subtype",
".",
"IterIdentifiers",
"(",
... | https://github.com/hanpfei/chromium-net/blob/392cc1fa3a8f92f42e4071ab6e674d8e0482f83f/third_party/catapult/third_party/closure_linter/closure_linter/typeannotation.py#L154-L160 | ||
apache/incubator-mxnet | f03fb23f1d103fec9541b5ae59ee06b1734a51d9 | python/mxnet/numpy/multiarray.py | python | trace | (a, offset=0, axis1=0, axis2=1, out=None) | return _mx_nd_np.trace(a, offset, axis1, axis2, out) | Return the sum along diagonals of the array.
If `a` is 2-D, the sum along its diagonal with the given offset
is returned, i.e., the sum of elements ``a[i,i+offset]`` for all i.
If `a` has more than two dimensions, then the axes specified by axis1 and
axis2 are used to determine the 2-D sub-arrays whose ... | Return the sum along diagonals of the array.
If `a` is 2-D, the sum along its diagonal with the given offset
is returned, i.e., the sum of elements ``a[i,i+offset]`` for all i.
If `a` has more than two dimensions, then the axes specified by axis1 and
axis2 are used to determine the 2-D sub-arrays whose ... | [
"Return",
"the",
"sum",
"along",
"diagonals",
"of",
"the",
"array",
".",
"If",
"a",
"is",
"2",
"-",
"D",
"the",
"sum",
"along",
"its",
"diagonal",
"with",
"the",
"given",
"offset",
"is",
"returned",
"i",
".",
"e",
".",
"the",
"sum",
"of",
"elements",... | def trace(a, offset=0, axis1=0, axis2=1, out=None):
"""
Return the sum along diagonals of the array.
If `a` is 2-D, the sum along its diagonal with the given offset
is returned, i.e., the sum of elements ``a[i,i+offset]`` for all i.
If `a` has more than two dimensions, then the axes specified by axi... | [
"def",
"trace",
"(",
"a",
",",
"offset",
"=",
"0",
",",
"axis1",
"=",
"0",
",",
"axis2",
"=",
"1",
",",
"out",
"=",
"None",
")",
":",
"return",
"_mx_nd_np",
".",
"trace",
"(",
"a",
",",
"offset",
",",
"axis1",
",",
"axis2",
",",
"out",
")"
] | https://github.com/apache/incubator-mxnet/blob/f03fb23f1d103fec9541b5ae59ee06b1734a51d9/python/mxnet/numpy/multiarray.py#L6544-L6587 | |
ArmageddonGames/ZeldaClassic | c244ae6c1d361d24a5529b1c0394e656f1f5d965 | allegro/demos/skater/blender/ademo_export.py | python | upper | (i1, i2) | return v | Given two vertex ids, determine if the edge is an upper face. | Given two vertex ids, determine if the edge is an upper face. | [
"Given",
"two",
"vertex",
"ids",
"determine",
"if",
"the",
"edge",
"is",
"an",
"upper",
"face",
"."
] | def upper(i1, i2):
"""
Given two vertex ids, determine if the edge is an upper face.
"""
v = V[i2][0] - V[i1][0]
return v | [
"def",
"upper",
"(",
"i1",
",",
"i2",
")",
":",
"v",
"=",
"V",
"[",
"i2",
"]",
"[",
"0",
"]",
"-",
"V",
"[",
"i1",
"]",
"[",
"0",
"]",
"return",
"v"
] | https://github.com/ArmageddonGames/ZeldaClassic/blob/c244ae6c1d361d24a5529b1c0394e656f1f5d965/allegro/demos/skater/blender/ademo_export.py#L143-L148 | |
wxWidgets/wxPython-Classic | 19571e1ae65f1ac445f5491474121998c97a1bf0 | src/msw/_controls.py | python | ListCtrl.Create | (*args, **kwargs) | return _controls_.ListCtrl_Create(*args, **kwargs) | Create(self, Window parent, int id=-1, Point pos=DefaultPosition,
Size size=DefaultSize, long style=LC_ICON,
Validator validator=DefaultValidator, String name=ListCtrlNameStr) -> bool
Do the 2nd phase and create the GUI control. | Create(self, Window parent, int id=-1, Point pos=DefaultPosition,
Size size=DefaultSize, long style=LC_ICON,
Validator validator=DefaultValidator, String name=ListCtrlNameStr) -> bool | [
"Create",
"(",
"self",
"Window",
"parent",
"int",
"id",
"=",
"-",
"1",
"Point",
"pos",
"=",
"DefaultPosition",
"Size",
"size",
"=",
"DefaultSize",
"long",
"style",
"=",
"LC_ICON",
"Validator",
"validator",
"=",
"DefaultValidator",
"String",
"name",
"=",
"Lis... | def Create(*args, **kwargs):
"""
Create(self, Window parent, int id=-1, Point pos=DefaultPosition,
Size size=DefaultSize, long style=LC_ICON,
Validator validator=DefaultValidator, String name=ListCtrlNameStr) -> bool
Do the 2nd phase and create the GUI control.
... | [
"def",
"Create",
"(",
"*",
"args",
",",
"*",
"*",
"kwargs",
")",
":",
"return",
"_controls_",
".",
"ListCtrl_Create",
"(",
"*",
"args",
",",
"*",
"*",
"kwargs",
")"
] | https://github.com/wxWidgets/wxPython-Classic/blob/19571e1ae65f1ac445f5491474121998c97a1bf0/src/msw/_controls.py#L4452-L4460 | |
catboost/catboost | 167f64f237114a4d10b2b4ee42adb4569137debe | contrib/tools/python/src/Lib/difflib.py | python | restore | (delta, which) | r"""
Generate one of the two sequences that generated a delta.
Given a `delta` produced by `Differ.compare()` or `ndiff()`, extract
lines originating from file 1 or 2 (parameter `which`), stripping off line
prefixes.
Examples:
>>> diff = ndiff('one\ntwo\nthree\n'.splitlines(1),
... ... | r"""
Generate one of the two sequences that generated a delta. | [
"r",
"Generate",
"one",
"of",
"the",
"two",
"sequences",
"that",
"generated",
"a",
"delta",
"."
] | def restore(delta, which):
r"""
Generate one of the two sequences that generated a delta.
Given a `delta` produced by `Differ.compare()` or `ndiff()`, extract
lines originating from file 1 or 2 (parameter `which`), stripping off line
prefixes.
Examples:
>>> diff = ndiff('one\ntwo\nthree\n... | [
"def",
"restore",
"(",
"delta",
",",
"which",
")",
":",
"try",
":",
"tag",
"=",
"{",
"1",
":",
"\"- \"",
",",
"2",
":",
"\"+ \"",
"}",
"[",
"int",
"(",
"which",
")",
"]",
"except",
"KeyError",
":",
"raise",
"ValueError",
",",
"(",
"'unknown delta c... | https://github.com/catboost/catboost/blob/167f64f237114a4d10b2b4ee42adb4569137debe/contrib/tools/python/src/Lib/difflib.py#L2020-L2050 | ||
jsupancic/deep_hand_pose | 22cbeae1a8410ff5d37c060c7315719d0a5d608f | scripts/cpp_lint.py | python | _VerboseLevel | () | return _cpplint_state.verbose_level | Returns the module's verbosity setting. | Returns the module's verbosity setting. | [
"Returns",
"the",
"module",
"s",
"verbosity",
"setting",
"."
] | def _VerboseLevel():
"""Returns the module's verbosity setting."""
return _cpplint_state.verbose_level | [
"def",
"_VerboseLevel",
"(",
")",
":",
"return",
"_cpplint_state",
".",
"verbose_level"
] | https://github.com/jsupancic/deep_hand_pose/blob/22cbeae1a8410ff5d37c060c7315719d0a5d608f/scripts/cpp_lint.py#L777-L779 | |
wxWidgets/wxPython-Classic | 19571e1ae65f1ac445f5491474121998c97a1bf0 | src/msw/_windows.py | python | TopLevelWindow.Maximize | (*args, **kwargs) | return _windows_.TopLevelWindow_Maximize(*args, **kwargs) | Maximize(self, bool maximize=True) | Maximize(self, bool maximize=True) | [
"Maximize",
"(",
"self",
"bool",
"maximize",
"=",
"True",
")"
] | def Maximize(*args, **kwargs):
"""Maximize(self, bool maximize=True)"""
return _windows_.TopLevelWindow_Maximize(*args, **kwargs) | [
"def",
"Maximize",
"(",
"*",
"args",
",",
"*",
"*",
"kwargs",
")",
":",
"return",
"_windows_",
".",
"TopLevelWindow_Maximize",
"(",
"*",
"args",
",",
"*",
"*",
"kwargs",
")"
] | https://github.com/wxWidgets/wxPython-Classic/blob/19571e1ae65f1ac445f5491474121998c97a1bf0/src/msw/_windows.py#L405-L407 | |
yuxng/DA-RNN | 77fbb50b4272514588a10a9f90b7d5f8d46974fb | lib/datasets/shapenet_scene.py | python | shapenet_scene.label_path_at | (self, i) | return self.label_path_from_index(self.image_index[i]) | Return the absolute path to metadata i in the image sequence. | Return the absolute path to metadata i in the image sequence. | [
"Return",
"the",
"absolute",
"path",
"to",
"metadata",
"i",
"in",
"the",
"image",
"sequence",
"."
] | def label_path_at(self, i):
"""
Return the absolute path to metadata i in the image sequence.
"""
return self.label_path_from_index(self.image_index[i]) | [
"def",
"label_path_at",
"(",
"self",
",",
"i",
")",
":",
"return",
"self",
".",
"label_path_from_index",
"(",
"self",
".",
"image_index",
"[",
"i",
"]",
")"
] | https://github.com/yuxng/DA-RNN/blob/77fbb50b4272514588a10a9f90b7d5f8d46974fb/lib/datasets/shapenet_scene.py#L66-L70 | |
mantidproject/mantid | 03deeb89254ec4289edb8771e0188c2090a02f32 | Framework/PythonInterface/plugins/algorithms/WorkflowAlgorithms/IndirectFlatPlateAbsorption2.py | python | IndirectFlatPlateAbsorption.validateInputs | (self) | return issues | Validate algorithm options. | Validate algorithm options. | [
"Validate",
"algorithm",
"options",
"."
] | def validateInputs(self):
"""
Validate algorithm options.
"""
self._setup()
issues = dict()
if self._use_can_corrections and self._can_chemical_formula == '':
issues['CanChemicalFormula'] = 'Must be set to use can corrections'
if self._use_can_corre... | [
"def",
"validateInputs",
"(",
"self",
")",
":",
"self",
".",
"_setup",
"(",
")",
"issues",
"=",
"dict",
"(",
")",
"if",
"self",
".",
"_use_can_corrections",
"and",
"self",
".",
"_can_chemical_formula",
"==",
"''",
":",
"issues",
"[",
"'CanChemicalFormula'",
... | https://github.com/mantidproject/mantid/blob/03deeb89254ec4289edb8771e0188c2090a02f32/Framework/PythonInterface/plugins/algorithms/WorkflowAlgorithms/IndirectFlatPlateAbsorption2.py#L394-L408 | |
SequoiaDB/SequoiaDB | 2894ed7e5bd6fe57330afc900cf76d0ff0df9f64 | tools/server/php_linux/libxml2/lib/python2.4/site-packages/libxml2.py | python | xmlTextReader.Close | (self) | return ret | This method releases any resources allocated by the current
instance changes the state to Closed and close any
underlying input. | This method releases any resources allocated by the current
instance changes the state to Closed and close any
underlying input. | [
"This",
"method",
"releases",
"any",
"resources",
"allocated",
"by",
"the",
"current",
"instance",
"changes",
"the",
"state",
"to",
"Closed",
"and",
"close",
"any",
"underlying",
"input",
"."
] | def Close(self):
"""This method releases any resources allocated by the current
instance changes the state to Closed and close any
underlying input. """
ret = libxml2mod.xmlTextReaderClose(self._o)
return ret | [
"def",
"Close",
"(",
"self",
")",
":",
"ret",
"=",
"libxml2mod",
".",
"xmlTextReaderClose",
"(",
"self",
".",
"_o",
")",
"return",
"ret"
] | https://github.com/SequoiaDB/SequoiaDB/blob/2894ed7e5bd6fe57330afc900cf76d0ff0df9f64/tools/server/php_linux/libxml2/lib/python2.4/site-packages/libxml2.py#L6498-L6503 | |
catboost/catboost | 167f64f237114a4d10b2b4ee42adb4569137debe | contrib/python/scipy/scipy/special/basic.py | python | lpn | (n, z) | return pn[:(n+1)], pd[:(n+1)] | Legendre functions of the first kind, Pn(z).
Compute sequence of Legendre functions of the first kind (polynomials),
Pn(z) and derivatives for all degrees from 0 to n (inclusive).
See also special.legendre for polynomial class.
References
----------
.. [1] Zhang, Shanjie and Jin, Jianming. "C... | Legendre functions of the first kind, Pn(z). | [
"Legendre",
"functions",
"of",
"the",
"first",
"kind",
"Pn",
"(",
"z",
")",
"."
] | def lpn(n, z):
"""Legendre functions of the first kind, Pn(z).
Compute sequence of Legendre functions of the first kind (polynomials),
Pn(z) and derivatives for all degrees from 0 to n (inclusive).
See also special.legendre for polynomial class.
References
----------
.. [1] Zhang, Shanjie... | [
"def",
"lpn",
"(",
"n",
",",
"z",
")",
":",
"if",
"not",
"(",
"isscalar",
"(",
"n",
")",
"and",
"isscalar",
"(",
"z",
")",
")",
":",
"raise",
"ValueError",
"(",
"\"arguments must be scalars.\"",
")",
"if",
"(",
"n",
"!=",
"floor",
"(",
"n",
")",
... | https://github.com/catboost/catboost/blob/167f64f237114a4d10b2b4ee42adb4569137debe/contrib/python/scipy/scipy/special/basic.py#L1590-L1617 | |
natanielruiz/android-yolo | 1ebb54f96a67a20ff83ddfc823ed83a13dc3a47f | jni-build/jni/include/tensorflow/contrib/learn/python/learn/datasets/text_datasets.py | python | maybe_download_dbpedia | (data_dir) | Download if DBpedia data is not present. | Download if DBpedia data is not present. | [
"Download",
"if",
"DBpedia",
"data",
"is",
"not",
"present",
"."
] | def maybe_download_dbpedia(data_dir):
"""Download if DBpedia data is not present."""
train_path = os.path.join(data_dir, 'dbpedia_csv/train.csv')
test_path = os.path.join(data_dir, 'dbpedia_csv/test.csv')
if not (gfile.Exists(train_path) and gfile.Exists(test_path)):
archive_path = base.maybe_download(
... | [
"def",
"maybe_download_dbpedia",
"(",
"data_dir",
")",
":",
"train_path",
"=",
"os",
".",
"path",
".",
"join",
"(",
"data_dir",
",",
"'dbpedia_csv/train.csv'",
")",
"test_path",
"=",
"os",
".",
"path",
".",
"join",
"(",
"data_dir",
",",
"'dbpedia_csv/test.csv'... | https://github.com/natanielruiz/android-yolo/blob/1ebb54f96a67a20ff83ddfc823ed83a13dc3a47f/jni-build/jni/include/tensorflow/contrib/learn/python/learn/datasets/text_datasets.py#L33-L41 | ||
LLNL/lbann | 26083e6c86050302ce33148aea70f62e61cacb92 | applications/nlp/transformer/subgraph/dataset.py | python | detokenize | (indices) | return text | Convert token indices to string.
Stops at the first EOS token. All other special tokens are
ignored. | Convert token indices to string. | [
"Convert",
"token",
"indices",
"to",
"string",
"."
] | def detokenize(indices):
"""Convert token indices to string.
Stops at the first EOS token. All other special tokens are
ignored.
"""
text = ''
for index in indices:
if index == eos_index:
break
elif index in (unk_index, bos_index, pad_index):
continue
... | [
"def",
"detokenize",
"(",
"indices",
")",
":",
"text",
"=",
"''",
"for",
"index",
"in",
"indices",
":",
"if",
"index",
"==",
"eos_index",
":",
"break",
"elif",
"index",
"in",
"(",
"unk_index",
",",
"bos_index",
",",
"pad_index",
")",
":",
"continue",
"... | https://github.com/LLNL/lbann/blob/26083e6c86050302ce33148aea70f62e61cacb92/applications/nlp/transformer/subgraph/dataset.py#L78-L93 | |
floooh/oryol | eb08cffe1b1cb6b05ed14ec692bca9372cef064e | fips-files/generators/util/png.py | python | Test.testPNMsbit | (self) | Test that PNM files can generates sBIT chunk. | Test that PNM files can generates sBIT chunk. | [
"Test",
"that",
"PNM",
"files",
"can",
"generates",
"sBIT",
"chunk",
"."
] | def testPNMsbit(self):
"""Test that PNM files can generates sBIT chunk."""
def do():
return _main(['testPNMsbit'])
s = BytesIO()
s.write(strtobytes('P6 8 1 1\n'))
for pixel in range(8):
s.write(struct.pack('<I', (0x4081*pixel)&0x10101)[:3])
s.flush... | [
"def",
"testPNMsbit",
"(",
"self",
")",
":",
"def",
"do",
"(",
")",
":",
"return",
"_main",
"(",
"[",
"'testPNMsbit'",
"]",
")",
"s",
"=",
"BytesIO",
"(",
")",
"s",
".",
"write",
"(",
"strtobytes",
"(",
"'P6 8 1 1\\n'",
")",
")",
"for",
"pixel",
"i... | https://github.com/floooh/oryol/blob/eb08cffe1b1cb6b05ed14ec692bca9372cef064e/fips-files/generators/util/png.py#L2578-L2592 | ||
MichalBusta/E2E-MLT | 2f0b54e31ebb414cd2daad824d7d474062ebe834 | data_gen.py | python | random_rotation | (img, word_gto) | return dst | for i in range(0, len(word_gto) - 1):
draw_box_points(dst, word_gto[i])
cv2.imshow('dst', dst)
cv2.waitKey(0) | for i in range(0, len(word_gto) - 1):
draw_box_points(dst, word_gto[i])
cv2.imshow('dst', dst)
cv2.waitKey(0) | [
"for",
"i",
"in",
"range",
"(",
"0",
"len",
"(",
"word_gto",
")",
"-",
"1",
")",
":",
"draw_box_points",
"(",
"dst",
"word_gto",
"[",
"i",
"]",
")",
"cv2",
".",
"imshow",
"(",
"dst",
"dst",
")",
"cv2",
".",
"waitKey",
"(",
"0",
")"
] | def random_rotation(img, word_gto):
center = (img.shape[1] / 2, img.shape[0] / 2)
angle = random.uniform(-1900, 1900) / 10
M = cv2.getRotationMatrix2D(center, angle, 1)
dst_size = (img.shape[1], img.shape[0])
dst = cv2.warpAffine(img, M, dst_size)
angle_rad = - angle * math.pi / 180
wor = np.copy(wo... | [
"def",
"random_rotation",
"(",
"img",
",",
"word_gto",
")",
":",
"center",
"=",
"(",
"img",
".",
"shape",
"[",
"1",
"]",
"/",
"2",
",",
"img",
".",
"shape",
"[",
"0",
"]",
"/",
"2",
")",
"angle",
"=",
"random",
".",
"uniform",
"(",
"-",
"1900",... | https://github.com/MichalBusta/E2E-MLT/blob/2f0b54e31ebb414cd2daad824d7d474062ebe834/data_gen.py#L151-L182 | |
aws/lumberyard | f85344403c1c2e77ec8c75deb2c116e97b713217 | dev/Gems/CloudGemFramework/v1/AWS/common-code/lib/cffi/api.py | python | FFI.string | (self, cdata, maxlen=-1) | return self._backend.string(cdata, maxlen) | Return a Python string (or unicode string) from the 'cdata'.
If 'cdata' is a pointer or array of characters or bytes, returns
the null-terminated string. The returned string extends until
the first null character, or at most 'maxlen' characters. If
'cdata' is an array then 'maxlen' def... | Return a Python string (or unicode string) from the 'cdata'.
If 'cdata' is a pointer or array of characters or bytes, returns
the null-terminated string. The returned string extends until
the first null character, or at most 'maxlen' characters. If
'cdata' is an array then 'maxlen' def... | [
"Return",
"a",
"Python",
"string",
"(",
"or",
"unicode",
"string",
")",
"from",
"the",
"cdata",
".",
"If",
"cdata",
"is",
"a",
"pointer",
"or",
"array",
"of",
"characters",
"or",
"bytes",
"returns",
"the",
"null",
"-",
"terminated",
"string",
".",
"The",... | def string(self, cdata, maxlen=-1):
"""Return a Python string (or unicode string) from the 'cdata'.
If 'cdata' is a pointer or array of characters or bytes, returns
the null-terminated string. The returned string extends until
the first null character, or at most 'maxlen' characters. I... | [
"def",
"string",
"(",
"self",
",",
"cdata",
",",
"maxlen",
"=",
"-",
"1",
")",
":",
"return",
"self",
".",
"_backend",
".",
"string",
"(",
"cdata",
",",
"maxlen",
")"
] | https://github.com/aws/lumberyard/blob/f85344403c1c2e77ec8c75deb2c116e97b713217/dev/Gems/CloudGemFramework/v1/AWS/common-code/lib/cffi/api.py#L302-L318 | |
catboost/catboost | 167f64f237114a4d10b2b4ee42adb4569137debe | contrib/python/numpy/py3/numpy/polynomial/legendre.py | python | leg2poly | (c) | Convert a Legendre series to a polynomial.
Convert an array representing the coefficients of a Legendre series,
ordered from lowest degree to highest, to an array of the coefficients
of the equivalent polynomial (relative to the "standard" basis) ordered
from lowest to highest degree.
Parameters
... | Convert a Legendre series to a polynomial. | [
"Convert",
"a",
"Legendre",
"series",
"to",
"a",
"polynomial",
"."
] | def leg2poly(c):
"""
Convert a Legendre series to a polynomial.
Convert an array representing the coefficients of a Legendre series,
ordered from lowest degree to highest, to an array of the coefficients
of the equivalent polynomial (relative to the "standard" basis) ordered
from lowest to high... | [
"def",
"leg2poly",
"(",
"c",
")",
":",
"from",
".",
"polynomial",
"import",
"polyadd",
",",
"polysub",
",",
"polymulx",
"[",
"c",
"]",
"=",
"pu",
".",
"as_series",
"(",
"[",
"c",
"]",
")",
"n",
"=",
"len",
"(",
"c",
")",
"if",
"n",
"<",
"3",
... | https://github.com/catboost/catboost/blob/167f64f237114a4d10b2b4ee42adb4569137debe/contrib/python/numpy/py3/numpy/polynomial/legendre.py#L148-L207 | ||
thalium/icebox | 99d147d5b9269222225443ce171b4fd46d8985d4 | third_party/virtualbox/src/VBox/ValidationKit/common/utils.py | python | _sudoFixArguments | (aPositionalArgs, dKeywordArgs, fInitialEnv = True) | return None | Adds 'sudo' (or similar) to the args parameter, whereever it is. | Adds 'sudo' (or similar) to the args parameter, whereever it is. | [
"Adds",
"sudo",
"(",
"or",
"similar",
")",
"to",
"the",
"args",
"parameter",
"whereever",
"it",
"is",
"."
] | def _sudoFixArguments(aPositionalArgs, dKeywordArgs, fInitialEnv = True):
"""
Adds 'sudo' (or similar) to the args parameter, whereever it is.
"""
# Are we root?
fIsRoot = True;
try:
fIsRoot = os.getuid() == 0; # pylint: disable=E1101
except:
pass;
# If not, prepend sud... | [
"def",
"_sudoFixArguments",
"(",
"aPositionalArgs",
",",
"dKeywordArgs",
",",
"fInitialEnv",
"=",
"True",
")",
":",
"# Are we root?",
"fIsRoot",
"=",
"True",
"try",
":",
"fIsRoot",
"=",
"os",
".",
"getuid",
"(",
")",
"==",
"0",
"# pylint: disable=E1101",
"exce... | https://github.com/thalium/icebox/blob/99d147d5b9269222225443ce171b4fd46d8985d4/third_party/virtualbox/src/VBox/ValidationKit/common/utils.py#L599-L643 | |
alexozer/jankdrone | c4b403eb254b41b832ab2bdfade12ba59c99e5dc | drone/lib/nanopb/generator/nanopb_generator.py | python | ExtensionField.tags | (self) | return '#define %-40s %d\n' % (identifier, self.tag) | Return the #define for the tag number of this field. | Return the #define for the tag number of this field. | [
"Return",
"the",
"#define",
"for",
"the",
"tag",
"number",
"of",
"this",
"field",
"."
] | def tags(self):
'''Return the #define for the tag number of this field.'''
identifier = '%s_tag' % self.fullname
return '#define %-40s %d\n' % (identifier, self.tag) | [
"def",
"tags",
"(",
"self",
")",
":",
"identifier",
"=",
"'%s_tag'",
"%",
"self",
".",
"fullname",
"return",
"'#define %-40s %d\\n'",
"%",
"(",
"identifier",
",",
"self",
".",
"tag",
")"
] | https://github.com/alexozer/jankdrone/blob/c4b403eb254b41b832ab2bdfade12ba59c99e5dc/drone/lib/nanopb/generator/nanopb_generator.py#L652-L655 | |
apache/incubator-mxnet | f03fb23f1d103fec9541b5ae59ee06b1734a51d9 | python/mxnet/ndarray/random.py | python | multinomial | (n=[1], p=[[1.0]], shape=_Null, dtype='float32', ctx=None, out=None, **kwargs) | return _internal._sample_multinomial(n, p, shape=shape, out=out, ctx=ctx, dtype=dtype, **kwargs) | Concurrent sampling from multiple multinomial distributions.
.. note:: The input distribution must be normalized, i.e. `p` must sum to
1 along its last dimension.
Parameters
----------
n : NDArray
An *n* dimensional array containing the number of trials of each
multinomia... | Concurrent sampling from multiple multinomial distributions. | [
"Concurrent",
"sampling",
"from",
"multiple",
"multinomial",
"distributions",
"."
] | def multinomial(n=[1], p=[[1.0]], shape=_Null, dtype='float32', ctx=None, out=None, **kwargs):
"""Concurrent sampling from multiple multinomial distributions.
.. note:: The input distribution must be normalized, i.e. `p` must sum to
1 along its last dimension.
Parameters
----------
n... | [
"def",
"multinomial",
"(",
"n",
"=",
"[",
"1",
"]",
",",
"p",
"=",
"[",
"[",
"1.0",
"]",
"]",
",",
"shape",
"=",
"_Null",
",",
"dtype",
"=",
"'float32'",
",",
"ctx",
"=",
"None",
",",
"out",
"=",
"None",
",",
"*",
"*",
"kwargs",
")",
":",
"... | https://github.com/apache/incubator-mxnet/blob/f03fb23f1d103fec9541b5ae59ee06b1734a51d9/python/mxnet/ndarray/random.py#L617-L670 | |
ApolloAuto/apollo-platform | 86d9dc6743b496ead18d597748ebabd34a513289 | ros/third_party/lib_x86_64/python2.7/dist-packages/numpy/lib/function_base.py | python | trim_zeros | (filt, trim='fb') | return filt[first:last] | Trim the leading and/or trailing zeros from a 1-D array or sequence.
Parameters
----------
filt : 1-D array or sequence
Input array.
trim : str, optional
A string with 'f' representing trim from front and 'b' to trim from
back. Default is 'fb', trim zeros from both front and bac... | Trim the leading and/or trailing zeros from a 1-D array or sequence. | [
"Trim",
"the",
"leading",
"and",
"/",
"or",
"trailing",
"zeros",
"from",
"a",
"1",
"-",
"D",
"array",
"or",
"sequence",
"."
] | def trim_zeros(filt, trim='fb'):
"""
Trim the leading and/or trailing zeros from a 1-D array or sequence.
Parameters
----------
filt : 1-D array or sequence
Input array.
trim : str, optional
A string with 'f' representing trim from front and 'b' to trim from
back. Defaul... | [
"def",
"trim_zeros",
"(",
"filt",
",",
"trim",
"=",
"'fb'",
")",
":",
"first",
"=",
"0",
"trim",
"=",
"trim",
".",
"upper",
"(",
")",
"if",
"'F'",
"in",
"trim",
":",
"for",
"i",
"in",
"filt",
":",
"if",
"i",
"!=",
"0.",
":",
"break",
"else",
... | https://github.com/ApolloAuto/apollo-platform/blob/86d9dc6743b496ead18d597748ebabd34a513289/ros/third_party/lib_x86_64/python2.7/dist-packages/numpy/lib/function_base.py#L1211-L1255 | |
adobe/chromium | cfe5bf0b51b1f6b9fe239c2a3c2f2364da9967d7 | native_client_sdk/src/build_tools/nacl_sdk_scons/site_tools/nacl_tools.py | python | NaClProgram | (env, target, sources, variant_dir='obj') | return env.Program(target, program_objects) | Add a Program to env that builds its objects in the directory specified
by |variant_dir|.
This is slightly different than VariantDir() in that the sources can live in
the same directory as the calling SConscript file.
Args:
env: Environment to modify.
target: The target name that depends on the object... | Add a Program to env that builds its objects in the directory specified
by |variant_dir|. | [
"Add",
"a",
"Program",
"to",
"env",
"that",
"builds",
"its",
"objects",
"in",
"the",
"directory",
"specified",
"by",
"|variant_dir|",
"."
] | def NaClProgram(env, target, sources, variant_dir='obj'):
'''Add a Program to env that builds its objects in the directory specified
by |variant_dir|.
This is slightly different than VariantDir() in that the sources can live in
the same directory as the calling SConscript file.
Args:
env: Environment to... | [
"def",
"NaClProgram",
"(",
"env",
",",
"target",
",",
"sources",
",",
"variant_dir",
"=",
"'obj'",
")",
":",
"program_objects",
"=",
"[",
"]",
"for",
"src_file",
"in",
"sources",
":",
"obj_file",
"=",
"os",
".",
"path",
".",
"splitext",
"(",
"src_file",
... | https://github.com/adobe/chromium/blob/cfe5bf0b51b1f6b9fe239c2a3c2f2364da9967d7/native_client_sdk/src/build_tools/nacl_sdk_scons/site_tools/nacl_tools.py#L99-L124 | |
catboost/catboost | 167f64f237114a4d10b2b4ee42adb4569137debe | contrib/python/setuptools/py2/pkg_resources/__init__.py | python | IResourceProvider.resource_listdir | (resource_name) | List of resource names in the directory (like ``os.listdir()``) | List of resource names in the directory (like ``os.listdir()``) | [
"List",
"of",
"resource",
"names",
"in",
"the",
"directory",
"(",
"like",
"os",
".",
"listdir",
"()",
")"
] | def resource_listdir(resource_name):
"""List of resource names in the directory (like ``os.listdir()``)""" | [
"def",
"resource_listdir",
"(",
"resource_name",
")",
":"
] | https://github.com/catboost/catboost/blob/167f64f237114a4d10b2b4ee42adb4569137debe/contrib/python/setuptools/py2/pkg_resources/__init__.py#L549-L550 | ||
gimli-org/gimli | 17aa2160de9b15ababd9ef99e89b1bc3277bbb23 | pygimli/physics/sNMR/mrsprofile.py | python | MRSprofile.showModel | (self, showFit=0, cmap=Spectral, figsize=(13, 12),
wlim=(0, 0.5), tlim=(0.05, 0.5)) | return fig, ax | Show 2d model as stitched 1d models along with fit. | Show 2d model as stitched 1d models along with fit. | [
"Show",
"2d",
"model",
"as",
"stitched",
"1d",
"models",
"along",
"with",
"fit",
"."
] | def showModel(self, showFit=0, cmap=Spectral, figsize=(13, 12),
wlim=(0, 0.5), tlim=(0.05, 0.5)):
"""Show 2d model as stitched 1d models along with fit."""
fig, ax = plt.subplots(nrows=2+showFit, figsize=figsize, sharex=True)
self.showWC(wlim, ax=ax[-2], cmap=cmap)
self... | [
"def",
"showModel",
"(",
"self",
",",
"showFit",
"=",
"0",
",",
"cmap",
"=",
"Spectral",
",",
"figsize",
"=",
"(",
"13",
",",
"12",
")",
",",
"wlim",
"=",
"(",
"0",
",",
"0.5",
")",
",",
"tlim",
"=",
"(",
"0.05",
",",
"0.5",
")",
")",
":",
... | https://github.com/gimli-org/gimli/blob/17aa2160de9b15ababd9ef99e89b1bc3277bbb23/pygimli/physics/sNMR/mrsprofile.py#L416-L433 | |
root-project/root | fcd3583bb14852bf2e8cd2415717cbaac0e75896 | interpreter/llvm/src/tools/clang/bindings/python/clang/cindex.py | python | CompileCommand.directory | (self) | return conf.lib.clang_CompileCommand_getDirectory(self.cmd) | Get the working directory for this CompileCommand | Get the working directory for this CompileCommand | [
"Get",
"the",
"working",
"directory",
"for",
"this",
"CompileCommand"
] | def directory(self):
"""Get the working directory for this CompileCommand"""
return conf.lib.clang_CompileCommand_getDirectory(self.cmd) | [
"def",
"directory",
"(",
"self",
")",
":",
"return",
"conf",
".",
"lib",
".",
"clang_CompileCommand_getDirectory",
"(",
"self",
".",
"cmd",
")"
] | https://github.com/root-project/root/blob/fcd3583bb14852bf2e8cd2415717cbaac0e75896/interpreter/llvm/src/tools/clang/bindings/python/clang/cindex.py#L3178-L3180 | |
baidu-research/tensorflow-allreduce | 66d5b855e90b0949e9fa5cca5599fd729a70e874 | tensorflow/contrib/metrics/python/ops/histogram_ops.py | python | _strict_conv1d | (x, h) | Return x * h for rank 1 tensors x and h. | Return x * h for rank 1 tensors x and h. | [
"Return",
"x",
"*",
"h",
"for",
"rank",
"1",
"tensors",
"x",
"and",
"h",
"."
] | def _strict_conv1d(x, h):
"""Return x * h for rank 1 tensors x and h."""
with ops.name_scope('strict_conv1d', values=[x, h]):
x = array_ops.reshape(x, (1, -1, 1, 1))
h = array_ops.reshape(h, (-1, 1, 1, 1))
result = nn_ops.conv2d(x, h, [1, 1, 1, 1], 'SAME')
return array_ops.reshape(result, [-1]) | [
"def",
"_strict_conv1d",
"(",
"x",
",",
"h",
")",
":",
"with",
"ops",
".",
"name_scope",
"(",
"'strict_conv1d'",
",",
"values",
"=",
"[",
"x",
",",
"h",
"]",
")",
":",
"x",
"=",
"array_ops",
".",
"reshape",
"(",
"x",
",",
"(",
"1",
",",
"-",
"1... | https://github.com/baidu-research/tensorflow-allreduce/blob/66d5b855e90b0949e9fa5cca5599fd729a70e874/tensorflow/contrib/metrics/python/ops/histogram_ops.py#L237-L243 | ||
OAID/Caffe-HRT | aae71e498ab842c6f92bcc23fc668423615a4d65 | scripts/cpp_lint.py | python | _NestingState.UpdatePreprocessor | (self, line) | Update preprocessor stack.
We need to handle preprocessors due to classes like this:
#ifdef SWIG
struct ResultDetailsPageElementExtensionPoint {
#else
struct ResultDetailsPageElementExtensionPoint : public Extension {
#endif
We make the following assumptions (good enough for most... | Update preprocessor stack. | [
"Update",
"preprocessor",
"stack",
"."
] | def UpdatePreprocessor(self, line):
"""Update preprocessor stack.
We need to handle preprocessors due to classes like this:
#ifdef SWIG
struct ResultDetailsPageElementExtensionPoint {
#else
struct ResultDetailsPageElementExtensionPoint : public Extension {
#endif
We make the ... | [
"def",
"UpdatePreprocessor",
"(",
"self",
",",
"line",
")",
":",
"if",
"Match",
"(",
"r'^\\s*#\\s*(if|ifdef|ifndef)\\b'",
",",
"line",
")",
":",
"# Beginning of #if block, save the nesting stack here. The saved",
"# stack will allow us to restore the parsing state in the #else cas... | https://github.com/OAID/Caffe-HRT/blob/aae71e498ab842c6f92bcc23fc668423615a4d65/scripts/cpp_lint.py#L1948-L2002 | ||
aws/lumberyard | f85344403c1c2e77ec8c75deb2c116e97b713217 | dev/Tools/Python/3.7.10/windows/Lib/distutils/msvc9compiler.py | python | Reg.read_values | (cls, base, key) | return d | Return dict of registry keys and values.
All names are converted to lowercase. | Return dict of registry keys and values. | [
"Return",
"dict",
"of",
"registry",
"keys",
"and",
"values",
"."
] | def read_values(cls, base, key):
"""Return dict of registry keys and values.
All names are converted to lowercase.
"""
try:
handle = RegOpenKeyEx(base, key)
except RegError:
return None
d = {}
i = 0
while True:
try:
... | [
"def",
"read_values",
"(",
"cls",
",",
"base",
",",
"key",
")",
":",
"try",
":",
"handle",
"=",
"RegOpenKeyEx",
"(",
"base",
",",
"key",
")",
"except",
"RegError",
":",
"return",
"None",
"d",
"=",
"{",
"}",
"i",
"=",
"0",
"while",
"True",
":",
"t... | https://github.com/aws/lumberyard/blob/f85344403c1c2e77ec8c75deb2c116e97b713217/dev/Tools/Python/3.7.10/windows/Lib/distutils/msvc9compiler.py#L90-L109 | |
apple/swift-lldb | d74be846ef3e62de946df343e8c234bde93a8912 | utils/vim-lldb/python-vim-lldb/import_lldb.py | python | import_lldb | () | return False | Find and import the lldb modules. This function tries to find the lldb module by:
1. Simply by doing "import lldb" in case the system python installation is aware of lldb. If that fails,
2. Executes the lldb executable pointed to by the LLDB environment variable (or if unset, the first lldb
o... | Find and import the lldb modules. This function tries to find the lldb module by:
1. Simply by doing "import lldb" in case the system python installation is aware of lldb. If that fails,
2. Executes the lldb executable pointed to by the LLDB environment variable (or if unset, the first lldb
o... | [
"Find",
"and",
"import",
"the",
"lldb",
"modules",
".",
"This",
"function",
"tries",
"to",
"find",
"the",
"lldb",
"module",
"by",
":",
"1",
".",
"Simply",
"by",
"doing",
"import",
"lldb",
"in",
"case",
"the",
"system",
"python",
"installation",
"is",
"aw... | def import_lldb():
""" Find and import the lldb modules. This function tries to find the lldb module by:
1. Simply by doing "import lldb" in case the system python installation is aware of lldb. If that fails,
2. Executes the lldb executable pointed to by the LLDB environment variable (or if unset, ... | [
"def",
"import_lldb",
"(",
")",
":",
"# Try simple 'import lldb', in case of a system-wide install or a",
"# pre-configured PYTHONPATH",
"try",
":",
"import",
"lldb",
"return",
"True",
"except",
"ImportError",
":",
"pass",
"# Allow overriding default path to lldb executable with th... | https://github.com/apple/swift-lldb/blob/d74be846ef3e62de946df343e8c234bde93a8912/utils/vim-lldb/python-vim-lldb/import_lldb.py#L8-L65 | |
apple/turicreate | cce55aa5311300e3ce6af93cb45ba791fd1bdf49 | src/external/coremltools_wrap/coremltools/coremltools/converters/_converters_entry.py | python | convert | (
model,
source="auto",
inputs=None,
outputs=None,
classifier_config=None,
minimum_deployment_target=None,
**kwargs
) | return model | Convert TensorFlow or Pytorch models to Core ML model format. Whether a
parameter is required may differ between frameworks (see below). Note that
this function is aliased as `ct.convert` in the tutorials.
Parameters
----------
model:
TensorFlow 1, TensorFlow 2 or Pytorch model in one of th... | Convert TensorFlow or Pytorch models to Core ML model format. Whether a
parameter is required may differ between frameworks (see below). Note that
this function is aliased as `ct.convert` in the tutorials. | [
"Convert",
"TensorFlow",
"or",
"Pytorch",
"models",
"to",
"Core",
"ML",
"model",
"format",
".",
"Whether",
"a",
"parameter",
"is",
"required",
"may",
"differ",
"between",
"frameworks",
"(",
"see",
"below",
")",
".",
"Note",
"that",
"this",
"function",
"is",
... | def convert(
model,
source="auto",
inputs=None,
outputs=None,
classifier_config=None,
minimum_deployment_target=None,
**kwargs
):
"""
Convert TensorFlow or Pytorch models to Core ML model format. Whether a
parameter is required may differ between frameworks (see below). Note that... | [
"def",
"convert",
"(",
"model",
",",
"source",
"=",
"\"auto\"",
",",
"inputs",
"=",
"None",
",",
"outputs",
"=",
"None",
",",
"classifier_config",
"=",
"None",
",",
"minimum_deployment_target",
"=",
"None",
",",
"*",
"*",
"kwargs",
")",
":",
"if",
"minim... | https://github.com/apple/turicreate/blob/cce55aa5311300e3ce6af93cb45ba791fd1bdf49/src/external/coremltools_wrap/coremltools/coremltools/converters/_converters_entry.py#L35-L339 | |
netket/netket | 0d534e54ecbf25b677ea72af6b85947979420652 | netket/hilbert/tensor_hilbert.py | python | TensorHilbert.__init__ | (self, *hilb_spaces: DiscreteHilbert) | r"""Constructs a tensor Hilbert space
Args:
*hilb: An iterable object containing at least 1 hilbert space. | r"""Constructs a tensor Hilbert space | [
"r",
"Constructs",
"a",
"tensor",
"Hilbert",
"space"
] | def __init__(self, *hilb_spaces: DiscreteHilbert):
r"""Constructs a tensor Hilbert space
Args:
*hilb: An iterable object containing at least 1 hilbert space.
"""
self._hilbert_spaces = hilb_spaces
self._n_hilbert_spaces = len(hilb_spaces)
self._hilbert_i = n... | [
"def",
"__init__",
"(",
"self",
",",
"*",
"hilb_spaces",
":",
"DiscreteHilbert",
")",
":",
"self",
".",
"_hilbert_spaces",
"=",
"hilb_spaces",
"self",
".",
"_n_hilbert_spaces",
"=",
"len",
"(",
"hilb_spaces",
")",
"self",
".",
"_hilbert_i",
"=",
"np",
".",
... | https://github.com/netket/netket/blob/0d534e54ecbf25b677ea72af6b85947979420652/netket/hilbert/tensor_hilbert.py#L44-L76 | ||
aws/lumberyard | f85344403c1c2e77ec8c75deb2c116e97b713217 | dev/Gems/CloudGemMetric/v1/AWS/common-code/Lib/numpy/lib/histograms.py | python | _get_outer_edges | (a, range) | return first_edge, last_edge | Determine the outer bin edges to use, from either the data or the range
argument | Determine the outer bin edges to use, from either the data or the range
argument | [
"Determine",
"the",
"outer",
"bin",
"edges",
"to",
"use",
"from",
"either",
"the",
"data",
"or",
"the",
"range",
"argument"
] | def _get_outer_edges(a, range):
"""
Determine the outer bin edges to use, from either the data or the range
argument
"""
if range is not None:
first_edge, last_edge = range
if first_edge > last_edge:
raise ValueError(
'max must be larger than min in range ... | [
"def",
"_get_outer_edges",
"(",
"a",
",",
"range",
")",
":",
"if",
"range",
"is",
"not",
"None",
":",
"first_edge",
",",
"last_edge",
"=",
"range",
"if",
"first_edge",
">",
"last_edge",
":",
"raise",
"ValueError",
"(",
"'max must be larger than min in range para... | https://github.com/aws/lumberyard/blob/f85344403c1c2e77ec8c75deb2c116e97b713217/dev/Gems/CloudGemMetric/v1/AWS/common-code/Lib/numpy/lib/histograms.py#L307-L334 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.