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 |
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
tensorflow/tensorflow | 419e3a6b650ea4bd1b0cba23c4348f8a69f3272e | tensorflow/python/saved_model/load_v1_in_v2.py | python | _EagerSavedModelLoader.restore_variables | (self, wrapped, restore_from_saver) | Restores variables from the checkpoint. | Restores variables from the checkpoint. | [
"Restores",
"variables",
"from",
"the",
"checkpoint",
"."
] | def restore_variables(self, wrapped, restore_from_saver):
"""Restores variables from the checkpoint."""
if restore_from_saver is not None:
initializer, _ = restore_from_saver(
constant_op.constant(self._variables_path))
if not ops.executing_eagerly_outside_functions():
# Add the in... | [
"def",
"restore_variables",
"(",
"self",
",",
"wrapped",
",",
"restore_from_saver",
")",
":",
"if",
"restore_from_saver",
"is",
"not",
"None",
":",
"initializer",
",",
"_",
"=",
"restore_from_saver",
"(",
"constant_op",
".",
"constant",
"(",
"self",
".",
"_var... | https://github.com/tensorflow/tensorflow/blob/419e3a6b650ea4bd1b0cba23c4348f8a69f3272e/tensorflow/python/saved_model/load_v1_in_v2.py#L110-L133 | ||
psi4/psi4 | be533f7f426b6ccc263904e55122899b16663395 | psi4/driver/qcdb/libmintsmolecule.py | python | LibmintsMolecule.input_units_to_au | (self) | return self.PYinput_units_to_au | Gets the geometry unit conversion. | Gets the geometry unit conversion. | [
"Gets",
"the",
"geometry",
"unit",
"conversion",
"."
] | def input_units_to_au(self):
"""Gets the geometry unit conversion."""
return self.PYinput_units_to_au | [
"def",
"input_units_to_au",
"(",
"self",
")",
":",
"return",
"self",
".",
"PYinput_units_to_au"
] | https://github.com/psi4/psi4/blob/be533f7f426b6ccc263904e55122899b16663395/psi4/driver/qcdb/libmintsmolecule.py#L330-L332 | |
wxWidgets/wxPython-Classic | 19571e1ae65f1ac445f5491474121998c97a1bf0 | src/osx_carbon/propgrid.py | python | PGProperty.SetWasModified | (*args, **kwargs) | return _propgrid.PGProperty_SetWasModified(*args, **kwargs) | SetWasModified(self, bool set=True) | SetWasModified(self, bool set=True) | [
"SetWasModified",
"(",
"self",
"bool",
"set",
"=",
"True",
")"
] | def SetWasModified(*args, **kwargs):
"""SetWasModified(self, bool set=True)"""
return _propgrid.PGProperty_SetWasModified(*args, **kwargs) | [
"def",
"SetWasModified",
"(",
"*",
"args",
",",
"*",
"*",
"kwargs",
")",
":",
"return",
"_propgrid",
".",
"PGProperty_SetWasModified",
"(",
"*",
"args",
",",
"*",
"*",
"kwargs",
")"
] | https://github.com/wxWidgets/wxPython-Classic/blob/19571e1ae65f1ac445f5491474121998c97a1bf0/src/osx_carbon/propgrid.py#L783-L785 | |
ApolloAuto/apollo-platform | 86d9dc6743b496ead18d597748ebabd34a513289 | ros/third_party/lib_aarch64/python2.7/dist-packages/rospkg/manifest.py | python | _check_platform | (n, filename) | return [Platform(*v) for v in vals] | Validator for manifest platform.
:raise: :exc:`InvalidManifest` If validation fails | Validator for manifest platform.
:raise: :exc:`InvalidManifest` If validation fails | [
"Validator",
"for",
"manifest",
"platform",
".",
":",
"raise",
":",
":",
"exc",
":",
"InvalidManifest",
"If",
"validation",
"fails"
] | def _check_platform(n, filename):
"""
Validator for manifest platform.
:raise: :exc:`InvalidManifest` If validation fails
"""
platforms = _get_nodes_by_name(n, 'platform')
try:
vals = [(p.attributes['os'].value, p.attributes['version'].value, p.getAttribute('notes')) for p in platforms]
... | [
"def",
"_check_platform",
"(",
"n",
",",
"filename",
")",
":",
"platforms",
"=",
"_get_nodes_by_name",
"(",
"n",
",",
"'platform'",
")",
"try",
":",
"vals",
"=",
"[",
"(",
"p",
".",
"attributes",
"[",
"'os'",
"]",
".",
"value",
",",
"p",
".",
"attrib... | https://github.com/ApolloAuto/apollo-platform/blob/86d9dc6743b496ead18d597748ebabd34a513289/ros/third_party/lib_aarch64/python2.7/dist-packages/rospkg/manifest.py#L100-L110 | |
twtygqyy/caffe-augmentation | c76600d247e5132fa5bd89d87bb5df458341fa84 | tools/extra/resize_and_crop_images.py | python | OpenCVResizeCrop.resize_and_crop_image | (self, input_file, output_file, output_side_length = 256) | Takes an image name, resize it and crop the center square | Takes an image name, resize it and crop the center square | [
"Takes",
"an",
"image",
"name",
"resize",
"it",
"and",
"crop",
"the",
"center",
"square"
] | def resize_and_crop_image(self, input_file, output_file, output_side_length = 256):
'''Takes an image name, resize it and crop the center square
'''
img = cv2.imread(input_file)
height, width, depth = img.shape
new_height = output_side_length
new_width = output_side_lengt... | [
"def",
"resize_and_crop_image",
"(",
"self",
",",
"input_file",
",",
"output_file",
",",
"output_side_length",
"=",
"256",
")",
":",
"img",
"=",
"cv2",
".",
"imread",
"(",
"input_file",
")",
"height",
",",
"width",
",",
"depth",
"=",
"img",
".",
"shape",
... | https://github.com/twtygqyy/caffe-augmentation/blob/c76600d247e5132fa5bd89d87bb5df458341fa84/tools/extra/resize_and_crop_images.py#L20-L36 | ||
luliyucoordinate/Leetcode | 96afcdc54807d1d184e881a075d1dbf3371e31fb | src/0279-Perfect-Squares/0279.py | python | Solution.numSquares | (self, n) | return 3 | :type n: int
:rtype: int | :type n: int
:rtype: int | [
":",
"type",
"n",
":",
"int",
":",
"rtype",
":",
"int"
] | def numSquares(self, n):
"""
:type n: int
:rtype: int
"""
while n % 4 == 0:
n /= 4
if n % 8 == 7:
return 4
a = 0
while a**2 <= n:
b = int((n - a**2)**0.5)
if a**2 + b**2 == n:
retur... | [
"def",
"numSquares",
"(",
"self",
",",
"n",
")",
":",
"while",
"n",
"%",
"4",
"==",
"0",
":",
"n",
"/=",
"4",
"if",
"n",
"%",
"8",
"==",
"7",
":",
"return",
"4",
"a",
"=",
"0",
"while",
"a",
"**",
"2",
"<=",
"n",
":",
"b",
"=",
"int",
"... | https://github.com/luliyucoordinate/Leetcode/blob/96afcdc54807d1d184e881a075d1dbf3371e31fb/src/0279-Perfect-Squares/0279.py#L2-L21 | |
aws/lumberyard | f85344403c1c2e77ec8c75deb2c116e97b713217 | dev/Gems/CloudGemMetric/v1/AWS/python/windows/Lib/numpy/lib/scimath.py | python | arccos | (x) | return nx.arccos(x) | Compute the inverse cosine of x.
Return the "principal value" (for a description of this, see
`numpy.arccos`) of the inverse cosine of `x`. For real `x` such that
`abs(x) <= 1`, this is a real number in the closed interval
:math:`[0, \\pi]`. Otherwise, the complex principle value is returned.
Par... | Compute the inverse cosine of x. | [
"Compute",
"the",
"inverse",
"cosine",
"of",
"x",
"."
] | def arccos(x):
"""
Compute the inverse cosine of x.
Return the "principal value" (for a description of this, see
`numpy.arccos`) of the inverse cosine of `x`. For real `x` such that
`abs(x) <= 1`, this is a real number in the closed interval
:math:`[0, \\pi]`. Otherwise, the complex principle ... | [
"def",
"arccos",
"(",
"x",
")",
":",
"x",
"=",
"_fix_real_abs_gt_1",
"(",
"x",
")",
"return",
"nx",
".",
"arccos",
"(",
"x",
")"
] | https://github.com/aws/lumberyard/blob/f85344403c1c2e77ec8c75deb2c116e97b713217/dev/Gems/CloudGemMetric/v1/AWS/python/windows/Lib/numpy/lib/scimath.py#L465-L506 | |
mantidproject/mantid | 03deeb89254ec4289edb8771e0188c2090a02f32 | qt/python/mantidqtinterfaces/mantidqtinterfaces/drill/view/DrillExportDialog.py | python | DrillExportDialog.getAlgorithmCheckStates | (self) | return {a:w.isChecked() for a,w in self._widgets.items()} | Get the check state of algorithms.
Returns:
dict(str:bool): for each algorithm name, a bool to set its check
state | Get the check state of algorithms. | [
"Get",
"the",
"check",
"state",
"of",
"algorithms",
"."
] | def getAlgorithmCheckStates(self):
"""
Get the check state of algorithms.
Returns:
dict(str:bool): for each algorithm name, a bool to set its check
state
"""
return {a:w.isChecked() for a,w in self._widgets.items()} | [
"def",
"getAlgorithmCheckStates",
"(",
"self",
")",
":",
"return",
"{",
"a",
":",
"w",
".",
"isChecked",
"(",
")",
"for",
"a",
",",
"w",
"in",
"self",
".",
"_widgets",
".",
"items",
"(",
")",
"}"
] | https://github.com/mantidproject/mantid/blob/03deeb89254ec4289edb8771e0188c2090a02f32/qt/python/mantidqtinterfaces/mantidqtinterfaces/drill/view/DrillExportDialog.py#L100-L108 | |
mandiant/flare-wmi | b0a5a094ff9ca7d7a1c4fc711dc00c74dec4b6b1 | python-cim/cim/objects.py | python | ClassDefinition.keys | (self) | return ret | get names of Key properties for instances
:rtype: str | get names of Key properties for instances | [
"get",
"names",
"of",
"Key",
"properties",
"for",
"instances"
] | def keys(self):
"""
get names of Key properties for instances
:rtype: str
"""
ret = []
for propname, prop in self.properties.items():
for k, v in prop.qualifiers.items():
# TODO: don't hardcode BUILTIN_QUALIFIERS.PROP_KEY symbol name
... | [
"def",
"keys",
"(",
"self",
")",
":",
"ret",
"=",
"[",
"]",
"for",
"propname",
",",
"prop",
"in",
"self",
".",
"properties",
".",
"items",
"(",
")",
":",
"for",
"k",
",",
"v",
"in",
"prop",
".",
"qualifiers",
".",
"items",
"(",
")",
":",
"# TOD... | https://github.com/mandiant/flare-wmi/blob/b0a5a094ff9ca7d7a1c4fc711dc00c74dec4b6b1/python-cim/cim/objects.py#L615-L627 | |
wlanjie/AndroidFFmpeg | 7baf9122f4b8e1c74e7baf4be5c422c7a5ba5aaf | tools/fdk-aac-build/armeabi/toolchain/lib/python2.7/robotparser.py | python | RobotFileParser.parse | (self, lines) | parse the input lines from a robots.txt file.
We allow that a user-agent: line is not preceded by
one or more blank lines. | parse the input lines from a robots.txt file.
We allow that a user-agent: line is not preceded by
one or more blank lines. | [
"parse",
"the",
"input",
"lines",
"from",
"a",
"robots",
".",
"txt",
"file",
".",
"We",
"allow",
"that",
"a",
"user",
"-",
"agent",
":",
"line",
"is",
"not",
"preceded",
"by",
"one",
"or",
"more",
"blank",
"lines",
"."
] | def parse(self, lines):
"""parse the input lines from a robots.txt file.
We allow that a user-agent: line is not preceded by
one or more blank lines."""
# states:
# 0: start state
# 1: saw user-agent line
# 2: saw an allow or disallow line
stat... | [
"def",
"parse",
"(",
"self",
",",
"lines",
")",
":",
"# states:",
"# 0: start state",
"# 1: saw user-agent line",
"# 2: saw an allow or disallow line",
"state",
"=",
"0",
"linenumber",
"=",
"0",
"entry",
"=",
"Entry",
"(",
")",
"for",
"line",
"in",
"lines",
... | https://github.com/wlanjie/AndroidFFmpeg/blob/7baf9122f4b8e1c74e7baf4be5c422c7a5ba5aaf/tools/fdk-aac-build/armeabi/toolchain/lib/python2.7/robotparser.py#L77-L125 | ||
wesnoth/wesnoth | 6ccac5a5e8ff75303c9190c0da60580925cb32c0 | data/tools/wesnoth/wmltools3.py | python | namespace_directory | (name) | Go from namespace to directory. | Go from namespace to directory. | [
"Go",
"from",
"namespace",
"to",
"directory",
"."
] | def namespace_directory(name):
"Go from namespace to directory."
if name == "core":
return "data/core/"
else:
return "data/campaigns/" + name + "/" | [
"def",
"namespace_directory",
"(",
"name",
")",
":",
"if",
"name",
"==",
"\"core\"",
":",
"return",
"\"data/core/\"",
"else",
":",
"return",
"\"data/campaigns/\"",
"+",
"name",
"+",
"\"/\""
] | https://github.com/wesnoth/wesnoth/blob/6ccac5a5e8ff75303c9190c0da60580925cb32c0/data/tools/wesnoth/wmltools3.py#L1079-L1084 | ||
lballabio/quantlib-old | 136336947ed4fea9ecc1da6edad188700e821739 | gensrc/gensrc/addins/addin.py | python | Addin.objectIdSuffix | (self) | return self.objectIdSuffix_ | Return the text which is appended to variable names
in autogenerated source code after object IDs are converted
to the corresponding objects. | Return the text which is appended to variable names
in autogenerated source code after object IDs are converted
to the corresponding objects. | [
"Return",
"the",
"text",
"which",
"is",
"appended",
"to",
"variable",
"names",
"in",
"autogenerated",
"source",
"code",
"after",
"object",
"IDs",
"are",
"converted",
"to",
"the",
"corresponding",
"objects",
"."
] | def objectIdSuffix(self):
"""Return the text which is appended to variable names
in autogenerated source code after object IDs are converted
to the corresponding objects."""
return self.objectIdSuffix_ | [
"def",
"objectIdSuffix",
"(",
"self",
")",
":",
"return",
"self",
".",
"objectIdSuffix_"
] | https://github.com/lballabio/quantlib-old/blob/136336947ed4fea9ecc1da6edad188700e821739/gensrc/gensrc/addins/addin.py#L50-L54 | |
cms-sw/cmssw | fd9de012d503d3405420bcbeec0ec879baa57cf2 | Validation/RecoTrack/python/plotting/plotting.py | python | PlotGroup.draw | (self, legendLabels, prefix=None, separate=False, saveFormat=".pdf", ratio=True, directory="") | return self._save(canvas, saveFormat, prefix=prefix, directory=directory) | Draw the histograms using values for a given algorithm.
Arguments:
legendLabels -- List of strings for legend labels (corresponding to the tdirectories in create())
prefix -- Optional string for file name prefix (default None)
separate -- Save the plots of a group to separa... | Draw the histograms using values for a given algorithm. | [
"Draw",
"the",
"histograms",
"using",
"values",
"for",
"a",
"given",
"algorithm",
"."
] | def draw(self, legendLabels, prefix=None, separate=False, saveFormat=".pdf", ratio=True, directory=""):
"""Draw the histograms using values for a given algorithm.
Arguments:
legendLabels -- List of strings for legend labels (corresponding to the tdirectories in create())
prefix ... | [
"def",
"draw",
"(",
"self",
",",
"legendLabels",
",",
"prefix",
"=",
"None",
",",
"separate",
"=",
"False",
",",
"saveFormat",
"=",
"\".pdf\"",
",",
"ratio",
"=",
"True",
",",
"directory",
"=",
"\"\"",
")",
":",
"if",
"self",
".",
"_overrideLegendLabels"... | https://github.com/cms-sw/cmssw/blob/fd9de012d503d3405420bcbeec0ec879baa57cf2/Validation/RecoTrack/python/plotting/plotting.py#L2337-L2412 | |
fatih/subvim | 241b6d170597857105da219c9b7d36059e9f11fb | vim/base/YouCompleteMe/third_party/jedi/jedi/parser/fast.py | python | FastParser._scan_user_scope | (self, sub_module) | return None | Scan with self.user_position. | Scan with self.user_position. | [
"Scan",
"with",
"self",
".",
"user_position",
"."
] | def _scan_user_scope(self, sub_module):
""" Scan with self.user_position. """
for scope in sub_module.statements + sub_module.subscopes:
if isinstance(scope, pr.Scope):
if scope.start_pos <= self.user_position <= scope.end_pos:
return self._scan_user_scope... | [
"def",
"_scan_user_scope",
"(",
"self",
",",
"sub_module",
")",
":",
"for",
"scope",
"in",
"sub_module",
".",
"statements",
"+",
"sub_module",
".",
"subscopes",
":",
"if",
"isinstance",
"(",
"scope",
",",
"pr",
".",
"Scope",
")",
":",
"if",
"scope",
".",... | https://github.com/fatih/subvim/blob/241b6d170597857105da219c9b7d36059e9f11fb/vim/base/YouCompleteMe/third_party/jedi/jedi/parser/fast.py#L237-L243 | |
wxWidgets/wxPython-Classic | 19571e1ae65f1ac445f5491474121998c97a1bf0 | src/osx_carbon/dataview.py | python | DataViewCtrl.IsExpanded | (*args, **kwargs) | return _dataview.DataViewCtrl_IsExpanded(*args, **kwargs) | IsExpanded(self, DataViewItem item) -> bool | IsExpanded(self, DataViewItem item) -> bool | [
"IsExpanded",
"(",
"self",
"DataViewItem",
"item",
")",
"-",
">",
"bool"
] | def IsExpanded(*args, **kwargs):
"""IsExpanded(self, DataViewItem item) -> bool"""
return _dataview.DataViewCtrl_IsExpanded(*args, **kwargs) | [
"def",
"IsExpanded",
"(",
"*",
"args",
",",
"*",
"*",
"kwargs",
")",
":",
"return",
"_dataview",
".",
"DataViewCtrl_IsExpanded",
"(",
"*",
"args",
",",
"*",
"*",
"kwargs",
")"
] | https://github.com/wxWidgets/wxPython-Classic/blob/19571e1ae65f1ac445f5491474121998c97a1bf0/src/osx_carbon/dataview.py#L1808-L1810 | |
windystrife/UnrealEngine_NVIDIAGameWorks | b50e6338a7c5b26374d66306ebc7807541ff815e | Engine/Extras/ThirdPartyNotUE/emsdk/Win64/python/2.7.5.3_64bit/Lib/cookielib.py | python | split_header_words | (header_values) | return result | r"""Parse header values into a list of lists containing key,value pairs.
The function knows how to deal with ",", ";" and "=" as well as quoted
values after "=". A list of space separated tokens are parsed as if they
were separated by ";".
If the header_values passed as argument contains multiple val... | r"""Parse header values into a list of lists containing key,value pairs. | [
"r",
"Parse",
"header",
"values",
"into",
"a",
"list",
"of",
"lists",
"containing",
"key",
"value",
"pairs",
"."
] | def split_header_words(header_values):
r"""Parse header values into a list of lists containing key,value pairs.
The function knows how to deal with ",", ";" and "=" as well as quoted
values after "=". A list of space separated tokens are parsed as if they
were separated by ";".
If the header_valu... | [
"def",
"split_header_words",
"(",
"header_values",
")",
":",
"assert",
"not",
"isinstance",
"(",
"header_values",
",",
"basestring",
")",
"result",
"=",
"[",
"]",
"for",
"text",
"in",
"header_values",
":",
"orig_text",
"=",
"text",
"pairs",
"=",
"[",
"]",
... | https://github.com/windystrife/UnrealEngine_NVIDIAGameWorks/blob/b50e6338a7c5b26374d66306ebc7807541ff815e/Engine/Extras/ThirdPartyNotUE/emsdk/Win64/python/2.7.5.3_64bit/Lib/cookielib.py#L326-L409 | |
eventql/eventql | 7ca0dbb2e683b525620ea30dc40540a22d5eb227 | deps/3rdparty/spidermonkey/mozjs/build/pymake/pymake/parser.py | python | itermakefilechars | (d, offset, tokenlist, it, ignorecomments=False) | Iterate over data in makefile syntax. Comments are found at unescaped # characters, and escaped newlines
are converted to single-space continuations. | Iterate over data in makefile syntax. Comments are found at unescaped # characters, and escaped newlines
are converted to single-space continuations. | [
"Iterate",
"over",
"data",
"in",
"makefile",
"syntax",
".",
"Comments",
"are",
"found",
"at",
"unescaped",
"#",
"characters",
"and",
"escaped",
"newlines",
"are",
"converted",
"to",
"single",
"-",
"space",
"continuations",
"."
] | def itermakefilechars(d, offset, tokenlist, it, ignorecomments=False):
"""
Iterate over data in makefile syntax. Comments are found at unescaped # characters, and escaped newlines
are converted to single-space continuations.
"""
assert offset >= d.lstart and offset <= d.lend, "offset %i should be b... | [
"def",
"itermakefilechars",
"(",
"d",
",",
"offset",
",",
"tokenlist",
",",
"it",
",",
"ignorecomments",
"=",
"False",
")",
":",
"assert",
"offset",
">=",
"d",
".",
"lstart",
"and",
"offset",
"<=",
"d",
".",
"lend",
",",
"\"offset %i should be between %i and... | https://github.com/eventql/eventql/blob/7ca0dbb2e683b525620ea30dc40540a22d5eb227/deps/3rdparty/spidermonkey/mozjs/build/pymake/pymake/parser.py#L146-L179 | ||
oracle/graaljs | 36a56e8e993d45fc40939a3a4d9c0c24990720f1 | graal-nodejs/deps/v8/third_party/jinja2/filters.py | python | do_format | (value, *args, **kwargs) | return soft_unicode(value) % (kwargs or args) | Apply python string formatting on an object:
.. sourcecode:: jinja
{{ "%s - %s"|format("Hello?", "Foo!") }}
-> Hello? - Foo! | Apply python string formatting on an object: | [
"Apply",
"python",
"string",
"formatting",
"on",
"an",
"object",
":"
] | def do_format(value, *args, **kwargs):
"""
Apply python string formatting on an object:
.. sourcecode:: jinja
{{ "%s - %s"|format("Hello?", "Foo!") }}
-> Hello? - Foo!
"""
if args and kwargs:
raise FilterArgumentError('can\'t handle positional and keyword '
... | [
"def",
"do_format",
"(",
"value",
",",
"*",
"args",
",",
"*",
"*",
"kwargs",
")",
":",
"if",
"args",
"and",
"kwargs",
":",
"raise",
"FilterArgumentError",
"(",
"'can\\'t handle positional and keyword '",
"'arguments at the same time'",
")",
"return",
"soft_unicode",... | https://github.com/oracle/graaljs/blob/36a56e8e993d45fc40939a3a4d9c0c24990720f1/graal-nodejs/deps/v8/third_party/jinja2/filters.py#L673-L685 | |
jeog/TOSDataBridge | 6a5a08ca5cf3883db1f12e9bc89ef374d098df5a | python/tosdb/_common.py | python | _TOSDB_DataBlock.remove_items | () | Remove items (ex. 'IBM', 'SPY') from the block.
NOTE: if this call removes all items from the block the remaining topics
will be pre-cached and appear not to exist, until a valid item is re-added.
remove_items(self, *items)
*items :: *str :: any numer of item strings in the b... | Remove items (ex. 'IBM', 'SPY') from the block. | [
"Remove",
"items",
"(",
"ex",
".",
"IBM",
"SPY",
")",
"from",
"the",
"block",
"."
] | def remove_items():
""" Remove items (ex. 'IBM', 'SPY') from the block.
NOTE: if this call removes all items from the block the remaining topics
will be pre-cached and appear not to exist, until a valid item is re-added.
remove_items(self, *items)
*items :: *str :: a... | [
"def",
"remove_items",
"(",
")",
":",
"pass"
] | https://github.com/jeog/TOSDataBridge/blob/6a5a08ca5cf3883db1f12e9bc89ef374d098df5a/python/tosdb/_common.py#L211-L223 | ||
Xilinx/Vitis-AI | fc74d404563d9951b57245443c73bef389f3657f | tools/Vitis-AI-Quantizer/vai_q_tensorflow1.x/tensorflow/python/ops/metrics_impl.py | python | false_positives_at_thresholds | (labels,
predictions,
thresholds,
weights=None,
metrics_collections=None,
updates_collections=None,
name=None) | Computes false positives at provided threshold values.
If `weights` is `None`, weights default to 1. Use weights of 0 to mask values.
Args:
labels: A `Tensor` whose shape matches `predictions`. Will be cast to
`bool`.
predictions: A floating point `Tensor` of arbitrary shape and whose values
a... | Computes false positives at provided threshold values. | [
"Computes",
"false",
"positives",
"at",
"provided",
"threshold",
"values",
"."
] | def false_positives_at_thresholds(labels,
predictions,
thresholds,
weights=None,
metrics_collections=None,
updates_collections=None,
... | [
"def",
"false_positives_at_thresholds",
"(",
"labels",
",",
"predictions",
",",
"thresholds",
",",
"weights",
"=",
"None",
",",
"metrics_collections",
"=",
"None",
",",
"updates_collections",
"=",
"None",
",",
"name",
"=",
"None",
")",
":",
"if",
"context",
".... | https://github.com/Xilinx/Vitis-AI/blob/fc74d404563d9951b57245443c73bef389f3657f/tools/Vitis-AI-Quantizer/vai_q_tensorflow1.x/tensorflow/python/ops/metrics_impl.py#L1674-L1726 | ||
ricardoquesada/Spidermonkey | 4a75ea2543408bd1b2c515aa95901523eeef7858 | config/configobj.py | python | ConfigObj._handle_repeat | (self, section, configspec) | Dynamically assign configspec for repeated section. | Dynamically assign configspec for repeated section. | [
"Dynamically",
"assign",
"configspec",
"for",
"repeated",
"section",
"."
] | def _handle_repeat(self, section, configspec):
"""Dynamically assign configspec for repeated section."""
try:
section_keys = configspec.sections
scalar_keys = configspec.scalars
except AttributeError:
section_keys = [entry for entry in configspec
... | [
"def",
"_handle_repeat",
"(",
"self",
",",
"section",
",",
"configspec",
")",
":",
"try",
":",
"section_keys",
"=",
"configspec",
".",
"sections",
"scalar_keys",
"=",
"configspec",
".",
"scalars",
"except",
"AttributeError",
":",
"section_keys",
"=",
"[",
"ent... | https://github.com/ricardoquesada/Spidermonkey/blob/4a75ea2543408bd1b2c515aa95901523eeef7858/config/configobj.py#L1826-L1855 | ||
smartdevicelink/sdl_core | 68f082169e0a40fccd9eb0db3c83911c28870f07 | tools/InterfaceGenerator/generator/generators/SmartFactoryBase.py | python | CodeGenerator._indent_code | (self, code, indent_level) | return u"".join(
[u"{0}{1}\n".format(
self._indent_template * indent_level,
x) if x != u"" else u"\n" for x in code_lines]) | Indent given source code.
Indents given source code right by given indentation level.
Keyword arguments:
code -- given source code.
indent_level -- desired indentation level.
Returns:
String with processed code. | Indent given source code. | [
"Indent",
"given",
"source",
"code",
"."
] | def _indent_code(self, code, indent_level):
"""Indent given source code.
Indents given source code right by given indentation level.
Keyword arguments:
code -- given source code.
indent_level -- desired indentation level.
Returns:
String with processed code.
... | [
"def",
"_indent_code",
"(",
"self",
",",
"code",
",",
"indent_level",
")",
":",
"code_lines",
"=",
"code",
".",
"split",
"(",
"\"\\n\"",
")",
"return",
"u\"\"",
".",
"join",
"(",
"[",
"u\"{0}{1}\\n\"",
".",
"format",
"(",
"self",
".",
"_indent_template",
... | https://github.com/smartdevicelink/sdl_core/blob/68f082169e0a40fccd9eb0db3c83911c28870f07/tools/InterfaceGenerator/generator/generators/SmartFactoryBase.py#L1482-L1500 | |
ceph/ceph | 959663007321a369c83218414a29bd9dbc8bda3a | qa/tasks/barbican.py | python | assign_ports | (ctx, config, initial_port) | return role_endpoints | Assign port numbers starting from @initial_port | Assign port numbers starting from | [
"Assign",
"port",
"numbers",
"starting",
"from"
] | def assign_ports(ctx, config, initial_port):
"""
Assign port numbers starting from @initial_port
"""
port = initial_port
role_endpoints = {}
for remote, roles_for_host in ctx.cluster.remotes.items():
for role in roles_for_host:
if role in config:
role_endpoint... | [
"def",
"assign_ports",
"(",
"ctx",
",",
"config",
",",
"initial_port",
")",
":",
"port",
"=",
"initial_port",
"role_endpoints",
"=",
"{",
"}",
"for",
"remote",
",",
"roles_for_host",
"in",
"ctx",
".",
"cluster",
".",
"remotes",
".",
"items",
"(",
")",
":... | https://github.com/ceph/ceph/blob/959663007321a369c83218414a29bd9dbc8bda3a/qa/tasks/barbican.py#L108-L120 | |
deepmind/reverb | ef3c8f0be1b720a741d2dee335e15e44668c291a | reverb/server.py | python | Table.stack | (cls,
name: str,
max_size: int,
extensions: Sequence[TableExtensionBase] = (),
signature: Optional[reverb_types.SpecNest] = None) | return cls(
name=name,
sampler=item_selectors.Lifo(),
remover=item_selectors.Lifo(),
max_size=max_size,
max_times_sampled=1,
rate_limiter=rate_limiters.Stack(max_size),
extensions=extensions,
signature=signature) | Constructs a Table which acts like a stack.
Args:
name: Name of the priority table (aka stack).
max_size: Maximum number of items in the priority table (aka stack).
extensions: See documentation in the constructor.
signature: See documentation in the constructor.
Returns:
Table w... | Constructs a Table which acts like a stack. | [
"Constructs",
"a",
"Table",
"which",
"acts",
"like",
"a",
"stack",
"."
] | def stack(cls,
name: str,
max_size: int,
extensions: Sequence[TableExtensionBase] = (),
signature: Optional[reverb_types.SpecNest] = None):
"""Constructs a Table which acts like a stack.
Args:
name: Name of the priority table (aka stack).
max_size: Ma... | [
"def",
"stack",
"(",
"cls",
",",
"name",
":",
"str",
",",
"max_size",
":",
"int",
",",
"extensions",
":",
"Sequence",
"[",
"TableExtensionBase",
"]",
"=",
"(",
")",
",",
"signature",
":",
"Optional",
"[",
"reverb_types",
".",
"SpecNest",
"]",
"=",
"Non... | https://github.com/deepmind/reverb/blob/ef3c8f0be1b720a741d2dee335e15e44668c291a/reverb/server.py#L192-L216 | |
pmq20/node-packer | 12c46c6e44fbc14d9ee645ebd17d5296b324f7e0 | current/deps/v8/third_party/jinja2/utils.py | python | environmentfunction | (f) | return f | This decorator can be used to mark a function or method as environment
callable. This decorator works exactly like the :func:`contextfunction`
decorator just that the first argument is the active :class:`Environment`
and not context. | This decorator can be used to mark a function or method as environment
callable. This decorator works exactly like the :func:`contextfunction`
decorator just that the first argument is the active :class:`Environment`
and not context. | [
"This",
"decorator",
"can",
"be",
"used",
"to",
"mark",
"a",
"function",
"or",
"method",
"as",
"environment",
"callable",
".",
"This",
"decorator",
"works",
"exactly",
"like",
"the",
":",
"func",
":",
"contextfunction",
"decorator",
"just",
"that",
"the",
"f... | def environmentfunction(f):
"""This decorator can be used to mark a function or method as environment
callable. This decorator works exactly like the :func:`contextfunction`
decorator just that the first argument is the active :class:`Environment`
and not context.
"""
f.environmentfunction = Tr... | [
"def",
"environmentfunction",
"(",
"f",
")",
":",
"f",
".",
"environmentfunction",
"=",
"True",
"return",
"f"
] | https://github.com/pmq20/node-packer/blob/12c46c6e44fbc14d9ee645ebd17d5296b324f7e0/current/deps/v8/third_party/jinja2/utils.py#L73-L80 | |
Smorodov/Multitarget-tracker | bee300e8bfd660c86cbeb6892c65a5b7195c9381 | thirdparty/pybind11/tools/clang/cindex.py | python | CursorKind.is_expression | (self) | return conf.lib.clang_isExpression(self) | Test if this is an expression kind. | Test if this is an expression kind. | [
"Test",
"if",
"this",
"is",
"an",
"expression",
"kind",
"."
] | def is_expression(self):
"""Test if this is an expression kind."""
return conf.lib.clang_isExpression(self) | [
"def",
"is_expression",
"(",
"self",
")",
":",
"return",
"conf",
".",
"lib",
".",
"clang_isExpression",
"(",
"self",
")"
] | https://github.com/Smorodov/Multitarget-tracker/blob/bee300e8bfd660c86cbeb6892c65a5b7195c9381/thirdparty/pybind11/tools/clang/cindex.py#L584-L586 | |
wxWidgets/wxPython-Classic | 19571e1ae65f1ac445f5491474121998c97a1bf0 | wx/lib/agw/thumbnailctrl.py | python | ScrolledThumbnail.SetCaption | (self, caption="") | Sets the current caption string.
:param `caption`: the current caption string. | Sets the current caption string. | [
"Sets",
"the",
"current",
"caption",
"string",
"."
] | def SetCaption(self, caption=""):
"""
Sets the current caption string.
:param `caption`: the current caption string.
"""
self._caption = caption
if self._labelcontrol:
maxWidth = self._labelcontrol.GetSize().GetWidth()/8
if len(caption) ... | [
"def",
"SetCaption",
"(",
"self",
",",
"caption",
"=",
"\"\"",
")",
":",
"self",
".",
"_caption",
"=",
"caption",
"if",
"self",
".",
"_labelcontrol",
":",
"maxWidth",
"=",
"self",
".",
"_labelcontrol",
".",
"GetSize",
"(",
")",
".",
"GetWidth",
"(",
")... | https://github.com/wxWidgets/wxPython-Classic/blob/19571e1ae65f1ac445f5491474121998c97a1bf0/wx/lib/agw/thumbnailctrl.py#L1731-L1748 | ||
hughperkins/tf-coriander | 970d3df6c11400ad68405f22b0c42a52374e94ca | tensorflow/contrib/learn/python/learn/monitors.py | python | CaptureVariable.values | (self) | return self._var_values | Returns the values captured so far.
Returns:
`dict` mapping `int` step numbers to that values of the variable at the
respective step. | Returns the values captured so far. | [
"Returns",
"the",
"values",
"captured",
"so",
"far",
"."
] | def values(self):
"""Returns the values captured so far.
Returns:
`dict` mapping `int` step numbers to that values of the variable at the
respective step.
"""
return self._var_values | [
"def",
"values",
"(",
"self",
")",
":",
"return",
"self",
".",
"_var_values"
] | https://github.com/hughperkins/tf-coriander/blob/970d3df6c11400ad68405f22b0c42a52374e94ca/tensorflow/contrib/learn/python/learn/monitors.py#L770-L777 | |
CoolProp/CoolProp | 381c8535e5dec3eec27ad430ebbfff8bc9dfc008 | dev/scripts/viscosity_builder.py | python | viscosity_linear | (fluid, T, rho, e_k, sigma) | return viscosity_dilute(fluid, T, e_k, sigma) * B_eta * rho / molemass * 1000 | Implements the method of Vogel 1998 (Propane) for the linear part | Implements the method of Vogel 1998 (Propane) for the linear part | [
"Implements",
"the",
"method",
"of",
"Vogel",
"1998",
"(",
"Propane",
")",
"for",
"the",
"linear",
"part"
] | def viscosity_linear(fluid, T, rho, e_k, sigma):
"""
Implements the method of Vogel 1998 (Propane) for the linear part
"""
N_A = 6.02214129e23
molemass = Props(fluid, 'molemass')
Tstar = T / e_k
b = [-19.572881, 219.73999, -1015.3226, 2471.01251, -3375.1717, 2491.6597, -787.26086, 14.085455,... | [
"def",
"viscosity_linear",
"(",
"fluid",
",",
"T",
",",
"rho",
",",
"e_k",
",",
"sigma",
")",
":",
"N_A",
"=",
"6.02214129e23",
"molemass",
"=",
"Props",
"(",
"fluid",
",",
"'molemass'",
")",
"Tstar",
"=",
"T",
"/",
"e_k",
"b",
"=",
"[",
"-",
"19.5... | https://github.com/CoolProp/CoolProp/blob/381c8535e5dec3eec27ad430ebbfff8bc9dfc008/dev/scripts/viscosity_builder.py#L43-L55 | |
wxWidgets/wxPython-Classic | 19571e1ae65f1ac445f5491474121998c97a1bf0 | src/osx_carbon/_core.py | python | Window.Layout | (*args, **kwargs) | return _core_.Window_Layout(*args, **kwargs) | Layout(self) -> bool
Invokes the constraint-based layout algorithm or the sizer-based
algorithm for this window. See SetAutoLayout: when auto layout is on,
this function gets called automatically by the default EVT_SIZE
handler when the window is resized. | Layout(self) -> bool | [
"Layout",
"(",
"self",
")",
"-",
">",
"bool"
] | def Layout(*args, **kwargs):
"""
Layout(self) -> bool
Invokes the constraint-based layout algorithm or the sizer-based
algorithm for this window. See SetAutoLayout: when auto layout is on,
this function gets called automatically by the default EVT_SIZE
handler when the ... | [
"def",
"Layout",
"(",
"*",
"args",
",",
"*",
"*",
"kwargs",
")",
":",
"return",
"_core_",
".",
"Window_Layout",
"(",
"*",
"args",
",",
"*",
"*",
"kwargs",
")"
] | https://github.com/wxWidgets/wxPython-Classic/blob/19571e1ae65f1ac445f5491474121998c97a1bf0/src/osx_carbon/_core.py#L11491-L11500 | |
aws/lumberyard | f85344403c1c2e77ec8c75deb2c116e97b713217 | dev/Tools/Python/3.7.10/mac/Python.framework/Versions/3.7/lib/python3.7/site-packages/pip/_vendor/requests/sessions.py | python | SessionRedirectMixin.rebuild_auth | (self, prepared_request, response) | When being redirected we may want to strip authentication from the
request to avoid leaking credentials. This method intelligently removes
and reapplies authentication where possible to avoid credential loss. | When being redirected we may want to strip authentication from the
request to avoid leaking credentials. This method intelligently removes
and reapplies authentication where possible to avoid credential loss. | [
"When",
"being",
"redirected",
"we",
"may",
"want",
"to",
"strip",
"authentication",
"from",
"the",
"request",
"to",
"avoid",
"leaking",
"credentials",
".",
"This",
"method",
"intelligently",
"removes",
"and",
"reapplies",
"authentication",
"where",
"possible",
"t... | def rebuild_auth(self, prepared_request, response):
"""When being redirected we may want to strip authentication from the
request to avoid leaking credentials. This method intelligently removes
and reapplies authentication where possible to avoid credential loss.
"""
headers = pr... | [
"def",
"rebuild_auth",
"(",
"self",
",",
"prepared_request",
",",
"response",
")",
":",
"headers",
"=",
"prepared_request",
".",
"headers",
"url",
"=",
"prepared_request",
".",
"url",
"if",
"'Authorization'",
"in",
"headers",
"and",
"self",
".",
"should_strip_au... | 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/requests/sessions.py#L254-L270 | ||
kevinlin311tw/Caffe-DeepBinaryCode | 9eaa7662be47d49f475ecbeea2bd51be105270d2 | scripts/cpp_lint.py | python | _IncludeState.CanonicalizeAlphabeticalOrder | (self, header_path) | return header_path.replace('-inl.h', '.h').replace('-', '_').lower() | Returns a path canonicalized for alphabetical comparison.
- replaces "-" with "_" so they both cmp the same.
- removes '-inl' since we don't require them to be after the main header.
- lowercase everything, just in case.
Args:
header_path: Path to be canonicalized.
Returns:
Canonicali... | Returns a path canonicalized for alphabetical comparison. | [
"Returns",
"a",
"path",
"canonicalized",
"for",
"alphabetical",
"comparison",
"."
] | def CanonicalizeAlphabeticalOrder(self, header_path):
"""Returns a path canonicalized for alphabetical comparison.
- replaces "-" with "_" so they both cmp the same.
- removes '-inl' since we don't require them to be after the main header.
- lowercase everything, just in case.
Args:
header_p... | [
"def",
"CanonicalizeAlphabeticalOrder",
"(",
"self",
",",
"header_path",
")",
":",
"return",
"header_path",
".",
"replace",
"(",
"'-inl.h'",
",",
"'.h'",
")",
".",
"replace",
"(",
"'-'",
",",
"'_'",
")",
".",
"lower",
"(",
")"
] | https://github.com/kevinlin311tw/Caffe-DeepBinaryCode/blob/9eaa7662be47d49f475ecbeea2bd51be105270d2/scripts/cpp_lint.py#L597-L610 | |
catboost/catboost | 167f64f237114a4d10b2b4ee42adb4569137debe | contrib/tools/python3/src/Lib/tarfile.py | python | TarFile._getmember | (self, name, tarinfo=None, normalize=False) | Find an archive member by name from bottom to top.
If tarinfo is given, it is used as the starting point. | Find an archive member by name from bottom to top.
If tarinfo is given, it is used as the starting point. | [
"Find",
"an",
"archive",
"member",
"by",
"name",
"from",
"bottom",
"to",
"top",
".",
"If",
"tarinfo",
"is",
"given",
"it",
"is",
"used",
"as",
"the",
"starting",
"point",
"."
] | def _getmember(self, name, tarinfo=None, normalize=False):
"""Find an archive member by name from bottom to top.
If tarinfo is given, it is used as the starting point.
"""
# Ensure that all members have been loaded.
members = self.getmembers()
# Limit the member searc... | [
"def",
"_getmember",
"(",
"self",
",",
"name",
",",
"tarinfo",
"=",
"None",
",",
"normalize",
"=",
"False",
")",
":",
"# Ensure that all members have been loaded.",
"members",
"=",
"self",
".",
"getmembers",
"(",
")",
"# Limit the member search list up to tarinfo.",
... | https://github.com/catboost/catboost/blob/167f64f237114a4d10b2b4ee42adb4569137debe/contrib/tools/python3/src/Lib/tarfile.py#L2369-L2390 | ||
baidu-research/tensorflow-allreduce | 66d5b855e90b0949e9fa5cca5599fd729a70e874 | tensorflow/python/client/timeline.py | python | _TensorTracker.name | (self) | return self._name | Name of this tensor. | Name of this tensor. | [
"Name",
"of",
"this",
"tensor",
"."
] | def name(self):
"""Name of this tensor."""
return self._name | [
"def",
"name",
"(",
"self",
")",
":",
"return",
"self",
".",
"_name"
] | https://github.com/baidu-research/tensorflow-allreduce/blob/66d5b855e90b0949e9fa5cca5599fd729a70e874/tensorflow/python/client/timeline.py#L295-L297 | |
wxWidgets/wxPython-Classic | 19571e1ae65f1ac445f5491474121998c97a1bf0 | src/gtk/propgrid.py | python | ArrayStringProperty.OnButtonClick | (*args, **kwargs) | return _propgrid.ArrayStringProperty_OnButtonClick(*args, **kwargs) | OnButtonClick(self, PropertyGrid propgrid, Window primary, wxChar cbt) -> bool | OnButtonClick(self, PropertyGrid propgrid, Window primary, wxChar cbt) -> bool | [
"OnButtonClick",
"(",
"self",
"PropertyGrid",
"propgrid",
"Window",
"primary",
"wxChar",
"cbt",
")",
"-",
">",
"bool"
] | def OnButtonClick(*args, **kwargs):
"""OnButtonClick(self, PropertyGrid propgrid, Window primary, wxChar cbt) -> bool"""
return _propgrid.ArrayStringProperty_OnButtonClick(*args, **kwargs) | [
"def",
"OnButtonClick",
"(",
"*",
"args",
",",
"*",
"*",
"kwargs",
")",
":",
"return",
"_propgrid",
".",
"ArrayStringProperty_OnButtonClick",
"(",
"*",
"args",
",",
"*",
"*",
"kwargs",
")"
] | https://github.com/wxWidgets/wxPython-Classic/blob/19571e1ae65f1ac445f5491474121998c97a1bf0/src/gtk/propgrid.py#L3143-L3145 | |
apache/incubator-mxnet | f03fb23f1d103fec9541b5ae59ee06b1734a51d9 | docs/tutorial_utils/vision/cnn_visualization/gradcam.py | python | get_image_grad | (net, image, class_id=None) | return _get_grad(net, image, class_id, image_grad=True) | Get the gradients of the image.
Parameters:
----------
net: Block
Network to use for visualization.
image: NDArray
Preprocessed image to use for visualization.
class_id: int
Category ID this image belongs to. If not provided,
network's prediction will be used. | Get the gradients of the image. | [
"Get",
"the",
"gradients",
"of",
"the",
"image",
"."
] | def get_image_grad(net, image, class_id=None):
"""Get the gradients of the image.
Parameters:
----------
net: Block
Network to use for visualization.
image: NDArray
Preprocessed image to use for visualization.
class_id: int
Category ID this image belongs to. If not provi... | [
"def",
"get_image_grad",
"(",
"net",
",",
"image",
",",
"class_id",
"=",
"None",
")",
":",
"return",
"_get_grad",
"(",
"net",
",",
"image",
",",
"class_id",
",",
"image_grad",
"=",
"True",
")"
] | https://github.com/apache/incubator-mxnet/blob/f03fb23f1d103fec9541b5ae59ee06b1734a51d9/docs/tutorial_utils/vision/cnn_visualization/gradcam.py#L184-L196 | |
miyosuda/TensorFlowAndroidMNIST | 7b5a4603d2780a8a2834575706e9001977524007 | jni-build/jni/include/tensorflow/contrib/distributions/python/ops/beta.py | python | Beta.b | (self) | return self._b | Shape parameter. | Shape parameter. | [
"Shape",
"parameter",
"."
] | def b(self):
"""Shape parameter."""
return self._b | [
"def",
"b",
"(",
"self",
")",
":",
"return",
"self",
".",
"_b"
] | https://github.com/miyosuda/TensorFlowAndroidMNIST/blob/7b5a4603d2780a8a2834575706e9001977524007/jni-build/jni/include/tensorflow/contrib/distributions/python/ops/beta.py#L159-L161 | |
wxWidgets/wxPython-Classic | 19571e1ae65f1ac445f5491474121998c97a1bf0 | src/gtk/_controls.py | python | ListItem.GetColumn | (*args, **kwargs) | return _controls_.ListItem_GetColumn(*args, **kwargs) | GetColumn(self) -> int | GetColumn(self) -> int | [
"GetColumn",
"(",
"self",
")",
"-",
">",
"int"
] | def GetColumn(*args, **kwargs):
"""GetColumn(self) -> int"""
return _controls_.ListItem_GetColumn(*args, **kwargs) | [
"def",
"GetColumn",
"(",
"*",
"args",
",",
"*",
"*",
"kwargs",
")",
":",
"return",
"_controls_",
".",
"ListItem_GetColumn",
"(",
"*",
"args",
",",
"*",
"*",
"kwargs",
")"
] | https://github.com/wxWidgets/wxPython-Classic/blob/19571e1ae65f1ac445f5491474121998c97a1bf0/src/gtk/_controls.py#L4220-L4222 | |
bulletphysics/bullet3 | f0f2a952e146f016096db6f85cf0c44ed75b0b9a | examples/pybullet/gym/pybullet_envs/minitaur/robots/safety/motor_action_validator.py | python | MotorActionValidator.__init__ | (
self,
motor_id: typing.Any,
position_bound: data_types.Bound,
position_gain_bound: data_types.Bound,
velocity_bound: data_types.Bound,
velocity_gain_bound: data_types.Bound,
torque_bound: data_types.Bound,
timestamp_delta_bound: data_types.Bound,
delta_position_bo... | Initializes the class.
Args:
motor_id: Unique ID for the motor.
position_bound: The lower/upper bound of the motor angle.
position_gain_bound: The lower/upper bound of the motor position gain for
PD control.
velocity_bound: The lower/upper bound of the motor speed.
velocity_ga... | Initializes the class. | [
"Initializes",
"the",
"class",
"."
] | def __init__(
self,
motor_id: typing.Any,
position_bound: data_types.Bound,
position_gain_bound: data_types.Bound,
velocity_bound: data_types.Bound,
velocity_gain_bound: data_types.Bound,
torque_bound: data_types.Bound,
timestamp_delta_bound: data_types.Bound,
delta... | [
"def",
"__init__",
"(",
"self",
",",
"motor_id",
":",
"typing",
".",
"Any",
",",
"position_bound",
":",
"data_types",
".",
"Bound",
",",
"position_gain_bound",
":",
"data_types",
".",
"Bound",
",",
"velocity_bound",
":",
"data_types",
".",
"Bound",
",",
"vel... | https://github.com/bulletphysics/bullet3/blob/f0f2a952e146f016096db6f85cf0c44ed75b0b9a/examples/pybullet/gym/pybullet_envs/minitaur/robots/safety/motor_action_validator.py#L22-L67 | ||
glotzerlab/hoomd-blue | f7f97abfa3fcc2522fa8d458d65d0aeca7ba781a | hoomd/hpmc/update.py | python | BoxMC.counter | (self) | Trial move counters.
The counter object has the following attributes:
* ``volume``: `tuple` [`int`, `int`] - Number of accepted and rejected
volume and length moves.
* ``shear``: `tuple` [`int`, `int`] - Number of accepted and rejected
shear moves.
* ``aspect``: `tu... | Trial move counters. | [
"Trial",
"move",
"counters",
"."
] | def counter(self):
"""Trial move counters.
The counter object has the following attributes:
* ``volume``: `tuple` [`int`, `int`] - Number of accepted and rejected
volume and length moves.
* ``shear``: `tuple` [`int`, `int`] - Number of accepted and rejected
shear mo... | [
"def",
"counter",
"(",
"self",
")",
":",
"if",
"not",
"self",
".",
"_attached",
":",
"return",
"None",
"else",
":",
"return",
"self",
".",
"_cpp_obj",
".",
"getCounters",
"(",
"1",
")"
] | https://github.com/glotzerlab/hoomd-blue/blob/f7f97abfa3fcc2522fa8d458d65d0aeca7ba781a/hoomd/hpmc/update.py#L134-L154 | ||
mongodb/mongo | d8ff665343ad29cf286ee2cf4a1960d29371937b | buildscripts/resmokelib/core/programs.py | python | genny_program | (logger, job_num, test_id=None, executable=None, process_kwargs=None, **kwargs) | return generic_program(logger, args, job_num, test_id=test_id, process_kwargs=process_kwargs,
**kwargs) | Return a Process instance that starts a genny executable with arguments constructed from 'kwargs'. | Return a Process instance that starts a genny executable with arguments constructed from 'kwargs'. | [
"Return",
"a",
"Process",
"instance",
"that",
"starts",
"a",
"genny",
"executable",
"with",
"arguments",
"constructed",
"from",
"kwargs",
"."
] | def genny_program(logger, job_num, test_id=None, executable=None, process_kwargs=None, **kwargs):
"""Return a Process instance that starts a genny executable with arguments constructed from 'kwargs'."""
executable = utils.default_if_none(executable, config.DEFAULT_GENNY_EXECUTABLE)
args = [executable]
r... | [
"def",
"genny_program",
"(",
"logger",
",",
"job_num",
",",
"test_id",
"=",
"None",
",",
"executable",
"=",
"None",
",",
"process_kwargs",
"=",
"None",
",",
"*",
"*",
"kwargs",
")",
":",
"executable",
"=",
"utils",
".",
"default_if_none",
"(",
"executable"... | https://github.com/mongodb/mongo/blob/d8ff665343ad29cf286ee2cf4a1960d29371937b/buildscripts/resmokelib/core/programs.py#L350-L355 | |
aws/lumberyard | f85344403c1c2e77ec8c75deb2c116e97b713217 | dev/Tools/Python/3.7.10/mac/Python.framework/Versions/3.7/lib/python3.7/datetime.py | python | time._tzstr | (self) | return _format_offset(off) | Return formatted timezone offset (+xx:xx) or an empty string. | Return formatted timezone offset (+xx:xx) or an empty string. | [
"Return",
"formatted",
"timezone",
"offset",
"(",
"+",
"xx",
":",
"xx",
")",
"or",
"an",
"empty",
"string",
"."
] | def _tzstr(self):
"""Return formatted timezone offset (+xx:xx) or an empty string."""
off = self.utcoffset()
return _format_offset(off) | [
"def",
"_tzstr",
"(",
"self",
")",
":",
"off",
"=",
"self",
".",
"utcoffset",
"(",
")",
"return",
"_format_offset",
"(",
"off",
")"
] | https://github.com/aws/lumberyard/blob/f85344403c1c2e77ec8c75deb2c116e97b713217/dev/Tools/Python/3.7.10/mac/Python.framework/Versions/3.7/lib/python3.7/datetime.py#L1341-L1344 | |
catboost/catboost | 167f64f237114a4d10b2b4ee42adb4569137debe | contrib/python/scipy/py2/scipy/interpolate/fitpack2.py | python | BivariateSpline._from_tck | (cls, tck) | return self | Construct a spline object from given tck and degree | Construct a spline object from given tck and degree | [
"Construct",
"a",
"spline",
"object",
"from",
"given",
"tck",
"and",
"degree"
] | def _from_tck(cls, tck):
"""Construct a spline object from given tck and degree"""
self = cls.__new__(cls)
if len(tck) != 5:
raise ValueError("tck should be a 5 element tuple of tx,"
" ty, c, kx, ky")
self.tck = tck[:3]
self.degrees = tck[... | [
"def",
"_from_tck",
"(",
"cls",
",",
"tck",
")",
":",
"self",
"=",
"cls",
".",
"__new__",
"(",
"cls",
")",
"if",
"len",
"(",
"tck",
")",
"!=",
"5",
":",
"raise",
"ValueError",
"(",
"\"tck should be a 5 element tuple of tx,\"",
"\" ty, c, kx, ky\"",
")",
"s... | https://github.com/catboost/catboost/blob/167f64f237114a4d10b2b4ee42adb4569137debe/contrib/python/scipy/py2/scipy/interpolate/fitpack2.py#L945-L953 | |
apple/turicreate | cce55aa5311300e3ce6af93cb45ba791fd1bdf49 | deps/src/libxml2-2.9.1/python/libxml2.py | python | uCSIsBuhid | (code) | return ret | Check whether the character is part of Buhid UCS Block | Check whether the character is part of Buhid UCS Block | [
"Check",
"whether",
"the",
"character",
"is",
"part",
"of",
"Buhid",
"UCS",
"Block"
] | def uCSIsBuhid(code):
"""Check whether the character is part of Buhid UCS Block """
ret = libxml2mod.xmlUCSIsBuhid(code)
return ret | [
"def",
"uCSIsBuhid",
"(",
"code",
")",
":",
"ret",
"=",
"libxml2mod",
".",
"xmlUCSIsBuhid",
"(",
"code",
")",
"return",
"ret"
] | https://github.com/apple/turicreate/blob/cce55aa5311300e3ce6af93cb45ba791fd1bdf49/deps/src/libxml2-2.9.1/python/libxml2.py#L2174-L2177 | |
hughperkins/tf-coriander | 970d3df6c11400ad68405f22b0c42a52374e94ca | tensorflow/python/debug/debug_data.py | python | has_inf_or_nan | (datum, tensor) | A predicate for whether a tensor consists of any bad numerical values.
This predicate is common enough to merit definition in this module.
Bad numerical values include nans and infs.
The signature of this function follows the requiremnet of DebugDumpDir's
find() method.
Args:
datum: (DebugTensorDatum) D... | A predicate for whether a tensor consists of any bad numerical values. | [
"A",
"predicate",
"for",
"whether",
"a",
"tensor",
"consists",
"of",
"any",
"bad",
"numerical",
"values",
"."
] | def has_inf_or_nan(datum, tensor):
"""A predicate for whether a tensor consists of any bad numerical values.
This predicate is common enough to merit definition in this module.
Bad numerical values include nans and infs.
The signature of this function follows the requiremnet of DebugDumpDir's
find() method.
... | [
"def",
"has_inf_or_nan",
"(",
"datum",
",",
"tensor",
")",
":",
"_",
"=",
"datum",
"# Datum metadata is unused in this predicte.",
"if",
"tensor",
"is",
"None",
":",
"# Uninitialized tensor doesn't have bad numerical values.",
"return",
"False",
"else",
":",
"return",
"... | https://github.com/hughperkins/tf-coriander/blob/970d3df6c11400ad68405f22b0c42a52374e94ca/tensorflow/python/debug/debug_data.py#L184-L206 | ||
hughperkins/tf-coriander | 970d3df6c11400ad68405f22b0c42a52374e94ca | tensorflow/python/ops/random_ops.py | python | random_uniform | (shape,
minval=0,
maxval=None,
dtype=dtypes.float32,
seed=None,
name=None) | Outputs random values from a uniform distribution.
The generated values follow a uniform distribution in the range
`[minval, maxval)`. The lower bound `minval` is included in the range, while
the upper bound `maxval` is excluded.
For floats, the default range is `[0, 1)`. For ints, at least `maxval` must
b... | Outputs random values from a uniform distribution. | [
"Outputs",
"random",
"values",
"from",
"a",
"uniform",
"distribution",
"."
] | def random_uniform(shape,
minval=0,
maxval=None,
dtype=dtypes.float32,
seed=None,
name=None):
"""Outputs random values from a uniform distribution.
The generated values follow a uniform distribution in the range
`[minv... | [
"def",
"random_uniform",
"(",
"shape",
",",
"minval",
"=",
"0",
",",
"maxval",
"=",
"None",
",",
"dtype",
"=",
"dtypes",
".",
"float32",
",",
"seed",
"=",
"None",
",",
"name",
"=",
"None",
")",
":",
"dtype",
"=",
"dtypes",
".",
"as_dtype",
"(",
"dt... | https://github.com/hughperkins/tf-coriander/blob/970d3df6c11400ad68405f22b0c42a52374e94ca/tensorflow/python/ops/random_ops.py#L185-L247 | ||
ApolloAuto/apollo-platform | 86d9dc6743b496ead18d597748ebabd34a513289 | ros/ros/roslib/src/roslib/packages.py | python | _update_rospack_cache | (env=None) | return _read_rospack_cache(cache, ros_root, ros_package_path) | Internal routine to update global package directory cache
@return: True if cache is valid
@rtype: bool | Internal routine to update global package directory cache | [
"Internal",
"routine",
"to",
"update",
"global",
"package",
"directory",
"cache"
] | def _update_rospack_cache(env=None):
"""
Internal routine to update global package directory cache
@return: True if cache is valid
@rtype: bool
"""
if env is None:
env = os.environ
cache = _pkg_dir_cache
if cache:
return True
ros_root = env[ROS_ROOT]
ros_pack... | [
"def",
"_update_rospack_cache",
"(",
"env",
"=",
"None",
")",
":",
"if",
"env",
"is",
"None",
":",
"env",
"=",
"os",
".",
"environ",
"cache",
"=",
"_pkg_dir_cache",
"if",
"cache",
":",
"return",
"True",
"ros_root",
"=",
"env",
"[",
"ROS_ROOT",
"]",
"ro... | https://github.com/ApolloAuto/apollo-platform/blob/86d9dc6743b496ead18d597748ebabd34a513289/ros/ros/roslib/src/roslib/packages.py#L274-L288 | |
andr3wmac/Torque6 | db6cd08f18f4917e0c6557b2766fb40d8e2bee39 | lib/freetype/android/freetype-2.4.12/src/tools/docmaker/tohtml.py | python | HtmlFormatter.make_html_words | ( self, words ) | return line | convert a series of simple words into some HTML text | convert a series of simple words into some HTML text | [
"convert",
"a",
"series",
"of",
"simple",
"words",
"into",
"some",
"HTML",
"text"
] | def make_html_words( self, words ):
""" convert a series of simple words into some HTML text """
line = ""
if words:
line = html_quote( words[0] )
for w in words[1:]:
line = line + " " + html_quote( w )
return line | [
"def",
"make_html_words",
"(",
"self",
",",
"words",
")",
":",
"line",
"=",
"\"\"",
"if",
"words",
":",
"line",
"=",
"html_quote",
"(",
"words",
"[",
"0",
"]",
")",
"for",
"w",
"in",
"words",
"[",
"1",
":",
"]",
":",
"line",
"=",
"line",
"+",
"... | https://github.com/andr3wmac/Torque6/blob/db6cd08f18f4917e0c6557b2766fb40d8e2bee39/lib/freetype/android/freetype-2.4.12/src/tools/docmaker/tohtml.py#L245-L253 | |
ApolloAuto/apollo-platform | 86d9dc6743b496ead18d597748ebabd34a513289 | ros/third_party/lib_x86_64/python2.7/dist-packages/geodesy/utm.py | python | UTMPoint.is2D | (self) | return self.altitude != self.altitude | :returns: True if altitude is not defined. | :returns: True if altitude is not defined. | [
":",
"returns",
":",
"True",
"if",
"altitude",
"is",
"not",
"defined",
"."
] | def is2D(self):
""":returns: True if altitude is not defined."""
return self.altitude != self.altitude | [
"def",
"is2D",
"(",
"self",
")",
":",
"return",
"self",
".",
"altitude",
"!=",
"self",
".",
"altitude"
] | https://github.com/ApolloAuto/apollo-platform/blob/86d9dc6743b496ead18d597748ebabd34a513289/ros/third_party/lib_x86_64/python2.7/dist-packages/geodesy/utm.py#L98-L100 | |
TGAC/KAT | e8870331de2b4bb0a1b3b91c6afb8fb9d59e9216 | scripts/kat/spectra.py | python | Spectra.analyse | (self, min_elements=1, verbose=False) | Analyse the histogram for peaks
:param verbose: Prints additional information about progress to stdout | Analyse the histogram for peaks
:param verbose: Prints additional information about progress to stdout | [
"Analyse",
"the",
"histogram",
"for",
"peaks",
":",
"param",
"verbose",
":",
"Prints",
"additional",
"information",
"about",
"progress",
"to",
"stdout"
] | def analyse(self, min_elements=1, verbose=False):
"""
Analyse the histogram for peaks
:param verbose: Prints additional information about progress to stdout
"""
if verbose:
print()
print("Creating initial peaks ... ", end="", flush=True)
self._createInitialPeaks()
if self.peaks:
if verbose:
... | [
"def",
"analyse",
"(",
"self",
",",
"min_elements",
"=",
"1",
",",
"verbose",
"=",
"False",
")",
":",
"if",
"verbose",
":",
"print",
"(",
")",
"print",
"(",
"\"Creating initial peaks ... \"",
",",
"end",
"=",
"\"\"",
",",
"flush",
"=",
"True",
")",
"se... | https://github.com/TGAC/KAT/blob/e8870331de2b4bb0a1b3b91c6afb8fb9d59e9216/scripts/kat/spectra.py#L140-L201 | ||
wlanjie/AndroidFFmpeg | 7baf9122f4b8e1c74e7baf4be5c422c7a5ba5aaf | tools/fdk-aac-build/x86/toolchain/lib/python2.7/wsgiref/handlers.py | python | BaseHandler.write | (self, data) | write()' callable as specified by PEP 333 | write()' callable as specified by PEP 333 | [
"write",
"()",
"callable",
"as",
"specified",
"by",
"PEP",
"333"
] | def write(self, data):
"""'write()' callable as specified by PEP 333"""
assert type(data) is StringType,"write() argument must be string"
if not self.status:
raise AssertionError("write() before start_response()")
elif not self.headers_sent:
# Before the first ... | [
"def",
"write",
"(",
"self",
",",
"data",
")",
":",
"assert",
"type",
"(",
"data",
")",
"is",
"StringType",
",",
"\"write() argument must be string\"",
"if",
"not",
"self",
".",
"status",
":",
"raise",
"AssertionError",
"(",
"\"write() before start_response()\"",
... | https://github.com/wlanjie/AndroidFFmpeg/blob/7baf9122f4b8e1c74e7baf4be5c422c7a5ba5aaf/tools/fdk-aac-build/x86/toolchain/lib/python2.7/wsgiref/handlers.py#L201-L218 | ||
s5z/zsim | fb4d6e0475a25cffd23f0687ede2d43d96b4a99f | misc/cpplint.py | python | ResetNolintSuppressions | () | Resets the set of NOLINT suppressions to empty. | Resets the set of NOLINT suppressions to empty. | [
"Resets",
"the",
"set",
"of",
"NOLINT",
"suppressions",
"to",
"empty",
"."
] | def ResetNolintSuppressions():
"Resets the set of NOLINT suppressions to empty."
_error_suppressions.clear() | [
"def",
"ResetNolintSuppressions",
"(",
")",
":",
"_error_suppressions",
".",
"clear",
"(",
")"
] | https://github.com/s5z/zsim/blob/fb4d6e0475a25cffd23f0687ede2d43d96b4a99f/misc/cpplint.py#L390-L392 | ||
wxWidgets/wxPython-Classic | 19571e1ae65f1ac445f5491474121998c97a1bf0 | src/osx_cocoa/html.py | python | HtmlTag.HasParam | (*args, **kwargs) | return _html.HtmlTag_HasParam(*args, **kwargs) | HasParam(self, String par) -> bool | HasParam(self, String par) -> bool | [
"HasParam",
"(",
"self",
"String",
"par",
")",
"-",
">",
"bool"
] | def HasParam(*args, **kwargs):
"""HasParam(self, String par) -> bool"""
return _html.HtmlTag_HasParam(*args, **kwargs) | [
"def",
"HasParam",
"(",
"*",
"args",
",",
"*",
"*",
"kwargs",
")",
":",
"return",
"_html",
".",
"HtmlTag_HasParam",
"(",
"*",
"args",
",",
"*",
"*",
"kwargs",
")"
] | https://github.com/wxWidgets/wxPython-Classic/blob/19571e1ae65f1ac445f5491474121998c97a1bf0/src/osx_cocoa/html.py#L145-L147 | |
aws/lumberyard | f85344403c1c2e77ec8c75deb2c116e97b713217 | dev/Tools/Python/3.7.10/linux_x64/lib/python3.7/idlelib/outwin.py | python | OutputWindow.write | (self, s, tags=(), mark="insert") | return len(s) | Write text to text widget.
The text is inserted at the given index with the provided
tags. The text widget is then scrolled to make it visible
and updated to display it, giving the effect of seeing each
line as it is added.
Args:
s: Text to insert into text widget.... | Write text to text widget. | [
"Write",
"text",
"to",
"text",
"widget",
"."
] | def write(self, s, tags=(), mark="insert"):
"""Write text to text widget.
The text is inserted at the given index with the provided
tags. The text widget is then scrolled to make it visible
and updated to display it, giving the effect of seeing each
line as it is added.
... | [
"def",
"write",
"(",
"self",
",",
"s",
",",
"tags",
"=",
"(",
")",
",",
"mark",
"=",
"\"insert\"",
")",
":",
"if",
"isinstance",
"(",
"s",
",",
"bytes",
")",
":",
"s",
"=",
"s",
".",
"decode",
"(",
"iomenu",
".",
"encoding",
",",
"\"replace\"",
... | https://github.com/aws/lumberyard/blob/f85344403c1c2e77ec8c75deb2c116e97b713217/dev/Tools/Python/3.7.10/linux_x64/lib/python3.7/idlelib/outwin.py#L97-L118 | |
gimli-org/gimli | 17aa2160de9b15ababd9ef99e89b1bc3277bbb23 | pygimli/physics/SIP/sipspectrum.py | python | SIPSpectrum.unifyData | (self, onlydown=False) | Unify data (only one value per frequency) by mean or selection. | Unify data (only one value per frequency) by mean or selection. | [
"Unify",
"data",
"(",
"only",
"one",
"value",
"per",
"frequency",
")",
"by",
"mean",
"or",
"selection",
"."
] | def unifyData(self, onlydown=False):
"""Unify data (only one value per frequency) by mean or selection."""
if self.f is None:
return
fu = np.unique(self.f)
if len(fu) < len(self.f) or onlydown:
if onlydown:
nonzero = np.nonzero(np.diff(self.f) > 0)... | [
"def",
"unifyData",
"(",
"self",
",",
"onlydown",
"=",
"False",
")",
":",
"if",
"self",
".",
"f",
"is",
"None",
":",
"return",
"fu",
"=",
"np",
".",
"unique",
"(",
"self",
".",
"f",
")",
"if",
"len",
"(",
"fu",
")",
"<",
"len",
"(",
"self",
"... | https://github.com/gimli-org/gimli/blob/17aa2160de9b15ababd9ef99e89b1bc3277bbb23/pygimli/physics/SIP/sipspectrum.py#L337-L361 | ||
ChromiumWebApps/chromium | c7361d39be8abd1574e6ce8957c8dbddd4c6ccf7 | gpu/command_buffer/build_gles2_cmd_buffer.py | python | PUTnHandler.WriteGLES2ImplementationUnitTest | (self, func, file) | Writes the GLES2 Implemention unit test. | Writes the GLES2 Implemention unit test. | [
"Writes",
"the",
"GLES2",
"Implemention",
"unit",
"test",
"."
] | def WriteGLES2ImplementationUnitTest(self, func, file):
"""Writes the GLES2 Implemention unit test."""
code = """
TEST_F(GLES2ImplementationTest, %(name)s) {
%(type)s data[%(count_param)d][%(count)d] = {{0}};
struct Cmds {
cmds::%(name)sImmediate cmd;
%(type)s data[%(count_param)d][%(count)d];
};
... | [
"def",
"WriteGLES2ImplementationUnitTest",
"(",
"self",
",",
"func",
",",
"file",
")",
":",
"code",
"=",
"\"\"\"\nTEST_F(GLES2ImplementationTest, %(name)s) {\n %(type)s data[%(count_param)d][%(count)d] = {{0}};\n struct Cmds {\n cmds::%(name)sImmediate cmd;\n %(type)s data[%(count_pa... | https://github.com/ChromiumWebApps/chromium/blob/c7361d39be8abd1574e6ce8957c8dbddd4c6ccf7/gpu/command_buffer/build_gles2_cmd_buffer.py#L5088-L5125 | ||
ptrkrysik/gr-gsm | 2de47e28ce1fb9a518337bfc0add36c8e3cff5eb | python/qa_gsm_bcch_ccch_sdcch4_demapper.py | python | qa_bcch_ccch_sdcch4_demapper.test_uplink | (self) | BCCH_CCCH_SDCCH4 demapper uplink test | BCCH_CCCH_SDCCH4 demapper uplink test | [
"BCCH_CCCH_SDCCH4",
"demapper",
"uplink",
"test"
] | def test_uplink (self):
"""
BCCH_CCCH_SDCCH4 demapper uplink test
"""
src = grgsm.burst_source(test_data.frames, test_data.timeslots, test_data.bursts)
src.set_arfcn(0x2240); #uplink flag is 40
demapper = grgsm.gsm_bcch_ccch_sdcch4_demapper(timeslot_nr=0)
dst =... | [
"def",
"test_uplink",
"(",
"self",
")",
":",
"src",
"=",
"grgsm",
".",
"burst_source",
"(",
"test_data",
".",
"frames",
",",
"test_data",
".",
"timeslots",
",",
"test_data",
".",
"bursts",
")",
"src",
".",
"set_arfcn",
"(",
"0x2240",
")",
"#uplink flag is ... | https://github.com/ptrkrysik/gr-gsm/blob/2de47e28ce1fb9a518337bfc0add36c8e3cff5eb/python/qa_gsm_bcch_ccch_sdcch4_demapper.py#L126-L206 | ||
xhzdeng/crpn | a5aef0f80dbe486103123f740c634fb01e6cc9a1 | caffe-fast-rcnn/scripts/cpp_lint.py | python | _CppLintState.SetFilters | (self, filters) | Sets the error-message filters.
These filters are applied when deciding whether to emit a given
error message.
Args:
filters: A string of comma-separated filters (eg "+whitespace/indent").
Each filter should start with + or -; else we die.
Raises:
ValueError: The comma-sepa... | Sets the error-message filters. | [
"Sets",
"the",
"error",
"-",
"message",
"filters",
"."
] | def SetFilters(self, filters):
"""Sets the error-message filters.
These filters are applied when deciding whether to emit a given
error message.
Args:
filters: A string of comma-separated filters (eg "+whitespace/indent").
Each filter should start with + or -; else we die.
Ra... | [
"def",
"SetFilters",
"(",
"self",
",",
"filters",
")",
":",
"# Default filters always have less priority than the flag ones.",
"self",
".",
"filters",
"=",
"_DEFAULT_FILTERS",
"[",
":",
"]",
"for",
"filt",
"in",
"filters",
".",
"split",
"(",
"','",
")",
":",
"cl... | https://github.com/xhzdeng/crpn/blob/a5aef0f80dbe486103123f740c634fb01e6cc9a1/caffe-fast-rcnn/scripts/cpp_lint.py#L721-L744 | ||
catboost/catboost | 167f64f237114a4d10b2b4ee42adb4569137debe | contrib/python/prompt-toolkit/py2/prompt_toolkit/buffer.py | python | Buffer._set_cursor_position | (self, value) | return value != original_position | Set cursor position. Return whether it changed. | Set cursor position. Return whether it changed. | [
"Set",
"cursor",
"position",
".",
"Return",
"whether",
"it",
"changed",
"."
] | def _set_cursor_position(self, value):
""" Set cursor position. Return whether it changed. """
original_position = self.__cursor_position
self.__cursor_position = max(0, value)
return value != original_position | [
"def",
"_set_cursor_position",
"(",
"self",
",",
"value",
")",
":",
"original_position",
"=",
"self",
".",
"__cursor_position",
"self",
".",
"__cursor_position",
"=",
"max",
"(",
"0",
",",
"value",
")",
"return",
"value",
"!=",
"original_position"
] | https://github.com/catboost/catboost/blob/167f64f237114a4d10b2b4ee42adb4569137debe/contrib/python/prompt-toolkit/py2/prompt_toolkit/buffer.py#L353-L358 | |
microsoft/EdgeML | ef9f8a77f096acbdeb941014791f8eda1c1bc35b | tf/edgeml_tf/graph/rnn.py | python | EMI_UGRNN.addBaseAssignOps | (self, graph, initVarList, **kwargs) | Adds Tensorflow assignment operations to all of the model tensors.
These operations can then be used to initialize these tensors from
numpy matrices by running these operators
initVarList: A list of numpy matrices that will be used for
initialization by the assignment operation. For... | Adds Tensorflow assignment operations to all of the model tensors.
These operations can then be used to initialize these tensors from
numpy matrices by running these operators | [
"Adds",
"Tensorflow",
"assignment",
"operations",
"to",
"all",
"of",
"the",
"model",
"tensors",
".",
"These",
"operations",
"can",
"then",
"be",
"used",
"to",
"initialize",
"these",
"tensors",
"from",
"numpy",
"matrices",
"by",
"running",
"these",
"operators"
] | def addBaseAssignOps(self, graph, initVarList, **kwargs):
'''
Adds Tensorflow assignment operations to all of the model tensors.
These operations can then be used to initialize these tensors from
numpy matrices by running these operators
initVarList: A list of numpy matrices tha... | [
"def",
"addBaseAssignOps",
"(",
"self",
",",
"graph",
",",
"initVarList",
",",
"*",
"*",
"kwargs",
")",
":",
"assert",
"initVarList",
"is",
"not",
"None",
"assert",
"len",
"(",
"initVarList",
")",
"==",
"2",
"k_",
"=",
"graph",
".",
"get_tensor_by_name",
... | https://github.com/microsoft/EdgeML/blob/ef9f8a77f096acbdeb941014791f8eda1c1bc35b/tf/edgeml_tf/graph/rnn.py#L1896-L1913 | ||
MythTV/mythtv | d282a209cb8be85d036f85a62a8ec971b67d45f4 | mythtv/bindings/python/MythTV/mythproto.py | python | FileOps.forgetRecording | (self, program) | FileOps.forgetRecording(program) -> None | FileOps.forgetRecording(program) -> None | [
"FileOps",
".",
"forgetRecording",
"(",
"program",
")",
"-",
">",
"None"
] | def forgetRecording(self, program):
"""FileOps.forgetRecording(program) -> None"""
self.backendCommand(BACKEND_SEP.join(['FORGET_RECORDING',
program.toString()])) | [
"def",
"forgetRecording",
"(",
"self",
",",
"program",
")",
":",
"self",
".",
"backendCommand",
"(",
"BACKEND_SEP",
".",
"join",
"(",
"[",
"'FORGET_RECORDING'",
",",
"program",
".",
"toString",
"(",
")",
"]",
")",
")"
] | https://github.com/MythTV/mythtv/blob/d282a209cb8be85d036f85a62a8ec971b67d45f4/mythtv/bindings/python/MythTV/mythproto.py#L666-L669 | ||
wlanjie/AndroidFFmpeg | 7baf9122f4b8e1c74e7baf4be5c422c7a5ba5aaf | tools/fdk-aac-build/armeabi/toolchain/lib/python2.7/lib-tk/ttk.py | python | Notebook.identify | (self, x, y) | return self.tk.call(self._w, "identify", x, y) | Returns the name of the tab element at position x, y, or the
empty string if none. | Returns the name of the tab element at position x, y, or the
empty string if none. | [
"Returns",
"the",
"name",
"of",
"the",
"tab",
"element",
"at",
"position",
"x",
"y",
"or",
"the",
"empty",
"string",
"if",
"none",
"."
] | def identify(self, x, y):
"""Returns the name of the tab element at position x, y, or the
empty string if none."""
return self.tk.call(self._w, "identify", x, y) | [
"def",
"identify",
"(",
"self",
",",
"x",
",",
"y",
")",
":",
"return",
"self",
".",
"tk",
".",
"call",
"(",
"self",
".",
"_w",
",",
"\"identify\"",
",",
"x",
",",
"y",
")"
] | https://github.com/wlanjie/AndroidFFmpeg/blob/7baf9122f4b8e1c74e7baf4be5c422c7a5ba5aaf/tools/fdk-aac-build/armeabi/toolchain/lib/python2.7/lib-tk/ttk.py#L857-L860 | |
catboost/catboost | 167f64f237114a4d10b2b4ee42adb4569137debe | contrib/python/pandas/py3/pandas/core/dtypes/common.py | python | is_timedelta64_dtype | (arr_or_dtype) | return _is_dtype_type(arr_or_dtype, classes(np.timedelta64)) | Check whether an array-like or dtype is of the timedelta64 dtype.
Parameters
----------
arr_or_dtype : array-like
The array-like or dtype to check.
Returns
-------
boolean
Whether or not the array-like or dtype is of the timedelta64 dtype.
Examples
--------
>>> is_... | Check whether an array-like or dtype is of the timedelta64 dtype. | [
"Check",
"whether",
"an",
"array",
"-",
"like",
"or",
"dtype",
"is",
"of",
"the",
"timedelta64",
"dtype",
"."
] | def is_timedelta64_dtype(arr_or_dtype) -> bool:
"""
Check whether an array-like or dtype is of the timedelta64 dtype.
Parameters
----------
arr_or_dtype : array-like
The array-like or dtype to check.
Returns
-------
boolean
Whether or not the array-like or dtype is of t... | [
"def",
"is_timedelta64_dtype",
"(",
"arr_or_dtype",
")",
"->",
"bool",
":",
"if",
"isinstance",
"(",
"arr_or_dtype",
",",
"np",
".",
"dtype",
")",
":",
"# GH#33400 fastpath for dtype object",
"return",
"arr_or_dtype",
".",
"kind",
"==",
"\"m\"",
"return",
"_is_dty... | https://github.com/catboost/catboost/blob/167f64f237114a4d10b2b4ee42adb4569137debe/contrib/python/pandas/py3/pandas/core/dtypes/common.py#L388-L419 | |
wxWidgets/wxPython-Classic | 19571e1ae65f1ac445f5491474121998c97a1bf0 | src/gtk/_misc.py | python | AboutDialogInfo.SetLicense | (*args, **kwargs) | return _misc_.AboutDialogInfo_SetLicense(*args, **kwargs) | SetLicense(self, String licence)
This is the same as `SetLicence`. | SetLicense(self, String licence) | [
"SetLicense",
"(",
"self",
"String",
"licence",
")"
] | def SetLicense(*args, **kwargs):
"""
SetLicense(self, String licence)
This is the same as `SetLicence`.
"""
return _misc_.AboutDialogInfo_SetLicense(*args, **kwargs) | [
"def",
"SetLicense",
"(",
"*",
"args",
",",
"*",
"*",
"kwargs",
")",
":",
"return",
"_misc_",
".",
"AboutDialogInfo_SetLicense",
"(",
"*",
"args",
",",
"*",
"*",
"kwargs",
")"
] | https://github.com/wxWidgets/wxPython-Classic/blob/19571e1ae65f1ac445f5491474121998c97a1bf0/src/gtk/_misc.py#L6700-L6706 | |
TGAC/KAT | e8870331de2b4bb0a1b3b91c6afb8fb9d59e9216 | deps/boost/tools/build/src/tools/common.py | python | check_init_parameters | (toolset, requirement, *args) | return ['/'.join(condition)] | The rule for checking toolset parameters. Trailing parameters should all be
parameter name/value pairs. The rule will check that each parameter either has
a value in each invocation or has no value in each invocation. Also, the rule
will check that the combination of all parameter values is uniq... | The rule for checking toolset parameters. Trailing parameters should all be
parameter name/value pairs. The rule will check that each parameter either has
a value in each invocation or has no value in each invocation. Also, the rule
will check that the combination of all parameter values is uniq... | [
"The",
"rule",
"for",
"checking",
"toolset",
"parameters",
".",
"Trailing",
"parameters",
"should",
"all",
"be",
"parameter",
"name",
"/",
"value",
"pairs",
".",
"The",
"rule",
"will",
"check",
"that",
"each",
"parameter",
"either",
"has",
"a",
"value",
"in"... | def check_init_parameters(toolset, requirement, *args):
""" The rule for checking toolset parameters. Trailing parameters should all be
parameter name/value pairs. The rule will check that each parameter either has
a value in each invocation or has no value in each invocation. Also, the rule
... | [
"def",
"check_init_parameters",
"(",
"toolset",
",",
"requirement",
",",
"*",
"args",
")",
":",
"assert",
"isinstance",
"(",
"toolset",
",",
"basestring",
")",
"assert",
"is_iterable_typed",
"(",
"requirement",
",",
"basestring",
")",
"or",
"requirement",
"is",
... | https://github.com/TGAC/KAT/blob/e8870331de2b4bb0a1b3b91c6afb8fb9d59e9216/deps/boost/tools/build/src/tools/common.py#L171-L282 | |
ApolloAuto/apollo-platform | 86d9dc6743b496ead18d597748ebabd34a513289 | ros/third_party/lib_x86_64/python2.7/dist-packages/numpy/ma/core.py | python | _arraymethod.getdoc | (self) | Return the doc of the function (from the doc of the method). | Return the doc of the function (from the doc of the method). | [
"Return",
"the",
"doc",
"of",
"the",
"function",
"(",
"from",
"the",
"doc",
"of",
"the",
"method",
")",
"."
] | def getdoc(self):
"Return the doc of the function (from the doc of the method)."
methdoc = getattr(ndarray, self.__name__, None) or \
getattr(np, self.__name__, None)
if methdoc is not None:
return methdoc.__doc__ | [
"def",
"getdoc",
"(",
"self",
")",
":",
"methdoc",
"=",
"getattr",
"(",
"ndarray",
",",
"self",
".",
"__name__",
",",
"None",
")",
"or",
"getattr",
"(",
"np",
",",
"self",
".",
"__name__",
",",
"None",
")",
"if",
"methdoc",
"is",
"not",
"None",
":"... | https://github.com/ApolloAuto/apollo-platform/blob/86d9dc6743b496ead18d597748ebabd34a513289/ros/third_party/lib_x86_64/python2.7/dist-packages/numpy/ma/core.py#L2434-L2439 | ||
fifengine/fifengine | 4b62c42e85bec19893cef8e63e6855927cff2c47 | engine/python/fife/extensions/pychan/widgets/common.py | python | gui2str | (text) | This function returns an 8-bit representation of the
unicode string. This is useful for passing strings
to SWIG functions. | This function returns an 8-bit representation of the
unicode string. This is useful for passing strings
to SWIG functions. | [
"This",
"function",
"returns",
"an",
"8",
"-",
"bit",
"representation",
"of",
"the",
"unicode",
"string",
".",
"This",
"is",
"useful",
"for",
"passing",
"strings",
"to",
"SWIG",
"functions",
"."
] | def gui2str(text):
"""
This function returns an 8-bit representation of the
unicode string. This is useful for passing strings
to SWIG functions.
"""
try:
return text.__str__()
except:
# String contains non-ascii characters
return text.encode("utf-8") | [
"def",
"gui2str",
"(",
"text",
")",
":",
"try",
":",
"return",
"text",
".",
"__str__",
"(",
")",
"except",
":",
"# String contains non-ascii characters",
"return",
"text",
".",
"encode",
"(",
"\"utf-8\"",
")"
] | https://github.com/fifengine/fifengine/blob/4b62c42e85bec19893cef8e63e6855927cff2c47/engine/python/fife/extensions/pychan/widgets/common.py#L66-L76 | ||
hpi-xnor/BMXNet | ed0b201da6667887222b8e4b5f997c4f6b61943d | amalgamation/python/mxnet_predict.py | python | _find_lib_path | () | return lib_path | Find mxnet library. | Find mxnet library. | [
"Find",
"mxnet",
"library",
"."
] | def _find_lib_path():
"""Find mxnet library."""
curr_path = os.path.dirname(os.path.abspath(os.path.expanduser(__file__)))
api_path = os.path.join(curr_path, '../../lib/')
dll_path = [curr_path, api_path]
dll_path = [os.path.join(p, 'libmxnet.so') for p in dll_path] + \
[os.path.join(p, 'lib... | [
"def",
"_find_lib_path",
"(",
")",
":",
"curr_path",
"=",
"os",
".",
"path",
".",
"dirname",
"(",
"os",
".",
"path",
".",
"abspath",
"(",
"os",
".",
"path",
".",
"expanduser",
"(",
"__file__",
")",
")",
")",
"api_path",
"=",
"os",
".",
"path",
".",... | https://github.com/hpi-xnor/BMXNet/blob/ed0b201da6667887222b8e4b5f997c4f6b61943d/amalgamation/python/mxnet_predict.py#L46-L57 | |
garbear/kodi-steamlink | 3f8e5970b01607cdb3c2688fbaa78e08f2d9c561 | tools/EventClients/lib/python/xbmcclient.py | python | PacketHELO.__init__ | (self, devicename=None, icon_type=ICON_NONE, icon_file=None) | Keyword arguments:
devicename -- the string that identifies the client
icon_type -- one of ICON_NONE, ICON_JPEG, ICON_PNG, ICON_GIF
icon_file -- location of icon file with respect to current working
directory if icon_type is not ICON_NONE | Keyword arguments:
devicename -- the string that identifies the client
icon_type -- one of ICON_NONE, ICON_JPEG, ICON_PNG, ICON_GIF
icon_file -- location of icon file with respect to current working
directory if icon_type is not ICON_NONE | [
"Keyword",
"arguments",
":",
"devicename",
"--",
"the",
"string",
"that",
"identifies",
"the",
"client",
"icon_type",
"--",
"one",
"of",
"ICON_NONE",
"ICON_JPEG",
"ICON_PNG",
"ICON_GIF",
"icon_file",
"--",
"location",
"of",
"icon",
"file",
"with",
"respect",
"to... | def __init__(self, devicename=None, icon_type=ICON_NONE, icon_file=None):
"""
Keyword arguments:
devicename -- the string that identifies the client
icon_type -- one of ICON_NONE, ICON_JPEG, ICON_PNG, ICON_GIF
icon_file -- location of icon file with respect to current working
... | [
"def",
"__init__",
"(",
"self",
",",
"devicename",
"=",
"None",
",",
"icon_type",
"=",
"ICON_NONE",
",",
"icon_file",
"=",
"None",
")",
":",
"Packet",
".",
"__init__",
"(",
"self",
")",
"self",
".",
"packettype",
"=",
"PT_HELO",
"self",
".",
"icontype",
... | https://github.com/garbear/kodi-steamlink/blob/3f8e5970b01607cdb3c2688fbaa78e08f2d9c561/tools/EventClients/lib/python/xbmcclient.py#L268-L286 | ||
OSGeo/gdal | 3748fc4ba4fba727492774b2b908a2130c864a83 | swig/python/osgeo/ogr.py | python | Feature.SetNativeData | (self, *args) | return _ogr.Feature_SetNativeData(self, *args) | r"""
SetNativeData(Feature self, char const * nativeData)
void
OGR_F_SetNativeData(OGRFeatureH hFeat, const char *pszNativeData)
Sets the native data for the feature.
The native data is the representation in a "natural" form that comes
from the driver that created this ... | r"""
SetNativeData(Feature self, char const * nativeData)
void
OGR_F_SetNativeData(OGRFeatureH hFeat, const char *pszNativeData) | [
"r",
"SetNativeData",
"(",
"Feature",
"self",
"char",
"const",
"*",
"nativeData",
")",
"void",
"OGR_F_SetNativeData",
"(",
"OGRFeatureH",
"hFeat",
"const",
"char",
"*",
"pszNativeData",
")"
] | def SetNativeData(self, *args):
r"""
SetNativeData(Feature self, char const * nativeData)
void
OGR_F_SetNativeData(OGRFeatureH hFeat, const char *pszNativeData)
Sets the native data for the feature.
The native data is the representation in a "natural" form that comes
... | [
"def",
"SetNativeData",
"(",
"self",
",",
"*",
"args",
")",
":",
"return",
"_ogr",
".",
"Feature_SetNativeData",
"(",
"self",
",",
"*",
"args",
")"
] | https://github.com/OSGeo/gdal/blob/3748fc4ba4fba727492774b2b908a2130c864a83/swig/python/osgeo/ogr.py#L4118-L4148 | |
microsoft/TSS.MSR | 0f2516fca2cd9929c31d5450e39301c9bde43688 | TSS.Py/src/Tpm.py | python | Tpm.GetTestResult | (self) | return self.processResponse(respBuf, GetTestResultResponse) | This command returns manufacturer-specific information regarding the
results of a self-test and an indication of the test status.
Returns:
outData - Test result data
contains manufacturer-specific information
testResult - TBD | This command returns manufacturer-specific information regarding the
results of a self-test and an indication of the test status. | [
"This",
"command",
"returns",
"manufacturer",
"-",
"specific",
"information",
"regarding",
"the",
"results",
"of",
"a",
"self",
"-",
"test",
"and",
"an",
"indication",
"of",
"the",
"test",
"status",
"."
] | def GetTestResult(self):
""" This command returns manufacturer-specific information regarding the
results of a self-test and an indication of the test status.
Returns:
outData - Test result data
contains manufacturer-specific information
testResult ... | [
"def",
"GetTestResult",
"(",
"self",
")",
":",
"req",
"=",
"TPM2_GetTestResult_REQUEST",
"(",
")",
"respBuf",
"=",
"self",
".",
"dispatchCommand",
"(",
"TPM_CC",
".",
"GetTestResult",
",",
"req",
")",
"return",
"self",
".",
"processResponse",
"(",
"respBuf",
... | https://github.com/microsoft/TSS.MSR/blob/0f2516fca2cd9929c31d5450e39301c9bde43688/TSS.Py/src/Tpm.py#L75-L86 | |
SequoiaDB/SequoiaDB | 2894ed7e5bd6fe57330afc900cf76d0ff0df9f64 | driver/python/bson/objectid.py | python | ObjectId.__getstate__ | (self) | return self.__id | return value of object for pickling.
needed explicitly because __slots__() defined. | return value of object for pickling.
needed explicitly because __slots__() defined. | [
"return",
"value",
"of",
"object",
"for",
"pickling",
".",
"needed",
"explicitly",
"because",
"__slots__",
"()",
"defined",
"."
] | def __getstate__(self):
"""return value of object for pickling.
needed explicitly because __slots__() defined.
"""
return self.__id | [
"def",
"__getstate__",
"(",
"self",
")",
":",
"return",
"self",
".",
"__id"
] | https://github.com/SequoiaDB/SequoiaDB/blob/2894ed7e5bd6fe57330afc900cf76d0ff0df9f64/driver/python/bson/objectid.py#L229-L233 | |
catboost/catboost | 167f64f237114a4d10b2b4ee42adb4569137debe | contrib/tools/python3/src/Lib/lib2to3/fixes/fix_urllib.py | python | FixUrllib.transform_dot | (self, node, results) | Transform for calls to module members in code. | Transform for calls to module members in code. | [
"Transform",
"for",
"calls",
"to",
"module",
"members",
"in",
"code",
"."
] | def transform_dot(self, node, results):
"""Transform for calls to module members in code."""
module_dot = results.get("bare_with_attr")
member = results.get("member")
new_name = None
if isinstance(member, list):
member = member[0]
for change in MAPPING[module_... | [
"def",
"transform_dot",
"(",
"self",
",",
"node",
",",
"results",
")",
":",
"module_dot",
"=",
"results",
".",
"get",
"(",
"\"bare_with_attr\"",
")",
"member",
"=",
"results",
".",
"get",
"(",
"\"member\"",
")",
"new_name",
"=",
"None",
"if",
"isinstance",... | https://github.com/catboost/catboost/blob/167f64f237114a4d10b2b4ee42adb4569137debe/contrib/tools/python3/src/Lib/lib2to3/fixes/fix_urllib.py#L168-L183 | ||
BlzFans/wke | b0fa21158312e40c5fbd84682d643022b6c34a93 | cygwin/lib/python2.6/dis.py | python | dis | (x=None) | Disassemble classes, methods, functions, or code.
With no argument, disassemble the last traceback. | Disassemble classes, methods, functions, or code. | [
"Disassemble",
"classes",
"methods",
"functions",
"or",
"code",
"."
] | def dis(x=None):
"""Disassemble classes, methods, functions, or code.
With no argument, disassemble the last traceback.
"""
if x is None:
distb()
return
if type(x) is types.InstanceType:
x = x.__class__
if hasattr(x, 'im_func'):
x = x.im_func
if hasattr(x, '... | [
"def",
"dis",
"(",
"x",
"=",
"None",
")",
":",
"if",
"x",
"is",
"None",
":",
"distb",
"(",
")",
"return",
"if",
"type",
"(",
"x",
")",
"is",
"types",
".",
"InstanceType",
":",
"x",
"=",
"x",
".",
"__class__",
"if",
"hasattr",
"(",
"x",
",",
"... | https://github.com/BlzFans/wke/blob/b0fa21158312e40c5fbd84682d643022b6c34a93/cygwin/lib/python2.6/dis.py#L12-L48 | ||
mantidproject/mantid | 03deeb89254ec4289edb8771e0188c2090a02f32 | scripts/SANS/SANSUserFileParser.py | python | BackCommandParser._parse | (self, arguments) | Parse the arguments and store the results
@param arguments: the string containing the arguments
@raise RuntimeError: If the argument cannot be parsed correctly | Parse the arguments and store the results | [
"Parse",
"the",
"arguments",
"and",
"store",
"the",
"results"
] | def _parse(self, arguments):
'''
Parse the arguments and store the results
@param arguments: the string containing the arguments
@raise RuntimeError: If the argument cannot be parsed correctly
'''
to_parse = self._prepare_argument(arguments)
if not self.can_attem... | [
"def",
"_parse",
"(",
"self",
",",
"arguments",
")",
":",
"to_parse",
"=",
"self",
".",
"_prepare_argument",
"(",
"arguments",
")",
"if",
"not",
"self",
".",
"can_attempt_to_parse",
"(",
"arguments",
")",
":",
"raise",
"RuntimeError",
"(",
"\"BackCommandParser... | https://github.com/mantidproject/mantid/blob/03deeb89254ec4289edb8771e0188c2090a02f32/scripts/SANS/SANSUserFileParser.py#L216-L233 | ||
baidu-research/tensorflow-allreduce | 66d5b855e90b0949e9fa5cca5599fd729a70e874 | tensorflow/python/ops/control_flow_ops.py | python | _GetLoopConstantEnter | (value) | return op if _IsLoopConstantEnter(op) else None | Return the enter op if we can infer `value` to be a loop invariant. | Return the enter op if we can infer `value` to be a loop invariant. | [
"Return",
"the",
"enter",
"op",
"if",
"we",
"can",
"infer",
"value",
"to",
"be",
"a",
"loop",
"invariant",
"."
] | def _GetLoopConstantEnter(value):
"""Return the enter op if we can infer `value` to be a loop invariant."""
id_ops = {"Switch", "RefSwitch", "Identity", "RefIdentity"}
op = value.op
while op.type in id_ops:
op = op.inputs[0].op
return op if _IsLoopConstantEnter(op) else None | [
"def",
"_GetLoopConstantEnter",
"(",
"value",
")",
":",
"id_ops",
"=",
"{",
"\"Switch\"",
",",
"\"RefSwitch\"",
",",
"\"Identity\"",
",",
"\"RefIdentity\"",
"}",
"op",
"=",
"value",
".",
"op",
"while",
"op",
".",
"type",
"in",
"id_ops",
":",
"op",
"=",
"... | https://github.com/baidu-research/tensorflow-allreduce/blob/66d5b855e90b0949e9fa5cca5599fd729a70e874/tensorflow/python/ops/control_flow_ops.py#L469-L475 | |
libfive/libfive | ab5e354cf6fd992f80aaa9432c52683219515c8a | libfive/bind/python/libfive/stdlib/transforms.py | python | twirl_y | (shape, amount, radius, center=(0, 0, 0)) | return Shape(stdlib.twirl_y(
args[0].ptr,
args[1].ptr,
args[2].ptr,
tvec3(*[a.ptr for a in args[3]]))) | Twirls the shape in the y axis about the (optional) center point | Twirls the shape in the y axis about the (optional) center point | [
"Twirls",
"the",
"shape",
"in",
"the",
"y",
"axis",
"about",
"the",
"(",
"optional",
")",
"center",
"point"
] | def twirl_y(shape, amount, radius, center=(0, 0, 0)):
""" Twirls the shape in the y axis about the (optional) center point
"""
args = [Shape.wrap(shape), Shape.wrap(amount), Shape.wrap(radius), list([Shape.wrap(i) for i in center])]
return Shape(stdlib.twirl_y(
args[0].ptr,
args[1].ptr,
... | [
"def",
"twirl_y",
"(",
"shape",
",",
"amount",
",",
"radius",
",",
"center",
"=",
"(",
"0",
",",
"0",
",",
"0",
")",
")",
":",
"args",
"=",
"[",
"Shape",
".",
"wrap",
"(",
"shape",
")",
",",
"Shape",
".",
"wrap",
"(",
"amount",
")",
",",
"Sha... | https://github.com/libfive/libfive/blob/ab5e354cf6fd992f80aaa9432c52683219515c8a/libfive/bind/python/libfive/stdlib/transforms.py#L459-L467 | |
wxWidgets/wxPython-Classic | 19571e1ae65f1ac445f5491474121998c97a1bf0 | wx/py/buffer.py | python | Buffer.addEditor | (self, editor) | Add an editor. | Add an editor. | [
"Add",
"an",
"editor",
"."
] | def addEditor(self, editor):
"""Add an editor."""
self.editor = editor
self.editors[editor.id] = editor | [
"def",
"addEditor",
"(",
"self",
",",
"editor",
")",
":",
"self",
".",
"editor",
"=",
"editor",
"self",
".",
"editors",
"[",
"editor",
".",
"id",
"]",
"=",
"editor"
] | https://github.com/wxWidgets/wxPython-Classic/blob/19571e1ae65f1ac445f5491474121998c97a1bf0/wx/py/buffer.py#L42-L45 | ||
magazino/move_base_flex | a8ca484e354a0196b5e9fbda5f0eae311d9b72d3 | git-clang-format.py | python | interpret_args | (args, dash_dash, default_commit) | return commits, files | Interpret `args` as "[commits] [--] [files]" and return (commits, files).
It is assumed that "--" and everything that follows has been removed from
args and placed in `dash_dash`.
If "--" is present (i.e., `dash_dash` is non-empty), the arguments to its
left (if present) are taken as commits. Otherwise, the ... | Interpret `args` as "[commits] [--] [files]" and return (commits, files). | [
"Interpret",
"args",
"as",
"[",
"commits",
"]",
"[",
"--",
"]",
"[",
"files",
"]",
"and",
"return",
"(",
"commits",
"files",
")",
"."
] | def interpret_args(args, dash_dash, default_commit):
"""Interpret `args` as "[commits] [--] [files]" and return (commits, files).
It is assumed that "--" and everything that follows has been removed from
args and placed in `dash_dash`.
If "--" is present (i.e., `dash_dash` is non-empty), the arguments to its
... | [
"def",
"interpret_args",
"(",
"args",
",",
"dash_dash",
",",
"default_commit",
")",
":",
"if",
"dash_dash",
":",
"if",
"len",
"(",
"args",
")",
"==",
"0",
":",
"commits",
"=",
"[",
"default_commit",
"]",
"else",
":",
"commits",
"=",
"args",
"for",
"com... | https://github.com/magazino/move_base_flex/blob/a8ca484e354a0196b5e9fbda5f0eae311d9b72d3/git-clang-format.py#L202-L237 | |
catboost/catboost | 167f64f237114a4d10b2b4ee42adb4569137debe | contrib/python/ipython/py3/IPython/core/profiledir.py | python | ProfileDir.find_profile_dir | (cls, profile_dir, config=None) | return cls(location=profile_dir, config=config) | Find/create a profile dir and return its ProfileDir.
This will create the profile directory if it doesn't exist.
Parameters
----------
profile_dir : unicode or str
The path of the profile directory. | Find/create a profile dir and return its ProfileDir. | [
"Find",
"/",
"create",
"a",
"profile",
"dir",
"and",
"return",
"its",
"ProfileDir",
"."
] | def find_profile_dir(cls, profile_dir, config=None):
"""Find/create a profile dir and return its ProfileDir.
This will create the profile directory if it doesn't exist.
Parameters
----------
profile_dir : unicode or str
The path of the profile directory.
"""... | [
"def",
"find_profile_dir",
"(",
"cls",
",",
"profile_dir",
",",
"config",
"=",
"None",
")",
":",
"profile_dir",
"=",
"expand_path",
"(",
"profile_dir",
")",
"if",
"not",
"os",
".",
"path",
".",
"isdir",
"(",
"profile_dir",
")",
":",
"raise",
"ProfileDirErr... | https://github.com/catboost/catboost/blob/167f64f237114a4d10b2b4ee42adb4569137debe/contrib/python/ipython/py3/IPython/core/profiledir.py#L208-L221 | |
thalium/icebox | 99d147d5b9269222225443ce171b4fd46d8985d4 | third_party/virtualbox/src/libs/libxml2-2.9.4/python/libxml2.py | python | parserCtxt.parseCDSect | (self) | Parse escaped pure raw content. [18] CDSect ::= CDStart
CData CDEnd [19] CDStart ::= '<![CDATA[' [20] Data ::=
(Char* - (Char* ']]>' Char*)) [21] CDEnd ::= ']]>' | Parse escaped pure raw content. [18] CDSect ::= CDStart
CData CDEnd [19] CDStart ::= '<![CDATA[' [20] Data ::=
(Char* - (Char* ']]>' Char*)) [21] CDEnd ::= ']]>' | [
"Parse",
"escaped",
"pure",
"raw",
"content",
".",
"[",
"18",
"]",
"CDSect",
"::",
"=",
"CDStart",
"CData",
"CDEnd",
"[",
"19",
"]",
"CDStart",
"::",
"=",
"<!",
"[",
"CDATA",
"[",
"[",
"20",
"]",
"Data",
"::",
"=",
"(",
"Char",
"*",
"-",
"(",
"... | def parseCDSect(self):
"""Parse escaped pure raw content. [18] CDSect ::= CDStart
CData CDEnd [19] CDStart ::= '<![CDATA[' [20] Data ::=
(Char* - (Char* ']]>' Char*)) [21] CDEnd ::= ']]>' """
libxml2mod.xmlParseCDSect(self._o) | [
"def",
"parseCDSect",
"(",
"self",
")",
":",
"libxml2mod",
".",
"xmlParseCDSect",
"(",
"self",
".",
"_o",
")"
] | https://github.com/thalium/icebox/blob/99d147d5b9269222225443ce171b4fd46d8985d4/third_party/virtualbox/src/libs/libxml2-2.9.4/python/libxml2.py#L5205-L5209 | ||
Xilinx/Vitis-AI | fc74d404563d9951b57245443c73bef389f3657f | tools/Vitis-AI-Runtime/VART/vart/rnn-runner/apps/imdb_sentiment_detection/utils/hdf5_format.py | python | load_weights_from_hdf5_group | (f, layers) | Implements topological (order-based) weight loading.
Arguments:
f: A pointer to a HDF5 group.
layers: a list of target layers.
Raises:
ValueError: in case of mismatch between provided layers
and weights file. | Implements topological (order-based) weight loading. | [
"Implements",
"topological",
"(",
"order",
"-",
"based",
")",
"weight",
"loading",
"."
] | def load_weights_from_hdf5_group(f, layers):
"""Implements topological (order-based) weight loading.
Arguments:
f: A pointer to a HDF5 group.
layers: a list of target layers.
Raises:
ValueError: in case of mismatch between provided layers
and weights file.
"""
if 'keras_version' ... | [
"def",
"load_weights_from_hdf5_group",
"(",
"f",
",",
"layers",
")",
":",
"if",
"'keras_version'",
"in",
"f",
".",
"attrs",
":",
"original_keras_version",
"=",
"f",
".",
"attrs",
"[",
"'keras_version'",
"]",
"else",
":",
"original_keras_version",
"=",
"'1'",
"... | https://github.com/Xilinx/Vitis-AI/blob/fc74d404563d9951b57245443c73bef389f3657f/tools/Vitis-AI-Runtime/VART/vart/rnn-runner/apps/imdb_sentiment_detection/utils/hdf5_format.py#L653-L713 | ||
wxWidgets/wxPython-Classic | 19571e1ae65f1ac445f5491474121998c97a1bf0 | wx/lib/agw/ultimatelistctrl.py | python | UltimateListMainWindow.HideWindows | (self) | Hides the windows associated to the items. Used internally. | Hides the windows associated to the items. Used internally. | [
"Hides",
"the",
"windows",
"associated",
"to",
"the",
"items",
".",
"Used",
"internally",
"."
] | def HideWindows(self):
""" Hides the windows associated to the items. Used internally. """
for child in self._itemWithWindow:
wnd = child.GetWindow()
if wnd:
wnd.Hide() | [
"def",
"HideWindows",
"(",
"self",
")",
":",
"for",
"child",
"in",
"self",
".",
"_itemWithWindow",
":",
"wnd",
"=",
"child",
".",
"GetWindow",
"(",
")",
"if",
"wnd",
":",
"wnd",
".",
"Hide",
"(",
")"
] | https://github.com/wxWidgets/wxPython-Classic/blob/19571e1ae65f1ac445f5491474121998c97a1bf0/wx/lib/agw/ultimatelistctrl.py#L7047-L7053 | ||
ivansafrin/Polycode | 37a40fefe194ec7f6e9d1257f3bb3517b0a168bc | Bindings/Scripts/create_lua_library/CppHeaderParser3.py | python | is_namespace | (nameStack) | return False | Determines if a namespace is being specified | Determines if a namespace is being specified | [
"Determines",
"if",
"a",
"namespace",
"is",
"being",
"specified"
] | def is_namespace(nameStack):
"""Determines if a namespace is being specified"""
if len(nameStack) == 0:
return False
if nameStack[0] == "namespace":
return True
return False | [
"def",
"is_namespace",
"(",
"nameStack",
")",
":",
"if",
"len",
"(",
"nameStack",
")",
"==",
"0",
":",
"return",
"False",
"if",
"nameStack",
"[",
"0",
"]",
"==",
"\"namespace\"",
":",
"return",
"True",
"return",
"False"
] | https://github.com/ivansafrin/Polycode/blob/37a40fefe194ec7f6e9d1257f3bb3517b0a168bc/Bindings/Scripts/create_lua_library/CppHeaderParser3.py#L201-L207 | |
wyrover/book-code | 7f4883d9030d553bc6bcfa3da685e34789839900 | 3rdparty/protobuf/python/google/protobuf/internal/python_message.py | python | _AddEqualsMethod | (message_descriptor, cls) | Helper for _AddMessageMethods(). | Helper for _AddMessageMethods(). | [
"Helper",
"for",
"_AddMessageMethods",
"()",
"."
] | def _AddEqualsMethod(message_descriptor, cls):
"""Helper for _AddMessageMethods()."""
def __eq__(self, other):
if (not isinstance(other, message_mod.Message) or
other.DESCRIPTOR != self.DESCRIPTOR):
return False
if self is other:
return True
if self.DESCRIPTOR.full_name == _AnyFull... | [
"def",
"_AddEqualsMethod",
"(",
"message_descriptor",
",",
"cls",
")",
":",
"def",
"__eq__",
"(",
"self",
",",
"other",
")",
":",
"if",
"(",
"not",
"isinstance",
"(",
"other",
",",
"message_mod",
".",
"Message",
")",
"or",
"other",
".",
"DESCRIPTOR",
"!=... | https://github.com/wyrover/book-code/blob/7f4883d9030d553bc6bcfa3da685e34789839900/3rdparty/protobuf/python/google/protobuf/internal/python_message.py#L951-L978 | ||
microsoft/TSS.MSR | 0f2516fca2cd9929c31d5450e39301c9bde43688 | TSS.Py/src/TpmTypes.py | python | TPM2_PolicyGetDigest_REQUEST.__init__ | (self, policySession = TPM_HANDLE()) | This command returns the current policyDigest of the session. This
command allows the TPM to be used to perform the actions required to
pre-compute the authPolicy for an object.
Attributes:
policySession (TPM_HANDLE): Handle for the policy session
Auth Index: None | This command returns the current policyDigest of the session. This
command allows the TPM to be used to perform the actions required to
pre-compute the authPolicy for an object. | [
"This",
"command",
"returns",
"the",
"current",
"policyDigest",
"of",
"the",
"session",
".",
"This",
"command",
"allows",
"the",
"TPM",
"to",
"be",
"used",
"to",
"perform",
"the",
"actions",
"required",
"to",
"pre",
"-",
"compute",
"the",
"authPolicy",
"for"... | def __init__(self, policySession = TPM_HANDLE()):
""" This command returns the current policyDigest of the session. This
command allows the TPM to be used to perform the actions required to
pre-compute the authPolicy for an object.
Attributes:
policySession (TPM_HANDLE): Han... | [
"def",
"__init__",
"(",
"self",
",",
"policySession",
"=",
"TPM_HANDLE",
"(",
")",
")",
":",
"self",
".",
"policySession",
"=",
"policySession"
] | https://github.com/microsoft/TSS.MSR/blob/0f2516fca2cd9929c31d5450e39301c9bde43688/TSS.Py/src/TpmTypes.py#L15029-L15038 | ||
smartdevicelink/sdl_core | 68f082169e0a40fccd9eb0db3c83911c28870f07 | tools/InterfaceGenerator/MsgVersionGenerate.py | python | store_data_to_file | (path_to_storage, data_for_storage) | Stores data with major and minor version
to file generated_msg_version.h | Stores data with major and minor version
to file generated_msg_version.h | [
"Stores",
"data",
"with",
"major",
"and",
"minor",
"version",
"to",
"file",
"generated_msg_version",
".",
"h"
] | def store_data_to_file(path_to_storage, data_for_storage):
"""Stores data with major and minor version
to file generated_msg_version.h
"""
path_to_storage = path_to_storage + "/generated_msg_version.h"
fh = open(path_to_storage, 'w')
fh.write(data_for_storage)
fh.close() | [
"def",
"store_data_to_file",
"(",
"path_to_storage",
",",
"data_for_storage",
")",
":",
"path_to_storage",
"=",
"path_to_storage",
"+",
"\"/generated_msg_version.h\"",
"fh",
"=",
"open",
"(",
"path_to_storage",
",",
"'w'",
")",
"fh",
".",
"write",
"(",
"data_for_sto... | https://github.com/smartdevicelink/sdl_core/blob/68f082169e0a40fccd9eb0db3c83911c28870f07/tools/InterfaceGenerator/MsgVersionGenerate.py#L43-L50 | ||
aws/lumberyard | f85344403c1c2e77ec8c75deb2c116e97b713217 | dev/Tools/Python/3.7.10/mac/Python.framework/Versions/3.7/lib/python3.7/distutils/dist.py | python | DistributionMetadata.write_pkg_file | (self, file) | Write the PKG-INFO format data to a file object. | Write the PKG-INFO format data to a file object. | [
"Write",
"the",
"PKG",
"-",
"INFO",
"format",
"data",
"to",
"a",
"file",
"object",
"."
] | def write_pkg_file(self, file):
"""Write the PKG-INFO format data to a file object.
"""
version = '1.0'
if (self.provides or self.requires or self.obsoletes or
self.classifiers or self.download_url):
version = '1.1'
file.write('Metadata-Version: %s\n'... | [
"def",
"write_pkg_file",
"(",
"self",
",",
"file",
")",
":",
"version",
"=",
"'1.0'",
"if",
"(",
"self",
".",
"provides",
"or",
"self",
".",
"requires",
"or",
"self",
".",
"obsoletes",
"or",
"self",
".",
"classifiers",
"or",
"self",
".",
"download_url",
... | https://github.com/aws/lumberyard/blob/f85344403c1c2e77ec8c75deb2c116e97b713217/dev/Tools/Python/3.7.10/mac/Python.framework/Versions/3.7/lib/python3.7/distutils/dist.py#L1119-L1151 | ||
psi4/psi4 | be533f7f426b6ccc263904e55122899b16663395 | psi4/driver/qcdb/molpro2.py | python | psi4_list | () | return procedures['energy'].keys() | Return an array of Psi4 methods with energies. | Return an array of Psi4 methods with energies. | [
"Return",
"an",
"array",
"of",
"Psi4",
"methods",
"with",
"energies",
"."
] | def psi4_list():
"""Return an array of Psi4 methods with energies.
"""
return procedures['energy'].keys() | [
"def",
"psi4_list",
"(",
")",
":",
"return",
"procedures",
"[",
"'energy'",
"]",
".",
"keys",
"(",
")"
] | https://github.com/psi4/psi4/blob/be533f7f426b6ccc263904e55122899b16663395/psi4/driver/qcdb/molpro2.py#L577-L581 | |
kamyu104/LeetCode-Solutions | 77605708a927ea3b85aee5a479db733938c7c211 | Python/fibonacci-number.py | python | Solution.fib | (self, N) | return matrix_mult([[1, 0]], matrix_expo(T, N))[0][1] | :type N: int
:rtype: int | :type N: int
:rtype: int | [
":",
"type",
"N",
":",
"int",
":",
"rtype",
":",
"int"
] | def fib(self, N):
"""
:type N: int
:rtype: int
"""
def matrix_expo(A, K):
result = [[int(i==j) for j in xrange(len(A))] \
for i in xrange(len(A))]
while K:
if K % 2:
result = matrix_mult(result, A)
... | [
"def",
"fib",
"(",
"self",
",",
"N",
")",
":",
"def",
"matrix_expo",
"(",
"A",
",",
"K",
")",
":",
"result",
"=",
"[",
"[",
"int",
"(",
"i",
"==",
"j",
")",
"for",
"j",
"in",
"xrange",
"(",
"len",
"(",
"A",
")",
")",
"]",
"for",
"i",
"in"... | https://github.com/kamyu104/LeetCode-Solutions/blob/77605708a927ea3b85aee5a479db733938c7c211/Python/fibonacci-number.py#L8-L30 | |
wxWidgets/wxPython-Classic | 19571e1ae65f1ac445f5491474121998c97a1bf0 | wx/tools/Editra/src/ebmlib/fileutil.py | python | GetPathName | (path) | return os.path.split(path)[0] | Gets the path minus filename
@param path: full path to get base of | Gets the path minus filename
@param path: full path to get base of | [
"Gets",
"the",
"path",
"minus",
"filename",
"@param",
"path",
":",
"full",
"path",
"to",
"get",
"base",
"of"
] | def GetPathName(path):
"""Gets the path minus filename
@param path: full path to get base of
"""
return os.path.split(path)[0] | [
"def",
"GetPathName",
"(",
"path",
")",
":",
"return",
"os",
".",
"path",
".",
"split",
"(",
"path",
")",
"[",
"0",
"]"
] | https://github.com/wxWidgets/wxPython-Classic/blob/19571e1ae65f1ac445f5491474121998c97a1bf0/wx/tools/Editra/src/ebmlib/fileutil.py#L186-L191 | |
mindspore-ai/mindspore | fb8fd3338605bb34fa5cea054e535a8b1d753fab | mindspore/python/mindspore/ops/composite/multitype_ops/negative_impl.py | python | _neg_scalar | (x) | return F.scalar_usub(x) | Returns the negative value of scalar x.
Outputs:
Number, negative value of x. | Returns the negative value of scalar x. | [
"Returns",
"the",
"negative",
"value",
"of",
"scalar",
"x",
"."
] | def _neg_scalar(x):
"""
Returns the negative value of scalar x.
Outputs:
Number, negative value of x.
"""
return F.scalar_usub(x) | [
"def",
"_neg_scalar",
"(",
"x",
")",
":",
"return",
"F",
".",
"scalar_usub",
"(",
"x",
")"
] | https://github.com/mindspore-ai/mindspore/blob/fb8fd3338605bb34fa5cea054e535a8b1d753fab/mindspore/python/mindspore/ops/composite/multitype_ops/negative_impl.py#L30-L37 | |
wxWidgets/wxPython-Classic | 19571e1ae65f1ac445f5491474121998c97a1bf0 | src/osx_carbon/aui.py | python | AuiPaneInfo.HasMinimizeButton | (*args, **kwargs) | return _aui.AuiPaneInfo_HasMinimizeButton(*args, **kwargs) | HasMinimizeButton(self) -> bool | HasMinimizeButton(self) -> bool | [
"HasMinimizeButton",
"(",
"self",
")",
"-",
">",
"bool"
] | def HasMinimizeButton(*args, **kwargs):
"""HasMinimizeButton(self) -> bool"""
return _aui.AuiPaneInfo_HasMinimizeButton(*args, **kwargs) | [
"def",
"HasMinimizeButton",
"(",
"*",
"args",
",",
"*",
"*",
"kwargs",
")",
":",
"return",
"_aui",
".",
"AuiPaneInfo_HasMinimizeButton",
"(",
"*",
"args",
",",
"*",
"*",
"kwargs",
")"
] | https://github.com/wxWidgets/wxPython-Classic/blob/19571e1ae65f1ac445f5491474121998c97a1bf0/src/osx_carbon/aui.py#L321-L323 | |
okex/V3-Open-API-SDK | c5abb0db7e2287718e0055e17e57672ce0ec7fd9 | okex-python-sdk-api/venv/Lib/site-packages/pip-19.0.3-py3.8.egg/pip/_vendor/urllib3/request.py | python | RequestMethods.request | (self, method, url, fields=None, headers=None, **urlopen_kw) | Make a request using :meth:`urlopen` with the appropriate encoding of
``fields`` based on the ``method`` used.
This is a convenience method that requires the least amount of manual
effort. It can be used in most situations, while still having the
option to drop down to more specific met... | Make a request using :meth:`urlopen` with the appropriate encoding of
``fields`` based on the ``method`` used. | [
"Make",
"a",
"request",
"using",
":",
"meth",
":",
"urlopen",
"with",
"the",
"appropriate",
"encoding",
"of",
"fields",
"based",
"on",
"the",
"method",
"used",
"."
] | def request(self, method, url, fields=None, headers=None, **urlopen_kw):
"""
Make a request using :meth:`urlopen` with the appropriate encoding of
``fields`` based on the ``method`` used.
This is a convenience method that requires the least amount of manual
effort. It can be use... | [
"def",
"request",
"(",
"self",
",",
"method",
",",
"url",
",",
"fields",
"=",
"None",
",",
"headers",
"=",
"None",
",",
"*",
"*",
"urlopen_kw",
")",
":",
"method",
"=",
"method",
".",
"upper",
"(",
")",
"urlopen_kw",
"[",
"'request_url'",
"]",
"=",
... | https://github.com/okex/V3-Open-API-SDK/blob/c5abb0db7e2287718e0055e17e57672ce0ec7fd9/okex-python-sdk-api/venv/Lib/site-packages/pip-19.0.3-py3.8.egg/pip/_vendor/urllib3/request.py#L50-L72 | ||
wxWidgets/wxPython-Classic | 19571e1ae65f1ac445f5491474121998c97a1bf0 | src/msw/_core.py | python | Event.GetEventCategory | (*args, **kwargs) | return _core_.Event_GetEventCategory(*args, **kwargs) | GetEventCategory(self) -> int | GetEventCategory(self) -> int | [
"GetEventCategory",
"(",
"self",
")",
"-",
">",
"int"
] | def GetEventCategory(*args, **kwargs):
"""GetEventCategory(self) -> int"""
return _core_.Event_GetEventCategory(*args, **kwargs) | [
"def",
"GetEventCategory",
"(",
"*",
"args",
",",
"*",
"*",
"kwargs",
")",
":",
"return",
"_core_",
".",
"Event_GetEventCategory",
"(",
"*",
"args",
",",
"*",
"*",
"kwargs",
")"
] | https://github.com/wxWidgets/wxPython-Classic/blob/19571e1ae65f1ac445f5491474121998c97a1bf0/src/msw/_core.py#L5034-L5036 | |
SpenceKonde/megaTinyCore | 1c4a70b18a149fe6bcb551dfa6db11ca50b8997b | megaavr/tools/libs/serial/urlhandler/protocol_alt.py | python | serial_class_for_url | (url) | return (''.join([parts.netloc, parts.path]), cls) | extract host and port from an URL string | extract host and port from an URL string | [
"extract",
"host",
"and",
"port",
"from",
"an",
"URL",
"string"
] | def serial_class_for_url(url):
"""extract host and port from an URL string"""
parts = urlparse.urlsplit(url)
if parts.scheme != 'alt':
raise serial.SerialException(
'expected a string in the form "alt://port[?option[=value][&option[=value]]]": '
'not starting with alt:// ({!r... | [
"def",
"serial_class_for_url",
"(",
"url",
")",
":",
"parts",
"=",
"urlparse",
".",
"urlsplit",
"(",
"url",
")",
"if",
"parts",
".",
"scheme",
"!=",
"'alt'",
":",
"raise",
"serial",
".",
"SerialException",
"(",
"'expected a string in the form \"alt://port[?option[... | https://github.com/SpenceKonde/megaTinyCore/blob/1c4a70b18a149fe6bcb551dfa6db11ca50b8997b/megaavr/tools/libs/serial/urlhandler/protocol_alt.py#L27-L50 | |
hpi-xnor/BMXNet-v2 | af2b1859eafc5c721b1397cef02f946aaf2ce20d | python/mxnet/ndarray/ndarray.py | python | NDArray._fresh_grad | (self) | return out.value | Whether this array's corresponding gradient array
(registered via `autograd.mark_variables`) has been
updated by `autograd.backward` since last reset.
`_fresh_grad` need to be manually set to False
after consuming gradient (usually after updating this
array). | Whether this array's corresponding gradient array
(registered via `autograd.mark_variables`) has been
updated by `autograd.backward` since last reset. | [
"Whether",
"this",
"array",
"s",
"corresponding",
"gradient",
"array",
"(",
"registered",
"via",
"autograd",
".",
"mark_variables",
")",
"has",
"been",
"updated",
"by",
"autograd",
".",
"backward",
"since",
"last",
"reset",
"."
] | def _fresh_grad(self):
"""Whether this array's corresponding gradient array
(registered via `autograd.mark_variables`) has been
updated by `autograd.backward` since last reset.
`_fresh_grad` need to be manually set to False
after consuming gradient (usually after updating this
... | [
"def",
"_fresh_grad",
"(",
"self",
")",
":",
"out",
"=",
"ctypes",
".",
"c_int",
"(",
")",
"check_call",
"(",
"_LIB",
".",
"MXNDArrayGetGradState",
"(",
"self",
".",
"handle",
",",
"ctypes",
".",
"byref",
"(",
"out",
")",
")",
")",
"return",
"out",
"... | https://github.com/hpi-xnor/BMXNet-v2/blob/af2b1859eafc5c721b1397cef02f946aaf2ce20d/python/mxnet/ndarray/ndarray.py#L1982-L1993 | |
Xilinx/Vitis-AI | fc74d404563d9951b57245443c73bef389f3657f | tools/RNN/rnn_quantizer/pytorch_binding/pytorch_nndct/parse/parser.py | python | TorchParser._convert_blob_tensor_type | (graph) | r"""convert torch tensor info to nndct tensor info | r"""convert torch tensor info to nndct tensor info | [
"r",
"convert",
"torch",
"tensor",
"info",
"to",
"nndct",
"tensor",
"info"
] | def _convert_blob_tensor_type(graph):
r"""convert torch tensor info to nndct tensor info"""
for blob_tensor in graph.tensors:
# tensor_util.convert_blob_tensor_format(blob_tensor,
# tensor_util.FrameworkType.TORCH,
# ... | [
"def",
"_convert_blob_tensor_type",
"(",
"graph",
")",
":",
"for",
"blob_tensor",
"in",
"graph",
".",
"tensors",
":",
"# tensor_util.convert_blob_tensor_format(blob_tensor,",
"# tensor_util.FrameworkType.TORCH,",
"# ... | https://github.com/Xilinx/Vitis-AI/blob/fc74d404563d9951b57245443c73bef389f3657f/tools/RNN/rnn_quantizer/pytorch_binding/pytorch_nndct/parse/parser.py#L145-L151 | ||
MegEngine/MegEngine | ce9ad07a27ec909fb8db4dd67943d24ba98fb93a | imperative/python/megengine/core/tensor/array_method.py | python | ArrayMethodMixin.sum | (self, axis=None, keepdims: bool = False) | return _reduce("sum")(self, axis, keepdims) | r"""Returns the sum of each row of the input tensor in the given dimension ``axis``.
If ``axis`` is a list of axises, reduce over all of them.
If ``keepdims`` is ``True``, the shape of output tensor is the same as the input tensor,
except in the dimension(s) ``axis`` where it is of size 1.
... | r"""Returns the sum of each row of the input tensor in the given dimension ``axis``. | [
"r",
"Returns",
"the",
"sum",
"of",
"each",
"row",
"of",
"the",
"input",
"tensor",
"in",
"the",
"given",
"dimension",
"axis",
"."
] | def sum(self, axis=None, keepdims: bool = False):
r"""Returns the sum of each row of the input tensor in the given dimension ``axis``.
If ``axis`` is a list of axises, reduce over all of them.
If ``keepdims`` is ``True``, the shape of output tensor is the same as the input tensor,
excep... | [
"def",
"sum",
"(",
"self",
",",
"axis",
"=",
"None",
",",
"keepdims",
":",
"bool",
"=",
"False",
")",
":",
"return",
"_reduce",
"(",
"\"sum\"",
")",
"(",
"self",
",",
"axis",
",",
"keepdims",
")"
] | https://github.com/MegEngine/MegEngine/blob/ce9ad07a27ec909fb8db4dd67943d24ba98fb93a/imperative/python/megengine/core/tensor/array_method.py#L490-L521 | |
tensorflow/tensorflow | 419e3a6b650ea4bd1b0cba23c4348f8a69f3272e | tensorflow/python/keras/backend.py | python | depthwise_conv2d | (x,
depthwise_kernel,
strides=(1, 1),
padding='valid',
data_format=None,
dilation_rate=(1, 1)) | return x | 2D convolution with separable filters.
Args:
x: input tensor
depthwise_kernel: convolution kernel for the depthwise convolution.
strides: strides tuple (length 2).
padding: string, `"same"` or `"valid"`.
data_format: string, `"channels_last"` or `"channels_first"`.
dilation_rate: ... | 2D convolution with separable filters. | [
"2D",
"convolution",
"with",
"separable",
"filters",
"."
] | def depthwise_conv2d(x,
depthwise_kernel,
strides=(1, 1),
padding='valid',
data_format=None,
dilation_rate=(1, 1)):
"""2D convolution with separable filters.
Args:
x: input tensor
depthwise_kernel: ... | [
"def",
"depthwise_conv2d",
"(",
"x",
",",
"depthwise_kernel",
",",
"strides",
"=",
"(",
"1",
",",
"1",
")",
",",
"padding",
"=",
"'valid'",
",",
"data_format",
"=",
"None",
",",
"dilation_rate",
"=",
"(",
"1",
",",
"1",
")",
")",
":",
"if",
"data_for... | https://github.com/tensorflow/tensorflow/blob/419e3a6b650ea4bd1b0cba23c4348f8a69f3272e/tensorflow/python/keras/backend.py#L5552-L5597 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.