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 |
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
apache/parquet-cpp | 642da055adf009652689b20e68a198cffb857651 | build-support/cpplint.py | python | _VerboseLevel | () | return _cpplint_state.verbose_level | Returns the module's verbosity setting. | Returns the module's verbosity setting. | [
"Returns",
"the",
"module",
"s",
"verbosity",
"setting",
"."
] | def _VerboseLevel():
"""Returns the module's verbosity setting."""
return _cpplint_state.verbose_level | [
"def",
"_VerboseLevel",
"(",
")",
":",
"return",
"_cpplint_state",
".",
"verbose_level"
] | https://github.com/apache/parquet-cpp/blob/642da055adf009652689b20e68a198cffb857651/build-support/cpplint.py#L861-L863 | |
ros-perception/image_pipeline | cd4aa7ab38726d88e8e0144aa0d45ad2f236535a | camera_calibration/src/camera_calibration/calibrator.py | python | MonoCalibrator.cal | (self, images) | Calibrate camera from given images | Calibrate camera from given images | [
"Calibrate",
"camera",
"from",
"given",
"images"
] | def cal(self, images):
"""
Calibrate camera from given images
"""
goodcorners = self.collect_corners(images)
self.cal_fromcorners(goodcorners)
self.calibrated = True | [
"def",
"cal",
"(",
"self",
",",
"images",
")",
":",
"goodcorners",
"=",
"self",
".",
"collect_corners",
"(",
"images",
")",
"self",
".",
"cal_fromcorners",
"(",
"goodcorners",
")",
"self",
".",
"calibrated",
"=",
"True"
] | https://github.com/ros-perception/image_pipeline/blob/cd4aa7ab38726d88e8e0144aa0d45ad2f236535a/camera_calibration/src/camera_calibration/calibrator.py#L727-L733 | ||
idaholab/moose | 9eeebc65e098b4c30f8205fb41591fd5b61eb6ff | python/peacock/ExodusViewer/plugins/ColorbarPlugin.py | python | ColorbarPlugin.updateColorbarOptions | (self) | Add/remove the colorbar object. | Add/remove the colorbar object. | [
"Add",
"/",
"remove",
"the",
"colorbar",
"object",
"."
] | def updateColorbarOptions(self):
"""
Add/remove the colorbar object.
"""
if (self._window is None) or (self._result is None):
return
visible = self.ColorBarToggle.isChecked()
if visible:
if self._colorbar is None:
self._colorbar = ... | [
"def",
"updateColorbarOptions",
"(",
"self",
")",
":",
"if",
"(",
"self",
".",
"_window",
"is",
"None",
")",
"or",
"(",
"self",
".",
"_result",
"is",
"None",
")",
":",
"return",
"visible",
"=",
"self",
".",
"ColorBarToggle",
".",
"isChecked",
"(",
")",... | https://github.com/idaholab/moose/blob/9eeebc65e098b4c30f8205fb41591fd5b61eb6ff/python/peacock/ExodusViewer/plugins/ColorbarPlugin.py#L206-L224 | ||
wxWidgets/wxPython-Classic | 19571e1ae65f1ac445f5491474121998c97a1bf0 | src/osx_cocoa/_controls.py | python | ListCtrl.DeleteAllItems | (*args, **kwargs) | return _controls_.ListCtrl_DeleteAllItems(*args, **kwargs) | DeleteAllItems(self) -> bool | DeleteAllItems(self) -> bool | [
"DeleteAllItems",
"(",
"self",
")",
"-",
">",
"bool"
] | def DeleteAllItems(*args, **kwargs):
"""DeleteAllItems(self) -> bool"""
return _controls_.ListCtrl_DeleteAllItems(*args, **kwargs) | [
"def",
"DeleteAllItems",
"(",
"*",
"args",
",",
"*",
"*",
"kwargs",
")",
":",
"return",
"_controls_",
".",
"ListCtrl_DeleteAllItems",
"(",
"*",
"args",
",",
"*",
"*",
"kwargs",
")"
] | https://github.com/wxWidgets/wxPython-Classic/blob/19571e1ae65f1ac445f5491474121998c97a1bf0/src/osx_cocoa/_controls.py#L4645-L4647 | |
oracle/graaljs | 36a56e8e993d45fc40939a3a4d9c0c24990720f1 | graal-nodejs/deps/v8/third_party/jinja2/runtime.py | python | Context.super | (self, name, current) | return BlockReference(name, self, blocks, index) | Render a parent block. | Render a parent block. | [
"Render",
"a",
"parent",
"block",
"."
] | def super(self, name, current):
"""Render a parent block."""
try:
blocks = self.blocks[name]
index = blocks.index(current) + 1
blocks[index]
except LookupError:
return self.environment.undefined('there is no parent block '
... | [
"def",
"super",
"(",
"self",
",",
"name",
",",
"current",
")",
":",
"try",
":",
"blocks",
"=",
"self",
".",
"blocks",
"[",
"name",
"]",
"index",
"=",
"blocks",
".",
"index",
"(",
"current",
")",
"+",
"1",
"blocks",
"[",
"index",
"]",
"except",
"L... | https://github.com/oracle/graaljs/blob/36a56e8e993d45fc40939a3a4d9c0c24990720f1/graal-nodejs/deps/v8/third_party/jinja2/runtime.py#L175-L185 | |
baidu-research/tensorflow-allreduce | 66d5b855e90b0949e9fa5cca5599fd729a70e874 | tensorflow/contrib/keras/python/keras/backend.py | python | pow | (x, a) | return math_ops.pow(x, a) | Element-wise exponentiation.
Arguments:
x: Tensor or variable.
a: Python integer.
Returns:
A tensor. | Element-wise exponentiation. | [
"Element",
"-",
"wise",
"exponentiation",
"."
] | def pow(x, a):
"""Element-wise exponentiation.
Arguments:
x: Tensor or variable.
a: Python integer.
Returns:
A tensor.
"""
return math_ops.pow(x, a) | [
"def",
"pow",
"(",
"x",
",",
"a",
")",
":",
"return",
"math_ops",
".",
"pow",
"(",
"x",
",",
"a",
")"
] | https://github.com/baidu-research/tensorflow-allreduce/blob/66d5b855e90b0949e9fa5cca5599fd729a70e874/tensorflow/contrib/keras/python/keras/backend.py#L1632-L1642 | |
kamyu104/LeetCode-Solutions | 77605708a927ea3b85aee5a479db733938c7c211 | Python/sum-of-digits-in-base-k.py | python | Solution.sumBase | (self, n, k) | return result | :type n: int
:type k: int
:rtype: int | :type n: int
:type k: int
:rtype: int | [
":",
"type",
"n",
":",
"int",
":",
"type",
"k",
":",
"int",
":",
"rtype",
":",
"int"
] | def sumBase(self, n, k):
"""
:type n: int
:type k: int
:rtype: int
"""
result = 0
while n:
n, r = divmod(n, k)
result += r
return result | [
"def",
"sumBase",
"(",
"self",
",",
"n",
",",
"k",
")",
":",
"result",
"=",
"0",
"while",
"n",
":",
"n",
",",
"r",
"=",
"divmod",
"(",
"n",
",",
"k",
")",
"result",
"+=",
"r",
"return",
"result"
] | https://github.com/kamyu104/LeetCode-Solutions/blob/77605708a927ea3b85aee5a479db733938c7c211/Python/sum-of-digits-in-base-k.py#L5-L15 | |
KratosMultiphysics/Kratos | 0000833054ed0503424eb28205d6508d9ca6cbbc | applications/ShallowWaterApplication/python_scripts/postprocess/line_graph_output_process.py | python | LineGraphOutputProcess.IsOutputStep | (self) | return self.interval.IsInInterval(time) and self.output_control.IsOutputStep() | Return if the current step is an output step. | Return if the current step is an output step. | [
"Return",
"if",
"the",
"current",
"step",
"is",
"an",
"output",
"step",
"."
] | def IsOutputStep(self):
"""Return if the current step is an output step."""
time = self.model_part.ProcessInfo[KM.TIME]
return self.interval.IsInInterval(time) and self.output_control.IsOutputStep() | [
"def",
"IsOutputStep",
"(",
"self",
")",
":",
"time",
"=",
"self",
".",
"model_part",
".",
"ProcessInfo",
"[",
"KM",
".",
"TIME",
"]",
"return",
"self",
".",
"interval",
".",
"IsInInterval",
"(",
"time",
")",
"and",
"self",
".",
"output_control",
".",
... | https://github.com/KratosMultiphysics/Kratos/blob/0000833054ed0503424eb28205d6508d9ca6cbbc/applications/ShallowWaterApplication/python_scripts/postprocess/line_graph_output_process.py#L122-L126 | |
niwinz/phantompy | ae25ddb6791e13cb7c35126971c410030ee5dfda | phantompy/context.py | python | Context.set_headers | (self, headers) | Set a list of headers. | Set a list of headers. | [
"Set",
"a",
"list",
"of",
"headers",
"."
] | def set_headers(self, headers):
"""
Set a list of headers.
"""
lib.ph_context_set_headers(util.force_bytes(json.dumps(headers))) | [
"def",
"set_headers",
"(",
"self",
",",
"headers",
")",
":",
"lib",
".",
"ph_context_set_headers",
"(",
"util",
".",
"force_bytes",
"(",
"json",
".",
"dumps",
"(",
"headers",
")",
")",
")"
] | https://github.com/niwinz/phantompy/blob/ae25ddb6791e13cb7c35126971c410030ee5dfda/phantompy/context.py#L92-L96 | ||
papyrussolution/OpenPapyrus | bbfb5ec2ea2109b8e2f125edd838e12eaf7b8b91 | Src/OSF/xapian/xapian-maintainer-tools/buildbot/scripts/get_tarballs.py | python | get_archive_links | (url, archives) | return links | Get the links to the archive files. | Get the links to the archive files. | [
"Get",
"the",
"links",
"to",
"the",
"archive",
"files",
"."
] | def get_archive_links(url, archives):
"""Get the links to the archive files.
"""
print("Getting links from '%s'" % url)
fd = u.urlopen(url)
html = fd.read()
fd.close()
max_revision, links = parsehtml(html, archives)
return links | [
"def",
"get_archive_links",
"(",
"url",
",",
"archives",
")",
":",
"print",
"(",
"\"Getting links from '%s'\"",
"%",
"url",
")",
"fd",
"=",
"u",
".",
"urlopen",
"(",
"url",
")",
"html",
"=",
"fd",
".",
"read",
"(",
")",
"fd",
".",
"close",
"(",
")",
... | https://github.com/papyrussolution/OpenPapyrus/blob/bbfb5ec2ea2109b8e2f125edd838e12eaf7b8b91/Src/OSF/xapian/xapian-maintainer-tools/buildbot/scripts/get_tarballs.py#L63-L72 | |
kamyu104/LeetCode-Solutions | 77605708a927ea3b85aee5a479db733938c7c211 | Python/find-duplicate-subtrees.py | python | Solution.findDuplicateSubtrees | (self, root) | return [roots[0] for roots in trees.itervalues() if len(roots) > 1] | :type root: TreeNode
:rtype: List[TreeNode] | :type root: TreeNode
:rtype: List[TreeNode] | [
":",
"type",
"root",
":",
"TreeNode",
":",
"rtype",
":",
"List",
"[",
"TreeNode",
"]"
] | def findDuplicateSubtrees(self, root):
"""
:type root: TreeNode
:rtype: List[TreeNode]
"""
def getid(root, lookup, trees):
if not root:
return -1
node_id = lookup[root.val,
getid(root.left, lookup, trees),
... | [
"def",
"findDuplicateSubtrees",
"(",
"self",
",",
"root",
")",
":",
"def",
"getid",
"(",
"root",
",",
"lookup",
",",
"trees",
")",
":",
"if",
"not",
"root",
":",
"return",
"-",
"1",
"node_id",
"=",
"lookup",
"[",
"root",
".",
"val",
",",
"getid",
"... | https://github.com/kamyu104/LeetCode-Solutions/blob/77605708a927ea3b85aee5a479db733938c7c211/Python/find-duplicate-subtrees.py#L8-L26 | |
mantidproject/mantid | 03deeb89254ec4289edb8771e0188c2090a02f32 | qt/applications/workbench/workbench/config/user.py | python | UserConfig.set | (self, option, value, extra=None) | Set a value for an option in a given section. Can either supply
the fully qualified option or add the section as an additional
first argument. ``config.set('main', 'high_dpi_scaling',
True)`` is equivalent to ``config.set('main/high_dpi_scaling',
True)`` | Set a value for an option in a given section. Can either supply
the fully qualified option or add the section as an additional
first argument. ``config.set('main', 'high_dpi_scaling',
True)`` is equivalent to ``config.set('main/high_dpi_scaling',
True)`` | [
"Set",
"a",
"value",
"for",
"an",
"option",
"in",
"a",
"given",
"section",
".",
"Can",
"either",
"supply",
"the",
"fully",
"qualified",
"option",
"or",
"add",
"the",
"section",
"as",
"an",
"additional",
"first",
"argument",
".",
"config",
".",
"set",
"("... | def set(self, option, value, extra=None):
"""Set a value for an option in a given section. Can either supply
the fully qualified option or add the section as an additional
first argument. ``config.set('main', 'high_dpi_scaling',
True)`` is equivalent to ``config.set('main/high_dpi_scalin... | [
"def",
"set",
"(",
"self",
",",
"option",
",",
"value",
",",
"extra",
"=",
"None",
")",
":",
"if",
"extra",
"is",
"None",
":",
"option",
"=",
"self",
".",
"_check_section_option_is_valid",
"(",
"option",
",",
"extra",
")",
"# value is in the right place",
... | https://github.com/mantidproject/mantid/blob/03deeb89254ec4289edb8771e0188c2090a02f32/qt/applications/workbench/workbench/config/user.py#L113-L126 | ||
benoitsteiner/tensorflow-opencl | cb7cb40a57fde5cfd4731bc551e82a1e2fef43a5 | tensorflow/contrib/distributions/python/ops/wishart.py | python | _WishartLinearOperator._multi_lgamma | (self, a, p, name="multi_lgamma") | Computes the log multivariate gamma function; log(Gamma_p(a)). | Computes the log multivariate gamma function; log(Gamma_p(a)). | [
"Computes",
"the",
"log",
"multivariate",
"gamma",
"function",
";",
"log",
"(",
"Gamma_p",
"(",
"a",
"))",
"."
] | def _multi_lgamma(self, a, p, name="multi_lgamma"):
"""Computes the log multivariate gamma function; log(Gamma_p(a))."""
with self._name_scope(name, values=[a, p]):
seq = self._multi_gamma_sequence(a, p)
return (0.25 * p * (p - 1.) * math.log(math.pi) +
math_ops.reduce_sum(math_ops.lga... | [
"def",
"_multi_lgamma",
"(",
"self",
",",
"a",
",",
"p",
",",
"name",
"=",
"\"multi_lgamma\"",
")",
":",
"with",
"self",
".",
"_name_scope",
"(",
"name",
",",
"values",
"=",
"[",
"a",
",",
"p",
"]",
")",
":",
"seq",
"=",
"self",
".",
"_multi_gamma_... | https://github.com/benoitsteiner/tensorflow-opencl/blob/cb7cb40a57fde5cfd4731bc551e82a1e2fef43a5/tensorflow/contrib/distributions/python/ops/wishart.py#L423-L429 | ||
catboost/catboost | 167f64f237114a4d10b2b4ee42adb4569137debe | contrib/python/Jinja2/py2/jinja2/environment.py | python | get_spontaneous_environment | (cls, *args) | Return a new spontaneous environment. A spontaneous environment
is used for templates created directly rather than through an
existing environment.
:param cls: Environment class to create.
:param args: Positional arguments passed to environment. | Return a new spontaneous environment. A spontaneous environment
is used for templates created directly rather than through an
existing environment. | [
"Return",
"a",
"new",
"spontaneous",
"environment",
".",
"A",
"spontaneous",
"environment",
"is",
"used",
"for",
"templates",
"created",
"directly",
"rather",
"than",
"through",
"an",
"existing",
"environment",
"."
] | def get_spontaneous_environment(cls, *args):
"""Return a new spontaneous environment. A spontaneous environment
is used for templates created directly rather than through an
existing environment.
:param cls: Environment class to create.
:param args: Positional arguments passed to environment.
"... | [
"def",
"get_spontaneous_environment",
"(",
"cls",
",",
"*",
"args",
")",
":",
"key",
"=",
"(",
"cls",
",",
"args",
")",
"try",
":",
"return",
"_spontaneous_environments",
"[",
"key",
"]",
"except",
"KeyError",
":",
"_spontaneous_environments",
"[",
"key",
"]... | https://github.com/catboost/catboost/blob/167f64f237114a4d10b2b4ee42adb4569137debe/contrib/python/Jinja2/py2/jinja2/environment.py#L65-L80 | ||
ChromiumWebApps/chromium | c7361d39be8abd1574e6ce8957c8dbddd4c6ccf7 | third_party/jinja2/environment.py | python | Environment._generate | (self, source, name, filename, defer_init=False) | return generate(source, self, name, filename, defer_init=defer_init) | Internal hook that can be overridden to hook a different generate
method in.
.. versionadded:: 2.5 | Internal hook that can be overridden to hook a different generate
method in. | [
"Internal",
"hook",
"that",
"can",
"be",
"overridden",
"to",
"hook",
"a",
"different",
"generate",
"method",
"in",
"."
] | def _generate(self, source, name, filename, defer_init=False):
"""Internal hook that can be overridden to hook a different generate
method in.
.. versionadded:: 2.5
"""
return generate(source, self, name, filename, defer_init=defer_init) | [
"def",
"_generate",
"(",
"self",
",",
"source",
",",
"name",
",",
"filename",
",",
"defer_init",
"=",
"False",
")",
":",
"return",
"generate",
"(",
"source",
",",
"self",
",",
"name",
",",
"filename",
",",
"defer_init",
"=",
"defer_init",
")"
] | https://github.com/ChromiumWebApps/chromium/blob/c7361d39be8abd1574e6ce8957c8dbddd4c6ccf7/third_party/jinja2/environment.py#L498-L504 | |
kushview/Element | 1cc16380caa2ab79461246ba758b9de1f46db2a5 | waflib/Build.py | python | BuildContext.add_post_fun | (self, meth) | Binds a callback method to execute immediately after the build is successful::
def call_ldconfig(bld):
bld.exec_command('/sbin/ldconfig')
def build(bld):
if bld.cmd == 'install':
bld.add_pre_fun(call_ldconfig) | Binds a callback method to execute immediately after the build is successful:: | [
"Binds",
"a",
"callback",
"method",
"to",
"execute",
"immediately",
"after",
"the",
"build",
"is",
"successful",
"::"
] | def add_post_fun(self, meth):
"""
Binds a callback method to execute immediately after the build is successful::
def call_ldconfig(bld):
bld.exec_command('/sbin/ldconfig')
def build(bld):
if bld.cmd == 'install':
bld.add_pre_fun(call_ldconfig)
"""
try:
self.post_funs.append(meth)
excep... | [
"def",
"add_post_fun",
"(",
"self",
",",
"meth",
")",
":",
"try",
":",
"self",
".",
"post_funs",
".",
"append",
"(",
"meth",
")",
"except",
"AttributeError",
":",
"self",
".",
"post_funs",
"=",
"[",
"meth",
"]"
] | https://github.com/kushview/Element/blob/1cc16380caa2ab79461246ba758b9de1f46db2a5/waflib/Build.py#L564-L578 | ||
hfinkel/llvm-project-cxxjit | 91084ef018240bbb8e24235ff5cd8c355a9c1a1e | compiler-rt/lib/sanitizer_common/scripts/cpplint.py | python | GetHeaderGuardCPPVariable | (filename) | return re.sub(r'[-./\s]', '_', file_path_from_root).upper() + '_' | Returns the CPP variable that should be used as a header guard.
Args:
filename: The name of a C++ header file.
Returns:
The CPP variable that should be used as a header guard in the
named file. | Returns the CPP variable that should be used as a header guard. | [
"Returns",
"the",
"CPP",
"variable",
"that",
"should",
"be",
"used",
"as",
"a",
"header",
"guard",
"."
] | def GetHeaderGuardCPPVariable(filename):
"""Returns the CPP variable that should be used as a header guard.
Args:
filename: The name of a C++ header file.
Returns:
The CPP variable that should be used as a header guard in the
named file.
"""
# Restores original filename in case that cpplint is... | [
"def",
"GetHeaderGuardCPPVariable",
"(",
"filename",
")",
":",
"# Restores original filename in case that cpplint is invoked from Emacs's",
"# flymake.",
"filename",
"=",
"re",
".",
"sub",
"(",
"r'_flymake\\.h$'",
",",
"'.h'",
",",
"filename",
")",
"filename",
"=",
"re",
... | https://github.com/hfinkel/llvm-project-cxxjit/blob/91084ef018240bbb8e24235ff5cd8c355a9c1a1e/compiler-rt/lib/sanitizer_common/scripts/cpplint.py#L1111-L1132 | |
catboost/catboost | 167f64f237114a4d10b2b4ee42adb4569137debe | contrib/tools/python3/src/Lib/functools.py | python | _ge_from_lt | (self, other, NotImplemented=NotImplemented) | return not op_result | Return a >= b. Computed by @total_ordering from (not a < b). | Return a >= b. Computed by | [
"Return",
"a",
">",
"=",
"b",
".",
"Computed",
"by"
] | def _ge_from_lt(self, other, NotImplemented=NotImplemented):
'Return a >= b. Computed by @total_ordering from (not a < b).'
op_result = type(self).__lt__(self, other)
if op_result is NotImplemented:
return op_result
return not op_result | [
"def",
"_ge_from_lt",
"(",
"self",
",",
"other",
",",
"NotImplemented",
"=",
"NotImplemented",
")",
":",
"op_result",
"=",
"type",
"(",
"self",
")",
".",
"__lt__",
"(",
"self",
",",
"other",
")",
"if",
"op_result",
"is",
"NotImplemented",
":",
"return",
... | https://github.com/catboost/catboost/blob/167f64f237114a4d10b2b4ee42adb4569137debe/contrib/tools/python3/src/Lib/functools.py#L103-L108 | |
idaholab/moose | 9eeebc65e098b4c30f8205fb41591fd5b61eb6ff | python/moosesqa/get_documents.py | python | get_documents | (required_docs=INL_DOCUMENTS, **kwargs) | return [Document(name=name, title=name.replace('_', ' ').title(), filename=kwargs.get(name, None)) for name in required_docs] | Build SQA document dictionary from the provided directories. | Build SQA document dictionary from the provided directories. | [
"Build",
"SQA",
"document",
"dictionary",
"from",
"the",
"provided",
"directories",
"."
] | def get_documents(required_docs=INL_DOCUMENTS, **kwargs):
"""
Build SQA document dictionary from the provided directories.
"""
return [Document(name=name, title=name.replace('_', ' ').title(), filename=kwargs.get(name, None)) for name in required_docs] | [
"def",
"get_documents",
"(",
"required_docs",
"=",
"INL_DOCUMENTS",
",",
"*",
"*",
"kwargs",
")",
":",
"return",
"[",
"Document",
"(",
"name",
"=",
"name",
",",
"title",
"=",
"name",
".",
"replace",
"(",
"'_'",
",",
"' '",
")",
".",
"title",
"(",
")"... | https://github.com/idaholab/moose/blob/9eeebc65e098b4c30f8205fb41591fd5b61eb6ff/python/moosesqa/get_documents.py#L39-L43 | |
eclipse/sumo | 7132a9b8b6eea734bdec38479026b4d8c4336d03 | tools/traci/_trafficlight.py | python | TrafficLightDomain.getPhaseName | (self, tlsID) | return self._getUniversal(tc.VAR_NAME, tlsID) | getPhase(string) -> string
Returns the name of the current phase. | getPhase(string) -> string
Returns the name of the current phase. | [
"getPhase",
"(",
"string",
")",
"-",
">",
"string",
"Returns",
"the",
"name",
"of",
"the",
"current",
"phase",
"."
] | def getPhaseName(self, tlsID):
"""getPhase(string) -> string
Returns the name of the current phase.
"""
return self._getUniversal(tc.VAR_NAME, tlsID) | [
"def",
"getPhaseName",
"(",
"self",
",",
"tlsID",
")",
":",
"return",
"self",
".",
"_getUniversal",
"(",
"tc",
".",
"VAR_NAME",
",",
"tlsID",
")"
] | https://github.com/eclipse/sumo/blob/7132a9b8b6eea734bdec38479026b4d8c4336d03/tools/traci/_trafficlight.py#L215-L219 | |
baidu-research/tensorflow-allreduce | 66d5b855e90b0949e9fa5cca5599fd729a70e874 | tensorflow/contrib/data/python/ops/dataset_ops.py | python | Dataset.filter | (self, predicate) | return FilterDataset(self, predicate) | Filters this dataset according to `predicate`.
Args:
predicate: A function mapping a nested structure of tensors (having shapes
and types defined by `self.output_shapes` and `self.output_types`) to a
scalar `tf.bool` tensor.
Returns:
A `Dataset`. | Filters this dataset according to `predicate`. | [
"Filters",
"this",
"dataset",
"according",
"to",
"predicate",
"."
] | def filter(self, predicate):
"""Filters this dataset according to `predicate`.
Args:
predicate: A function mapping a nested structure of tensors (having shapes
and types defined by `self.output_shapes` and `self.output_types`) to a
scalar `tf.bool` tensor.
Returns:
A `Dataset`.... | [
"def",
"filter",
"(",
"self",
",",
"predicate",
")",
":",
"return",
"FilterDataset",
"(",
"self",
",",
"predicate",
")"
] | https://github.com/baidu-research/tensorflow-allreduce/blob/66d5b855e90b0949e9fa5cca5599fd729a70e874/tensorflow/contrib/data/python/ops/dataset_ops.py#L1061-L1072 | |
quantOS-org/DataCore | e2ef9bd2c22ee9e2845675b6435a14fa607f3551 | mdlink/deps/windows/protobuf-2.5.0/python/google/protobuf/descriptor_database.py | python | _ExtractSymbols | (desc_proto, package) | Pulls out all the symbols from a descriptor proto.
Args:
desc_proto: The proto to extract symbols from.
package: The package containing the descriptor type.
Yields:
The fully qualified name found in the descriptor. | Pulls out all the symbols from a descriptor proto. | [
"Pulls",
"out",
"all",
"the",
"symbols",
"from",
"a",
"descriptor",
"proto",
"."
] | def _ExtractSymbols(desc_proto, package):
"""Pulls out all the symbols from a descriptor proto.
Args:
desc_proto: The proto to extract symbols from.
package: The package containing the descriptor type.
Yields:
The fully qualified name found in the descriptor.
"""
message_name = '.'.join((packag... | [
"def",
"_ExtractSymbols",
"(",
"desc_proto",
",",
"package",
")",
":",
"message_name",
"=",
"'.'",
".",
"join",
"(",
"(",
"package",
",",
"desc_proto",
".",
"name",
")",
")",
"yield",
"message_name",
"for",
"nested_type",
"in",
"desc_proto",
".",
"nested_typ... | https://github.com/quantOS-org/DataCore/blob/e2ef9bd2c22ee9e2845675b6435a14fa607f3551/mdlink/deps/windows/protobuf-2.5.0/python/google/protobuf/descriptor_database.py#L103-L120 | ||
mongodb/mongo | d8ff665343ad29cf286ee2cf4a1960d29371937b | buildscripts/resmokelib/powercycle/powercycle.py | python | wait_for_mongod_shutdown | (mongod_control, timeout=2 * ONE_HOUR_SECS) | return 0 | Wait for for mongod to shutdown; return 0 if shutdown occurs within 'timeout', else 1. | Wait for for mongod to shutdown; return 0 if shutdown occurs within 'timeout', else 1. | [
"Wait",
"for",
"for",
"mongod",
"to",
"shutdown",
";",
"return",
"0",
"if",
"shutdown",
"occurs",
"within",
"timeout",
"else",
"1",
"."
] | def wait_for_mongod_shutdown(mongod_control, timeout=2 * ONE_HOUR_SECS):
"""Wait for for mongod to shutdown; return 0 if shutdown occurs within 'timeout', else 1."""
start = time.time()
status = mongod_control.status()
while status != "stopped":
if time.time() - start >= timeout:
LOG... | [
"def",
"wait_for_mongod_shutdown",
"(",
"mongod_control",
",",
"timeout",
"=",
"2",
"*",
"ONE_HOUR_SECS",
")",
":",
"start",
"=",
"time",
".",
"time",
"(",
")",
"status",
"=",
"mongod_control",
".",
"status",
"(",
")",
"while",
"status",
"!=",
"\"stopped\"",... | https://github.com/mongodb/mongo/blob/d8ff665343ad29cf286ee2cf4a1960d29371937b/buildscripts/resmokelib/powercycle/powercycle.py#L1087-L1104 | |
aws/lumberyard | f85344403c1c2e77ec8c75deb2c116e97b713217 | dev/Tools/Python/3.7.10/linux_x64/lib/python3.7/tkinter/__init__.py | python | Menu.yposition | (self, index) | return self.tk.getint(self.tk.call(
self._w, 'yposition', index)) | Return the y-position of the topmost pixel of the menu item at INDEX. | Return the y-position of the topmost pixel of the menu item at INDEX. | [
"Return",
"the",
"y",
"-",
"position",
"of",
"the",
"topmost",
"pixel",
"of",
"the",
"menu",
"item",
"at",
"INDEX",
"."
] | def yposition(self, index):
"""Return the y-position of the topmost pixel of the menu item at INDEX."""
return self.tk.getint(self.tk.call(
self._w, 'yposition', index)) | [
"def",
"yposition",
"(",
"self",
",",
"index",
")",
":",
"return",
"self",
".",
"tk",
".",
"getint",
"(",
"self",
".",
"tk",
".",
"call",
"(",
"self",
".",
"_w",
",",
"'yposition'",
",",
"index",
")",
")"
] | https://github.com/aws/lumberyard/blob/f85344403c1c2e77ec8c75deb2c116e97b713217/dev/Tools/Python/3.7.10/linux_x64/lib/python3.7/tkinter/__init__.py#L2957-L2960 | |
arangodb/arangodb | 0d658689c7d1b721b314fa3ca27d38303e1570c8 | 3rdParty/V8/v7.9.317/third_party/jinja2/parser.py | python | Parser.parse_tuple | (self, simplified=False, with_condexpr=True,
extra_end_rules=None, explicit_parentheses=False) | return nodes.Tuple(args, 'load', lineno=lineno) | Works like `parse_expression` but if multiple expressions are
delimited by a comma a :class:`~jinja2.nodes.Tuple` node is created.
This method could also return a regular expression instead of a tuple
if no commas where found.
The default parsing mode is a full tuple. If `simplified` i... | Works like `parse_expression` but if multiple expressions are
delimited by a comma a :class:`~jinja2.nodes.Tuple` node is created.
This method could also return a regular expression instead of a tuple
if no commas where found. | [
"Works",
"like",
"parse_expression",
"but",
"if",
"multiple",
"expressions",
"are",
"delimited",
"by",
"a",
"comma",
"a",
":",
"class",
":",
"~jinja2",
".",
"nodes",
".",
"Tuple",
"node",
"is",
"created",
".",
"This",
"method",
"could",
"also",
"return",
"... | def parse_tuple(self, simplified=False, with_condexpr=True,
extra_end_rules=None, explicit_parentheses=False):
"""Works like `parse_expression` but if multiple expressions are
delimited by a comma a :class:`~jinja2.nodes.Tuple` node is created.
This method could also return a... | [
"def",
"parse_tuple",
"(",
"self",
",",
"simplified",
"=",
"False",
",",
"with_condexpr",
"=",
"True",
",",
"extra_end_rules",
"=",
"None",
",",
"explicit_parentheses",
"=",
"False",
")",
":",
"lineno",
"=",
"self",
".",
"stream",
".",
"current",
".",
"lin... | https://github.com/arangodb/arangodb/blob/0d658689c7d1b721b314fa3ca27d38303e1570c8/3rdParty/V8/v7.9.317/third_party/jinja2/parser.py#L586-L639 | |
mantidproject/mantid | 03deeb89254ec4289edb8771e0188c2090a02f32 | qt/python/mantidqtinterfaces/mantidqtinterfaces/Muon/GUI/Common/contexts/fitting_contexts/fitting_context.py | python | FittingContext.active_fit_history | (self) | Returns the fit history for the currently active fitting mode. Override in a child class. | Returns the fit history for the currently active fitting mode. Override in a child class. | [
"Returns",
"the",
"fit",
"history",
"for",
"the",
"currently",
"active",
"fitting",
"mode",
".",
"Override",
"in",
"a",
"child",
"class",
"."
] | def active_fit_history(self) -> None:
"""Returns the fit history for the currently active fitting mode. Override in a child class."""
raise NotImplementedError("This needs to be overridden by a child class.") | [
"def",
"active_fit_history",
"(",
"self",
")",
"->",
"None",
":",
"raise",
"NotImplementedError",
"(",
"\"This needs to be overridden by a child class.\"",
")"
] | https://github.com/mantidproject/mantid/blob/03deeb89254ec4289edb8771e0188c2090a02f32/qt/python/mantidqtinterfaces/mantidqtinterfaces/Muon/GUI/Common/contexts/fitting_contexts/fitting_context.py#L354-L356 | ||
snap-stanford/snap-python | d53c51b0a26aa7e3e7400b014cdf728948fde80a | setup/snap.py | python | TIntV.AddUnique | (self, *args) | return _snap.TIntV_AddUnique(self, *args) | AddUnique(TIntV self, TInt Val) -> int
Parameters:
Val: TInt const & | AddUnique(TIntV self, TInt Val) -> int | [
"AddUnique",
"(",
"TIntV",
"self",
"TInt",
"Val",
")",
"-",
">",
"int"
] | def AddUnique(self, *args):
"""
AddUnique(TIntV self, TInt Val) -> int
Parameters:
Val: TInt const &
"""
return _snap.TIntV_AddUnique(self, *args) | [
"def",
"AddUnique",
"(",
"self",
",",
"*",
"args",
")",
":",
"return",
"_snap",
".",
"TIntV_AddUnique",
"(",
"self",
",",
"*",
"args",
")"
] | https://github.com/snap-stanford/snap-python/blob/d53c51b0a26aa7e3e7400b014cdf728948fde80a/setup/snap.py#L15737-L15745 | |
RamadhanAmizudin/malware | 2c6c53c8b0d556f5d8078d6ca0fc4448f4697cf1 | GMBot/gmbot/apps/smsg_r/smsapp/remote_api.py | python | cb_forward_disabled | (rec) | Call forwarding ended for the phone
@param rec: Phone data record
@type rec: models.PhoneData
@rtype: None | Call forwarding ended for the phone | [
"Call",
"forwarding",
"ended",
"for",
"the",
"phone"
] | def cb_forward_disabled(rec):
"""
Call forwarding ended for the phone
@param rec: Phone data record
@type rec: models.PhoneData
@rtype: None
"""
rec.forwarding_calls = None
rec.save() | [
"def",
"cb_forward_disabled",
"(",
"rec",
")",
":",
"rec",
".",
"forwarding_calls",
"=",
"None",
"rec",
".",
"save",
"(",
")"
] | https://github.com/RamadhanAmizudin/malware/blob/2c6c53c8b0d556f5d8078d6ca0fc4448f4697cf1/GMBot/gmbot/apps/smsg_r/smsapp/remote_api.py#L451-L459 | ||
apache/arrow | af33dd1157eb8d7d9bfac25ebf61445b793b7943 | cpp/gdb_arrow.py | python | format_date32 | (val) | Format a date32 value. | Format a date32 value. | [
"Format",
"a",
"date32",
"value",
"."
] | def format_date32(val):
"""
Format a date32 value.
"""
val = int(val)
try:
decoded = datetime.date.fromordinal(val + _date_base)
except ValueError: # "ordinal must be >= 1"
return f"{val}d [year <= 0]"
else:
return f"{val}d [{decoded}]" | [
"def",
"format_date32",
"(",
"val",
")",
":",
"val",
"=",
"int",
"(",
"val",
")",
"try",
":",
"decoded",
"=",
"datetime",
".",
"date",
".",
"fromordinal",
"(",
"val",
"+",
"_date_base",
")",
"except",
"ValueError",
":",
"# \"ordinal must be >= 1\"",
"retur... | https://github.com/apache/arrow/blob/af33dd1157eb8d7d9bfac25ebf61445b793b7943/cpp/gdb_arrow.py#L259-L269 | ||
ChromiumWebApps/chromium | c7361d39be8abd1574e6ce8957c8dbddd4c6ccf7 | third_party/closure_linter/closure_linter/common/tokens.py | python | Token.IsType | (self, token_type) | return self.type == token_type | Tests if this token is of the given type.
Args:
token_type: The type to test for.
Returns:
True if the type of this token matches the type passed in. | Tests if this token is of the given type. | [
"Tests",
"if",
"this",
"token",
"is",
"of",
"the",
"given",
"type",
"."
] | def IsType(self, token_type):
"""Tests if this token is of the given type.
Args:
token_type: The type to test for.
Returns:
True if the type of this token matches the type passed in.
"""
return self.type == token_type | [
"def",
"IsType",
"(",
"self",
",",
"token_type",
")",
":",
"return",
"self",
".",
"type",
"==",
"token_type"
] | https://github.com/ChromiumWebApps/chromium/blob/c7361d39be8abd1574e6ce8957c8dbddd4c6ccf7/third_party/closure_linter/closure_linter/common/tokens.py#L97-L106 | |
mindspore-ai/mindspore | fb8fd3338605bb34fa5cea054e535a8b1d753fab | mindspore/python/mindspore/numpy/utils_const.py | python | _check_element_int | (lst) | return True | Check whether each element in `lst` is an integer. | Check whether each element in `lst` is an integer. | [
"Check",
"whether",
"each",
"element",
"in",
"lst",
"is",
"an",
"integer",
"."
] | def _check_element_int(lst):
"""
Check whether each element in `lst` is an integer.
"""
for item in lst:
if not isinstance(item, int):
raise TypeError(f"Each element in {lst} should be integer, but got {type(item)}.")
return True | [
"def",
"_check_element_int",
"(",
"lst",
")",
":",
"for",
"item",
"in",
"lst",
":",
"if",
"not",
"isinstance",
"(",
"item",
",",
"int",
")",
":",
"raise",
"TypeError",
"(",
"f\"Each element in {lst} should be integer, but got {type(item)}.\"",
")",
"return",
"True... | https://github.com/mindspore-ai/mindspore/blob/fb8fd3338605bb34fa5cea054e535a8b1d753fab/mindspore/python/mindspore/numpy/utils_const.py#L382-L389 | |
aws/lumberyard | f85344403c1c2e77ec8c75deb2c116e97b713217 | dev/Gems/CloudGemFramework/v1/ResourceManager/lib/Crypto/Cipher/_mode_ofb.py | python | OfbMode.__init__ | (self, block_cipher, iv) | Create a new block cipher, configured in OFB mode.
:Parameters:
block_cipher : C pointer
A smart pointer to the low-level block cipher instance.
iv : bytes/bytearray/memoryview
The initialization vector to use for encryption or decryption.
It is as long ... | Create a new block cipher, configured in OFB mode. | [
"Create",
"a",
"new",
"block",
"cipher",
"configured",
"in",
"OFB",
"mode",
"."
] | def __init__(self, block_cipher, iv):
"""Create a new block cipher, configured in OFB mode.
:Parameters:
block_cipher : C pointer
A smart pointer to the low-level block cipher instance.
iv : bytes/bytearray/memoryview
The initialization vector to use for enc... | [
"def",
"__init__",
"(",
"self",
",",
"block_cipher",
",",
"iv",
")",
":",
"self",
".",
"_state",
"=",
"VoidPointer",
"(",
")",
"result",
"=",
"raw_ofb_lib",
".",
"OFB_start_operation",
"(",
"block_cipher",
".",
"get",
"(",
")",
",",
"c_uint8_ptr",
"(",
"... | https://github.com/aws/lumberyard/blob/f85344403c1c2e77ec8c75deb2c116e97b713217/dev/Gems/CloudGemFramework/v1/ResourceManager/lib/Crypto/Cipher/_mode_ofb.py#L73-L119 | ||
natanielruiz/android-yolo | 1ebb54f96a67a20ff83ddfc823ed83a13dc3a47f | jni-build/jni/include/tensorflow/contrib/distributions/python/ops/bijector.py | python | _Bijector.inverse_and_inverse_log_det_jacobian | (
self, x, name='inverse_and_inverse_log_det_jacobian') | Returns both the inverse evaluation and inverse_log_det_jacobian.
Enables possibly more efficient calculation when both inverse and
corresponding Jacobian are needed.
See `inverse()`, `inverse_log_det_jacobian()` for more details.
Args:
x: `Tensor`. The input to the "inverse" Jacobian evaluatio... | Returns both the inverse evaluation and inverse_log_det_jacobian. | [
"Returns",
"both",
"the",
"inverse",
"evaluation",
"and",
"inverse_log_det_jacobian",
"."
] | def inverse_and_inverse_log_det_jacobian(
self, x, name='inverse_and_inverse_log_det_jacobian'):
"""Returns both the inverse evaluation and inverse_log_det_jacobian.
Enables possibly more efficient calculation when both inverse and
corresponding Jacobian are needed.
See `inverse()`, `inverse_log... | [
"def",
"inverse_and_inverse_log_det_jacobian",
"(",
"self",
",",
"x",
",",
"name",
"=",
"'inverse_and_inverse_log_det_jacobian'",
")",
":",
"with",
"ops",
".",
"name_scope",
"(",
"self",
".",
"name",
")",
":",
"with",
"ops",
".",
"op_scope",
"(",
"[",
"x",
"... | https://github.com/natanielruiz/android-yolo/blob/1ebb54f96a67a20ff83ddfc823ed83a13dc3a47f/jni-build/jni/include/tensorflow/contrib/distributions/python/ops/bijector.py#L204-L226 | ||
wxWidgets/wxPython-Classic | 19571e1ae65f1ac445f5491474121998c97a1bf0 | src/msw/xrc.py | python | XmlDocument.GetFileEncoding | (*args, **kwargs) | return _xrc.XmlDocument_GetFileEncoding(*args, **kwargs) | GetFileEncoding(self) -> String | GetFileEncoding(self) -> String | [
"GetFileEncoding",
"(",
"self",
")",
"-",
">",
"String"
] | def GetFileEncoding(*args, **kwargs):
"""GetFileEncoding(self) -> String"""
return _xrc.XmlDocument_GetFileEncoding(*args, **kwargs) | [
"def",
"GetFileEncoding",
"(",
"*",
"args",
",",
"*",
"*",
"kwargs",
")",
":",
"return",
"_xrc",
".",
"XmlDocument_GetFileEncoding",
"(",
"*",
"args",
",",
"*",
"*",
"kwargs",
")"
] | https://github.com/wxWidgets/wxPython-Classic/blob/19571e1ae65f1ac445f5491474121998c97a1bf0/src/msw/xrc.py#L543-L545 | |
mantidproject/mantid | 03deeb89254ec4289edb8771e0188c2090a02f32 | qt/python/mantidqtinterfaces/mantidqtinterfaces/Muon/GUI/Common/fitting_widgets/basic_fitting/basic_fitting_model.py | python | BasicFittingModel.current_exclude_end_x | (self, value: float) | Sets the value of the currently selected exclude end X. | Sets the value of the currently selected exclude end X. | [
"Sets",
"the",
"value",
"of",
"the",
"currently",
"selected",
"exclude",
"end",
"X",
"."
] | def current_exclude_end_x(self, value: float) -> None:
"""Sets the value of the currently selected exclude end X."""
if value > self.current_exclude_start_x:
self.fitting_context.exclude_end_xs[self.fitting_context.current_dataset_index] = value | [
"def",
"current_exclude_end_x",
"(",
"self",
",",
"value",
":",
"float",
")",
"->",
"None",
":",
"if",
"value",
">",
"self",
".",
"current_exclude_start_x",
":",
"self",
".",
"fitting_context",
".",
"exclude_end_xs",
"[",
"self",
".",
"fitting_context",
".",
... | https://github.com/mantidproject/mantid/blob/03deeb89254ec4289edb8771e0188c2090a02f32/qt/python/mantidqtinterfaces/mantidqtinterfaces/Muon/GUI/Common/fitting_widgets/basic_fitting/basic_fitting_model.py#L230-L233 | ||
wxWidgets/wxPython-Classic | 19571e1ae65f1ac445f5491474121998c97a1bf0 | src/osx_cocoa/_misc.py | python | Log.EnableLogging | (*args, **kwargs) | return _misc_.Log_EnableLogging(*args, **kwargs) | EnableLogging(bool enable=True) -> bool | EnableLogging(bool enable=True) -> bool | [
"EnableLogging",
"(",
"bool",
"enable",
"=",
"True",
")",
"-",
">",
"bool"
] | def EnableLogging(*args, **kwargs):
"""EnableLogging(bool enable=True) -> bool"""
return _misc_.Log_EnableLogging(*args, **kwargs) | [
"def",
"EnableLogging",
"(",
"*",
"args",
",",
"*",
"*",
"kwargs",
")",
":",
"return",
"_misc_",
".",
"Log_EnableLogging",
"(",
"*",
"args",
",",
"*",
"*",
"kwargs",
")"
] | https://github.com/wxWidgets/wxPython-Classic/blob/19571e1ae65f1ac445f5491474121998c97a1bf0/src/osx_cocoa/_misc.py#L1466-L1468 | |
PaddlePaddle/Paddle | 1252f4bb3e574df80aa6d18c7ddae1b3a90bd81c | python/paddle/fluid/layers/rnn.py | python | Decoder.initialize | (self, inits) | r"""
Called once before the decoding iterations.
Parameters:
inits: Argument provided by the caller.
Returns:
tuple: A tuple( :code:`(initial_inputs, initial_states, finished)` ). \
`initial_inputs` and `initial_states` both are a (possibly nested \
... | r"""
Called once before the decoding iterations. | [
"r",
"Called",
"once",
"before",
"the",
"decoding",
"iterations",
"."
] | def initialize(self, inits):
r"""
Called once before the decoding iterations.
Parameters:
inits: Argument provided by the caller.
Returns:
tuple: A tuple( :code:`(initial_inputs, initial_states, finished)` ). \
`initial_inputs` and `initial_state... | [
"def",
"initialize",
"(",
"self",
",",
"inits",
")",
":",
"raise",
"NotImplementedError"
] | https://github.com/PaddlePaddle/Paddle/blob/1252f4bb3e574df80aa6d18c7ddae1b3a90bd81c/python/paddle/fluid/layers/rnn.py#L786-L799 | ||
wlanjie/AndroidFFmpeg | 7baf9122f4b8e1c74e7baf4be5c422c7a5ba5aaf | tools/fdk-aac-build/armeabi-v7a/toolchain/lib/python2.7/lib-tk/Tkinter.py | python | Text.edit_redo | (self) | return self.edit("redo") | Redo the last undone edit
When the undo option is true, reapplies the last
undone edits provided no other edits were done since
then. Generates an error when the redo stack is empty.
Does nothing when the undo option is false. | Redo the last undone edit | [
"Redo",
"the",
"last",
"undone",
"edit"
] | def edit_redo(self):
"""Redo the last undone edit
When the undo option is true, reapplies the last
undone edits provided no other edits were done since
then. Generates an error when the redo stack is empty.
Does nothing when the undo option is false.
"""
return s... | [
"def",
"edit_redo",
"(",
"self",
")",
":",
"return",
"self",
".",
"edit",
"(",
"\"redo\"",
")"
] | https://github.com/wlanjie/AndroidFFmpeg/blob/7baf9122f4b8e1c74e7baf4be5c422c7a5ba5aaf/tools/fdk-aac-build/armeabi-v7a/toolchain/lib/python2.7/lib-tk/Tkinter.py#L2987-L2995 | |
milvus-io/milvus | 3b1030de2b6c39e3512833e97f6044d63eb24237 | internal/core/build-support/cpplint.py | python | GetPreviousNonBlankLine | (clean_lines, linenum) | return ('', -1) | Return the most recent non-blank line and its line number.
Args:
clean_lines: A CleansedLines instance containing the file contents.
linenum: The number of the line to check.
Returns:
A tuple with two elements. The first element is the contents of the last
non-blank line before the current line, ... | Return the most recent non-blank line and its line number. | [
"Return",
"the",
"most",
"recent",
"non",
"-",
"blank",
"line",
"and",
"its",
"line",
"number",
"."
] | def GetPreviousNonBlankLine(clean_lines, linenum):
"""Return the most recent non-blank line and its line number.
Args:
clean_lines: A CleansedLines instance containing the file contents.
linenum: The number of the line to check.
Returns:
A tuple with two elements. The first element is the contents ... | [
"def",
"GetPreviousNonBlankLine",
"(",
"clean_lines",
",",
"linenum",
")",
":",
"prevlinenum",
"=",
"linenum",
"-",
"1",
"while",
"prevlinenum",
">=",
"0",
":",
"prevline",
"=",
"clean_lines",
".",
"elided",
"[",
"prevlinenum",
"]",
"if",
"not",
"IsBlankLine",... | https://github.com/milvus-io/milvus/blob/3b1030de2b6c39e3512833e97f6044d63eb24237/internal/core/build-support/cpplint.py#L4209-L4229 | |
hughperkins/tf-coriander | 970d3df6c11400ad68405f22b0c42a52374e94ca | tensorflow/contrib/graph_editor/transform.py | python | copy_with_input_replacements | (sgv, replacement_ts,
dst_graph=None, dst_scope="", src_scope="",
reuse_dst_scope=False) | return copier(
sgv, dst_graph, dst_scope, src_scope, reuse_dst_scope=reuse_dst_scope) | Copy a subgraph, replacing some of its inputs.
Note a replacement only happens if the tensor to be replaced
is an input of the given subgraph. The inputs of a subgraph can
be queried using sgv.inputs.
Args:
sgv: the source subgraph-view. This argument is converted to a subgraph
using the same rules ... | Copy a subgraph, replacing some of its inputs. | [
"Copy",
"a",
"subgraph",
"replacing",
"some",
"of",
"its",
"inputs",
"."
] | def copy_with_input_replacements(sgv, replacement_ts,
dst_graph=None, dst_scope="", src_scope="",
reuse_dst_scope=False):
"""Copy a subgraph, replacing some of its inputs.
Note a replacement only happens if the tensor to be replaced
is an input of... | [
"def",
"copy_with_input_replacements",
"(",
"sgv",
",",
"replacement_ts",
",",
"dst_graph",
"=",
"None",
",",
"dst_scope",
"=",
"\"\"",
",",
"src_scope",
"=",
"\"\"",
",",
"reuse_dst_scope",
"=",
"False",
")",
":",
"sgv",
"=",
"subgraph",
".",
"make_view",
"... | https://github.com/hughperkins/tf-coriander/blob/970d3df6c11400ad68405f22b0c42a52374e94ca/tensorflow/contrib/graph_editor/transform.py#L623-L669 | |
devsisters/libquic | 8954789a056d8e7d5fcb6452fd1572ca57eb5c4e | src/third_party/protobuf/python/google/protobuf/internal/well_known_types.py | python | _IsValidPath | (message_descriptor, path) | return last in message_descriptor.fields_by_name | Checks whether the path is valid for Message Descriptor. | Checks whether the path is valid for Message Descriptor. | [
"Checks",
"whether",
"the",
"path",
"is",
"valid",
"for",
"Message",
"Descriptor",
"."
] | def _IsValidPath(message_descriptor, path):
"""Checks whether the path is valid for Message Descriptor."""
parts = path.split('.')
last = parts.pop()
for name in parts:
field = message_descriptor.fields_by_name[name]
if (field is None or
field.label == FieldDescriptor.LABEL_REPEATED or
f... | [
"def",
"_IsValidPath",
"(",
"message_descriptor",
",",
"path",
")",
":",
"parts",
"=",
"path",
".",
"split",
"(",
"'.'",
")",
"last",
"=",
"parts",
".",
"pop",
"(",
")",
"for",
"name",
"in",
"parts",
":",
"field",
"=",
"message_descriptor",
".",
"field... | https://github.com/devsisters/libquic/blob/8954789a056d8e7d5fcb6452fd1572ca57eb5c4e/src/third_party/protobuf/python/google/protobuf/internal/well_known_types.py#L452-L463 | |
catboost/catboost | 167f64f237114a4d10b2b4ee42adb4569137debe | contrib/python/scikit-learn/py2/sklearn/decomposition/dict_learning.py | python | MiniBatchDictionaryLearning.partial_fit | (self, X, y=None, iter_offset=None) | return self | Updates the model using the data in X as a mini-batch.
Parameters
----------
X: array-like, shape (n_samples, n_features)
Training vector, where n_samples in the number of samples
and n_features is the number of features.
iter_offset: integer, optional
... | Updates the model using the data in X as a mini-batch. | [
"Updates",
"the",
"model",
"using",
"the",
"data",
"in",
"X",
"as",
"a",
"mini",
"-",
"batch",
"."
] | def partial_fit(self, X, y=None, iter_offset=None):
"""Updates the model using the data in X as a mini-batch.
Parameters
----------
X: array-like, shape (n_samples, n_features)
Training vector, where n_samples in the number of samples
and n_features is the number... | [
"def",
"partial_fit",
"(",
"self",
",",
"X",
",",
"y",
"=",
"None",
",",
"iter_offset",
"=",
"None",
")",
":",
"if",
"not",
"hasattr",
"(",
"self",
",",
"'random_state_'",
")",
":",
"self",
".",
"random_state_",
"=",
"check_random_state",
"(",
"self",
... | https://github.com/catboost/catboost/blob/167f64f237114a4d10b2b4ee42adb4569137debe/contrib/python/scikit-learn/py2/sklearn/decomposition/dict_learning.py#L1246-L1290 | |
genn-team/genn | 75e1eb218cafa228bf36ae4613d1ce26e877b12c | generate_swig_interfaces.py | python | SwigAsIsScope.__init__ | ( self, ofs ) | Adds %{ %} block. The code within %{ %} block is added to the wrapper C++ file as is without being processed by SWIG | Adds %{ %} block. The code within %{ %} block is added to the wrapper C++ file as is without being processed by SWIG | [
"Adds",
"%",
"{",
"%",
"}",
"block",
".",
"The",
"code",
"within",
"%",
"{",
"%",
"}",
"block",
"is",
"added",
"to",
"the",
"wrapper",
"C",
"++",
"file",
"as",
"is",
"without",
"being",
"processed",
"by",
"SWIG"
] | def __init__( self, ofs ):
'''Adds %{ %} block. The code within %{ %} block is added to the wrapper C++ file as is without being processed by SWIG'''
self.os = ofs | [
"def",
"__init__",
"(",
"self",
",",
"ofs",
")",
":",
"self",
".",
"os",
"=",
"ofs"
] | https://github.com/genn-team/genn/blob/75e1eb218cafa228bf36ae4613d1ce26e877b12c/generate_swig_interfaces.py#L84-L86 | ||
aws/lumberyard | f85344403c1c2e77ec8c75deb2c116e97b713217 | dev/Gems/CloudGemMetric/v1/AWS/python/windows/Lib/numba/types/npytypes.py | python | Record.members | (self) | return [(k, v.type) for k, v in ordered] | An ordered list of (name, type) for the fields. | An ordered list of (name, type) for the fields. | [
"An",
"ordered",
"list",
"of",
"(",
"name",
"type",
")",
"for",
"the",
"fields",
"."
] | def members(self):
"""An ordered list of (name, type) for the fields.
"""
ordered = sorted(self.fields.items(), key=lambda x: x[1].offset)
return [(k, v.type) for k, v in ordered] | [
"def",
"members",
"(",
"self",
")",
":",
"ordered",
"=",
"sorted",
"(",
"self",
".",
"fields",
".",
"items",
"(",
")",
",",
"key",
"=",
"lambda",
"x",
":",
"x",
"[",
"1",
"]",
".",
"offset",
")",
"return",
"[",
"(",
"k",
",",
"v",
".",
"type"... | https://github.com/aws/lumberyard/blob/f85344403c1c2e77ec8c75deb2c116e97b713217/dev/Gems/CloudGemMetric/v1/AWS/python/windows/Lib/numba/types/npytypes.py#L196-L200 | |
ricardoquesada/Spidermonkey | 4a75ea2543408bd1b2c515aa95901523eeef7858 | addon-sdk/source/python-lib/cuddlefish/runner.py | python | XulrunnerAppRunner.command | (self) | Returns the command list to run. | Returns the command list to run. | [
"Returns",
"the",
"command",
"list",
"to",
"run",
"."
] | def command(self):
"""Returns the command list to run."""
if self.__is_xulrunner_sdk:
return [self.binary, self.__app_ini, '-profile',
self.profile.profile]
else:
return [self.binary, '-app', self.__app_ini, '-profile',
self.profil... | [
"def",
"command",
"(",
"self",
")",
":",
"if",
"self",
".",
"__is_xulrunner_sdk",
":",
"return",
"[",
"self",
".",
"binary",
",",
"self",
".",
"__app_ini",
",",
"'-profile'",
",",
"self",
".",
"profile",
".",
"profile",
"]",
"else",
":",
"return",
"[",... | https://github.com/ricardoquesada/Spidermonkey/blob/4a75ea2543408bd1b2c515aa95901523eeef7858/addon-sdk/source/python-lib/cuddlefish/runner.py#L353-L361 | ||
OGRECave/ogre-next | 287307980e6de8910f04f3cc0994451b075071fd | Tools/Wings3DExporter/io3d_ogre.py | python | ogre_writer.add_geometry | (self, geometry_elem, vertices) | add given vertices to an XML element | add given vertices to an XML element | [
"add",
"given",
"vertices",
"to",
"an",
"XML",
"element"
] | def add_geometry(self, geometry_elem, vertices):
"add given vertices to an XML element"
geometry_elem.setProp("vertexcount", str(len(vertices)))
want_uvs = vertices[0].uv != None
vb_elem = geometry_elem.newChild(None, "vertexbuffer", None)
vb_elem.setProp("positions", "true")
vb_elem.setProp("normals"... | [
"def",
"add_geometry",
"(",
"self",
",",
"geometry_elem",
",",
"vertices",
")",
":",
"geometry_elem",
".",
"setProp",
"(",
"\"vertexcount\"",
",",
"str",
"(",
"len",
"(",
"vertices",
")",
")",
")",
"want_uvs",
"=",
"vertices",
"[",
"0",
"]",
".",
"uv",
... | https://github.com/OGRECave/ogre-next/blob/287307980e6de8910f04f3cc0994451b075071fd/Tools/Wings3DExporter/io3d_ogre.py#L65-L98 | ||
PlatformLab/Arachne | e67391471007174dd4002dc2c160628e19c284e8 | scripts/cpplint.py | python | CheckBracesSpacing | (filename, clean_lines, linenum, nesting_state, error) | Checks for horizontal spacing near commas.
Args:
filename: The name of the current file.
clean_lines: A CleansedLines instance containing the file.
linenum: The number of the line to check.
nesting_state: A NestingState instance which maintains information about
the current stack o... | Checks for horizontal spacing near commas. | [
"Checks",
"for",
"horizontal",
"spacing",
"near",
"commas",
"."
] | def CheckBracesSpacing(filename, clean_lines, linenum, nesting_state, error):
"""Checks for horizontal spacing near commas.
Args:
filename: The name of the current file.
clean_lines: A CleansedLines instance containing the file.
linenum: The number of the line to check.
nesting_state: A NestingStat... | [
"def",
"CheckBracesSpacing",
"(",
"filename",
",",
"clean_lines",
",",
"linenum",
",",
"nesting_state",
",",
"error",
")",
":",
"line",
"=",
"clean_lines",
".",
"elided",
"[",
"linenum",
"]",
"# Except after an opening paren, or after another opening brace (in case of",
... | https://github.com/PlatformLab/Arachne/blob/e67391471007174dd4002dc2c160628e19c284e8/scripts/cpplint.py#L3439-L3525 | ||
krishauser/Klampt | 972cc83ea5befac3f653c1ba20f80155768ad519 | Python/python2_version/klampt/model/trajectory.py | python | HermiteTrajectory.length | (self) | return Trajectory.length(self,distance) | Returns an upper bound on length given by the Bezier property.
Faster than calculating the true length. To retrieve an approximation
of true length, use self.discretize(dt).length(). | Returns an upper bound on length given by the Bezier property.
Faster than calculating the true length. To retrieve an approximation
of true length, use self.discretize(dt).length(). | [
"Returns",
"an",
"upper",
"bound",
"on",
"length",
"given",
"by",
"the",
"Bezier",
"property",
".",
"Faster",
"than",
"calculating",
"the",
"true",
"length",
".",
"To",
"retrieve",
"an",
"approximation",
"of",
"true",
"length",
"use",
"self",
".",
"discretiz... | def length(self):
"""Returns an upper bound on length given by the Bezier property.
Faster than calculating the true length. To retrieve an approximation
of true length, use self.discretize(dt).length().
"""
n = len(self.milestones[0])//2
third = 1.0/3.0
def dis... | [
"def",
"length",
"(",
"self",
")",
":",
"n",
"=",
"len",
"(",
"self",
".",
"milestones",
"[",
"0",
"]",
")",
"//",
"2",
"third",
"=",
"1.0",
"/",
"3.0",
"def",
"distance",
"(",
"x",
",",
"y",
")",
":",
"cp0",
"=",
"x",
"[",
":",
"n",
"]",
... | https://github.com/krishauser/Klampt/blob/972cc83ea5befac3f653c1ba20f80155768ad519/Python/python2_version/klampt/model/trajectory.py#L996-L1009 | |
FreeCAD/FreeCAD | ba42231b9c6889b89e064d6d563448ed81e376ec | src/Mod/Draft/draftguitools/gui_lines.py | python | Wire.GetResources | (self) | return {'Pixmap': 'Draft_Wire',
'Accel': "P, L",
'MenuText': QT_TRANSLATE_NOOP("Draft_Wire", "Polyline"),
'ToolTip': QT_TRANSLATE_NOOP("Draft_Wire", "Creates a multiple-points line (polyline). CTRL to snap, SHIFT to constrain.")} | Set icon, menu and tooltip. | Set icon, menu and tooltip. | [
"Set",
"icon",
"menu",
"and",
"tooltip",
"."
] | def GetResources(self):
"""Set icon, menu and tooltip."""
return {'Pixmap': 'Draft_Wire',
'Accel': "P, L",
'MenuText': QT_TRANSLATE_NOOP("Draft_Wire", "Polyline"),
'ToolTip': QT_TRANSLATE_NOOP("Draft_Wire", "Creates a multiple-points line (polyline). CTRL... | [
"def",
"GetResources",
"(",
"self",
")",
":",
"return",
"{",
"'Pixmap'",
":",
"'Draft_Wire'",
",",
"'Accel'",
":",
"\"P, L\"",
",",
"'MenuText'",
":",
"QT_TRANSLATE_NOOP",
"(",
"\"Draft_Wire\"",
",",
"\"Polyline\"",
")",
",",
"'ToolTip'",
":",
"QT_TRANSLATE_NOOP... | https://github.com/FreeCAD/FreeCAD/blob/ba42231b9c6889b89e064d6d563448ed81e376ec/src/Mod/Draft/draftguitools/gui_lines.py#L305-L311 | |
bareos/bareos | 56a10bb368b0a81e977bb51304033fe49d59efb0 | core/src/plugins/filed/python/libcloud/BareosFdPluginLibcloud.py | python | BareosFdPluginLibcloud._check_config | (self, config_filename) | return True | Check the configuration and set or override options if necessary,
considering mandatory: username and password in the [credentials] section | Check the configuration and set or override options if necessary,
considering mandatory: username and password in the [credentials] section | [
"Check",
"the",
"configuration",
"and",
"set",
"or",
"override",
"options",
"if",
"necessary",
"considering",
"mandatory",
":",
"username",
"and",
"password",
"in",
"the",
"[",
"credentials",
"]",
"section"
] | def _check_config(self, config_filename):
"""
Check the configuration and set or override options if necessary,
considering mandatory: username and password in the [credentials] section
"""
mandatory_sections = ["credentials", "host", "misc"]
mandatory_options = {}
... | [
"def",
"_check_config",
"(",
"self",
",",
"config_filename",
")",
":",
"mandatory_sections",
"=",
"[",
"\"credentials\"",
",",
"\"host\"",
",",
"\"misc\"",
"]",
"mandatory_options",
"=",
"{",
"}",
"mandatory_options",
"[",
"\"credentials\"",
"]",
"=",
"[",
"\"us... | https://github.com/bareos/bareos/blob/56a10bb368b0a81e977bb51304033fe49d59efb0/core/src/plugins/filed/python/libcloud/BareosFdPluginLibcloud.py#L166-L255 | |
google/llvm-propeller | 45c226984fe8377ebfb2ad7713c680d652ba678d | lldb/third_party/Python/module/pexpect-4.6/pexpect/fdpexpect.py | python | fdspawn.send | (self, s) | return os.write(self.child_fd, b) | Write to fd, return number of bytes written | Write to fd, return number of bytes written | [
"Write",
"to",
"fd",
"return",
"number",
"of",
"bytes",
"written"
] | def send(self, s):
"Write to fd, return number of bytes written"
s = self._coerce_send_string(s)
self._log(s, 'send')
b = self._encoder.encode(s, final=False)
return os.write(self.child_fd, b) | [
"def",
"send",
"(",
"self",
",",
"s",
")",
":",
"s",
"=",
"self",
".",
"_coerce_send_string",
"(",
"s",
")",
"self",
".",
"_log",
"(",
"s",
",",
"'send'",
")",
"b",
"=",
"self",
".",
"_encoder",
".",
"encode",
"(",
"s",
",",
"final",
"=",
"Fals... | https://github.com/google/llvm-propeller/blob/45c226984fe8377ebfb2ad7713c680d652ba678d/lldb/third_party/Python/module/pexpect-4.6/pexpect/fdpexpect.py#L96-L102 | |
DanielSWolf/rhubarb-lip-sync | 5cface0af3b6e4e58c0b829c51561d784fb9f52f | rhubarb/lib/sphinxbase-rev13216/doc/doxy2swig.py | python | Doxy2SWIG.__init__ | (self, src, include_function_definition=True, quiet=False) | Initialize the instance given a source object. `src` can
be a file or filename. If you do not want to include function
definitions from doxygen then set
`include_function_definition` to `False`. This is handy since
this allows you to use the swig generated function definition
... | Initialize the instance given a source object. `src` can
be a file or filename. If you do not want to include function
definitions from doxygen then set
`include_function_definition` to `False`. This is handy since
this allows you to use the swig generated function definition
... | [
"Initialize",
"the",
"instance",
"given",
"a",
"source",
"object",
".",
"src",
"can",
"be",
"a",
"file",
"or",
"filename",
".",
"If",
"you",
"do",
"not",
"want",
"to",
"include",
"function",
"definitions",
"from",
"doxygen",
"then",
"set",
"include_function_... | def __init__(self, src, include_function_definition=True, quiet=False):
"""Initialize the instance given a source object. `src` can
be a file or filename. If you do not want to include function
definitions from doxygen then set
`include_function_definition` to `False`. This is handy s... | [
"def",
"__init__",
"(",
"self",
",",
"src",
",",
"include_function_definition",
"=",
"True",
",",
"quiet",
"=",
"False",
")",
":",
"f",
"=",
"my_open_read",
"(",
"src",
")",
"self",
".",
"my_dir",
"=",
"os",
".",
"path",
".",
"dirname",
"(",
"f",
"."... | https://github.com/DanielSWolf/rhubarb-lip-sync/blob/5cface0af3b6e4e58c0b829c51561d784fb9f52f/rhubarb/lib/sphinxbase-rev13216/doc/doxy2swig.py#L82-L115 | ||
pytorch/pytorch | 7176c92687d3cc847cc046bf002269c6949a21c2 | torch/package/package_exporter.py | python | PackageExporter.denied_modules | (self) | return self._nodes_with_action_type(_ModuleProviderAction.DENY) | Return all modules that are currently denied.
Returns:
A list containing the names of modules which will be
denied in this package. | Return all modules that are currently denied. | [
"Return",
"all",
"modules",
"that",
"are",
"currently",
"denied",
"."
] | def denied_modules(self) -> List[str]:
"""Return all modules that are currently denied.
Returns:
A list containing the names of modules which will be
denied in this package.
"""
return self._nodes_with_action_type(_ModuleProviderAction.DENY) | [
"def",
"denied_modules",
"(",
"self",
")",
"->",
"List",
"[",
"str",
"]",
":",
"return",
"self",
".",
"_nodes_with_action_type",
"(",
"_ModuleProviderAction",
".",
"DENY",
")"
] | https://github.com/pytorch/pytorch/blob/7176c92687d3cc847cc046bf002269c6949a21c2/torch/package/package_exporter.py#L1084-L1091 | |
catboost/catboost | 167f64f237114a4d10b2b4ee42adb4569137debe | contrib/tools/python/src/Lib/lib-tk/ttk.py | python | Treeview.move | (self, item, parent, index) | Moves item to position index in parent's list of children.
It is illegal to move an item under one of its descendants. If
index is less than or equal to zero, item is moved to the
beginning, if greater than or equal to the number of children,
it is moved to the end. If item was detached... | Moves item to position index in parent's list of children. | [
"Moves",
"item",
"to",
"position",
"index",
"in",
"parent",
"s",
"list",
"of",
"children",
"."
] | def move(self, item, parent, index):
"""Moves item to position index in parent's list of children.
It is illegal to move an item under one of its descendants. If
index is less than or equal to zero, item is moved to the
beginning, if greater than or equal to the number of children,
... | [
"def",
"move",
"(",
"self",
",",
"item",
",",
"parent",
",",
"index",
")",
":",
"self",
".",
"tk",
".",
"call",
"(",
"self",
".",
"_w",
",",
"\"move\"",
",",
"item",
",",
"parent",
",",
"index",
")"
] | https://github.com/catboost/catboost/blob/167f64f237114a4d10b2b4ee42adb4569137debe/contrib/tools/python/src/Lib/lib-tk/ttk.py#L1356-L1363 | ||
omnisci/omniscidb | b9c95f1bd602b4ffc8b0edf18bfad61031e08d86 | python/omnisci/cursor.py | python | Cursor.description | (self) | return self._description | Read-only sequence describing columns of the result set.
Each column is an instance of `Description` describing
- name
- type_code
- display_size
- internal_size
- precision
- scale
- null_ok
We only use name, type_code, and null_ok; The rest are... | Read-only sequence describing columns of the result set.
Each column is an instance of `Description` describing | [
"Read",
"-",
"only",
"sequence",
"describing",
"columns",
"of",
"the",
"result",
"set",
".",
"Each",
"column",
"is",
"an",
"instance",
"of",
"Description",
"describing"
] | def description(self):
"""
Read-only sequence describing columns of the result set.
Each column is an instance of `Description` describing
- name
- type_code
- display_size
- internal_size
- precision
- scale
- null_ok
We only use... | [
"def",
"description",
"(",
"self",
")",
":",
"return",
"self",
".",
"_description"
] | https://github.com/omnisci/omniscidb/blob/b9c95f1bd602b4ffc8b0edf18bfad61031e08d86/python/omnisci/cursor.py#L32-L47 | |
wxWidgets/wxPython-Classic | 19571e1ae65f1ac445f5491474121998c97a1bf0 | wx/tools/Editra/src/extern/pkg_resources.py | python | IResourceProvider.get_resource_string | (manager, resource_name) | Return a string containing the contents of `resource_name`
`manager` must be an ``IResourceManager`` | Return a string containing the contents of `resource_name` | [
"Return",
"a",
"string",
"containing",
"the",
"contents",
"of",
"resource_name"
] | def get_resource_string(manager, resource_name):
"""Return a string containing the contents of `resource_name`
`manager` must be an ``IResourceManager``""" | [
"def",
"get_resource_string",
"(",
"manager",
",",
"resource_name",
")",
":"
] | https://github.com/wxWidgets/wxPython-Classic/blob/19571e1ae65f1ac445f5491474121998c97a1bf0/wx/tools/Editra/src/extern/pkg_resources.py#L307-L310 | ||
eProsima/Fast-DDS | 6639a84b7855e8fda66a4afb541326ef22f8c727 | tools/fastdds/fastdds.py | python | FastDDSParser.__check_python_version | (self) | Assert python version is valid. | Assert python version is valid. | [
"Assert",
"python",
"version",
"is",
"valid",
"."
] | def __check_python_version(self):
"""Assert python version is valid."""
req_v = self.__required_python_version
v = sys.version_info
if not (
((v[0] == req_v[0]) and (v[1] >= req_v[1])) or
(v[0] > req_v[0])
):
print('fastd... | [
"def",
"__check_python_version",
"(",
"self",
")",
":",
"req_v",
"=",
"self",
".",
"__required_python_version",
"v",
"=",
"sys",
".",
"version_info",
"if",
"not",
"(",
"(",
"(",
"v",
"[",
"0",
"]",
"==",
"req_v",
"[",
"0",
"]",
")",
"and",
"(",
"v",
... | https://github.com/eProsima/Fast-DDS/blob/6639a84b7855e8fda66a4afb541326ef22f8c727/tools/fastdds/fastdds.py#L89-L99 | ||
catboost/catboost | 167f64f237114a4d10b2b4ee42adb4569137debe | contrib/tools/python/src/Lib/logging/__init__.py | python | LoggerAdapter.critical | (self, msg, *args, **kwargs) | Delegate a critical call to the underlying logger, after adding
contextual information from this adapter instance. | Delegate a critical call to the underlying logger, after adding
contextual information from this adapter instance. | [
"Delegate",
"a",
"critical",
"call",
"to",
"the",
"underlying",
"logger",
"after",
"adding",
"contextual",
"information",
"from",
"this",
"adapter",
"instance",
"."
] | def critical(self, msg, *args, **kwargs):
"""
Delegate a critical call to the underlying logger, after adding
contextual information from this adapter instance.
"""
msg, kwargs = self.process(msg, kwargs)
self.logger.critical(msg, *args, **kwargs) | [
"def",
"critical",
"(",
"self",
",",
"msg",
",",
"*",
"args",
",",
"*",
"*",
"kwargs",
")",
":",
"msg",
",",
"kwargs",
"=",
"self",
".",
"process",
"(",
"msg",
",",
"kwargs",
")",
"self",
".",
"logger",
".",
"critical",
"(",
"msg",
",",
"*",
"a... | https://github.com/catboost/catboost/blob/167f64f237114a4d10b2b4ee42adb4569137debe/contrib/tools/python/src/Lib/logging/__init__.py#L1482-L1488 | ||
aws/lumberyard | f85344403c1c2e77ec8c75deb2c116e97b713217 | dev/Tools/Python/3.7.10/linux_x64/lib/python3.7/site-packages/pip/_internal/models/direct_url.py | python | DirectUrl.redacted_url | (self) | return surl | url with user:password part removed unless it is formed with
environment variables as specified in PEP 610, or it is ``git``
in the case of a git URL. | url with user:password part removed unless it is formed with | [
"url",
"with",
"user",
":",
"password",
"part",
"removed",
"unless",
"it",
"is",
"formed",
"with"
] | def redacted_url(self):
# type: () -> str
"""url with user:password part removed unless it is formed with
environment variables as specified in PEP 610, or it is ``git``
in the case of a git URL.
"""
purl = urllib.parse.urlsplit(self.url)
netloc = self._rem... | [
"def",
"redacted_url",
"(",
"self",
")",
":",
"# type: () -> str",
"purl",
"=",
"urllib",
".",
"parse",
".",
"urlsplit",
"(",
"self",
".",
"url",
")",
"netloc",
"=",
"self",
".",
"_remove_auth_from_netloc",
"(",
"purl",
".",
"netloc",
")",
"surl",
"=",
"... | https://github.com/aws/lumberyard/blob/f85344403c1c2e77ec8c75deb2c116e97b713217/dev/Tools/Python/3.7.10/linux_x64/lib/python3.7/site-packages/pip/_internal/models/direct_url.py#L381-L403 | |
TGAC/KAT | e8870331de2b4bb0a1b3b91c6afb8fb9d59e9216 | deps/boost/tools/build/src/build/project.py | python | ProjectRegistry.current | (self) | return self.current_project | Returns the project which is currently being loaded. | Returns the project which is currently being loaded. | [
"Returns",
"the",
"project",
"which",
"is",
"currently",
"being",
"loaded",
"."
] | def current(self):
"""Returns the project which is currently being loaded."""
if not self.current_project:
get_manager().errors()(
'Reference to the project currently being loaded requested '
'when there was no project module being loaded.'
)
... | [
"def",
"current",
"(",
"self",
")",
":",
"if",
"not",
"self",
".",
"current_project",
":",
"get_manager",
"(",
")",
".",
"errors",
"(",
")",
"(",
"'Reference to the project currently being loaded requested '",
"'when there was no project module being loaded.'",
")",
"re... | https://github.com/TGAC/KAT/blob/e8870331de2b4bb0a1b3b91c6afb8fb9d59e9216/deps/boost/tools/build/src/build/project.py#L557-L564 | |
baidu/bigflow | 449245016c0df7d1252e85581e588bfc60cefad3 | bigflow_python/python/bigflow/serde.py | python | SameTypeListSerde.deserialize | (self, buf) | return result | deserialize | deserialize | [
"deserialize"
] | def deserialize(self, buf):
""" deserialize """
buf_len = len(buf)
result = []
buf_offset = 0
while buf_offset < buf_len:
element_size = struct.unpack("<I", buf[buf_offset:buf_offset + 4])[0]
val = self._value.deserialize(buf[buf_offset + 4:buf_offset + 4 ... | [
"def",
"deserialize",
"(",
"self",
",",
"buf",
")",
":",
"buf_len",
"=",
"len",
"(",
"buf",
")",
"result",
"=",
"[",
"]",
"buf_offset",
"=",
"0",
"while",
"buf_offset",
"<",
"buf_len",
":",
"element_size",
"=",
"struct",
".",
"unpack",
"(",
"\"<I\"",
... | https://github.com/baidu/bigflow/blob/449245016c0df7d1252e85581e588bfc60cefad3/bigflow_python/python/bigflow/serde.py#L260-L270 | |
BitMEX/api-connectors | 37a3a5b806ad5d0e0fc975ab86d9ed43c3bcd812 | auto-generated/python/swagger_client/models/execution.py | python | Execution.ex_destination | (self, ex_destination) | Sets the ex_destination of this Execution.
:param ex_destination: The ex_destination of this Execution. # noqa: E501
:type: str | Sets the ex_destination of this Execution. | [
"Sets",
"the",
"ex_destination",
"of",
"this",
"Execution",
"."
] | def ex_destination(self, ex_destination):
"""Sets the ex_destination of this Execution.
:param ex_destination: The ex_destination of this Execution. # noqa: E501
:type: str
"""
self._ex_destination = ex_destination | [
"def",
"ex_destination",
"(",
"self",
",",
"ex_destination",
")",
":",
"self",
".",
"_ex_destination",
"=",
"ex_destination"
] | https://github.com/BitMEX/api-connectors/blob/37a3a5b806ad5d0e0fc975ab86d9ed43c3bcd812/auto-generated/python/swagger_client/models/execution.py#L838-L846 | ||
catboost/catboost | 167f64f237114a4d10b2b4ee42adb4569137debe | contrib/python/dateutil/dateutil/parser/_parser.py | python | _timelex.isspace | (cls, nextchar) | return nextchar.isspace() | Whether the next character is whitespace | Whether the next character is whitespace | [
"Whether",
"the",
"next",
"character",
"is",
"whitespace"
] | def isspace(cls, nextchar):
""" Whether the next character is whitespace """
return nextchar.isspace() | [
"def",
"isspace",
"(",
"cls",
",",
"nextchar",
")",
":",
"return",
"nextchar",
".",
"isspace",
"(",
")"
] | https://github.com/catboost/catboost/blob/167f64f237114a4d10b2b4ee42adb4569137debe/contrib/python/dateutil/dateutil/parser/_parser.py#L214-L216 | |
freesurfer/freesurfer | 6dbe527d43ffa611acb2cd112e9469f9bfec8e36 | cnn_sphere_register/ext/pynd-lib/pynd/ndutils.py | python | volsize2ndgrid | (volsize) | return ndgrid(*ranges) | return the dense nd-grid for the volume with size volsize
essentially return the ndgrid fpr | return the dense nd-grid for the volume with size volsize
essentially return the ndgrid fpr | [
"return",
"the",
"dense",
"nd",
"-",
"grid",
"for",
"the",
"volume",
"with",
"size",
"volsize",
"essentially",
"return",
"the",
"ndgrid",
"fpr"
] | def volsize2ndgrid(volsize):
"""
return the dense nd-grid for the volume with size volsize
essentially return the ndgrid fpr
"""
ranges = [np.arange(e) for e in volsize]
return ndgrid(*ranges) | [
"def",
"volsize2ndgrid",
"(",
"volsize",
")",
":",
"ranges",
"=",
"[",
"np",
".",
"arange",
"(",
"e",
")",
"for",
"e",
"in",
"volsize",
"]",
"return",
"ndgrid",
"(",
"*",
"ranges",
")"
] | https://github.com/freesurfer/freesurfer/blob/6dbe527d43ffa611acb2cd112e9469f9bfec8e36/cnn_sphere_register/ext/pynd-lib/pynd/ndutils.py#L163-L169 | |
catboost/catboost | 167f64f237114a4d10b2b4ee42adb4569137debe | contrib/python/scikit-learn/py2/sklearn/gaussian_process/kernels.py | python | CompoundKernel.theta | (self, theta) | Sets the (flattened, log-transformed) non-fixed hyperparameters.
Parameters
----------
theta : array, shape (n_dims,)
The non-fixed, log-transformed hyperparameters of the kernel | Sets the (flattened, log-transformed) non-fixed hyperparameters. | [
"Sets",
"the",
"(",
"flattened",
"log",
"-",
"transformed",
")",
"non",
"-",
"fixed",
"hyperparameters",
"."
] | def theta(self, theta):
"""Sets the (flattened, log-transformed) non-fixed hyperparameters.
Parameters
----------
theta : array, shape (n_dims,)
The non-fixed, log-transformed hyperparameters of the kernel
"""
k_dims = self.k1.n_dims
for i, kernel in ... | [
"def",
"theta",
"(",
"self",
",",
"theta",
")",
":",
"k_dims",
"=",
"self",
".",
"k1",
".",
"n_dims",
"for",
"i",
",",
"kernel",
"in",
"enumerate",
"(",
"self",
".",
"kernels",
")",
":",
"kernel",
".",
"theta",
"=",
"theta",
"[",
"i",
"*",
"k_dim... | https://github.com/catboost/catboost/blob/167f64f237114a4d10b2b4ee42adb4569137debe/contrib/python/scikit-learn/py2/sklearn/gaussian_process/kernels.py#L436-L446 | ||
Z3Prover/z3 | d745d03afdfdf638d66093e2bfbacaf87187f35b | src/api/python/z3/z3.py | python | SortRef.name | (self) | return _symbol2py(self.ctx, Z3_get_sort_name(self.ctx_ref(), self.ast)) | Return the name (string) of sort `self`.
>>> BoolSort().name()
'Bool'
>>> ArraySort(IntSort(), IntSort()).name()
'Array' | Return the name (string) of sort `self`. | [
"Return",
"the",
"name",
"(",
"string",
")",
"of",
"sort",
"self",
"."
] | def name(self):
"""Return the name (string) of sort `self`.
>>> BoolSort().name()
'Bool'
>>> ArraySort(IntSort(), IntSort()).name()
'Array'
"""
return _symbol2py(self.ctx, Z3_get_sort_name(self.ctx_ref(), self.ast)) | [
"def",
"name",
"(",
"self",
")",
":",
"return",
"_symbol2py",
"(",
"self",
".",
"ctx",
",",
"Z3_get_sort_name",
"(",
"self",
".",
"ctx_ref",
"(",
")",
",",
"self",
".",
"ast",
")",
")"
] | https://github.com/Z3Prover/z3/blob/d745d03afdfdf638d66093e2bfbacaf87187f35b/src/api/python/z3/z3.py#L607-L615 | |
catboost/catboost | 167f64f237114a4d10b2b4ee42adb4569137debe | contrib/tools/python3/src/Lib/logging/__init__.py | python | LoggerAdapter.log | (self, level, msg, *args, **kwargs) | Delegate a log call to the underlying logger, after adding
contextual information from this adapter instance. | Delegate a log call to the underlying logger, after adding
contextual information from this adapter instance. | [
"Delegate",
"a",
"log",
"call",
"to",
"the",
"underlying",
"logger",
"after",
"adding",
"contextual",
"information",
"from",
"this",
"adapter",
"instance",
"."
] | def log(self, level, msg, *args, **kwargs):
"""
Delegate a log call to the underlying logger, after adding
contextual information from this adapter instance.
"""
if self.isEnabledFor(level):
msg, kwargs = self.process(msg, kwargs)
self.logger.log(level, ms... | [
"def",
"log",
"(",
"self",
",",
"level",
",",
"msg",
",",
"*",
"args",
",",
"*",
"*",
"kwargs",
")",
":",
"if",
"self",
".",
"isEnabledFor",
"(",
"level",
")",
":",
"msg",
",",
"kwargs",
"=",
"self",
".",
"process",
"(",
"msg",
",",
"kwargs",
"... | https://github.com/catboost/catboost/blob/167f64f237114a4d10b2b4ee42adb4569137debe/contrib/tools/python3/src/Lib/logging/__init__.py#L1837-L1844 | ||
mhammond/pywin32 | 44afd86ba8485194df93234639243252deeb40d5 | adodbapi/remote.py | python | Connection._rollback | (self) | In case a database does provide transactions this method causes the the database to roll back to
the start of any pending transaction. Closing a connection without committing the changes first will
cause an implicit rollback to be performed. | In case a database does provide transactions this method causes the the database to roll back to
the start of any pending transaction. Closing a connection without committing the changes first will
cause an implicit rollback to be performed. | [
"In",
"case",
"a",
"database",
"does",
"provide",
"transactions",
"this",
"method",
"causes",
"the",
"the",
"database",
"to",
"roll",
"back",
"to",
"the",
"start",
"of",
"any",
"pending",
"transaction",
".",
"Closing",
"a",
"connection",
"without",
"committing... | def _rollback(self):
"""In case a database does provide transactions this method causes the the database to roll back to
the start of any pending transaction. Closing a connection without committing the changes first will
cause an implicit rollback to be performed.
"""
result = s... | [
"def",
"_rollback",
"(",
"self",
")",
":",
"result",
"=",
"self",
".",
"proxy",
".",
"rollback",
"(",
")",
"if",
"result",
":",
"self",
".",
"_raiseConnectionError",
"(",
"api",
".",
"OperationalError",
",",
"\"Error during rollback: %s\"",
"%",
"result",
")... | https://github.com/mhammond/pywin32/blob/44afd86ba8485194df93234639243252deeb40d5/adodbapi/remote.py#L289-L298 | ||
hpi-xnor/BMXNet-v2 | af2b1859eafc5c721b1397cef02f946aaf2ce20d | example/kaggle-ndsb2/Train.py | python | encode_label | (label_data) | return systole_encode, diastole_encode | Run encoding to encode the label into the CDF target. | Run encoding to encode the label into the CDF target. | [
"Run",
"encoding",
"to",
"encode",
"the",
"label",
"into",
"the",
"CDF",
"target",
"."
] | def encode_label(label_data):
"""Run encoding to encode the label into the CDF target.
"""
systole = label_data[:, 1]
diastole = label_data[:, 2]
systole_encode = np.array([
(x < np.arange(600)) for x in systole
], dtype=np.uint8)
diastole_encode = np.array([
(x <... | [
"def",
"encode_label",
"(",
"label_data",
")",
":",
"systole",
"=",
"label_data",
"[",
":",
",",
"1",
"]",
"diastole",
"=",
"label_data",
"[",
":",
",",
"2",
"]",
"systole_encode",
"=",
"np",
".",
"array",
"(",
"[",
"(",
"x",
"<",
"np",
".",
"arang... | https://github.com/hpi-xnor/BMXNet-v2/blob/af2b1859eafc5c721b1397cef02f946aaf2ce20d/example/kaggle-ndsb2/Train.py#L69-L80 | |
windystrife/UnrealEngine_NVIDIAGameWorks | b50e6338a7c5b26374d66306ebc7807541ff815e | Engine/Extras/ThirdPartyNotUE/emsdk/Win64/python/2.7.5.3_64bit/Lib/site-packages/win32comext/axdebug/gateways.py | python | DebugStackFrame.GetLanguageString | (self) | Returns a short or long textual description of the language.
fLong -- A flag indicating if the long name is requested. | Returns a short or long textual description of the language. | [
"Returns",
"a",
"short",
"or",
"long",
"textual",
"description",
"of",
"the",
"language",
"."
] | def GetLanguageString(self):
"""Returns a short or long textual description of the language.
fLong -- A flag indicating if the long name is requested.
"""
RaiseNotImpl("GetLanguageString") | [
"def",
"GetLanguageString",
"(",
"self",
")",
":",
"RaiseNotImpl",
"(",
"\"GetLanguageString\"",
")"
] | https://github.com/windystrife/UnrealEngine_NVIDIAGameWorks/blob/b50e6338a7c5b26374d66306ebc7807541ff815e/Engine/Extras/ThirdPartyNotUE/emsdk/Win64/python/2.7.5.3_64bit/Lib/site-packages/win32comext/axdebug/gateways.py#L279-L284 | ||
CGRU/cgru | 1881a4128530e3d31ac6c25314c18314fc50c2c7 | afanasy/python/parsers/parser.py | python | parser.toHTMLline | (self, i_line) | return self.tagHTML(i_line) | Convert line to HTML.
Designed for GUIs for escape sequences, errors highlighting.
:param i_line: input line
:return: converted line | Convert line to HTML.
Designed for GUIs for escape sequences, errors highlighting.
:param i_line: input line
:return: converted line | [
"Convert",
"line",
"to",
"HTML",
".",
"Designed",
"for",
"GUIs",
"for",
"escape",
"sequences",
"errors",
"highlighting",
".",
":",
"param",
"i_line",
":",
"input",
"line",
":",
"return",
":",
"converted",
"line"
] | def toHTMLline(self, i_line):
""" Convert line to HTML.
Designed for GUIs for escape sequences, errors highlighting.
:param i_line: input line
:return: converted line
"""
self.parse({'data':i_line})
if self.error:
i_line = '<span style="backgroun... | [
"def",
"toHTMLline",
"(",
"self",
",",
"i_line",
")",
":",
"self",
".",
"parse",
"(",
"{",
"'data'",
":",
"i_line",
"}",
")",
"if",
"self",
".",
"error",
":",
"i_line",
"=",
"'<span style=\"background-color:#FF0000\"><b>'",
"+",
"i_line",
"+",
"'</b></span>'... | https://github.com/CGRU/cgru/blob/1881a4128530e3d31ac6c25314c18314fc50c2c7/afanasy/python/parsers/parser.py#L255-L277 | |
wxWidgets/wxPython-Classic | 19571e1ae65f1ac445f5491474121998c97a1bf0 | wx/tools/Editra/src/prefdlg.py | python | KeyBindingPanel.OnListBox | (self, evt) | Handle listbox selections and update binding display
@param evt: wx.CommandEvent | Handle listbox selections and update binding display
@param evt: wx.CommandEvent | [
"Handle",
"listbox",
"selections",
"and",
"update",
"binding",
"display",
"@param",
"evt",
":",
"wx",
".",
"CommandEvent"
] | def OnListBox(self, evt):
"""Handle listbox selections and update binding display
@param evt: wx.CommandEvent
"""
if evt.GetId() == ID_MENU_ITEMS:
sel_idx = evt.GetSelection()
cmenu = self.FindWindowById(ID_MENUS).GetStringSelection()
menu_id = self.m... | [
"def",
"OnListBox",
"(",
"self",
",",
"evt",
")",
":",
"if",
"evt",
".",
"GetId",
"(",
")",
"==",
"ID_MENU_ITEMS",
":",
"sel_idx",
"=",
"evt",
".",
"GetSelection",
"(",
")",
"cmenu",
"=",
"self",
".",
"FindWindowById",
"(",
"ID_MENUS",
")",
".",
"Get... | https://github.com/wxWidgets/wxPython-Classic/blob/19571e1ae65f1ac445f5491474121998c97a1bf0/wx/tools/Editra/src/prefdlg.py#L2059-L2071 | ||
PlatformLab/RAMCloud | b1866af19124325a6dfd8cbc267e2e3ef1f965d1 | cpplint.py | python | CheckForCopyright | (filename, lines, error) | Logs an error if no Copyright message appears at the top of the file. | Logs an error if no Copyright message appears at the top of the file. | [
"Logs",
"an",
"error",
"if",
"no",
"Copyright",
"message",
"appears",
"at",
"the",
"top",
"of",
"the",
"file",
"."
] | def CheckForCopyright(filename, lines, error):
"""Logs an error if no Copyright message appears at the top of the file."""
# We'll say it should occur by line 10. Don't forget there's a
# dummy line at the front.
for line in xrange(1, min(len(lines), 11)):
if re.search(r'Copyright', lines[line], re.I): bre... | [
"def",
"CheckForCopyright",
"(",
"filename",
",",
"lines",
",",
"error",
")",
":",
"# We'll say it should occur by line 10. Don't forget there's a",
"# dummy line at the front.",
"for",
"line",
"in",
"xrange",
"(",
"1",
",",
"min",
"(",
"len",
"(",
"lines",
")",
","... | https://github.com/PlatformLab/RAMCloud/blob/b1866af19124325a6dfd8cbc267e2e3ef1f965d1/cpplint.py#L952-L962 | ||
Xilinx/Vitis-AI | fc74d404563d9951b57245443c73bef389f3657f | tools/Vitis-AI-Quantizer/vai_q_tensorflow1.x/tensorflow/contrib/cudnn_rnn/python/layers/cudnn_rnn.py | python | _CudnnRNN.call | (self,
inputs,
initial_state=None,
sequence_lengths=None,
time_major=True,
training=True) | Runs the forward step for the RNN model.
Args:
inputs: `3-D` tensor. If `time_major` is True (default), the Tensor shape
is [time_len, batch_size, input_size]. If `time_major` is False, the
shape is [batch_size, time_len, input_size].
initial_state: a tuple of tensor(s) of shape `[num_l... | Runs the forward step for the RNN model. | [
"Runs",
"the",
"forward",
"step",
"for",
"the",
"RNN",
"model",
"."
] | def call(self,
inputs,
initial_state=None,
sequence_lengths=None,
time_major=True,
training=True):
"""Runs the forward step for the RNN model.
Args:
inputs: `3-D` tensor. If `time_major` is True (default), the Tensor shape
is [time_len, batch... | [
"def",
"call",
"(",
"self",
",",
"inputs",
",",
"initial_state",
"=",
"None",
",",
"sequence_lengths",
"=",
"None",
",",
"time_major",
"=",
"True",
",",
"training",
"=",
"True",
")",
":",
"if",
"initial_state",
"is",
"not",
"None",
"and",
"not",
"isinsta... | https://github.com/Xilinx/Vitis-AI/blob/fc74d404563d9951b57245443c73bef389f3657f/tools/Vitis-AI-Quantizer/vai_q_tensorflow1.x/tensorflow/contrib/cudnn_rnn/python/layers/cudnn_rnn.py#L381-L444 | ||
esphome/esphome | 40e06c9819f17409615d4f4eec5cfe4dc9a3776d | esphome/config_validation.py | python | hex_int_range | (min=None, max=None, min_included=True, max_included=True) | return All(
hex_int,
Range(min=min, max=max, min_included=min_included, max_included=max_included),
) | Validate that the config option is an integer in the given range. | Validate that the config option is an integer in the given range. | [
"Validate",
"that",
"the",
"config",
"option",
"is",
"an",
"integer",
"in",
"the",
"given",
"range",
"."
] | def hex_int_range(min=None, max=None, min_included=True, max_included=True):
"""Validate that the config option is an integer in the given range."""
return All(
hex_int,
Range(min=min, max=max, min_included=min_included, max_included=max_included),
) | [
"def",
"hex_int_range",
"(",
"min",
"=",
"None",
",",
"max",
"=",
"None",
",",
"min_included",
"=",
"True",
",",
"max_included",
"=",
"True",
")",
":",
"return",
"All",
"(",
"hex_int",
",",
"Range",
"(",
"min",
"=",
"min",
",",
"max",
"=",
"max",
"... | https://github.com/esphome/esphome/blob/40e06c9819f17409615d4f4eec5cfe4dc9a3776d/esphome/config_validation.py#L397-L402 | |
NetSys/bess | ae52fc5804290fc3116daf2aef52226fafcedf5d | bin/dpdk-devbind.py | python | get_device_details | (devices_type) | This function populates the "devices" dictionary. The keys used are
the pci addresses (domain:bus:slot.func). The values are themselves
dictionaries - one for each NIC. | This function populates the "devices" dictionary. The keys used are
the pci addresses (domain:bus:slot.func). The values are themselves
dictionaries - one for each NIC. | [
"This",
"function",
"populates",
"the",
"devices",
"dictionary",
".",
"The",
"keys",
"used",
"are",
"the",
"pci",
"addresses",
"(",
"domain",
":",
"bus",
":",
"slot",
".",
"func",
")",
".",
"The",
"values",
"are",
"themselves",
"dictionaries",
"-",
"one",
... | def get_device_details(devices_type):
'''This function populates the "devices" dictionary. The keys used are
the pci addresses (domain:bus:slot.func). The values are themselves
dictionaries - one for each NIC.'''
global devices
global dpdk_drivers
# first loop through and read details for all d... | [
"def",
"get_device_details",
"(",
"devices_type",
")",
":",
"global",
"devices",
"global",
"dpdk_drivers",
"# first loop through and read details for all devices",
"# request machine readable format, with numeric IDs and String",
"dev",
"=",
"{",
"}",
"dev_lines",
"=",
"check_out... | https://github.com/NetSys/bess/blob/ae52fc5804290fc3116daf2aef52226fafcedf5d/bin/dpdk-devbind.py#L263-L339 | ||
hpi-xnor/BMXNet | ed0b201da6667887222b8e4b5f997c4f6b61943d | python/mxnet/registry.py | python | get_create_func | (base_class, nickname) | return create | Get creator function
Parameters
----------
base_class : type
base class for classes that will be reigstered
nickname : str
nickname of base_class for logging
Returns
-------
a creator function | Get creator function | [
"Get",
"creator",
"function"
] | def get_create_func(base_class, nickname):
"""Get creator function
Parameters
----------
base_class : type
base class for classes that will be reigstered
nickname : str
nickname of base_class for logging
Returns
-------
a creator function
"""
if base_class not i... | [
"def",
"get_create_func",
"(",
"base_class",
",",
"nickname",
")",
":",
"if",
"base_class",
"not",
"in",
"_REGISTRY",
":",
"_REGISTRY",
"[",
"base_class",
"]",
"=",
"{",
"}",
"registry",
"=",
"_REGISTRY",
"[",
"base_class",
"]",
"def",
"create",
"(",
"*",
... | https://github.com/hpi-xnor/BMXNet/blob/ed0b201da6667887222b8e4b5f997c4f6b61943d/python/mxnet/registry.py#L97-L158 | |
networkit/networkit | 695b7a786a894a303fa8587597d5ef916e797729 | networkit/GEXFIO.py | python | GEXFWriter.write | (self, graph, fname, eventStream = [], mapping = []) | Writes a NetworKit::Graph to the specified file fname.
Parameters:
-----------
graph: a NetworKit::Graph python object
fname: the desired file path and name to be written to
eventStream: stream of events
mapping: random node mapping | Writes a NetworKit::Graph to the specified file fname.
Parameters:
-----------
graph: a NetworKit::Graph python object
fname: the desired file path and name to be written to
eventStream: stream of events
mapping: random node mapping | [
"Writes",
"a",
"NetworKit",
"::",
"Graph",
"to",
"the",
"specified",
"file",
"fname",
".",
"Parameters",
":",
"-----------",
"graph",
":",
"a",
"NetworKit",
"::",
"Graph",
"python",
"object",
"fname",
":",
"the",
"desired",
"file",
"path",
"and",
"name",
"... | def write(self, graph, fname, eventStream = [], mapping = []):
"""
Writes a NetworKit::Graph to the specified file fname.
Parameters:
-----------
graph: a NetworKit::Graph python object
fname: the desired file path and name to be written to
eventStream: stream of events
mapping: random node mapping
... | [
"def",
"write",
"(",
"self",
",",
"graph",
",",
"fname",
",",
"eventStream",
"=",
"[",
"]",
",",
"mapping",
"=",
"[",
"]",
")",
":",
"#0. Reset internal vars",
"self",
".",
"__init__",
"(",
")",
"#1. Start with the root element and the right header information",
... | https://github.com/networkit/networkit/blob/695b7a786a894a303fa8587597d5ef916e797729/networkit/GEXFIO.py#L269-L358 | ||
wlanjie/AndroidFFmpeg | 7baf9122f4b8e1c74e7baf4be5c422c7a5ba5aaf | tools/fdk-aac-build/x86/toolchain/lib/python2.7/lib-tk/Tkinter.py | python | Canvas.coords | (self, *args) | return map(getdouble,
self.tk.splitlist(
self.tk.call((self._w, 'coords') + args))) | Return a list of coordinates for the item given in ARGS. | Return a list of coordinates for the item given in ARGS. | [
"Return",
"a",
"list",
"of",
"coordinates",
"for",
"the",
"item",
"given",
"in",
"ARGS",
"."
] | def coords(self, *args):
"""Return a list of coordinates for the item given in ARGS."""
# XXX Should use _flatten on args
return map(getdouble,
self.tk.splitlist(
self.tk.call((self._w, 'coords') + args))) | [
"def",
"coords",
"(",
"self",
",",
"*",
"args",
")",
":",
"# XXX Should use _flatten on args",
"return",
"map",
"(",
"getdouble",
",",
"self",
".",
"tk",
".",
"splitlist",
"(",
"self",
".",
"tk",
".",
"call",
"(",
"(",
"self",
".",
"_w",
",",
"'coords'... | https://github.com/wlanjie/AndroidFFmpeg/blob/7baf9122f4b8e1c74e7baf4be5c422c7a5ba5aaf/tools/fdk-aac-build/x86/toolchain/lib/python2.7/lib-tk/Tkinter.py#L2235-L2240 | |
aws/lumberyard | f85344403c1c2e77ec8c75deb2c116e97b713217 | dev/Tools/Python/3.7.10/linux_x64/lib/python3.7/_pydecimal.py | python | Decimal._compare_check_nans | (self, other, context) | return 0 | Version of _check_nans used for the signaling comparisons
compare_signal, __le__, __lt__, __ge__, __gt__.
Signal InvalidOperation if either self or other is a (quiet
or signaling) NaN. Signaling NaNs take precedence over quiet
NaNs.
Return 0 if neither operand is a NaN. | Version of _check_nans used for the signaling comparisons
compare_signal, __le__, __lt__, __ge__, __gt__. | [
"Version",
"of",
"_check_nans",
"used",
"for",
"the",
"signaling",
"comparisons",
"compare_signal",
"__le__",
"__lt__",
"__ge__",
"__gt__",
"."
] | def _compare_check_nans(self, other, context):
"""Version of _check_nans used for the signaling comparisons
compare_signal, __le__, __lt__, __ge__, __gt__.
Signal InvalidOperation if either self or other is a (quiet
or signaling) NaN. Signaling NaNs take precedence over quiet
N... | [
"def",
"_compare_check_nans",
"(",
"self",
",",
"other",
",",
"context",
")",
":",
"if",
"context",
"is",
"None",
":",
"context",
"=",
"getcontext",
"(",
")",
"if",
"self",
".",
"_is_special",
"or",
"other",
".",
"_is_special",
":",
"if",
"self",
".",
... | https://github.com/aws/lumberyard/blob/f85344403c1c2e77ec8c75deb2c116e97b713217/dev/Tools/Python/3.7.10/linux_x64/lib/python3.7/_pydecimal.py#L777-L808 | |
Xilinx/Vitis-AI | fc74d404563d9951b57245443c73bef389f3657f | tools/Vitis-AI-Quantizer/vai_q_tensorflow1.x/tensorflow/contrib/layers/python/layers/feature_column.py | python | _BucketizedColumn.length | (self) | return len(self.boundaries) + 1 | Returns total number of buckets. | Returns total number of buckets. | [
"Returns",
"total",
"number",
"of",
"buckets",
"."
] | def length(self):
"""Returns total number of buckets."""
return len(self.boundaries) + 1 | [
"def",
"length",
"(",
"self",
")",
":",
"return",
"len",
"(",
"self",
".",
"boundaries",
")",
"+",
"1"
] | https://github.com/Xilinx/Vitis-AI/blob/fc74d404563d9951b57245443c73bef389f3657f/tools/Vitis-AI-Quantizer/vai_q_tensorflow1.x/tensorflow/contrib/layers/python/layers/feature_column.py#L2100-L2102 | |
catboost/catboost | 167f64f237114a4d10b2b4ee42adb4569137debe | contrib/python/pandas/py2/pandas/core/arrays/categorical.py | python | Categorical.as_ordered | (self, inplace=False) | return self.set_ordered(True, inplace=inplace) | Set the Categorical to be ordered.
Parameters
----------
inplace : boolean (default: False)
Whether or not to set the ordered attribute inplace or return a copy
of this categorical with ordered set to True | Set the Categorical to be ordered. | [
"Set",
"the",
"Categorical",
"to",
"be",
"ordered",
"."
] | def as_ordered(self, inplace=False):
"""
Set the Categorical to be ordered.
Parameters
----------
inplace : boolean (default: False)
Whether or not to set the ordered attribute inplace or return a copy
of this categorical with ordered set to True
""... | [
"def",
"as_ordered",
"(",
"self",
",",
"inplace",
"=",
"False",
")",
":",
"inplace",
"=",
"validate_bool_kwarg",
"(",
"inplace",
",",
"'inplace'",
")",
"return",
"self",
".",
"set_ordered",
"(",
"True",
",",
"inplace",
"=",
"inplace",
")"
] | https://github.com/catboost/catboost/blob/167f64f237114a4d10b2b4ee42adb4569137debe/contrib/python/pandas/py2/pandas/core/arrays/categorical.py#L759-L770 | |
wxWidgets/wxPython-Classic | 19571e1ae65f1ac445f5491474121998c97a1bf0 | src/osx_cocoa/_windows.py | python | PageSetupDialogData.SetDefaultMinMargins | (*args, **kwargs) | return _windows_.PageSetupDialogData_SetDefaultMinMargins(*args, **kwargs) | SetDefaultMinMargins(self, bool flag) | SetDefaultMinMargins(self, bool flag) | [
"SetDefaultMinMargins",
"(",
"self",
"bool",
"flag",
")"
] | def SetDefaultMinMargins(*args, **kwargs):
"""SetDefaultMinMargins(self, bool flag)"""
return _windows_.PageSetupDialogData_SetDefaultMinMargins(*args, **kwargs) | [
"def",
"SetDefaultMinMargins",
"(",
"*",
"args",
",",
"*",
"*",
"kwargs",
")",
":",
"return",
"_windows_",
".",
"PageSetupDialogData_SetDefaultMinMargins",
"(",
"*",
"args",
",",
"*",
"*",
"kwargs",
")"
] | https://github.com/wxWidgets/wxPython-Classic/blob/19571e1ae65f1ac445f5491474121998c97a1bf0/src/osx_cocoa/_windows.py#L4951-L4953 | |
llvm-mirror/libcxx | 78d6a7767ed57b50122a161b91f59f19c9bd0d19 | utils/google-benchmark/mingw.py | python | root | (location = None, arch = None, version = None, threading = None,
exceptions = None, revision = None, log = EmptyLogger()) | return root_dir | Returns the root folder of a specific version of the mingw-builds variant
of gcc. Will download the compiler if needed | Returns the root folder of a specific version of the mingw-builds variant
of gcc. Will download the compiler if needed | [
"Returns",
"the",
"root",
"folder",
"of",
"a",
"specific",
"version",
"of",
"the",
"mingw",
"-",
"builds",
"variant",
"of",
"gcc",
".",
"Will",
"download",
"the",
"compiler",
"if",
"needed"
] | def root(location = None, arch = None, version = None, threading = None,
exceptions = None, revision = None, log = EmptyLogger()):
'''
Returns the root folder of a specific version of the mingw-builds variant
of gcc. Will download the compiler if needed
'''
# Get the repository if we don't ... | [
"def",
"root",
"(",
"location",
"=",
"None",
",",
"arch",
"=",
"None",
",",
"version",
"=",
"None",
",",
"threading",
"=",
"None",
",",
"exceptions",
"=",
"None",
",",
"revision",
"=",
"None",
",",
"log",
"=",
"EmptyLogger",
"(",
")",
")",
":",
"# ... | https://github.com/llvm-mirror/libcxx/blob/78d6a7767ed57b50122a161b91f59f19c9bd0d19/utils/google-benchmark/mingw.py#L172-L246 | |
catboost/catboost | 167f64f237114a4d10b2b4ee42adb4569137debe | contrib/python/scikit-learn/py3/sklearn/impute/_base.py | python | MissingIndicator.fit_transform | (self, X, y=None) | return imputer_mask | Generate missing values indicator for X.
Parameters
----------
X : {array-like, sparse matrix}, shape (n_samples, n_features)
The input data to complete.
Returns
-------
Xt : {ndarray or sparse matrix}, shape (n_samples, n_features) \
or (n_samples, ... | Generate missing values indicator for X. | [
"Generate",
"missing",
"values",
"indicator",
"for",
"X",
"."
] | def fit_transform(self, X, y=None):
"""Generate missing values indicator for X.
Parameters
----------
X : {array-like, sparse matrix}, shape (n_samples, n_features)
The input data to complete.
Returns
-------
Xt : {ndarray or sparse matrix}, shape (n... | [
"def",
"fit_transform",
"(",
"self",
",",
"X",
",",
"y",
"=",
"None",
")",
":",
"imputer_mask",
"=",
"self",
".",
"_fit",
"(",
"X",
",",
"y",
")",
"if",
"self",
".",
"features_",
".",
"size",
"<",
"self",
".",
"_n_features",
":",
"imputer_mask",
"=... | https://github.com/catboost/catboost/blob/167f64f237114a4d10b2b4ee42adb4569137debe/contrib/python/scikit-learn/py3/sklearn/impute/_base.py#L697-L718 | |
wlanjie/AndroidFFmpeg | 7baf9122f4b8e1c74e7baf4be5c422c7a5ba5aaf | tools/fdk-aac-build/armeabi/toolchain/lib/python2.7/lib-tk/turtle.py | python | __methods | (cls) | return _dict.keys() | helper function for Scrolled Canvas | helper function for Scrolled Canvas | [
"helper",
"function",
"for",
"Scrolled",
"Canvas"
] | def __methods(cls):
"""helper function for Scrolled Canvas"""
_dict = {}
__methodDict(cls, _dict)
return _dict.keys() | [
"def",
"__methods",
"(",
"cls",
")",
":",
"_dict",
"=",
"{",
"}",
"__methodDict",
"(",
"cls",
",",
"_dict",
")",
"return",
"_dict",
".",
"keys",
"(",
")"
] | https://github.com/wlanjie/AndroidFFmpeg/blob/7baf9122f4b8e1c74e7baf4be5c422c7a5ba5aaf/tools/fdk-aac-build/armeabi/toolchain/lib/python2.7/lib-tk/turtle.py#L318-L322 | |
catboost/catboost | 167f64f237114a4d10b2b4ee42adb4569137debe | contrib/python/tornado/tornado-6/tornado/httputil.py | python | HTTPServerConnectionDelegate.start_request | (
self, server_conn: object, request_conn: "HTTPConnection"
) | This method is called by the server when a new request has started.
:arg server_conn: is an opaque object representing the long-lived
(e.g. tcp-level) connection.
:arg request_conn: is a `.HTTPConnection` object for a single
request/response exchange.
This method should... | This method is called by the server when a new request has started. | [
"This",
"method",
"is",
"called",
"by",
"the",
"server",
"when",
"a",
"new",
"request",
"has",
"started",
"."
] | def start_request(
self, server_conn: object, request_conn: "HTTPConnection"
) -> "HTTPMessageDelegate":
"""This method is called by the server when a new request has started.
:arg server_conn: is an opaque object representing the long-lived
(e.g. tcp-level) connection.
... | [
"def",
"start_request",
"(",
"self",
",",
"server_conn",
":",
"object",
",",
"request_conn",
":",
"\"HTTPConnection\"",
")",
"->",
"\"HTTPMessageDelegate\"",
":",
"raise",
"NotImplementedError",
"(",
")"
] | https://github.com/catboost/catboost/blob/167f64f237114a4d10b2b4ee42adb4569137debe/contrib/python/tornado/tornado-6/tornado/httputil.py#L494-L506 | ||
0vercl0k/rp | 5fe693c26d76b514efaedb4084f6e37d820db023 | src/third_party/fmt/support/docopt.py | python | parse_long | (tokens, options) | return [o] | long ::= '--' chars [ ( ' ' | '=' ) chars ] ; | long ::= '--' chars [ ( ' ' | '=' ) chars ] ; | [
"long",
"::",
"=",
"--",
"chars",
"[",
"(",
"|",
"=",
")",
"chars",
"]",
";"
] | def parse_long(tokens, options):
"""long ::= '--' chars [ ( ' ' | '=' ) chars ] ;"""
long, eq, value = tokens.move().partition('=')
assert long.startswith('--')
value = None if eq == value == '' else value
similar = [o for o in options if o.long == long]
if tokens.error is DocoptExit and similar... | [
"def",
"parse_long",
"(",
"tokens",
",",
"options",
")",
":",
"long",
",",
"eq",
",",
"value",
"=",
"tokens",
".",
"move",
"(",
")",
".",
"partition",
"(",
"'='",
")",
"assert",
"long",
".",
"startswith",
"(",
"'--'",
")",
"value",
"=",
"None",
"if... | https://github.com/0vercl0k/rp/blob/5fe693c26d76b514efaedb4084f6e37d820db023/src/third_party/fmt/support/docopt.py#L301-L331 | |
PaddlePaddle/Paddle | 1252f4bb3e574df80aa6d18c7ddae1b3a90bd81c | python/paddle/fluid/dygraph/checkpoint.py | python | save_dygraph | (state_dict, model_path) | :api_attr: imperative
Save Layer's state_dict to disk. This will generate a file with suffix ".pdparams"
The state_dict is get from Layers.state_dict function
Args:
state_dict(dict) : The state dict to be saved.
model_path(str) : the file prefix to save the state_dict. The format ... | :api_attr: imperative | [
":",
"api_attr",
":",
"imperative"
] | def save_dygraph(state_dict, model_path):
'''
:api_attr: imperative
Save Layer's state_dict to disk. This will generate a file with suffix ".pdparams"
The state_dict is get from Layers.state_dict function
Args:
state_dict(dict) : The state dict to be saved.
model_path(str)... | [
"def",
"save_dygraph",
"(",
"state_dict",
",",
"model_path",
")",
":",
"base_name",
"=",
"os",
".",
"path",
".",
"basename",
"(",
"model_path",
")",
"assert",
"base_name",
"!=",
"\"\"",
",",
"\"The input model_path MUST be format of dirname/filename [dirname\\\\filename... | https://github.com/PaddlePaddle/Paddle/blob/1252f4bb3e574df80aa6d18c7ddae1b3a90bd81c/python/paddle/fluid/dygraph/checkpoint.py#L55-L119 | ||
aws/lumberyard | f85344403c1c2e77ec8c75deb2c116e97b713217 | dev/Tools/AWSPythonSDK/1.5.8/docutils/parsers/rst/states.py | python | Text.text | (self, match, context, next_state) | return [], next_state, [] | Paragraph. | Paragraph. | [
"Paragraph",
"."
] | def text(self, match, context, next_state):
"""Paragraph."""
startline = self.state_machine.abs_line_number() - 1
msg = None
try:
block = self.state_machine.get_text_block(flush_left=True)
except statemachine.UnexpectedIndentationError, err:
block, src, sr... | [
"def",
"text",
"(",
"self",
",",
"match",
",",
"context",
",",
"next_state",
")",
":",
"startline",
"=",
"self",
".",
"state_machine",
".",
"abs_line_number",
"(",
")",
"-",
"1",
"msg",
"=",
"None",
"try",
":",
"block",
"=",
"self",
".",
"state_machine... | https://github.com/aws/lumberyard/blob/f85344403c1c2e77ec8c75deb2c116e97b713217/dev/Tools/AWSPythonSDK/1.5.8/docutils/parsers/rst/states.py#L2756-L2776 | |
aws/lumberyard | f85344403c1c2e77ec8c75deb2c116e97b713217 | dev/Gems/CloudGemMetric/v1/AWS/common-code/Lib/numba/runtime/context.py | python | NRTContext.eh_check | (self, builder) | return has_raised | Check if an exception is raised | Check if an exception is raised | [
"Check",
"if",
"an",
"exception",
"is",
"raised"
] | def eh_check(self, builder):
"""Check if an exception is raised
"""
ctx = self._context
cc = ctx.call_conv
# Inspect the excinfo argument on the function
trystatus = cc.check_try_status(builder)
excinfo = trystatus.excinfo
has_raised = builder.not_(cgutils... | [
"def",
"eh_check",
"(",
"self",
",",
"builder",
")",
":",
"ctx",
"=",
"self",
".",
"_context",
"cc",
"=",
"ctx",
".",
"call_conv",
"# Inspect the excinfo argument on the function",
"trystatus",
"=",
"cc",
".",
"check_try_status",
"(",
"builder",
")",
"excinfo",
... | https://github.com/aws/lumberyard/blob/f85344403c1c2e77ec8c75deb2c116e97b713217/dev/Gems/CloudGemMetric/v1/AWS/common-code/Lib/numba/runtime/context.py#L238-L249 | |
protocolbuffers/protobuf | b5ab0b7a18b7336c60130f4ddb2d97c51792f896 | python/mox.py | python | MockAnything._Reset | (self) | Reset the state of this mock to record mode with an empty queue. | Reset the state of this mock to record mode with an empty queue. | [
"Reset",
"the",
"state",
"of",
"this",
"mock",
"to",
"record",
"mode",
"with",
"an",
"empty",
"queue",
"."
] | def _Reset(self):
"""Reset the state of this mock to record mode with an empty queue."""
# Maintain a list of method calls we are expecting
self._expected_calls_queue = deque()
# Make sure we are in setup mode, not replay mode
self._replay_mode = False | [
"def",
"_Reset",
"(",
"self",
")",
":",
"# Maintain a list of method calls we are expecting",
"self",
".",
"_expected_calls_queue",
"=",
"deque",
"(",
")",
"# Make sure we are in setup mode, not replay mode",
"self",
".",
"_replay_mode",
"=",
"False"
] | https://github.com/protocolbuffers/protobuf/blob/b5ab0b7a18b7336c60130f4ddb2d97c51792f896/python/mox.py#L349-L356 | ||
happynear/caffe-windows | 967eedf25009e334b7f6f933bb5e17aaaff5bef6 | scripts/cpp_lint.py | python | FindNextMatchingAngleBracket | (clean_lines, linenum, init_suffix) | return True | Find the corresponding > to close a template.
Args:
clean_lines: A CleansedLines instance containing the file.
linenum: Current line number.
init_suffix: Remainder of the current line after the initial <.
Returns:
True if a matching bracket exists. | Find the corresponding > to close a template. | [
"Find",
"the",
"corresponding",
">",
"to",
"close",
"a",
"template",
"."
] | def FindNextMatchingAngleBracket(clean_lines, linenum, init_suffix):
"""Find the corresponding > to close a template.
Args:
clean_lines: A CleansedLines instance containing the file.
linenum: Current line number.
init_suffix: Remainder of the current line after the initial <.
Returns:
True if a ... | [
"def",
"FindNextMatchingAngleBracket",
"(",
"clean_lines",
",",
"linenum",
",",
"init_suffix",
")",
":",
"line",
"=",
"init_suffix",
"nesting_stack",
"=",
"[",
"'<'",
"]",
"while",
"True",
":",
"# Find the next operator that can tell us whether < is used as an",
"# openin... | https://github.com/happynear/caffe-windows/blob/967eedf25009e334b7f6f933bb5e17aaaff5bef6/scripts/cpp_lint.py#L2521-L2587 | |
aws/lumberyard | f85344403c1c2e77ec8c75deb2c116e97b713217 | dev/Gems/CloudGemMetric/v1/AWS/common-code/Lib/numba/cuda/intrinsic_wrapper.py | python | all_sync | (mask, predicate) | return numba.cuda.vote_sync_intrinsic(mask, 0, predicate)[1] | If for all threads in the masked warp the predicate is true, then
a non-zero value is returned, otherwise 0 is returned. | If for all threads in the masked warp the predicate is true, then
a non-zero value is returned, otherwise 0 is returned. | [
"If",
"for",
"all",
"threads",
"in",
"the",
"masked",
"warp",
"the",
"predicate",
"is",
"true",
"then",
"a",
"non",
"-",
"zero",
"value",
"is",
"returned",
"otherwise",
"0",
"is",
"returned",
"."
] | def all_sync(mask, predicate):
"""
If for all threads in the masked warp the predicate is true, then
a non-zero value is returned, otherwise 0 is returned.
"""
return numba.cuda.vote_sync_intrinsic(mask, 0, predicate)[1] | [
"def",
"all_sync",
"(",
"mask",
",",
"predicate",
")",
":",
"return",
"numba",
".",
"cuda",
".",
"vote_sync_intrinsic",
"(",
"mask",
",",
"0",
",",
"predicate",
")",
"[",
"1",
"]"
] | https://github.com/aws/lumberyard/blob/f85344403c1c2e77ec8c75deb2c116e97b713217/dev/Gems/CloudGemMetric/v1/AWS/common-code/Lib/numba/cuda/intrinsic_wrapper.py#L7-L12 | |
mindspore-ai/mindspore | fb8fd3338605bb34fa5cea054e535a8b1d753fab | mindspore/python/mindspore/mindrecord/tools/mnist_to_mr.py | python | MnistToMR.run | (self) | return SUCCESS | Execute transformation from Mnist to MindRecord.
Returns:
MSRStatus, whether successfully written into MindRecord. | Execute transformation from Mnist to MindRecord. | [
"Execute",
"transformation",
"from",
"Mnist",
"to",
"MindRecord",
"."
] | def run(self):
"""
Execute transformation from Mnist to MindRecord.
Returns:
MSRStatus, whether successfully written into MindRecord.
"""
if not cv2:
raise ModuleNotFoundError("opencv-python module not found, please use pip install it.")
if self.... | [
"def",
"run",
"(",
"self",
")",
":",
"if",
"not",
"cv2",
":",
"raise",
"ModuleNotFoundError",
"(",
"\"opencv-python module not found, please use pip install it.\"",
")",
"if",
"self",
".",
"_transform_train",
"(",
")",
"==",
"FAILED",
":",
"return",
"FAILED",
"if"... | https://github.com/mindspore-ai/mindspore/blob/fb8fd3338605bb34fa5cea054e535a8b1d753fab/mindspore/python/mindspore/mindrecord/tools/mnist_to_mr.py#L223-L238 | |
eric612/MobileNet-YOLO | 69b4441cb3ec8d553fbdef788ad033e246f901bd | 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/eric612/MobileNet-YOLO/blob/69b4441cb3ec8d553fbdef788ad033e246f901bd/scripts/cpp_lint.py#L1171-L1184 | |
aws/lumberyard | f85344403c1c2e77ec8c75deb2c116e97b713217 | dev/Tools/Python/3.7.10/windows/Lib/collections/__init__.py | python | Counter.__isub__ | (self, other) | return self._keep_positive() | Inplace subtract counter, but keep only results with positive counts.
>>> c = Counter('abbbc')
>>> c -= Counter('bccd')
>>> c
Counter({'b': 2, 'a': 1}) | Inplace subtract counter, but keep only results with positive counts. | [
"Inplace",
"subtract",
"counter",
"but",
"keep",
"only",
"results",
"with",
"positive",
"counts",
"."
] | def __isub__(self, other):
'''Inplace subtract counter, but keep only results with positive counts.
>>> c = Counter('abbbc')
>>> c -= Counter('bccd')
>>> c
Counter({'b': 2, 'a': 1})
'''
for elem, count in other.items():
self[elem] -= count
re... | [
"def",
"__isub__",
"(",
"self",
",",
"other",
")",
":",
"for",
"elem",
",",
"count",
"in",
"other",
".",
"items",
"(",
")",
":",
"self",
"[",
"elem",
"]",
"-=",
"count",
"return",
"self",
".",
"_keep_positive",
"(",
")"
] | https://github.com/aws/lumberyard/blob/f85344403c1c2e77ec8c75deb2c116e97b713217/dev/Tools/Python/3.7.10/windows/Lib/collections/__init__.py#L838-L849 | |
blue-yonder/turbodbc | 3cccd0af637944cf566c6c295c92f23ba90deffa | python/turbodbc/cursor.py | python | Cursor.execute | (self, sql, parameters=None) | return self._execute() | Execute an SQL command or query
:param sql: A (unicode) string that contains the SQL command or query. If you would like to
use parameters, please use a question mark ``?`` at the location where the
parameter shall be inserted.
:param parameters: An iterable of parameter v... | Execute an SQL command or query | [
"Execute",
"an",
"SQL",
"command",
"or",
"query"
] | def execute(self, sql, parameters=None):
"""
Execute an SQL command or query
:param sql: A (unicode) string that contains the SQL command or query. If you would like to
use parameters, please use a question mark ``?`` at the location where the
parameter shall be in... | [
"def",
"execute",
"(",
"self",
",",
"sql",
",",
"parameters",
"=",
"None",
")",
":",
"self",
".",
"rowcount",
"=",
"-",
"1",
"self",
".",
"_assert_valid",
"(",
")",
"self",
".",
"impl",
".",
"prepare",
"(",
"sql",
")",
"if",
"parameters",
":",
"buf... | https://github.com/blue-yonder/turbodbc/blob/3cccd0af637944cf566c6c295c92f23ba90deffa/python/turbodbc/cursor.py#L118-L136 | |
gem5/gem5 | 141cc37c2d4b93959d4c249b8f7e6a8b2ef75338 | site_scons/gem5_scons/sources.py | python | with_all_tags | (*tags) | return SourceFilter(lambda env, stags: resolve_tags(env, tags) <= stags) | Return a list of sources with all of the supplied tags. | Return a list of sources with all of the supplied tags. | [
"Return",
"a",
"list",
"of",
"sources",
"with",
"all",
"of",
"the",
"supplied",
"tags",
"."
] | def with_all_tags(*tags):
'''Return a list of sources with all of the supplied tags.'''
return SourceFilter(lambda env, stags: resolve_tags(env, tags) <= stags) | [
"def",
"with_all_tags",
"(",
"*",
"tags",
")",
":",
"return",
"SourceFilter",
"(",
"lambda",
"env",
",",
"stags",
":",
"resolve_tags",
"(",
"env",
",",
"tags",
")",
"<=",
"stags",
")"
] | https://github.com/gem5/gem5/blob/141cc37c2d4b93959d4c249b8f7e6a8b2ef75338/site_scons/gem5_scons/sources.py#L143-L145 | |
WeitaoVan/L-GM-loss | 598582f0631bac876b3eeb8d6c4cd1d780269e03 | tensorflow/resnet_model.py | python | lgm_logits | (feat, num_classes, labels=None, alpha=0.1, lambda_=0.01) | return logits_with_margin, likelihood_reg_loss, means | The 3 input hyper-params are explained in the paper.\n
Support 2 modes: Train, Validation\n
(1)Train:\n
return logits, likelihood_reg_loss\n
(2)Validation:\n
Set labels=None\n
return logits\n | The 3 input hyper-params are explained in the paper.\n
Support 2 modes: Train, Validation\n
(1)Train:\n
return logits, likelihood_reg_loss\n
(2)Validation:\n
Set labels=None\n
return logits\n | [
"The",
"3",
"input",
"hyper",
"-",
"params",
"are",
"explained",
"in",
"the",
"paper",
".",
"\\",
"n",
"Support",
"2",
"modes",
":",
"Train",
"Validation",
"\\",
"n",
"(",
"1",
")",
"Train",
":",
"\\",
"n",
"return",
"logits",
"likelihood_reg_loss",
"\... | def lgm_logits(feat, num_classes, labels=None, alpha=0.1, lambda_=0.01):
'''
The 3 input hyper-params are explained in the paper.\n
Support 2 modes: Train, Validation\n
(1)Train:\n
return logits, likelihood_reg_loss\n
(2)Validation:\n
Set labels=None\n
return logits\n
'''
N = feat.get_shape().as_lis... | [
"def",
"lgm_logits",
"(",
"feat",
",",
"num_classes",
",",
"labels",
"=",
"None",
",",
"alpha",
"=",
"0.1",
",",
"lambda_",
"=",
"0.01",
")",
":",
"N",
"=",
"feat",
".",
"get_shape",
"(",
")",
".",
"as_list",
"(",
")",
"[",
"0",
"]",
"feat_len",
... | https://github.com/WeitaoVan/L-GM-loss/blob/598582f0631bac876b3eeb8d6c4cd1d780269e03/tensorflow/resnet_model.py#L436-L472 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.