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 |
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
junhyukoh/caffe-lstm | 598d45456fa2a1b127a644f4aa38daa8fb9fc722 | scripts/cpp_lint.py | python | _CppLintState.IncrementErrorCount | (self, category) | Bumps the module's error statistic. | Bumps the module's error statistic. | [
"Bumps",
"the",
"module",
"s",
"error",
"statistic",
"."
] | def IncrementErrorCount(self, category):
"""Bumps the module's error statistic."""
self.error_count += 1
if self.counting in ('toplevel', 'detailed'):
if self.counting != 'detailed':
category = category.split('/')[0]
if category not in self.errors_by_category:
self.errors_by_cate... | [
"def",
"IncrementErrorCount",
"(",
"self",
",",
"category",
")",
":",
"self",
".",
"error_count",
"+=",
"1",
"if",
"self",
".",
"counting",
"in",
"(",
"'toplevel'",
",",
"'detailed'",
")",
":",
"if",
"self",
".",
"counting",
"!=",
"'detailed'",
":",
"cat... | https://github.com/junhyukoh/caffe-lstm/blob/598d45456fa2a1b127a644f4aa38daa8fb9fc722/scripts/cpp_lint.py#L747-L755 | ||
wxWidgets/wxPython-Classic | 19571e1ae65f1ac445f5491474121998c97a1bf0 | src/msw/_controls.py | python | GenericDirCtrl.SelectPath | (*args, **kwargs) | return _controls_.GenericDirCtrl_SelectPath(*args, **kwargs) | SelectPath(self, String path, bool select=True) | SelectPath(self, String path, bool select=True) | [
"SelectPath",
"(",
"self",
"String",
"path",
"bool",
"select",
"=",
"True",
")"
] | def SelectPath(*args, **kwargs):
"""SelectPath(self, String path, bool select=True)"""
return _controls_.GenericDirCtrl_SelectPath(*args, **kwargs) | [
"def",
"SelectPath",
"(",
"*",
"args",
",",
"*",
"*",
"kwargs",
")",
":",
"return",
"_controls_",
".",
"GenericDirCtrl_SelectPath",
"(",
"*",
"args",
",",
"*",
"*",
"kwargs",
")"
] | https://github.com/wxWidgets/wxPython-Classic/blob/19571e1ae65f1ac445f5491474121998c97a1bf0/src/msw/_controls.py#L5712-L5714 | |
Tencent/CMONGO | c40380caa14e05509f46993aa8b8da966b09b0b5 | src/third_party/scons-2.5.0/scons-time.py | python | SConsTimer.logfile_name | (self, invocation) | return os.path.join(self.outdir, name) | Returns the absolute path of a log file for the specificed
invocation number. | Returns the absolute path of a log file for the specificed
invocation number. | [
"Returns",
"the",
"absolute",
"path",
"of",
"a",
"log",
"file",
"for",
"the",
"specificed",
"invocation",
"number",
"."
] | def logfile_name(self, invocation):
"""
Returns the absolute path of a log file for the specificed
invocation number.
"""
name = self.prefix_run + '-%d.log' % invocation
return os.path.join(self.outdir, name) | [
"def",
"logfile_name",
"(",
"self",
",",
"invocation",
")",
":",
"name",
"=",
"self",
".",
"prefix_run",
"+",
"'-%d.log'",
"%",
"invocation",
"return",
"os",
".",
"path",
".",
"join",
"(",
"self",
".",
"outdir",
",",
"name",
")"
] | https://github.com/Tencent/CMONGO/blob/c40380caa14e05509f46993aa8b8da966b09b0b5/src/third_party/scons-2.5.0/scons-time.py#L586-L592 | |
FlightGear/flightgear | cf4801e11c5b69b107f87191584eefda3c5a9b26 | scripts/python/FlightGear.py | python | FGTelnet.ls | (self,dir=None) | return self._getresp() | Returns a list of properties. | Returns a list of properties. | [
"Returns",
"a",
"list",
"of",
"properties",
"."
] | def ls(self,dir=None):
"""
Returns a list of properties.
"""
if dir is None:
self._putcmd('ls')
else:
self._putcmd('ls %s' % dir )
return self._getresp() | [
"def",
"ls",
"(",
"self",
",",
"dir",
"=",
"None",
")",
":",
"if",
"dir",
"is",
"None",
":",
"self",
".",
"_putcmd",
"(",
"'ls'",
")",
"else",
":",
"self",
".",
"_putcmd",
"(",
"'ls %s'",
"%",
"dir",
")",
"return",
"self",
".",
"_getresp",
"(",
... | https://github.com/FlightGear/flightgear/blob/cf4801e11c5b69b107f87191584eefda3c5a9b26/scripts/python/FlightGear.py#L21-L29 | |
mongodb/mongo | d8ff665343ad29cf286ee2cf4a1960d29371937b | buildscripts/combine_reports.py | python | report_exit | (combined_test_report) | return ret | Return report exit code.
The exit code of this script is based on the following:
0: All tests have status "pass", or only non-dynamic tests have status "silentfail".
31: At least one test has status "fail" or "timeout".
Note: A test can be considered dynamic if its name contains a ":" characte... | Return report exit code. | [
"Return",
"report",
"exit",
"code",
"."
] | def report_exit(combined_test_report):
"""Return report exit code.
The exit code of this script is based on the following:
0: All tests have status "pass", or only non-dynamic tests have status "silentfail".
31: At least one test has status "fail" or "timeout".
Note: A test can be consider... | [
"def",
"report_exit",
"(",
"combined_test_report",
")",
":",
"ret",
"=",
"0",
"for",
"test",
"in",
"combined_test_report",
".",
"test_infos",
":",
"if",
"test",
".",
"status",
"in",
"[",
"\"fail\"",
",",
"\"timeout\"",
"]",
":",
"return",
"31",
"return",
"... | https://github.com/mongodb/mongo/blob/d8ff665343ad29cf286ee2cf4a1960d29371937b/buildscripts/combine_reports.py#L24-L37 | |
weolar/miniblink49 | 1c4678db0594a4abde23d3ebbcc7cd13c3170777 | third_party/jinja2/runtime.py | python | Context.get_all | (self) | return dict(self.parent, **self.vars) | Return a copy of the complete context as dict including the
exported variables. | Return a copy of the complete context as dict including the
exported variables. | [
"Return",
"a",
"copy",
"of",
"the",
"complete",
"context",
"as",
"dict",
"including",
"the",
"exported",
"variables",
"."
] | def get_all(self):
"""Return a copy of the complete context as dict including the
exported variables.
"""
return dict(self.parent, **self.vars) | [
"def",
"get_all",
"(",
"self",
")",
":",
"return",
"dict",
"(",
"self",
".",
"parent",
",",
"*",
"*",
"self",
".",
"vars",
")"
] | https://github.com/weolar/miniblink49/blob/1c4678db0594a4abde23d3ebbcc7cd13c3170777/third_party/jinja2/runtime.py#L160-L164 | |
shogun-toolbox/shogun | 9b8d856971af5a295dd6ad70623ae45647a6334c | examples/undocumented/python/structure_graphcuts.py | python | define_factor_types | (num_vars, len_feat, edge_table) | return v_factor_types | Define factor types
Args:
num_vars: number of variables in factor graph
len_feat: length of the feature vector
edge_table: edge table defines pair-wise node indeces
Returns:
v_factor_types: list of all unary and pair-wise factor types | Define factor types | [
"Define",
"factor",
"types"
] | def define_factor_types(num_vars, len_feat, edge_table):
""" Define factor types
Args:
num_vars: number of variables in factor graph
len_feat: length of the feature vector
edge_table: edge table defines pair-wise node indeces
Returns:
v_factor_types:... | [
"def",
"define_factor_types",
"(",
"num_vars",
",",
"len_feat",
",",
"edge_table",
")",
":",
"n_stats",
"=",
"2",
"# for binary status",
"v_factor_types",
"=",
"{",
"}",
"n_edges",
"=",
"edge_table",
".",
"shape",
"[",
"0",
"]",
"# unary factors",
"cards_u",
"... | https://github.com/shogun-toolbox/shogun/blob/9b8d856971af5a295dd6ad70623ae45647a6334c/examples/undocumented/python/structure_graphcuts.py#L43-L71 | |
wxWidgets/wxPython-Classic | 19571e1ae65f1ac445f5491474121998c97a1bf0 | src/gtk/stc.py | python | StyledTextCtrl.IndicatorValueAt | (*args, **kwargs) | return _stc.StyledTextCtrl_IndicatorValueAt(*args, **kwargs) | IndicatorValueAt(self, int indicator, int position) -> int
What value does a particular indicator have at at a position? | IndicatorValueAt(self, int indicator, int position) -> int | [
"IndicatorValueAt",
"(",
"self",
"int",
"indicator",
"int",
"position",
")",
"-",
">",
"int"
] | def IndicatorValueAt(*args, **kwargs):
"""
IndicatorValueAt(self, int indicator, int position) -> int
What value does a particular indicator have at at a position?
"""
return _stc.StyledTextCtrl_IndicatorValueAt(*args, **kwargs) | [
"def",
"IndicatorValueAt",
"(",
"*",
"args",
",",
"*",
"*",
"kwargs",
")",
":",
"return",
"_stc",
".",
"StyledTextCtrl_IndicatorValueAt",
"(",
"*",
"args",
",",
"*",
"*",
"kwargs",
")"
] | https://github.com/wxWidgets/wxPython-Classic/blob/19571e1ae65f1ac445f5491474121998c97a1bf0/src/gtk/stc.py#L5703-L5709 | |
aws/lumberyard | f85344403c1c2e77ec8c75deb2c116e97b713217 | dev/Tools/build/waf-1.7.13/waflib/Build.py | python | BuildContext.add_manual_dependency | (self, path, value) | Adds a dependency from a node object to a value::
def build(bld):
bld.add_manual_dependency(
bld.path.find_resource('wscript'),
bld.root.find_resource('/etc/fstab'))
:param path: file path
:type path: string or :py:class:`waflib.Node.Node`
:param value: value to depend on
:type value: :py:cla... | Adds a dependency from a node object to a value:: | [
"Adds",
"a",
"dependency",
"from",
"a",
"node",
"object",
"to",
"a",
"value",
"::"
] | def add_manual_dependency(self, path, value):
"""
Adds a dependency from a node object to a value::
def build(bld):
bld.add_manual_dependency(
bld.path.find_resource('wscript'),
bld.root.find_resource('/etc/fstab'))
:param path: file path
:type path: string or :py:class:`waflib.Node.Node`
:... | [
"def",
"add_manual_dependency",
"(",
"self",
",",
"path",
",",
"value",
")",
":",
"if",
"path",
"is",
"None",
":",
"raise",
"ValueError",
"(",
"'Invalid input'",
")",
"if",
"isinstance",
"(",
"path",
",",
"waflib",
".",
"Node",
".",
"Node",
")",
":",
"... | https://github.com/aws/lumberyard/blob/f85344403c1c2e77ec8c75deb2c116e97b713217/dev/Tools/build/waf-1.7.13/waflib/Build.py#L414-L441 | ||
Z3Prover/z3 | d745d03afdfdf638d66093e2bfbacaf87187f35b | scripts/mk_util.py | python | MakeRuleCmd.install_root | (cls) | return "$(DESTDIR)$(PREFIX)/" | Returns a string that will expand to the
install location when used in a makefile rule. | Returns a string that will expand to the
install location when used in a makefile rule. | [
"Returns",
"a",
"string",
"that",
"will",
"expand",
"to",
"the",
"install",
"location",
"when",
"used",
"in",
"a",
"makefile",
"rule",
"."
] | def install_root(cls):
"""
Returns a string that will expand to the
install location when used in a makefile rule.
"""
# Note: DESTDIR is to support staged installs
return "$(DESTDIR)$(PREFIX)/" | [
"def",
"install_root",
"(",
"cls",
")",
":",
"# Note: DESTDIR is to support staged installs",
"return",
"\"$(DESTDIR)$(PREFIX)/\""
] | https://github.com/Z3Prover/z3/blob/d745d03afdfdf638d66093e2bfbacaf87187f35b/scripts/mk_util.py#L3297-L3303 | |
apple/turicreate | cce55aa5311300e3ce6af93cb45ba791fd1bdf49 | src/python/turicreate/data_structures/sarray.py | python | SArray.__div__ | (self, other) | If other is a scalar value, divides each element of the current array
by the value, returning the result. If other is an SArray, performs
an element-wise division of the two arrays. | If other is a scalar value, divides each element of the current array
by the value, returning the result. If other is an SArray, performs
an element-wise division of the two arrays. | [
"If",
"other",
"is",
"a",
"scalar",
"value",
"divides",
"each",
"element",
"of",
"the",
"current",
"array",
"by",
"the",
"value",
"returning",
"the",
"result",
".",
"If",
"other",
"is",
"an",
"SArray",
"performs",
"an",
"element",
"-",
"wise",
"division",
... | def __div__(self, other):
"""
If other is a scalar value, divides each element of the current array
by the value, returning the result. If other is an SArray, performs
an element-wise division of the two arrays.
"""
with cython_context():
if type(other) is SAr... | [
"def",
"__div__",
"(",
"self",
",",
"other",
")",
":",
"with",
"cython_context",
"(",
")",
":",
"if",
"type",
"(",
"other",
")",
"is",
"SArray",
":",
"return",
"SArray",
"(",
"_proxy",
"=",
"self",
".",
"__proxy__",
".",
"vector_operator",
"(",
"other"... | https://github.com/apple/turicreate/blob/cce55aa5311300e3ce6af93cb45ba791fd1bdf49/src/python/turicreate/data_structures/sarray.py#L1086-L1098 | ||
windystrife/UnrealEngine_NVIDIAGameWorks | b50e6338a7c5b26374d66306ebc7807541ff815e | Engine/Extras/ThirdPartyNotUE/emsdk/Win64/python/2.7.5.3_64bit/Lib/collections.py | python | Counter.__add__ | (self, other) | return result | Add counts from two counters.
>>> Counter('abbb') + Counter('bcc')
Counter({'b': 4, 'c': 2, 'a': 1}) | Add counts from two counters. | [
"Add",
"counts",
"from",
"two",
"counters",
"."
] | def __add__(self, other):
'''Add counts from two counters.
>>> Counter('abbb') + Counter('bcc')
Counter({'b': 4, 'c': 2, 'a': 1})
'''
if not isinstance(other, Counter):
return NotImplemented
result = Counter()
for elem, count in self.items():
... | [
"def",
"__add__",
"(",
"self",
",",
"other",
")",
":",
"if",
"not",
"isinstance",
"(",
"other",
",",
"Counter",
")",
":",
"return",
"NotImplemented",
"result",
"=",
"Counter",
"(",
")",
"for",
"elem",
",",
"count",
"in",
"self",
".",
"items",
"(",
")... | https://github.com/windystrife/UnrealEngine_NVIDIAGameWorks/blob/b50e6338a7c5b26374d66306ebc7807541ff815e/Engine/Extras/ThirdPartyNotUE/emsdk/Win64/python/2.7.5.3_64bit/Lib/collections.py#L584-L601 | |
wlanjie/AndroidFFmpeg | 7baf9122f4b8e1c74e7baf4be5c422c7a5ba5aaf | tools/fdk-aac-build/armeabi-v7a/toolchain/lib/python2.7/distutils/fancy_getopt.py | python | FancyGetopt._grok_option_table | (self) | Populate the various data structures that keep tabs on the
option table. Called by 'getopt()' before it can do anything
worthwhile. | Populate the various data structures that keep tabs on the
option table. Called by 'getopt()' before it can do anything
worthwhile. | [
"Populate",
"the",
"various",
"data",
"structures",
"that",
"keep",
"tabs",
"on",
"the",
"option",
"table",
".",
"Called",
"by",
"getopt",
"()",
"before",
"it",
"can",
"do",
"anything",
"worthwhile",
"."
] | def _grok_option_table (self):
"""Populate the various data structures that keep tabs on the
option table. Called by 'getopt()' before it can do anything
worthwhile.
"""
self.long_opts = []
self.short_opts = []
self.short2long.clear()
self.repeat = {}
... | [
"def",
"_grok_option_table",
"(",
"self",
")",
":",
"self",
".",
"long_opts",
"=",
"[",
"]",
"self",
".",
"short_opts",
"=",
"[",
"]",
"self",
".",
"short2long",
".",
"clear",
"(",
")",
"self",
".",
"repeat",
"=",
"{",
"}",
"for",
"option",
"in",
"... | https://github.com/wlanjie/AndroidFFmpeg/blob/7baf9122f4b8e1c74e7baf4be5c422c7a5ba5aaf/tools/fdk-aac-build/armeabi-v7a/toolchain/lib/python2.7/distutils/fancy_getopt.py#L146-L227 | ||
letscontrolit/ESPEasy | acb2c9e695d6f61d8d67adf0fe4037c08d4baedd | lib/IRremoteESP8266/tools/auto_analyse_raw_data.py | python | RawIRMessage.add_data_code | (self, bin_str, name="", footer=True) | return code | Add the common "data" sequence of code to send the bulk of a message. | Add the common "data" sequence of code to send the bulk of a message. | [
"Add",
"the",
"common",
"data",
"sequence",
"of",
"code",
"to",
"send",
"the",
"bulk",
"of",
"a",
"message",
"."
] | def add_data_code(self, bin_str, name="", footer=True):
"""Add the common "data" sequence of code to send the bulk of a message."""
# pylint: disable=no-self-use
code = []
nbits = len(bin_str)
code.append(f" // Data Section #{self.section_count}")
code.append(f" // e.g. data = 0x{int(bin_s... | [
"def",
"add_data_code",
"(",
"self",
",",
"bin_str",
",",
"name",
"=",
"\"\"",
",",
"footer",
"=",
"True",
")",
":",
"# pylint: disable=no-self-use",
"code",
"=",
"[",
"]",
"nbits",
"=",
"len",
"(",
"bin_str",
")",
"code",
".",
"append",
"(",
"f\" // ... | https://github.com/letscontrolit/ESPEasy/blob/acb2c9e695d6f61d8d67adf0fe4037c08d4baedd/lib/IRremoteESP8266/tools/auto_analyse_raw_data.py#L101-L114 | |
wlanjie/AndroidFFmpeg | 7baf9122f4b8e1c74e7baf4be5c422c7a5ba5aaf | tools/fdk-aac-build/x86/toolchain/lib/python2.7/lib-tk/Tkinter.py | python | Menu.add_command | (self, cnf={}, **kw) | Add command menu item. | Add command menu item. | [
"Add",
"command",
"menu",
"item",
"."
] | def add_command(self, cnf={}, **kw):
"""Add command menu item."""
self.add('command', cnf or kw) | [
"def",
"add_command",
"(",
"self",
",",
"cnf",
"=",
"{",
"}",
",",
"*",
"*",
"kw",
")",
":",
"self",
".",
"add",
"(",
"'command'",
",",
"cnf",
"or",
"kw",
")"
] | https://github.com/wlanjie/AndroidFFmpeg/blob/7baf9122f4b8e1c74e7baf4be5c422c7a5ba5aaf/tools/fdk-aac-build/x86/toolchain/lib/python2.7/lib-tk/Tkinter.py#L2681-L2683 | ||
wxWidgets/wxPython-Classic | 19571e1ae65f1ac445f5491474121998c97a1bf0 | src/gtk/xrc.py | python | XmlResourceHandler.AddWindowStyles | (*args, **kwargs) | return _xrc.XmlResourceHandler_AddWindowStyles(*args, **kwargs) | AddWindowStyles(self) | AddWindowStyles(self) | [
"AddWindowStyles",
"(",
"self",
")"
] | def AddWindowStyles(*args, **kwargs):
"""AddWindowStyles(self)"""
return _xrc.XmlResourceHandler_AddWindowStyles(*args, **kwargs) | [
"def",
"AddWindowStyles",
"(",
"*",
"args",
",",
"*",
"*",
"kwargs",
")",
":",
"return",
"_xrc",
".",
"XmlResourceHandler_AddWindowStyles",
"(",
"*",
"args",
",",
"*",
"*",
"kwargs",
")"
] | https://github.com/wxWidgets/wxPython-Classic/blob/19571e1ae65f1ac445f5491474121998c97a1bf0/src/gtk/xrc.py#L651-L653 | |
Xilinx/Vitis-AI | fc74d404563d9951b57245443c73bef389f3657f | tools/Vitis-AI-Quantizer/vai_q_tensorflow1.x/tensorflow/python/distribute/values.py | python | MirroredVariable._gather_saveables_for_checkpoint | (self) | return {trackable.VARIABLE_VALUE_KEY: _saveable_factory} | Overrides Trackable method.
This allows both name-based and object-based save and restore of
MirroredVariables.
Returns:
A dictionary mapping attribute names to `SaveableObject` factories. | Overrides Trackable method. | [
"Overrides",
"Trackable",
"method",
"."
] | def _gather_saveables_for_checkpoint(self):
"""Overrides Trackable method.
This allows both name-based and object-based save and restore of
MirroredVariables.
Returns:
A dictionary mapping attribute names to `SaveableObject` factories.
"""
def _saveable_factory(name=self._common_name):
... | [
"def",
"_gather_saveables_for_checkpoint",
"(",
"self",
")",
":",
"def",
"_saveable_factory",
"(",
"name",
"=",
"self",
".",
"_common_name",
")",
":",
"return",
"_MirroredSaveable",
"(",
"self",
",",
"self",
".",
"primary",
",",
"name",
")",
"return",
"{",
"... | https://github.com/Xilinx/Vitis-AI/blob/fc74d404563d9951b57245443c73bef389f3657f/tools/Vitis-AI-Quantizer/vai_q_tensorflow1.x/tensorflow/python/distribute/values.py#L1055-L1066 | |
baidu-research/tensorflow-allreduce | 66d5b855e90b0949e9fa5cca5599fd729a70e874 | tensorflow/python/framework/dtypes.py | python | as_dtype | (type_value) | Converts the given `type_value` to a `DType`.
Args:
type_value: A value that can be converted to a `tf.DType`
object. This may currently be a `tf.DType` object, a
[`DataType` enum](https://www.tensorflow.org/code/tensorflow/core/framework/types.proto),
a string type name, or a `numpy.dtype`.
... | Converts the given `type_value` to a `DType`. | [
"Converts",
"the",
"given",
"type_value",
"to",
"a",
"DType",
"."
] | def as_dtype(type_value):
"""Converts the given `type_value` to a `DType`.
Args:
type_value: A value that can be converted to a `tf.DType`
object. This may currently be a `tf.DType` object, a
[`DataType` enum](https://www.tensorflow.org/code/tensorflow/core/framework/types.proto),
a string ty... | [
"def",
"as_dtype",
"(",
"type_value",
")",
":",
"if",
"isinstance",
"(",
"type_value",
",",
"DType",
")",
":",
"return",
"type_value",
"try",
":",
"return",
"_INTERN_TABLE",
"[",
"type_value",
"]",
"except",
"KeyError",
":",
"pass",
"try",
":",
"return",
"... | https://github.com/baidu-research/tensorflow-allreduce/blob/66d5b855e90b0949e9fa5cca5599fd729a70e874/tensorflow/python/framework/dtypes.py#L540-L584 | ||
zhuli19901106/leetcode-zhuli | 0f8fc29ccb8c33ea91149ecb2d4e961024c11db7 | explore/hash-table/1179_two-sum-iii-data-structure-design_1_AC.py | python | TwoSum.__init__ | (self) | Initialize your data structure here. | Initialize your data structure here. | [
"Initialize",
"your",
"data",
"structure",
"here",
"."
] | def __init__(self):
"""
Initialize your data structure here.
"""
self.mm = {} | [
"def",
"__init__",
"(",
"self",
")",
":",
"self",
".",
"mm",
"=",
"{",
"}"
] | https://github.com/zhuli19901106/leetcode-zhuli/blob/0f8fc29ccb8c33ea91149ecb2d4e961024c11db7/explore/hash-table/1179_two-sum-iii-data-structure-design_1_AC.py#L4-L8 | ||
apache/impala | 8ddac48f3428c86f2cbd037ced89cfb903298b12 | shell/TSSLSocketWithWildcardSAN.py | python | TSSLSocketWithWildcardSAN._match_hostname | (self, cert, hostname) | Verify that *cert* (in decoded format as returned by
SSLSocket.getpeercert()) matches the *hostname*. RFC 2818 and RFC 6125
rules are followed, but IP addresses are not accepted for *hostname*.
CertificateError is raised on failure. On success, the function
returns nothing. | Verify that *cert* (in decoded format as returned by
SSLSocket.getpeercert()) matches the *hostname*. RFC 2818 and RFC 6125
rules are followed, but IP addresses are not accepted for *hostname*. | [
"Verify",
"that",
"*",
"cert",
"*",
"(",
"in",
"decoded",
"format",
"as",
"returned",
"by",
"SSLSocket",
".",
"getpeercert",
"()",
")",
"matches",
"the",
"*",
"hostname",
"*",
".",
"RFC",
"2818",
"and",
"RFC",
"6125",
"rules",
"are",
"followed",
"but",
... | def _match_hostname(self, cert, hostname):
"""Verify that *cert* (in decoded format as returned by
SSLSocket.getpeercert()) matches the *hostname*. RFC 2818 and RFC 6125
rules are followed, but IP addresses are not accepted for *hostname*.
CertificateError is raised on failure. On success, the functio... | [
"def",
"_match_hostname",
"(",
"self",
",",
"cert",
",",
"hostname",
")",
":",
"dnsnames",
"=",
"[",
"]",
"san",
"=",
"cert",
".",
"get",
"(",
"'subjectAltName'",
",",
"(",
")",
")",
"for",
"key",
",",
"value",
"in",
"san",
":",
"if",
"key",
"==",
... | https://github.com/apache/impala/blob/8ddac48f3428c86f2cbd037ced89cfb903298b12/shell/TSSLSocketWithWildcardSAN.py#L78-L114 | ||
junhyukoh/caffe-lstm | 598d45456fa2a1b127a644f4aa38daa8fb9fc722 | tools/extra/parse_log.py | python | parse_line_for_net_output | (regex_obj, row, row_dict_list,
line, iteration, seconds, learning_rate) | return row_dict_list, row | Parse a single line for training or test output
Returns a a tuple with (row_dict_list, row)
row: may be either a new row or an augmented version of the current row
row_dict_list: may be either the current row_dict_list or an augmented
version of the current row_dict_list | Parse a single line for training or test output | [
"Parse",
"a",
"single",
"line",
"for",
"training",
"or",
"test",
"output"
] | def parse_line_for_net_output(regex_obj, row, row_dict_list,
line, iteration, seconds, learning_rate):
"""Parse a single line for training or test output
Returns a a tuple with (row_dict_list, row)
row: may be either a new row or an augmented version of the current row
row... | [
"def",
"parse_line_for_net_output",
"(",
"regex_obj",
",",
"row",
",",
"row_dict_list",
",",
"line",
",",
"iteration",
",",
"seconds",
",",
"learning_rate",
")",
":",
"output_match",
"=",
"regex_obj",
".",
"search",
"(",
"line",
")",
"if",
"output_match",
":",... | https://github.com/junhyukoh/caffe-lstm/blob/598d45456fa2a1b127a644f4aa38daa8fb9fc722/tools/extra/parse_log.py#L77-L116 | |
tensorflow/tensorflow | 419e3a6b650ea4bd1b0cba23c4348f8a69f3272e | tensorflow/python/framework/error_interpolation.py | python | interpolate | (message, graph) | return "\n".join(error_message) | Interpolates an error message.
The error message can contain tags of form `{{node_type node_name}}`
which will be parsed to identify the tf.Graph and op. If the op contains
traceback, the traceback will be attached to the error message.
Args:
message: A string to interpolate.
graph: ops.Graph object c... | Interpolates an error message. | [
"Interpolates",
"an",
"error",
"message",
"."
] | def interpolate(message, graph):
"""Interpolates an error message.
The error message can contain tags of form `{{node_type node_name}}`
which will be parsed to identify the tf.Graph and op. If the op contains
traceback, the traceback will be attached to the error message.
Args:
message: A string to inte... | [
"def",
"interpolate",
"(",
"message",
",",
"graph",
")",
":",
"parsed_messaged",
",",
"_",
",",
"node_tags",
"=",
"parse_message",
"(",
"message",
")",
"error_message",
"=",
"[",
"\"Graph execution error:\"",
",",
"\"\"",
"]",
"for",
"tag",
"in",
"node_tags",
... | https://github.com/tensorflow/tensorflow/blob/419e3a6b650ea4bd1b0cba23c4348f8a69f3272e/tensorflow/python/framework/error_interpolation.py#L446-L472 | |
kushview/Element | 1cc16380caa2ab79461246ba758b9de1f46db2a5 | waflib/Options.py | python | OptionsContext.jobs | (self) | return count | Finds the optimal amount of cpu cores to use for parallel jobs.
At runtime the options can be obtained from :py:const:`waflib.Options.options` ::
from waflib.Options import options
njobs = options.jobs
:return: the amount of cpu cores
:rtype: int | Finds the optimal amount of cpu cores to use for parallel jobs.
At runtime the options can be obtained from :py:const:`waflib.Options.options` :: | [
"Finds",
"the",
"optimal",
"amount",
"of",
"cpu",
"cores",
"to",
"use",
"for",
"parallel",
"jobs",
".",
"At",
"runtime",
"the",
"options",
"can",
"be",
"obtained",
"from",
":",
"py",
":",
"const",
":",
"waflib",
".",
"Options",
".",
"options",
"::"
] | def jobs(self):
"""
Finds the optimal amount of cpu cores to use for parallel jobs.
At runtime the options can be obtained from :py:const:`waflib.Options.options` ::
from waflib.Options import options
njobs = options.jobs
:return: the amount of cpu cores
:rtype: int
"""
count = int(os.environ.get(... | [
"def",
"jobs",
"(",
"self",
")",
":",
"count",
"=",
"int",
"(",
"os",
".",
"environ",
".",
"get",
"(",
"'JOBS'",
",",
"0",
")",
")",
"if",
"count",
"<",
"1",
":",
"if",
"'NUMBER_OF_PROCESSORS'",
"in",
"os",
".",
"environ",
":",
"# on Windows, use the... | https://github.com/kushview/Element/blob/1cc16380caa2ab79461246ba758b9de1f46db2a5/waflib/Options.py#L192-L227 | |
aws/lumberyard | f85344403c1c2e77ec8c75deb2c116e97b713217 | dev/Gems/CloudGemMetric/v1/AWS/common-code/Lib/pkg_resources/_vendor/pyparsing.py | python | ParserElement.ignore | ( self, other ) | return self | Define expression to be ignored (e.g., comments) while doing pattern
matching; may be called repeatedly, to define multiple comment or other
ignorable patterns.
Example::
patt = OneOrMore(Word(alphas))
patt.parseString('ablaj /* comment */ lskjd') # -> ['ablaj']
... | Define expression to be ignored (e.g., comments) while doing pattern
matching; may be called repeatedly, to define multiple comment or other
ignorable patterns.
Example::
patt = OneOrMore(Word(alphas))
patt.parseString('ablaj /* comment */ lskjd') # -> ['ablaj']
... | [
"Define",
"expression",
"to",
"be",
"ignored",
"(",
"e",
".",
"g",
".",
"comments",
")",
"while",
"doing",
"pattern",
"matching",
";",
"may",
"be",
"called",
"repeatedly",
"to",
"define",
"multiple",
"comment",
"or",
"other",
"ignorable",
"patterns",
".",
... | def ignore( self, other ):
"""
Define expression to be ignored (e.g., comments) while doing pattern
matching; may be called repeatedly, to define multiple comment or other
ignorable patterns.
Example::
patt = OneOrMore(Word(alphas))
patt.parseStri... | [
"def",
"ignore",
"(",
"self",
",",
"other",
")",
":",
"if",
"isinstance",
"(",
"other",
",",
"basestring",
")",
":",
"other",
"=",
"Suppress",
"(",
"other",
")",
"if",
"isinstance",
"(",
"other",
",",
"Suppress",
")",
":",
"if",
"other",
"not",
"in",... | https://github.com/aws/lumberyard/blob/f85344403c1c2e77ec8c75deb2c116e97b713217/dev/Gems/CloudGemMetric/v1/AWS/common-code/Lib/pkg_resources/_vendor/pyparsing.py#L2080-L2101 | |
windystrife/UnrealEngine_NVIDIAGameWorks | b50e6338a7c5b26374d66306ebc7807541ff815e | Engine/Extras/ThirdPartyNotUE/emsdk/Win64/python/2.7.5.3_64bit/Lib/site-packages/setuptools/_backport/hashlib/_sha.py | python | new | (arg=None) | return crypto | Return a new sha crypto object.
If arg is present, the method call update(arg) is made. | Return a new sha crypto object. | [
"Return",
"a",
"new",
"sha",
"crypto",
"object",
"."
] | def new(arg=None):
"""Return a new sha crypto object.
If arg is present, the method call update(arg) is made.
"""
crypto = sha()
if arg:
crypto.update(arg)
return crypto | [
"def",
"new",
"(",
"arg",
"=",
"None",
")",
":",
"crypto",
"=",
"sha",
"(",
")",
"if",
"arg",
":",
"crypto",
".",
"update",
"(",
"arg",
")",
"return",
"crypto"
] | https://github.com/windystrife/UnrealEngine_NVIDIAGameWorks/blob/b50e6338a7c5b26374d66306ebc7807541ff815e/Engine/Extras/ThirdPartyNotUE/emsdk/Win64/python/2.7.5.3_64bit/Lib/site-packages/setuptools/_backport/hashlib/_sha.py#L337-L347 | |
arangodb/arangodb | 0d658689c7d1b721b314fa3ca27d38303e1570c8 | 3rdParty/V8/gyp/generator/eclipse.py | python | GenerateOutput | (target_list, target_dicts, data, params) | Generate an XML settings file that can be imported into a CDT project. | Generate an XML settings file that can be imported into a CDT project. | [
"Generate",
"an",
"XML",
"settings",
"file",
"that",
"can",
"be",
"imported",
"into",
"a",
"CDT",
"project",
"."
] | def GenerateOutput(target_list, target_dicts, data, params):
"""Generate an XML settings file that can be imported into a CDT project."""
if params['options'].generator_output:
raise NotImplementedError("--generator_output not implemented for eclipse")
user_config = params.get('generator_flags', {}).get('co... | [
"def",
"GenerateOutput",
"(",
"target_list",
",",
"target_dicts",
",",
"data",
",",
"params",
")",
":",
"if",
"params",
"[",
"'options'",
"]",
".",
"generator_output",
":",
"raise",
"NotImplementedError",
"(",
"\"--generator_output not implemented for eclipse\"",
")",... | https://github.com/arangodb/arangodb/blob/0d658689c7d1b721b314fa3ca27d38303e1570c8/3rdParty/V8/gyp/generator/eclipse.py#L391-L405 | ||
pytorch/pytorch | 7176c92687d3cc847cc046bf002269c6949a21c2 | caffe2/python/helpers/dropout.py | python | dropout | (model, blob_in, blob_out, use_cudnn=False, **kwargs) | return model.net.Dropout(
blob_in, [blob_out, "_" + blob_out + "_mask"], **kwargs)[0] | dropout | dropout | [
"dropout"
] | def dropout(model, blob_in, blob_out, use_cudnn=False, **kwargs):
"""dropout"""
if use_cudnn:
kwargs['engine'] = 'CUDNN'
else:
kwargs['engine'] = 'DEFAULT'
assert 'is_test' in kwargs, "Argument 'is_test' is required"
return model.net.Dropout(
blob_in, [blob_out, "_" + blob_ou... | [
"def",
"dropout",
"(",
"model",
",",
"blob_in",
",",
"blob_out",
",",
"use_cudnn",
"=",
"False",
",",
"*",
"*",
"kwargs",
")",
":",
"if",
"use_cudnn",
":",
"kwargs",
"[",
"'engine'",
"]",
"=",
"'CUDNN'",
"else",
":",
"kwargs",
"[",
"'engine'",
"]",
"... | https://github.com/pytorch/pytorch/blob/7176c92687d3cc847cc046bf002269c6949a21c2/caffe2/python/helpers/dropout.py#L9-L17 | |
nyuwireless-unipd/ns3-mmwave | 4ff9e87e8079764e04cbeccd8e85bff15ae16fb3 | utils/grid.py | python | TimelineDataRange.__search | (self, key) | return - 1 | ! Search
@param self this object
@param key key
@return index if found or -1 if not found | ! Search | [
"!",
"Search"
] | def __search(self, key):
"""! Search
@param self this object
@param key key
@return index if found or -1 if not found
"""
l = 0
u = len(self.ranges)-1
while l <= u:
i = int((l + u) / 2)
if key >= self.ranges[i].start and key <= self... | [
"def",
"__search",
"(",
"self",
",",
"key",
")",
":",
"l",
"=",
"0",
"u",
"=",
"len",
"(",
"self",
".",
"ranges",
")",
"-",
"1",
"while",
"l",
"<=",
"u",
":",
"i",
"=",
"int",
"(",
"(",
"l",
"+",
"u",
")",
"/",
"2",
")",
"if",
"key",
">... | https://github.com/nyuwireless-unipd/ns3-mmwave/blob/4ff9e87e8079764e04cbeccd8e85bff15ae16fb3/utils/grid.py#L105-L122 | |
hpi-xnor/BMXNet | ed0b201da6667887222b8e4b5f997c4f6b61943d | example/fcn-xs/data.py | python | FileIter.provide_data | (self) | return [(k, tuple([1] + list(v.shape[1:]))) for k, v in self.data] | The name and shape of data provided by this iterator | The name and shape of data provided by this iterator | [
"The",
"name",
"and",
"shape",
"of",
"data",
"provided",
"by",
"this",
"iterator"
] | def provide_data(self):
"""The name and shape of data provided by this iterator"""
return [(k, tuple([1] + list(v.shape[1:]))) for k, v in self.data] | [
"def",
"provide_data",
"(",
"self",
")",
":",
"return",
"[",
"(",
"k",
",",
"tuple",
"(",
"[",
"1",
"]",
"+",
"list",
"(",
"v",
".",
"shape",
"[",
"1",
":",
"]",
")",
")",
")",
"for",
"k",
",",
"v",
"in",
"self",
".",
"data",
"]"
] | https://github.com/hpi-xnor/BMXNet/blob/ed0b201da6667887222b8e4b5f997c4f6b61943d/example/fcn-xs/data.py#L108-L110 | |
yue/yue | 619d62c191b13c51c01be451dc48917c34a5aefc | building/tools/cpplint.py | python | ParseArguments | (args) | return filenames | Parses the command line arguments.
This may set the output format and verbosity level as side-effects.
Args:
args: The command line arguments:
Returns:
The list of filenames to lint. | Parses the command line arguments. | [
"Parses",
"the",
"command",
"line",
"arguments",
"."
] | def ParseArguments(args):
"""Parses the command line arguments.
This may set the output format and verbosity level as side-effects.
Args:
args: The command line arguments:
Returns:
The list of filenames to lint.
"""
try:
(opts, filenames) = getopt.getopt(args, '', ['help', 'output=', 'verbose... | [
"def",
"ParseArguments",
"(",
"args",
")",
":",
"try",
":",
"(",
"opts",
",",
"filenames",
")",
"=",
"getopt",
".",
"getopt",
"(",
"args",
",",
"''",
",",
"[",
"'help'",
",",
"'output='",
",",
"'verbose='",
",",
"'counting='",
",",
"'filter='",
",",
... | https://github.com/yue/yue/blob/619d62c191b13c51c01be451dc48917c34a5aefc/building/tools/cpplint.py#L6129-L6204 | |
catboost/catboost | 167f64f237114a4d10b2b4ee42adb4569137debe | contrib/python/scipy/py3/scipy/cluster/hierarchy.py | python | is_valid_im | (R, warning=False, throw=False, name=None) | return valid | Return True if the inconsistency matrix passed is valid.
It must be a :math:`n` by 4 array of doubles. The standard
deviations ``R[:,1]`` must be nonnegative. The link counts
``R[:,2]`` must be positive and no greater than :math:`n-1`.
Parameters
----------
R : ndarray
The inconsistenc... | Return True if the inconsistency matrix passed is valid. | [
"Return",
"True",
"if",
"the",
"inconsistency",
"matrix",
"passed",
"is",
"valid",
"."
] | def is_valid_im(R, warning=False, throw=False, name=None):
"""Return True if the inconsistency matrix passed is valid.
It must be a :math:`n` by 4 array of doubles. The standard
deviations ``R[:,1]`` must be nonnegative. The link counts
``R[:,2]`` must be positive and no greater than :math:`n-1`.
... | [
"def",
"is_valid_im",
"(",
"R",
",",
"warning",
"=",
"False",
",",
"throw",
"=",
"False",
",",
"name",
"=",
"None",
")",
":",
"R",
"=",
"np",
".",
"asarray",
"(",
"R",
",",
"order",
"=",
"'c'",
")",
"valid",
"=",
"True",
"name_str",
"=",
"\"%r \"... | https://github.com/catboost/catboost/blob/167f64f237114a4d10b2b4ee42adb4569137debe/contrib/python/scipy/py3/scipy/cluster/hierarchy.py#L2091-L2213 | |
aws/lumberyard | f85344403c1c2e77ec8c75deb2c116e97b713217 | dev/Gems/CloudGemMetric/v1/AWS/python/windows/Lib/numba/pycc/platform.py | python | Toolchain.link_shared | (self, output, objects, libraries=(),
library_dirs=(), export_symbols=(),
extra_ldflags=None) | Create a shared library *output* linking the given *objects*
and *libraries* (all strings). | Create a shared library *output* linking the given *objects*
and *libraries* (all strings). | [
"Create",
"a",
"shared",
"library",
"*",
"output",
"*",
"linking",
"the",
"given",
"*",
"objects",
"*",
"and",
"*",
"libraries",
"*",
"(",
"all",
"strings",
")",
"."
] | def link_shared(self, output, objects, libraries=(),
library_dirs=(), export_symbols=(),
extra_ldflags=None):
"""
Create a shared library *output* linking the given *objects*
and *libraries* (all strings).
"""
output_dir, output_filename = ... | [
"def",
"link_shared",
"(",
"self",
",",
"output",
",",
"objects",
",",
"libraries",
"=",
"(",
")",
",",
"library_dirs",
"=",
"(",
")",
",",
"export_symbols",
"=",
"(",
")",
",",
"extra_ldflags",
"=",
"None",
")",
":",
"output_dir",
",",
"output_filename"... | https://github.com/aws/lumberyard/blob/f85344403c1c2e77ec8c75deb2c116e97b713217/dev/Gems/CloudGemMetric/v1/AWS/python/windows/Lib/numba/pycc/platform.py#L147-L159 | ||
windystrife/UnrealEngine_NVIDIAGameWorks | b50e6338a7c5b26374d66306ebc7807541ff815e | Engine/Extras/ThirdPartyNotUE/emsdk/Win64/python/2.7.5.3_64bit/Lib/_pyio.py | python | TextIOWrapper._rewind_decoded_chars | (self, n) | Rewind the _decoded_chars buffer. | Rewind the _decoded_chars buffer. | [
"Rewind",
"the",
"_decoded_chars",
"buffer",
"."
] | def _rewind_decoded_chars(self, n):
"""Rewind the _decoded_chars buffer."""
if self._decoded_chars_used < n:
raise AssertionError("rewind decoded_chars out of bounds")
self._decoded_chars_used -= n | [
"def",
"_rewind_decoded_chars",
"(",
"self",
",",
"n",
")",
":",
"if",
"self",
".",
"_decoded_chars_used",
"<",
"n",
":",
"raise",
"AssertionError",
"(",
"\"rewind decoded_chars out of bounds\"",
")",
"self",
".",
"_decoded_chars_used",
"-=",
"n"
] | https://github.com/windystrife/UnrealEngine_NVIDIAGameWorks/blob/b50e6338a7c5b26374d66306ebc7807541ff815e/Engine/Extras/ThirdPartyNotUE/emsdk/Win64/python/2.7.5.3_64bit/Lib/_pyio.py#L1644-L1648 | ||
krishauser/Klampt | 972cc83ea5befac3f653c1ba20f80155768ad519 | Python/klampt/vis/backends/qtbackend.py | python | QtBackend.run | (self) | Starts the main loop | Starts the main loop | [
"Starts",
"the",
"main",
"loop"
] | def run(self):
"""Starts the main loop"""
assert self.window != None, "No windows create()'ed"
self.window.show()
self.app.exec_() | [
"def",
"run",
"(",
"self",
")",
":",
"assert",
"self",
".",
"window",
"!=",
"None",
",",
"\"No windows create()'ed\"",
"self",
".",
"window",
".",
"show",
"(",
")",
"self",
".",
"app",
".",
"exec_",
"(",
")"
] | https://github.com/krishauser/Klampt/blob/972cc83ea5befac3f653c1ba20f80155768ad519/Python/klampt/vis/backends/qtbackend.py#L453-L457 | ||
apple/swift-clang | d7403439fc6641751840b723e7165fb02f52db95 | bindings/python/clang/cindex.py | python | CompilationDatabase.getCompileCommands | (self, filename) | return conf.lib.clang_CompilationDatabase_getCompileCommands(self,
fspath(filename)) | Get an iterable object providing all the CompileCommands available to
build filename. Returns None if filename is not found in the database. | Get an iterable object providing all the CompileCommands available to
build filename. Returns None if filename is not found in the database. | [
"Get",
"an",
"iterable",
"object",
"providing",
"all",
"the",
"CompileCommands",
"available",
"to",
"build",
"filename",
".",
"Returns",
"None",
"if",
"filename",
"is",
"not",
"found",
"in",
"the",
"database",
"."
] | def getCompileCommands(self, filename):
"""
Get an iterable object providing all the CompileCommands available to
build filename. Returns None if filename is not found in the database.
"""
return conf.lib.clang_CompilationDatabase_getCompileCommands(self,
... | [
"def",
"getCompileCommands",
"(",
"self",
",",
"filename",
")",
":",
"return",
"conf",
".",
"lib",
".",
"clang_CompilationDatabase_getCompileCommands",
"(",
"self",
",",
"fspath",
"(",
"filename",
")",
")"
] | https://github.com/apple/swift-clang/blob/d7403439fc6641751840b723e7165fb02f52db95/bindings/python/clang/cindex.py#L3255-L3261 | |
mongodb/mongo | d8ff665343ad29cf286ee2cf4a1960d29371937b | src/third_party/mozjs/extract/js/src/devtools/automation/autospider.py | python | set_vars_from_script | (script, vars) | Run a shell script, then dump out chosen environment variables. The build
system uses shell scripts to do some configuration that we need to
borrow. On Windows, the script itself must output the variable settings
(in the form "export FOO=<value>"), since otherwise there will be
problems with... | Run a shell script, then dump out chosen environment variables. The build
system uses shell scripts to do some configuration that we need to
borrow. On Windows, the script itself must output the variable settings
(in the form "export FOO=<value>"), since otherwise there will be
problems with... | [
"Run",
"a",
"shell",
"script",
"then",
"dump",
"out",
"chosen",
"environment",
"variables",
".",
"The",
"build",
"system",
"uses",
"shell",
"scripts",
"to",
"do",
"some",
"configuration",
"that",
"we",
"need",
"to",
"borrow",
".",
"On",
"Windows",
"the",
"... | def set_vars_from_script(script, vars):
'''Run a shell script, then dump out chosen environment variables. The build
system uses shell scripts to do some configuration that we need to
borrow. On Windows, the script itself must output the variable settings
(in the form "export FOO=<value>"), sin... | [
"def",
"set_vars_from_script",
"(",
"script",
",",
"vars",
")",
":",
"script_text",
"=",
"'source %s'",
"%",
"script",
"if",
"platform",
".",
"system",
"(",
")",
"==",
"'Windows'",
":",
"parse_state",
"=",
"'parsing exports'",
"else",
":",
"script_text",
"+=",... | https://github.com/mongodb/mongo/blob/d8ff665343ad29cf286ee2cf4a1960d29371937b/src/third_party/mozjs/extract/js/src/devtools/automation/autospider.py#L98-L140 | ||
Xilinx/Vitis-AI | fc74d404563d9951b57245443c73bef389f3657f | tools/Vitis-AI-Quantizer/vai_q_tensorflow1.x/tensorflow/python/ops/control_flow_state.py | python | _ControlFlowState.ProcessUnusedLoopExits | (self, pending_count, to_ops_set) | return loop_exits | Process all the "unused" loop exits.
The "unused" exits of the loops are added to `unused_exits`. An exit is
unused if its pending_count is 0. If there is an exit with real gradient,
all these deferred exits will enter the backprop loop with zero gradient.
Otherwise, they will enter the backprop loop w... | Process all the "unused" loop exits. | [
"Process",
"all",
"the",
"unused",
"loop",
"exits",
"."
] | def ProcessUnusedLoopExits(self, pending_count, to_ops_set):
"""Process all the "unused" loop exits.
The "unused" exits of the loops are added to `unused_exits`. An exit is
unused if its pending_count is 0. If there is an exit with real gradient,
all these deferred exits will enter the backprop loop wi... | [
"def",
"ProcessUnusedLoopExits",
"(",
"self",
",",
"pending_count",
",",
"to_ops_set",
")",
":",
"loop_exits",
"=",
"[",
"]",
"for",
"grad_state",
"in",
"self",
".",
"_map",
".",
"values",
"(",
")",
":",
"for",
"y",
"in",
"grad_state",
".",
"forward_loop_e... | https://github.com/Xilinx/Vitis-AI/blob/fc74d404563d9951b57245443c73bef389f3657f/tools/Vitis-AI-Quantizer/vai_q_tensorflow1.x/tensorflow/python/ops/control_flow_state.py#L511-L549 | |
devpack/android-python27 | d42dd67565e104cf7b0b50eb473f615db3e69901 | python-build-with-qt/sip-4.11.2/sipconfig.py | python | Makefile.clean_build_file_objects | (self, mfile, build) | Generate the clean target.
mfile is the file object.
build is the dictionary created from the build file. | Generate the clean target. | [
"Generate",
"the",
"clean",
"target",
"."
] | def clean_build_file_objects(self, mfile, build):
"""Generate the clean target.
mfile is the file object.
build is the dictionary created from the build file.
"""
mfile.write("\t-%s $(TARGET)\n" % self.rm)
for f in build["objects"].split():
mfile.write("\t-%... | [
"def",
"clean_build_file_objects",
"(",
"self",
",",
"mfile",
",",
"build",
")",
":",
"mfile",
".",
"write",
"(",
"\"\\t-%s $(TARGET)\\n\"",
"%",
"self",
".",
"rm",
")",
"for",
"f",
"in",
"build",
"[",
"\"objects\"",
"]",
".",
"split",
"(",
")",
":",
"... | https://github.com/devpack/android-python27/blob/d42dd67565e104cf7b0b50eb473f615db3e69901/python-build-with-qt/sip-4.11.2/sipconfig.py#L1079-L1092 | ||
baidu-research/tensorflow-allreduce | 66d5b855e90b0949e9fa5cca5599fd729a70e874 | tensorflow/tools/quantization/quantize_graph.py | python | GraphRewriter.should_merge_with_fake_quant_node | (self) | return top[1] == 0 and top[0].op in ["FakeQuantWithMinMaxVars"] | Should the current node merge with self.state.output_node_stack[-1]? | Should the current node merge with self.state.output_node_stack[-1]? | [
"Should",
"the",
"current",
"node",
"merge",
"with",
"self",
".",
"state",
".",
"output_node_stack",
"[",
"-",
"1",
"]",
"?"
] | def should_merge_with_fake_quant_node(self):
"""Should the current node merge with self.state.output_node_stack[-1]?"""
if not self.state.output_node_stack:
return False
top = self.state.output_node_stack[-1]
return top[1] == 0 and top[0].op in ["FakeQuantWithMinMaxVars"] | [
"def",
"should_merge_with_fake_quant_node",
"(",
"self",
")",
":",
"if",
"not",
"self",
".",
"state",
".",
"output_node_stack",
":",
"return",
"False",
"top",
"=",
"self",
".",
"state",
".",
"output_node_stack",
"[",
"-",
"1",
"]",
"return",
"top",
"[",
"1... | https://github.com/baidu-research/tensorflow-allreduce/blob/66d5b855e90b0949e9fa5cca5599fd729a70e874/tensorflow/tools/quantization/quantize_graph.py#L554-L559 | |
hpi-xnor/BMXNet-v2 | af2b1859eafc5c721b1397cef02f946aaf2ce20d | plugin/opencv/opencv.py | python | random_size_crop | (src, size, min_area=0.25, ratio=(3.0/4.0, 4.0/3.0)) | return random_crop(src, size) | Randomly crop src with size. Randomize area and aspect ratio | Randomly crop src with size. Randomize area and aspect ratio | [
"Randomly",
"crop",
"src",
"with",
"size",
".",
"Randomize",
"area",
"and",
"aspect",
"ratio"
] | def random_size_crop(src, size, min_area=0.25, ratio=(3.0/4.0, 4.0/3.0)):
"""Randomly crop src with size. Randomize area and aspect ratio"""
h, w, _ = src.shape
area = w*h
for _ in range(10):
new_area = random.uniform(min_area, 1.0) * area
new_ratio = random.uniform(*ratio)
new_w... | [
"def",
"random_size_crop",
"(",
"src",
",",
"size",
",",
"min_area",
"=",
"0.25",
",",
"ratio",
"=",
"(",
"3.0",
"/",
"4.0",
",",
"4.0",
"/",
"3.0",
")",
")",
":",
"h",
",",
"w",
",",
"_",
"=",
"src",
".",
"shape",
"area",
"=",
"w",
"*",
"h",... | https://github.com/hpi-xnor/BMXNet-v2/blob/af2b1859eafc5c721b1397cef02f946aaf2ce20d/plugin/opencv/opencv.py#L131-L153 | |
aws/lumberyard | f85344403c1c2e77ec8c75deb2c116e97b713217 | dev/Gems/CloudGemMetric/v1/AWS/common-code/Lib/numba/cuda/cudadrv/autotune.py | python | AutoTuner.by_occupancy | (self) | return self._by_occupancy | A list of tuple-2 of (occupancy, thread-per-block) sorted in
descending.
The first item has the highest occupancy and the lowest number of
thread-per-block. | A list of tuple-2 of (occupancy, thread-per-block) sorted in
descending. | [
"A",
"list",
"of",
"tuple",
"-",
"2",
"of",
"(",
"occupancy",
"thread",
"-",
"per",
"-",
"block",
")",
"sorted",
"in",
"descending",
"."
] | def by_occupancy(self):
"""A list of tuple-2 of (occupancy, thread-per-block) sorted in
descending.
The first item has the highest occupancy and the lowest number of
thread-per-block.
"""
return self._by_occupancy | [
"def",
"by_occupancy",
"(",
"self",
")",
":",
"return",
"self",
".",
"_by_occupancy"
] | https://github.com/aws/lumberyard/blob/f85344403c1c2e77ec8c75deb2c116e97b713217/dev/Gems/CloudGemMetric/v1/AWS/common-code/Lib/numba/cuda/cudadrv/autotune.py#L66-L73 | |
DaFuCoding/MTCNN_Caffe | 09c30c3ff391bd9cb6b249c1910afaf147767ab3 | 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/DaFuCoding/MTCNN_Caffe/blob/09c30c3ff391bd9cb6b249c1910afaf147767ab3/scripts/cpp_lint.py#L717-L740 | ||
mindspore-ai/mindspore | fb8fd3338605bb34fa5cea054e535a8b1d753fab | mindspore/python/mindspore/communication/_comm_helper.py | python | _get_rank_helper | (group, backend) | return rank_id | The Helper to do get_rank_id.
Args:
group (str): The communication group.
backend (str): The backend, like "hccl".
Raises:
ValueError: If backend is invalid.
Returns:
Integer. The local rank id of the calling process. | The Helper to do get_rank_id. | [
"The",
"Helper",
"to",
"do",
"get_rank_id",
"."
] | def _get_rank_helper(group, backend):
"""
The Helper to do get_rank_id.
Args:
group (str): The communication group.
backend (str): The backend, like "hccl".
Raises:
ValueError: If backend is invalid.
Returns:
Integer. The local rank id of the calling process.
"... | [
"def",
"_get_rank_helper",
"(",
"group",
",",
"backend",
")",
":",
"rank_id",
"=",
"None",
"if",
"_is_role_pserver",
"(",
")",
"or",
"_is_role_sched",
"(",
")",
":",
"rank_id",
"=",
"0",
"return",
"rank_id",
"if",
"backend",
"==",
"Backend",
".",
"HCCL_MPI... | https://github.com/mindspore-ai/mindspore/blob/fb8fd3338605bb34fa5cea054e535a8b1d753fab/mindspore/python/mindspore/communication/_comm_helper.py#L188-L218 | |
alexgkendall/caffe-posenet | 62aafbd7c45df91acdba14f5d1406d8295c2bc6f | scripts/cpp_lint.py | python | CleanseComments | (line) | return _RE_PATTERN_CLEANSE_LINE_C_COMMENTS.sub('', line) | Removes //-comments and single-line C-style /* */ comments.
Args:
line: A line of C++ source.
Returns:
The line with single-line comments removed. | Removes //-comments and single-line C-style /* */ comments. | [
"Removes",
"//",
"-",
"comments",
"and",
"single",
"-",
"line",
"C",
"-",
"style",
"/",
"*",
"*",
"/",
"comments",
"."
] | def CleanseComments(line):
"""Removes //-comments and single-line C-style /* */ comments.
Args:
line: A line of C++ source.
Returns:
The line with single-line comments removed.
"""
commentpos = line.find('//')
if commentpos != -1 and not IsCppString(line[:commentpos]):
line = line[:commentpos]... | [
"def",
"CleanseComments",
"(",
"line",
")",
":",
"commentpos",
"=",
"line",
".",
"find",
"(",
"'//'",
")",
"if",
"commentpos",
"!=",
"-",
"1",
"and",
"not",
"IsCppString",
"(",
"line",
"[",
":",
"commentpos",
"]",
")",
":",
"line",
"=",
"line",
"[",
... | https://github.com/alexgkendall/caffe-posenet/blob/62aafbd7c45df91acdba14f5d1406d8295c2bc6f/scripts/cpp_lint.py#L1167-L1180 | |
aws/lumberyard | f85344403c1c2e77ec8c75deb2c116e97b713217 | dev/Gems/CloudGemDefectReporter/v1/AWS/common-code/Lib/urllib3/poolmanager.py | python | _default_key_normalizer | (key_class, request_context) | return key_class(**context) | Create a pool key out of a request context dictionary.
According to RFC 3986, both the scheme and host are case-insensitive.
Therefore, this function normalizes both before constructing the pool
key for an HTTPS request. If you wish to change this behaviour, provide
alternate callables to ``key_fn_by_s... | Create a pool key out of a request context dictionary. | [
"Create",
"a",
"pool",
"key",
"out",
"of",
"a",
"request",
"context",
"dictionary",
"."
] | def _default_key_normalizer(key_class, request_context):
"""
Create a pool key out of a request context dictionary.
According to RFC 3986, both the scheme and host are case-insensitive.
Therefore, this function normalizes both before constructing the pool
key for an HTTPS request. If you wish to ch... | [
"def",
"_default_key_normalizer",
"(",
"key_class",
",",
"request_context",
")",
":",
"# Since we mutate the dictionary, make a copy first",
"context",
"=",
"request_context",
".",
"copy",
"(",
")",
"context",
"[",
"'scheme'",
"]",
"=",
"context",
"[",
"'scheme'",
"]"... | https://github.com/aws/lumberyard/blob/f85344403c1c2e77ec8c75deb2c116e97b713217/dev/Gems/CloudGemDefectReporter/v1/AWS/common-code/Lib/urllib3/poolmanager.py#L57-L103 | |
mantidproject/mantid | 03deeb89254ec4289edb8771e0188c2090a02f32 | qt/python/mantidqtinterfaces/mantidqtinterfaces/drill/presenter/DrillSettingsPresenter.py | python | DrillSettingsPresenter.onApplied | (self) | Triggered when the apply button is pressed. This removes the initial
values kept in memory. | Triggered when the apply button is pressed. This removes the initial
values kept in memory. | [
"Triggered",
"when",
"the",
"apply",
"button",
"is",
"pressed",
".",
"This",
"removes",
"the",
"initial",
"values",
"kept",
"in",
"memory",
"."
] | def onApplied(self):
"""
Triggered when the apply button is pressed. This removes the initial
values kept in memory.
"""
self._initialValues = dict() | [
"def",
"onApplied",
"(",
"self",
")",
":",
"self",
".",
"_initialValues",
"=",
"dict",
"(",
")"
] | https://github.com/mantidproject/mantid/blob/03deeb89254ec4289edb8771e0188c2090a02f32/qt/python/mantidqtinterfaces/mantidqtinterfaces/drill/presenter/DrillSettingsPresenter.py#L84-L89 | ||
Tencent/CMONGO | c40380caa14e05509f46993aa8b8da966b09b0b5 | src/third_party/scons-2.5.0/scons-local-2.5.0/SCons/Subst.py | python | SpecialAttrWrapper.__init__ | (self, lstr, for_signature=None) | The for_signature parameter, if supplied, will be the
canonical string we return from for_signature(). Else
we will simply return lstr. | The for_signature parameter, if supplied, will be the
canonical string we return from for_signature(). Else
we will simply return lstr. | [
"The",
"for_signature",
"parameter",
"if",
"supplied",
"will",
"be",
"the",
"canonical",
"string",
"we",
"return",
"from",
"for_signature",
"()",
".",
"Else",
"we",
"will",
"simply",
"return",
"lstr",
"."
] | def __init__(self, lstr, for_signature=None):
"""The for_signature parameter, if supplied, will be the
canonical string we return from for_signature(). Else
we will simply return lstr."""
self.lstr = lstr
if for_signature:
self.forsig = for_signature
else:
... | [
"def",
"__init__",
"(",
"self",
",",
"lstr",
",",
"for_signature",
"=",
"None",
")",
":",
"self",
".",
"lstr",
"=",
"lstr",
"if",
"for_signature",
":",
"self",
".",
"forsig",
"=",
"for_signature",
"else",
":",
"self",
".",
"forsig",
"=",
"lstr"
] | https://github.com/Tencent/CMONGO/blob/c40380caa14e05509f46993aa8b8da966b09b0b5/src/third_party/scons-2.5.0/scons-local-2.5.0/SCons/Subst.py#L98-L106 | ||
catboost/catboost | 167f64f237114a4d10b2b4ee42adb4569137debe | contrib/tools/python3/src/Lib/importlib/_bootstrap_external.py | python | PathFinder.invalidate_caches | (cls) | Call the invalidate_caches() method on all path entry finders
stored in sys.path_importer_caches (where implemented). | Call the invalidate_caches() method on all path entry finders
stored in sys.path_importer_caches (where implemented). | [
"Call",
"the",
"invalidate_caches",
"()",
"method",
"on",
"all",
"path",
"entry",
"finders",
"stored",
"in",
"sys",
".",
"path_importer_caches",
"(",
"where",
"implemented",
")",
"."
] | def invalidate_caches(cls):
"""Call the invalidate_caches() method on all path entry finders
stored in sys.path_importer_caches (where implemented)."""
for name, finder in list(sys.path_importer_cache.items()):
if finder is None:
del sys.path_importer_cache[name]
... | [
"def",
"invalidate_caches",
"(",
"cls",
")",
":",
"for",
"name",
",",
"finder",
"in",
"list",
"(",
"sys",
".",
"path_importer_cache",
".",
"items",
"(",
")",
")",
":",
"if",
"finder",
"is",
"None",
":",
"del",
"sys",
".",
"path_importer_cache",
"[",
"n... | https://github.com/catboost/catboost/blob/167f64f237114a4d10b2b4ee42adb4569137debe/contrib/tools/python3/src/Lib/importlib/_bootstrap_external.py#L1315-L1322 | ||
weolar/miniblink49 | 1c4678db0594a4abde23d3ebbcc7cd13c3170777 | third_party/jinja2/filters.py | python | do_slice | (value, slices, fill_with=None) | Slice an iterator and return a list of lists containing
those items. Useful if you want to create a div containing
three ul tags that represent columns:
.. sourcecode:: html+jinja
<div class="columwrapper">
{%- for column in items|slice(3) %}
<ul class="column-{{ loop.index }... | Slice an iterator and return a list of lists containing
those items. Useful if you want to create a div containing
three ul tags that represent columns: | [
"Slice",
"an",
"iterator",
"and",
"return",
"a",
"list",
"of",
"lists",
"containing",
"those",
"items",
".",
"Useful",
"if",
"you",
"want",
"to",
"create",
"a",
"div",
"containing",
"three",
"ul",
"tags",
"that",
"represent",
"columns",
":"
] | def do_slice(value, slices, fill_with=None):
"""Slice an iterator and return a list of lists containing
those items. Useful if you want to create a div containing
three ul tags that represent columns:
.. sourcecode:: html+jinja
<div class="columwrapper">
{%- for column in items|slice... | [
"def",
"do_slice",
"(",
"value",
",",
"slices",
",",
"fill_with",
"=",
"None",
")",
":",
"seq",
"=",
"list",
"(",
"value",
")",
"length",
"=",
"len",
"(",
"seq",
")",
"items_per_slice",
"=",
"length",
"//",
"slices",
"slices_with_extra",
"=",
"length",
... | https://github.com/weolar/miniblink49/blob/1c4678db0594a4abde23d3ebbcc7cd13c3170777/third_party/jinja2/filters.py#L560-L593 | ||
wxWidgets/wxPython-Classic | 19571e1ae65f1ac445f5491474121998c97a1bf0 | src/osx_cocoa/richtext.py | python | RichTextObject.ExportXML | (*args) | return _richtext.RichTextObject_ExportXML(*args) | ExportXML(self, wxOutputStream stream, int indent, RichTextXMLHandler handler) -> bool
ExportXML(self, wxXmlNode parent, RichTextXMLHandler handler) -> bool | ExportXML(self, wxOutputStream stream, int indent, RichTextXMLHandler handler) -> bool
ExportXML(self, wxXmlNode parent, RichTextXMLHandler handler) -> bool | [
"ExportXML",
"(",
"self",
"wxOutputStream",
"stream",
"int",
"indent",
"RichTextXMLHandler",
"handler",
")",
"-",
">",
"bool",
"ExportXML",
"(",
"self",
"wxXmlNode",
"parent",
"RichTextXMLHandler",
"handler",
")",
"-",
">",
"bool"
] | def ExportXML(*args):
"""
ExportXML(self, wxOutputStream stream, int indent, RichTextXMLHandler handler) -> bool
ExportXML(self, wxXmlNode parent, RichTextXMLHandler handler) -> bool
"""
return _richtext.RichTextObject_ExportXML(*args) | [
"def",
"ExportXML",
"(",
"*",
"args",
")",
":",
"return",
"_richtext",
".",
"RichTextObject_ExportXML",
"(",
"*",
"args",
")"
] | https://github.com/wxWidgets/wxPython-Classic/blob/19571e1ae65f1ac445f5491474121998c97a1bf0/src/osx_cocoa/richtext.py#L1269-L1274 | |
wxWidgets/wxPython-Classic | 19571e1ae65f1ac445f5491474121998c97a1bf0 | src/osx_cocoa/propgrid.py | python | PGMultiButton.GetCount | (*args, **kwargs) | return _propgrid.PGMultiButton_GetCount(*args, **kwargs) | GetCount(self) -> int | GetCount(self) -> int | [
"GetCount",
"(",
"self",
")",
"-",
">",
"int"
] | def GetCount(*args, **kwargs):
"""GetCount(self) -> int"""
return _propgrid.PGMultiButton_GetCount(*args, **kwargs) | [
"def",
"GetCount",
"(",
"*",
"args",
",",
"*",
"*",
"kwargs",
")",
":",
"return",
"_propgrid",
".",
"PGMultiButton_GetCount",
"(",
"*",
"args",
",",
"*",
"*",
"kwargs",
")"
] | https://github.com/wxWidgets/wxPython-Classic/blob/19571e1ae65f1ac445f5491474121998c97a1bf0/src/osx_cocoa/propgrid.py#L2835-L2837 | |
panda3d/panda3d | 833ad89ebad58395d0af0b7ec08538e5e4308265 | makepanda/makepanda.py | python | CompileJava | (target, src, opts) | Compiles a .java file into a .class file. | Compiles a .java file into a .class file. | [
"Compiles",
"a",
".",
"java",
"file",
"into",
"a",
".",
"class",
"file",
"."
] | def CompileJava(target, src, opts):
"""Compiles a .java file into a .class file."""
if GetHost() == 'android':
cmd = "ecj "
else:
cmd = "javac -bootclasspath " + BracketNameWithQuotes(SDK["ANDROID_JAR"]) + " "
optlevel = GetOptimizeOption(opts)
if optlevel >= 4:
cmd += "-deb... | [
"def",
"CompileJava",
"(",
"target",
",",
"src",
",",
"opts",
")",
":",
"if",
"GetHost",
"(",
")",
"==",
"'android'",
":",
"cmd",
"=",
"\"ecj \"",
"else",
":",
"cmd",
"=",
"\"javac -bootclasspath \"",
"+",
"BracketNameWithQuotes",
"(",
"SDK",
"[",
"\"ANDRO... | https://github.com/panda3d/panda3d/blob/833ad89ebad58395d0af0b7ec08538e5e4308265/makepanda/makepanda.py#L2042-L2056 | ||
aws/lumberyard | f85344403c1c2e77ec8c75deb2c116e97b713217 | dev/Tools/AWSPythonSDK/1.5.8/botocore/session.py | python | Session.get_available_partitions | (self) | return resolver.get_available_partitions() | Lists the available partitions found on disk
:rtype: list
:return: Returns a list of partition names (e.g., ["aws", "aws-cn"]) | Lists the available partitions found on disk | [
"Lists",
"the",
"available",
"partitions",
"found",
"on",
"disk"
] | def get_available_partitions(self):
"""Lists the available partitions found on disk
:rtype: list
:return: Returns a list of partition names (e.g., ["aws", "aws-cn"])
"""
resolver = self.get_component('endpoint_resolver')
return resolver.get_available_partitions() | [
"def",
"get_available_partitions",
"(",
"self",
")",
":",
"resolver",
"=",
"self",
".",
"get_component",
"(",
"'endpoint_resolver'",
")",
"return",
"resolver",
".",
"get_available_partitions",
"(",
")"
] | https://github.com/aws/lumberyard/blob/f85344403c1c2e77ec8c75deb2c116e97b713217/dev/Tools/AWSPythonSDK/1.5.8/botocore/session.py#L871-L878 | |
benoitsteiner/tensorflow-opencl | cb7cb40a57fde5cfd4731bc551e82a1e2fef43a5 | tensorflow/tools/docs/pretty_docs.py | python | _Metadata.build_html | (self) | return '\n'.join(parts) | Return the Metadata block as an Html string. | Return the Metadata block as an Html string. | [
"Return",
"the",
"Metadata",
"block",
"as",
"an",
"Html",
"string",
"."
] | def build_html(self):
"""Return the Metadata block as an Html string."""
schema = 'http://developers.google.com/ReferenceObject'
parts = ['<div itemscope itemtype="%s">' % schema]
parts.append('<meta itemprop="name" content="%s" />' % self.name)
for item in self._content:
parts.append('<meta ... | [
"def",
"build_html",
"(",
"self",
")",
":",
"schema",
"=",
"'http://developers.google.com/ReferenceObject'",
"parts",
"=",
"[",
"'<div itemscope itemtype=\"%s\">'",
"%",
"schema",
"]",
"parts",
".",
"append",
"(",
"'<meta itemprop=\"name\" content=\"%s\" />'",
"%",
"self"... | https://github.com/benoitsteiner/tensorflow-opencl/blob/cb7cb40a57fde5cfd4731bc551e82a1e2fef43a5/tensorflow/tools/docs/pretty_docs.py#L336-L347 | |
rdiankov/openrave | d1a23023fd4b58f077d2ca949ceaf1b91f3f13d7 | 3rdparty/flann-1.6.6/src/python/pyflann/index.py | python | FLANN.__init__ | (self, **kwargs) | Constructor for the class and returns a class that can bind to
the flann libraries. Any keyword arguments passed to __init__
override the global defaults given. | Constructor for the class and returns a class that can bind to
the flann libraries. Any keyword arguments passed to __init__
override the global defaults given. | [
"Constructor",
"for",
"the",
"class",
"and",
"returns",
"a",
"class",
"that",
"can",
"bind",
"to",
"the",
"flann",
"libraries",
".",
"Any",
"keyword",
"arguments",
"passed",
"to",
"__init__",
"override",
"the",
"global",
"defaults",
"given",
"."
] | def __init__(self, **kwargs):
"""
Constructor for the class and returns a class that can bind to
the flann libraries. Any keyword arguments passed to __init__
override the global defaults given.
"""
self.__rn_gen.seed()
self.__curindex = None
se... | [
"def",
"__init__",
"(",
"self",
",",
"*",
"*",
"kwargs",
")",
":",
"self",
".",
"__rn_gen",
".",
"seed",
"(",
")",
"self",
".",
"__curindex",
"=",
"None",
"self",
".",
"__curindex_data",
"=",
"None",
"self",
".",
"__curindex_type",
"=",
"None",
"self",... | https://github.com/rdiankov/openrave/blob/d1a23023fd4b58f077d2ca949ceaf1b91f3f13d7/3rdparty/flann-1.6.6/src/python/pyflann/index.py#L65-L79 | ||
natanielruiz/android-yolo | 1ebb54f96a67a20ff83ddfc823ed83a13dc3a47f | jni-build/jni/include/tensorflow/examples/image_retraining/retrain.py | python | cache_bottlenecks | (sess, image_lists, image_dir, bottleneck_dir,
jpeg_data_tensor, bottleneck_tensor) | Ensures all the training, testing, and validation bottlenecks are cached.
Because we're likely to read the same image multiple times (if there are no
distortions applied during training) it can speed things up a lot if we
calculate the bottleneck layer values once for each image during
preprocessing, and then ... | Ensures all the training, testing, and validation bottlenecks are cached. | [
"Ensures",
"all",
"the",
"training",
"testing",
"and",
"validation",
"bottlenecks",
"are",
"cached",
"."
] | def cache_bottlenecks(sess, image_lists, image_dir, bottleneck_dir,
jpeg_data_tensor, bottleneck_tensor):
"""Ensures all the training, testing, and validation bottlenecks are cached.
Because we're likely to read the same image multiple times (if there are no
distortions applied during train... | [
"def",
"cache_bottlenecks",
"(",
"sess",
",",
"image_lists",
",",
"image_dir",
",",
"bottleneck_dir",
",",
"jpeg_data_tensor",
",",
"bottleneck_tensor",
")",
":",
"how_many_bottlenecks",
"=",
"0",
"ensure_dir_exists",
"(",
"bottleneck_dir",
")",
"for",
"label_name",
... | https://github.com/natanielruiz/android-yolo/blob/1ebb54f96a67a20ff83ddfc823ed83a13dc3a47f/jni-build/jni/include/tensorflow/examples/image_retraining/retrain.py#L425-L459 | ||
CleverRaven/Cataclysm-DDA | 03e7363df0835ec1b39da973ea29f26f27833b38 | tools/json_tools/itemgroups.py | python | get_item_data | (entries, categories=None, ignore=None) | return (item_to_group, item_orphan, item_entry, problems) | Scans the raw data structure from JSON and constructs
an item to group map, a dict of orphans, a dict of items,
an a list of potential problems | Scans the raw data structure from JSON and constructs
an item to group map, a dict of orphans, a dict of items,
an a list of potential problems | [
"Scans",
"the",
"raw",
"data",
"structure",
"from",
"JSON",
"and",
"constructs",
"an",
"item",
"to",
"group",
"map",
"a",
"dict",
"of",
"orphans",
"a",
"dict",
"of",
"items",
"an",
"a",
"list",
"of",
"potential",
"problems"
] | def get_item_data(entries, categories=None, ignore=None):
"""Scans the raw data structure from JSON and constructs
an item to group map, a dict of orphans, a dict of items,
an a list of potential problems"""
ignore_items = ["battery_test"]
TYPE_WHITELIST.append("item_group")
if ignore:
... | [
"def",
"get_item_data",
"(",
"entries",
",",
"categories",
"=",
"None",
",",
"ignore",
"=",
"None",
")",
":",
"ignore_items",
"=",
"[",
"\"battery_test\"",
"]",
"TYPE_WHITELIST",
".",
"append",
"(",
"\"item_group\"",
")",
"if",
"ignore",
":",
"ignore_items",
... | https://github.com/CleverRaven/Cataclysm-DDA/blob/03e7363df0835ec1b39da973ea29f26f27833b38/tools/json_tools/itemgroups.py#L137-L182 | |
tensorflow/tensorflow | 419e3a6b650ea4bd1b0cba23c4348f8a69f3272e | tensorflow/python/ops/string_ops.py | python | regex_full_match | (input, pattern, name=None) | return gen_string_ops.regex_full_match(
input=input, pattern=pattern, name=name) | r"""Match elements of `input` with regex `pattern`.
Args:
input: string `Tensor`, the source strings to process.
pattern: string or scalar string `Tensor`, regular expression to use,
see more details at https://github.com/google/re2/wiki/Syntax
name: Name of the op.
Returns:
bool `Tensor` of... | r"""Match elements of `input` with regex `pattern`. | [
"r",
"Match",
"elements",
"of",
"input",
"with",
"regex",
"pattern",
"."
] | def regex_full_match(input, pattern, name=None):
r"""Match elements of `input` with regex `pattern`.
Args:
input: string `Tensor`, the source strings to process.
pattern: string or scalar string `Tensor`, regular expression to use,
see more details at https://github.com/google/re2/wiki/Syntax
nam... | [
"def",
"regex_full_match",
"(",
"input",
",",
"pattern",
",",
"name",
"=",
"None",
")",
":",
"if",
"isinstance",
"(",
"pattern",
",",
"util_compat",
".",
"bytes_or_text_types",
")",
":",
"# When `pattern` is static through the life of the op we can",
"# use a version wh... | https://github.com/tensorflow/tensorflow/blob/419e3a6b650ea4bd1b0cba23c4348f8a69f3272e/tensorflow/python/ops/string_ops.py#L47-L66 | |
catboost/catboost | 167f64f237114a4d10b2b4ee42adb4569137debe | contrib/python/scikit-learn/py2/sklearn/utils/extmath.py | python | norm | (x) | return nrm2(x) | Compute the Euclidean or Frobenius norm of x.
Returns the Euclidean norm when x is a vector, the Frobenius norm when x
is a matrix (2-d array). More precise than sqrt(squared_norm(x)). | Compute the Euclidean or Frobenius norm of x. | [
"Compute",
"the",
"Euclidean",
"or",
"Frobenius",
"norm",
"of",
"x",
"."
] | def norm(x):
"""Compute the Euclidean or Frobenius norm of x.
Returns the Euclidean norm when x is a vector, the Frobenius norm when x
is a matrix (2-d array). More precise than sqrt(squared_norm(x)).
"""
x = np.asarray(x)
nrm2, = linalg.get_blas_funcs(['nrm2'], [x])
return nrm2(x) | [
"def",
"norm",
"(",
"x",
")",
":",
"x",
"=",
"np",
".",
"asarray",
"(",
"x",
")",
"nrm2",
",",
"=",
"linalg",
".",
"get_blas_funcs",
"(",
"[",
"'nrm2'",
"]",
",",
"[",
"x",
"]",
")",
"return",
"nrm2",
"(",
"x",
")"
] | https://github.com/catboost/catboost/blob/167f64f237114a4d10b2b4ee42adb4569137debe/contrib/python/scikit-learn/py2/sklearn/utils/extmath.py#L31-L39 | |
aws/lumberyard | f85344403c1c2e77ec8c75deb2c116e97b713217 | dev/Tools/Python/3.7.10/windows/Lib/site-packages/setuptools/_vendor/pyparsing.py | python | ParseResults.getName | (self) | r"""
Returns the results name for this token expression. Useful when several
different expressions might match at a particular location.
Example::
integer = Word(nums)
ssn_expr = Regex(r"\d\d\d-\d\d-\d\d\d\d")
house_number_expr = Suppress('#') + Word(nums, a... | r"""
Returns the results name for this token expression. Useful when several
different expressions might match at a particular location. | [
"r",
"Returns",
"the",
"results",
"name",
"for",
"this",
"token",
"expression",
".",
"Useful",
"when",
"several",
"different",
"expressions",
"might",
"match",
"at",
"a",
"particular",
"location",
"."
] | def getName(self):
r"""
Returns the results name for this token expression. Useful when several
different expressions might match at a particular location.
Example::
integer = Word(nums)
ssn_expr = Regex(r"\d\d\d-\d\d-\d\d\d\d")
house_number_expr = S... | [
"def",
"getName",
"(",
"self",
")",
":",
"if",
"self",
".",
"__name",
":",
"return",
"self",
".",
"__name",
"elif",
"self",
".",
"__parent",
":",
"par",
"=",
"self",
".",
"__parent",
"(",
")",
"if",
"par",
":",
"return",
"par",
".",
"__lookup",
"("... | https://github.com/aws/lumberyard/blob/f85344403c1c2e77ec8c75deb2c116e97b713217/dev/Tools/Python/3.7.10/windows/Lib/site-packages/setuptools/_vendor/pyparsing.py#L834-L869 | ||
infinit/memo | 3a8394d0f647efe03ccb8bfe885a7279cb8be8a6 | elle/drake/src/drake/__init__.py | python | WriteBuilder.execute | (self) | return True | Create all the non-existent target nodes as empty files. | Create all the non-existent target nodes as empty files. | [
"Create",
"all",
"the",
"non",
"-",
"existent",
"target",
"nodes",
"as",
"empty",
"files",
"."
] | def execute(self):
"""Create all the non-existent target nodes as empty files."""
pretty = 'Write' if len(self.__input) else 'Touch'
self.output(
'%s %s' % (pretty, ', '.join(map(str, self.targets()))))
for node in self.targets():
path = str(node.path())
ass... | [
"def",
"execute",
"(",
"self",
")",
":",
"pretty",
"=",
"'Write'",
"if",
"len",
"(",
"self",
".",
"__input",
")",
"else",
"'Touch'",
"self",
".",
"output",
"(",
"'%s %s'",
"%",
"(",
"pretty",
",",
"', '",
".",
"join",
"(",
"map",
"(",
"str",
",",
... | https://github.com/infinit/memo/blob/3a8394d0f647efe03ccb8bfe885a7279cb8be8a6/elle/drake/src/drake/__init__.py#L3511-L3527 | |
ChromiumWebApps/chromium | c7361d39be8abd1574e6ce8957c8dbddd4c6ccf7 | tools/symsrc/pefile.py | python | PE.get_qword_at_rva | (self, rva) | Return the quad-word value at the given RVA.
Returns None if the value can't be read, i.e. the RVA can't be mapped
to a file offset. | Return the quad-word value at the given RVA.
Returns None if the value can't be read, i.e. the RVA can't be mapped
to a file offset. | [
"Return",
"the",
"quad",
"-",
"word",
"value",
"at",
"the",
"given",
"RVA",
".",
"Returns",
"None",
"if",
"the",
"value",
"can",
"t",
"be",
"read",
"i",
".",
"e",
".",
"the",
"RVA",
"can",
"t",
"be",
"mapped",
"to",
"a",
"file",
"offset",
"."
] | def get_qword_at_rva(self, rva):
"""Return the quad-word value at the given RVA.
Returns None if the value can't be read, i.e. the RVA can't be mapped
to a file offset.
"""
try:
return self.get_qword_from_data(self.get_data(rva)[:8], 0)
excep... | [
"def",
"get_qword_at_rva",
"(",
"self",
",",
"rva",
")",
":",
"try",
":",
"return",
"self",
".",
"get_qword_from_data",
"(",
"self",
".",
"get_data",
"(",
"rva",
")",
"[",
":",
"8",
"]",
",",
"0",
")",
"except",
"PEFormatError",
":",
"return",
"None"
] | https://github.com/ChromiumWebApps/chromium/blob/c7361d39be8abd1574e6ce8957c8dbddd4c6ccf7/tools/symsrc/pefile.py#L3526-L3536 | ||
gem5/gem5 | 141cc37c2d4b93959d4c249b8f7e6a8b2ef75338 | src/python/m5/ext/pyfdt/pyfdt.py | python | FdtPropertyStrings.__extract_prop_strings | (cls, value) | return [st for st in \
value.decode('ascii').split('\0') if len(st)] | Extract strings from raw_value | Extract strings from raw_value | [
"Extract",
"strings",
"from",
"raw_value"
] | def __extract_prop_strings(cls, value):
"""Extract strings from raw_value"""
return [st for st in \
value.decode('ascii').split('\0') if len(st)] | [
"def",
"__extract_prop_strings",
"(",
"cls",
",",
"value",
")",
":",
"return",
"[",
"st",
"for",
"st",
"in",
"value",
".",
"decode",
"(",
"'ascii'",
")",
".",
"split",
"(",
"'\\0'",
")",
"if",
"len",
"(",
"st",
")",
"]"
] | https://github.com/gem5/gem5/blob/141cc37c2d4b93959d4c249b8f7e6a8b2ef75338/src/python/m5/ext/pyfdt/pyfdt.py#L163-L166 | |
wlanjie/AndroidFFmpeg | 7baf9122f4b8e1c74e7baf4be5c422c7a5ba5aaf | tools/fdk-aac-build/x86/toolchain/lib/python2.7/lib-tk/Tkinter.py | python | Listbox.get | (self, first, last=None) | Get list of items from FIRST to LAST (not included). | Get list of items from FIRST to LAST (not included). | [
"Get",
"list",
"of",
"items",
"from",
"FIRST",
"to",
"LAST",
"(",
"not",
"included",
")",
"."
] | def get(self, first, last=None):
"""Get list of items from FIRST to LAST (not included)."""
if last:
return self.tk.splitlist(self.tk.call(
self._w, 'get', first, last))
else:
return self.tk.call(self._w, 'get', first) | [
"def",
"get",
"(",
"self",
",",
"first",
",",
"last",
"=",
"None",
")",
":",
"if",
"last",
":",
"return",
"self",
".",
"tk",
".",
"splitlist",
"(",
"self",
".",
"tk",
".",
"call",
"(",
"self",
".",
"_w",
",",
"'get'",
",",
"first",
",",
"last",... | https://github.com/wlanjie/AndroidFFmpeg/blob/7baf9122f4b8e1c74e7baf4be5c422c7a5ba5aaf/tools/fdk-aac-build/x86/toolchain/lib/python2.7/lib-tk/Tkinter.py#L2566-L2572 | ||
aws/lumberyard | f85344403c1c2e77ec8c75deb2c116e97b713217 | dev/Tools/Python/3.7.10/windows/Lib/email/__init__.py | python | message_from_string | (s, *args, **kws) | return Parser(*args, **kws).parsestr(s) | Parse a string into a Message object model.
Optional _class and strict are passed to the Parser constructor. | Parse a string into a Message object model. | [
"Parse",
"a",
"string",
"into",
"a",
"Message",
"object",
"model",
"."
] | def message_from_string(s, *args, **kws):
"""Parse a string into a Message object model.
Optional _class and strict are passed to the Parser constructor.
"""
from email.parser import Parser
return Parser(*args, **kws).parsestr(s) | [
"def",
"message_from_string",
"(",
"s",
",",
"*",
"args",
",",
"*",
"*",
"kws",
")",
":",
"from",
"email",
".",
"parser",
"import",
"Parser",
"return",
"Parser",
"(",
"*",
"args",
",",
"*",
"*",
"kws",
")",
".",
"parsestr",
"(",
"s",
")"
] | https://github.com/aws/lumberyard/blob/f85344403c1c2e77ec8c75deb2c116e97b713217/dev/Tools/Python/3.7.10/windows/Lib/email/__init__.py#L32-L38 | |
wlanjie/AndroidFFmpeg | 7baf9122f4b8e1c74e7baf4be5c422c7a5ba5aaf | tools/fdk-aac-build/armeabi/toolchain/lib/python2.7/nntplib.py | python | NNTP.next | (self) | return self.statcmd('NEXT') | Process a NEXT command. No arguments. Return as for STAT. | Process a NEXT command. No arguments. Return as for STAT. | [
"Process",
"a",
"NEXT",
"command",
".",
"No",
"arguments",
".",
"Return",
"as",
"for",
"STAT",
"."
] | def next(self):
"""Process a NEXT command. No arguments. Return as for STAT."""
return self.statcmd('NEXT') | [
"def",
"next",
"(",
"self",
")",
":",
"return",
"self",
".",
"statcmd",
"(",
"'NEXT'",
")"
] | https://github.com/wlanjie/AndroidFFmpeg/blob/7baf9122f4b8e1c74e7baf4be5c422c7a5ba5aaf/tools/fdk-aac-build/armeabi/toolchain/lib/python2.7/nntplib.py#L397-L399 | |
hanpfei/chromium-net | 392cc1fa3a8f92f42e4071ab6e674d8e0482f83f | third_party/catapult/devil/devil/utils/find_usb_devices.py | python | parse_options | (argv) | return parser.parse_args(argv[1:]) | Parses and checks the command-line options.
Returns:
A tuple containing the options structure and a list of categories to
be traced. | Parses and checks the command-line options. | [
"Parses",
"and",
"checks",
"the",
"command",
"-",
"line",
"options",
"."
] | def parse_options(argv):
"""Parses and checks the command-line options.
Returns:
A tuple containing the options structure and a list of categories to
be traced.
"""
USAGE = '''./find_usb_devices [--help]
This script shows the mapping between USB devices and port numbers.
Clients are not intende... | [
"def",
"parse_options",
"(",
"argv",
")",
":",
"USAGE",
"=",
"'''./find_usb_devices [--help]\n This script shows the mapping between USB devices and port numbers.\n Clients are not intended to call this script from the command line.\n Clients are intended to call the functions in this scrip... | https://github.com/hanpfei/chromium-net/blob/392cc1fa3a8f92f42e4071ab6e674d8e0482f83f/third_party/catapult/devil/devil/utils/find_usb_devices.py#L507-L525 | |
Xilinx/Vitis-AI | fc74d404563d9951b57245443c73bef389f3657f | tools/Vitis-AI-Quantizer/vai_q_tensorflow1.x/tensorflow/python/framework/meta_graph.py | python | export_scoped_meta_graph | (filename=None,
graph_def=None,
graph=None,
export_scope=None,
as_text=False,
unbound_inputs_col_name="unbound_inputs",
clear_devices=False,
... | return scoped_meta_graph_def, var_list | Returns `MetaGraphDef` proto. Optionally writes it to filename.
This function exports the graph, saver, and collection objects into
`MetaGraphDef` protocol buffer with the intention of it being imported
at a later time or location to restart training, run inference, or be
a subgraph.
Args:
filename: Opt... | Returns `MetaGraphDef` proto. Optionally writes it to filename. | [
"Returns",
"MetaGraphDef",
"proto",
".",
"Optionally",
"writes",
"it",
"to",
"filename",
"."
] | def export_scoped_meta_graph(filename=None,
graph_def=None,
graph=None,
export_scope=None,
as_text=False,
unbound_inputs_col_name="unbound_inputs",
... | [
"def",
"export_scoped_meta_graph",
"(",
"filename",
"=",
"None",
",",
"graph_def",
"=",
"None",
",",
"graph",
"=",
"None",
",",
"export_scope",
"=",
"None",
",",
"as_text",
"=",
"False",
",",
"unbound_inputs_col_name",
"=",
"\"unbound_inputs\"",
",",
"clear_devi... | https://github.com/Xilinx/Vitis-AI/blob/fc74d404563d9951b57245443c73bef389f3657f/tools/Vitis-AI-Quantizer/vai_q_tensorflow1.x/tensorflow/python/framework/meta_graph.py#L913-L1075 | |
yyzybb537/libgo | 4af17b7c67643c4d54aa354dcc77963ea07847d0 | third_party/boost.context/tools/build/src/build/feature.py | python | Feature.parent | (self) | return self._parent | For subfeatures, return pair of (parent_feature, value).
Value may be None if this subfeature is not specific to any
value of the parent feature. | For subfeatures, return pair of (parent_feature, value). | [
"For",
"subfeatures",
"return",
"pair",
"of",
"(",
"parent_feature",
"value",
")",
"."
] | def parent(self):
"""For subfeatures, return pair of (parent_feature, value).
Value may be None if this subfeature is not specific to any
value of the parent feature.
"""
return self._parent | [
"def",
"parent",
"(",
"self",
")",
":",
"return",
"self",
".",
"_parent"
] | https://github.com/yyzybb537/libgo/blob/4af17b7c67643c4d54aa354dcc77963ea07847d0/third_party/boost.context/tools/build/src/build/feature.py#L77-L83 | |
wxWidgets/wxPython-Classic | 19571e1ae65f1ac445f5491474121998c97a1bf0 | src/msw/stc.py | python | StyledTextCtrl.GetText | (*args, **kwargs) | return _stc.StyledTextCtrl_GetText(*args, **kwargs) | GetText(self) -> String
Retrieve all the text in the document. | GetText(self) -> String | [
"GetText",
"(",
"self",
")",
"-",
">",
"String"
] | def GetText(*args, **kwargs):
"""
GetText(self) -> String
Retrieve all the text in the document.
"""
return _stc.StyledTextCtrl_GetText(*args, **kwargs) | [
"def",
"GetText",
"(",
"*",
"args",
",",
"*",
"*",
"kwargs",
")",
":",
"return",
"_stc",
".",
"StyledTextCtrl_GetText",
"(",
"*",
"args",
",",
"*",
"*",
"kwargs",
")"
] | https://github.com/wxWidgets/wxPython-Classic/blob/19571e1ae65f1ac445f5491474121998c97a1bf0/src/msw/stc.py#L3665-L3671 | |
bitconch/bitconch-core | 5537f3215b3e3b76f6720d6f908676a6c34bc5db | deploy-nightly.py | python | rmtree_onerror | (self, func, file_path, exc_info) | Error handler for ``shutil.rmtree``.
If the error is due to an access error (read only file)
it attempts to add write permission and then retries.
If the error is for another reason it re-raises the error.
Usage : ``shutil.rmtree(path, onerror=onerror)`` | Error handler for ``shutil.rmtree``.
If the error is due to an access error (read only file)
it attempts to add write permission and then retries.
If the error is for another reason it re-raises the error.
Usage : ``shutil.rmtree(path, onerror=onerror)`` | [
"Error",
"handler",
"for",
"shutil",
".",
"rmtree",
".",
"If",
"the",
"error",
"is",
"due",
"to",
"an",
"access",
"error",
"(",
"read",
"only",
"file",
")",
"it",
"attempts",
"to",
"add",
"write",
"permission",
"and",
"then",
"retries",
".",
"If",
"the... | def rmtree_onerror(self, func, file_path, exc_info):
"""
Error handler for ``shutil.rmtree``.
If the error is due to an access error (read only file)
it attempts to add write permission and then retries.
If the error is for another reason it re-raises the error.
Usage : ``shutil.rmtree(path, one... | [
"def",
"rmtree_onerror",
"(",
"self",
",",
"func",
",",
"file_path",
",",
"exc_info",
")",
":",
"logging",
".",
"warning",
"(",
"str",
"(",
"exc_info",
")",
")",
"logging",
".",
"warning",
"(",
"\"rmtree error,check the file exists or try to chmod the file,then retr... | https://github.com/bitconch/bitconch-core/blob/5537f3215b3e3b76f6720d6f908676a6c34bc5db/deploy-nightly.py#L18-L34 | ||
wxWidgets/wxPython-Classic | 19571e1ae65f1ac445f5491474121998c97a1bf0 | src/gtk/_windows.py | python | StatusBar.PushStatusText | (*args, **kwargs) | return _windows_.StatusBar_PushStatusText(*args, **kwargs) | PushStatusText(self, String text, int number=0) | PushStatusText(self, String text, int number=0) | [
"PushStatusText",
"(",
"self",
"String",
"text",
"int",
"number",
"=",
"0",
")"
] | def PushStatusText(*args, **kwargs):
"""PushStatusText(self, String text, int number=0)"""
return _windows_.StatusBar_PushStatusText(*args, **kwargs) | [
"def",
"PushStatusText",
"(",
"*",
"args",
",",
"*",
"*",
"kwargs",
")",
":",
"return",
"_windows_",
".",
"StatusBar_PushStatusText",
"(",
"*",
"args",
",",
"*",
"*",
"kwargs",
")"
] | https://github.com/wxWidgets/wxPython-Classic/blob/19571e1ae65f1ac445f5491474121998c97a1bf0/src/gtk/_windows.py#L1255-L1257 | |
Tencent/Pebble | 68315f176d9e328a233ace29b7579a829f89879f | tools/blade/src/blade/target.py | python | Target._clone_env | (self) | Clone target's environment. | Clone target's environment. | [
"Clone",
"target",
"s",
"environment",
"."
] | def _clone_env(self):
"""Clone target's environment. """
self._write_rule('%s = top_env.Clone()' % self._env_name()) | [
"def",
"_clone_env",
"(",
"self",
")",
":",
"self",
".",
"_write_rule",
"(",
"'%s = top_env.Clone()'",
"%",
"self",
".",
"_env_name",
"(",
")",
")"
] | https://github.com/Tencent/Pebble/blob/68315f176d9e328a233ace29b7579a829f89879f/tools/blade/src/blade/target.py#L58-L60 | ||
sc0ty/subsync | be5390d00ff475b6543eb0140c7e65b34317d95b | subsync/assets/item.py | python | Asset.remoteVersion | (self) | return utils.parseVersion(self._remote.get('version')) | Get version of asset available on server.
Returns
-------
tuple of int or None
Remote version number or `None` if not available on server. | Get version of asset available on server. | [
"Get",
"version",
"of",
"asset",
"available",
"on",
"server",
"."
] | def remoteVersion(self):
"""Get version of asset available on server.
Returns
-------
tuple of int or None
Remote version number or `None` if not available on server.
"""
return utils.parseVersion(self._remote.get('version')) | [
"def",
"remoteVersion",
"(",
"self",
")",
":",
"return",
"utils",
".",
"parseVersion",
"(",
"self",
".",
"_remote",
".",
"get",
"(",
"'version'",
")",
")"
] | https://github.com/sc0ty/subsync/blob/be5390d00ff475b6543eb0140c7e65b34317d95b/subsync/assets/item.py#L71-L79 | |
wxWidgets/wxPython-Classic | 19571e1ae65f1ac445f5491474121998c97a1bf0 | src/msw/combo.py | python | ComboCtrl.SetPopupMinWidth | (*args, **kwargs) | return _combo.ComboCtrl_SetPopupMinWidth(*args, **kwargs) | SetPopupMinWidth(self, int width)
Sets minimum width of the popup. If wider than combo control, it will
extend to the left. A value of -1 indicates to use the default. The
popup implementation may choose to ignore this. | SetPopupMinWidth(self, int width) | [
"SetPopupMinWidth",
"(",
"self",
"int",
"width",
")"
] | def SetPopupMinWidth(*args, **kwargs):
"""
SetPopupMinWidth(self, int width)
Sets minimum width of the popup. If wider than combo control, it will
extend to the left. A value of -1 indicates to use the default. The
popup implementation may choose to ignore this.
"""
... | [
"def",
"SetPopupMinWidth",
"(",
"*",
"args",
",",
"*",
"*",
"kwargs",
")",
":",
"return",
"_combo",
".",
"ComboCtrl_SetPopupMinWidth",
"(",
"*",
"args",
",",
"*",
"*",
"kwargs",
")"
] | https://github.com/wxWidgets/wxPython-Classic/blob/19571e1ae65f1ac445f5491474121998c97a1bf0/src/msw/combo.py#L273-L281 | |
wxWidgets/wxPython-Classic | 19571e1ae65f1ac445f5491474121998c97a1bf0 | src/osx_cocoa/aui.py | python | AuiManager._GetPaneByWidget | (*args, **kwargs) | return _aui.AuiManager__GetPaneByWidget(*args, **kwargs) | _GetPaneByWidget(self, Window window) -> AuiPaneInfo | _GetPaneByWidget(self, Window window) -> AuiPaneInfo | [
"_GetPaneByWidget",
"(",
"self",
"Window",
"window",
")",
"-",
">",
"AuiPaneInfo"
] | def _GetPaneByWidget(*args, **kwargs):
"""_GetPaneByWidget(self, Window window) -> AuiPaneInfo"""
return _aui.AuiManager__GetPaneByWidget(*args, **kwargs) | [
"def",
"_GetPaneByWidget",
"(",
"*",
"args",
",",
"*",
"*",
"kwargs",
")",
":",
"return",
"_aui",
".",
"AuiManager__GetPaneByWidget",
"(",
"*",
"args",
",",
"*",
"*",
"kwargs",
")"
] | https://github.com/wxWidgets/wxPython-Classic/blob/19571e1ae65f1ac445f5491474121998c97a1bf0/src/osx_cocoa/aui.py#L627-L629 | |
mindspore-ai/mindspore | fb8fd3338605bb34fa5cea054e535a8b1d753fab | mindspore/python/mindspore/nn/layer/pooling.py | python | AvgPool1d.__init__ | (self,
kernel_size=1,
stride=1,
pad_mode="valid") | Initialize AvgPool1d. | Initialize AvgPool1d. | [
"Initialize",
"AvgPool1d",
"."
] | def __init__(self,
kernel_size=1,
stride=1,
pad_mode="valid"):
"""Initialize AvgPool1d."""
validator.check_value_type('kernel_size', kernel_size, [int], self.cls_name)
validator.check_value_type('stride', stride, [int], self.cls_name)
se... | [
"def",
"__init__",
"(",
"self",
",",
"kernel_size",
"=",
"1",
",",
"stride",
"=",
"1",
",",
"pad_mode",
"=",
"\"valid\"",
")",
":",
"validator",
".",
"check_value_type",
"(",
"'kernel_size'",
",",
"kernel_size",
",",
"[",
"int",
"]",
",",
"self",
".",
... | https://github.com/mindspore-ai/mindspore/blob/fb8fd3338605bb34fa5cea054e535a8b1d753fab/mindspore/python/mindspore/nn/layer/pooling.py#L364-L384 | ||
catboost/catboost | 167f64f237114a4d10b2b4ee42adb4569137debe | contrib/tools/python/src/Lib/idlelib/configHandler.py | python | IdleConfParser.GetOptionList | (self, section) | Return a list of options for given section, else []. | Return a list of options for given section, else []. | [
"Return",
"a",
"list",
"of",
"options",
"for",
"given",
"section",
"else",
"[]",
"."
] | def GetOptionList(self, section):
"Return a list of options for given section, else []."
if self.has_section(section):
return self.options(section)
else: #return a default value
return [] | [
"def",
"GetOptionList",
"(",
"self",
",",
"section",
")",
":",
"if",
"self",
".",
"has_section",
"(",
"section",
")",
":",
"return",
"self",
".",
"options",
"(",
"section",
")",
"else",
":",
"#return a default value",
"return",
"[",
"]"
] | https://github.com/catboost/catboost/blob/167f64f237114a4d10b2b4ee42adb4569137debe/contrib/tools/python/src/Lib/idlelib/configHandler.py#L62-L67 | ||
root-project/root | fcd3583bb14852bf2e8cd2415717cbaac0e75896 | bindings/pyroot/pythonizations/python/ROOT/_pythonization/_roofit/__init__.py | python | get_defined_attributes | (klass, consider_base_classes=False) | return sorted([attr for attr in dir(klass) if is_defined(attr)]) | Get all class attributes that are defined in a given class or optionally in
any of its base classes (except for `object`). | Get all class attributes that are defined in a given class or optionally in
any of its base classes (except for `object`). | [
"Get",
"all",
"class",
"attributes",
"that",
"are",
"defined",
"in",
"a",
"given",
"class",
"or",
"optionally",
"in",
"any",
"of",
"its",
"base",
"classes",
"(",
"except",
"for",
"object",
")",
"."
] | def get_defined_attributes(klass, consider_base_classes=False):
"""
Get all class attributes that are defined in a given class or optionally in
any of its base classes (except for `object`).
"""
blacklist = ["__dict__", "__doc__", "__hash__", "__module__", "__weakref__"]
if not consider_base_c... | [
"def",
"get_defined_attributes",
"(",
"klass",
",",
"consider_base_classes",
"=",
"False",
")",
":",
"blacklist",
"=",
"[",
"\"__dict__\"",
",",
"\"__doc__\"",
",",
"\"__hash__\"",
",",
"\"__module__\"",
",",
"\"__weakref__\"",
"]",
"if",
"not",
"consider_base_class... | https://github.com/root-project/root/blob/fcd3583bb14852bf2e8cd2415717cbaac0e75896/bindings/pyroot/pythonizations/python/ROOT/_pythonization/_roofit/__init__.py#L119-L148 | |
miyosuda/TensorFlowAndroidDemo | 35903e0221aa5f109ea2dbef27f20b52e317f42d | jni-build/jni/include/tensorflow/python/ops/state_ops.py | python | _AssignUpdateShape | (op) | return [op.inputs[0].get_shape().merge_with(op.inputs[1].get_shape())] | Shape function for the AssignAdd and AssignSub dense update ops. | Shape function for the AssignAdd and AssignSub dense update ops. | [
"Shape",
"function",
"for",
"the",
"AssignAdd",
"and",
"AssignSub",
"dense",
"update",
"ops",
"."
] | def _AssignUpdateShape(op):
"""Shape function for the AssignAdd and AssignSub dense update ops."""
return [op.inputs[0].get_shape().merge_with(op.inputs[1].get_shape())] | [
"def",
"_AssignUpdateShape",
"(",
"op",
")",
":",
"return",
"[",
"op",
".",
"inputs",
"[",
"0",
"]",
".",
"get_shape",
"(",
")",
".",
"merge_with",
"(",
"op",
".",
"inputs",
"[",
"1",
"]",
".",
"get_shape",
"(",
")",
")",
"]"
] | https://github.com/miyosuda/TensorFlowAndroidDemo/blob/35903e0221aa5f109ea2dbef27f20b52e317f42d/jni-build/jni/include/tensorflow/python/ops/state_ops.py#L216-L218 | |
Yelp/MOE | 5b5a6a2c6c3cf47320126f7f5894e2a83e347f5c | moe/optimal_learning/python/python_version/log_likelihood.py | python | GaussianProcessLogMarginalLikelihood.dim | (self) | return self._historical_data.dim | Return the number of spatial dimensions. | Return the number of spatial dimensions. | [
"Return",
"the",
"number",
"of",
"spatial",
"dimensions",
"."
] | def dim(self):
"""Return the number of spatial dimensions."""
return self._historical_data.dim | [
"def",
"dim",
"(",
"self",
")",
":",
"return",
"self",
".",
"_historical_data",
".",
"dim"
] | https://github.com/Yelp/MOE/blob/5b5a6a2c6c3cf47320126f7f5894e2a83e347f5c/moe/optimal_learning/python/python_version/log_likelihood.py#L204-L206 | |
albertz/openlierox | d316c14a8eb57848ef56e9bfa7b23a56f694a51b | tools/DedicatedServerVideo/gdata/finance/service.py | python | FinanceService.AddTransaction | (self, transaction_entry=None, transaction_feed = None,
position_entry=None, portfolio_id=None, ticker_id=None) | return self.Post(transaction_entry, uri,
converter=gdata.finance.TransactionEntryFromString) | Args:
transaction_entry: TransactionEntry (required)
transaction_feed: TransactionFeed (optional; see Notes)
position_entry: PositionEntry (optional; see Notes)
portfolio_id: string (optional; see Notes) This may be obtained
from a PortfolioEntry's portfolio_id attribute.
ticker_... | Args:
transaction_entry: TransactionEntry (required)
transaction_feed: TransactionFeed (optional; see Notes)
position_entry: PositionEntry (optional; see Notes)
portfolio_id: string (optional; see Notes) This may be obtained
from a PortfolioEntry's portfolio_id attribute.
ticker_... | [
"Args",
":",
"transaction_entry",
":",
"TransactionEntry",
"(",
"required",
")",
"transaction_feed",
":",
"TransactionFeed",
"(",
"optional",
";",
"see",
"Notes",
")",
"position_entry",
":",
"PositionEntry",
"(",
"optional",
";",
"see",
"Notes",
")",
"portfolio_id... | def AddTransaction(self, transaction_entry=None, transaction_feed = None,
position_entry=None, portfolio_id=None, ticker_id=None):
"""
Args:
transaction_entry: TransactionEntry (required)
transaction_feed: TransactionFeed (optional; see Notes)
position_entry: PositionEntry (optional; see... | [
"def",
"AddTransaction",
"(",
"self",
",",
"transaction_entry",
"=",
"None",
",",
"transaction_feed",
"=",
"None",
",",
"position_entry",
"=",
"None",
",",
"portfolio_id",
"=",
"None",
",",
"ticker_id",
"=",
"None",
")",
":",
"if",
"transaction_feed",
":",
"... | https://github.com/albertz/openlierox/blob/d316c14a8eb57848ef56e9bfa7b23a56f694a51b/tools/DedicatedServerVideo/gdata/finance/service.py#L208-L234 | |
wxWidgets/wxPython-Classic | 19571e1ae65f1ac445f5491474121998c97a1bf0 | src/osx_cocoa/dataview.py | python | DataViewListCtrl.SetValue | (*args, **kwargs) | return _dataview.DataViewListCtrl_SetValue(*args, **kwargs) | SetValue(self, wxVariant value, unsigned int row, unsigned int col) | SetValue(self, wxVariant value, unsigned int row, unsigned int col) | [
"SetValue",
"(",
"self",
"wxVariant",
"value",
"unsigned",
"int",
"row",
"unsigned",
"int",
"col",
")"
] | def SetValue(*args, **kwargs):
"""SetValue(self, wxVariant value, unsigned int row, unsigned int col)"""
return _dataview.DataViewListCtrl_SetValue(*args, **kwargs) | [
"def",
"SetValue",
"(",
"*",
"args",
",",
"*",
"*",
"kwargs",
")",
":",
"return",
"_dataview",
".",
"DataViewListCtrl_SetValue",
"(",
"*",
"args",
",",
"*",
"*",
"kwargs",
")"
] | https://github.com/wxWidgets/wxPython-Classic/blob/19571e1ae65f1ac445f5491474121998c97a1bf0/src/osx_cocoa/dataview.py#L2177-L2179 | |
ros-planning/moveit | ee48dc5cedc981d0869352aa3db0b41469c2735c | moveit_commander/src/moveit_commander/planning_scene_interface.py | python | PlanningSceneInterface.__make_existing | (name) | return co | Create an empty Collision Object. Used when the object already exists | Create an empty Collision Object. Used when the object already exists | [
"Create",
"an",
"empty",
"Collision",
"Object",
".",
"Used",
"when",
"the",
"object",
"already",
"exists"
] | def __make_existing(name):
"""
Create an empty Collision Object. Used when the object already exists
"""
co = CollisionObject()
co.id = name
return co | [
"def",
"__make_existing",
"(",
"name",
")",
":",
"co",
"=",
"CollisionObject",
"(",
")",
"co",
".",
"id",
"=",
"name",
"return",
"co"
] | https://github.com/ros-planning/moveit/blob/ee48dc5cedc981d0869352aa3db0b41469c2735c/moveit_commander/src/moveit_commander/planning_scene_interface.py#L256-L262 | |
aws/lumberyard | f85344403c1c2e77ec8c75deb2c116e97b713217 | dev/Tools/Python/3.7.10/linux_x64/lib/python3.7/inspect.py | python | ismethod | (object) | return isinstance(object, types.MethodType) | Return true if the object is an instance method.
Instance method objects provide these attributes:
__doc__ documentation string
__name__ name with which this method was defined
__func__ function object containing implementation of method
__self__ instanc... | Return true if the object is an instance method. | [
"Return",
"true",
"if",
"the",
"object",
"is",
"an",
"instance",
"method",
"."
] | def ismethod(object):
"""Return true if the object is an instance method.
Instance method objects provide these attributes:
__doc__ documentation string
__name__ name with which this method was defined
__func__ function object containing implementation of method
... | [
"def",
"ismethod",
"(",
"object",
")",
":",
"return",
"isinstance",
"(",
"object",
",",
"types",
".",
"MethodType",
")"
] | https://github.com/aws/lumberyard/blob/f85344403c1c2e77ec8c75deb2c116e97b713217/dev/Tools/Python/3.7.10/linux_x64/lib/python3.7/inspect.py#L80-L88 | |
aws/lumberyard | f85344403c1c2e77ec8c75deb2c116e97b713217 | dev/Gems/CloudGemMetric/v1/AWS/python/windows/Lib/numba/dispatcher.py | python | _DispatcherBase.inspect_llvm | (self, signature=None) | return dict((sig, self.inspect_llvm(sig)) for sig in self.signatures) | Get the LLVM intermediate representation generated by compilation.
Parameters
----------
signature : tuple of numba types, optional
Specify a signature for which to obtain the LLVM IR. If None, the
IR is returned for all available signatures.
Returns
---... | Get the LLVM intermediate representation generated by compilation. | [
"Get",
"the",
"LLVM",
"intermediate",
"representation",
"generated",
"by",
"compilation",
"."
] | def inspect_llvm(self, signature=None):
"""Get the LLVM intermediate representation generated by compilation.
Parameters
----------
signature : tuple of numba types, optional
Specify a signature for which to obtain the LLVM IR. If None, the
IR is returned for all... | [
"def",
"inspect_llvm",
"(",
"self",
",",
"signature",
"=",
"None",
")",
":",
"if",
"signature",
"is",
"not",
"None",
":",
"lib",
"=",
"self",
".",
"overloads",
"[",
"signature",
"]",
".",
"library",
"return",
"lib",
".",
"get_llvm_str",
"(",
")",
"retu... | https://github.com/aws/lumberyard/blob/f85344403c1c2e77ec8c75deb2c116e97b713217/dev/Gems/CloudGemMetric/v1/AWS/python/windows/Lib/numba/dispatcher.py#L422-L442 | |
ceph/ceph | 959663007321a369c83218414a29bd9dbc8bda3a | src/ceph-volume/ceph_volume/devices/lvm/zap.py | python | Zap.zap_lv | (self, device) | Device examples: vg-name/lv-name, /dev/vg-name/lv-name
Requirements: Must be a logical volume (LV) | Device examples: vg-name/lv-name, /dev/vg-name/lv-name
Requirements: Must be a logical volume (LV) | [
"Device",
"examples",
":",
"vg",
"-",
"name",
"/",
"lv",
"-",
"name",
"/",
"dev",
"/",
"vg",
"-",
"name",
"/",
"lv",
"-",
"name",
"Requirements",
":",
"Must",
"be",
"a",
"logical",
"volume",
"(",
"LV",
")"
] | def zap_lv(self, device):
"""
Device examples: vg-name/lv-name, /dev/vg-name/lv-name
Requirements: Must be a logical volume (LV)
"""
lv = api.get_single_lv(filters={'lv_name': device.lv_name, 'vg_name':
device.vg_name})
self.unmount... | [
"def",
"zap_lv",
"(",
"self",
",",
"device",
")",
":",
"lv",
"=",
"api",
".",
"get_single_lv",
"(",
"filters",
"=",
"{",
"'lv_name'",
":",
"device",
".",
"lv_name",
",",
"'vg_name'",
":",
"device",
".",
"vg_name",
"}",
")",
"self",
".",
"unmount_lv",
... | https://github.com/ceph/ceph/blob/959663007321a369c83218414a29bd9dbc8bda3a/src/ceph-volume/ceph_volume/devices/lvm/zap.py#L164-L193 | ||
pybox2d/pybox2d | 09643321fd363f0850087d1bde8af3f4afd82163 | library/Box2D/examples/backends/pyglet_framework.py | python | PygletFramework.Keyboard | (self, key) | Callback indicating 'key' has been pressed down. | Callback indicating 'key' has been pressed down. | [
"Callback",
"indicating",
"key",
"has",
"been",
"pressed",
"down",
"."
] | def Keyboard(self, key):
"""
Callback indicating 'key' has been pressed down.
"""
pass | [
"def",
"Keyboard",
"(",
"self",
",",
"key",
")",
":",
"pass"
] | https://github.com/pybox2d/pybox2d/blob/09643321fd363f0850087d1bde8af3f4afd82163/library/Box2D/examples/backends/pyglet_framework.py#L686-L690 | ||
aws/lumberyard | f85344403c1c2e77ec8c75deb2c116e97b713217 | dev/Tools/Python/3.7.10/windows/Lib/inspect.py | python | getblock | (lines) | return lines[:blockfinder.last] | Extract the block of code at the top of the given list of lines. | Extract the block of code at the top of the given list of lines. | [
"Extract",
"the",
"block",
"of",
"code",
"at",
"the",
"top",
"of",
"the",
"given",
"list",
"of",
"lines",
"."
] | def getblock(lines):
"""Extract the block of code at the top of the given list of lines."""
blockfinder = BlockFinder()
try:
tokens = tokenize.generate_tokens(iter(lines).__next__)
for _token in tokens:
blockfinder.tokeneater(*_token)
except (EndOfBlock, IndentationError):
... | [
"def",
"getblock",
"(",
"lines",
")",
":",
"blockfinder",
"=",
"BlockFinder",
"(",
")",
"try",
":",
"tokens",
"=",
"tokenize",
".",
"generate_tokens",
"(",
"iter",
"(",
"lines",
")",
".",
"__next__",
")",
"for",
"_token",
"in",
"tokens",
":",
"blockfinde... | https://github.com/aws/lumberyard/blob/f85344403c1c2e77ec8c75deb2c116e97b713217/dev/Tools/Python/3.7.10/windows/Lib/inspect.py#L935-L944 | |
wxWidgets/wxPython-Classic | 19571e1ae65f1ac445f5491474121998c97a1bf0 | src/msw/xrc.py | python | XmlNode.DeleteProperty | (*args, **kwargs) | return _xrc.XmlNode_DeleteProperty(*args, **kwargs) | DeleteProperty(self, String name) -> bool | DeleteProperty(self, String name) -> bool | [
"DeleteProperty",
"(",
"self",
"String",
"name",
")",
"-",
">",
"bool"
] | def DeleteProperty(*args, **kwargs):
"""DeleteProperty(self, String name) -> bool"""
return _xrc.XmlNode_DeleteProperty(*args, **kwargs) | [
"def",
"DeleteProperty",
"(",
"*",
"args",
",",
"*",
"*",
"kwargs",
")",
":",
"return",
"_xrc",
".",
"XmlNode_DeleteProperty",
"(",
"*",
"args",
",",
"*",
"*",
"kwargs",
")"
] | https://github.com/wxWidgets/wxPython-Classic/blob/19571e1ae65f1ac445f5491474121998c97a1bf0/src/msw/xrc.py#L382-L384 | |
greatscottgadgets/gr-bluetooth | c2a7d7d810e047f8a18902a4e3d1a152420655bb | docs/doxygen/swig_doc.py | python | make_block_entry | (di, block) | return "\n\n".join(output) | Create class and function docstrings of a gnuradio block for a
swig interface file. | Create class and function docstrings of a gnuradio block for a
swig interface file. | [
"Create",
"class",
"and",
"function",
"docstrings",
"of",
"a",
"gnuradio",
"block",
"for",
"a",
"swig",
"interface",
"file",
"."
] | def make_block_entry(di, block):
"""
Create class and function docstrings of a gnuradio block for a
swig interface file.
"""
descriptions = []
# Get the documentation associated with the class.
class_desc = combine_descriptions(block)
if class_desc:
descriptions.append(class_desc... | [
"def",
"make_block_entry",
"(",
"di",
",",
"block",
")",
":",
"descriptions",
"=",
"[",
"]",
"# Get the documentation associated with the class.",
"class_desc",
"=",
"combine_descriptions",
"(",
"block",
")",
"if",
"class_desc",
":",
"descriptions",
".",
"append",
"... | https://github.com/greatscottgadgets/gr-bluetooth/blob/c2a7d7d810e047f8a18902a4e3d1a152420655bb/docs/doxygen/swig_doc.py#L148-L181 | |
hanpfei/chromium-net | 392cc1fa3a8f92f42e4071ab6e674d8e0482f83f | third_party/catapult/third_party/gsutil/third_party/rsa/rsa/_version200.py | python | are_relatively_prime | (a, b) | return (d == 1) | Returns True if a and b are relatively prime, and False if they
are not.
>>> are_relatively_prime(2, 3)
1
>>> are_relatively_prime(2, 4)
0 | Returns True if a and b are relatively prime, and False if they
are not. | [
"Returns",
"True",
"if",
"a",
"and",
"b",
"are",
"relatively",
"prime",
"and",
"False",
"if",
"they",
"are",
"not",
"."
] | def are_relatively_prime(a, b):
"""Returns True if a and b are relatively prime, and False if they
are not.
>>> are_relatively_prime(2, 3)
1
>>> are_relatively_prime(2, 4)
0
"""
d = gcd(a, b)
return (d == 1) | [
"def",
"are_relatively_prime",
"(",
"a",
",",
"b",
")",
":",
"d",
"=",
"gcd",
"(",
"a",
",",
"b",
")",
"return",
"(",
"d",
"==",
"1",
")"
] | https://github.com/hanpfei/chromium-net/blob/392cc1fa3a8f92f42e4071ab6e674d8e0482f83f/third_party/catapult/third_party/gsutil/third_party/rsa/rsa/_version200.py#L298-L309 | |
pmq20/node-packer | 12c46c6e44fbc14d9ee645ebd17d5296b324f7e0 | lts/deps/npm/node_modules/node-gyp/gyp/pylib/gyp/msvs_emulation.py | python | PrecompiledHeader._PchHeader | (self) | return os.path.split(self.settings.msvs_precompiled_header[self.config])[1] | Get the header that will appear in an #include line for all source
files. | Get the header that will appear in an #include line for all source
files. | [
"Get",
"the",
"header",
"that",
"will",
"appear",
"in",
"an",
"#include",
"line",
"for",
"all",
"source",
"files",
"."
] | def _PchHeader(self):
"""Get the header that will appear in an #include line for all source
files."""
return os.path.split(self.settings.msvs_precompiled_header[self.config])[1] | [
"def",
"_PchHeader",
"(",
"self",
")",
":",
"return",
"os",
".",
"path",
".",
"split",
"(",
"self",
".",
"settings",
".",
"msvs_precompiled_header",
"[",
"self",
".",
"config",
"]",
")",
"[",
"1",
"]"
] | https://github.com/pmq20/node-packer/blob/12c46c6e44fbc14d9ee645ebd17d5296b324f7e0/lts/deps/npm/node_modules/node-gyp/gyp/pylib/gyp/msvs_emulation.py#L901-L904 | |
Xilinx/Vitis-AI | fc74d404563d9951b57245443c73bef389f3657f | tools/Vitis-AI-Quantizer/vai_q_tensorflow1.x/tensorflow/python/keras/backend.py | python | elu | (x, alpha=1.) | Exponential linear unit.
Arguments:
x: A tensor or variable to compute the activation function for.
alpha: A scalar, slope of negative section.
Returns:
A tensor. | Exponential linear unit. | [
"Exponential",
"linear",
"unit",
"."
] | def elu(x, alpha=1.):
"""Exponential linear unit.
Arguments:
x: A tensor or variable to compute the activation function for.
alpha: A scalar, slope of negative section.
Returns:
A tensor.
"""
res = nn.elu(x)
if alpha == 1:
return res
else:
return array_ops.where(x > 0, res, alp... | [
"def",
"elu",
"(",
"x",
",",
"alpha",
"=",
"1.",
")",
":",
"res",
"=",
"nn",
".",
"elu",
"(",
"x",
")",
"if",
"alpha",
"==",
"1",
":",
"return",
"res",
"else",
":",
"return",
"array_ops",
".",
"where",
"(",
"x",
">",
"0",
",",
"res",
",",
"... | https://github.com/Xilinx/Vitis-AI/blob/fc74d404563d9951b57245443c73bef389f3657f/tools/Vitis-AI-Quantizer/vai_q_tensorflow1.x/tensorflow/python/keras/backend.py#L4263-L4277 | ||
aws/lumberyard | f85344403c1c2e77ec8c75deb2c116e97b713217 | dev/Tools/Python/3.7.10/linux_x64/lib/python3.7/idlelib/hyperparser.py | python | HyperParser.get_expression | (self) | return rawtext[last_identifier_pos:self.indexinrawtext] | Return a string with the Python expression which ends at the
given index, which is empty if there is no real one. | Return a string with the Python expression which ends at the
given index, which is empty if there is no real one. | [
"Return",
"a",
"string",
"with",
"the",
"Python",
"expression",
"which",
"ends",
"at",
"the",
"given",
"index",
"which",
"is",
"empty",
"if",
"there",
"is",
"no",
"real",
"one",
"."
] | def get_expression(self):
"""Return a string with the Python expression which ends at the
given index, which is empty if there is no real one.
"""
if not self.is_in_code():
raise ValueError("get_expression should only be called "
"if index is insi... | [
"def",
"get_expression",
"(",
"self",
")",
":",
"if",
"not",
"self",
".",
"is_in_code",
"(",
")",
":",
"raise",
"ValueError",
"(",
"\"get_expression should only be called \"",
"\"if index is inside a code.\"",
")",
"rawtext",
"=",
"self",
".",
"rawtext",
"bracketing... | https://github.com/aws/lumberyard/blob/f85344403c1c2e77ec8c75deb2c116e97b713217/dev/Tools/Python/3.7.10/linux_x64/lib/python3.7/idlelib/hyperparser.py#L222-L307 | |
aws/lumberyard | f85344403c1c2e77ec8c75deb2c116e97b713217 | dev/Tools/Python/3.7.10/windows/Lib/site-packages/setuptools/dist.py | python | Distribution.get_command_class | (self, command) | Pluggable version of get_command_class() | Pluggable version of get_command_class() | [
"Pluggable",
"version",
"of",
"get_command_class",
"()"
] | def get_command_class(self, command):
"""Pluggable version of get_command_class()"""
if command in self.cmdclass:
return self.cmdclass[command]
eps = pkg_resources.iter_entry_points('distutils.commands', command)
for ep in eps:
ep.require(installer=self.fetch_bui... | [
"def",
"get_command_class",
"(",
"self",
",",
"command",
")",
":",
"if",
"command",
"in",
"self",
".",
"cmdclass",
":",
"return",
"self",
".",
"cmdclass",
"[",
"command",
"]",
"eps",
"=",
"pkg_resources",
".",
"iter_entry_points",
"(",
"'distutils.commands'",
... | https://github.com/aws/lumberyard/blob/f85344403c1c2e77ec8c75deb2c116e97b713217/dev/Tools/Python/3.7.10/windows/Lib/site-packages/setuptools/dist.py#L756-L767 | ||
CMU-Perceptual-Computing-Lab/caffe_rtpose | a4778bb1c3eb74d7250402016047216f77b4dba6 | scripts/cpp_lint.py | python | CheckLanguage | (filename, clean_lines, linenum, file_extension,
include_state, nesting_state, error) | Checks rules from the 'C++ language rules' section of cppguide.html.
Some of these rules are hard to test (function overloading, using
uint32 inappropriately), but we do the best we can.
Args:
filename: The name of the current file.
clean_lines: A CleansedLines instance containing the file.
linenum:... | Checks rules from the 'C++ language rules' section of cppguide.html. | [
"Checks",
"rules",
"from",
"the",
"C",
"++",
"language",
"rules",
"section",
"of",
"cppguide",
".",
"html",
"."
] | def CheckLanguage(filename, clean_lines, linenum, file_extension,
include_state, nesting_state, error):
"""Checks rules from the 'C++ language rules' section of cppguide.html.
Some of these rules are hard to test (function overloading, using
uint32 inappropriately), but we do the best we can.
... | [
"def",
"CheckLanguage",
"(",
"filename",
",",
"clean_lines",
",",
"linenum",
",",
"file_extension",
",",
"include_state",
",",
"nesting_state",
",",
"error",
")",
":",
"# If the line is empty or consists of entirely a comment, no need to",
"# check it.",
"line",
"=",
"cle... | https://github.com/CMU-Perceptual-Computing-Lab/caffe_rtpose/blob/a4778bb1c3eb74d7250402016047216f77b4dba6/scripts/cpp_lint.py#L3834-L4132 | ||
Xilinx/Vitis-AI | fc74d404563d9951b57245443c73bef389f3657f | tools/Vitis-AI-Quantizer/vai_q_tensorflow1.x/tensorflow/contrib/constrained_optimization/python/swap_regret_optimizer.py | python | _project_log_stochastic_matrix_wrt_kl_divergence | (log_matrix) | return log_matrix | Projects its argument onto the set of log-left-stochastic matrices.
Args:
log_matrix: 2d square tensor, the element-wise logarithm of the matrix to
project.
Returns:
The 2d square tensor that results from projecting exp(`matrix`) onto the set
of left-stochastic matrices w.r.t. the KL-divergenc... | Projects its argument onto the set of log-left-stochastic matrices. | [
"Projects",
"its",
"argument",
"onto",
"the",
"set",
"of",
"log",
"-",
"left",
"-",
"stochastic",
"matrices",
"."
] | def _project_log_stochastic_matrix_wrt_kl_divergence(log_matrix):
"""Projects its argument onto the set of log-left-stochastic matrices.
Args:
log_matrix: 2d square tensor, the element-wise logarithm of the matrix to
project.
Returns:
The 2d square tensor that results from projecting exp(`matrix`)... | [
"def",
"_project_log_stochastic_matrix_wrt_kl_divergence",
"(",
"log_matrix",
")",
":",
"# For numerical reasons, make sure that the largest matrix element is zero",
"# before exponentiating.",
"log_matrix",
"=",
"log_matrix",
"-",
"standard_ops",
".",
"reduce_max",
"(",
"log_matrix"... | https://github.com/Xilinx/Vitis-AI/blob/fc74d404563d9951b57245443c73bef389f3657f/tools/Vitis-AI-Quantizer/vai_q_tensorflow1.x/tensorflow/contrib/constrained_optimization/python/swap_regret_optimizer.py#L198-L217 | |
generalized-intelligence/GAAS | 29ab17d3e8a4ba18edef3a57c36d8db6329fac73 | algorithms/src/SystemManagement/json_request_response_lib/src/third_party/nlohmann_json/third_party/cpplint/cpplint.py | python | _DropCommonSuffixes | (filename) | return os.path.splitext(filename)[0] | Drops common suffixes like _test.cc or -inl.h from filename.
For example:
>>> _DropCommonSuffixes('foo/foo-inl.h')
'foo/foo'
>>> _DropCommonSuffixes('foo/bar/foo.cc')
'foo/bar/foo'
>>> _DropCommonSuffixes('foo/foo_internal.h')
'foo/foo'
>>> _DropCommonSuffixes('foo/foo_unusualinternal.h')... | Drops common suffixes like _test.cc or -inl.h from filename. | [
"Drops",
"common",
"suffixes",
"like",
"_test",
".",
"cc",
"or",
"-",
"inl",
".",
"h",
"from",
"filename",
"."
] | def _DropCommonSuffixes(filename):
"""Drops common suffixes like _test.cc or -inl.h from filename.
For example:
>>> _DropCommonSuffixes('foo/foo-inl.h')
'foo/foo'
>>> _DropCommonSuffixes('foo/bar/foo.cc')
'foo/bar/foo'
>>> _DropCommonSuffixes('foo/foo_internal.h')
'foo/foo'
>>> _DropCom... | [
"def",
"_DropCommonSuffixes",
"(",
"filename",
")",
":",
"for",
"suffix",
"in",
"itertools",
".",
"chain",
"(",
"(",
"'%s.%s'",
"%",
"(",
"test_suffix",
".",
"lstrip",
"(",
"'_'",
")",
",",
"ext",
")",
"for",
"test_suffix",
",",
"ext",
"in",
"itertools",... | https://github.com/generalized-intelligence/GAAS/blob/29ab17d3e8a4ba18edef3a57c36d8db6329fac73/algorithms/src/SystemManagement/json_request_response_lib/src/third_party/nlohmann_json/third_party/cpplint/cpplint.py#L4672-L4699 | |
benoitsteiner/tensorflow-opencl | cb7cb40a57fde5cfd4731bc551e82a1e2fef43a5 | tensorflow/python/training/sync_replicas_optimizer.py | python | SyncReplicasOptimizer.get_slot | (self, *args, **kwargs) | return self._opt.get_slot(*args, **kwargs) | Return a slot named "name" created for "var" by the Optimizer.
This simply wraps the get_slot() from the actual optimizer.
Args:
*args: Arguments for get_slot().
**kwargs: Keyword arguments for get_slot().
Returns:
The `Variable` for the slot if it was created, `None` otherwise. | Return a slot named "name" created for "var" by the Optimizer. | [
"Return",
"a",
"slot",
"named",
"name",
"created",
"for",
"var",
"by",
"the",
"Optimizer",
"."
] | def get_slot(self, *args, **kwargs):
"""Return a slot named "name" created for "var" by the Optimizer.
This simply wraps the get_slot() from the actual optimizer.
Args:
*args: Arguments for get_slot().
**kwargs: Keyword arguments for get_slot().
Returns:
The `Variable` for the slot ... | [
"def",
"get_slot",
"(",
"self",
",",
"*",
"args",
",",
"*",
"*",
"kwargs",
")",
":",
"return",
"self",
".",
"_opt",
".",
"get_slot",
"(",
"*",
"args",
",",
"*",
"*",
"kwargs",
")"
] | https://github.com/benoitsteiner/tensorflow-opencl/blob/cb7cb40a57fde5cfd4731bc551e82a1e2fef43a5/tensorflow/python/training/sync_replicas_optimizer.py#L363-L375 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.