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 |
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
ApolloAuto/apollo-platform | 86d9dc6743b496ead18d597748ebabd34a513289 | ros/third_party/lib_x86_64/python2.7/dist-packages/numpy/lib/scimath.py | python | logn | (n, x) | return nx.log(x)/nx.log(n) | Take log base n of x.
If `x` contains negative inputs, the answer is computed and returned in the
complex domain.
Parameters
----------
n : int
The base in which the log is taken.
x : array_like
The value(s) whose log base `n` is (are) required.
Returns
-------
out : ndarray or scalar
The log base `n` of the `x` value(s). If `x` was a scalar, so is
`out`, otherwise an array is returned.
Examples
--------
>>> np.set_printoptions(precision=4)
>>> np.lib.scimath.logn(2, [4, 8])
array([ 2., 3.])
>>> np.lib.scimath.logn(2, [-4, -8, 8])
array([ 2.+4.5324j, 3.+4.5324j, 3.+0.j ]) | Take log base n of x. | [
"Take",
"log",
"base",
"n",
"of",
"x",
"."
] | def logn(n, x):
"""
Take log base n of x.
If `x` contains negative inputs, the answer is computed and returned in the
complex domain.
Parameters
----------
n : int
The base in which the log is taken.
x : array_like
The value(s) whose log base `n` is (are) required.
Returns
-------
out : ndarray or scalar
The log base `n` of the `x` value(s). If `x` was a scalar, so is
`out`, otherwise an array is returned.
Examples
--------
>>> np.set_printoptions(precision=4)
>>> np.lib.scimath.logn(2, [4, 8])
array([ 2., 3.])
>>> np.lib.scimath.logn(2, [-4, -8, 8])
array([ 2.+4.5324j, 3.+4.5324j, 3.+0.j ])
"""
x = _fix_real_lt_zero(x)
n = _fix_real_lt_zero(n)
return nx.log(x)/nx.log(n) | [
"def",
"logn",
"(",
"n",
",",
"x",
")",
":",
"x",
"=",
"_fix_real_lt_zero",
"(",
"x",
")",
"n",
"=",
"_fix_real_lt_zero",
"(",
"n",
")",
"return",
"nx",
".",
"log",
"(",
"x",
")",
"/",
"nx",
".",
"log",
"(",
"n",
")"
] | https://github.com/ApolloAuto/apollo-platform/blob/86d9dc6743b496ead18d597748ebabd34a513289/ros/third_party/lib_x86_64/python2.7/dist-packages/numpy/lib/scimath.py#L306-L338 | |
windystrife/UnrealEngine_NVIDIAGameWorks | b50e6338a7c5b26374d66306ebc7807541ff815e | Engine/Extras/ThirdPartyNotUE/emsdk/Win64/python/2.7.5.3_64bit/Lib/decimal.py | python | Context.shift | (self, a, b) | return a.shift(b, context=self) | Returns a shifted copy of a, b times.
The coefficient of the result is a shifted copy of the digits
in the coefficient of the first operand. The number of places
to shift is taken from the absolute value of the second operand,
with the shift being to the left if the second operand is
positive or to the right otherwise. Digits shifted into the
coefficient are zeros.
>>> ExtendedContext.shift(Decimal('34'), Decimal('8'))
Decimal('400000000')
>>> ExtendedContext.shift(Decimal('12'), Decimal('9'))
Decimal('0')
>>> ExtendedContext.shift(Decimal('123456789'), Decimal('-2'))
Decimal('1234567')
>>> ExtendedContext.shift(Decimal('123456789'), Decimal('0'))
Decimal('123456789')
>>> ExtendedContext.shift(Decimal('123456789'), Decimal('+2'))
Decimal('345678900')
>>> ExtendedContext.shift(88888888, 2)
Decimal('888888800')
>>> ExtendedContext.shift(Decimal(88888888), 2)
Decimal('888888800')
>>> ExtendedContext.shift(88888888, Decimal(2))
Decimal('888888800') | Returns a shifted copy of a, b times. | [
"Returns",
"a",
"shifted",
"copy",
"of",
"a",
"b",
"times",
"."
] | def shift(self, a, b):
"""Returns a shifted copy of a, b times.
The coefficient of the result is a shifted copy of the digits
in the coefficient of the first operand. The number of places
to shift is taken from the absolute value of the second operand,
with the shift being to the left if the second operand is
positive or to the right otherwise. Digits shifted into the
coefficient are zeros.
>>> ExtendedContext.shift(Decimal('34'), Decimal('8'))
Decimal('400000000')
>>> ExtendedContext.shift(Decimal('12'), Decimal('9'))
Decimal('0')
>>> ExtendedContext.shift(Decimal('123456789'), Decimal('-2'))
Decimal('1234567')
>>> ExtendedContext.shift(Decimal('123456789'), Decimal('0'))
Decimal('123456789')
>>> ExtendedContext.shift(Decimal('123456789'), Decimal('+2'))
Decimal('345678900')
>>> ExtendedContext.shift(88888888, 2)
Decimal('888888800')
>>> ExtendedContext.shift(Decimal(88888888), 2)
Decimal('888888800')
>>> ExtendedContext.shift(88888888, Decimal(2))
Decimal('888888800')
"""
a = _convert_other(a, raiseit=True)
return a.shift(b, context=self) | [
"def",
"shift",
"(",
"self",
",",
"a",
",",
"b",
")",
":",
"a",
"=",
"_convert_other",
"(",
"a",
",",
"raiseit",
"=",
"True",
")",
"return",
"a",
".",
"shift",
"(",
"b",
",",
"context",
"=",
"self",
")"
] | https://github.com/windystrife/UnrealEngine_NVIDIAGameWorks/blob/b50e6338a7c5b26374d66306ebc7807541ff815e/Engine/Extras/ThirdPartyNotUE/emsdk/Win64/python/2.7.5.3_64bit/Lib/decimal.py#L5255-L5283 | |
wxWidgets/wxPython-Classic | 19571e1ae65f1ac445f5491474121998c97a1bf0 | src/msw/_controls.py | python | TextCtrl.write | (*args, **kwargs) | return _controls_.TextCtrl_write(*args, **kwargs) | write(self, String text) | write(self, String text) | [
"write",
"(",
"self",
"String",
"text",
")"
] | def write(*args, **kwargs):
"""write(self, String text)"""
return _controls_.TextCtrl_write(*args, **kwargs) | [
"def",
"write",
"(",
"*",
"args",
",",
"*",
"*",
"kwargs",
")",
":",
"return",
"_controls_",
".",
"TextCtrl_write",
"(",
"*",
"args",
",",
"*",
"*",
"kwargs",
")"
] | https://github.com/wxWidgets/wxPython-Classic/blob/19571e1ae65f1ac445f5491474121998c97a1bf0/src/msw/_controls.py#L2059-L2061 | |
pmq20/node-packer | 12c46c6e44fbc14d9ee645ebd17d5296b324f7e0 | lts/tools/gyp/pylib/gyp/common.py | python | EnsureDirExists | (path) | Make sure the directory for |path| exists. | Make sure the directory for |path| exists. | [
"Make",
"sure",
"the",
"directory",
"for",
"|path|",
"exists",
"."
] | def EnsureDirExists(path):
"""Make sure the directory for |path| exists."""
try:
os.makedirs(os.path.dirname(path))
except OSError:
pass | [
"def",
"EnsureDirExists",
"(",
"path",
")",
":",
"try",
":",
"os",
".",
"makedirs",
"(",
"os",
".",
"path",
".",
"dirname",
"(",
"path",
")",
")",
"except",
"OSError",
":",
"pass"
] | https://github.com/pmq20/node-packer/blob/12c46c6e44fbc14d9ee645ebd17d5296b324f7e0/lts/tools/gyp/pylib/gyp/common.py#L415-L420 | ||
windystrife/UnrealEngine_NVIDIAGameWorks | b50e6338a7c5b26374d66306ebc7807541ff815e | Engine/Extras/ThirdPartyNotUE/emsdk/Win64/python/2.7.5.3_64bit/Lib/site-packages/pkg_resources.py | python | Environment.__iter__ | (self) | Yield the unique project names of the available distributions | Yield the unique project names of the available distributions | [
"Yield",
"the",
"unique",
"project",
"names",
"of",
"the",
"available",
"distributions"
] | def __iter__(self):
"""Yield the unique project names of the available distributions"""
for key in self._distmap.keys():
if self[key]: yield key | [
"def",
"__iter__",
"(",
"self",
")",
":",
"for",
"key",
"in",
"self",
".",
"_distmap",
".",
"keys",
"(",
")",
":",
"if",
"self",
"[",
"key",
"]",
":",
"yield",
"key"
] | https://github.com/windystrife/UnrealEngine_NVIDIAGameWorks/blob/b50e6338a7c5b26374d66306ebc7807541ff815e/Engine/Extras/ThirdPartyNotUE/emsdk/Win64/python/2.7.5.3_64bit/Lib/site-packages/pkg_resources.py#L820-L823 | ||
eclipse/sumo | 7132a9b8b6eea734bdec38479026b4d8c4336d03 | tools/contributed/sumopy/coremodules/demand/origin_to_destination_wxgui.py | python | OdFlowsWxGuiMixin.on_clear_odtrips | (self, event=None) | Generates trips from origin to destination zone from current OD matrices. | Generates trips from origin to destination zone from current OD matrices. | [
"Generates",
"trips",
"from",
"origin",
"to",
"destination",
"zone",
"from",
"current",
"OD",
"matrices",
"."
] | def on_clear_odtrips(self, event=None):
"""
Generates trips from origin to destination zone from current OD matrices.
"""
self._demand.odintervals.clear_od_trips()
self._mainframe.browse_obj(self._demand.odintervals) | [
"def",
"on_clear_odtrips",
"(",
"self",
",",
"event",
"=",
"None",
")",
":",
"self",
".",
"_demand",
".",
"odintervals",
".",
"clear_od_trips",
"(",
")",
"self",
".",
"_mainframe",
".",
"browse_obj",
"(",
"self",
".",
"_demand",
".",
"odintervals",
")"
] | https://github.com/eclipse/sumo/blob/7132a9b8b6eea734bdec38479026b4d8c4336d03/tools/contributed/sumopy/coremodules/demand/origin_to_destination_wxgui.py#L268-L273 | ||
catboost/catboost | 167f64f237114a4d10b2b4ee42adb4569137debe | contrib/python/scikit-learn/py3/sklearn/utils/estimator_checks.py | python | check_estimator | (Estimator, generate_only=False) | Check if estimator adheres to scikit-learn conventions.
This estimator will run an extensive test-suite for input validation,
shapes, etc.
Additional tests for classifiers, regressors, clustering or transformers
will be run if the Estimator class inherits from the corresponding mixin
from sklearn.base.
This test can be applied to classes or instances.
Classes currently have some additional tests that related to construction,
while passing instances allows the testing of multiple options.
Read more in :ref:`rolling_your_own_estimator`.
Parameters
----------
estimator : estimator object or class
Estimator to check. Estimator is a class object or instance.
generate_only : bool, optional (default=False)
When `False`, checks are evaluated when `check_estimator` is called.
When `True`, `check_estimator` returns a generator that yields
(estimator, check) tuples. The check is run by calling
`check(estimator)`.
.. versionadded:: 0.22
Returns
-------
checks_generator : generator
Generator that yields (estimator, check) tuples. Returned when
`generate_only=True`. | Check if estimator adheres to scikit-learn conventions. | [
"Check",
"if",
"estimator",
"adheres",
"to",
"scikit",
"-",
"learn",
"conventions",
"."
] | def check_estimator(Estimator, generate_only=False):
"""Check if estimator adheres to scikit-learn conventions.
This estimator will run an extensive test-suite for input validation,
shapes, etc.
Additional tests for classifiers, regressors, clustering or transformers
will be run if the Estimator class inherits from the corresponding mixin
from sklearn.base.
This test can be applied to classes or instances.
Classes currently have some additional tests that related to construction,
while passing instances allows the testing of multiple options.
Read more in :ref:`rolling_your_own_estimator`.
Parameters
----------
estimator : estimator object or class
Estimator to check. Estimator is a class object or instance.
generate_only : bool, optional (default=False)
When `False`, checks are evaluated when `check_estimator` is called.
When `True`, `check_estimator` returns a generator that yields
(estimator, check) tuples. The check is run by calling
`check(estimator)`.
.. versionadded:: 0.22
Returns
-------
checks_generator : generator
Generator that yields (estimator, check) tuples. Returned when
`generate_only=True`.
"""
if isinstance(Estimator, type):
# got a class
checks_generator = _generate_class_checks(Estimator)
else:
# got an instance
estimator = Estimator
name = type(estimator).__name__
checks_generator = _generate_instance_checks(name, estimator)
if generate_only:
return checks_generator
for estimator, check in checks_generator:
try:
check(estimator)
except SkipTest as exception:
# the only SkipTest thrown currently results from not
# being able to import pandas.
warnings.warn(str(exception), SkipTestWarning) | [
"def",
"check_estimator",
"(",
"Estimator",
",",
"generate_only",
"=",
"False",
")",
":",
"if",
"isinstance",
"(",
"Estimator",
",",
"type",
")",
":",
"# got a class",
"checks_generator",
"=",
"_generate_class_checks",
"(",
"Estimator",
")",
"else",
":",
"# got ... | https://github.com/catboost/catboost/blob/167f64f237114a4d10b2b4ee42adb4569137debe/contrib/python/scikit-learn/py3/sklearn/utils/estimator_checks.py#L379-L431 | ||
Komnomnomnom/swigibpy | cfd307fdbfaffabc69a2dc037538d7e34a8b8daf | swigibpy.py | python | EClient.cancelNewsBulletins | (self) | return _swigibpy.EClient_cancelNewsBulletins(self) | cancelNewsBulletins(EClient self) | cancelNewsBulletins(EClient self) | [
"cancelNewsBulletins",
"(",
"EClient",
"self",
")"
] | def cancelNewsBulletins(self):
"""cancelNewsBulletins(EClient self)"""
return _swigibpy.EClient_cancelNewsBulletins(self) | [
"def",
"cancelNewsBulletins",
"(",
"self",
")",
":",
"return",
"_swigibpy",
".",
"EClient_cancelNewsBulletins",
"(",
"self",
")"
] | https://github.com/Komnomnomnom/swigibpy/blob/cfd307fdbfaffabc69a2dc037538d7e34a8b8daf/swigibpy.py#L1180-L1182 | |
ApolloAuto/apollo-platform | 86d9dc6743b496ead18d597748ebabd34a513289 | ros/third_party/lib_aarch64/python2.7/dist-packages/rosdep2/main.py | python | str_to_bool | (s) | Maps a string to bool. Supports true/false, and yes/no, and is case-insensitive | Maps a string to bool. Supports true/false, and yes/no, and is case-insensitive | [
"Maps",
"a",
"string",
"to",
"bool",
".",
"Supports",
"true",
"/",
"false",
"and",
"yes",
"/",
"no",
"and",
"is",
"case",
"-",
"insensitive"
] | def str_to_bool(s):
"""Maps a string to bool. Supports true/false, and yes/no, and is case-insensitive"""
s = s.lower()
if s in ['yes', 'true']:
return True
elif s in ['no', 'false']:
return False
else:
raise UsageError("Cannot parse '%s' as boolean" % s) | [
"def",
"str_to_bool",
"(",
"s",
")",
":",
"s",
"=",
"s",
".",
"lower",
"(",
")",
"if",
"s",
"in",
"[",
"'yes'",
",",
"'true'",
"]",
":",
"return",
"True",
"elif",
"s",
"in",
"[",
"'no'",
",",
"'false'",
"]",
":",
"return",
"False",
"else",
":",... | https://github.com/ApolloAuto/apollo-platform/blob/86d9dc6743b496ead18d597748ebabd34a513289/ros/third_party/lib_aarch64/python2.7/dist-packages/rosdep2/main.py#L234-L242 | ||
tensorflow/tensorflow | 419e3a6b650ea4bd1b0cba23c4348f8a69f3272e | tensorflow/python/framework/indexed_slices.py | python | convert_n_to_tensor_or_indexed_slices | (values, dtype=None, name=None) | return internal_convert_n_to_tensor_or_indexed_slices(
values=values, dtype=dtype, name=name, as_ref=False) | Converts `values` to a list of `Output` or `IndexedSlices` objects.
Any `IndexedSlices` or `SparseTensor` objects in `values` are returned
unmodified.
Args:
values: A list of `None`, `IndexedSlices`, `SparseTensor`, or objects that
can be consumed by `convert_to_tensor()`.
dtype: (Optional.) The required `DType` of the returned `Tensor`
`IndexedSlices`.
name: (Optional.) A name prefix to used when a new `Tensor` is created, in
which case element `i` will be given the name `name + '_' + i`.
Returns:
A list of `Tensor`, `IndexedSlices`, and/or `SparseTensor` objects.
Raises:
TypeError: If no conversion function is registered for an element in
`values`.
RuntimeError: If a registered conversion function returns an invalid
value. | Converts `values` to a list of `Output` or `IndexedSlices` objects. | [
"Converts",
"values",
"to",
"a",
"list",
"of",
"Output",
"or",
"IndexedSlices",
"objects",
"."
] | def convert_n_to_tensor_or_indexed_slices(values, dtype=None, name=None):
"""Converts `values` to a list of `Output` or `IndexedSlices` objects.
Any `IndexedSlices` or `SparseTensor` objects in `values` are returned
unmodified.
Args:
values: A list of `None`, `IndexedSlices`, `SparseTensor`, or objects that
can be consumed by `convert_to_tensor()`.
dtype: (Optional.) The required `DType` of the returned `Tensor`
`IndexedSlices`.
name: (Optional.) A name prefix to used when a new `Tensor` is created, in
which case element `i` will be given the name `name + '_' + i`.
Returns:
A list of `Tensor`, `IndexedSlices`, and/or `SparseTensor` objects.
Raises:
TypeError: If no conversion function is registered for an element in
`values`.
RuntimeError: If a registered conversion function returns an invalid
value.
"""
return internal_convert_n_to_tensor_or_indexed_slices(
values=values, dtype=dtype, name=name, as_ref=False) | [
"def",
"convert_n_to_tensor_or_indexed_slices",
"(",
"values",
",",
"dtype",
"=",
"None",
",",
"name",
"=",
"None",
")",
":",
"return",
"internal_convert_n_to_tensor_or_indexed_slices",
"(",
"values",
"=",
"values",
",",
"dtype",
"=",
"dtype",
",",
"name",
"=",
... | https://github.com/tensorflow/tensorflow/blob/419e3a6b650ea4bd1b0cba23c4348f8a69f3272e/tensorflow/python/framework/indexed_slices.py#L371-L395 | |
blackberry/Boost | fc90c3fde129c62565c023f091eddc4a7ed9902b | tools/build/v2/build/project.py | python | ProjectRegistry.load_module | (self, name, extra_path=None) | Load a Python module that should be useable from Jamfiles.
There are generally two types of modules Jamfiles might want to
use:
- Core Boost.Build. Those are imported using plain names, e.g.
'toolset', so this function checks if we have module named
b2.package.module already.
- Python modules in the same directory as Jamfile. We don't
want to even temporary add Jamfile's directory to sys.path,
since then we might get naming conflicts between standard
Python modules and those. | Load a Python module that should be useable from Jamfiles. | [
"Load",
"a",
"Python",
"module",
"that",
"should",
"be",
"useable",
"from",
"Jamfiles",
"."
] | def load_module(self, name, extra_path=None):
"""Load a Python module that should be useable from Jamfiles.
There are generally two types of modules Jamfiles might want to
use:
- Core Boost.Build. Those are imported using plain names, e.g.
'toolset', so this function checks if we have module named
b2.package.module already.
- Python modules in the same directory as Jamfile. We don't
want to even temporary add Jamfile's directory to sys.path,
since then we might get naming conflicts between standard
Python modules and those.
"""
# See if we loaded module of this name already
existing = self.loaded_tool_modules_.get(name)
if existing:
return existing
# See if we have a module b2.whatever.<name>, where <name>
# is what is passed to this function
modules = sys.modules
for class_name in modules:
parts = class_name.split('.')
if name is class_name or parts[0] == "b2" \
and parts[-1] == name.replace("-", "_"):
module = modules[class_name]
self.loaded_tool_modules_[name] = module
return module
# Lookup a module in BOOST_BUILD_PATH
path = extra_path
if not path:
path = []
path.extend(self.manager.boost_build_path())
location = None
for p in path:
l = os.path.join(p, name + ".py")
if os.path.exists(l):
location = l
break
if not location:
self.manager.errors()("Cannot find module '%s'" % name)
mname = name + "__for_jamfile"
file = open(location)
try:
# TODO: this means we'll never make use of .pyc module,
# which might be a problem, or not.
self.loaded_tool_module_path_[mname] = location
module = imp.load_module(mname, file, os.path.basename(location),
(".py", "r", imp.PY_SOURCE))
self.loaded_tool_modules_[name] = module
return module
finally:
file.close() | [
"def",
"load_module",
"(",
"self",
",",
"name",
",",
"extra_path",
"=",
"None",
")",
":",
"# See if we loaded module of this name already",
"existing",
"=",
"self",
".",
"loaded_tool_modules_",
".",
"get",
"(",
"name",
")",
"if",
"existing",
":",
"return",
"exis... | https://github.com/blackberry/Boost/blob/fc90c3fde129c62565c023f091eddc4a7ed9902b/tools/build/v2/build/project.py#L629-L685 | ||
IfcOpenShell/IfcOpenShell | 2c2954b11a9c9d581bef03240836d4567e69ad0b | src/ifcopenshell-python/ifcopenshell/ids.py | python | material.asdict | (self) | return fac_dict | Converts object to a dictionary, adding required attributes.
:return: Xmlschema compliant dictionary.
:rtype: dict | Converts object to a dictionary, adding required attributes. | [
"Converts",
"object",
"to",
"a",
"dictionary",
"adding",
"required",
"attributes",
"."
] | def asdict(self):
"""Converts object to a dictionary, adding required attributes.
:return: Xmlschema compliant dictionary.
:rtype: dict
"""
fac_dict = {
"value": parameter_asdict(self.value),
"@location": self.location,
# TODO "instructions": "SAMPLE_INSTRUCTIONS",
# TODO '@href': 'http://identifier.buildingsmart.org/uri/buildingsmart/ifc-4.3/prop/FireRating', #https://identifier.buildingsmart.org/uri/something
# TODO '@use': 'optional'
}
return fac_dict | [
"def",
"asdict",
"(",
"self",
")",
":",
"fac_dict",
"=",
"{",
"\"value\"",
":",
"parameter_asdict",
"(",
"self",
".",
"value",
")",
",",
"\"@location\"",
":",
"self",
".",
"location",
",",
"# TODO \"instructions\": \"SAMPLE_INSTRUCTIONS\",",
"# TODO '@href': 'http:/... | https://github.com/IfcOpenShell/IfcOpenShell/blob/2c2954b11a9c9d581bef03240836d4567e69ad0b/src/ifcopenshell-python/ifcopenshell/ids.py#L760-L773 | |
apiaryio/snowcrash | b5b39faa85f88ee17459edf39fdc6fe4fc70d2e3 | tools/gyp/pylib/gyp/generator/make.py | python | MakefileWriter.ComputeMacBundleBinaryOutput | (self, spec) | return os.path.join(path, self.xcode_settings.GetExecutablePath()) | Return the 'output' (full output path) to the binary in a bundle. | Return the 'output' (full output path) to the binary in a bundle. | [
"Return",
"the",
"output",
"(",
"full",
"output",
"path",
")",
"to",
"the",
"binary",
"in",
"a",
"bundle",
"."
] | def ComputeMacBundleBinaryOutput(self, spec):
"""Return the 'output' (full output path) to the binary in a bundle."""
path = generator_default_variables['PRODUCT_DIR']
return os.path.join(path, self.xcode_settings.GetExecutablePath()) | [
"def",
"ComputeMacBundleBinaryOutput",
"(",
"self",
",",
"spec",
")",
":",
"path",
"=",
"generator_default_variables",
"[",
"'PRODUCT_DIR'",
"]",
"return",
"os",
".",
"path",
".",
"join",
"(",
"path",
",",
"self",
".",
"xcode_settings",
".",
"GetExecutablePath",... | https://github.com/apiaryio/snowcrash/blob/b5b39faa85f88ee17459edf39fdc6fe4fc70d2e3/tools/gyp/pylib/gyp/generator/make.py#L1393-L1396 | |
microsoft/TSS.MSR | 0f2516fca2cd9929c31d5450e39301c9bde43688 | TSS.Py/src/TpmTypes.py | python | TPMS_SENSITIVE_CREATE.__init__ | (self, userAuth = None, data = None) | This structure defines the values to be placed in the sensitive area
of a created object. This structure is only used within a
TPM2B_SENSITIVE_CREATE structure.
Attributes:
userAuth (bytes): The USER auth secret value
data (bytes): Data to be sealed, a key, or derivation values | This structure defines the values to be placed in the sensitive area
of a created object. This structure is only used within a
TPM2B_SENSITIVE_CREATE structure. | [
"This",
"structure",
"defines",
"the",
"values",
"to",
"be",
"placed",
"in",
"the",
"sensitive",
"area",
"of",
"a",
"created",
"object",
".",
"This",
"structure",
"is",
"only",
"used",
"within",
"a",
"TPM2B_SENSITIVE_CREATE",
"structure",
"."
] | def __init__(self, userAuth = None, data = None):
""" This structure defines the values to be placed in the sensitive area
of a created object. This structure is only used within a
TPM2B_SENSITIVE_CREATE structure.
Attributes:
userAuth (bytes): The USER auth secret value
data (bytes): Data to be sealed, a key, or derivation values
"""
self.userAuth = userAuth
self.data = data | [
"def",
"__init__",
"(",
"self",
",",
"userAuth",
"=",
"None",
",",
"data",
"=",
"None",
")",
":",
"self",
".",
"userAuth",
"=",
"userAuth",
"self",
".",
"data",
"=",
"data"
] | https://github.com/microsoft/TSS.MSR/blob/0f2516fca2cd9929c31d5450e39301c9bde43688/TSS.Py/src/TpmTypes.py#L6111-L6121 | ||
Xilinx/Vitis-AI | fc74d404563d9951b57245443c73bef389f3657f | tools/Vitis-AI-Quantizer/vai_q_tensorflow1.x/tensorflow/python/client/timeline.py | python | Timeline._show_memory_counters | (self) | Produce a counter series for each memory allocator. | Produce a counter series for each memory allocator. | [
"Produce",
"a",
"counter",
"series",
"for",
"each",
"memory",
"allocator",
"."
] | def _show_memory_counters(self):
"""Produce a counter series for each memory allocator."""
# Iterate over all tensor trackers to build a list of allocations and
# frees for each allocator. Then sort the lists and emit a cumulative
# counter series for each allocator.
allocations = {}
for name in self._tensors:
tensor = self._tensors[name]
self._chrome_trace.emit_obj_delete('Tensor', name, tensor.last_unref,
tensor.pid, 0, tensor.object_id)
allocator = tensor.allocator
if allocator not in allocations:
allocations[allocator] = []
num_bytes = tensor.num_bytes
allocations[allocator].append((tensor.create_time, num_bytes, name))
allocations[allocator].append((tensor.last_unref, -num_bytes, name))
alloc_maxes = {}
# Generate a counter series showing total allocations for each allocator.
for allocator in allocations:
alloc_list = allocations[allocator]
alloc_list.sort()
total_bytes = 0
alloc_tensor_set = set()
alloc_maxes[allocator] = AllocationMaximum(
timestamp=0, num_bytes=0, tensors=set())
for time, num_bytes, name in sorted(
alloc_list, key=lambda allocation: allocation[0]):
total_bytes += num_bytes
if num_bytes < 0:
alloc_tensor_set.discard(name)
else:
alloc_tensor_set.add(name)
if total_bytes > alloc_maxes[allocator].num_bytes:
alloc_maxes[allocator] = AllocationMaximum(
timestamp=time,
num_bytes=total_bytes,
tensors=copy.deepcopy(alloc_tensor_set))
self._chrome_trace.emit_counter('Memory', allocator,
self._allocators_pid, time, allocator,
total_bytes)
self._allocator_maximums = alloc_maxes | [
"def",
"_show_memory_counters",
"(",
"self",
")",
":",
"# Iterate over all tensor trackers to build a list of allocations and",
"# frees for each allocator. Then sort the lists and emit a cumulative",
"# counter series for each allocator.",
"allocations",
"=",
"{",
"}",
"for",
"name",
... | https://github.com/Xilinx/Vitis-AI/blob/fc74d404563d9951b57245443c73bef389f3657f/tools/Vitis-AI-Quantizer/vai_q_tensorflow1.x/tensorflow/python/client/timeline.py#L564-L608 | ||
wxWidgets/wxPython-Classic | 19571e1ae65f1ac445f5491474121998c97a1bf0 | src/gtk/dataview.py | python | DataViewModel.IsContainer | (*args, **kwargs) | return _dataview.DataViewModel_IsContainer(*args, **kwargs) | IsContainer(self, DataViewItem item) -> bool
Override this to indicate whether an item is a container, in other
words, if it is a parent item that can have children. | IsContainer(self, DataViewItem item) -> bool | [
"IsContainer",
"(",
"self",
"DataViewItem",
"item",
")",
"-",
">",
"bool"
] | def IsContainer(*args, **kwargs):
"""
IsContainer(self, DataViewItem item) -> bool
Override this to indicate whether an item is a container, in other
words, if it is a parent item that can have children.
"""
return _dataview.DataViewModel_IsContainer(*args, **kwargs) | [
"def",
"IsContainer",
"(",
"*",
"args",
",",
"*",
"*",
"kwargs",
")",
":",
"return",
"_dataview",
".",
"DataViewModel_IsContainer",
"(",
"*",
"args",
",",
"*",
"*",
"kwargs",
")"
] | https://github.com/wxWidgets/wxPython-Classic/blob/19571e1ae65f1ac445f5491474121998c97a1bf0/src/gtk/dataview.py#L524-L531 | |
openvinotoolkit/openvino | dedcbeafa8b84cccdc55ca64b8da516682b381c7 | tools/mo/openvino/tools/mo/front/common/register_custom_ops.py | python | check_for_duplicates | (extractors_collection: dict) | return {k: v[0] for k, v in keys.items()} | Check if extractors_collection has case-insensitive duplicates, if it does,
raise exception with information about duplicates | Check if extractors_collection has case-insensitive duplicates, if it does,
raise exception with information about duplicates | [
"Check",
"if",
"extractors_collection",
"has",
"case",
"-",
"insensitive",
"duplicates",
"if",
"it",
"does",
"raise",
"exception",
"with",
"information",
"about",
"duplicates"
] | def check_for_duplicates(extractors_collection: dict):
"""
Check if extractors_collection has case-insensitive duplicates, if it does,
raise exception with information about duplicates
"""
# Check if extractors_collection is a normal form, that is it doesn't have case-insensitive duplicates
duplicates, keys = find_case_insensitive_duplicates(extractors_collection)
if len(duplicates) > 0:
raise Error('Extractors collection have case insensitive duplicates {}. ' +
refer_to_faq_msg(47), duplicates)
return {k: v[0] for k, v in keys.items()} | [
"def",
"check_for_duplicates",
"(",
"extractors_collection",
":",
"dict",
")",
":",
"# Check if extractors_collection is a normal form, that is it doesn't have case-insensitive duplicates",
"duplicates",
",",
"keys",
"=",
"find_case_insensitive_duplicates",
"(",
"extractors_collection"... | https://github.com/openvinotoolkit/openvino/blob/dedcbeafa8b84cccdc55ca64b8da516682b381c7/tools/mo/openvino/tools/mo/front/common/register_custom_ops.py#L38-L48 | |
baidu/bigflow | 449245016c0df7d1252e85581e588bfc60cefad3 | bigflow_python/python/bigflow/ptable.py | python | PTable._key | (self, ensure_keep_group=False) | return self.__key | 内部函数
ensure_keep_group的话,则返回至少发一条数据给reduce,确保每个group都保留着。
否则,依赖于其它结点产生group。 | 内部函数 | [
"内部函数"
] | def _key(self, ensure_keep_group=False):
'''
内部函数
ensure_keep_group的话,则返回至少发一条数据给reduce,确保每个group都保留着。
否则,依赖于其它结点产生group。
'''
value = self._value()
value = value[0] if isinstance(value, tuple) else value
take_num = 1 if ensure_keep_group else 0
if self.__key is None:
import bigflow.transforms
from bigflow.core import entity
key_serde = self.key_serdes()[0]
deserialize = entity.SerdeWrapper(key_serde, is_serialize=False)
key_node = bigflow.transforms.flatten_values(value).node() \
.process_by(entity.TakeProcessor(take_num)) \
.as_type(value.serde()) \
.set_debug_info("ExtractKeyPartial") \
.input(0).allow_partial_processing().done() \
.process_by(entity.GetLastKeyProcessor(deserialize)) \
.as_type(key_serde) \
.set_debug_info("ExtractKey")
self.__key = pobject.PObject(key_node, self._pipeline)
return self.__key | [
"def",
"_key",
"(",
"self",
",",
"ensure_keep_group",
"=",
"False",
")",
":",
"value",
"=",
"self",
".",
"_value",
"(",
")",
"value",
"=",
"value",
"[",
"0",
"]",
"if",
"isinstance",
"(",
"value",
",",
"tuple",
")",
"else",
"value",
"take_num",
"=",
... | https://github.com/baidu/bigflow/blob/449245016c0df7d1252e85581e588bfc60cefad3/bigflow_python/python/bigflow/ptable.py#L97-L128 | |
arangodb/arangodb | 0d658689c7d1b721b314fa3ca27d38303e1570c8 | 3rdParty/V8/v7.9.317/tools/clusterfuzz/v8_foozzie.py | python | infer_arch | (d8) | return 'ia32' if arch == 'x86' else arch | Infer the V8 architecture from the build configuration next to the
executable. | Infer the V8 architecture from the build configuration next to the
executable. | [
"Infer",
"the",
"V8",
"architecture",
"from",
"the",
"build",
"configuration",
"next",
"to",
"the",
"executable",
"."
] | def infer_arch(d8):
"""Infer the V8 architecture from the build configuration next to the
executable.
"""
with open(os.path.join(os.path.dirname(d8), 'v8_build_config.json')) as f:
arch = json.load(f)['v8_current_cpu']
return 'ia32' if arch == 'x86' else arch | [
"def",
"infer_arch",
"(",
"d8",
")",
":",
"with",
"open",
"(",
"os",
".",
"path",
".",
"join",
"(",
"os",
".",
"path",
".",
"dirname",
"(",
"d8",
")",
",",
"'v8_build_config.json'",
")",
")",
"as",
"f",
":",
"arch",
"=",
"json",
".",
"load",
"(",... | https://github.com/arangodb/arangodb/blob/0d658689c7d1b721b314fa3ca27d38303e1570c8/3rdParty/V8/v7.9.317/tools/clusterfuzz/v8_foozzie.py#L161-L167 | |
catboost/catboost | 167f64f237114a4d10b2b4ee42adb4569137debe | contrib/python/scikit-learn/py3/sklearn/neural_network/_multilayer_perceptron.py | python | BaseMultilayerPerceptron.fit | (self, X, y) | return self._fit(X, y, incremental=False) | Fit the model to data matrix X and target(s) y.
Parameters
----------
X : ndarray or sparse matrix of shape (n_samples, n_features)
The input data.
y : ndarray of shape (n_samples,) or (n_samples, n_outputs)
The target values (class labels in classification, real numbers in
regression).
Returns
-------
self : returns a trained MLP model. | Fit the model to data matrix X and target(s) y. | [
"Fit",
"the",
"model",
"to",
"data",
"matrix",
"X",
"and",
"target",
"(",
"s",
")",
"y",
"."
] | def fit(self, X, y):
"""Fit the model to data matrix X and target(s) y.
Parameters
----------
X : ndarray or sparse matrix of shape (n_samples, n_features)
The input data.
y : ndarray of shape (n_samples,) or (n_samples, n_outputs)
The target values (class labels in classification, real numbers in
regression).
Returns
-------
self : returns a trained MLP model.
"""
return self._fit(X, y, incremental=False) | [
"def",
"fit",
"(",
"self",
",",
"X",
",",
"y",
")",
":",
"return",
"self",
".",
"_fit",
"(",
"X",
",",
"y",
",",
"incremental",
"=",
"False",
")"
] | https://github.com/catboost/catboost/blob/167f64f237114a4d10b2b4ee42adb4569137debe/contrib/python/scikit-learn/py3/sklearn/neural_network/_multilayer_perceptron.py#L611-L627 | |
catboost/catboost | 167f64f237114a4d10b2b4ee42adb4569137debe | contrib/python/ipython/py2/IPython/core/interactiveshell.py | python | InteractiveShell._indent_current_str | (self) | return self.input_splitter.indent_spaces * ' ' | return the current level of indentation as a string | return the current level of indentation as a string | [
"return",
"the",
"current",
"level",
"of",
"indentation",
"as",
"a",
"string"
] | def _indent_current_str(self):
"""return the current level of indentation as a string"""
return self.input_splitter.indent_spaces * ' ' | [
"def",
"_indent_current_str",
"(",
"self",
")",
":",
"return",
"self",
".",
"input_splitter",
".",
"indent_spaces",
"*",
"' '"
] | https://github.com/catboost/catboost/blob/167f64f237114a4d10b2b4ee42adb4569137debe/contrib/python/ipython/py2/IPython/core/interactiveshell.py#L1903-L1905 | |
wlanjie/AndroidFFmpeg | 7baf9122f4b8e1c74e7baf4be5c422c7a5ba5aaf | tools/fdk-aac-build/x86/toolchain/lib/python2.7/urllib.py | python | splittag | (url) | return url, None | splittag('/path#tag') --> '/path', 'tag'. | splittag('/path#tag') --> '/path', 'tag'. | [
"splittag",
"(",
"/",
"path#tag",
")",
"--",
">",
"/",
"path",
"tag",
"."
] | def splittag(url):
"""splittag('/path#tag') --> '/path', 'tag'."""
global _tagprog
if _tagprog is None:
import re
_tagprog = re.compile('^(.*)#([^#]*)$')
match = _tagprog.match(url)
if match: return match.group(1, 2)
return url, None | [
"def",
"splittag",
"(",
"url",
")",
":",
"global",
"_tagprog",
"if",
"_tagprog",
"is",
"None",
":",
"import",
"re",
"_tagprog",
"=",
"re",
".",
"compile",
"(",
"'^(.*)#([^#]*)$'",
")",
"match",
"=",
"_tagprog",
".",
"match",
"(",
"url",
")",
"if",
"mat... | https://github.com/wlanjie/AndroidFFmpeg/blob/7baf9122f4b8e1c74e7baf4be5c422c7a5ba5aaf/tools/fdk-aac-build/x86/toolchain/lib/python2.7/urllib.py#L1166-L1175 | |
hughperkins/tf-coriander | 970d3df6c11400ad68405f22b0c42a52374e94ca | tensorflow/tensorboard/backend/handler.py | python | TensorboardHandler.respond | (self, *args, **kwargs) | Delegates to http.Respond. | Delegates to http.Respond. | [
"Delegates",
"to",
"http",
".",
"Respond",
"."
] | def respond(self, *args, **kwargs):
"""Delegates to http.Respond."""
http.Respond(self, *args, **kwargs) | [
"def",
"respond",
"(",
"self",
",",
"*",
"args",
",",
"*",
"*",
"kwargs",
")",
":",
"http",
".",
"Respond",
"(",
"self",
",",
"*",
"args",
",",
"*",
"*",
"kwargs",
")"
] | https://github.com/hughperkins/tf-coriander/blob/970d3df6c11400ad68405f22b0c42a52374e94ca/tensorflow/tensorboard/backend/handler.py#L106-L108 | ||
wxWidgets/wxPython-Classic | 19571e1ae65f1ac445f5491474121998c97a1bf0 | src/osx_carbon/xrc.py | python | XmlResourceHandler.AddWindowStyles | (*args, **kwargs) | return _xrc.XmlResourceHandler_AddWindowStyles(*args, **kwargs) | AddWindowStyles(self) | AddWindowStyles(self) | [
"AddWindowStyles",
"(",
"self",
")"
] | def AddWindowStyles(*args, **kwargs):
"""AddWindowStyles(self)"""
return _xrc.XmlResourceHandler_AddWindowStyles(*args, **kwargs) | [
"def",
"AddWindowStyles",
"(",
"*",
"args",
",",
"*",
"*",
"kwargs",
")",
":",
"return",
"_xrc",
".",
"XmlResourceHandler_AddWindowStyles",
"(",
"*",
"args",
",",
"*",
"*",
"kwargs",
")"
] | https://github.com/wxWidgets/wxPython-Classic/blob/19571e1ae65f1ac445f5491474121998c97a1bf0/src/osx_carbon/xrc.py#L651-L653 | |
tkn-tub/ns3-gym | 19bfe0a583e641142609939a090a09dfc63a095f | utils/check-style.py | python | PatchChunkLine.line | (self) | return self.__line | ! Get line
@param self The current class
@return line | ! Get line | [
"!",
"Get",
"line"
] | def line(self):
"""! Get line
@param self The current class
@return line
"""
return self.__line | [
"def",
"line",
"(",
"self",
")",
":",
"return",
"self",
".",
"__line"
] | https://github.com/tkn-tub/ns3-gym/blob/19bfe0a583e641142609939a090a09dfc63a095f/utils/check-style.py#L186-L191 | |
domino-team/openwrt-cc | 8b181297c34d14d3ca521cc9f31430d561dbc688 | package/gli-pub/openwrt-node-packages-master/node/node-v6.9.1/deps/npm/node_modules/node-gyp/gyp/pylib/gyp/ninja_syntax.py | python | escape | (string) | return string.replace('$', '$$') | Escape a string such that it can be embedded into a Ninja file without
further interpretation. | Escape a string such that it can be embedded into a Ninja file without
further interpretation. | [
"Escape",
"a",
"string",
"such",
"that",
"it",
"can",
"be",
"embedded",
"into",
"a",
"Ninja",
"file",
"without",
"further",
"interpretation",
"."
] | def escape(string):
"""Escape a string such that it can be embedded into a Ninja file without
further interpretation."""
assert '\n' not in string, 'Ninja syntax does not allow newlines'
# We only have one special metacharacter: '$'.
return string.replace('$', '$$') | [
"def",
"escape",
"(",
"string",
")",
":",
"assert",
"'\\n'",
"not",
"in",
"string",
",",
"'Ninja syntax does not allow newlines'",
"# We only have one special metacharacter: '$'.",
"return",
"string",
".",
"replace",
"(",
"'$'",
",",
"'$$'",
")"
] | https://github.com/domino-team/openwrt-cc/blob/8b181297c34d14d3ca521cc9f31430d561dbc688/package/gli-pub/openwrt-node-packages-master/node/node-v6.9.1/deps/npm/node_modules/node-gyp/gyp/pylib/gyp/ninja_syntax.py#L155-L160 | |
catboost/catboost | 167f64f237114a4d10b2b4ee42adb4569137debe | contrib/python/Jinja2/py3/jinja2/filters.py | python | make_multi_attrgetter | (
environment: "Environment",
attribute: t.Optional[t.Union[str, int]],
postprocess: t.Optional[t.Callable[[t.Any], t.Any]] = None,
) | return attrgetter | Returns a callable that looks up the given comma separated
attributes from a passed object with the rules of the environment.
Dots are allowed to access attributes of each attribute. Integer
parts in paths are looked up as integers.
The value returned by the returned callable is a list of extracted
attribute values.
Examples of attribute: "attr1,attr2", "attr1.inner1.0,attr2.inner2.0", etc. | Returns a callable that looks up the given comma separated
attributes from a passed object with the rules of the environment.
Dots are allowed to access attributes of each attribute. Integer
parts in paths are looked up as integers. | [
"Returns",
"a",
"callable",
"that",
"looks",
"up",
"the",
"given",
"comma",
"separated",
"attributes",
"from",
"a",
"passed",
"object",
"with",
"the",
"rules",
"of",
"the",
"environment",
".",
"Dots",
"are",
"allowed",
"to",
"access",
"attributes",
"of",
"ea... | def make_multi_attrgetter(
environment: "Environment",
attribute: t.Optional[t.Union[str, int]],
postprocess: t.Optional[t.Callable[[t.Any], t.Any]] = None,
) -> t.Callable[[t.Any], t.List[t.Any]]:
"""Returns a callable that looks up the given comma separated
attributes from a passed object with the rules of the environment.
Dots are allowed to access attributes of each attribute. Integer
parts in paths are looked up as integers.
The value returned by the returned callable is a list of extracted
attribute values.
Examples of attribute: "attr1,attr2", "attr1.inner1.0,attr2.inner2.0", etc.
"""
if isinstance(attribute, str):
split: t.Sequence[t.Union[str, int, None]] = attribute.split(",")
else:
split = [attribute]
parts = [_prepare_attribute_parts(item) for item in split]
def attrgetter(item: t.Any) -> t.List[t.Any]:
items = [None] * len(parts)
for i, attribute_part in enumerate(parts):
item_i = item
for part in attribute_part:
item_i = environment.getitem(item_i, part)
if postprocess is not None:
item_i = postprocess(item_i)
items[i] = item_i
return items
return attrgetter | [
"def",
"make_multi_attrgetter",
"(",
"environment",
":",
"\"Environment\"",
",",
"attribute",
":",
"t",
".",
"Optional",
"[",
"t",
".",
"Union",
"[",
"str",
",",
"int",
"]",
"]",
",",
"postprocess",
":",
"t",
".",
"Optional",
"[",
"t",
".",
"Callable",
... | https://github.com/catboost/catboost/blob/167f64f237114a4d10b2b4ee42adb4569137debe/contrib/python/Jinja2/py3/jinja2/filters.py#L136-L174 | |
rdkit/rdkit | ede860ae316d12d8568daf5ee800921c3389c84e | Contrib/AtomAtomSimilarity/AtomAtomPathSimilarity.py | python | AtomAtomPathSimilarity | (m1, m2, m1pathintegers=None, m2pathintegers=None) | return simab | compute the Atom Atom Path Similarity for a pair of RDKit molecules. See Gobbi et al, J. ChemInf (2015) 7:11
the most expensive part of the calculation is computing the path integers - we can precompute these and pass them in as an argument | compute the Atom Atom Path Similarity for a pair of RDKit molecules. See Gobbi et al, J. ChemInf (2015) 7:11
the most expensive part of the calculation is computing the path integers - we can precompute these and pass them in as an argument | [
"compute",
"the",
"Atom",
"Atom",
"Path",
"Similarity",
"for",
"a",
"pair",
"of",
"RDKit",
"molecules",
".",
"See",
"Gobbi",
"et",
"al",
"J",
".",
"ChemInf",
"(",
"2015",
")",
"7",
":",
"11",
"the",
"most",
"expensive",
"part",
"of",
"the",
"calculatio... | def AtomAtomPathSimilarity(m1, m2, m1pathintegers=None, m2pathintegers=None):
'''compute the Atom Atom Path Similarity for a pair of RDKit molecules. See Gobbi et al, J. ChemInf (2015) 7:11
the most expensive part of the calculation is computing the path integers - we can precompute these and pass them in as an argument'''
if m1pathintegers is None:
m1pathintegers = getpathintegers(m1)
if m2pathintegers is None:
m2pathintegers = getpathintegers(m2)
simmatrix = getsimmatrix(m1, m1pathintegers, m2, m2pathintegers)
# mappings = getmappings(simmatrix)
mappings = gethungarianmappings(simmatrix)
simab = getsimab(mappings, simmatrix)
return simab | [
"def",
"AtomAtomPathSimilarity",
"(",
"m1",
",",
"m2",
",",
"m1pathintegers",
"=",
"None",
",",
"m2pathintegers",
"=",
"None",
")",
":",
"if",
"m1pathintegers",
"is",
"None",
":",
"m1pathintegers",
"=",
"getpathintegers",
"(",
"m1",
")",
"if",
"m2pathintegers"... | https://github.com/rdkit/rdkit/blob/ede860ae316d12d8568daf5ee800921c3389c84e/Contrib/AtomAtomSimilarity/AtomAtomPathSimilarity.py#L225-L240 | |
grpc/grpc | 27bc6fe7797e43298dc931b96dc57322d0852a9f | src/python/grpcio/grpc/aio/_base_call.py | python | StreamStreamCall.__aiter__ | (self) | Returns the async iterable representation that yields messages.
Under the hood, it is calling the "read" method.
Returns:
An async iterable object that yields messages. | Returns the async iterable representation that yields messages. | [
"Returns",
"the",
"async",
"iterable",
"representation",
"that",
"yields",
"messages",
"."
] | def __aiter__(self) -> AsyncIterable[ResponseType]:
"""Returns the async iterable representation that yields messages.
Under the hood, it is calling the "read" method.
Returns:
An async iterable object that yields messages.
""" | [
"def",
"__aiter__",
"(",
"self",
")",
"->",
"AsyncIterable",
"[",
"ResponseType",
"]",
":"
] | https://github.com/grpc/grpc/blob/27bc6fe7797e43298dc931b96dc57322d0852a9f/src/python/grpcio/grpc/aio/_base_call.py#L213-L220 | ||
s9xie/DSN | 065e49898d239f5c96be558616b2556eabc50351 | scripts/cpp_lint.py | python | _IncludeState.CheckNextIncludeOrder | (self, header_type) | return '' | Returns a non-empty error message if the next header is out of order.
This function also updates the internal state to be ready to check
the next include.
Args:
header_type: One of the _XXX_HEADER constants defined above.
Returns:
The empty string if the header is in the right order, or an
error message describing what's wrong. | Returns a non-empty error message if the next header is out of order. | [
"Returns",
"a",
"non",
"-",
"empty",
"error",
"message",
"if",
"the",
"next",
"header",
"is",
"out",
"of",
"order",
"."
] | def CheckNextIncludeOrder(self, header_type):
"""Returns a non-empty error message if the next header is out of order.
This function also updates the internal state to be ready to check
the next include.
Args:
header_type: One of the _XXX_HEADER constants defined above.
Returns:
The empty string if the header is in the right order, or an
error message describing what's wrong.
"""
error_message = ('Found %s after %s' %
(self._TYPE_NAMES[header_type],
self._SECTION_NAMES[self._section]))
last_section = self._section
if header_type == _C_SYS_HEADER:
if self._section <= self._C_SECTION:
self._section = self._C_SECTION
else:
self._last_header = ''
return error_message
elif header_type == _CPP_SYS_HEADER:
if self._section <= self._CPP_SECTION:
self._section = self._CPP_SECTION
else:
self._last_header = ''
return error_message
elif header_type == _LIKELY_MY_HEADER:
if self._section <= self._MY_H_SECTION:
self._section = self._MY_H_SECTION
else:
self._section = self._OTHER_H_SECTION
elif header_type == _POSSIBLE_MY_HEADER:
if self._section <= self._MY_H_SECTION:
self._section = self._MY_H_SECTION
else:
# This will always be the fallback because we're not sure
# enough that the header is associated with this file.
self._section = self._OTHER_H_SECTION
else:
assert header_type == _OTHER_HEADER
self._section = self._OTHER_H_SECTION
if last_section != self._section:
self._last_header = ''
return '' | [
"def",
"CheckNextIncludeOrder",
"(",
"self",
",",
"header_type",
")",
":",
"error_message",
"=",
"(",
"'Found %s after %s'",
"%",
"(",
"self",
".",
"_TYPE_NAMES",
"[",
"header_type",
"]",
",",
"self",
".",
"_SECTION_NAMES",
"[",
"self",
".",
"_section",
"]",
... | https://github.com/s9xie/DSN/blob/065e49898d239f5c96be558616b2556eabc50351/scripts/cpp_lint.py#L628-L679 | |
gem5/gem5 | 141cc37c2d4b93959d4c249b8f7e6a8b2ef75338 | configs/common/ObjectList.py | python | ObjectList._add_objects | (self) | Add all sub-classes of the base class in the object hierarchy. | Add all sub-classes of the base class in the object hierarchy. | [
"Add",
"all",
"sub",
"-",
"classes",
"of",
"the",
"base",
"class",
"in",
"the",
"object",
"hierarchy",
"."
] | def _add_objects(self):
"""Add all sub-classes of the base class in the object hierarchy."""
for name, cls in inspect.getmembers(m5.objects, self._is_obj_class):
self._sub_classes[name] = cls | [
"def",
"_add_objects",
"(",
"self",
")",
":",
"for",
"name",
",",
"cls",
"in",
"inspect",
".",
"getmembers",
"(",
"m5",
".",
"objects",
",",
"self",
".",
"_is_obj_class",
")",
":",
"self",
".",
"_sub_classes",
"[",
"name",
"]",
"=",
"cls"
] | https://github.com/gem5/gem5/blob/141cc37c2d4b93959d4c249b8f7e6a8b2ef75338/configs/common/ObjectList.py#L95-L98 | ||
catboost/catboost | 167f64f237114a4d10b2b4ee42adb4569137debe | contrib/python/prompt-toolkit/py3/prompt_toolkit/buffer.py | python | Buffer.document | (self) | return self._document_cache[
self.text, self.cursor_position, self.selection_state
] | Return :class:`~prompt_toolkit.document.Document` instance from the
current text, cursor position and selection state. | Return :class:`~prompt_toolkit.document.Document` instance from the
current text, cursor position and selection state. | [
"Return",
":",
"class",
":",
"~prompt_toolkit",
".",
"document",
".",
"Document",
"instance",
"from",
"the",
"current",
"text",
"cursor",
"position",
"and",
"selection",
"state",
"."
] | def document(self) -> Document:
"""
Return :class:`~prompt_toolkit.document.Document` instance from the
current text, cursor position and selection state.
"""
return self._document_cache[
self.text, self.cursor_position, self.selection_state
] | [
"def",
"document",
"(",
"self",
")",
"->",
"Document",
":",
"return",
"self",
".",
"_document_cache",
"[",
"self",
".",
"text",
",",
"self",
".",
"cursor_position",
",",
"self",
".",
"selection_state",
"]"
] | https://github.com/catboost/catboost/blob/167f64f237114a4d10b2b4ee42adb4569137debe/contrib/python/prompt-toolkit/py3/prompt_toolkit/buffer.py#L574-L581 | |
aws/lumberyard | f85344403c1c2e77ec8c75deb2c116e97b713217 | dev/Tools/AWSPythonSDK/1.5.8/docutils/utils/math/math2html.py | python | Options.usage | (self) | Show correct usage | Show correct usage | [
"Show",
"correct",
"usage"
] | def usage(self):
"Show correct usage"
Trace.error('Usage: ' + os.path.basename(Options.location) + ' [options] [filein] [fileout]')
Trace.error('Convert LyX input file "filein" to HTML file "fileout".')
Trace.error('If filein (or fileout) is not given use standard input (or output).')
Trace.error('Main program of the eLyXer package (http://elyxer.nongnu.org/).')
self.showoptions() | [
"def",
"usage",
"(",
"self",
")",
":",
"Trace",
".",
"error",
"(",
"'Usage: '",
"+",
"os",
".",
"path",
".",
"basename",
"(",
"Options",
".",
"location",
")",
"+",
"' [options] [filein] [fileout]'",
")",
"Trace",
".",
"error",
"(",
"'Convert LyX input file \... | https://github.com/aws/lumberyard/blob/f85344403c1c2e77ec8c75deb2c116e97b713217/dev/Tools/AWSPythonSDK/1.5.8/docutils/utils/math/math2html.py#L1177-L1183 | ||
miyosuda/TensorFlowAndroidMNIST | 7b5a4603d2780a8a2834575706e9001977524007 | jni-build/jni/include/tensorflow/contrib/learn/python/learn/estimators/classifier.py | python | Classifier.predict_proba | (
self, x=None, input_fn=None, batch_size=None, as_iterable=False) | Returns predicted probabilty distributions for given features.
Args:
x: Matrix of shape [n_samples, n_features...]. Can be iterator that
returns arrays of features. The training input samples for fitting the
model. If set, `input_fn` must be `None`.
input_fn: Input function. If set, `x` and 'batch_size' must be `None`.
batch_size: Override default batch size. If set, 'input_fn' must be
'None'.
as_iterable: If True, return an iterable which keeps yielding predictions
for each example until inputs are exhausted. Note: The inputs must
terminate if you want the iterable to terminate (e.g. be sure to pass
num_epochs=1 if you are using something like read_batch_features).
Returns:
A numpy array of predicted probability distributions (or an iterable of
predicted probability distributions if as_iterable is True).
Raises:
ValueError: If x and input_fn are both provided or both `None`. | Returns predicted probabilty distributions for given features. | [
"Returns",
"predicted",
"probabilty",
"distributions",
"for",
"given",
"features",
"."
] | def predict_proba(
self, x=None, input_fn=None, batch_size=None, as_iterable=False):
"""Returns predicted probabilty distributions for given features.
Args:
x: Matrix of shape [n_samples, n_features...]. Can be iterator that
returns arrays of features. The training input samples for fitting the
model. If set, `input_fn` must be `None`.
input_fn: Input function. If set, `x` and 'batch_size' must be `None`.
batch_size: Override default batch size. If set, 'input_fn' must be
'None'.
as_iterable: If True, return an iterable which keeps yielding predictions
for each example until inputs are exhausted. Note: The inputs must
terminate if you want the iterable to terminate (e.g. be sure to pass
num_epochs=1 if you are using something like read_batch_features).
Returns:
A numpy array of predicted probability distributions (or an iterable of
predicted probability distributions if as_iterable is True).
Raises:
ValueError: If x and input_fn are both provided or both `None`.
"""
predictions = super(Classifier, self).predict(
x=x, input_fn=input_fn, batch_size=batch_size, as_iterable=as_iterable,
outputs=[self.PROBABILITY_OUTPUT])
if as_iterable:
return (p[self.PROBABILITY_OUTPUT] for p in predictions)
else:
return predictions[self.PROBABILITY_OUTPUT] | [
"def",
"predict_proba",
"(",
"self",
",",
"x",
"=",
"None",
",",
"input_fn",
"=",
"None",
",",
"batch_size",
"=",
"None",
",",
"as_iterable",
"=",
"False",
")",
":",
"predictions",
"=",
"super",
"(",
"Classifier",
",",
"self",
")",
".",
"predict",
"(",... | https://github.com/miyosuda/TensorFlowAndroidMNIST/blob/7b5a4603d2780a8a2834575706e9001977524007/jni-build/jni/include/tensorflow/contrib/learn/python/learn/estimators/classifier.py#L97-L126 | ||
GXYM/DRRG | 9e074fa9052de8d131f55ca1f6ae6673c1bfeca4 | dataset/total_text.py | python | TotalText.parse_mat | (mat_path) | return polygons | .mat file parser
:param mat_path: (str), mat file path
:return: (list), TextInstance | .mat file parser
:param mat_path: (str), mat file path
:return: (list), TextInstance | [
".",
"mat",
"file",
"parser",
":",
"param",
"mat_path",
":",
"(",
"str",
")",
"mat",
"file",
"path",
":",
"return",
":",
"(",
"list",
")",
"TextInstance"
] | def parse_mat(mat_path):
"""
.mat file parser
:param mat_path: (str), mat file path
:return: (list), TextInstance
"""
annot = io.loadmat(mat_path + ".mat")
polygons = []
for cell in annot['polygt']:
x = cell[1][0]
y = cell[3][0]
text = cell[4][0] if len(cell[4]) > 0 else '#'
ori = cell[5][0] if len(cell[5]) > 0 else 'c'
if len(x) < 4: # too few points
continue
pts = np.stack([x, y]).T.astype(np.int32)
polygons.append(TextInstance(pts, ori, text))
return polygons | [
"def",
"parse_mat",
"(",
"mat_path",
")",
":",
"annot",
"=",
"io",
".",
"loadmat",
"(",
"mat_path",
"+",
"\".mat\"",
")",
"polygons",
"=",
"[",
"]",
"for",
"cell",
"in",
"annot",
"[",
"'polygt'",
"]",
":",
"x",
"=",
"cell",
"[",
"1",
"]",
"[",
"0... | https://github.com/GXYM/DRRG/blob/9e074fa9052de8d131f55ca1f6ae6673c1bfeca4/dataset/total_text.py#L35-L54 | |
google/iree | 1224bbdbe65b0d1fdf40e7324f60f68beeaf7c76 | integrations/tensorflow/iree-dialects/python/iree/compiler/dialects/iree_pydm/importer/intrinsic_def.py | python | def_ir_macro_intrinsic | (f=None) | return IrIntrinsicMacro() | Defines an IR macro intrinsic.
The decorated function must take as positional arguments the
ImportStage followed by *`ir.Value` instances corresponding with the
call and return a single `ir.Value`.
The function will be evaluated in an MLIR with context including
context, location and ip. | Defines an IR macro intrinsic. | [
"Defines",
"an",
"IR",
"macro",
"intrinsic",
"."
] | def def_ir_macro_intrinsic(f=None):
"""Defines an IR macro intrinsic.
The decorated function must take as positional arguments the
ImportStage followed by *`ir.Value` instances corresponding with the
call and return a single `ir.Value`.
The function will be evaluated in an MLIR with context including
context, location and ip.
"""
if f is None:
return functools.partial(def_ir_macro_intrinsic)
class IrIntrinsicMacro(Intrinsic):
def emit_call(self, stage: ImportStage, args: Sequence[ir.Value],
keywords: Sequence[Any]) -> ir.Value:
ic = stage.ic
if keywords:
ic.abort(f"{self} only supports positional arguments")
# TODO: Apply pre-conditions on number of arguments, etc, for nicer
# error messages.
with ic.loc, ic.ip:
result = f(stage, *args)
if not isinstance(result, ir.Value):
ic.abort(f"compiler intrinsic macro must return an IR Value: {f}")
return result
def __call__(self, *args, **kwargs):
return f(*args, **kwargs)
def __repr__(self):
return f"<IR macro {self}>"
return IrIntrinsicMacro() | [
"def",
"def_ir_macro_intrinsic",
"(",
"f",
"=",
"None",
")",
":",
"if",
"f",
"is",
"None",
":",
"return",
"functools",
".",
"partial",
"(",
"def_ir_macro_intrinsic",
")",
"class",
"IrIntrinsicMacro",
"(",
"Intrinsic",
")",
":",
"def",
"emit_call",
"(",
"self... | https://github.com/google/iree/blob/1224bbdbe65b0d1fdf40e7324f60f68beeaf7c76/integrations/tensorflow/iree-dialects/python/iree/compiler/dialects/iree_pydm/importer/intrinsic_def.py#L66-L101 | |
quantOS-org/DataCore | e2ef9bd2c22ee9e2845675b6435a14fa607f3551 | mdlink/deps/windows/protobuf-2.5.0/python/google/protobuf/text_format.py | python | _Tokenizer.TryConsume | (self, token) | return False | Tries to consume a given piece of text.
Args:
token: Text to consume.
Returns:
True iff the text was consumed. | Tries to consume a given piece of text. | [
"Tries",
"to",
"consume",
"a",
"given",
"piece",
"of",
"text",
"."
] | def TryConsume(self, token):
"""Tries to consume a given piece of text.
Args:
token: Text to consume.
Returns:
True iff the text was consumed.
"""
if self.token == token:
self.NextToken()
return True
return False | [
"def",
"TryConsume",
"(",
"self",
",",
"token",
")",
":",
"if",
"self",
".",
"token",
"==",
"token",
":",
"self",
".",
"NextToken",
"(",
")",
"return",
"True",
"return",
"False"
] | https://github.com/quantOS-org/DataCore/blob/e2ef9bd2c22ee9e2845675b6435a14fa607f3551/mdlink/deps/windows/protobuf-2.5.0/python/google/protobuf/text_format.py#L354-L366 | |
wxWidgets/wxPython-Classic | 19571e1ae65f1ac445f5491474121998c97a1bf0 | src/osx_carbon/_core.py | python | PyApp_SetMacHelpMenuTitleName | (*args, **kwargs) | return _core_.PyApp_SetMacHelpMenuTitleName(*args, **kwargs) | PyApp_SetMacHelpMenuTitleName(String val) | PyApp_SetMacHelpMenuTitleName(String val) | [
"PyApp_SetMacHelpMenuTitleName",
"(",
"String",
"val",
")"
] | def PyApp_SetMacHelpMenuTitleName(*args, **kwargs):
"""PyApp_SetMacHelpMenuTitleName(String val)"""
return _core_.PyApp_SetMacHelpMenuTitleName(*args, **kwargs) | [
"def",
"PyApp_SetMacHelpMenuTitleName",
"(",
"*",
"args",
",",
"*",
"*",
"kwargs",
")",
":",
"return",
"_core_",
".",
"PyApp_SetMacHelpMenuTitleName",
"(",
"*",
"args",
",",
"*",
"*",
"kwargs",
")"
] | https://github.com/wxWidgets/wxPython-Classic/blob/19571e1ae65f1ac445f5491474121998c97a1bf0/src/osx_carbon/_core.py#L8310-L8312 | |
tensorflow/tensorflow | 419e3a6b650ea4bd1b0cba23c4348f8a69f3272e | tensorflow/python/ops/tensor_array_ops.py | python | _EagerTensorArray.read | (self, index, name=None) | return tensor | See TensorArray. | See TensorArray. | [
"See",
"TensorArray",
"."
] | def read(self, index, name=None):
"""See TensorArray."""
del name # not meaningful when executing eagerly.
if isinstance(index, ops.EagerTensor):
index = index.numpy()
if index < 0:
raise errors_impl.OutOfRangeError(
None, None,
"Reading from negative indices (index %d) is not allowed." % index)
if index >= len(self._tensor_array):
raise errors_impl.OutOfRangeError(
None, None, "Tried to read from index %d but array size is: %d " %
(index, len(self._tensor_array)))
tensor = self._tensor_array[index]
if tensor is None:
if index in self._previously_read_indices:
raise errors_impl.InvalidArgumentError(
None, None,
"Could not read index %d twice because it was cleared after "
"a previous read (perhaps try setting clear_after_read = false?)" %
index)
else:
tensor = self._maybe_zero(index)
if self._clear_after_read:
self._tensor_array[index] = None
self._previously_read_indices.append(index)
return tensor | [
"def",
"read",
"(",
"self",
",",
"index",
",",
"name",
"=",
"None",
")",
":",
"del",
"name",
"# not meaningful when executing eagerly.",
"if",
"isinstance",
"(",
"index",
",",
"ops",
".",
"EagerTensor",
")",
":",
"index",
"=",
"index",
".",
"numpy",
"(",
... | https://github.com/tensorflow/tensorflow/blob/419e3a6b650ea4bd1b0cba23c4348f8a69f3272e/tensorflow/python/ops/tensor_array_ops.py#L757-L788 | |
aws/lumberyard | f85344403c1c2e77ec8c75deb2c116e97b713217 | dev/Tools/Python/3.7.10/windows/Lib/site-packages/pip/_vendor/pyparsing.py | python | traceParseAction | (f) | return z | Decorator for debugging parse actions.
When the parse action is called, this decorator will print
``">> entering method-name(line:<current_source_line>, <parse_location>, <matched_tokens>)"``.
When the parse action completes, the decorator will print
``"<<"`` followed by the returned value, or any exception that the parse action raised.
Example::
wd = Word(alphas)
@traceParseAction
def remove_duplicate_chars(tokens):
return ''.join(sorted(set(''.join(tokens))))
wds = OneOrMore(wd).setParseAction(remove_duplicate_chars)
print(wds.parseString("slkdjs sld sldd sdlf sdljf"))
prints::
>>entering remove_duplicate_chars(line: 'slkdjs sld sldd sdlf sdljf', 0, (['slkdjs', 'sld', 'sldd', 'sdlf', 'sdljf'], {}))
<<leaving remove_duplicate_chars (ret: 'dfjkls')
['dfjkls'] | Decorator for debugging parse actions. | [
"Decorator",
"for",
"debugging",
"parse",
"actions",
"."
] | def traceParseAction(f):
"""Decorator for debugging parse actions.
When the parse action is called, this decorator will print
``">> entering method-name(line:<current_source_line>, <parse_location>, <matched_tokens>)"``.
When the parse action completes, the decorator will print
``"<<"`` followed by the returned value, or any exception that the parse action raised.
Example::
wd = Word(alphas)
@traceParseAction
def remove_duplicate_chars(tokens):
return ''.join(sorted(set(''.join(tokens))))
wds = OneOrMore(wd).setParseAction(remove_duplicate_chars)
print(wds.parseString("slkdjs sld sldd sdlf sdljf"))
prints::
>>entering remove_duplicate_chars(line: 'slkdjs sld sldd sdlf sdljf', 0, (['slkdjs', 'sld', 'sldd', 'sdlf', 'sdljf'], {}))
<<leaving remove_duplicate_chars (ret: 'dfjkls')
['dfjkls']
"""
f = _trim_arity(f)
def z(*paArgs):
thisFunc = f.__name__
s, l, t = paArgs[-3:]
if len(paArgs) > 3:
thisFunc = paArgs[0].__class__.__name__ + '.' + thisFunc
sys.stderr.write(">>entering %s(line: '%s', %d, %r)\n" % (thisFunc, line(l, s), l, t))
try:
ret = f(*paArgs)
except Exception as exc:
sys.stderr.write("<<leaving %s (exception: %s)\n" % (thisFunc, exc))
raise
sys.stderr.write("<<leaving %s (ret: %r)\n" % (thisFunc, ret))
return ret
try:
z.__name__ = f.__name__
except AttributeError:
pass
return z | [
"def",
"traceParseAction",
"(",
"f",
")",
":",
"f",
"=",
"_trim_arity",
"(",
"f",
")",
"def",
"z",
"(",
"*",
"paArgs",
")",
":",
"thisFunc",
"=",
"f",
".",
"__name__",
"s",
",",
"l",
",",
"t",
"=",
"paArgs",
"[",
"-",
"3",
":",
"]",
"if",
"le... | https://github.com/aws/lumberyard/blob/f85344403c1c2e77ec8c75deb2c116e97b713217/dev/Tools/Python/3.7.10/windows/Lib/site-packages/pip/_vendor/pyparsing.py#L5281-L5324 | |
aws/lumberyard | f85344403c1c2e77ec8c75deb2c116e97b713217 | dev/Tools/Python/3.7.10/mac/Python.framework/Versions/3.7/lib/python3.7/multiprocessing/connection.py | python | _ConnectionBase.poll | (self, timeout=0.0) | return self._poll(timeout) | Whether there is any input available to be read | Whether there is any input available to be read | [
"Whether",
"there",
"is",
"any",
"input",
"available",
"to",
"be",
"read"
] | def poll(self, timeout=0.0):
"""Whether there is any input available to be read"""
self._check_closed()
self._check_readable()
return self._poll(timeout) | [
"def",
"poll",
"(",
"self",
",",
"timeout",
"=",
"0.0",
")",
":",
"self",
".",
"_check_closed",
"(",
")",
"self",
".",
"_check_readable",
"(",
")",
"return",
"self",
".",
"_poll",
"(",
"timeout",
")"
] | https://github.com/aws/lumberyard/blob/f85344403c1c2e77ec8c75deb2c116e97b713217/dev/Tools/Python/3.7.10/mac/Python.framework/Versions/3.7/lib/python3.7/multiprocessing/connection.py#L253-L257 | |
mindspore-ai/mindspore | fb8fd3338605bb34fa5cea054e535a8b1d753fab | mindspore/python/mindspore/ops/_op_impl/tbe/cum_sum.py | python | _cum_sum_tbe | () | return | CumSum TBE register | CumSum TBE register | [
"CumSum",
"TBE",
"register"
] | def _cum_sum_tbe():
"""CumSum TBE register"""
return | [
"def",
"_cum_sum_tbe",
"(",
")",
":",
"return"
] | https://github.com/mindspore-ai/mindspore/blob/fb8fd3338605bb34fa5cea054e535a8b1d753fab/mindspore/python/mindspore/ops/_op_impl/tbe/cum_sum.py#L40-L42 | |
wxWidgets/wxPython-Classic | 19571e1ae65f1ac445f5491474121998c97a1bf0 | src/osx_carbon/_core.py | python | MenuItem.IsChecked | (*args, **kwargs) | return _core_.MenuItem_IsChecked(*args, **kwargs) | IsChecked(self) -> bool | IsChecked(self) -> bool | [
"IsChecked",
"(",
"self",
")",
"-",
">",
"bool"
] | def IsChecked(*args, **kwargs):
"""IsChecked(self) -> bool"""
return _core_.MenuItem_IsChecked(*args, **kwargs) | [
"def",
"IsChecked",
"(",
"*",
"args",
",",
"*",
"*",
"kwargs",
")",
":",
"return",
"_core_",
".",
"MenuItem_IsChecked",
"(",
"*",
"args",
",",
"*",
"*",
"kwargs",
")"
] | https://github.com/wxWidgets/wxPython-Classic/blob/19571e1ae65f1ac445f5491474121998c97a1bf0/src/osx_carbon/_core.py#L12525-L12527 | |
wxWidgets/wxPython-Classic | 19571e1ae65f1ac445f5491474121998c97a1bf0 | wx/tools/Editra/src/extern/aui/framemanager.py | python | AuiManager.GetAutoNotebookTabArt | (self) | return self._autoNBTabArt | Returns the default tab art provider for automatic notebooks. | Returns the default tab art provider for automatic notebooks. | [
"Returns",
"the",
"default",
"tab",
"art",
"provider",
"for",
"automatic",
"notebooks",
"."
] | def GetAutoNotebookTabArt(self):
""" Returns the default tab art provider for automatic notebooks. """
return self._autoNBTabArt | [
"def",
"GetAutoNotebookTabArt",
"(",
"self",
")",
":",
"return",
"self",
".",
"_autoNBTabArt"
] | https://github.com/wxWidgets/wxPython-Classic/blob/19571e1ae65f1ac445f5491474121998c97a1bf0/wx/tools/Editra/src/extern/aui/framemanager.py#L5197-L5200 | |
catboost/catboost | 167f64f237114a4d10b2b4ee42adb4569137debe | contrib/tools/python3/src/Lib/xml/dom/expatbuilder.py | python | InternalSubsetExtractor.getSubset | (self) | return self.subset | Return the internal subset as a string. | Return the internal subset as a string. | [
"Return",
"the",
"internal",
"subset",
"as",
"a",
"string",
"."
] | def getSubset(self):
"""Return the internal subset as a string."""
return self.subset | [
"def",
"getSubset",
"(",
"self",
")",
":",
"return",
"self",
".",
"subset"
] | https://github.com/catboost/catboost/blob/167f64f237114a4d10b2b4ee42adb4569137debe/contrib/tools/python3/src/Lib/xml/dom/expatbuilder.py#L860-L862 | |
hanpfei/chromium-net | 392cc1fa3a8f92f42e4071ab6e674d8e0482f83f | third_party/catapult/third_party/gsutil/gslib/copy_helper.py | python | _DownloadObjectToFileNonResumable | (src_url, src_obj_metadata, dst_url,
download_file_name, gsutil_api, logger,
digesters) | return src_obj_metadata.size, server_encoding | Downloads an object to a local file using the non-resumable strategy.
Args:
src_url: Source CloudUrl.
src_obj_metadata: Metadata from the source object.
dst_url: Destination FileUrl.
download_file_name: Temporary file name to be used for download.
gsutil_api: gsutil Cloud API instance to use for the download.
logger: for outputting log messages.
digesters: Digesters corresponding to the hash algorithms that will be used
for validation.
Returns:
(bytes_transferred, server_encoding)
bytes_transferred: Number of bytes transferred from server this call.
server_encoding: Content-encoding string if it was detected that the server
sent encoded bytes during transfer, None otherwise. | Downloads an object to a local file using the non-resumable strategy. | [
"Downloads",
"an",
"object",
"to",
"a",
"local",
"file",
"using",
"the",
"non",
"-",
"resumable",
"strategy",
"."
] | def _DownloadObjectToFileNonResumable(src_url, src_obj_metadata, dst_url,
download_file_name, gsutil_api, logger,
digesters):
"""Downloads an object to a local file using the non-resumable strategy.
Args:
src_url: Source CloudUrl.
src_obj_metadata: Metadata from the source object.
dst_url: Destination FileUrl.
download_file_name: Temporary file name to be used for download.
gsutil_api: gsutil Cloud API instance to use for the download.
logger: for outputting log messages.
digesters: Digesters corresponding to the hash algorithms that will be used
for validation.
Returns:
(bytes_transferred, server_encoding)
bytes_transferred: Number of bytes transferred from server this call.
server_encoding: Content-encoding string if it was detected that the server
sent encoded bytes during transfer, None otherwise.
"""
try:
fp = open(download_file_name, 'w')
# This is used to pass the mediaLink and the size into the download so that
# we can avoid making an extra HTTP call.
serialization_data = GetDownloadSerializationData(src_obj_metadata)
progress_callback = FileProgressCallbackHandler(
ConstructAnnounceText('Downloading', dst_url.url_string), logger).call
if global_copy_helper_opts.test_callback_file:
with open(global_copy_helper_opts.test_callback_file, 'rb') as test_fp:
progress_callback = pickle.loads(test_fp.read()).call
server_encoding = gsutil_api.GetObjectMedia(
src_url.bucket_name, src_url.object_name, fp,
generation=src_url.generation, object_size=src_obj_metadata.size,
download_strategy=CloudApi.DownloadStrategy.ONE_SHOT,
provider=src_url.scheme, serialization_data=serialization_data,
digesters=digesters, progress_callback=progress_callback)
finally:
if fp:
fp.close()
return src_obj_metadata.size, server_encoding | [
"def",
"_DownloadObjectToFileNonResumable",
"(",
"src_url",
",",
"src_obj_metadata",
",",
"dst_url",
",",
"download_file_name",
",",
"gsutil_api",
",",
"logger",
",",
"digesters",
")",
":",
"try",
":",
"fp",
"=",
"open",
"(",
"download_file_name",
",",
"'w'",
")... | https://github.com/hanpfei/chromium-net/blob/392cc1fa3a8f92f42e4071ab6e674d8e0482f83f/third_party/catapult/third_party/gsutil/gslib/copy_helper.py#L2199-L2243 | |
miyosuda/TensorFlowAndroidDemo | 35903e0221aa5f109ea2dbef27f20b52e317f42d | jni-build/jni/include/tensorflow/python/ops/control_flow_ops.py | python | GradLoopState.grad_sync | (self) | return self._grad_sync | A control trigger node for synchronization in the grad loop.
One main use is to keep the pop ops of a stack executed in the
iteration order. | A control trigger node for synchronization in the grad loop. | [
"A",
"control",
"trigger",
"node",
"for",
"synchronization",
"in",
"the",
"grad",
"loop",
"."
] | def grad_sync(self):
"""A control trigger node for synchronization in the grad loop.
One main use is to keep the pop ops of a stack executed in the
iteration order.
"""
if self._grad_sync is None:
with ops.control_dependencies(None):
self._grad_sync = control_trigger(name="b_sync")
self._grad_sync._set_control_flow_context(self._grad_context)
self._grad_index.op._add_control_input(self._grad_sync)
return self._grad_sync | [
"def",
"grad_sync",
"(",
"self",
")",
":",
"if",
"self",
".",
"_grad_sync",
"is",
"None",
":",
"with",
"ops",
".",
"control_dependencies",
"(",
"None",
")",
":",
"self",
".",
"_grad_sync",
"=",
"control_trigger",
"(",
"name",
"=",
"\"b_sync\"",
")",
"sel... | https://github.com/miyosuda/TensorFlowAndroidDemo/blob/35903e0221aa5f109ea2dbef27f20b52e317f42d/jni-build/jni/include/tensorflow/python/ops/control_flow_ops.py#L600-L611 | |
hanpfei/chromium-net | 392cc1fa3a8f92f42e4071ab6e674d8e0482f83f | third_party/catapult/third_party/mox3/mox3/mox.py | python | MockMethod.__ne__ | (self, rhs) | return not self == rhs | Test if this MockMethod is not equivalent to another MockMethod.
Args:
# rhs: the right hand side of the test
rhs: MockMethod | Test if this MockMethod is not equivalent to another MockMethod. | [
"Test",
"if",
"this",
"MockMethod",
"is",
"not",
"equivalent",
"to",
"another",
"MockMethod",
"."
] | def __ne__(self, rhs):
"""Test if this MockMethod is not equivalent to another MockMethod.
Args:
# rhs: the right hand side of the test
rhs: MockMethod
"""
return not self == rhs | [
"def",
"__ne__",
"(",
"self",
",",
"rhs",
")",
":",
"return",
"not",
"self",
"==",
"rhs"
] | https://github.com/hanpfei/chromium-net/blob/392cc1fa3a8f92f42e4071ab6e674d8e0482f83f/third_party/catapult/third_party/mox3/mox3/mox.py#L1207-L1215 | |
thalium/icebox | 99d147d5b9269222225443ce171b4fd46d8985d4 | third_party/virtualbox/src/libs/libxml2-2.9.4/python/libxml2class.py | python | xpathParserContext.xpathRoot | (self) | Initialize the context to the root of the document | Initialize the context to the root of the document | [
"Initialize",
"the",
"context",
"to",
"the",
"root",
"of",
"the",
"document"
] | def xpathRoot(self):
"""Initialize the context to the root of the document """
libxml2mod.xmlXPathRoot(self._o) | [
"def",
"xpathRoot",
"(",
"self",
")",
":",
"libxml2mod",
".",
"xmlXPathRoot",
"(",
"self",
".",
"_o",
")"
] | https://github.com/thalium/icebox/blob/99d147d5b9269222225443ce171b4fd46d8985d4/third_party/virtualbox/src/libs/libxml2-2.9.4/python/libxml2class.py#L7039-L7041 | ||
oracle/graaljs | 36a56e8e993d45fc40939a3a4d9c0c24990720f1 | graal-nodejs/tools/cpplint.py | python | CheckMakePairUsesDeduction | (filename, clean_lines, linenum, error) | Check that make_pair's template arguments are deduced.
G++ 4.6 in C++11 mode fails badly if make_pair's template arguments are
specified explicitly, and such use isn't intended in any case.
Args:
filename: The name of the current file.
clean_lines: A CleansedLines instance containing the file.
linenum: The number of the line to check.
error: The function to call with any errors found. | Check that make_pair's template arguments are deduced. | [
"Check",
"that",
"make_pair",
"s",
"template",
"arguments",
"are",
"deduced",
"."
] | def CheckMakePairUsesDeduction(filename, clean_lines, linenum, error):
"""Check that make_pair's template arguments are deduced.
G++ 4.6 in C++11 mode fails badly if make_pair's template arguments are
specified explicitly, and such use isn't intended in any case.
Args:
filename: The name of the current file.
clean_lines: A CleansedLines instance containing the file.
linenum: The number of the line to check.
error: The function to call with any errors found.
"""
line = clean_lines.elided[linenum]
match = _RE_PATTERN_EXPLICIT_MAKEPAIR.search(line)
if match:
error(filename, linenum, 'build/explicit_make_pair',
4, # 4 = high confidence
'For C++11-compatibility, omit template arguments from make_pair'
' OR use pair directly OR if appropriate, construct a pair directly') | [
"def",
"CheckMakePairUsesDeduction",
"(",
"filename",
",",
"clean_lines",
",",
"linenum",
",",
"error",
")",
":",
"line",
"=",
"clean_lines",
".",
"elided",
"[",
"linenum",
"]",
"match",
"=",
"_RE_PATTERN_EXPLICIT_MAKEPAIR",
".",
"search",
"(",
"line",
")",
"i... | https://github.com/oracle/graaljs/blob/36a56e8e993d45fc40939a3a4d9c0c24990720f1/graal-nodejs/tools/cpplint.py#L6252-L6270 | ||
chromiumembedded/cef | 80caf947f3fe2210e5344713c5281d8af9bdc295 | tools/cef_parser.py | python | obj_analysis.is_result_map_multi | (self) | return (self.result_type == 'multimap') | Returns true if this is a multi map type. | Returns true if this is a multi map type. | [
"Returns",
"true",
"if",
"this",
"is",
"a",
"multi",
"map",
"type",
"."
] | def is_result_map_multi(self):
""" Returns true if this is a multi map type. """
return (self.result_type == 'multimap') | [
"def",
"is_result_map_multi",
"(",
"self",
")",
":",
"return",
"(",
"self",
".",
"result_type",
"==",
"'multimap'",
")"
] | https://github.com/chromiumembedded/cef/blob/80caf947f3fe2210e5344713c5281d8af9bdc295/tools/cef_parser.py#L2019-L2021 | |
JoseExposito/touchegg | 1f3fda214358d071c05da4bf17c070c33d67b5eb | cmake/cpplint.py | python | _BlockInfo.IsBlockInfo | (self) | return self.__class__ == _BlockInfo | Returns true if this block is a _BlockInfo.
This is convenient for verifying that an object is an instance of
a _BlockInfo, but not an instance of any of the derived classes.
Returns:
True for this class, False for derived classes. | Returns true if this block is a _BlockInfo. | [
"Returns",
"true",
"if",
"this",
"block",
"is",
"a",
"_BlockInfo",
"."
] | def IsBlockInfo(self):
"""Returns true if this block is a _BlockInfo.
This is convenient for verifying that an object is an instance of
a _BlockInfo, but not an instance of any of the derived classes.
Returns:
True for this class, False for derived classes.
"""
return self.__class__ == _BlockInfo | [
"def",
"IsBlockInfo",
"(",
"self",
")",
":",
"return",
"self",
".",
"__class__",
"==",
"_BlockInfo"
] | https://github.com/JoseExposito/touchegg/blob/1f3fda214358d071c05da4bf17c070c33d67b5eb/cmake/cpplint.py#L2243-L2252 | |
metashell/metashell | f4177e4854ea00c8dbc722cadab26ef413d798ea | 3rd/templight/compiler-rt/lib/sanitizer_common/scripts/cpplint.py | python | IsDerivedFunction | (clean_lines, linenum) | return False | Check if current line contains an inherited function.
Args:
clean_lines: A CleansedLines instance containing the file.
linenum: The number of the line to check.
Returns:
True if current line contains a function with "override"
virt-specifier. | Check if current line contains an inherited function. | [
"Check",
"if",
"current",
"line",
"contains",
"an",
"inherited",
"function",
"."
] | def IsDerivedFunction(clean_lines, linenum):
"""Check if current line contains an inherited function.
Args:
clean_lines: A CleansedLines instance containing the file.
linenum: The number of the line to check.
Returns:
True if current line contains a function with "override"
virt-specifier.
"""
# Scan back a few lines for start of current function
for i in xrange(linenum, max(-1, linenum - 10), -1):
match = Match(r'^([^()]*\w+)\(', clean_lines.elided[i])
if match:
# Look for "override" after the matching closing parenthesis
line, _, closing_paren = CloseExpression(
clean_lines, i, len(match.group(1)))
return (closing_paren >= 0 and
Search(r'\boverride\b', line[closing_paren:]))
return False | [
"def",
"IsDerivedFunction",
"(",
"clean_lines",
",",
"linenum",
")",
":",
"# Scan back a few lines for start of current function",
"for",
"i",
"in",
"xrange",
"(",
"linenum",
",",
"max",
"(",
"-",
"1",
",",
"linenum",
"-",
"10",
")",
",",
"-",
"1",
")",
":",... | https://github.com/metashell/metashell/blob/f4177e4854ea00c8dbc722cadab26ef413d798ea/3rd/templight/compiler-rt/lib/sanitizer_common/scripts/cpplint.py#L4933-L4952 | |
UlordChain/UlordChain | b6288141e9744e89b1901f330c3797ff5f161d62 | contrib/devtools/optimize-pngs.py | python | file_hash | (filename) | Return hash of raw file contents | Return hash of raw file contents | [
"Return",
"hash",
"of",
"raw",
"file",
"contents"
] | def file_hash(filename):
'''Return hash of raw file contents'''
with open(filename, 'rb') as f:
return hashlib.sha256(f.read()).hexdigest() | [
"def",
"file_hash",
"(",
"filename",
")",
":",
"with",
"open",
"(",
"filename",
",",
"'rb'",
")",
"as",
"f",
":",
"return",
"hashlib",
".",
"sha256",
"(",
"f",
".",
"read",
"(",
")",
")",
".",
"hexdigest",
"(",
")"
] | https://github.com/UlordChain/UlordChain/blob/b6288141e9744e89b1901f330c3797ff5f161d62/contrib/devtools/optimize-pngs.py#L12-L15 | ||
ChromiumWebApps/chromium | c7361d39be8abd1574e6ce8957c8dbddd4c6ccf7 | third_party/pexpect/pexpect.py | python | spawn.readline | (self, size=-1) | This reads and returns one entire line. The newline at the end of
line is returned as part of the string, unless the file ends without a
newline. An empty string is returned if EOF is encountered immediately.
This looks for a newline as a CR/LF pair (\\r\\n) even on UNIX because
this is what the pseudotty device returns. So contrary to what you may
expect you will receive newlines as \\r\\n.
If the size argument is 0 then an empty string is returned. In all
other cases the size argument is ignored, which is not standard
behavior for a file-like object. | This reads and returns one entire line. The newline at the end of
line is returned as part of the string, unless the file ends without a
newline. An empty string is returned if EOF is encountered immediately.
This looks for a newline as a CR/LF pair (\\r\\n) even on UNIX because
this is what the pseudotty device returns. So contrary to what you may
expect you will receive newlines as \\r\\n. | [
"This",
"reads",
"and",
"returns",
"one",
"entire",
"line",
".",
"The",
"newline",
"at",
"the",
"end",
"of",
"line",
"is",
"returned",
"as",
"part",
"of",
"the",
"string",
"unless",
"the",
"file",
"ends",
"without",
"a",
"newline",
".",
"An",
"empty",
... | def readline(self, size=-1):
"""This reads and returns one entire line. The newline at the end of
line is returned as part of the string, unless the file ends without a
newline. An empty string is returned if EOF is encountered immediately.
This looks for a newline as a CR/LF pair (\\r\\n) even on UNIX because
this is what the pseudotty device returns. So contrary to what you may
expect you will receive newlines as \\r\\n.
If the size argument is 0 then an empty string is returned. In all
other cases the size argument is ignored, which is not standard
behavior for a file-like object. """
if size == 0:
return ''
# delimiter default is EOF
index = self.expect(['\r\n', self.delimiter])
if index == 0:
return self.before + '\r\n'
else:
return self.before | [
"def",
"readline",
"(",
"self",
",",
"size",
"=",
"-",
"1",
")",
":",
"if",
"size",
"==",
"0",
":",
"return",
"''",
"# delimiter default is EOF",
"index",
"=",
"self",
".",
"expect",
"(",
"[",
"'\\r\\n'",
",",
"self",
".",
"delimiter",
"]",
")",
"if"... | https://github.com/ChromiumWebApps/chromium/blob/c7361d39be8abd1574e6ce8957c8dbddd4c6ccf7/third_party/pexpect/pexpect.py#L924-L944 | ||
aws/lumberyard | f85344403c1c2e77ec8c75deb2c116e97b713217 | dev/Tools/Python/3.7.10/linux_x64/lib/python3.7/pdb.py | python | Pdb.checkline | (self, filename, lineno) | return lineno | Check whether specified line seems to be executable.
Return `lineno` if it is, 0 if not (e.g. a docstring, comment, blank
line or EOF). Warning: testing is not comprehensive. | Check whether specified line seems to be executable. | [
"Check",
"whether",
"specified",
"line",
"seems",
"to",
"be",
"executable",
"."
] | def checkline(self, filename, lineno):
"""Check whether specified line seems to be executable.
Return `lineno` if it is, 0 if not (e.g. a docstring, comment, blank
line or EOF). Warning: testing is not comprehensive.
"""
# this method should be callable before starting debugging, so default
# to "no globals" if there is no current frame
globs = self.curframe.f_globals if hasattr(self, 'curframe') else None
line = linecache.getline(filename, lineno, globs)
if not line:
self.message('End of file')
return 0
line = line.strip()
# Don't allow setting breakpoint at a blank line
if (not line or (line[0] == '#') or
(line[:3] == '"""') or line[:3] == "'''"):
self.error('Blank or comment')
return 0
return lineno | [
"def",
"checkline",
"(",
"self",
",",
"filename",
",",
"lineno",
")",
":",
"# this method should be callable before starting debugging, so default",
"# to \"no globals\" if there is no current frame",
"globs",
"=",
"self",
".",
"curframe",
".",
"f_globals",
"if",
"hasattr",
... | https://github.com/aws/lumberyard/blob/f85344403c1c2e77ec8c75deb2c116e97b713217/dev/Tools/Python/3.7.10/linux_x64/lib/python3.7/pdb.py#L741-L760 | |
panda3d/panda3d | 833ad89ebad58395d0af0b7ec08538e5e4308265 | direct/src/extensions_native/NodePath_extensions.py | python | printPosHpr | (self, other = None, sd = 2) | Deprecated. Pretty print a node path's pos and, hpr | Deprecated. Pretty print a node path's pos and, hpr | [
"Deprecated",
".",
"Pretty",
"print",
"a",
"node",
"path",
"s",
"pos",
"and",
"hpr"
] | def printPosHpr(self, other = None, sd = 2):
""" Deprecated. Pretty print a node path's pos and, hpr """
if __debug__:
warnings.warn("NodePath.printPosHpr() is deprecated.", DeprecationWarning, stacklevel=2)
formatString = '%0.' + '%d' % sd + 'f'
if other:
pos = self.getPos(other)
hpr = self.getHpr(other)
otherString = other.getName() + ', '
else:
pos = self.getPos()
hpr = self.getHpr()
otherString = ''
print((self.getName() + '.setPosHpr(' + otherString +
formatString % pos[0] + ', ' +
formatString % pos[1] + ', ' +
formatString % pos[2] + ', ' +
formatString % hpr[0] + ', ' +
formatString % hpr[1] + ', ' +
formatString % hpr[2] +
')\n')) | [
"def",
"printPosHpr",
"(",
"self",
",",
"other",
"=",
"None",
",",
"sd",
"=",
"2",
")",
":",
"if",
"__debug__",
":",
"warnings",
".",
"warn",
"(",
"\"NodePath.printPosHpr() is deprecated.\"",
",",
"DeprecationWarning",
",",
"stacklevel",
"=",
"2",
")",
"form... | https://github.com/panda3d/panda3d/blob/833ad89ebad58395d0af0b7ec08538e5e4308265/direct/src/extensions_native/NodePath_extensions.py#L277-L297 | ||
baidu-research/tensorflow-allreduce | 66d5b855e90b0949e9fa5cca5599fd729a70e874 | tensorflow/contrib/learn/python/learn/models.py | python | get_rnn_model | (rnn_size, cell_type, num_layers, input_op_fn, bidirectional,
target_predictor_fn, sequence_length, initial_state,
attn_length, attn_size, attn_vec_size) | return rnn_estimator | Returns a function that creates a RNN TensorFlow subgraph.
Args:
rnn_size: The size for rnn cell, e.g. size of your word embeddings.
cell_type: The type of rnn cell, including rnn, gru, and lstm.
num_layers: The number of layers of the rnn model.
input_op_fn: Function that will transform the input tensor, such as
creating word embeddings, byte list, etc. This takes
an argument `x` for input and returns transformed `x`.
bidirectional: boolean, Whether this is a bidirectional rnn.
target_predictor_fn: Function that will predict target from input
features. This can be logistic regression,
linear regression or any other model,
that takes `x`, `y` and returns predictions and loss
tensors.
sequence_length: If sequence_length is provided, dynamic calculation is
performed. This saves computational time when unrolling past max sequence
length. Required for bidirectional RNNs.
initial_state: An initial state for the RNN. This must be a tensor of
appropriate type and shape [batch_size x cell.state_size].
attn_length: integer, the size of attention vector attached to rnn cells.
attn_size: integer, the size of an attention window attached to rnn cells.
attn_vec_size: integer, the number of convolutional features calculated on
attention state and the size of the hidden layer built from base cell
state.
Returns:
A function that creates the subgraph. | Returns a function that creates a RNN TensorFlow subgraph. | [
"Returns",
"a",
"function",
"that",
"creates",
"a",
"RNN",
"TensorFlow",
"subgraph",
"."
] | def get_rnn_model(rnn_size, cell_type, num_layers, input_op_fn, bidirectional,
target_predictor_fn, sequence_length, initial_state,
attn_length, attn_size, attn_vec_size):
"""Returns a function that creates a RNN TensorFlow subgraph.
Args:
rnn_size: The size for rnn cell, e.g. size of your word embeddings.
cell_type: The type of rnn cell, including rnn, gru, and lstm.
num_layers: The number of layers of the rnn model.
input_op_fn: Function that will transform the input tensor, such as
creating word embeddings, byte list, etc. This takes
an argument `x` for input and returns transformed `x`.
bidirectional: boolean, Whether this is a bidirectional rnn.
target_predictor_fn: Function that will predict target from input
features. This can be logistic regression,
linear regression or any other model,
that takes `x`, `y` and returns predictions and loss
tensors.
sequence_length: If sequence_length is provided, dynamic calculation is
performed. This saves computational time when unrolling past max sequence
length. Required for bidirectional RNNs.
initial_state: An initial state for the RNN. This must be a tensor of
appropriate type and shape [batch_size x cell.state_size].
attn_length: integer, the size of attention vector attached to rnn cells.
attn_size: integer, the size of an attention window attached to rnn cells.
attn_vec_size: integer, the number of convolutional features calculated on
attention state and the size of the hidden layer built from base cell
state.
Returns:
A function that creates the subgraph.
"""
def rnn_estimator(x, y):
"""RNN estimator with target predictor function on top."""
x = input_op_fn(x)
if cell_type == 'rnn':
cell_fn = contrib_rnn.BasicRNNCell
elif cell_type == 'gru':
cell_fn = contrib_rnn.GRUCell
elif cell_type == 'lstm':
cell_fn = functools.partial(
contrib_rnn.BasicLSTMCell, state_is_tuple=False)
else:
raise ValueError('cell_type {} is not supported. '.format(cell_type))
# TODO(ipolosukhin): state_is_tuple=False is deprecated
if bidirectional:
# forward direction cell
fw_cell = lambda: cell_fn(rnn_size)
bw_cell = lambda: cell_fn(rnn_size)
# attach attention cells if specified
if attn_length is not None:
def attn_fw_cell():
return contrib_rnn.AttentionCellWrapper(
fw_cell(),
attn_length=attn_length,
attn_size=attn_size,
attn_vec_size=attn_vec_size,
state_is_tuple=False)
def attn_bw_cell():
return contrib_rnn.AttentionCellWrapper(
bw_cell(),
attn_length=attn_length,
attn_size=attn_size,
attn_vec_size=attn_vec_size,
state_is_tuple=False)
else:
attn_fw_cell = fw_cell
attn_bw_cell = bw_cell
rnn_fw_cell = contrib_rnn.MultiRNNCell(
[attn_fw_cell() for _ in range(num_layers)], state_is_tuple=False)
# backward direction cell
rnn_bw_cell = contrib_rnn.MultiRNNCell(
[attn_bw_cell() for _ in range(num_layers)], state_is_tuple=False)
# pylint: disable=unexpected-keyword-arg, no-value-for-parameter
_, encoding = bidirectional_rnn(
rnn_fw_cell,
rnn_bw_cell,
x,
dtype=dtypes.float32,
sequence_length=sequence_length,
initial_state_fw=initial_state,
initial_state_bw=initial_state)
else:
rnn_cell = lambda: cell_fn(rnn_size)
if attn_length is not None:
def attn_rnn_cell():
return contrib_rnn.AttentionCellWrapper(
rnn_cell(),
attn_length=attn_length,
attn_size=attn_size,
attn_vec_size=attn_vec_size,
state_is_tuple=False)
else:
attn_rnn_cell = rnn_cell
cell = contrib_rnn.MultiRNNCell(
[attn_rnn_cell() for _ in range(num_layers)], state_is_tuple=False)
_, encoding = contrib_rnn.static_rnn(
cell,
x,
dtype=dtypes.float32,
sequence_length=sequence_length,
initial_state=initial_state)
return target_predictor_fn(encoding, y)
return rnn_estimator | [
"def",
"get_rnn_model",
"(",
"rnn_size",
",",
"cell_type",
",",
"num_layers",
",",
"input_op_fn",
",",
"bidirectional",
",",
"target_predictor_fn",
",",
"sequence_length",
",",
"initial_state",
",",
"attn_length",
",",
"attn_size",
",",
"attn_vec_size",
")",
":",
... | https://github.com/baidu-research/tensorflow-allreduce/blob/66d5b855e90b0949e9fa5cca5599fd729a70e874/tensorflow/contrib/learn/python/learn/models.py#L286-L395 | |
wxWidgets/wxPython-Classic | 19571e1ae65f1ac445f5491474121998c97a1bf0 | src/osx_cocoa/_core.py | python | Sizer.AddStretchSpacer | (self, prop=1) | return self.Add((0,0), prop) | AddStretchSpacer(int prop=1) --> SizerItem
Add a stretchable spacer. | AddStretchSpacer(int prop=1) --> SizerItem | [
"AddStretchSpacer",
"(",
"int",
"prop",
"=",
"1",
")",
"--",
">",
"SizerItem"
] | def AddStretchSpacer(self, prop=1):
"""AddStretchSpacer(int prop=1) --> SizerItem
Add a stretchable spacer."""
return self.Add((0,0), prop) | [
"def",
"AddStretchSpacer",
"(",
"self",
",",
"prop",
"=",
"1",
")",
":",
"return",
"self",
".",
"Add",
"(",
"(",
"0",
",",
"0",
")",
",",
"prop",
")"
] | https://github.com/wxWidgets/wxPython-Classic/blob/19571e1ae65f1ac445f5491474121998c97a1bf0/src/osx_cocoa/_core.py#L14699-L14703 | |
daijifeng001/caffe-rfcn | 543f8f6a4b7c88256ea1445ae951a12d1ad9cffd | scripts/cpp_lint.py | python | CheckForNewlineAtEOF | (filename, lines, error) | Logs an error if there is no newline char at the end of the file.
Args:
filename: The name of the current file.
lines: An array of strings, each representing a line of the file.
error: The function to call with any errors found. | Logs an error if there is no newline char at the end of the file. | [
"Logs",
"an",
"error",
"if",
"there",
"is",
"no",
"newline",
"char",
"at",
"the",
"end",
"of",
"the",
"file",
"."
] | def CheckForNewlineAtEOF(filename, lines, error):
"""Logs an error if there is no newline char at the end of the file.
Args:
filename: The name of the current file.
lines: An array of strings, each representing a line of the file.
error: The function to call with any errors found.
"""
# The array lines() was created by adding two newlines to the
# original file (go figure), then splitting on \n.
# To verify that the file ends in \n, we just have to make sure the
# last-but-two element of lines() exists and is empty.
if len(lines) < 3 or lines[-2]:
error(filename, len(lines) - 2, 'whitespace/ending_newline', 5,
'Could not find a newline character at the end of the file.') | [
"def",
"CheckForNewlineAtEOF",
"(",
"filename",
",",
"lines",
",",
"error",
")",
":",
"# The array lines() was created by adding two newlines to the",
"# original file (go figure), then splitting on \\n.",
"# To verify that the file ends in \\n, we just have to make sure the",
"# last-but-... | https://github.com/daijifeng001/caffe-rfcn/blob/543f8f6a4b7c88256ea1445ae951a12d1ad9cffd/scripts/cpp_lint.py#L1508-L1523 | ||
google/llvm-propeller | 45c226984fe8377ebfb2ad7713c680d652ba678d | lldb/third_party/Python/module/ptyprocess-0.6.0/ptyprocess/ptyprocess.py | python | PtyProcess.sendeof | (self) | return self._writeb(_EOF), _EOF | This sends an EOF to the child. This sends a character which causes
the pending parent output buffer to be sent to the waiting child
program without waiting for end-of-line. If it is the first character
of the line, the read() in the user program returns 0, which signifies
end-of-file. This means to work as expected a sendeof() has to be
called at the beginning of a line. This method does not send a newline.
It is the responsibility of the caller to ensure the eof is sent at the
beginning of a line. | This sends an EOF to the child. This sends a character which causes
the pending parent output buffer to be sent to the waiting child
program without waiting for end-of-line. If it is the first character
of the line, the read() in the user program returns 0, which signifies
end-of-file. This means to work as expected a sendeof() has to be
called at the beginning of a line. This method does not send a newline.
It is the responsibility of the caller to ensure the eof is sent at the
beginning of a line. | [
"This",
"sends",
"an",
"EOF",
"to",
"the",
"child",
".",
"This",
"sends",
"a",
"character",
"which",
"causes",
"the",
"pending",
"parent",
"output",
"buffer",
"to",
"be",
"sent",
"to",
"the",
"waiting",
"child",
"program",
"without",
"waiting",
"for",
"end... | def sendeof(self):
'''This sends an EOF to the child. This sends a character which causes
the pending parent output buffer to be sent to the waiting child
program without waiting for end-of-line. If it is the first character
of the line, the read() in the user program returns 0, which signifies
end-of-file. This means to work as expected a sendeof() has to be
called at the beginning of a line. This method does not send a newline.
It is the responsibility of the caller to ensure the eof is sent at the
beginning of a line. '''
return self._writeb(_EOF), _EOF | [
"def",
"sendeof",
"(",
"self",
")",
":",
"return",
"self",
".",
"_writeb",
"(",
"_EOF",
")",
",",
"_EOF"
] | https://github.com/google/llvm-propeller/blob/45c226984fe8377ebfb2ad7713c680d652ba678d/lldb/third_party/Python/module/ptyprocess-0.6.0/ptyprocess/ptyprocess.py#L592-L602 | |
aws/lumberyard | f85344403c1c2e77ec8c75deb2c116e97b713217 | dev/Gems/CloudGemMetric/v1/AWS/common-code/Lib/numpy/polynomial/chebyshev.py | python | chebdiv | (c1, c2) | Divide one Chebyshev series by another.
Returns the quotient-with-remainder of two Chebyshev series
`c1` / `c2`. The arguments are sequences of coefficients from lowest
order "term" to highest, e.g., [1,2,3] represents the series
``T_0 + 2*T_1 + 3*T_2``.
Parameters
----------
c1, c2 : array_like
1-D arrays of Chebyshev series coefficients ordered from low to
high.
Returns
-------
[quo, rem] : ndarrays
Of Chebyshev series coefficients representing the quotient and
remainder.
See Also
--------
chebadd, chebsub, chemulx, chebmul, chebpow
Notes
-----
In general, the (polynomial) division of one C-series by another
results in quotient and remainder terms that are not in the Chebyshev
polynomial basis set. Thus, to express these results as C-series, it
is typically necessary to "reproject" the results onto said basis
set, which typically produces "unintuitive" (but correct) results;
see Examples section below.
Examples
--------
>>> from numpy.polynomial import chebyshev as C
>>> c1 = (1,2,3)
>>> c2 = (3,2,1)
>>> C.chebdiv(c1,c2) # quotient "intuitive," remainder not
(array([3.]), array([-8., -4.]))
>>> c2 = (0,1,2,3)
>>> C.chebdiv(c2,c1) # neither "intuitive"
(array([0., 2.]), array([-2., -4.])) | Divide one Chebyshev series by another. | [
"Divide",
"one",
"Chebyshev",
"series",
"by",
"another",
"."
] | def chebdiv(c1, c2):
"""
Divide one Chebyshev series by another.
Returns the quotient-with-remainder of two Chebyshev series
`c1` / `c2`. The arguments are sequences of coefficients from lowest
order "term" to highest, e.g., [1,2,3] represents the series
``T_0 + 2*T_1 + 3*T_2``.
Parameters
----------
c1, c2 : array_like
1-D arrays of Chebyshev series coefficients ordered from low to
high.
Returns
-------
[quo, rem] : ndarrays
Of Chebyshev series coefficients representing the quotient and
remainder.
See Also
--------
chebadd, chebsub, chemulx, chebmul, chebpow
Notes
-----
In general, the (polynomial) division of one C-series by another
results in quotient and remainder terms that are not in the Chebyshev
polynomial basis set. Thus, to express these results as C-series, it
is typically necessary to "reproject" the results onto said basis
set, which typically produces "unintuitive" (but correct) results;
see Examples section below.
Examples
--------
>>> from numpy.polynomial import chebyshev as C
>>> c1 = (1,2,3)
>>> c2 = (3,2,1)
>>> C.chebdiv(c1,c2) # quotient "intuitive," remainder not
(array([3.]), array([-8., -4.]))
>>> c2 = (0,1,2,3)
>>> C.chebdiv(c2,c1) # neither "intuitive"
(array([0., 2.]), array([-2., -4.]))
"""
# c1, c2 are trimmed copies
[c1, c2] = pu.as_series([c1, c2])
if c2[-1] == 0:
raise ZeroDivisionError()
# note: this is more efficient than `pu._div(chebmul, c1, c2)`
lc1 = len(c1)
lc2 = len(c2)
if lc1 < lc2:
return c1[:1]*0, c1
elif lc2 == 1:
return c1/c2[-1], c1[:1]*0
else:
z1 = _cseries_to_zseries(c1)
z2 = _cseries_to_zseries(c2)
quo, rem = _zseries_div(z1, z2)
quo = pu.trimseq(_zseries_to_cseries(quo))
rem = pu.trimseq(_zseries_to_cseries(rem))
return quo, rem | [
"def",
"chebdiv",
"(",
"c1",
",",
"c2",
")",
":",
"# c1, c2 are trimmed copies",
"[",
"c1",
",",
"c2",
"]",
"=",
"pu",
".",
"as_series",
"(",
"[",
"c1",
",",
"c2",
"]",
")",
"if",
"c2",
"[",
"-",
"1",
"]",
"==",
"0",
":",
"raise",
"ZeroDivisionEr... | https://github.com/aws/lumberyard/blob/f85344403c1c2e77ec8c75deb2c116e97b713217/dev/Gems/CloudGemMetric/v1/AWS/common-code/Lib/numpy/polynomial/chebyshev.py#L727-L791 | ||
wxWidgets/wxPython-Classic | 19571e1ae65f1ac445f5491474121998c97a1bf0 | wx/lib/agw/ultimatelistctrl.py | python | UltimateListLineData.GetToolTip | (self, index) | return item.GetToolTip() | Returns the item tooltip at the position `index`.
:param `index`: the index of the item. | Returns the item tooltip at the position `index`. | [
"Returns",
"the",
"item",
"tooltip",
"at",
"the",
"position",
"index",
"."
] | def GetToolTip(self, index):
"""
Returns the item tooltip at the position `index`.
:param `index`: the index of the item.
"""
item = self._items[index]
return item.GetToolTip() | [
"def",
"GetToolTip",
"(",
"self",
",",
"index",
")",
":",
"item",
"=",
"self",
".",
"_items",
"[",
"index",
"]",
"return",
"item",
".",
"GetToolTip",
"(",
")"
] | https://github.com/wxWidgets/wxPython-Classic/blob/19571e1ae65f1ac445f5491474121998c97a1bf0/wx/lib/agw/ultimatelistctrl.py#L4134-L4142 | |
catboost/catboost | 167f64f237114a4d10b2b4ee42adb4569137debe | contrib/tools/python3/src/Lib/distutils/sysconfig.py | python | get_python_lib | (plat_specific=0, standard_lib=0, prefix=None) | Return the directory containing the Python library (standard or
site additions).
If 'plat_specific' is true, return the directory containing
platform-specific modules, i.e. any module from a non-pure-Python
module distribution; otherwise, return the platform-shared library
directory. If 'standard_lib' is true, return the directory
containing standard Python library modules; otherwise, return the
directory for site-specific modules.
If 'prefix' is supplied, use it instead of sys.base_prefix or
sys.base_exec_prefix -- i.e., ignore 'plat_specific'. | Return the directory containing the Python library (standard or
site additions). | [
"Return",
"the",
"directory",
"containing",
"the",
"Python",
"library",
"(",
"standard",
"or",
"site",
"additions",
")",
"."
] | def get_python_lib(plat_specific=0, standard_lib=0, prefix=None):
"""Return the directory containing the Python library (standard or
site additions).
If 'plat_specific' is true, return the directory containing
platform-specific modules, i.e. any module from a non-pure-Python
module distribution; otherwise, return the platform-shared library
directory. If 'standard_lib' is true, return the directory
containing standard Python library modules; otherwise, return the
directory for site-specific modules.
If 'prefix' is supplied, use it instead of sys.base_prefix or
sys.base_exec_prefix -- i.e., ignore 'plat_specific'.
"""
if prefix is None:
if standard_lib:
prefix = plat_specific and BASE_EXEC_PREFIX or BASE_PREFIX
else:
prefix = plat_specific and EXEC_PREFIX or PREFIX
if os.name == "posix":
if plat_specific or standard_lib:
# Platform-specific modules (any module from a non-pure-Python
# module distribution) or standard Python library modules.
libdir = sys.platlibdir
else:
# Pure Python
libdir = "lib"
libpython = os.path.join(prefix, libdir,
"python" + get_python_version())
if standard_lib:
return libpython
else:
return os.path.join(libpython, "site-packages")
elif os.name == "nt":
if standard_lib:
return os.path.join(prefix, "Lib")
else:
return os.path.join(prefix, "Lib", "site-packages")
else:
raise DistutilsPlatformError(
"I don't know where Python installs its library "
"on platform '%s'" % os.name) | [
"def",
"get_python_lib",
"(",
"plat_specific",
"=",
"0",
",",
"standard_lib",
"=",
"0",
",",
"prefix",
"=",
"None",
")",
":",
"if",
"prefix",
"is",
"None",
":",
"if",
"standard_lib",
":",
"prefix",
"=",
"plat_specific",
"and",
"BASE_EXEC_PREFIX",
"or",
"BA... | https://github.com/catboost/catboost/blob/167f64f237114a4d10b2b4ee42adb4569137debe/contrib/tools/python3/src/Lib/distutils/sysconfig.py#L127-L169 | ||
openvinotoolkit/openvino | dedcbeafa8b84cccdc55ca64b8da516682b381c7 | src/bindings/python/src/compatibility/ngraph/opset4/ops.py | python | softplus | (data: NodeInput, name: Optional[str] = None) | return _get_node_factory_opset4().create("SoftPlus", as_nodes(data), {}) | Apply SoftPlus operation on each element of input tensor.
:param data: The tensor providing input data.
:return: The new node with SoftPlus operation applied on each element. | Apply SoftPlus operation on each element of input tensor. | [
"Apply",
"SoftPlus",
"operation",
"on",
"each",
"element",
"of",
"input",
"tensor",
"."
] | def softplus(data: NodeInput, name: Optional[str] = None) -> Node:
"""Apply SoftPlus operation on each element of input tensor.
:param data: The tensor providing input data.
:return: The new node with SoftPlus operation applied on each element.
"""
return _get_node_factory_opset4().create("SoftPlus", as_nodes(data), {}) | [
"def",
"softplus",
"(",
"data",
":",
"NodeInput",
",",
"name",
":",
"Optional",
"[",
"str",
"]",
"=",
"None",
")",
"->",
"Node",
":",
"return",
"_get_node_factory_opset4",
"(",
")",
".",
"create",
"(",
"\"SoftPlus\"",
",",
"as_nodes",
"(",
"data",
")",
... | https://github.com/openvinotoolkit/openvino/blob/dedcbeafa8b84cccdc55ca64b8da516682b381c7/src/bindings/python/src/compatibility/ngraph/opset4/ops.py#L130-L136 | |
Xilinx/Vitis-AI | fc74d404563d9951b57245443c73bef389f3657f | tools/Vitis-AI-Quantizer/vai_q_tensorflow1.x/configure.py | python | config_info_line | (name, help_text) | Helper function to print formatted help text for Bazel config options. | Helper function to print formatted help text for Bazel config options. | [
"Helper",
"function",
"to",
"print",
"formatted",
"help",
"text",
"for",
"Bazel",
"config",
"options",
"."
] | def config_info_line(name, help_text):
"""Helper function to print formatted help text for Bazel config options."""
print('\t--config=%-12s\t# %s' % (name, help_text)) | [
"def",
"config_info_line",
"(",
"name",
",",
"help_text",
")",
":",
"print",
"(",
"'\\t--config=%-12s\\t# %s'",
"%",
"(",
"name",
",",
"help_text",
")",
")"
] | https://github.com/Xilinx/Vitis-AI/blob/fc74d404563d9951b57245443c73bef389f3657f/tools/Vitis-AI-Quantizer/vai_q_tensorflow1.x/configure.py#L1296-L1298 | ||
adobe/chromium | cfe5bf0b51b1f6b9fe239c2a3c2f2364da9967d7 | third_party/mesa/MesaLib/src/mapi/glapi/gen/gl_XML.py | python | gl_print_base.printFastcall | (self) | return | Conditionally define `FASTCALL' function attribute.
Conditionally defines a preprocessor macro `FASTCALL' that
wraps GCC's `fastcall' function attribute. The conditional
code can be easilly adapted to other compilers that support a
similar feature.
The name is also added to the file's undef_list. | Conditionally define `FASTCALL' function attribute. | [
"Conditionally",
"define",
"FASTCALL",
"function",
"attribute",
"."
] | def printFastcall(self):
"""Conditionally define `FASTCALL' function attribute.
Conditionally defines a preprocessor macro `FASTCALL' that
wraps GCC's `fastcall' function attribute. The conditional
code can be easilly adapted to other compilers that support a
similar feature.
The name is also added to the file's undef_list.
"""
self.undef_list.append("FASTCALL")
print """# if defined(__i386__) && defined(__GNUC__) && !defined(__CYGWIN__) && !defined(__MINGW32__)
# define FASTCALL __attribute__((fastcall))
# else
# define FASTCALL
# endif"""
return | [
"def",
"printFastcall",
"(",
"self",
")",
":",
"self",
".",
"undef_list",
".",
"append",
"(",
"\"FASTCALL\"",
")",
"print",
"\"\"\"# if defined(__i386__) && defined(__GNUC__) && !defined(__CYGWIN__) && !defined(__MINGW32__)\n# define FASTCALL __attribute__((fastcall))\n# else\n# ... | https://github.com/adobe/chromium/blob/cfe5bf0b51b1f6b9fe239c2a3c2f2364da9967d7/third_party/mesa/MesaLib/src/mapi/glapi/gen/gl_XML.py#L195-L212 | |
windystrife/UnrealEngine_NVIDIAGameWorks | b50e6338a7c5b26374d66306ebc7807541ff815e | Engine/Source/ThirdParty/CEF3/cef_source/tools/make_distrib.py | python | create_fuzed_gtest | (tests_dir) | Generate a fuzed version of gtest and build the expected directory structure. | Generate a fuzed version of gtest and build the expected directory structure. | [
"Generate",
"a",
"fuzed",
"version",
"of",
"gtest",
"and",
"build",
"the",
"expected",
"directory",
"structure",
"."
] | def create_fuzed_gtest(tests_dir):
""" Generate a fuzed version of gtest and build the expected directory structure. """
src_gtest_dir = os.path.join(src_dir, 'testing', 'gtest')
run('%s fuse_gtest_files.py \"%s\"' % (sys.executable, tests_dir),
os.path.join(src_gtest_dir, 'scripts'))
if not options.quiet:
sys.stdout.write('Building gtest directory structure.\n')
target_gtest_dir = os.path.join(tests_dir, 'gtest')
gtest_header = os.path.join(target_gtest_dir, 'gtest.h')
gtest_cpp = os.path.join(target_gtest_dir, 'gtest-all.cc')
if not os.path.exists(gtest_header):
raise Exception('Generated file not found: %s' % gtest_header)
if not os.path.exists(gtest_cpp):
raise Exception('Generated file not found: %s' % gtest_cpp)
# gtest header file at tests/gtest/include/gtest/gtest.h
target_gtest_header_dir = os.path.join(target_gtest_dir, 'include', 'gtest')
make_dir(target_gtest_header_dir, options.quiet)
move_file(gtest_header, target_gtest_header_dir, options.quiet)
# gtest source file at tests/gtest/src/gtest-all.cc
target_gtest_cpp_dir = os.path.join(target_gtest_dir, 'src')
make_dir(target_gtest_cpp_dir, options.quiet)
move_file(gtest_cpp, target_gtest_cpp_dir, options.quiet)
# gtest LICENSE file at tests/gtest/LICENSE
copy_file(os.path.join(src_gtest_dir, 'LICENSE'), target_gtest_dir, options.quiet)
# CEF README file at tests/gtest/README.cef
copy_file(os.path.join(cef_dir, 'tests', 'gtest', 'README.cef.in'),
os.path.join(target_gtest_dir, 'README.cef'), options.quiet) | [
"def",
"create_fuzed_gtest",
"(",
"tests_dir",
")",
":",
"src_gtest_dir",
"=",
"os",
".",
"path",
".",
"join",
"(",
"src_dir",
",",
"'testing'",
",",
"'gtest'",
")",
"run",
"(",
"'%s fuse_gtest_files.py \\\"%s\\\"'",
"%",
"(",
"sys",
".",
"executable",
",",
... | https://github.com/windystrife/UnrealEngine_NVIDIAGameWorks/blob/b50e6338a7c5b26374d66306ebc7807541ff815e/Engine/Source/ThirdParty/CEF3/cef_source/tools/make_distrib.py#L151-L184 | ||
pytorch/pytorch | 7176c92687d3cc847cc046bf002269c6949a21c2 | torch/distributed/remote_device.py | python | _remote_device.worker_name | (self) | return self._worker_name | Returns the name of remote worker representing the remote device.
Returns ``None`` if no worker name is available. | Returns the name of remote worker representing the remote device.
Returns ``None`` if no worker name is available. | [
"Returns",
"the",
"name",
"of",
"remote",
"worker",
"representing",
"the",
"remote",
"device",
".",
"Returns",
"None",
"if",
"no",
"worker",
"name",
"is",
"available",
"."
] | def worker_name(self) -> Optional[str]:
"""
Returns the name of remote worker representing the remote device.
Returns ``None`` if no worker name is available.
"""
return self._worker_name | [
"def",
"worker_name",
"(",
"self",
")",
"->",
"Optional",
"[",
"str",
"]",
":",
"return",
"self",
".",
"_worker_name"
] | https://github.com/pytorch/pytorch/blob/7176c92687d3cc847cc046bf002269c6949a21c2/torch/distributed/remote_device.py#L80-L85 | |
hanpfei/chromium-net | 392cc1fa3a8f92f42e4071ab6e674d8e0482f83f | third_party/catapult/third_party/gsutil/third_party/boto/boto/configservice/layer1.py | python | ConfigServiceConnection.describe_delivery_channels | (self, delivery_channel_names=None) | return self.make_request(action='DescribeDeliveryChannels',
body=json.dumps(params)) | Returns details about the specified delivery channel. If a
delivery channel is not specified, this action returns the
details of all delivery channels associated with the account.
:type delivery_channel_names: list
:param delivery_channel_names: A list of delivery channel names. | Returns details about the specified delivery channel. If a
delivery channel is not specified, this action returns the
details of all delivery channels associated with the account. | [
"Returns",
"details",
"about",
"the",
"specified",
"delivery",
"channel",
".",
"If",
"a",
"delivery",
"channel",
"is",
"not",
"specified",
"this",
"action",
"returns",
"the",
"details",
"of",
"all",
"delivery",
"channels",
"associated",
"with",
"the",
"account",... | def describe_delivery_channels(self, delivery_channel_names=None):
"""
Returns details about the specified delivery channel. If a
delivery channel is not specified, this action returns the
details of all delivery channels associated with the account.
:type delivery_channel_names: list
:param delivery_channel_names: A list of delivery channel names.
"""
params = {}
if delivery_channel_names is not None:
params['DeliveryChannelNames'] = delivery_channel_names
return self.make_request(action='DescribeDeliveryChannels',
body=json.dumps(params)) | [
"def",
"describe_delivery_channels",
"(",
"self",
",",
"delivery_channel_names",
"=",
"None",
")",
":",
"params",
"=",
"{",
"}",
"if",
"delivery_channel_names",
"is",
"not",
"None",
":",
"params",
"[",
"'DeliveryChannelNames'",
"]",
"=",
"delivery_channel_names",
... | https://github.com/hanpfei/chromium-net/blob/392cc1fa3a8f92f42e4071ab6e674d8e0482f83f/third_party/catapult/third_party/gsutil/third_party/boto/boto/configservice/layer1.py#L205-L219 | |
wlanjie/AndroidFFmpeg | 7baf9122f4b8e1c74e7baf4be5c422c7a5ba5aaf | tools/fdk-aac-build/armeabi-v7a/toolchain/lib/python2.7/lib-tk/Tkinter.py | python | Text.debug | (self, boolean=None) | return self.tk.getboolean(self.tk.call(
self._w, 'debug', boolean)) | Turn on the internal consistency checks of the B-Tree inside the text
widget according to BOOLEAN. | Turn on the internal consistency checks of the B-Tree inside the text
widget according to BOOLEAN. | [
"Turn",
"on",
"the",
"internal",
"consistency",
"checks",
"of",
"the",
"B",
"-",
"Tree",
"inside",
"the",
"text",
"widget",
"according",
"to",
"BOOLEAN",
"."
] | def debug(self, boolean=None):
"""Turn on the internal consistency checks of the B-Tree inside the text
widget according to BOOLEAN."""
return self.tk.getboolean(self.tk.call(
self._w, 'debug', boolean)) | [
"def",
"debug",
"(",
"self",
",",
"boolean",
"=",
"None",
")",
":",
"return",
"self",
".",
"tk",
".",
"getboolean",
"(",
"self",
".",
"tk",
".",
"call",
"(",
"self",
".",
"_w",
",",
"'debug'",
",",
"boolean",
")",
")"
] | https://github.com/wlanjie/AndroidFFmpeg/blob/7baf9122f4b8e1c74e7baf4be5c422c7a5ba5aaf/tools/fdk-aac-build/armeabi-v7a/toolchain/lib/python2.7/lib-tk/Tkinter.py#L2908-L2912 | |
cms-sw/cmssw | fd9de012d503d3405420bcbeec0ec879baa57cf2 | Validation/Tools/python/GenObject.py | python | GenObject.printGlobal | () | Meant for debugging, but ok if called by user | Meant for debugging, but ok if called by user | [
"Meant",
"for",
"debugging",
"but",
"ok",
"if",
"called",
"by",
"user"
] | def printGlobal():
"""Meant for debugging, but ok if called by user"""
print("objs: ")
pprint.pprint (GenObject._objsDict, indent=4)
print("equiv: ")
pprint.pprint (GenObject._equivDict, indent=4)
print("ntuple: ")
pprint.pprint (GenObject._ntupleDict, indent=4)
print("tofill: ")
pprint.pprint (GenObject._tofillDict, indent=4)
print("kitchenSink: ")
pprint.pprint (GenObject._kitchenSinkDict, indent=4)
print("rootClassDict")
pprint.pprint (GenObject._rootClassDict, indent=4) | [
"def",
"printGlobal",
"(",
")",
":",
"print",
"(",
"\"objs: \"",
")",
"pprint",
".",
"pprint",
"(",
"GenObject",
".",
"_objsDict",
",",
"indent",
"=",
"4",
")",
"print",
"(",
"\"equiv: \"",
")",
"pprint",
".",
"pprint",
"(",
"GenObject",
".",
"_equivDict... | https://github.com/cms-sw/cmssw/blob/fd9de012d503d3405420bcbeec0ec879baa57cf2/Validation/Tools/python/GenObject.py#L178-L191 | ||
eventql/eventql | 7ca0dbb2e683b525620ea30dc40540a22d5eb227 | deps/3rdparty/spidermonkey/mozjs/python/mozbuild/mozpack/files.py | python | XPTFile.remove | (self, xpt) | Remove the given XPT file (as a BaseFile instance) from the list of
XPTs to link. | Remove the given XPT file (as a BaseFile instance) from the list of
XPTs to link. | [
"Remove",
"the",
"given",
"XPT",
"file",
"(",
"as",
"a",
"BaseFile",
"instance",
")",
"from",
"the",
"list",
"of",
"XPTs",
"to",
"link",
"."
] | def remove(self, xpt):
'''
Remove the given XPT file (as a BaseFile instance) from the list of
XPTs to link.
'''
assert isinstance(xpt, BaseFile)
self._files.remove(xpt) | [
"def",
"remove",
"(",
"self",
",",
"xpt",
")",
":",
"assert",
"isinstance",
"(",
"xpt",
",",
"BaseFile",
")",
"self",
".",
"_files",
".",
"remove",
"(",
"xpt",
")"
] | https://github.com/eventql/eventql/blob/7ca0dbb2e683b525620ea30dc40540a22d5eb227/deps/3rdparty/spidermonkey/mozjs/python/mozbuild/mozpack/files.py#L492-L498 | ||
windystrife/UnrealEngine_NVIDIAGameWorks | b50e6338a7c5b26374d66306ebc7807541ff815e | Engine/Source/ThirdParty/CEF3/pristine/cef_source/tools/cefbuilds/cef_json_builder.py | python | cef_json_builder.is_valid_version | (version) | return bool(re.compile('^3.[0-9]{4,5}.[0-9]{4,5}.g[0-9a-f]{7}$').match(version)) | Returns true if the specified CEF version is fully qualified and valid. | Returns true if the specified CEF version is fully qualified and valid. | [
"Returns",
"true",
"if",
"the",
"specified",
"CEF",
"version",
"is",
"fully",
"qualified",
"and",
"valid",
"."
] | def is_valid_version(version):
""" Returns true if the specified CEF version is fully qualified and valid. """
return bool(re.compile('^3.[0-9]{4,5}.[0-9]{4,5}.g[0-9a-f]{7}$').match(version)) | [
"def",
"is_valid_version",
"(",
"version",
")",
":",
"return",
"bool",
"(",
"re",
".",
"compile",
"(",
"'^3.[0-9]{4,5}.[0-9]{4,5}.g[0-9a-f]{7}$'",
")",
".",
"match",
"(",
"version",
")",
")"
] | https://github.com/windystrife/UnrealEngine_NVIDIAGameWorks/blob/b50e6338a7c5b26374d66306ebc7807541ff815e/Engine/Source/ThirdParty/CEF3/pristine/cef_source/tools/cefbuilds/cef_json_builder.py#L86-L88 | |
NVIDIAGameWorks/kaolin | e5148d05e9c1e2ce92a07881ce3593b1c5c3f166 | kaolin/render/spc/raytrace.py | python | mark_pack_boundaries | (pack_ids) | return _C.render.spc.mark_pack_boundaries_cuda(pack_ids.contiguous()).bool() | r"""Mark the boundaries of pack IDs.
Pack IDs are sorted tensors which mark the ID of the pack each element belongs in.
For example, the SPC ray trace kernel will return the ray index tensor which marks the ID of the ray
that each intersection belongs in. This kernel will mark the beginning of each of those packs of
intersections with a boolean mask (true where the beginning is).
Args:
pack_ids (torch.Tensor): pack ids of shape :math:`(\text{num_elems})`
This can be any integral (n-bit integer) type.
Returns:
first_hits (torch.BoolTensor): the boolean mask marking the boundaries.
Examples:
>>> pack_ids = torch.IntTensor([1,1,1,1,2,2,2]).to('cuda:0')
>>> mark_pack_boundaries(pack_ids)
tensor([ True, False, False, False, True, False, False], device='cuda:0') | r"""Mark the boundaries of pack IDs. | [
"r",
"Mark",
"the",
"boundaries",
"of",
"pack",
"IDs",
"."
] | def mark_pack_boundaries(pack_ids):
r"""Mark the boundaries of pack IDs.
Pack IDs are sorted tensors which mark the ID of the pack each element belongs in.
For example, the SPC ray trace kernel will return the ray index tensor which marks the ID of the ray
that each intersection belongs in. This kernel will mark the beginning of each of those packs of
intersections with a boolean mask (true where the beginning is).
Args:
pack_ids (torch.Tensor): pack ids of shape :math:`(\text{num_elems})`
This can be any integral (n-bit integer) type.
Returns:
first_hits (torch.BoolTensor): the boolean mask marking the boundaries.
Examples:
>>> pack_ids = torch.IntTensor([1,1,1,1,2,2,2]).to('cuda:0')
>>> mark_pack_boundaries(pack_ids)
tensor([ True, False, False, False, True, False, False], device='cuda:0')
"""
return _C.render.spc.mark_pack_boundaries_cuda(pack_ids.contiguous()).bool() | [
"def",
"mark_pack_boundaries",
"(",
"pack_ids",
")",
":",
"return",
"_C",
".",
"render",
".",
"spc",
".",
"mark_pack_boundaries_cuda",
"(",
"pack_ids",
".",
"contiguous",
"(",
")",
")",
".",
"bool",
"(",
")"
] | https://github.com/NVIDIAGameWorks/kaolin/blob/e5148d05e9c1e2ce92a07881ce3593b1c5c3f166/kaolin/render/spc/raytrace.py#L86-L106 | |
aws/lumberyard | f85344403c1c2e77ec8c75deb2c116e97b713217 | dev/Gems/CloudGemDefectReporter/v1/AWS/common-code/Lib/pkg_resources/__init__.py | python | WorkingSet._build_master | (cls) | return ws | Prepare the master working set. | Prepare the master working set. | [
"Prepare",
"the",
"master",
"working",
"set",
"."
] | def _build_master(cls):
"""
Prepare the master working set.
"""
ws = cls()
try:
from __main__ import __requires__
except ImportError:
# The main program does not list any requirements
return ws
# ensure the requirements are met
try:
ws.require(__requires__)
except VersionConflict:
return cls._build_from_requirements(__requires__)
return ws | [
"def",
"_build_master",
"(",
"cls",
")",
":",
"ws",
"=",
"cls",
"(",
")",
"try",
":",
"from",
"__main__",
"import",
"__requires__",
"except",
"ImportError",
":",
"# The main program does not list any requirements",
"return",
"ws",
"# ensure the requirements are met",
... | https://github.com/aws/lumberyard/blob/f85344403c1c2e77ec8c75deb2c116e97b713217/dev/Gems/CloudGemDefectReporter/v1/AWS/common-code/Lib/pkg_resources/__init__.py#L653-L670 | |
mongodb/mongo | d8ff665343ad29cf286ee2cf4a1960d29371937b | src/third_party/scons-3.1.2/scons-local-3.1.2/SCons/Environment.py | python | Base.FindIxes | (self, paths, prefix, suffix) | Search a list of paths for something that matches the prefix and suffix.
paths - the list of paths or nodes.
prefix - construction variable for the prefix.
suffix - construction variable for the suffix. | Search a list of paths for something that matches the prefix and suffix. | [
"Search",
"a",
"list",
"of",
"paths",
"for",
"something",
"that",
"matches",
"the",
"prefix",
"and",
"suffix",
"."
] | def FindIxes(self, paths, prefix, suffix):
"""
Search a list of paths for something that matches the prefix and suffix.
paths - the list of paths or nodes.
prefix - construction variable for the prefix.
suffix - construction variable for the suffix.
"""
suffix = self.subst('$'+suffix)
prefix = self.subst('$'+prefix)
for path in paths:
dir,name = os.path.split(str(path))
if name[:len(prefix)] == prefix and name[-len(suffix):] == suffix:
return path | [
"def",
"FindIxes",
"(",
"self",
",",
"paths",
",",
"prefix",
",",
"suffix",
")",
":",
"suffix",
"=",
"self",
".",
"subst",
"(",
"'$'",
"+",
"suffix",
")",
"prefix",
"=",
"self",
".",
"subst",
"(",
"'$'",
"+",
"prefix",
")",
"for",
"path",
"in",
"... | https://github.com/mongodb/mongo/blob/d8ff665343ad29cf286ee2cf4a1960d29371937b/src/third_party/scons-3.1.2/scons-local-3.1.2/SCons/Environment.py#L1556-L1571 | ||
windystrife/UnrealEngine_NVIDIAGameWorks | b50e6338a7c5b26374d66306ebc7807541ff815e | Engine/Extras/ThirdPartyNotUE/emsdk/Win64/python/2.7.5.3_64bit/Lib/idlelib/rpc.py | python | SocketIO.EOFhook | (self) | Classes using rpc client/server can override to augment EOF action | Classes using rpc client/server can override to augment EOF action | [
"Classes",
"using",
"rpc",
"client",
"/",
"server",
"can",
"override",
"to",
"augment",
"EOF",
"action"
] | def EOFhook(self):
"Classes using rpc client/server can override to augment EOF action"
pass | [
"def",
"EOFhook",
"(",
"self",
")",
":",
"pass"
] | https://github.com/windystrife/UnrealEngine_NVIDIAGameWorks/blob/b50e6338a7c5b26374d66306ebc7807541ff815e/Engine/Extras/ThirdPartyNotUE/emsdk/Win64/python/2.7.5.3_64bit/Lib/idlelib/rpc.py#L475-L477 | ||
catboost/catboost | 167f64f237114a4d10b2b4ee42adb4569137debe | contrib/python/pandas/py2/pandas/core/indexes/base.py | python | Index._validate_for_numeric_unaryop | (self, op, opstr) | Validate if we can perform a numeric unary operation. | Validate if we can perform a numeric unary operation. | [
"Validate",
"if",
"we",
"can",
"perform",
"a",
"numeric",
"unary",
"operation",
"."
] | def _validate_for_numeric_unaryop(self, op, opstr):
"""
Validate if we can perform a numeric unary operation.
"""
if not self._is_numeric_dtype:
raise TypeError("cannot evaluate a numeric op "
"{opstr} for type: {typ}"
.format(opstr=opstr, typ=type(self).__name__)) | [
"def",
"_validate_for_numeric_unaryop",
"(",
"self",
",",
"op",
",",
"opstr",
")",
":",
"if",
"not",
"self",
".",
"_is_numeric_dtype",
":",
"raise",
"TypeError",
"(",
"\"cannot evaluate a numeric op \"",
"\"{opstr} for type: {typ}\"",
".",
"format",
"(",
"opstr",
"=... | https://github.com/catboost/catboost/blob/167f64f237114a4d10b2b4ee42adb4569137debe/contrib/python/pandas/py2/pandas/core/indexes/base.py#L5050-L5057 | ||
PaddlePaddle/Paddle | 1252f4bb3e574df80aa6d18c7ddae1b3a90bd81c | python/paddle/distributed/fleet/utils/fs.py | python | HDFSClient.is_dir | (self, fs_path) | return self._is_dir(fs_path) | Whether the remote HDFS path is a directory.
Args:
fs_path(str): The HDFS file path.
Returns:
Bool: Return true if the path exists and it's a directory, otherwise return false.
Examples:
.. code-block:: text
from paddle.distributed.fleet.utils import HDFSClient
hadoop_home = "/home/client/hadoop-client/hadoop/"
configs = {
"fs.default.name": "hdfs://xxx.hadoop.com:54310",
"hadoop.job.ugi": "hello,hello123"
}
client = HDFSClient(hadoop_home, configs)
ret = client.is_file("hdfs:/test_hdfs_client") | Whether the remote HDFS path is a directory. | [
"Whether",
"the",
"remote",
"HDFS",
"path",
"is",
"a",
"directory",
"."
] | def is_dir(self, fs_path):
"""
Whether the remote HDFS path is a directory.
Args:
fs_path(str): The HDFS file path.
Returns:
Bool: Return true if the path exists and it's a directory, otherwise return false.
Examples:
.. code-block:: text
from paddle.distributed.fleet.utils import HDFSClient
hadoop_home = "/home/client/hadoop-client/hadoop/"
configs = {
"fs.default.name": "hdfs://xxx.hadoop.com:54310",
"hadoop.job.ugi": "hello,hello123"
}
client = HDFSClient(hadoop_home, configs)
ret = client.is_file("hdfs:/test_hdfs_client")
"""
if not self.is_exist(fs_path):
return False
return self._is_dir(fs_path) | [
"def",
"is_dir",
"(",
"self",
",",
"fs_path",
")",
":",
"if",
"not",
"self",
".",
"is_exist",
"(",
"fs_path",
")",
":",
"return",
"False",
"return",
"self",
".",
"_is_dir",
"(",
"fs_path",
")"
] | https://github.com/PaddlePaddle/Paddle/blob/1252f4bb3e574df80aa6d18c7ddae1b3a90bd81c/python/paddle/distributed/fleet/utils/fs.py#L581-L609 | |
aws/lumberyard | f85344403c1c2e77ec8c75deb2c116e97b713217 | dev/Tools/Python/3.7.10/windows/Lib/site-packages/pip/_vendor/ipaddress.py | python | _IPAddressBase.reverse_pointer | (self) | return self._reverse_pointer() | The name of the reverse DNS pointer for the IP address, e.g.:
>>> ipaddress.ip_address("127.0.0.1").reverse_pointer
'1.0.0.127.in-addr.arpa'
>>> ipaddress.ip_address("2001:db8::1").reverse_pointer
'1.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.8.b.d.0.1.0.0.2.ip6.arpa' | The name of the reverse DNS pointer for the IP address, e.g.:
>>> ipaddress.ip_address("127.0.0.1").reverse_pointer
'1.0.0.127.in-addr.arpa'
>>> ipaddress.ip_address("2001:db8::1").reverse_pointer
'1.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.8.b.d.0.1.0.0.2.ip6.arpa' | [
"The",
"name",
"of",
"the",
"reverse",
"DNS",
"pointer",
"for",
"the",
"IP",
"address",
"e",
".",
"g",
".",
":",
">>>",
"ipaddress",
".",
"ip_address",
"(",
"127",
".",
"0",
".",
"0",
".",
"1",
")",
".",
"reverse_pointer",
"1",
".",
"0",
".",
"0"... | def reverse_pointer(self):
"""The name of the reverse DNS pointer for the IP address, e.g.:
>>> ipaddress.ip_address("127.0.0.1").reverse_pointer
'1.0.0.127.in-addr.arpa'
>>> ipaddress.ip_address("2001:db8::1").reverse_pointer
'1.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.8.b.d.0.1.0.0.2.ip6.arpa'
"""
return self._reverse_pointer() | [
"def",
"reverse_pointer",
"(",
"self",
")",
":",
"return",
"self",
".",
"_reverse_pointer",
"(",
")"
] | https://github.com/aws/lumberyard/blob/f85344403c1c2e77ec8c75deb2c116e97b713217/dev/Tools/Python/3.7.10/windows/Lib/site-packages/pip/_vendor/ipaddress.py#L522-L530 | |
wxWidgets/wxPython-Classic | 19571e1ae65f1ac445f5491474121998c97a1bf0 | src/osx_cocoa/propgrid.py | python | PropertyGridInterface.RemoveProperty | (*args, **kwargs) | return _propgrid.PropertyGridInterface_RemoveProperty(*args, **kwargs) | RemoveProperty(self, PGPropArg id) -> PGProperty | RemoveProperty(self, PGPropArg id) -> PGProperty | [
"RemoveProperty",
"(",
"self",
"PGPropArg",
"id",
")",
"-",
">",
"PGProperty"
] | def RemoveProperty(*args, **kwargs):
"""RemoveProperty(self, PGPropArg id) -> PGProperty"""
return _propgrid.PropertyGridInterface_RemoveProperty(*args, **kwargs) | [
"def",
"RemoveProperty",
"(",
"*",
"args",
",",
"*",
"*",
"kwargs",
")",
":",
"return",
"_propgrid",
".",
"PropertyGridInterface_RemoveProperty",
"(",
"*",
"args",
",",
"*",
"*",
"kwargs",
")"
] | https://github.com/wxWidgets/wxPython-Classic/blob/19571e1ae65f1ac445f5491474121998c97a1bf0/src/osx_cocoa/propgrid.py#L1135-L1137 | |
catboost/catboost | 167f64f237114a4d10b2b4ee42adb4569137debe | contrib/python/scipy/py3/scipy/optimize/_lsq/common.py | python | intersect_trust_region | (x, s, Delta) | Find the intersection of a line with the boundary of a trust region.
This function solves the quadratic equation with respect to t
||(x + s*t)||**2 = Delta**2.
Returns
-------
t_neg, t_pos : tuple of float
Negative and positive roots.
Raises
------
ValueError
If `s` is zero or `x` is not within the trust region. | Find the intersection of a line with the boundary of a trust region.
This function solves the quadratic equation with respect to t
||(x + s*t)||**2 = Delta**2.
Returns
-------
t_neg, t_pos : tuple of float
Negative and positive roots.
Raises
------
ValueError
If `s` is zero or `x` is not within the trust region. | [
"Find",
"the",
"intersection",
"of",
"a",
"line",
"with",
"the",
"boundary",
"of",
"a",
"trust",
"region",
".",
"This",
"function",
"solves",
"the",
"quadratic",
"equation",
"with",
"respect",
"to",
"t",
"||",
"(",
"x",
"+",
"s",
"*",
"t",
")",
"||",
... | def intersect_trust_region(x, s, Delta):
"""Find the intersection of a line with the boundary of a trust region.
This function solves the quadratic equation with respect to t
||(x + s*t)||**2 = Delta**2.
Returns
-------
t_neg, t_pos : tuple of float
Negative and positive roots.
Raises
------
ValueError
If `s` is zero or `x` is not within the trust region.
"""
a = np.dot(s, s)
if a == 0:
raise ValueError("`s` is zero.")
b = np.dot(x, s)
c = np.dot(x, x) - Delta**2
if c > 0:
raise ValueError("`x` is not within the trust region.")
d = np.sqrt(b*b - a*c) # Root from one fourth of the discriminant.
# Computations below avoid loss of significance, see "Numerical Recipes".
q = -(b + copysign(d, b))
t1 = q / a
t2 = c / q
if t1 < t2:
return t1, t2
else:
return t2, t1 | [
"def",
"intersect_trust_region",
"(",
"x",
",",
"s",
",",
"Delta",
")",
":",
"a",
"=",
"np",
".",
"dot",
"(",
"s",
",",
"s",
")",
"if",
"a",
"==",
"0",
":",
"raise",
"ValueError",
"(",
"\"`s` is zero.\"",
")",
"b",
"=",
"np",
".",
"dot",
"(",
"... | https://github.com/catboost/catboost/blob/167f64f237114a4d10b2b4ee42adb4569137debe/contrib/python/scipy/py3/scipy/optimize/_lsq/common.py#L20-L56 | ||
swift/swift | 12d031cf8177fdec0137f9aa7e2912fa23c4416b | 3rdParty/SCons/scons-3.0.1/engine/SCons/Node/FS.py | python | FS.VariantDir | (self, variant_dir, src_dir, duplicate=1) | Link the supplied variant directory to the source directory
for purposes of building files. | Link the supplied variant directory to the source directory
for purposes of building files. | [
"Link",
"the",
"supplied",
"variant",
"directory",
"to",
"the",
"source",
"directory",
"for",
"purposes",
"of",
"building",
"files",
"."
] | def VariantDir(self, variant_dir, src_dir, duplicate=1):
"""Link the supplied variant directory to the source directory
for purposes of building files."""
if not isinstance(src_dir, SCons.Node.Node):
src_dir = self.Dir(src_dir)
if not isinstance(variant_dir, SCons.Node.Node):
variant_dir = self.Dir(variant_dir)
if src_dir.is_under(variant_dir):
raise SCons.Errors.UserError("Source directory cannot be under variant directory.")
if variant_dir.srcdir:
if variant_dir.srcdir == src_dir:
return # We already did this.
raise SCons.Errors.UserError("'%s' already has a source directory: '%s'."%(variant_dir, variant_dir.srcdir))
variant_dir.link(src_dir, duplicate) | [
"def",
"VariantDir",
"(",
"self",
",",
"variant_dir",
",",
"src_dir",
",",
"duplicate",
"=",
"1",
")",
":",
"if",
"not",
"isinstance",
"(",
"src_dir",
",",
"SCons",
".",
"Node",
".",
"Node",
")",
":",
"src_dir",
"=",
"self",
".",
"Dir",
"(",
"src_dir... | https://github.com/swift/swift/blob/12d031cf8177fdec0137f9aa7e2912fa23c4416b/3rdParty/SCons/scons-3.0.1/engine/SCons/Node/FS.py#L1370-L1384 | ||
wxWidgets/wxPython-Classic | 19571e1ae65f1ac445f5491474121998c97a1bf0 | src/msw/_controls.py | python | ColourPickerCtrl.SetColour | (*args, **kwargs) | return _controls_.ColourPickerCtrl_SetColour(*args, **kwargs) | SetColour(self, Colour col)
Set the displayed colour. | SetColour(self, Colour col) | [
"SetColour",
"(",
"self",
"Colour",
"col",
")"
] | def SetColour(*args, **kwargs):
"""
SetColour(self, Colour col)
Set the displayed colour.
"""
return _controls_.ColourPickerCtrl_SetColour(*args, **kwargs) | [
"def",
"SetColour",
"(",
"*",
"args",
",",
"*",
"*",
"kwargs",
")",
":",
"return",
"_controls_",
".",
"ColourPickerCtrl_SetColour",
"(",
"*",
"args",
",",
"*",
"*",
"kwargs",
")"
] | https://github.com/wxWidgets/wxPython-Classic/blob/19571e1ae65f1ac445f5491474121998c97a1bf0/src/msw/_controls.py#L6954-L6960 | |
aws/lumberyard | f85344403c1c2e77ec8c75deb2c116e97b713217 | dev/Tools/Python/3.7.10/mac/Python.framework/Versions/3.7/lib/python3.7/distutils/dist.py | python | Distribution.get_option_dict | (self, command) | return dict | Get the option dictionary for a given command. If that
command's option dictionary hasn't been created yet, then create it
and return the new dictionary; otherwise, return the existing
option dictionary. | Get the option dictionary for a given command. If that
command's option dictionary hasn't been created yet, then create it
and return the new dictionary; otherwise, return the existing
option dictionary. | [
"Get",
"the",
"option",
"dictionary",
"for",
"a",
"given",
"command",
".",
"If",
"that",
"command",
"s",
"option",
"dictionary",
"hasn",
"t",
"been",
"created",
"yet",
"then",
"create",
"it",
"and",
"return",
"the",
"new",
"dictionary",
";",
"otherwise",
"... | def get_option_dict(self, command):
"""Get the option dictionary for a given command. If that
command's option dictionary hasn't been created yet, then create it
and return the new dictionary; otherwise, return the existing
option dictionary.
"""
dict = self.command_options.get(command)
if dict is None:
dict = self.command_options[command] = {}
return dict | [
"def",
"get_option_dict",
"(",
"self",
",",
"command",
")",
":",
"dict",
"=",
"self",
".",
"command_options",
".",
"get",
"(",
"command",
")",
"if",
"dict",
"is",
"None",
":",
"dict",
"=",
"self",
".",
"command_options",
"[",
"command",
"]",
"=",
"{",
... | https://github.com/aws/lumberyard/blob/f85344403c1c2e77ec8c75deb2c116e97b713217/dev/Tools/Python/3.7.10/mac/Python.framework/Versions/3.7/lib/python3.7/distutils/dist.py#L294-L303 | |
hanpfei/chromium-net | 392cc1fa3a8f92f42e4071ab6e674d8e0482f83f | tools/grit/grit/tool/build.py | python | RcBuilder.GenerateDepfile | (self, depfile, depdir, first_ids_file, depend_on_stamp) | Generate a depfile that contains the imlicit dependencies of the input
grd. The depfile will be in the same format as a makefile, and will contain
references to files relative to |depdir|. It will be put in |depfile|.
For example, supposing we have three files in a directory src/
src/
blah.grd <- depends on input{1,2}.xtb
input1.xtb
input2.xtb
and we run
grit -i blah.grd -o ../out/gen --depdir ../out --depfile ../out/gen/blah.rd.d
from the directory src/ we will generate a depfile ../out/gen/blah.grd.d
that has the contents
gen/blah.h: ../src/input1.xtb ../src/input2.xtb
Where "gen/blah.h" is the first output (Ninja expects the .d file to list
the first output in cases where there is more than one). If the flag
--depend-on-stamp is specified, "gen/blah.rd.d.stamp" will be used that is
'touched' whenever a new depfile is generated.
Note that all paths in the depfile are relative to ../out, the depdir. | Generate a depfile that contains the imlicit dependencies of the input
grd. The depfile will be in the same format as a makefile, and will contain
references to files relative to |depdir|. It will be put in |depfile|. | [
"Generate",
"a",
"depfile",
"that",
"contains",
"the",
"imlicit",
"dependencies",
"of",
"the",
"input",
"grd",
".",
"The",
"depfile",
"will",
"be",
"in",
"the",
"same",
"format",
"as",
"a",
"makefile",
"and",
"will",
"contain",
"references",
"to",
"files",
... | def GenerateDepfile(self, depfile, depdir, first_ids_file, depend_on_stamp):
'''Generate a depfile that contains the imlicit dependencies of the input
grd. The depfile will be in the same format as a makefile, and will contain
references to files relative to |depdir|. It will be put in |depfile|.
For example, supposing we have three files in a directory src/
src/
blah.grd <- depends on input{1,2}.xtb
input1.xtb
input2.xtb
and we run
grit -i blah.grd -o ../out/gen --depdir ../out --depfile ../out/gen/blah.rd.d
from the directory src/ we will generate a depfile ../out/gen/blah.grd.d
that has the contents
gen/blah.h: ../src/input1.xtb ../src/input2.xtb
Where "gen/blah.h" is the first output (Ninja expects the .d file to list
the first output in cases where there is more than one). If the flag
--depend-on-stamp is specified, "gen/blah.rd.d.stamp" will be used that is
'touched' whenever a new depfile is generated.
Note that all paths in the depfile are relative to ../out, the depdir.
'''
depfile = os.path.abspath(depfile)
depdir = os.path.abspath(depdir)
infiles = self.res.GetInputFiles()
# We want to trigger a rebuild if the first ids change.
if first_ids_file is not None:
infiles.append(first_ids_file)
if (depend_on_stamp):
output_file = depfile + ".stamp"
# Touch the stamp file before generating the depfile.
with open(output_file, 'a'):
os.utime(output_file, None)
else:
# Get the first output file relative to the depdir.
outputs = self.res.GetOutputFiles()
output_file = os.path.join(self.output_directory,
outputs[0].GetFilename())
output_file = os.path.relpath(output_file, depdir)
# The path prefix to prepend to dependencies in the depfile.
prefix = os.path.relpath(os.getcwd(), depdir)
deps_text = ' '.join([os.path.join(prefix, i) for i in infiles])
depfile_contents = output_file + ': ' + deps_text
self.MakeDirectoriesTo(depfile)
outfile = self.fo_create(depfile, 'w', encoding='utf-8')
outfile.writelines(depfile_contents) | [
"def",
"GenerateDepfile",
"(",
"self",
",",
"depfile",
",",
"depdir",
",",
"first_ids_file",
",",
"depend_on_stamp",
")",
":",
"depfile",
"=",
"os",
".",
"path",
".",
"abspath",
"(",
"depfile",
")",
"depdir",
"=",
"os",
".",
"path",
".",
"abspath",
"(",
... | https://github.com/hanpfei/chromium-net/blob/392cc1fa3a8f92f42e4071ab6e674d8e0482f83f/tools/grit/grit/tool/build.py#L462-L517 | ||
devsisters/libquic | 8954789a056d8e7d5fcb6452fd1572ca57eb5c4e | src/third_party/protobuf/python/google/protobuf/service.py | python | RpcController.ErrorText | (self) | If Failed is true, returns a human-readable description of the error. | If Failed is true, returns a human-readable description of the error. | [
"If",
"Failed",
"is",
"true",
"returns",
"a",
"human",
"-",
"readable",
"description",
"of",
"the",
"error",
"."
] | def ErrorText(self):
"""If Failed is true, returns a human-readable description of the error."""
raise NotImplementedError | [
"def",
"ErrorText",
"(",
"self",
")",
":",
"raise",
"NotImplementedError"
] | https://github.com/devsisters/libquic/blob/8954789a056d8e7d5fcb6452fd1572ca57eb5c4e/src/third_party/protobuf/python/google/protobuf/service.py#L150-L152 | ||
apache/incubator-mxnet | f03fb23f1d103fec9541b5ae59ee06b1734a51d9 | python/mxnet/ndarray/numpy/_op.py | python | inner | (a, b) | return tensordot(a, b, [-1, -1]) | r"""
Inner product of two arrays.
Ordinary inner product of vectors for 1-D arrays (without complex
conjugation), in higher dimensions a sum product over the last axes.
Parameters
----------
a, b : ndarray
If `a` and `b` are nonscalar, their last dimensions must match.
Returns
-------
out : ndarray
`out.shape = a.shape[:-1] + b.shape[:-1]`
Raises
------
ValueError
If the last dimension of `a` and `b` has different size.
See Also
--------
tensordot : Sum products over arbitrary axes.
dot : Generalised matrix product, using second last dimension of `b`.
einsum : Einstein summation convention.
Notes
-----
For vectors (1-D arrays) it computes the ordinary inner-product::
np.inner(a, b) = sum(a[:]*b[:])
More generally, if `ndim(a) = r > 0` and `ndim(b) = s > 0`::
np.inner(a, b) = np.tensordot(a, b, axes=(-1,-1))
or explicitly::
np.inner(a, b)[i0,...,ir-1,j0,...,js-1]
= sum(a[i0,...,ir-1,:]*b[j0,...,js-1,:])
In addition `a` or `b` may be scalars, in which case::
np.inner(a,b) = a*b
Examples
--------
Ordinary inner product for vectors:
>>> a = np.array([1,2,3])
>>> b = np.array([0,1,0])
>>> np.inner(a, b)
2
A multidimensional example:
>>> a = np.arange(24).reshape((2,3,4))
>>> b = np.arange(4)
>>> np.inner(a, b)
array([[ 14, 38, 62],
[ 86, 110, 134]]) | r"""
Inner product of two arrays.
Ordinary inner product of vectors for 1-D arrays (without complex
conjugation), in higher dimensions a sum product over the last axes. | [
"r",
"Inner",
"product",
"of",
"two",
"arrays",
".",
"Ordinary",
"inner",
"product",
"of",
"vectors",
"for",
"1",
"-",
"D",
"arrays",
"(",
"without",
"complex",
"conjugation",
")",
"in",
"higher",
"dimensions",
"a",
"sum",
"product",
"over",
"the",
"last",... | def inner(a, b):
r"""
Inner product of two arrays.
Ordinary inner product of vectors for 1-D arrays (without complex
conjugation), in higher dimensions a sum product over the last axes.
Parameters
----------
a, b : ndarray
If `a` and `b` are nonscalar, their last dimensions must match.
Returns
-------
out : ndarray
`out.shape = a.shape[:-1] + b.shape[:-1]`
Raises
------
ValueError
If the last dimension of `a` and `b` has different size.
See Also
--------
tensordot : Sum products over arbitrary axes.
dot : Generalised matrix product, using second last dimension of `b`.
einsum : Einstein summation convention.
Notes
-----
For vectors (1-D arrays) it computes the ordinary inner-product::
np.inner(a, b) = sum(a[:]*b[:])
More generally, if `ndim(a) = r > 0` and `ndim(b) = s > 0`::
np.inner(a, b) = np.tensordot(a, b, axes=(-1,-1))
or explicitly::
np.inner(a, b)[i0,...,ir-1,j0,...,js-1]
= sum(a[i0,...,ir-1,:]*b[j0,...,js-1,:])
In addition `a` or `b` may be scalars, in which case::
np.inner(a,b) = a*b
Examples
--------
Ordinary inner product for vectors:
>>> a = np.array([1,2,3])
>>> b = np.array([0,1,0])
>>> np.inner(a, b)
2
A multidimensional example:
>>> a = np.arange(24).reshape((2,3,4))
>>> b = np.arange(4)
>>> np.inner(a, b)
array([[ 14, 38, 62],
[ 86, 110, 134]])
"""
return tensordot(a, b, [-1, -1]) | [
"def",
"inner",
"(",
"a",
",",
"b",
")",
":",
"return",
"tensordot",
"(",
"a",
",",
"b",
",",
"[",
"-",
"1",
",",
"-",
"1",
"]",
")"
] | https://github.com/apache/incubator-mxnet/blob/f03fb23f1d103fec9541b5ae59ee06b1734a51d9/python/mxnet/ndarray/numpy/_op.py#L7093-L7146 | |
mysql/mysql-router | cc0179f982bb9739a834eb6fd205a56224616133 | ext/gmock/scripts/gmock_doctor.py | python | _OverloadedFunctionMatcherDiagnoser | (msg) | return _GenericDiagnoser('OFM', 'Overloaded Function Matcher',
[(gcc_regex, diagnosis),
(clang_regex, diagnosis)],
msg) | Diagnoses the OFM disease, given the error messages by the compiler. | Diagnoses the OFM disease, given the error messages by the compiler. | [
"Diagnoses",
"the",
"OFM",
"disease",
"given",
"the",
"error",
"messages",
"by",
"the",
"compiler",
"."
] | def _OverloadedFunctionMatcherDiagnoser(msg):
"""Diagnoses the OFM disease, given the error messages by the compiler."""
gcc_regex = (_GCC_FILE_LINE_RE + r'error: no matching function for '
r'call to \'Truly\(<unresolved overloaded function type>\)')
clang_regex = (_CLANG_FILE_LINE_RE + r'error: no matching function for '
r'call to \'Truly')
diagnosis = """
The argument you gave to Truly() is an overloaded function. Please tell
your compiler which overloaded version you want to use.
For example, if you want to use the version whose signature is
bool Foo(int n);
you should write
Truly(static_cast<bool (*)(int n)>(Foo))"""
return _GenericDiagnoser('OFM', 'Overloaded Function Matcher',
[(gcc_regex, diagnosis),
(clang_regex, diagnosis)],
msg) | [
"def",
"_OverloadedFunctionMatcherDiagnoser",
"(",
"msg",
")",
":",
"gcc_regex",
"=",
"(",
"_GCC_FILE_LINE_RE",
"+",
"r'error: no matching function for '",
"r'call to \\'Truly\\(<unresolved overloaded function type>\\)'",
")",
"clang_regex",
"=",
"(",
"_CLANG_FILE_LINE_RE",
"+",
... | https://github.com/mysql/mysql-router/blob/cc0179f982bb9739a834eb6fd205a56224616133/ext/gmock/scripts/gmock_doctor.py#L278-L296 | |
ptrkrysik/gr-gsm | 2de47e28ce1fb9a518337bfc0add36c8e3cff5eb | docs/doxygen/doxyxml/base.py | python | Base.from_refid | (cls, refid, top=None) | return inst | Instantiate class from a refid rather than parsing object. | Instantiate class from a refid rather than parsing object. | [
"Instantiate",
"class",
"from",
"a",
"refid",
"rather",
"than",
"parsing",
"object",
"."
] | def from_refid(cls, refid, top=None):
""" Instantiate class from a refid rather than parsing object. """
# First check to see if its already been instantiated.
if top is not None and refid in top._refs:
return top._refs[refid]
# Otherwise create a new instance and set refid.
inst = cls(None, top=top)
inst.refid = refid
inst.add_ref(inst)
return inst | [
"def",
"from_refid",
"(",
"cls",
",",
"refid",
",",
"top",
"=",
"None",
")",
":",
"# First check to see if its already been instantiated.",
"if",
"top",
"is",
"not",
"None",
"and",
"refid",
"in",
"top",
".",
"_refs",
":",
"return",
"top",
".",
"_refs",
"[",
... | https://github.com/ptrkrysik/gr-gsm/blob/2de47e28ce1fb9a518337bfc0add36c8e3cff5eb/docs/doxygen/doxyxml/base.py#L68-L77 | |
windystrife/UnrealEngine_NVIDIAGameWorks | b50e6338a7c5b26374d66306ebc7807541ff815e | Engine/Extras/ThirdPartyNotUE/emsdk/Win64/python/2.7.5.3_64bit/Lib/site-packages/setuptools/command/egg_info.py | python | egg_info.delete_file | (self, filename) | Delete `filename` (if not a dry run) after announcing it | Delete `filename` (if not a dry run) after announcing it | [
"Delete",
"filename",
"(",
"if",
"not",
"a",
"dry",
"run",
")",
"after",
"announcing",
"it"
] | def delete_file(self, filename):
"""Delete `filename` (if not a dry run) after announcing it"""
log.info("deleting %s", filename)
if not self.dry_run:
os.unlink(filename) | [
"def",
"delete_file",
"(",
"self",
",",
"filename",
")",
":",
"log",
".",
"info",
"(",
"\"deleting %s\"",
",",
"filename",
")",
"if",
"not",
"self",
".",
"dry_run",
":",
"os",
".",
"unlink",
"(",
"filename",
")"
] | https://github.com/windystrife/UnrealEngine_NVIDIAGameWorks/blob/b50e6338a7c5b26374d66306ebc7807541ff815e/Engine/Extras/ThirdPartyNotUE/emsdk/Win64/python/2.7.5.3_64bit/Lib/site-packages/setuptools/command/egg_info.py#L159-L163 | ||
wxWidgets/wxPython-Classic | 19571e1ae65f1ac445f5491474121998c97a1bf0 | src/msw/_gdi.py | python | DC.DrawImageLabel | (*args, **kwargs) | return _gdi_.DC_DrawImageLabel(*args, **kwargs) | DrawImageLabel(self, String text, Bitmap image, Rect rect, int alignment=wxALIGN_LEFT|wxALIGN_TOP,
int indexAccel=-1) -> Rect
Draw *text* and an image (which may be ``wx.NullBitmap`` to skip
drawing it) within the specified rectangle, abiding by the alignment
flags. Will additionally emphasize the character at *indexAccel* if
it is not -1. Returns the bounding rectangle. | DrawImageLabel(self, String text, Bitmap image, Rect rect, int alignment=wxALIGN_LEFT|wxALIGN_TOP,
int indexAccel=-1) -> Rect | [
"DrawImageLabel",
"(",
"self",
"String",
"text",
"Bitmap",
"image",
"Rect",
"rect",
"int",
"alignment",
"=",
"wxALIGN_LEFT|wxALIGN_TOP",
"int",
"indexAccel",
"=",
"-",
"1",
")",
"-",
">",
"Rect"
] | def DrawImageLabel(*args, **kwargs):
"""
DrawImageLabel(self, String text, Bitmap image, Rect rect, int alignment=wxALIGN_LEFT|wxALIGN_TOP,
int indexAccel=-1) -> Rect
Draw *text* and an image (which may be ``wx.NullBitmap`` to skip
drawing it) within the specified rectangle, abiding by the alignment
flags. Will additionally emphasize the character at *indexAccel* if
it is not -1. Returns the bounding rectangle.
"""
return _gdi_.DC_DrawImageLabel(*args, **kwargs) | [
"def",
"DrawImageLabel",
"(",
"*",
"args",
",",
"*",
"*",
"kwargs",
")",
":",
"return",
"_gdi_",
".",
"DC_DrawImageLabel",
"(",
"*",
"args",
",",
"*",
"*",
"kwargs",
")"
] | https://github.com/wxWidgets/wxPython-Classic/blob/19571e1ae65f1ac445f5491474121998c97a1bf0/src/msw/_gdi.py#L4040-L4050 | |
catboost/catboost | 167f64f237114a4d10b2b4ee42adb4569137debe | contrib/python/prompt-toolkit/py3/prompt_toolkit/key_binding/emacs_state.py | python | EmacsState.is_recording | (self) | return self.current_recording is not None | Tell whether we are recording a macro. | Tell whether we are recording a macro. | [
"Tell",
"whether",
"we",
"are",
"recording",
"a",
"macro",
"."
] | def is_recording(self) -> bool:
"Tell whether we are recording a macro."
return self.current_recording is not None | [
"def",
"is_recording",
"(",
"self",
")",
"->",
"bool",
":",
"return",
"self",
".",
"current_recording",
"is",
"not",
"None"
] | https://github.com/catboost/catboost/blob/167f64f237114a4d10b2b4ee42adb4569137debe/contrib/python/prompt-toolkit/py3/prompt_toolkit/key_binding/emacs_state.py#L25-L27 | |
aws/lumberyard | f85344403c1c2e77ec8c75deb2c116e97b713217 | dev/Gems/CloudGemFramework/v1/AWS/common-code/lib/OpenSSL/SSL.py | python | Connection.set_app_data | (self, data) | Set application data
:param data: The application data
:return: None | Set application data | [
"Set",
"application",
"data"
] | def set_app_data(self, data):
"""
Set application data
:param data: The application data
:return: None
"""
self._app_data = data | [
"def",
"set_app_data",
"(",
"self",
",",
"data",
")",
":",
"self",
".",
"_app_data",
"=",
"data"
] | https://github.com/aws/lumberyard/blob/f85344403c1c2e77ec8c75deb2c116e97b713217/dev/Gems/CloudGemFramework/v1/AWS/common-code/lib/OpenSSL/SSL.py#L2087-L2094 | ||
LiquidPlayer/LiquidCore | 9405979363f2353ac9a71ad8ab59685dd7f919c9 | deps/node-10.15.3/deps/npm/node_modules/node-gyp/gyp/pylib/gyp/generator/msvs.py | python | _GetMSVSConfigurationType | (spec, build_file) | return config_type | Returns the configuration type for this project.
It's a number defined by Microsoft. May raise an exception.
Args:
spec: The target dictionary containing the properties of the target.
build_file: The path of the gyp file.
Returns:
An integer, the configuration type. | Returns the configuration type for this project. | [
"Returns",
"the",
"configuration",
"type",
"for",
"this",
"project",
"."
] | def _GetMSVSConfigurationType(spec, build_file):
"""Returns the configuration type for this project.
It's a number defined by Microsoft. May raise an exception.
Args:
spec: The target dictionary containing the properties of the target.
build_file: The path of the gyp file.
Returns:
An integer, the configuration type.
"""
try:
config_type = {
'executable': '1', # .exe
'shared_library': '2', # .dll
'loadable_module': '2', # .dll
'static_library': '4', # .lib
'none': '10', # Utility type
}[spec['type']]
except KeyError:
if spec.get('type'):
raise GypError('Target type %s is not a valid target type for '
'target %s in %s.' %
(spec['type'], spec['target_name'], build_file))
else:
raise GypError('Missing type field for target %s in %s.' %
(spec['target_name'], build_file))
return config_type | [
"def",
"_GetMSVSConfigurationType",
"(",
"spec",
",",
"build_file",
")",
":",
"try",
":",
"config_type",
"=",
"{",
"'executable'",
":",
"'1'",
",",
"# .exe",
"'shared_library'",
":",
"'2'",
",",
"# .dll",
"'loadable_module'",
":",
"'2'",
",",
"# .dll",
"'stati... | https://github.com/LiquidPlayer/LiquidCore/blob/9405979363f2353ac9a71ad8ab59685dd7f919c9/deps/node-10.15.3/deps/npm/node_modules/node-gyp/gyp/pylib/gyp/generator/msvs.py#L1086-L1113 | |
mongodb/mongo | d8ff665343ad29cf286ee2cf4a1960d29371937b | buildscripts/util/runcommand.py | python | RunCommand.__init__ | ( # pylint: disable=too-many-arguments
self, string=None, output_file=None, append_file=False, propagate_signals=True) | Initialize the RunCommand object. | Initialize the RunCommand object. | [
"Initialize",
"the",
"RunCommand",
"object",
"."
] | def __init__( # pylint: disable=too-many-arguments
self, string=None, output_file=None, append_file=False, propagate_signals=True):
"""Initialize the RunCommand object."""
self._command = string if string else ""
self.output_file = output_file
self.append_file = append_file
self._process = None
if propagate_signals or os.name != "posix":
# The function os.setpgrp is not supported on Windows.
self._preexec_kargs = {}
elif subprocess.__name__ == "subprocess32":
self._preexec_kargs = {"start_new_session": True}
else:
self._preexec_kargs = {"preexec_fn": os.setpgrp} | [
"def",
"__init__",
"(",
"# pylint: disable=too-many-arguments",
"self",
",",
"string",
"=",
"None",
",",
"output_file",
"=",
"None",
",",
"append_file",
"=",
"False",
",",
"propagate_signals",
"=",
"True",
")",
":",
"self",
".",
"_command",
"=",
"string",
"if"... | https://github.com/mongodb/mongo/blob/d8ff665343ad29cf286ee2cf4a1960d29371937b/buildscripts/util/runcommand.py#L15-L28 | ||
Polidea/SiriusObfuscator | b0e590d8130e97856afe578869b83a209e2b19be | SymbolExtractorAndRenamer/lldb/scripts/Python/static-binding/lldb.py | python | SBPlatformShellCommand.GetSignal | (self) | return _lldb.SBPlatformShellCommand_GetSignal(self) | GetSignal(self) -> int | GetSignal(self) -> int | [
"GetSignal",
"(",
"self",
")",
"-",
">",
"int"
] | def GetSignal(self):
"""GetSignal(self) -> int"""
return _lldb.SBPlatformShellCommand_GetSignal(self) | [
"def",
"GetSignal",
"(",
"self",
")",
":",
"return",
"_lldb",
".",
"SBPlatformShellCommand_GetSignal",
"(",
"self",
")"
] | https://github.com/Polidea/SiriusObfuscator/blob/b0e590d8130e97856afe578869b83a209e2b19be/SymbolExtractorAndRenamer/lldb/scripts/Python/static-binding/lldb.py#L6741-L6743 | |
emscripten-core/emscripten | 0d413d3c5af8b28349682496edc14656f5700c2f | third_party/ply/example/ansic/cparse.py | python | p_unary_expression_1 | (t) | unary_expression : postfix_expression | unary_expression : postfix_expression | [
"unary_expression",
":",
"postfix_expression"
] | def p_unary_expression_1(t):
'unary_expression : postfix_expression'
pass | [
"def",
"p_unary_expression_1",
"(",
"t",
")",
":",
"pass"
] | https://github.com/emscripten-core/emscripten/blob/0d413d3c5af8b28349682496edc14656f5700c2f/third_party/ply/example/ansic/cparse.py#L758-L760 | ||
aws/lumberyard | f85344403c1c2e77ec8c75deb2c116e97b713217 | dev/Tools/Python/3.7.10/linux_x64/lib/python3.7/site-packages/botocore/paginate.py | python | PageIterator._convert_deprecated_starting_token | (self, deprecated_token) | return dict(zip(self._input_token, deprecated_token)) | This attempts to convert a deprecated starting token into the new
style. | This attempts to convert a deprecated starting token into the new
style. | [
"This",
"attempts",
"to",
"convert",
"a",
"deprecated",
"starting",
"token",
"into",
"the",
"new",
"style",
"."
] | def _convert_deprecated_starting_token(self, deprecated_token):
"""
This attempts to convert a deprecated starting token into the new
style.
"""
len_deprecated_token = len(deprecated_token)
len_input_token = len(self._input_token)
if len_deprecated_token > len_input_token:
raise ValueError("Bad starting token: %s" % self._starting_token)
elif len_deprecated_token < len_input_token:
log.debug("Old format starting token does not contain all input "
"tokens. Setting the rest, in order, as None.")
for i in range(len_input_token - len_deprecated_token):
deprecated_token.append(None)
return dict(zip(self._input_token, deprecated_token)) | [
"def",
"_convert_deprecated_starting_token",
"(",
"self",
",",
"deprecated_token",
")",
":",
"len_deprecated_token",
"=",
"len",
"(",
"deprecated_token",
")",
"len_input_token",
"=",
"len",
"(",
"self",
".",
"_input_token",
")",
"if",
"len_deprecated_token",
">",
"l... | https://github.com/aws/lumberyard/blob/f85344403c1c2e77ec8c75deb2c116e97b713217/dev/Tools/Python/3.7.10/linux_x64/lib/python3.7/site-packages/botocore/paginate.py#L536-L550 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.