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 |
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
Samsung/veles | 95ed733c2e49bc011ad98ccf2416ecec23fbf352 | veles/genetics/core.py | python | Population.__len__ | (self) | return len(self.chromosomes) | Returns the number of chromosomes. | Returns the number of chromosomes. | [
"Returns",
"the",
"number",
"of",
"chromosomes",
"."
] | def __len__(self):
"""Returns the number of chromosomes.
"""
return len(self.chromosomes) | [
"def",
"__len__",
"(",
"self",
")",
":",
"return",
"len",
"(",
"self",
".",
"chromosomes",
")"
] | https://github.com/Samsung/veles/blob/95ed733c2e49bc011ad98ccf2416ecec23fbf352/veles/genetics/core.py#L492-L495 | |
aws/lumberyard | f85344403c1c2e77ec8c75deb2c116e97b713217 | dev/Tools/Python/3.7.10/mac/Python.framework/Versions/3.7/lib/python3.7/socketserver.py | python | TCPServer.server_bind | (self) | Called by constructor to bind the socket.
May be overridden. | Called by constructor to bind the socket. | [
"Called",
"by",
"constructor",
"to",
"bind",
"the",
"socket",
"."
] | def server_bind(self):
"""Called by constructor to bind the socket.
May be overridden.
"""
if self.allow_reuse_address:
self.socket.setsockopt(socket.SOL_SOCKET, socket.SO_REUSEADDR, 1)
self.socket.bind(self.server_address)
self.server_address = self.socket.... | [
"def",
"server_bind",
"(",
"self",
")",
":",
"if",
"self",
".",
"allow_reuse_address",
":",
"self",
".",
"socket",
".",
"setsockopt",
"(",
"socket",
".",
"SOL_SOCKET",
",",
"socket",
".",
"SO_REUSEADDR",
",",
"1",
")",
"self",
".",
"socket",
".",
"bind",... | https://github.com/aws/lumberyard/blob/f85344403c1c2e77ec8c75deb2c116e97b713217/dev/Tools/Python/3.7.10/mac/Python.framework/Versions/3.7/lib/python3.7/socketserver.py#L458-L467 | ||
wxWidgets/wxPython-Classic | 19571e1ae65f1ac445f5491474121998c97a1bf0 | src/osx_cocoa/richtext.py | python | TextAttrDimensions.EqPartial | (*args, **kwargs) | return _richtext.TextAttrDimensions_EqPartial(*args, **kwargs) | EqPartial(self, TextAttrDimensions dims) -> bool | EqPartial(self, TextAttrDimensions dims) -> bool | [
"EqPartial",
"(",
"self",
"TextAttrDimensions",
"dims",
")",
"-",
">",
"bool"
] | def EqPartial(*args, **kwargs):
"""EqPartial(self, TextAttrDimensions dims) -> bool"""
return _richtext.TextAttrDimensions_EqPartial(*args, **kwargs) | [
"def",
"EqPartial",
"(",
"*",
"args",
",",
"*",
"*",
"kwargs",
")",
":",
"return",
"_richtext",
".",
"TextAttrDimensions_EqPartial",
"(",
"*",
"args",
",",
"*",
"*",
"kwargs",
")"
] | https://github.com/wxWidgets/wxPython-Classic/blob/19571e1ae65f1ac445f5491474121998c97a1bf0/src/osx_cocoa/richtext.py#L213-L215 | |
apple/turicreate | cce55aa5311300e3ce6af93cb45ba791fd1bdf49 | src/external/xgboost/python-package/xgboost/core.py | python | DMatrix.set_uint_info | (self, field, data) | Set uint type property into the DMatrix.
Parameters
----------
field: str
The field name of the information
data: numpy array
The array ofdata to be set | Set uint type property into the DMatrix. | [
"Set",
"uint",
"type",
"property",
"into",
"the",
"DMatrix",
"."
] | def set_uint_info(self, field, data):
"""Set uint type property into the DMatrix.
Parameters
----------
field: str
The field name of the information
data: numpy array
The array ofdata to be set
"""
_check_call(_LIB.XGDMatrixSetUIntInfo(se... | [
"def",
"set_uint_info",
"(",
"self",
",",
"field",
",",
"data",
")",
":",
"_check_call",
"(",
"_LIB",
".",
"XGDMatrixSetUIntInfo",
"(",
"self",
".",
"handle",
",",
"c_str",
"(",
"field",
")",
",",
"c_array",
"(",
"ctypes",
".",
"c_uint",
",",
"data",
"... | https://github.com/apple/turicreate/blob/cce55aa5311300e3ce6af93cb45ba791fd1bdf49/src/external/xgboost/python-package/xgboost/core.py#L335-L349 | ||
leosac/leosac | 932a2a90bd2e75483d46b24fdbc8f02e0809d731 | python/leosacpy/cli/dev/cc.py | python | cmake | (ctx) | Run the CMake command to prepare the build
directory. | Run the CMake command to prepare the build
directory. | [
"Run",
"the",
"CMake",
"command",
"to",
"prepare",
"the",
"build",
"directory",
"."
] | def cmake(ctx):
"""
Run the CMake command to prepare the build
directory.
"""
build_dir = ctx.obj.cc.build_dir
assert isinstance(build_dir, str)
run_in_container(build_dir, guess_root_dir(),
'cd /leosac_arm_build; '
'cmake -DCMAKE_SYSROOT=/opt/rpi_f... | [
"def",
"cmake",
"(",
"ctx",
")",
":",
"build_dir",
"=",
"ctx",
".",
"obj",
".",
"cc",
".",
"build_dir",
"assert",
"isinstance",
"(",
"build_dir",
",",
"str",
")",
"run_in_container",
"(",
"build_dir",
",",
"guess_root_dir",
"(",
")",
",",
"'cd /leosac_arm_... | https://github.com/leosac/leosac/blob/932a2a90bd2e75483d46b24fdbc8f02e0809d731/python/leosacpy/cli/dev/cc.py#L92-L104 | ||
aws/lumberyard | f85344403c1c2e77ec8c75deb2c116e97b713217 | dev/Gems/CloudGemMetric/v1/AWS/python/windows/Lib/numba/pythonapi.py | python | PythonAPI.emit_environment_sentry | (self, envptr, return_pyobject=False) | Emits LLVM code to ensure the `envptr` is not NULL | Emits LLVM code to ensure the `envptr` is not NULL | [
"Emits",
"LLVM",
"code",
"to",
"ensure",
"the",
"envptr",
"is",
"not",
"NULL"
] | def emit_environment_sentry(self, envptr, return_pyobject=False):
"""Emits LLVM code to ensure the `envptr` is not NULL
"""
is_null = cgutils.is_null(self.builder, envptr)
with cgutils.if_unlikely(self.builder, is_null):
if return_pyobject:
fnty = self.builder... | [
"def",
"emit_environment_sentry",
"(",
"self",
",",
"envptr",
",",
"return_pyobject",
"=",
"False",
")",
":",
"is_null",
"=",
"cgutils",
".",
"is_null",
"(",
"self",
".",
"builder",
",",
"envptr",
")",
"with",
"cgutils",
".",
"if_unlikely",
"(",
"self",
".... | https://github.com/aws/lumberyard/blob/f85344403c1c2e77ec8c75deb2c116e97b713217/dev/Gems/CloudGemMetric/v1/AWS/python/windows/Lib/numba/pythonapi.py#L192-L206 | ||
idaholab/moose | 9eeebc65e098b4c30f8205fb41591fd5b61eb6ff | python/MooseDocs/common/mixins.py | python | RendererObject.renderer | (self) | return self.__renderer | Return the Renderer object. | Return the Renderer object. | [
"Return",
"the",
"Renderer",
"object",
"."
] | def renderer(self):
"""Return the Renderer object."""
assertInitialized(self.__renderer, 'setRenderer')
return self.__renderer | [
"def",
"renderer",
"(",
"self",
")",
":",
"assertInitialized",
"(",
"self",
".",
"__renderer",
",",
"'setRenderer'",
")",
"return",
"self",
".",
"__renderer"
] | https://github.com/idaholab/moose/blob/9eeebc65e098b4c30f8205fb41591fd5b61eb6ff/python/MooseDocs/common/mixins.py#L152-L155 | |
Z3Prover/z3 | d745d03afdfdf638d66093e2bfbacaf87187f35b | examples/python/mus/marco.py | python | MapSolver.complement | (self, aset) | return self.all_n.difference(aset) | Return the complement of a given set w.r.t. the set of mapped constraints. | Return the complement of a given set w.r.t. the set of mapped constraints. | [
"Return",
"the",
"complement",
"of",
"a",
"given",
"set",
"w",
".",
"r",
".",
"t",
".",
"the",
"set",
"of",
"mapped",
"constraints",
"."
] | def complement(self, aset):
"""Return the complement of a given set w.r.t. the set of mapped constraints."""
return self.all_n.difference(aset) | [
"def",
"complement",
"(",
"self",
",",
"aset",
")",
":",
"return",
"self",
".",
"all_n",
".",
"difference",
"(",
"aset",
")"
] | https://github.com/Z3Prover/z3/blob/d745d03afdfdf638d66093e2bfbacaf87187f35b/examples/python/mus/marco.py#L154-L156 | |
wxWidgets/wxPython-Classic | 19571e1ae65f1ac445f5491474121998c97a1bf0 | src/osx_carbon/_misc.py | python | Log.Suspend | (*args, **kwargs) | return _misc_.Log_Suspend(*args, **kwargs) | Suspend() | Suspend() | [
"Suspend",
"()"
] | def Suspend(*args, **kwargs):
"""Suspend()"""
return _misc_.Log_Suspend(*args, **kwargs) | [
"def",
"Suspend",
"(",
"*",
"args",
",",
"*",
"*",
"kwargs",
")",
":",
"return",
"_misc_",
".",
"Log_Suspend",
"(",
"*",
"args",
",",
"*",
"*",
"kwargs",
")"
] | https://github.com/wxWidgets/wxPython-Classic/blob/19571e1ae65f1ac445f5491474121998c97a1bf0/src/osx_carbon/_misc.py#L1525-L1527 | |
hanpfei/chromium-net | 392cc1fa3a8f92f42e4071ab6e674d8e0482f83f | third_party/catapult/telemetry/third_party/mock/mock.py | python | _patch_object | (
target, attribute, new=DEFAULT, spec=None,
create=False, spec_set=None, autospec=None,
new_callable=None, **kwargs
) | return _patch(
getter, attribute, new, spec, create,
spec_set, autospec, new_callable, kwargs
) | patch.object(target, attribute, new=DEFAULT, spec=None, create=False,
spec_set=None, autospec=None, new_callable=None, **kwargs)
patch the named member (`attribute`) on an object (`target`) with a mock
object.
`patch.object` can be used as a decorator, class decorator or a context
man... | patch.object(target, attribute, new=DEFAULT, spec=None, create=False,
spec_set=None, autospec=None, new_callable=None, **kwargs) | [
"patch",
".",
"object",
"(",
"target",
"attribute",
"new",
"=",
"DEFAULT",
"spec",
"=",
"None",
"create",
"=",
"False",
"spec_set",
"=",
"None",
"autospec",
"=",
"None",
"new_callable",
"=",
"None",
"**",
"kwargs",
")"
] | def _patch_object(
target, attribute, new=DEFAULT, spec=None,
create=False, spec_set=None, autospec=None,
new_callable=None, **kwargs
):
"""
patch.object(target, attribute, new=DEFAULT, spec=None, create=False,
spec_set=None, autospec=None, new_callable=None, **kwarg... | [
"def",
"_patch_object",
"(",
"target",
",",
"attribute",
",",
"new",
"=",
"DEFAULT",
",",
"spec",
"=",
"None",
",",
"create",
"=",
"False",
",",
"spec_set",
"=",
"None",
",",
"autospec",
"=",
"None",
",",
"new_callable",
"=",
"None",
",",
"*",
"*",
"... | https://github.com/hanpfei/chromium-net/blob/392cc1fa3a8f92f42e4071ab6e674d8e0482f83f/third_party/catapult/telemetry/third_party/mock/mock.py#L1418-L1443 | |
openmm/openmm | cb293447c4fc8b03976dfe11399f107bab70f3d9 | wrappers/python/openmm/unit/unit.py | python | ScaledUnit.iter_base_dimensions | (self) | Returns a sorted tuple of (BaseDimension, exponent) pairs, describing the dimension of this unit. | Returns a sorted tuple of (BaseDimension, exponent) pairs, describing the dimension of this unit. | [
"Returns",
"a",
"sorted",
"tuple",
"of",
"(",
"BaseDimension",
"exponent",
")",
"pairs",
"describing",
"the",
"dimension",
"of",
"this",
"unit",
"."
] | def iter_base_dimensions(self):
"""
Returns a sorted tuple of (BaseDimension, exponent) pairs, describing the dimension of this unit.
"""
for base_unit, exponent in self:
if exponent != 0:
yield (base_unit.dimension, exponent) | [
"def",
"iter_base_dimensions",
"(",
"self",
")",
":",
"for",
"base_unit",
",",
"exponent",
"in",
"self",
":",
"if",
"exponent",
"!=",
"0",
":",
"yield",
"(",
"base_unit",
".",
"dimension",
",",
"exponent",
")"
] | https://github.com/openmm/openmm/blob/cb293447c4fc8b03976dfe11399f107bab70f3d9/wrappers/python/openmm/unit/unit.py#L553-L559 | ||
rdkit/rdkit | ede860ae316d12d8568daf5ee800921c3389c84e | rdkit/ML/files.py | python | ReFile.rewind | (self) | rewinds the file (seeks to the beginning) | rewinds the file (seeks to the beginning) | [
"rewinds",
"the",
"file",
"(",
"seeks",
"to",
"the",
"beginning",
")"
] | def rewind(self):
""" rewinds the file (seeks to the beginning)
"""
self.inFile.seek(0) | [
"def",
"rewind",
"(",
"self",
")",
":",
"self",
".",
"inFile",
".",
"seek",
"(",
"0",
")"
] | https://github.com/rdkit/rdkit/blob/ede860ae316d12d8568daf5ee800921c3389c84e/rdkit/ML/files.py#L50-L54 | ||
wxWidgets/wxPython-Classic | 19571e1ae65f1ac445f5491474121998c97a1bf0 | src/osx_carbon/_controls.py | python | ToolBarToolBase.MakeStretchable | (*args, **kwargs) | return _controls_.ToolBarToolBase_MakeStretchable(*args, **kwargs) | MakeStretchable(self) | MakeStretchable(self) | [
"MakeStretchable",
"(",
"self",
")"
] | def MakeStretchable(*args, **kwargs):
"""MakeStretchable(self)"""
return _controls_.ToolBarToolBase_MakeStretchable(*args, **kwargs) | [
"def",
"MakeStretchable",
"(",
"*",
"args",
",",
"*",
"*",
"kwargs",
")",
":",
"return",
"_controls_",
".",
"ToolBarToolBase_MakeStretchable",
"(",
"*",
"args",
",",
"*",
"*",
"kwargs",
")"
] | https://github.com/wxWidgets/wxPython-Classic/blob/19571e1ae65f1ac445f5491474121998c97a1bf0/src/osx_carbon/_controls.py#L3473-L3475 | |
tensorflow/tensorflow | 419e3a6b650ea4bd1b0cba23c4348f8a69f3272e | tensorflow/tools/dockerfiles/assembler.py | python | assemble_tags | (spec, cli_args, enabled_releases, all_partials) | return tag_data | Gather all the tags based on our spec.
Args:
spec: Nested dict containing full Tag spec
cli_args: List of ARG=foo arguments to pass along to Docker build
enabled_releases: List of releases to parse. Empty list = all
all_partials: Dict of every partial, for reference
Returns:
Dict of tags and h... | Gather all the tags based on our spec. | [
"Gather",
"all",
"the",
"tags",
"based",
"on",
"our",
"spec",
"."
] | def assemble_tags(spec, cli_args, enabled_releases, all_partials):
"""Gather all the tags based on our spec.
Args:
spec: Nested dict containing full Tag spec
cli_args: List of ARG=foo arguments to pass along to Docker build
enabled_releases: List of releases to parse. Empty list = all
all_partials:... | [
"def",
"assemble_tags",
"(",
"spec",
",",
"cli_args",
",",
"enabled_releases",
",",
"all_partials",
")",
":",
"tag_data",
"=",
"collections",
".",
"defaultdict",
"(",
"list",
")",
"for",
"name",
",",
"release",
"in",
"spec",
"[",
"'releases'",
"]",
".",
"i... | https://github.com/tensorflow/tensorflow/blob/419e3a6b650ea4bd1b0cba23c4348f8a69f3272e/tensorflow/tools/dockerfiles/assembler.py#L369-L419 | |
benoitsteiner/tensorflow-opencl | cb7cb40a57fde5cfd4731bc551e82a1e2fef43a5 | tensorflow/python/framework/ops.py | python | Graph.colocate_with | (self, op, ignore_existing=False) | Returns a context manager that specifies an op to colocate with.
Note: this function is not for public use, only for internal libraries.
For example:
```python
a = tf.Variable([1.0])
with g.colocate_with(a):
b = tf.constant(1.0)
c = tf.add(a, b)
```
`b` and `c` will always be... | Returns a context manager that specifies an op to colocate with. | [
"Returns",
"a",
"context",
"manager",
"that",
"specifies",
"an",
"op",
"to",
"colocate",
"with",
"."
] | def colocate_with(self, op, ignore_existing=False):
"""Returns a context manager that specifies an op to colocate with.
Note: this function is not for public use, only for internal libraries.
For example:
```python
a = tf.Variable([1.0])
with g.colocate_with(a):
b = tf.constant(1.0)
... | [
"def",
"colocate_with",
"(",
"self",
",",
"op",
",",
"ignore_existing",
"=",
"False",
")",
":",
"if",
"op",
"is",
"None",
"and",
"not",
"ignore_existing",
":",
"raise",
"ValueError",
"(",
"\"Trying to reset colocation (op is None) but \"",
"\"ignore_existing is not Tr... | https://github.com/benoitsteiner/tensorflow-opencl/blob/cb7cb40a57fde5cfd4731bc551e82a1e2fef43a5/tensorflow/python/framework/ops.py#L3647-L3718 | ||
wxWidgets/wxPython-Classic | 19571e1ae65f1ac445f5491474121998c97a1bf0 | src/osx_carbon/xrc.py | python | XmlResource_Set | (*args, **kwargs) | return _xrc.XmlResource_Set(*args, **kwargs) | XmlResource_Set(XmlResource res) -> XmlResource | XmlResource_Set(XmlResource res) -> XmlResource | [
"XmlResource_Set",
"(",
"XmlResource",
"res",
")",
"-",
">",
"XmlResource"
] | def XmlResource_Set(*args, **kwargs):
"""XmlResource_Set(XmlResource res) -> XmlResource"""
return _xrc.XmlResource_Set(*args, **kwargs) | [
"def",
"XmlResource_Set",
"(",
"*",
"args",
",",
"*",
"*",
"kwargs",
")",
":",
"return",
"_xrc",
".",
"XmlResource_Set",
"(",
"*",
"args",
",",
"*",
"*",
"kwargs",
")"
] | https://github.com/wxWidgets/wxPython-Classic/blob/19571e1ae65f1ac445f5491474121998c97a1bf0/src/osx_carbon/xrc.py#L262-L264 | |
hanpfei/chromium-net | 392cc1fa3a8f92f42e4071ab6e674d8e0482f83f | third_party/catapult/third_party/mapreduce/mapreduce/context.py | python | Pool.flush | (self) | Flush all changes. | Flush all changes. | [
"Flush",
"all",
"changes",
"."
] | def flush(self):
"""Flush all changes."""
raise NotImplementedError() | [
"def",
"flush",
"(",
"self",
")",
":",
"raise",
"NotImplementedError",
"(",
")"
] | https://github.com/hanpfei/chromium-net/blob/392cc1fa3a8f92f42e4071ab6e674d8e0482f83f/third_party/catapult/third_party/mapreduce/mapreduce/context.py#L211-L213 | ||
wlanjie/AndroidFFmpeg | 7baf9122f4b8e1c74e7baf4be5c422c7a5ba5aaf | tools/fdk-aac-build/armeabi/toolchain/lib/python2.7/logging/__init__.py | python | _releaseLock | () | Release the module-level lock acquired by calling _acquireLock(). | Release the module-level lock acquired by calling _acquireLock(). | [
"Release",
"the",
"module",
"-",
"level",
"lock",
"acquired",
"by",
"calling",
"_acquireLock",
"()",
"."
] | def _releaseLock():
"""
Release the module-level lock acquired by calling _acquireLock().
"""
if _lock:
_lock.release() | [
"def",
"_releaseLock",
"(",
")",
":",
"if",
"_lock",
":",
"_lock",
".",
"release",
"(",
")"
] | https://github.com/wlanjie/AndroidFFmpeg/blob/7baf9122f4b8e1c74e7baf4be5c422c7a5ba5aaf/tools/fdk-aac-build/armeabi/toolchain/lib/python2.7/logging/__init__.py#L219-L224 | ||
catboost/catboost | 167f64f237114a4d10b2b4ee42adb4569137debe | contrib/python/setuptools/py3/pkg_resources/_vendor/pyparsing.py | python | ParserElement.enablePackrat | (cache_size_limit=128) | Enables "packrat" parsing, which adds memoizing to the parsing logic.
Repeated parse attempts at the same string location (which happens
often in many complex grammars) can immediately return a cached value,
instead of re-executing parsing/validating code. Memoizing is done of
... | Enables "packrat" parsing, which adds memoizing to the parsing logic.
Repeated parse attempts at the same string location (which happens
often in many complex grammars) can immediately return a cached value,
instead of re-executing parsing/validating code. Memoizing is done of
... | [
"Enables",
"packrat",
"parsing",
"which",
"adds",
"memoizing",
"to",
"the",
"parsing",
"logic",
".",
"Repeated",
"parse",
"attempts",
"at",
"the",
"same",
"string",
"location",
"(",
"which",
"happens",
"often",
"in",
"many",
"complex",
"grammars",
")",
"can",
... | def enablePackrat(cache_size_limit=128):
"""Enables "packrat" parsing, which adds memoizing to the parsing logic.
Repeated parse attempts at the same string location (which happens
often in many complex grammars) can immediately return a cached value,
instead of re-executing par... | [
"def",
"enablePackrat",
"(",
"cache_size_limit",
"=",
"128",
")",
":",
"if",
"not",
"ParserElement",
".",
"_packratEnabled",
":",
"ParserElement",
".",
"_packratEnabled",
"=",
"True",
"if",
"cache_size_limit",
"is",
"None",
":",
"ParserElement",
".",
"packrat_cach... | https://github.com/catboost/catboost/blob/167f64f237114a4d10b2b4ee42adb4569137debe/contrib/python/setuptools/py3/pkg_resources/_vendor/pyparsing.py#L1574-L1606 | ||
metashell/metashell | f4177e4854ea00c8dbc722cadab26ef413d798ea | 3rd/templight/clang/utils/creduce-clang-crash.py | python | check_cmd | (cmd_name, cmd_dir, cmd_path=None) | Returns absolute path to cmd_path if it is given,
or absolute path to cmd_dir/cmd_name. | Returns absolute path to cmd_path if it is given,
or absolute path to cmd_dir/cmd_name. | [
"Returns",
"absolute",
"path",
"to",
"cmd_path",
"if",
"it",
"is",
"given",
"or",
"absolute",
"path",
"to",
"cmd_dir",
"/",
"cmd_name",
"."
] | def check_cmd(cmd_name, cmd_dir, cmd_path=None):
"""
Returns absolute path to cmd_path if it is given,
or absolute path to cmd_dir/cmd_name.
"""
if cmd_path:
# Make the path absolute so the creduce test can be run from any directory.
cmd_path = os.path.abspath(cmd_path)
cmd = find_executable(cmd_p... | [
"def",
"check_cmd",
"(",
"cmd_name",
",",
"cmd_dir",
",",
"cmd_path",
"=",
"None",
")",
":",
"if",
"cmd_path",
":",
"# Make the path absolute so the creduce test can be run from any directory.",
"cmd_path",
"=",
"os",
".",
"path",
".",
"abspath",
"(",
"cmd_path",
")... | https://github.com/metashell/metashell/blob/f4177e4854ea00c8dbc722cadab26ef413d798ea/3rd/templight/clang/utils/creduce-clang-crash.py#L37-L56 | ||
wlanjie/AndroidFFmpeg | 7baf9122f4b8e1c74e7baf4be5c422c7a5ba5aaf | tools/fdk-aac-build/armeabi-v7a/toolchain/lib/python2.7/lib2to3/fixer_util.py | python | is_probably_builtin | (node) | return True | Check that something isn't an attribute or function name etc. | Check that something isn't an attribute or function name etc. | [
"Check",
"that",
"something",
"isn",
"t",
"an",
"attribute",
"or",
"function",
"name",
"etc",
"."
] | def is_probably_builtin(node):
"""
Check that something isn't an attribute or function name etc.
"""
prev = node.prev_sibling
if prev is not None and prev.type == token.DOT:
# Attribute lookup.
return False
parent = node.parent
if parent.type in (syms.funcdef, syms.classdef):... | [
"def",
"is_probably_builtin",
"(",
"node",
")",
":",
"prev",
"=",
"node",
".",
"prev_sibling",
"if",
"prev",
"is",
"not",
"None",
"and",
"prev",
".",
"type",
"==",
"token",
".",
"DOT",
":",
"# Attribute lookup.",
"return",
"False",
"parent",
"=",
"node",
... | https://github.com/wlanjie/AndroidFFmpeg/blob/7baf9122f4b8e1c74e7baf4be5c422c7a5ba5aaf/tools/fdk-aac-build/armeabi-v7a/toolchain/lib/python2.7/lib2to3/fixer_util.py#L227-L248 | |
NVIDIA/TensorRT | 42805f078052daad1a98bc5965974fcffaad0960 | samples/python/yolov3_onnx/yolov3_to_onnx.py | python | ResizeParams.generate_param_name | (self) | return param_name | Generates the scale parameter name for the Resize node. | Generates the scale parameter name for the Resize node. | [
"Generates",
"the",
"scale",
"parameter",
"name",
"for",
"the",
"Resize",
"node",
"."
] | def generate_param_name(self):
"""Generates the scale parameter name for the Resize node."""
param_name = self.node_name + '_' + "scale"
return param_name | [
"def",
"generate_param_name",
"(",
"self",
")",
":",
"param_name",
"=",
"self",
".",
"node_name",
"+",
"'_'",
"+",
"\"scale\"",
"return",
"param_name"
] | https://github.com/NVIDIA/TensorRT/blob/42805f078052daad1a98bc5965974fcffaad0960/samples/python/yolov3_onnx/yolov3_to_onnx.py#L215-L218 | |
Mahlet-Inc/hobbits | 071d7a542f1af0a7791bcaab17b08224df9ecd4e | src/hobbits-plugins/analyzers/KaitaiStruct/ksy_py/database/vlq_base128_be.py | python | VlqBase128Be.value | (self) | return self._m_value if hasattr(self, '_m_value') else None | Resulting value as normal integer. | Resulting value as normal integer. | [
"Resulting",
"value",
"as",
"normal",
"integer",
"."
] | def value(self):
"""Resulting value as normal integer."""
if hasattr(self, '_m_value'):
return self._m_value if hasattr(self, '_m_value') else None
self._m_value = (((((((self.groups[self.last].value + ((self.groups[(self.last - 1)].value << 7) if self.last >= 1 else 0)) + ((self.gr... | [
"def",
"value",
"(",
"self",
")",
":",
"if",
"hasattr",
"(",
"self",
",",
"'_m_value'",
")",
":",
"return",
"self",
".",
"_m_value",
"if",
"hasattr",
"(",
"self",
",",
"'_m_value'",
")",
"else",
"None",
"self",
".",
"_m_value",
"=",
"(",
"(",
"(",
... | https://github.com/Mahlet-Inc/hobbits/blob/071d7a542f1af0a7791bcaab17b08224df9ecd4e/src/hobbits-plugins/analyzers/KaitaiStruct/ksy_py/database/vlq_base128_be.py#L95-L101 | |
catboost/catboost | 167f64f237114a4d10b2b4ee42adb4569137debe | contrib/python/pandas/py3/pandas/core/arrays/categorical.py | python | Categorical._reverse_indexer | (self) | return dict(zip(categories, _result)) | Compute the inverse of a categorical, returning
a dict of categories -> indexers.
*This is an internal function*
Returns
-------
Dict[Hashable, np.ndarray[np.intp]]
dict of categories -> indexers
Examples
--------
>>> c = pd.Categorical(list... | Compute the inverse of a categorical, returning
a dict of categories -> indexers. | [
"Compute",
"the",
"inverse",
"of",
"a",
"categorical",
"returning",
"a",
"dict",
"of",
"categories",
"-",
">",
"indexers",
"."
] | def _reverse_indexer(self) -> dict[Hashable, np.ndarray]:
"""
Compute the inverse of a categorical, returning
a dict of categories -> indexers.
*This is an internal function*
Returns
-------
Dict[Hashable, np.ndarray[np.intp]]
dict of categories -> i... | [
"def",
"_reverse_indexer",
"(",
"self",
")",
"->",
"dict",
"[",
"Hashable",
",",
"np",
".",
"ndarray",
"]",
":",
"categories",
"=",
"self",
".",
"categories",
"r",
",",
"counts",
"=",
"libalgos",
".",
"groupsort_indexer",
"(",
"ensure_platform_int",
"(",
"... | https://github.com/catboost/catboost/blob/167f64f237114a4d10b2b4ee42adb4569137debe/contrib/python/pandas/py3/pandas/core/arrays/categorical.py#L2052-L2084 | |
arangodb/arangodb | 0d658689c7d1b721b314fa3ca27d38303e1570c8 | 3rdParty/V8/gyp/easy_xml.py | python | WriteXmlIfChanged | (content, path, encoding='utf-8', pretty=False, win32=False) | Writes the XML content to disk, touching the file only if it has changed.
Args:
content: The structured content to be written.
path: Location of the file.
encoding: The encoding to report on the first line of the XML file.
pretty: True if we want pretty printing with indents and new lines.
win32... | Writes the XML content to disk, touching the file only if it has changed. | [
"Writes",
"the",
"XML",
"content",
"to",
"disk",
"touching",
"the",
"file",
"only",
"if",
"it",
"has",
"changed",
"."
] | def WriteXmlIfChanged(content, path, encoding='utf-8', pretty=False, win32=False):
""" Writes the XML content to disk, touching the file only if it has changed.
Args:
content: The structured content to be written.
path: Location of the file.
encoding: The encoding to report on the first line of the XM... | [
"def",
"WriteXmlIfChanged",
"(",
"content",
",",
"path",
",",
"encoding",
"=",
"'utf-8'",
",",
"pretty",
"=",
"False",
",",
"win32",
"=",
"False",
")",
":",
"xml_string",
"=",
"XmlToString",
"(",
"content",
",",
"encoding",
",",
"pretty",
")",
"default_enc... | https://github.com/arangodb/arangodb/blob/0d658689c7d1b721b314fa3ca27d38303e1570c8/3rdParty/V8/gyp/easy_xml.py#L108-L136 | ||
wxWidgets/wxPython-Classic | 19571e1ae65f1ac445f5491474121998c97a1bf0 | src/osx_cocoa/_controls.py | python | PreSpinButton | (*args, **kwargs) | return val | PreSpinButton() -> SpinButton | PreSpinButton() -> SpinButton | [
"PreSpinButton",
"()",
"-",
">",
"SpinButton"
] | def PreSpinButton(*args, **kwargs):
"""PreSpinButton() -> SpinButton"""
val = _controls_.new_PreSpinButton(*args, **kwargs)
return val | [
"def",
"PreSpinButton",
"(",
"*",
"args",
",",
"*",
"*",
"kwargs",
")",
":",
"val",
"=",
"_controls_",
".",
"new_PreSpinButton",
"(",
"*",
"args",
",",
"*",
"*",
"kwargs",
")",
"return",
"val"
] | https://github.com/wxWidgets/wxPython-Classic/blob/19571e1ae65f1ac445f5491474121998c97a1bf0/src/osx_cocoa/_controls.py#L2311-L2314 | |
aws/lumberyard | f85344403c1c2e77ec8c75deb2c116e97b713217 | dev/Tools/Python/3.7.10/linux_x64/lib/python3.7/difflib.py | python | unified_diff | (a, b, fromfile='', tofile='', fromfiledate='',
tofiledate='', n=3, lineterm='\n') | r"""
Compare two sequences of lines; generate the delta as a unified diff.
Unified diffs are a compact way of showing line changes and a few
lines of context. The number of context lines is set by 'n' which
defaults to three.
By default, the diff control lines (those with ---, +++, or @@) are
... | r"""
Compare two sequences of lines; generate the delta as a unified diff. | [
"r",
"Compare",
"two",
"sequences",
"of",
"lines",
";",
"generate",
"the",
"delta",
"as",
"a",
"unified",
"diff",
"."
] | def unified_diff(a, b, fromfile='', tofile='', fromfiledate='',
tofiledate='', n=3, lineterm='\n'):
r"""
Compare two sequences of lines; generate the delta as a unified diff.
Unified diffs are a compact way of showing line changes and a few
lines of context. The number of context line... | [
"def",
"unified_diff",
"(",
"a",
",",
"b",
",",
"fromfile",
"=",
"''",
",",
"tofile",
"=",
"''",
",",
"fromfiledate",
"=",
"''",
",",
"tofiledate",
"=",
"''",
",",
"n",
"=",
"3",
",",
"lineterm",
"=",
"'\\n'",
")",
":",
"_check_types",
"(",
"a",
... | https://github.com/aws/lumberyard/blob/f85344403c1c2e77ec8c75deb2c116e97b713217/dev/Tools/Python/3.7.10/linux_x64/lib/python3.7/difflib.py#L1136-L1202 | ||
aws/lumberyard | f85344403c1c2e77ec8c75deb2c116e97b713217 | dev/Tools/Python/3.7.10/windows/Lib/socket.py | python | SocketIO.writable | (self) | return self._writing | True if the SocketIO is open for writing. | True if the SocketIO is open for writing. | [
"True",
"if",
"the",
"SocketIO",
"is",
"open",
"for",
"writing",
"."
] | def writable(self):
"""True if the SocketIO is open for writing.
"""
if self.closed:
raise ValueError("I/O operation on closed socket.")
return self._writing | [
"def",
"writable",
"(",
"self",
")",
":",
"if",
"self",
".",
"closed",
":",
"raise",
"ValueError",
"(",
"\"I/O operation on closed socket.\"",
")",
"return",
"self",
".",
"_writing"
] | https://github.com/aws/lumberyard/blob/f85344403c1c2e77ec8c75deb2c116e97b713217/dev/Tools/Python/3.7.10/windows/Lib/socket.py#L621-L626 | |
rdkit/rdkit | ede860ae316d12d8568daf5ee800921c3389c84e | Code/GraphMol/CIPLabeler/Wrap/pyCIPLabelsValidation.py | python | supplier | (fname) | Read the smiles, name and expected labels from the input file.
If we know of an override for the expected labels, we do the
override here. | Read the smiles, name and expected labels from the input file.
If we know of an override for the expected labels, we do the
override here. | [
"Read",
"the",
"smiles",
"name",
"and",
"expected",
"labels",
"from",
"the",
"input",
"file",
".",
"If",
"we",
"know",
"of",
"an",
"override",
"for",
"the",
"expected",
"labels",
"we",
"do",
"the",
"override",
"here",
"."
] | def supplier(fname):
"""
Read the smiles, name and expected labels from the input file.
If we know of an override for the expected labels, we do the
override here.
"""
with open(fname) as f:
for line in f:
smiles, name, expected, _ = line.split('\t', 3)
try:
expected = set(E... | [
"def",
"supplier",
"(",
"fname",
")",
":",
"with",
"open",
"(",
"fname",
")",
"as",
"f",
":",
"for",
"line",
"in",
"f",
":",
"smiles",
",",
"name",
",",
"expected",
",",
"_",
"=",
"line",
".",
"split",
"(",
"'\\t'",
",",
"3",
")",
"try",
":",
... | https://github.com/rdkit/rdkit/blob/ede860ae316d12d8568daf5ee800921c3389c84e/Code/GraphMol/CIPLabeler/Wrap/pyCIPLabelsValidation.py#L31-L50 | ||
apiaryio/snowcrash | b5b39faa85f88ee17459edf39fdc6fe4fc70d2e3 | tools/gyp/pylib/gyp/xcodeproj_file.py | python | XCObject.ComputeIDs | (self, recursive=True, overwrite=True, seed_hash=None) | Set "id" properties deterministically.
An object's "id" property is set based on a hash of its class type and
name, as well as the class type and name of all ancestor objects. As
such, it is only advisable to call ComputeIDs once an entire project file
tree is built.
If recursive is True, recurse... | Set "id" properties deterministically. | [
"Set",
"id",
"properties",
"deterministically",
"."
] | def ComputeIDs(self, recursive=True, overwrite=True, seed_hash=None):
"""Set "id" properties deterministically.
An object's "id" property is set based on a hash of its class type and
name, as well as the class type and name of all ancestor objects. As
such, it is only advisable to call ComputeIDs once... | [
"def",
"ComputeIDs",
"(",
"self",
",",
"recursive",
"=",
"True",
",",
"overwrite",
"=",
"True",
",",
"seed_hash",
"=",
"None",
")",
":",
"def",
"_HashUpdate",
"(",
"hash",
",",
"data",
")",
":",
"\"\"\"Update hash with data's length and contents.\n\n If the h... | https://github.com/apiaryio/snowcrash/blob/b5b39faa85f88ee17459edf39fdc6fe4fc70d2e3/tools/gyp/pylib/gyp/xcodeproj_file.py#L397-L457 | ||
aws/lumberyard | f85344403c1c2e77ec8c75deb2c116e97b713217 | dev/Tools/AWSPythonSDK/1.5.8/botocore/vendored/requests/packages/urllib3/packages/ordered_dict.py | python | OrderedDict.itervalues | (self) | od.itervalues -> an iterator over the values in od | od.itervalues -> an iterator over the values in od | [
"od",
".",
"itervalues",
"-",
">",
"an",
"iterator",
"over",
"the",
"values",
"in",
"od"
] | def itervalues(self):
'od.itervalues -> an iterator over the values in od'
for k in self:
yield self[k] | [
"def",
"itervalues",
"(",
"self",
")",
":",
"for",
"k",
"in",
"self",
":",
"yield",
"self",
"[",
"k",
"]"
] | https://github.com/aws/lumberyard/blob/f85344403c1c2e77ec8c75deb2c116e97b713217/dev/Tools/AWSPythonSDK/1.5.8/botocore/vendored/requests/packages/urllib3/packages/ordered_dict.py#L132-L135 | ||
wxWidgets/wxPython-Classic | 19571e1ae65f1ac445f5491474121998c97a1bf0 | src/osx_cocoa/html2.py | python | WebView.Paste | (*args, **kwargs) | return _html2.WebView_Paste(*args, **kwargs) | Paste(self) | Paste(self) | [
"Paste",
"(",
"self",
")"
] | def Paste(*args, **kwargs):
"""Paste(self)"""
return _html2.WebView_Paste(*args, **kwargs) | [
"def",
"Paste",
"(",
"*",
"args",
",",
"*",
"*",
"kwargs",
")",
":",
"return",
"_html2",
".",
"WebView_Paste",
"(",
"*",
"args",
",",
"*",
"*",
"kwargs",
")"
] | https://github.com/wxWidgets/wxPython-Classic/blob/19571e1ae65f1ac445f5491474121998c97a1bf0/src/osx_cocoa/html2.py#L234-L236 | |
hanpfei/chromium-net | 392cc1fa3a8f92f42e4071ab6e674d8e0482f83f | third_party/catapult/third_party/py_vulcanize/third_party/rcssmin/_setup/py2/setup.py | python | make_manifest | (manifest, config, docs, kwargs) | return result | Create file list to pack up | Create file list to pack up | [
"Create",
"file",
"list",
"to",
"pack",
"up"
] | def make_manifest(manifest, config, docs, kwargs):
""" Create file list to pack up """
# pylint: disable = R0912
kwargs = kwargs.copy()
kwargs['script_args'] = ['install']
kwargs['packages'] = list(kwargs.get('packages') or ()) + [
'_setup', '_setup.py2', '_setup.py3',
] + list(manifest.... | [
"def",
"make_manifest",
"(",
"manifest",
",",
"config",
",",
"docs",
",",
"kwargs",
")",
":",
"# pylint: disable = R0912",
"kwargs",
"=",
"kwargs",
".",
"copy",
"(",
")",
"kwargs",
"[",
"'script_args'",
"]",
"=",
"[",
"'install'",
"]",
"kwargs",
"[",
"'pac... | https://github.com/hanpfei/chromium-net/blob/392cc1fa3a8f92f42e4071ab6e674d8e0482f83f/third_party/catapult/third_party/py_vulcanize/third_party/rcssmin/_setup/py2/setup.py#L244-L332 | |
benoitsteiner/tensorflow-opencl | cb7cb40a57fde5cfd4731bc551e82a1e2fef43a5 | tensorflow/contrib/framework/python/ops/variables.py | python | local_variable | (initial_value, validate_shape=True, name=None) | return variable_scope.variable(
initial_value, trainable=False,
collections=[ops.GraphKeys.LOCAL_VARIABLES],
validate_shape=validate_shape, name=name) | Create variable and add it to `GraphKeys.LOCAL_VARIABLES` collection.
Args:
initial_value: See variables.Variable.__init__.
validate_shape: See variables.Variable.__init__.
name: See variables.Variable.__init__.
Returns:
New variable. | Create variable and add it to `GraphKeys.LOCAL_VARIABLES` collection. | [
"Create",
"variable",
"and",
"add",
"it",
"to",
"GraphKeys",
".",
"LOCAL_VARIABLES",
"collection",
"."
] | def local_variable(initial_value, validate_shape=True, name=None):
"""Create variable and add it to `GraphKeys.LOCAL_VARIABLES` collection.
Args:
initial_value: See variables.Variable.__init__.
validate_shape: See variables.Variable.__init__.
name: See variables.Variable.__init__.
Returns:
New va... | [
"def",
"local_variable",
"(",
"initial_value",
",",
"validate_shape",
"=",
"True",
",",
"name",
"=",
"None",
")",
":",
"return",
"variable_scope",
".",
"variable",
"(",
"initial_value",
",",
"trainable",
"=",
"False",
",",
"collections",
"=",
"[",
"ops",
"."... | https://github.com/benoitsteiner/tensorflow-opencl/blob/cb7cb40a57fde5cfd4731bc551e82a1e2fef43a5/tensorflow/contrib/framework/python/ops/variables.py#L150-L163 | |
wxWidgets/wxPython-Classic | 19571e1ae65f1ac445f5491474121998c97a1bf0 | src/msw/_windows.py | python | PrePyScrolledWindow | (*args, **kwargs) | return val | PrePyScrolledWindow() -> PyScrolledWindow | PrePyScrolledWindow() -> PyScrolledWindow | [
"PrePyScrolledWindow",
"()",
"-",
">",
"PyScrolledWindow"
] | def PrePyScrolledWindow(*args, **kwargs):
"""PrePyScrolledWindow() -> PyScrolledWindow"""
val = _windows_.new_PrePyScrolledWindow(*args, **kwargs)
return val | [
"def",
"PrePyScrolledWindow",
"(",
"*",
"args",
",",
"*",
"*",
"kwargs",
")",
":",
"val",
"=",
"_windows_",
".",
"new_PrePyScrolledWindow",
"(",
"*",
"args",
",",
"*",
"*",
"kwargs",
")",
"return",
"val"
] | https://github.com/wxWidgets/wxPython-Classic/blob/19571e1ae65f1ac445f5491474121998c97a1bf0/src/msw/_windows.py#L4676-L4679 | |
wxWidgets/wxPython-Classic | 19571e1ae65f1ac445f5491474121998c97a1bf0 | wx/lib/pydocview.py | python | ChildDocument.Save | (self) | return self.OnSaveDocument(self._documentFile) | Called when the ChildDocument is saved and does the minimum such that the
ChildDocument looks like a real Document to the framework. | Called when the ChildDocument is saved and does the minimum such that the
ChildDocument looks like a real Document to the framework. | [
"Called",
"when",
"the",
"ChildDocument",
"is",
"saved",
"and",
"does",
"the",
"minimum",
"such",
"that",
"the",
"ChildDocument",
"looks",
"like",
"a",
"real",
"Document",
"to",
"the",
"framework",
"."
] | def Save(self):
"""
Called when the ChildDocument is saved and does the minimum such that the
ChildDocument looks like a real Document to the framework.
"""
return self.OnSaveDocument(self._documentFile) | [
"def",
"Save",
"(",
"self",
")",
":",
"return",
"self",
".",
"OnSaveDocument",
"(",
"self",
".",
"_documentFile",
")"
] | https://github.com/wxWidgets/wxPython-Classic/blob/19571e1ae65f1ac445f5491474121998c97a1bf0/wx/lib/pydocview.py#L2791-L2796 | |
chromiumembedded/cef | 80caf947f3fe2210e5344713c5281d8af9bdc295 | tools/cef_parser.py | python | obj_class.get_capi_name | (self) | return get_capi_name(self.name, True) | Return the CAPI structure name for this class. | Return the CAPI structure name for this class. | [
"Return",
"the",
"CAPI",
"structure",
"name",
"for",
"this",
"class",
"."
] | def get_capi_name(self):
""" Return the CAPI structure name for this class. """
return get_capi_name(self.name, True) | [
"def",
"get_capi_name",
"(",
"self",
")",
":",
"return",
"get_capi_name",
"(",
"self",
".",
"name",
",",
"True",
")"
] | https://github.com/chromiumembedded/cef/blob/80caf947f3fe2210e5344713c5281d8af9bdc295/tools/cef_parser.py#L922-L924 | |
hanpfei/chromium-net | 392cc1fa3a8f92f42e4071ab6e674d8e0482f83f | third_party/catapult/third_party/gsutil/third_party/boto/boto/ec2/elb/loadbalancer.py | python | LoadBalancer.enable_cross_zone_load_balancing | (self) | return success | Turns on CrossZone Load Balancing for this ELB.
:rtype: bool
:return: True if successful, False if not. | Turns on CrossZone Load Balancing for this ELB. | [
"Turns",
"on",
"CrossZone",
"Load",
"Balancing",
"for",
"this",
"ELB",
"."
] | def enable_cross_zone_load_balancing(self):
"""
Turns on CrossZone Load Balancing for this ELB.
:rtype: bool
:return: True if successful, False if not.
"""
success = self.connection.modify_lb_attribute(
self.name, 'crossZoneLoadBalancing', True)
if su... | [
"def",
"enable_cross_zone_load_balancing",
"(",
"self",
")",
":",
"success",
"=",
"self",
".",
"connection",
".",
"modify_lb_attribute",
"(",
"self",
".",
"name",
",",
"'crossZoneLoadBalancing'",
",",
"True",
")",
"if",
"success",
"and",
"self",
".",
"_attribute... | https://github.com/hanpfei/chromium-net/blob/392cc1fa3a8f92f42e4071ab6e674d8e0482f83f/third_party/catapult/third_party/gsutil/third_party/boto/boto/ec2/elb/loadbalancer.py#L237-L248 | |
google/or-tools | 2cb85b4eead4c38e1c54b48044f92087cf165bce | ortools/constraint_solver/samples/cvrptw_break.py | python | add_time_window_constraints | (routing, manager, data, time_evaluator_index) | Add Global Span constraint. | Add Global Span constraint. | [
"Add",
"Global",
"Span",
"constraint",
"."
] | def add_time_window_constraints(routing, manager, data, time_evaluator_index):
"""Add Global Span constraint."""
time = 'Time'
horizon = 120
routing.AddDimension(
time_evaluator_index,
horizon, # allow waiting time
horizon, # maximum time per vehicle
False, # don't for... | [
"def",
"add_time_window_constraints",
"(",
"routing",
",",
"manager",
",",
"data",
",",
"time_evaluator_index",
")",
":",
"time",
"=",
"'Time'",
"horizon",
"=",
"120",
"routing",
".",
"AddDimension",
"(",
"time_evaluator_index",
",",
"horizon",
",",
"# allow waiti... | https://github.com/google/or-tools/blob/2cb85b4eead4c38e1c54b48044f92087cf165bce/ortools/constraint_solver/samples/cvrptw_break.py#L169-L194 | ||
potassco/clingo | e0c91d8f95cc28de1c480a871f9c97c30de83d40 | libpyclingo/clingo/ast.py | python | Interval | (location: Location, left: AST, right: AST) | return AST(p_ast[0]) | Construct an AST node of type `ASTType.Interval`. | Construct an AST node of type `ASTType.Interval`. | [
"Construct",
"an",
"AST",
"node",
"of",
"type",
"ASTType",
".",
"Interval",
"."
] | def Interval(location: Location, left: AST, right: AST) -> AST:
'''
Construct an AST node of type `ASTType.Interval`.
'''
p_ast = _ffi.new('clingo_ast_t**')
c_location = _c_location(location)
_handle_error(_lib.clingo_ast_build(
_lib.clingo_ast_type_interval, p_ast,
c_location[0]... | [
"def",
"Interval",
"(",
"location",
":",
"Location",
",",
"left",
":",
"AST",
",",
"right",
":",
"AST",
")",
"->",
"AST",
":",
"p_ast",
"=",
"_ffi",
".",
"new",
"(",
"'clingo_ast_t**'",
")",
"c_location",
"=",
"_c_location",
"(",
"location",
")",
"_han... | https://github.com/potassco/clingo/blob/e0c91d8f95cc28de1c480a871f9c97c30de83d40/libpyclingo/clingo/ast.py#L1259-L1270 | |
snap-stanford/snap-python | d53c51b0a26aa7e3e7400b014cdf728948fde80a | setup/snap.py | python | TUNGraphMtx.PGetCols | (self) | return _snap.TUNGraphMtx_PGetCols(self) | PGetCols(TUNGraphMtx self) -> int
Parameters:
self: TUNGraphMtx const * | PGetCols(TUNGraphMtx self) -> int | [
"PGetCols",
"(",
"TUNGraphMtx",
"self",
")",
"-",
">",
"int"
] | def PGetCols(self):
"""
PGetCols(TUNGraphMtx self) -> int
Parameters:
self: TUNGraphMtx const *
"""
return _snap.TUNGraphMtx_PGetCols(self) | [
"def",
"PGetCols",
"(",
"self",
")",
":",
"return",
"_snap",
".",
"TUNGraphMtx_PGetCols",
"(",
"self",
")"
] | https://github.com/snap-stanford/snap-python/blob/d53c51b0a26aa7e3e7400b014cdf728948fde80a/setup/snap.py#L5498-L5506 | |
hfinkel/llvm-project-cxxjit | 91084ef018240bbb8e24235ff5cd8c355a9c1a1e | lldb/examples/python/dict_utils.py | python | LookupDictionary.get_value | (self, key, fail_value=None) | return fail_value | find the value given a key | find the value given a key | [
"find",
"the",
"value",
"given",
"a",
"key"
] | def get_value(self, key, fail_value=None):
"""find the value given a key"""
if key in self:
return self[key]
return fail_value | [
"def",
"get_value",
"(",
"self",
",",
"key",
",",
"fail_value",
"=",
"None",
")",
":",
"if",
"key",
"in",
"self",
":",
"return",
"self",
"[",
"key",
"]",
"return",
"fail_value"
] | https://github.com/hfinkel/llvm-project-cxxjit/blob/91084ef018240bbb8e24235ff5cd8c355a9c1a1e/lldb/examples/python/dict_utils.py#L25-L29 | |
wxWidgets/wxPython-Classic | 19571e1ae65f1ac445f5491474121998c97a1bf0 | src/osx_carbon/_core.py | python | XPMHandler.__init__ | (self, *args, **kwargs) | __init__(self) -> XPMHandler
A `wx.ImageHandler` for XPM image. | __init__(self) -> XPMHandler | [
"__init__",
"(",
"self",
")",
"-",
">",
"XPMHandler"
] | def __init__(self, *args, **kwargs):
"""
__init__(self) -> XPMHandler
A `wx.ImageHandler` for XPM image.
"""
_core_.XPMHandler_swiginit(self,_core_.new_XPMHandler(*args, **kwargs)) | [
"def",
"__init__",
"(",
"self",
",",
"*",
"args",
",",
"*",
"*",
"kwargs",
")",
":",
"_core_",
".",
"XPMHandler_swiginit",
"(",
"self",
",",
"_core_",
".",
"new_XPMHandler",
"(",
"*",
"args",
",",
"*",
"*",
"kwargs",
")",
")"
] | https://github.com/wxWidgets/wxPython-Classic/blob/19571e1ae65f1ac445f5491474121998c97a1bf0/src/osx_carbon/_core.py#L4044-L4050 | ||
eclipse/sumo | 7132a9b8b6eea734bdec38479026b4d8c4336d03 | tools/traci/_poi.py | python | PoiDomain.setPosition | (self, poiID, x, y) | setPosition(string, (double, double)) -> None
Sets the position coordinates of the poi. | setPosition(string, (double, double)) -> None | [
"setPosition",
"(",
"string",
"(",
"double",
"double",
"))",
"-",
">",
"None"
] | def setPosition(self, poiID, x, y):
"""setPosition(string, (double, double)) -> None
Sets the position coordinates of the poi.
"""
self._setCmd(tc.VAR_POSITION, poiID, "o", (x, y)) | [
"def",
"setPosition",
"(",
"self",
",",
"poiID",
",",
"x",
",",
"y",
")",
":",
"self",
".",
"_setCmd",
"(",
"tc",
".",
"VAR_POSITION",
",",
"poiID",
",",
"\"o\"",
",",
"(",
"x",
",",
"y",
")",
")"
] | https://github.com/eclipse/sumo/blob/7132a9b8b6eea734bdec38479026b4d8c4336d03/tools/traci/_poi.py#L88-L93 | ||
facebookarchive/LogDevice | ce7726050edc49a1e15d9160e81c890736b779e2 | logdevice/ops/ldquery/py/lib.py | python | Cursor.columns | (self) | return list(self._result.headers) | A list of the columns returned in this result-set | A list of the columns returned in this result-set | [
"A",
"list",
"of",
"the",
"columns",
"returned",
"in",
"this",
"result",
"-",
"set"
] | def columns(self):
"""
A list of the columns returned in this result-set
"""
return list(self._result.headers) | [
"def",
"columns",
"(",
"self",
")",
":",
"return",
"list",
"(",
"self",
".",
"_result",
".",
"headers",
")"
] | https://github.com/facebookarchive/LogDevice/blob/ce7726050edc49a1e15d9160e81c890736b779e2/logdevice/ops/ldquery/py/lib.py#L172-L176 | |
turi-code/SFrame | 796b9bdfb2fa1b881d82080754643c7e68629cd2 | oss_src/unity/python/sframe/data_structures/sarray.py | python | SArray.num_missing | (self) | Number of missing elements in the SArray.
Returns
-------
out : int
Number of missing values. | Number of missing elements in the SArray. | [
"Number",
"of",
"missing",
"elements",
"in",
"the",
"SArray",
"."
] | def num_missing(self):
"""
Number of missing elements in the SArray.
Returns
-------
out : int
Number of missing values.
"""
with cython_context():
return self.__proxy__.num_missing() | [
"def",
"num_missing",
"(",
"self",
")",
":",
"with",
"cython_context",
"(",
")",
":",
"return",
"self",
".",
"__proxy__",
".",
"num_missing",
"(",
")"
] | https://github.com/turi-code/SFrame/blob/796b9bdfb2fa1b881d82080754643c7e68629cd2/oss_src/unity/python/sframe/data_structures/sarray.py#L2282-L2292 | ||
panda3d/panda3d | 833ad89ebad58395d0af0b7ec08538e5e4308265 | direct/src/showbase/ShowBase.py | python | ShowBase.addAngularIntegrator | (self) | Adds a :class:`~panda3d.physics.AngularEulerIntegrator` to the default
physics manager. By default, only a
:class:`~panda3d.physics.LinearEulerIntegrator` is attached. | Adds a :class:`~panda3d.physics.AngularEulerIntegrator` to the default
physics manager. By default, only a
:class:`~panda3d.physics.LinearEulerIntegrator` is attached. | [
"Adds",
"a",
":",
"class",
":",
"~panda3d",
".",
"physics",
".",
"AngularEulerIntegrator",
"to",
"the",
"default",
"physics",
"manager",
".",
"By",
"default",
"only",
"a",
":",
"class",
":",
"~panda3d",
".",
"physics",
".",
"LinearEulerIntegrator",
"is",
"at... | def addAngularIntegrator(self):
"""
Adds a :class:`~panda3d.physics.AngularEulerIntegrator` to the default
physics manager. By default, only a
:class:`~panda3d.physics.LinearEulerIntegrator` is attached.
"""
if not self.physicsMgrAngular:
physics = importlib.... | [
"def",
"addAngularIntegrator",
"(",
"self",
")",
":",
"if",
"not",
"self",
".",
"physicsMgrAngular",
":",
"physics",
"=",
"importlib",
".",
"import_module",
"(",
"'panda3d.physics'",
")",
"self",
".",
"physicsMgrAngular",
"=",
"1",
"integrator",
"=",
"physics",
... | https://github.com/panda3d/panda3d/blob/833ad89ebad58395d0af0b7ec08538e5e4308265/direct/src/showbase/ShowBase.py#L1832-L1842 | ||
ricardoquesada/Spidermonkey | 4a75ea2543408bd1b2c515aa95901523eeef7858 | python/psutil/psutil/__init__.py | python | Process.exe | (self) | The process executable path. May also be an empty string. | The process executable path. May also be an empty string. | [
"The",
"process",
"executable",
"path",
".",
"May",
"also",
"be",
"an",
"empty",
"string",
"."
] | def exe(self):
"""The process executable path. May also be an empty string."""
def guess_it(fallback):
# try to guess exe from cmdline[0] in absence of a native
# exe representation
cmdline = self.cmdline
if cmdline and hasattr(os, 'access') and hasattr(os... | [
"def",
"exe",
"(",
"self",
")",
":",
"def",
"guess_it",
"(",
"fallback",
")",
":",
"# try to guess exe from cmdline[0] in absence of a native",
"# exe representation",
"cmdline",
"=",
"self",
".",
"cmdline",
"if",
"cmdline",
"and",
"hasattr",
"(",
"os",
",",
"'acc... | https://github.com/ricardoquesada/Spidermonkey/blob/4a75ea2543408bd1b2c515aa95901523eeef7858/python/psutil/psutil/__init__.py#L309-L341 | ||
tensorflow/tensorflow | 419e3a6b650ea4bd1b0cba23c4348f8a69f3272e | tensorflow/python/autograph/converters/functions.py | python | FunctionTransformer._function_scope_options | (self, fn_scope) | return self.ctx.user.options.call_options() | Returns the options with which to create function scopes. | Returns the options with which to create function scopes. | [
"Returns",
"the",
"options",
"with",
"which",
"to",
"create",
"function",
"scopes",
"."
] | def _function_scope_options(self, fn_scope):
"""Returns the options with which to create function scopes."""
# Top-level function receive the options that were directly requested.
# All others receive the options corresponding to a recursive conversion.
# Note: this mainly controls the user_requested fl... | [
"def",
"_function_scope_options",
"(",
"self",
",",
"fn_scope",
")",
":",
"# Top-level function receive the options that were directly requested.",
"# All others receive the options corresponding to a recursive conversion.",
"# Note: this mainly controls the user_requested flag, which is importa... | https://github.com/tensorflow/tensorflow/blob/419e3a6b650ea4bd1b0cba23c4348f8a69f3272e/tensorflow/python/autograph/converters/functions.py#L37-L47 | |
francinexue/xuefu | b6ff79747a42e020588c0c0a921048e08fe4680c | cnx/tickfeed.py | python | BaseBarFeed.getLastBar | (self, instrument) | return self.__lastBars.get(instrument, None) | Returns the last :class:`pyalgotrade.bar.Bar` for a given instrument, or None. | Returns the last :class:`pyalgotrade.bar.Bar` for a given instrument, or None. | [
"Returns",
"the",
"last",
":",
"class",
":",
"pyalgotrade",
".",
"bar",
".",
"Bar",
"for",
"a",
"given",
"instrument",
"or",
"None",
"."
] | def getLastBar(self, instrument):
"""Returns the last :class:`pyalgotrade.bar.Bar` for a given instrument, or None."""
return self.__lastBars.get(instrument, None) | [
"def",
"getLastBar",
"(",
"self",
",",
"instrument",
")",
":",
"return",
"self",
".",
"__lastBars",
".",
"get",
"(",
"instrument",
",",
"None",
")"
] | https://github.com/francinexue/xuefu/blob/b6ff79747a42e020588c0c0a921048e08fe4680c/cnx/tickfeed.py#L127-L129 | |
hughperkins/tf-coriander | 970d3df6c11400ad68405f22b0c42a52374e94ca | tensorflow/contrib/learn/python/learn/estimators/_sklearn.py | python | _BaseEstimator.get_params | (self, deep=True) | return out | Get parameters for this estimator.
Args:
deep: boolean, optional
If `True`, will return the parameters for this estimator and
contained subobjects that are estimators.
Returns:
params : mapping of string to any
Parameter names mapped to their values. | Get parameters for this estimator. | [
"Get",
"parameters",
"for",
"this",
"estimator",
"."
] | def get_params(self, deep=True):
"""Get parameters for this estimator.
Args:
deep: boolean, optional
If `True`, will return the parameters for this estimator and
contained subobjects that are estimators.
Returns:
params : mapping of string to any
Parameter names mapped t... | [
"def",
"get_params",
"(",
"self",
",",
"deep",
"=",
"True",
")",
":",
"out",
"=",
"dict",
"(",
")",
"param_names",
"=",
"[",
"name",
"for",
"name",
"in",
"self",
".",
"__dict__",
"if",
"not",
"name",
".",
"startswith",
"(",
"'_'",
")",
"]",
"for",
... | https://github.com/hughperkins/tf-coriander/blob/970d3df6c11400ad68405f22b0c42a52374e94ca/tensorflow/contrib/learn/python/learn/estimators/_sklearn.py#L40-L66 | |
krishauser/Klampt | 972cc83ea5befac3f653c1ba20f80155768ad519 | Python/python2_version/klampt/math/optimize.py | python | OptimizationProblemBuilder.inBounds | (self) | return True | Returns True if all bounded variables are within their ranges at the currently bound state x | Returns True if all bounded variables are within their ranges at the currently bound state x | [
"Returns",
"True",
"if",
"all",
"bounded",
"variables",
"are",
"within",
"their",
"ranges",
"at",
"the",
"currently",
"bound",
"state",
"x"
] | def inBounds(self):
"""Returns True if all bounded variables are within their ranges at the currently bound state x"""
for k,bnds in self.variableBounds.iteritems():
var = self.context.variableDict[k]
assert var.value is not None,"All optimization variables must be bound"
... | [
"def",
"inBounds",
"(",
"self",
")",
":",
"for",
"k",
",",
"bnds",
"in",
"self",
".",
"variableBounds",
".",
"iteritems",
"(",
")",
":",
"var",
"=",
"self",
".",
"context",
".",
"variableDict",
"[",
"k",
"]",
"assert",
"var",
".",
"value",
"is",
"n... | https://github.com/krishauser/Klampt/blob/972cc83ea5befac3f653c1ba20f80155768ad519/Python/python2_version/klampt/math/optimize.py#L988-L996 | |
google/syzygy | 8164b24ebde9c5649c9a09e88a7fc0b0fcbd1bc5 | third_party/numpy/files/numpy/core/numeric.py | python | identity | (n, dtype=None) | return a | Return the identity array.
The identity array is a square array with ones on
the main diagonal.
Parameters
----------
n : int
Number of rows (and columns) in `n` x `n` output.
dtype : data-type, optional
Data-type of the output. Defaults to ``float``.
Returns
-------
... | Return the identity array. | [
"Return",
"the",
"identity",
"array",
"."
] | def identity(n, dtype=None):
"""
Return the identity array.
The identity array is a square array with ones on
the main diagonal.
Parameters
----------
n : int
Number of rows (and columns) in `n` x `n` output.
dtype : data-type, optional
Data-type of the output. Default... | [
"def",
"identity",
"(",
"n",
",",
"dtype",
"=",
"None",
")",
":",
"a",
"=",
"zeros",
"(",
"(",
"n",
",",
"n",
")",
",",
"dtype",
"=",
"dtype",
")",
"a",
".",
"flat",
"[",
":",
":",
"n",
"+",
"1",
"]",
"=",
"1",
"return",
"a"
] | https://github.com/google/syzygy/blob/8164b24ebde9c5649c9a09e88a7fc0b0fcbd1bc5/third_party/numpy/files/numpy/core/numeric.py#L1830-L1860 | |
wxWidgets/wxPython-Classic | 19571e1ae65f1ac445f5491474121998c97a1bf0 | src/osx_carbon/_controls.py | python | Listbook.GetListView | (*args, **kwargs) | return _controls_.Listbook_GetListView(*args, **kwargs) | GetListView(self) -> ListView | GetListView(self) -> ListView | [
"GetListView",
"(",
"self",
")",
"-",
">",
"ListView"
] | def GetListView(*args, **kwargs):
"""GetListView(self) -> ListView"""
return _controls_.Listbook_GetListView(*args, **kwargs) | [
"def",
"GetListView",
"(",
"*",
"args",
",",
"*",
"*",
"kwargs",
")",
":",
"return",
"_controls_",
".",
"Listbook_GetListView",
"(",
"*",
"args",
",",
"*",
"*",
"kwargs",
")"
] | https://github.com/wxWidgets/wxPython-Classic/blob/19571e1ae65f1ac445f5491474121998c97a1bf0/src/osx_carbon/_controls.py#L3226-L3228 | |
tensorflow/tensorflow | 419e3a6b650ea4bd1b0cba23c4348f8a69f3272e | tensorflow/python/ops/losses/losses_impl.py | python | absolute_difference | (
labels, predictions, weights=1.0, scope=None,
loss_collection=ops.GraphKeys.LOSSES,
reduction=Reduction.SUM_BY_NONZERO_WEIGHTS) | Adds an Absolute Difference loss to the training procedure.
`weights` acts as a coefficient for the loss. If a scalar is provided, then
the loss is simply scaled by the given value. If `weights` is a `Tensor` of
shape `[batch_size]`, then the total loss for each sample of the batch is
rescaled by the correspon... | Adds an Absolute Difference loss to the training procedure. | [
"Adds",
"an",
"Absolute",
"Difference",
"loss",
"to",
"the",
"training",
"procedure",
"."
] | def absolute_difference(
labels, predictions, weights=1.0, scope=None,
loss_collection=ops.GraphKeys.LOSSES,
reduction=Reduction.SUM_BY_NONZERO_WEIGHTS):
"""Adds an Absolute Difference loss to the training procedure.
`weights` acts as a coefficient for the loss. If a scalar is provided, then
the loss... | [
"def",
"absolute_difference",
"(",
"labels",
",",
"predictions",
",",
"weights",
"=",
"1.0",
",",
"scope",
"=",
"None",
",",
"loss_collection",
"=",
"ops",
".",
"GraphKeys",
".",
"LOSSES",
",",
"reduction",
"=",
"Reduction",
".",
"SUM_BY_NONZERO_WEIGHTS",
")",... | https://github.com/tensorflow/tensorflow/blob/419e3a6b650ea4bd1b0cba23c4348f8a69f3272e/tensorflow/python/ops/losses/losses_impl.py#L217-L266 | ||
catboost/catboost | 167f64f237114a4d10b2b4ee42adb4569137debe | contrib/python/scipy/py2/scipy/optimize/_trustregion_constr/tr_interior_point.py | python | BarrierSubproblem.function_and_constraints | (self, z) | return (self._compute_function(f, c_ineq, s),
self._compute_constr(c_ineq, c_eq, s)) | Returns barrier function and constraints at given point.
For z = [x, s], returns barrier function:
function(z) = fun(x) - barrier_parameter*sum(log(s))
and barrier constraints:
constraints(z) = [ constr_eq(x) ]
[ constr_ineq(x) + s ] | Returns barrier function and constraints at given point. | [
"Returns",
"barrier",
"function",
"and",
"constraints",
"at",
"given",
"point",
"."
] | def function_and_constraints(self, z):
"""Returns barrier function and constraints at given point.
For z = [x, s], returns barrier function:
function(z) = fun(x) - barrier_parameter*sum(log(s))
and barrier constraints:
constraints(z) = [ constr_eq(x) ]
... | [
"def",
"function_and_constraints",
"(",
"self",
",",
"z",
")",
":",
"# Get variables and slack variables",
"x",
"=",
"self",
".",
"get_variables",
"(",
"z",
")",
"s",
"=",
"self",
".",
"get_slack",
"(",
"z",
")",
"# Compute function and constraints",
"f",
"=",
... | https://github.com/catboost/catboost/blob/167f64f237114a4d10b2b4ee42adb4569137debe/contrib/python/scipy/py2/scipy/optimize/_trustregion_constr/tr_interior_point.py#L69-L87 | |
microsoft/TSS.MSR | 0f2516fca2cd9929c31d5450e39301c9bde43688 | TSS.Py/src/Tpm.py | python | Tpm.PP_Commands | (self, auth, setList, clearList) | return self.processResponse(respBuf) | This command is used to determine which commands require assertion
of Physical Presence (PP) in addition to platformAuth/platformPolicy.
Args:
auth (TPM_HANDLE): TPM_RH_PLATFORM+PP
Auth Index: 1
Auth Role: USER + Physical Presence
setList (TPM_CC[... | This command is used to determine which commands require assertion
of Physical Presence (PP) in addition to platformAuth/platformPolicy. | [
"This",
"command",
"is",
"used",
"to",
"determine",
"which",
"commands",
"require",
"assertion",
"of",
"Physical",
"Presence",
"(",
"PP",
")",
"in",
"addition",
"to",
"platformAuth",
"/",
"platformPolicy",
"."
] | def PP_Commands(self, auth, setList, clearList):
""" This command is used to determine which commands require assertion
of Physical Presence (PP) in addition to platformAuth/platformPolicy.
Args:
auth (TPM_HANDLE): TPM_RH_PLATFORM+PP
Auth Index: 1
Aut... | [
"def",
"PP_Commands",
"(",
"self",
",",
"auth",
",",
"setList",
",",
"clearList",
")",
":",
"req",
"=",
"TPM2_PP_Commands_REQUEST",
"(",
"auth",
",",
"setList",
",",
"clearList",
")",
"respBuf",
"=",
"self",
".",
"dispatchCommand",
"(",
"TPM_CC",
".",
"PP_... | https://github.com/microsoft/TSS.MSR/blob/0f2516fca2cd9929c31d5450e39301c9bde43688/TSS.Py/src/Tpm.py#L1985-L2000 | |
Samsung/veles | 95ed733c2e49bc011ad98ccf2416ecec23fbf352 | veles/external/prettytable.py | python | PrettyTable._get_start | (self) | return self._start | Start index of the range of rows to print
Arguments:
start - index of first data row to include in output | Start index of the range of rows to print | [
"Start",
"index",
"of",
"the",
"range",
"of",
"rows",
"to",
"print"
] | def _get_start(self):
"""Start index of the range of rows to print
Arguments:
start - index of first data row to include in output"""
return self._start | [
"def",
"_get_start",
"(",
"self",
")",
":",
"return",
"self",
".",
"_start"
] | https://github.com/Samsung/veles/blob/95ed733c2e49bc011ad98ccf2416ecec23fbf352/veles/external/prettytable.py#L472-L478 | |
aws/lumberyard | f85344403c1c2e77ec8c75deb2c116e97b713217 | dev/Gems/CloudGemMetric/v1/AWS/common-code/Lib/pandas/io/formats/excel.py | python | ExcelFormatter.write | (
self,
writer,
sheet_name="Sheet1",
startrow=0,
startcol=0,
freeze_panes=None,
engine=None,
) | writer : string or ExcelWriter object
File path or existing ExcelWriter
sheet_name : string, default 'Sheet1'
Name of sheet which will contain DataFrame
startrow :
upper left cell row to dump data frame
startcol :
upper left cell column to dump dat... | writer : string or ExcelWriter object
File path or existing ExcelWriter
sheet_name : string, default 'Sheet1'
Name of sheet which will contain DataFrame
startrow :
upper left cell row to dump data frame
startcol :
upper left cell column to dump dat... | [
"writer",
":",
"string",
"or",
"ExcelWriter",
"object",
"File",
"path",
"or",
"existing",
"ExcelWriter",
"sheet_name",
":",
"string",
"default",
"Sheet1",
"Name",
"of",
"sheet",
"which",
"will",
"contain",
"DataFrame",
"startrow",
":",
"upper",
"left",
"cell",
... | def write(
self,
writer,
sheet_name="Sheet1",
startrow=0,
startcol=0,
freeze_panes=None,
engine=None,
):
"""
writer : string or ExcelWriter object
File path or existing ExcelWriter
sheet_name : string, default 'Sheet1'
... | [
"def",
"write",
"(",
"self",
",",
"writer",
",",
"sheet_name",
"=",
"\"Sheet1\"",
",",
"startrow",
"=",
"0",
",",
"startcol",
"=",
"0",
",",
"freeze_panes",
"=",
"None",
",",
"engine",
"=",
"None",
",",
")",
":",
"from",
"pandas",
".",
"io",
".",
"... | https://github.com/aws/lumberyard/blob/f85344403c1c2e77ec8c75deb2c116e97b713217/dev/Gems/CloudGemMetric/v1/AWS/common-code/Lib/pandas/io/formats/excel.py#L688-L738 | ||
miyosuda/TensorFlowAndroidDemo | 35903e0221aa5f109ea2dbef27f20b52e317f42d | jni-build/jni/include/tensorflow/contrib/factorization/python/ops/clustering_ops.py | python | KMeans._full_batch_training_op | (self, inputs, cluster_idx_list, cluster_centers) | return tf.assign(cluster_centers, new_clusters_centers) | Creates an op for training for full batch case.
Args:
inputs: list of input Tensors.
cluster_idx_list: A vector (or list of vectors). Each element in the
vector corresponds to an input row in 'inp' and specifies the cluster id
corresponding to the input.
cluster_centers: Tensor Re... | Creates an op for training for full batch case. | [
"Creates",
"an",
"op",
"for",
"training",
"for",
"full",
"batch",
"case",
"."
] | def _full_batch_training_op(self, inputs, cluster_idx_list, cluster_centers):
"""Creates an op for training for full batch case.
Args:
inputs: list of input Tensors.
cluster_idx_list: A vector (or list of vectors). Each element in the
vector corresponds to an input row in 'inp' and specifie... | [
"def",
"_full_batch_training_op",
"(",
"self",
",",
"inputs",
",",
"cluster_idx_list",
",",
"cluster_centers",
")",
":",
"cluster_sums",
"=",
"[",
"]",
"cluster_counts",
"=",
"[",
"]",
"epsilon",
"=",
"tf",
".",
"constant",
"(",
"1e-6",
",",
"dtype",
"=",
... | https://github.com/miyosuda/TensorFlowAndroidDemo/blob/35903e0221aa5f109ea2dbef27f20b52e317f42d/jni-build/jni/include/tensorflow/contrib/factorization/python/ops/clustering_ops.py#L378-L408 | |
wxWidgets/wxPython-Classic | 19571e1ae65f1ac445f5491474121998c97a1bf0 | src/msw/aui.py | python | AuiManager.DrawHintRect | (*args, **kwargs) | return _aui.AuiManager_DrawHintRect(*args, **kwargs) | DrawHintRect(self, Window paneWindow, Point pt, Point offset) | DrawHintRect(self, Window paneWindow, Point pt, Point offset) | [
"DrawHintRect",
"(",
"self",
"Window",
"paneWindow",
"Point",
"pt",
"Point",
"offset",
")"
] | def DrawHintRect(*args, **kwargs):
"""DrawHintRect(self, Window paneWindow, Point pt, Point offset)"""
return _aui.AuiManager_DrawHintRect(*args, **kwargs) | [
"def",
"DrawHintRect",
"(",
"*",
"args",
",",
"*",
"*",
"kwargs",
")",
":",
"return",
"_aui",
".",
"AuiManager_DrawHintRect",
"(",
"*",
"args",
",",
"*",
"*",
"kwargs",
")"
] | https://github.com/wxWidgets/wxPython-Classic/blob/19571e1ae65f1ac445f5491474121998c97a1bf0/src/msw/aui.py#L719-L721 | |
wxWidgets/wxPython-Classic | 19571e1ae65f1ac445f5491474121998c97a1bf0 | src/osx_carbon/aui.py | python | AuiMDIChildFrame.ApplyMDIChildFrameRect | (*args, **kwargs) | return _aui.AuiMDIChildFrame_ApplyMDIChildFrameRect(*args, **kwargs) | ApplyMDIChildFrameRect(self) | ApplyMDIChildFrameRect(self) | [
"ApplyMDIChildFrameRect",
"(",
"self",
")"
] | def ApplyMDIChildFrameRect(*args, **kwargs):
"""ApplyMDIChildFrameRect(self)"""
return _aui.AuiMDIChildFrame_ApplyMDIChildFrameRect(*args, **kwargs) | [
"def",
"ApplyMDIChildFrameRect",
"(",
"*",
"args",
",",
"*",
"*",
"kwargs",
")",
":",
"return",
"_aui",
".",
"AuiMDIChildFrame_ApplyMDIChildFrameRect",
"(",
"*",
"args",
",",
"*",
"*",
"kwargs",
")"
] | https://github.com/wxWidgets/wxPython-Classic/blob/19571e1ae65f1ac445f5491474121998c97a1bf0/src/osx_carbon/aui.py#L1610-L1612 | |
PaddlePaddle/Paddle | 1252f4bb3e574df80aa6d18c7ddae1b3a90bd81c | python/paddle/fluid/incubate/fleet/base/fleet_base.py | python | Fleet.server_endpoints | (self, to_string=False) | Get current server endpoints, such as ["127.0.0.1:1001", "127.0.0.1:1002"].
Returns:
list/string: server endpoints | Get current server endpoints, such as ["127.0.0.1:1001", "127.0.0.1:1002"]. | [
"Get",
"current",
"server",
"endpoints",
"such",
"as",
"[",
"127",
".",
"0",
".",
"0",
".",
"1",
":",
"1001",
"127",
".",
"0",
".",
"0",
".",
"1",
":",
"1002",
"]",
"."
] | def server_endpoints(self, to_string=False):
"""
Get current server endpoints, such as ["127.0.0.1:1001", "127.0.0.1:1002"].
Returns:
list/string: server endpoints
"""
if to_string:
return ",".join(self._role_maker.get_pserver_endpoints())
else:
... | [
"def",
"server_endpoints",
"(",
"self",
",",
"to_string",
"=",
"False",
")",
":",
"if",
"to_string",
":",
"return",
"\",\"",
".",
"join",
"(",
"self",
".",
"_role_maker",
".",
"get_pserver_endpoints",
"(",
")",
")",
"else",
":",
"return",
"self",
".",
"_... | https://github.com/PaddlePaddle/Paddle/blob/1252f4bb3e574df80aa6d18c7ddae1b3a90bd81c/python/paddle/fluid/incubate/fleet/base/fleet_base.py#L121-L132 | ||
miyosuda/TensorFlowAndroidDemo | 35903e0221aa5f109ea2dbef27f20b52e317f42d | jni-build/jni/include/tensorflow/python/training/saver.py | python | BaseSaverBuilder._ValidateAndSliceInputs | (self, names_to_variables) | return vars_to_save | Returns the variables and names that will be used for a Saver.
Args:
names_to_variables: A dict (k, v) where k is the name of a variable and v
is a Variable to save or a BaseSaverBuilder.Saver.
Returns:
A list of BaseSaverBuilder.VarToSave objects.
Raises:
TypeError: If any of ... | Returns the variables and names that will be used for a Saver. | [
"Returns",
"the",
"variables",
"and",
"names",
"that",
"will",
"be",
"used",
"for",
"a",
"Saver",
"."
] | def _ValidateAndSliceInputs(self, names_to_variables):
"""Returns the variables and names that will be used for a Saver.
Args:
names_to_variables: A dict (k, v) where k is the name of a variable and v
is a Variable to save or a BaseSaverBuilder.Saver.
Returns:
A list of BaseSaverBuild... | [
"def",
"_ValidateAndSliceInputs",
"(",
"self",
",",
"names_to_variables",
")",
":",
"if",
"not",
"isinstance",
"(",
"names_to_variables",
",",
"dict",
")",
":",
"names_to_variables",
"=",
"self",
".",
"_VarListToDict",
"(",
"names_to_variables",
")",
"vars_to_save",... | https://github.com/miyosuda/TensorFlowAndroidDemo/blob/35903e0221aa5f109ea2dbef27f20b52e317f42d/jni-build/jni/include/tensorflow/python/training/saver.py#L382-L435 | |
aws/lumberyard | f85344403c1c2e77ec8c75deb2c116e97b713217 | dev/Tools/Python/3.7.10/linux_x64/lib/python3.7/site-packages/urllib3/contrib/securetransport.py | python | inject_into_urllib3 | () | Monkey-patch urllib3 with SecureTransport-backed SSL-support. | Monkey-patch urllib3 with SecureTransport-backed SSL-support. | [
"Monkey",
"-",
"patch",
"urllib3",
"with",
"SecureTransport",
"-",
"backed",
"SSL",
"-",
"support",
"."
] | def inject_into_urllib3():
"""
Monkey-patch urllib3 with SecureTransport-backed SSL-support.
"""
util.SSLContext = SecureTransportContext
util.ssl_.SSLContext = SecureTransportContext
util.HAS_SNI = HAS_SNI
util.ssl_.HAS_SNI = HAS_SNI
util.IS_SECURETRANSPORT = True
util.ssl_.IS_SECUR... | [
"def",
"inject_into_urllib3",
"(",
")",
":",
"util",
".",
"SSLContext",
"=",
"SecureTransportContext",
"util",
".",
"ssl_",
".",
"SSLContext",
"=",
"SecureTransportContext",
"util",
".",
"HAS_SNI",
"=",
"HAS_SNI",
"util",
".",
"ssl_",
".",
"HAS_SNI",
"=",
"HAS... | https://github.com/aws/lumberyard/blob/f85344403c1c2e77ec8c75deb2c116e97b713217/dev/Tools/Python/3.7.10/linux_x64/lib/python3.7/site-packages/urllib3/contrib/securetransport.py#L180-L189 | ||
natanielruiz/android-yolo | 1ebb54f96a67a20ff83ddfc823ed83a13dc3a47f | jni-build/jni/include/tensorflow/contrib/distributions/python/ops/operator_pd_identity.py | python | OperatorPDIdentity.get_shape | (self) | return self._get_shape | Static `TensorShape` of entire operator.
If this operator represents the batch matrix `A` with
`A.shape = [N1,...,Nn, k, k]`, then this returns
`TensorShape([N1,...,Nn, k, k])`
Returns:
`TensorShape`, statically determined, may be undefined. | Static `TensorShape` of entire operator. | [
"Static",
"TensorShape",
"of",
"entire",
"operator",
"."
] | def get_shape(self):
"""Static `TensorShape` of entire operator.
If this operator represents the batch matrix `A` with
`A.shape = [N1,...,Nn, k, k]`, then this returns
`TensorShape([N1,...,Nn, k, k])`
Returns:
`TensorShape`, statically determined, may be undefined.
"""
return self._g... | [
"def",
"get_shape",
"(",
"self",
")",
":",
"return",
"self",
".",
"_get_shape"
] | https://github.com/natanielruiz/android-yolo/blob/1ebb54f96a67a20ff83ddfc823ed83a13dc3a47f/jni-build/jni/include/tensorflow/contrib/distributions/python/ops/operator_pd_identity.py#L153-L163 | |
aws/lumberyard | f85344403c1c2e77ec8c75deb2c116e97b713217 | dev/Tools/Python/3.7.10/mac/Python.framework/Versions/3.7/lib/python3.7/http/cookiejar.py | python | parse_ns_headers | (ns_headers) | return result | Ad-hoc parser for Netscape protocol cookie-attributes.
The old Netscape cookie format for Set-Cookie can for instance contain
an unquoted "," in the expires field, so we have to use this ad-hoc
parser instead of split_header_words.
XXX This may not make the best possible effort to parse all the crap
... | Ad-hoc parser for Netscape protocol cookie-attributes. | [
"Ad",
"-",
"hoc",
"parser",
"for",
"Netscape",
"protocol",
"cookie",
"-",
"attributes",
"."
] | def parse_ns_headers(ns_headers):
"""Ad-hoc parser for Netscape protocol cookie-attributes.
The old Netscape cookie format for Set-Cookie can for instance contain
an unquoted "," in the expires field, so we have to use this ad-hoc
parser instead of split_header_words.
XXX This may not make the bes... | [
"def",
"parse_ns_headers",
"(",
"ns_headers",
")",
":",
"known_attrs",
"=",
"(",
"\"expires\"",
",",
"\"domain\"",
",",
"\"path\"",
",",
"\"secure\"",
",",
"# RFC 2109 attrs (may turn up in Netscape cookies, too)",
"\"version\"",
",",
"\"port\"",
",",
"\"max-age\"",
")"... | https://github.com/aws/lumberyard/blob/f85344403c1c2e77ec8c75deb2c116e97b713217/dev/Tools/Python/3.7.10/mac/Python.framework/Versions/3.7/lib/python3.7/http/cookiejar.py#L458-L523 | |
htcondor/htcondor | 4829724575176d1d6c936e4693dfd78a728569b0 | bindings/python/htcondor/dags/rescue.py | python | find_rescue_file | (
dag_dir: Path, dag_file_name: str = DEFAULT_DAG_FILE_NAME
) | return rescue_files[-1] | Finds the latest rescue file in a DAG directory
(just like DAGMan itself would).
Parameters
----------
dag_dir
The directory to search in.
dag_file_name
The base name of the DAG description file;
the same name you would pass to :func:`write_dag`.
Returns
-------
... | Finds the latest rescue file in a DAG directory
(just like DAGMan itself would). | [
"Finds",
"the",
"latest",
"rescue",
"file",
"in",
"a",
"DAG",
"directory",
"(",
"just",
"like",
"DAGMan",
"itself",
"would",
")",
"."
] | def find_rescue_file(
dag_dir: Path, dag_file_name: str = DEFAULT_DAG_FILE_NAME
) -> Optional[Path]:
"""
Finds the latest rescue file in a DAG directory
(just like DAGMan itself would).
Parameters
----------
dag_dir
The directory to search in.
dag_file_name
The base name... | [
"def",
"find_rescue_file",
"(",
"dag_dir",
":",
"Path",
",",
"dag_file_name",
":",
"str",
"=",
"DEFAULT_DAG_FILE_NAME",
")",
"->",
"Optional",
"[",
"Path",
"]",
":",
"dag_dir",
"=",
"Path",
"(",
"dag_dir",
")",
"rescue_files",
"=",
"sorted",
"(",
"dag_dir",
... | https://github.com/htcondor/htcondor/blob/4829724575176d1d6c936e4693dfd78a728569b0/bindings/python/htcondor/dags/rescue.py#L92-L120 | |
aws/lumberyard | f85344403c1c2e77ec8c75deb2c116e97b713217 | dev/Gems/CloudGemMetric/v1/AWS/python/windows/Lib/pandas/core/frame.py | python | DataFrame._info_repr | (self) | return info_repr_option and not (
self._repr_fits_horizontal_() and self._repr_fits_vertical_()
) | True if the repr should show the info view. | True if the repr should show the info view. | [
"True",
"if",
"the",
"repr",
"should",
"show",
"the",
"info",
"view",
"."
] | def _info_repr(self) -> bool:
"""
True if the repr should show the info view.
"""
info_repr_option = get_option("display.large_repr") == "info"
return info_repr_option and not (
self._repr_fits_horizontal_() and self._repr_fits_vertical_()
) | [
"def",
"_info_repr",
"(",
"self",
")",
"->",
"bool",
":",
"info_repr_option",
"=",
"get_option",
"(",
"\"display.large_repr\"",
")",
"==",
"\"info\"",
"return",
"info_repr_option",
"and",
"not",
"(",
"self",
".",
"_repr_fits_horizontal_",
"(",
")",
"and",
"self"... | https://github.com/aws/lumberyard/blob/f85344403c1c2e77ec8c75deb2c116e97b713217/dev/Gems/CloudGemMetric/v1/AWS/python/windows/Lib/pandas/core/frame.py#L653-L660 | |
ApolloAuto/apollo-platform | 86d9dc6743b496ead18d597748ebabd34a513289 | ros/ros_comm/rosmaster/src/rosmaster/master_api.py | python | ROSMasterHandler.registerPublisher | (self, caller_id, topic, topic_type, caller_api) | return 1, "Registered [%s] as publisher of [%s]"%(caller_id, topic), sub_uris | Register the caller as a publisher the topic.
@param caller_id: ROS caller id
@type caller_id: str
@param topic: Fully-qualified name of topic to register.
@type topic: str
@param topic_type: Datatype for topic. Must be a
package-resource name, i.e. the .msg name.
... | Register the caller as a publisher the topic. | [
"Register",
"the",
"caller",
"as",
"a",
"publisher",
"the",
"topic",
"."
] | def registerPublisher(self, caller_id, topic, topic_type, caller_api):
"""
Register the caller as a publisher the topic.
@param caller_id: ROS caller id
@type caller_id: str
@param topic: Fully-qualified name of topic to register.
@type topic: str
@param topic_t... | [
"def",
"registerPublisher",
"(",
"self",
",",
"caller_id",
",",
"topic",
",",
"topic_type",
",",
"caller_api",
")",
":",
"#NOTE: we need topic_type for getPublishedTopics.",
"try",
":",
"self",
".",
"ps_lock",
".",
"acquire",
"(",
")",
"self",
".",
"reg_manager",
... | https://github.com/ApolloAuto/apollo-platform/blob/86d9dc6743b496ead18d597748ebabd34a513289/ros/ros_comm/rosmaster/src/rosmaster/master_api.py#L723-L753 | |
aws/lumberyard | f85344403c1c2e77ec8c75deb2c116e97b713217 | dev/Tools/Python/3.7.10/mac/Python.framework/Versions/3.7/lib/python3.7/tkinter/__init__.py | python | Menu.add | (self, itemType, cnf={}, **kw) | Internal function. | Internal function. | [
"Internal",
"function",
"."
] | def add(self, itemType, cnf={}, **kw):
"""Internal function."""
self.tk.call((self._w, 'add', itemType) +
self._options(cnf, kw)) | [
"def",
"add",
"(",
"self",
",",
"itemType",
",",
"cnf",
"=",
"{",
"}",
",",
"*",
"*",
"kw",
")",
":",
"self",
".",
"tk",
".",
"call",
"(",
"(",
"self",
".",
"_w",
",",
"'add'",
",",
"itemType",
")",
"+",
"self",
".",
"_options",
"(",
"cnf",
... | https://github.com/aws/lumberyard/blob/f85344403c1c2e77ec8c75deb2c116e97b713217/dev/Tools/Python/3.7.10/mac/Python.framework/Versions/3.7/lib/python3.7/tkinter/__init__.py#L2875-L2878 | ||
wxWidgets/wxPython-Classic | 19571e1ae65f1ac445f5491474121998c97a1bf0 | wx/tools/Editra/src/extern/aui/tabart.py | python | AuiSimpleTabArt.GetMeasuringFont | (self) | return self._measuring_font | Returns the font for calculating text measurements. | Returns the font for calculating text measurements. | [
"Returns",
"the",
"font",
"for",
"calculating",
"text",
"measurements",
"."
] | def GetMeasuringFont(self):
""" Returns the font for calculating text measurements. """
return self._measuring_font | [
"def",
"GetMeasuringFont",
"(",
"self",
")",
":",
"return",
"self",
".",
"_measuring_font"
] | https://github.com/wxWidgets/wxPython-Classic/blob/19571e1ae65f1ac445f5491474121998c97a1bf0/wx/tools/Editra/src/extern/aui/tabart.py#L1588-L1591 | |
oracle/graaljs | 36a56e8e993d45fc40939a3a4d9c0c24990720f1 | graal-nodejs/tools/gyp/pylib/gyp/generator/msvs.py | python | _EscapeCommandLineArgumentForMSVS | (s) | return s | Escapes a Windows command-line argument.
So that the Win32 CommandLineToArgv function will turn the escaped result back
into the original string.
See http://msdn.microsoft.com/en-us/library/17w5ykft.aspx
("Parsing C++ Command-Line Arguments") to understand why we have to do
this.
Args:
s: the string... | Escapes a Windows command-line argument. | [
"Escapes",
"a",
"Windows",
"command",
"-",
"line",
"argument",
"."
] | def _EscapeCommandLineArgumentForMSVS(s):
"""Escapes a Windows command-line argument.
So that the Win32 CommandLineToArgv function will turn the escaped result back
into the original string.
See http://msdn.microsoft.com/en-us/library/17w5ykft.aspx
("Parsing C++ Command-Line Arguments") to understand why w... | [
"def",
"_EscapeCommandLineArgumentForMSVS",
"(",
"s",
")",
":",
"def",
"_Replace",
"(",
"match",
")",
":",
"# For a literal quote, CommandLineToArgv requires an odd number of",
"# backslashes preceding it, and it produces half as many literal backslashes",
"# (rounded down). So we need t... | https://github.com/oracle/graaljs/blob/36a56e8e993d45fc40939a3a4d9c0c24990720f1/graal-nodejs/tools/gyp/pylib/gyp/generator/msvs.py#L764-L789 | |
aws/lumberyard | f85344403c1c2e77ec8c75deb2c116e97b713217 | dev/Tools/Python/3.7.10/linux_x64/lib/python3.7/logging/__init__.py | python | LoggerAdapter.hasHandlers | (self) | return self.logger.hasHandlers() | See if the underlying logger has any handlers. | See if the underlying logger has any handlers. | [
"See",
"if",
"the",
"underlying",
"logger",
"has",
"any",
"handlers",
"."
] | def hasHandlers(self):
"""
See if the underlying logger has any handlers.
"""
return self.logger.hasHandlers() | [
"def",
"hasHandlers",
"(",
"self",
")",
":",
"return",
"self",
".",
"logger",
".",
"hasHandlers",
"(",
")"
] | https://github.com/aws/lumberyard/blob/f85344403c1c2e77ec8c75deb2c116e97b713217/dev/Tools/Python/3.7.10/linux_x64/lib/python3.7/logging/__init__.py#L1786-L1790 | |
catboost/catboost | 167f64f237114a4d10b2b4ee42adb4569137debe | contrib/python/parso/py3/parso/python/tree.py | python | WithStmt.get_defined_names | (self, include_setitem=False) | return names | Returns the a list of `Name` that the with statement defines. The
defined names are set after `as`. | Returns the a list of `Name` that the with statement defines. The
defined names are set after `as`. | [
"Returns",
"the",
"a",
"list",
"of",
"Name",
"that",
"the",
"with",
"statement",
"defines",
".",
"The",
"defined",
"names",
"are",
"set",
"after",
"as",
"."
] | def get_defined_names(self, include_setitem=False):
"""
Returns the a list of `Name` that the with statement defines. The
defined names are set after `as`.
"""
names = []
for with_item in self.children[1:-2:2]:
# Check with items for 'as' names.
if... | [
"def",
"get_defined_names",
"(",
"self",
",",
"include_setitem",
"=",
"False",
")",
":",
"names",
"=",
"[",
"]",
"for",
"with_item",
"in",
"self",
".",
"children",
"[",
"1",
":",
"-",
"2",
":",
"2",
"]",
":",
"# Check with items for 'as' names.",
"if",
"... | https://github.com/catboost/catboost/blob/167f64f237114a4d10b2b4ee42adb4569137debe/contrib/python/parso/py3/parso/python/tree.py#L773-L783 | |
catboost/catboost | 167f64f237114a4d10b2b4ee42adb4569137debe | contrib/python/scipy/scipy/stats/morestats.py | python | circvar | (samples, high=2*pi, low=0, axis=None) | return ((high - low)/2.0/pi)**2 * 2 * log(1/R) | Compute the circular variance for samples assumed to be in a range
Parameters
----------
samples : array_like
Input array.
low : float or int, optional
Low boundary for circular variance range. Default is 0.
high : float or int, optional
High boundary for circular variance ... | Compute the circular variance for samples assumed to be in a range | [
"Compute",
"the",
"circular",
"variance",
"for",
"samples",
"assumed",
"to",
"be",
"in",
"a",
"range"
] | def circvar(samples, high=2*pi, low=0, axis=None):
"""
Compute the circular variance for samples assumed to be in a range
Parameters
----------
samples : array_like
Input array.
low : float or int, optional
Low boundary for circular variance range. Default is 0.
high : floa... | [
"def",
"circvar",
"(",
"samples",
",",
"high",
"=",
"2",
"*",
"pi",
",",
"low",
"=",
"0",
",",
"axis",
"=",
"None",
")",
":",
"samples",
",",
"ang",
"=",
"_circfuncs_common",
"(",
"samples",
",",
"high",
",",
"low",
")",
"S",
"=",
"sin",
"(",
"... | https://github.com/catboost/catboost/blob/167f64f237114a4d10b2b4ee42adb4569137debe/contrib/python/scipy/scipy/stats/morestats.py#L2743-L2774 | |
aws/lumberyard | f85344403c1c2e77ec8c75deb2c116e97b713217 | dev/Tools/Python/3.7.10/mac/Python.framework/Versions/3.7/lib/python3.7/optparse.py | python | OptionParser.error | (self, msg) | error(msg : string)
Print a usage message incorporating 'msg' to stderr and exit.
If you override this in a subclass, it should not return -- it
should either exit or raise an exception. | error(msg : string) | [
"error",
"(",
"msg",
":",
"string",
")"
] | def error(self, msg):
"""error(msg : string)
Print a usage message incorporating 'msg' to stderr and exit.
If you override this in a subclass, it should not return -- it
should either exit or raise an exception.
"""
self.print_usage(sys.stderr)
self.exit(2, "%s: ... | [
"def",
"error",
"(",
"self",
",",
"msg",
")",
":",
"self",
".",
"print_usage",
"(",
"sys",
".",
"stderr",
")",
"self",
".",
"exit",
"(",
"2",
",",
"\"%s: error: %s\\n\"",
"%",
"(",
"self",
".",
"get_prog_name",
"(",
")",
",",
"msg",
")",
")"
] | https://github.com/aws/lumberyard/blob/f85344403c1c2e77ec8c75deb2c116e97b713217/dev/Tools/Python/3.7.10/mac/Python.framework/Versions/3.7/lib/python3.7/optparse.py#L1561-L1569 | ||
hanpfei/chromium-net | 392cc1fa3a8f92f42e4071ab6e674d8e0482f83f | third_party/catapult/third_party/gsutil/third_party/boto/boto/ec2/instance.py | python | Instance.update | (self, validate=False, dry_run=False) | return self.state | Update the instance's state information by making a call to fetch
the current instance attributes from the service.
:type validate: bool
:param validate: By default, if EC2 returns no data about the
instance the update method returns quietly. If
... | Update the instance's state information by making a call to fetch
the current instance attributes from the service. | [
"Update",
"the",
"instance",
"s",
"state",
"information",
"by",
"making",
"a",
"call",
"to",
"fetch",
"the",
"current",
"instance",
"attributes",
"from",
"the",
"service",
"."
] | def update(self, validate=False, dry_run=False):
"""
Update the instance's state information by making a call to fetch
the current instance attributes from the service.
:type validate: bool
:param validate: By default, if EC2 returns no data about the
in... | [
"def",
"update",
"(",
"self",
",",
"validate",
"=",
"False",
",",
"dry_run",
"=",
"False",
")",
":",
"rs",
"=",
"self",
".",
"connection",
".",
"get_all_reservations",
"(",
"[",
"self",
".",
"id",
"]",
",",
"dry_run",
"=",
"dry_run",
")",
"if",
"len"... | https://github.com/hanpfei/chromium-net/blob/392cc1fa3a8f92f42e4071ab6e674d8e0482f83f/third_party/catapult/third_party/gsutil/third_party/boto/boto/ec2/instance.py#L401-L421 | |
ApolloAuto/apollo-platform | 86d9dc6743b496ead18d597748ebabd34a513289 | ros/third_party/lib_x86_64/python2.7/dist-packages/yaml/__init__.py | python | compose | (stream, Loader=Loader) | Parse the first YAML document in a stream
and produce the corresponding representation tree. | Parse the first YAML document in a stream
and produce the corresponding representation tree. | [
"Parse",
"the",
"first",
"YAML",
"document",
"in",
"a",
"stream",
"and",
"produce",
"the",
"corresponding",
"representation",
"tree",
"."
] | def compose(stream, Loader=Loader):
"""
Parse the first YAML document in a stream
and produce the corresponding representation tree.
"""
loader = Loader(stream)
try:
return loader.get_single_node()
finally:
loader.dispose() | [
"def",
"compose",
"(",
"stream",
",",
"Loader",
"=",
"Loader",
")",
":",
"loader",
"=",
"Loader",
"(",
"stream",
")",
"try",
":",
"return",
"loader",
".",
"get_single_node",
"(",
")",
"finally",
":",
"loader",
".",
"dispose",
"(",
")"
] | https://github.com/ApolloAuto/apollo-platform/blob/86d9dc6743b496ead18d597748ebabd34a513289/ros/third_party/lib_x86_64/python2.7/dist-packages/yaml/__init__.py#L41-L50 | ||
PlatformLab/RAMCloud | b1866af19124325a6dfd8cbc267e2e3ef1f965d1 | scripts/colorize.py | python | stripPaths | (line) | return ' '.join([stripWord(word) for word in line.split()]) | Kill all prefixesToStrip from a line | Kill all prefixesToStrip from a line | [
"Kill",
"all",
"prefixesToStrip",
"from",
"a",
"line"
] | def stripPaths(line):
"""Kill all prefixesToStrip from a line"""
def stripWord(word):
for prefix in prefixesToStrip:
if word.startswith(prefix):
return word[len(prefix):]
return word
return ' '.join([stripWord(word) for word in line.split()]) | [
"def",
"stripPaths",
"(",
"line",
")",
":",
"def",
"stripWord",
"(",
"word",
")",
":",
"for",
"prefix",
"in",
"prefixesToStrip",
":",
"if",
"word",
".",
"startswith",
"(",
"prefix",
")",
":",
"return",
"word",
"[",
"len",
"(",
"prefix",
")",
":",
"]"... | https://github.com/PlatformLab/RAMCloud/blob/b1866af19124325a6dfd8cbc267e2e3ef1f965d1/scripts/colorize.py#L81-L88 | |
swift/swift | 12d031cf8177fdec0137f9aa7e2912fa23c4416b | 3rdParty/SCons/scons-3.0.1/engine/SCons/Platform/win32.py | python | get_architecture | (arch=None) | return SupportedArchitectureMap.get(arch, ArchDefinition('', [''])) | Returns the definition for the specified architecture string.
If no string is specified, the system default is returned (as defined
by the PROCESSOR_ARCHITEW6432 or PROCESSOR_ARCHITECTURE environment
variables). | Returns the definition for the specified architecture string. | [
"Returns",
"the",
"definition",
"for",
"the",
"specified",
"architecture",
"string",
"."
] | def get_architecture(arch=None):
"""Returns the definition for the specified architecture string.
If no string is specified, the system default is returned (as defined
by the PROCESSOR_ARCHITEW6432 or PROCESSOR_ARCHITECTURE environment
variables).
"""
if arch is None:
arch = os.environ.... | [
"def",
"get_architecture",
"(",
"arch",
"=",
"None",
")",
":",
"if",
"arch",
"is",
"None",
":",
"arch",
"=",
"os",
".",
"environ",
".",
"get",
"(",
"'PROCESSOR_ARCHITEW6432'",
")",
"if",
"not",
"arch",
":",
"arch",
"=",
"os",
".",
"environ",
".",
"ge... | https://github.com/swift/swift/blob/12d031cf8177fdec0137f9aa7e2912fa23c4416b/3rdParty/SCons/scons-3.0.1/engine/SCons/Platform/win32.py#L358-L369 | |
catboost/catboost | 167f64f237114a4d10b2b4ee42adb4569137debe | contrib/python/scipy/py3/scipy/spatial/kdtree.py | python | Rectangle.min_distance_point | (self, x, p=2.) | return minkowski_distance(0, np.maximum(0,np.maximum(self.mins-x,x-self.maxes)),p) | Return the minimum distance between input and points in the hyperrectangle.
Parameters
----------
x : array_like
Input.
p : float, optional
Input. | Return the minimum distance between input and points in the hyperrectangle. | [
"Return",
"the",
"minimum",
"distance",
"between",
"input",
"and",
"points",
"in",
"the",
"hyperrectangle",
"."
] | def min_distance_point(self, x, p=2.):
"""
Return the minimum distance between input and points in the hyperrectangle.
Parameters
----------
x : array_like
Input.
p : float, optional
Input.
"""
return minkowski_distance(0, np.maxi... | [
"def",
"min_distance_point",
"(",
"self",
",",
"x",
",",
"p",
"=",
"2.",
")",
":",
"return",
"minkowski_distance",
"(",
"0",
",",
"np",
".",
"maximum",
"(",
"0",
",",
"np",
".",
"maximum",
"(",
"self",
".",
"mins",
"-",
"x",
",",
"x",
"-",
"self"... | https://github.com/catboost/catboost/blob/167f64f237114a4d10b2b4ee42adb4569137debe/contrib/python/scipy/py3/scipy/spatial/kdtree.py#L119-L131 | |
catboost/catboost | 167f64f237114a4d10b2b4ee42adb4569137debe | contrib/python/scikit-learn/py3/sklearn/metrics/pairwise.py | python | _euclidean_distances_upcast | (X, XX=None, Y=None, YY=None, batch_size=None) | return distances | Euclidean distances between X and Y
Assumes X and Y have float32 dtype.
Assumes XX and YY have float64 dtype or are None.
X and Y are upcast to float64 by chunks, which size is chosen to limit
memory increase by approximately 10% (at least 10MiB). | Euclidean distances between X and Y | [
"Euclidean",
"distances",
"between",
"X",
"and",
"Y"
] | def _euclidean_distances_upcast(X, XX=None, Y=None, YY=None, batch_size=None):
"""Euclidean distances between X and Y
Assumes X and Y have float32 dtype.
Assumes XX and YY have float64 dtype or are None.
X and Y are upcast to float64 by chunks, which size is chosen to limit
memory increase by appr... | [
"def",
"_euclidean_distances_upcast",
"(",
"X",
",",
"XX",
"=",
"None",
",",
"Y",
"=",
"None",
",",
"YY",
"=",
"None",
",",
"batch_size",
"=",
"None",
")",
":",
"n_samples_X",
"=",
"X",
".",
"shape",
"[",
"0",
"]",
"n_samples_Y",
"=",
"Y",
".",
"sh... | https://github.com/catboost/catboost/blob/167f64f237114a4d10b2b4ee42adb4569137debe/contrib/python/scikit-learn/py3/sklearn/metrics/pairwise.py#L431-L497 | |
wlanjie/AndroidFFmpeg | 7baf9122f4b8e1c74e7baf4be5c422c7a5ba5aaf | tools/fdk-aac-build/x86/toolchain/lib/python2.7/CGIHTTPServer.py | python | _url_collapse_path | (path) | return collapsed_path | Given a URL path, remove extra '/'s and '.' path elements and collapse
any '..' references and returns a colllapsed path.
Implements something akin to RFC-2396 5.2 step 6 to parse relative paths.
The utility of this function is limited to is_cgi method and helps
preventing some security attacks.
R... | Given a URL path, remove extra '/'s and '.' path elements and collapse
any '..' references and returns a colllapsed path. | [
"Given",
"a",
"URL",
"path",
"remove",
"extra",
"/",
"s",
"and",
".",
"path",
"elements",
"and",
"collapse",
"any",
"..",
"references",
"and",
"returns",
"a",
"colllapsed",
"path",
"."
] | def _url_collapse_path(path):
"""
Given a URL path, remove extra '/'s and '.' path elements and collapse
any '..' references and returns a colllapsed path.
Implements something akin to RFC-2396 5.2 step 6 to parse relative paths.
The utility of this function is limited to is_cgi method and helps
... | [
"def",
"_url_collapse_path",
"(",
"path",
")",
":",
"# Similar to os.path.split(os.path.normpath(path)) but specific to URL",
"# path semantics rather than local operating system semantics.",
"path_parts",
"=",
"path",
".",
"split",
"(",
"'/'",
")",
"head_parts",
"=",
"[",
"]",... | https://github.com/wlanjie/AndroidFFmpeg/blob/7baf9122f4b8e1c74e7baf4be5c422c7a5ba5aaf/tools/fdk-aac-build/x86/toolchain/lib/python2.7/CGIHTTPServer.py#L303-L342 | |
catboost/catboost | 167f64f237114a4d10b2b4ee42adb4569137debe | contrib/tools/python3/src/Lib/threading.py | python | Thread.ident | (self) | return self._ident | Thread identifier of this thread or None if it has not been started.
This is a nonzero integer. See the get_ident() function. Thread
identifiers may be recycled when a thread exits and another thread is
created. The identifier is available even after the thread has exited. | Thread identifier of this thread or None if it has not been started. | [
"Thread",
"identifier",
"of",
"this",
"thread",
"or",
"None",
"if",
"it",
"has",
"not",
"been",
"started",
"."
] | def ident(self):
"""Thread identifier of this thread or None if it has not been started.
This is a nonzero integer. See the get_ident() function. Thread
identifiers may be recycled when a thread exits and another thread is
created. The identifier is available even after the thread has e... | [
"def",
"ident",
"(",
"self",
")",
":",
"assert",
"self",
".",
"_initialized",
",",
"\"Thread.__init__() not called\"",
"return",
"self",
".",
"_ident"
] | https://github.com/catboost/catboost/blob/167f64f237114a4d10b2b4ee42adb4569137debe/contrib/tools/python3/src/Lib/threading.py#L1103-L1112 | |
miyosuda/TensorFlowAndroidMNIST | 7b5a4603d2780a8a2834575706e9001977524007 | jni-build/jni/include/tensorflow/contrib/metrics/python/ops/histogram_ops.py | python | _strict_1d_cumsum | (tensor, len_tensor) | Cumsum of a 1D tensor with defined shape by padding and convolving. | Cumsum of a 1D tensor with defined shape by padding and convolving. | [
"Cumsum",
"of",
"a",
"1D",
"tensor",
"with",
"defined",
"shape",
"by",
"padding",
"and",
"convolving",
"."
] | def _strict_1d_cumsum(tensor, len_tensor):
"""Cumsum of a 1D tensor with defined shape by padding and convolving."""
# Assumes tensor shape is fully defined.
with ops.op_scope([tensor], 'strict_1d_cumsum'):
if len_tensor == 0:
return constant_op.constant([])
len_pad = len_tensor - 1
x = array_op... | [
"def",
"_strict_1d_cumsum",
"(",
"tensor",
",",
"len_tensor",
")",
":",
"# Assumes tensor shape is fully defined.",
"with",
"ops",
".",
"op_scope",
"(",
"[",
"tensor",
"]",
",",
"'strict_1d_cumsum'",
")",
":",
"if",
"len_tensor",
"==",
"0",
":",
"return",
"const... | https://github.com/miyosuda/TensorFlowAndroidMNIST/blob/7b5a4603d2780a8a2834575706e9001977524007/jni-build/jni/include/tensorflow/contrib/metrics/python/ops/histogram_ops.py#L222-L231 | ||
tensorflow/tensorflow | 419e3a6b650ea4bd1b0cba23c4348f8a69f3272e | tensorflow/python/tools/saved_model_aot_compile.py | python | _parse_tensor_name | (name) | Convert a tensor name like 'tensor:0' into a tuple ('tensor', 0). | Convert a tensor name like 'tensor:0' into a tuple ('tensor', 0). | [
"Convert",
"a",
"tensor",
"name",
"like",
"tensor",
":",
"0",
"into",
"a",
"tuple",
"(",
"tensor",
"0",
")",
"."
] | def _parse_tensor_name(name):
"""Convert a tensor name like 'tensor:0' into a tuple ('tensor', 0)."""
if ':' in name and not name.endswith(':'):
node_name = name[:name.rfind(':')]
output_slot = int(name[name.rfind(':') + 1:])
return node_name, output_slot
else:
return name, None | [
"def",
"_parse_tensor_name",
"(",
"name",
")",
":",
"if",
"':'",
"in",
"name",
"and",
"not",
"name",
".",
"endswith",
"(",
"':'",
")",
":",
"node_name",
"=",
"name",
"[",
":",
"name",
".",
"rfind",
"(",
"':'",
")",
"]",
"output_slot",
"=",
"int",
"... | https://github.com/tensorflow/tensorflow/blob/419e3a6b650ea4bd1b0cba23c4348f8a69f3272e/tensorflow/python/tools/saved_model_aot_compile.py#L76-L83 | ||
opengauss-mirror/openGauss-server | e383f1b77720a00ddbe4c0655bc85914d9b02a2b | src/gausskernel/dbmind/tools/ai_manager/tools/params_checkers.py | python | LostChecker._check_server | (server_info) | Check server info of config
:param server_info:
:return: | Check server info of config
:param server_info:
:return: | [
"Check",
"server",
"info",
"of",
"config",
":",
"param",
"server_info",
":",
":",
"return",
":"
] | def _check_server(server_info):
"""
Check server info of config
:param server_info:
:return:
"""
host = server_info.get(Constant.SERVER_HOST)
listen_host = server_info.get(Constant.SERVER_LISTEN_HOST)
listen_port = server_info.get(Constant.SERVER_LISTEN_PO... | [
"def",
"_check_server",
"(",
"server_info",
")",
":",
"host",
"=",
"server_info",
".",
"get",
"(",
"Constant",
".",
"SERVER_HOST",
")",
"listen_host",
"=",
"server_info",
".",
"get",
"(",
"Constant",
".",
"SERVER_LISTEN_HOST",
")",
"listen_port",
"=",
"server_... | https://github.com/opengauss-mirror/openGauss-server/blob/e383f1b77720a00ddbe4c0655bc85914d9b02a2b/src/gausskernel/dbmind/tools/ai_manager/tools/params_checkers.py#L397-L410 | ||
ricardoquesada/Spidermonkey | 4a75ea2543408bd1b2c515aa95901523eeef7858 | python/mozbuild/mozbuild/preprocessor.py | python | Preprocessor.processFile | (self, input, output, depfile=None) | Preprocesses the contents of the ``input`` stream and writes the result
to the ``output`` stream. If ``depfile`` is set, the dependencies of
``output`` file are written to ``depfile`` in Makefile format. | Preprocesses the contents of the ``input`` stream and writes the result
to the ``output`` stream. If ``depfile`` is set, the dependencies of
``output`` file are written to ``depfile`` in Makefile format. | [
"Preprocesses",
"the",
"contents",
"of",
"the",
"input",
"stream",
"and",
"writes",
"the",
"result",
"to",
"the",
"output",
"stream",
".",
"If",
"depfile",
"is",
"set",
"the",
"dependencies",
"of",
"output",
"file",
"are",
"written",
"to",
"depfile",
"in",
... | def processFile(self, input, output, depfile=None):
"""
Preprocesses the contents of the ``input`` stream and writes the result
to the ``output`` stream. If ``depfile`` is set, the dependencies of
``output`` file are written to ``depfile`` in Makefile format.
"""
self.ou... | [
"def",
"processFile",
"(",
"self",
",",
"input",
",",
"output",
",",
"depfile",
"=",
"None",
")",
":",
"self",
".",
"out",
"=",
"output",
"self",
".",
"do_include",
"(",
"input",
",",
"False",
")",
"self",
".",
"warnUnused",
"(",
"input",
".",
"name"... | https://github.com/ricardoquesada/Spidermonkey/blob/4a75ea2543408bd1b2c515aa95901523eeef7858/python/mozbuild/mozbuild/preprocessor.py#L372-L386 | ||
mlpack/mlpack | cf190e11f2109de4d4d8694aad5dd07850f04a82 | src/mlpack/bindings/python/mlpack/preprocess_json_params.py | python | process_params_out | (model, params, return_str=False) | This method processes the parameters obtained from the model.
params:
1) model - the model to process params.
2) params - json parameters of the model (which we get through cereal).
3) return_str (bool) - if True then a pretty string version of the
params is returned. | This method processes the parameters obtained from the model. | [
"This",
"method",
"processes",
"the",
"parameters",
"obtained",
"from",
"the",
"model",
"."
] | def process_params_out(model, params, return_str=False):
'''
This method processes the parameters obtained from the model.
params:
1) model - the model to process params.
2) params - json parameters of the model (which we get through cereal).
3) return_str (bool) - if True then a pretty string version of t... | [
"def",
"process_params_out",
"(",
"model",
",",
"params",
",",
"return_str",
"=",
"False",
")",
":",
"# for pretty printing.",
"pp",
"=",
"pprint",
".",
"PrettyPrinter",
"(",
")",
"# value_resolver defined later.",
"params_dic",
"=",
"json",
".",
"loads",
"(",
"... | https://github.com/mlpack/mlpack/blob/cf190e11f2109de4d4d8694aad5dd07850f04a82/src/mlpack/bindings/python/mlpack/preprocess_json_params.py#L21-L61 | ||
CaoWGG/TensorRT-YOLOv4 | 4d7c2edce99e8794a4cb4ea3540d51ce91158a36 | onnx-tensorrt/third_party/onnx/third_party/benchmark/tools/gbench/report.py | python | filter_benchmark | (json_orig, family, replacement="") | return filtered | Apply a filter to the json, and only leave the 'family' of benchmarks. | Apply a filter to the json, and only leave the 'family' of benchmarks. | [
"Apply",
"a",
"filter",
"to",
"the",
"json",
"and",
"only",
"leave",
"the",
"family",
"of",
"benchmarks",
"."
] | def filter_benchmark(json_orig, family, replacement=""):
"""
Apply a filter to the json, and only leave the 'family' of benchmarks.
"""
regex = re.compile(family)
filtered = {}
filtered['benchmarks'] = []
for be in json_orig['benchmarks']:
if not regex.search(be['name']):
... | [
"def",
"filter_benchmark",
"(",
"json_orig",
",",
"family",
",",
"replacement",
"=",
"\"\"",
")",
":",
"regex",
"=",
"re",
".",
"compile",
"(",
"family",
")",
"filtered",
"=",
"{",
"}",
"filtered",
"[",
"'benchmarks'",
"]",
"=",
"[",
"]",
"for",
"be",
... | https://github.com/CaoWGG/TensorRT-YOLOv4/blob/4d7c2edce99e8794a4cb4ea3540d51ce91158a36/onnx-tensorrt/third_party/onnx/third_party/benchmark/tools/gbench/report.py#L71-L84 | |
miyosuda/TensorFlowAndroidMNIST | 7b5a4603d2780a8a2834575706e9001977524007 | jni-build/jni/include/tensorflow/tensorboard/backend/server.py | python | ParseEventFilesSpec | (logdir) | return files | Parses `logdir` into a map from paths to run group names.
The events files flag format is a comma-separated list of path specifications.
A path specification either looks like 'group_name:/path/to/directory' or
'/path/to/directory'; in the latter case, the group is unnamed. Group names
cannot start with a forw... | Parses `logdir` into a map from paths to run group names. | [
"Parses",
"logdir",
"into",
"a",
"map",
"from",
"paths",
"to",
"run",
"group",
"names",
"."
] | def ParseEventFilesSpec(logdir):
"""Parses `logdir` into a map from paths to run group names.
The events files flag format is a comma-separated list of path specifications.
A path specification either looks like 'group_name:/path/to/directory' or
'/path/to/directory'; in the latter case, the group is unnamed. ... | [
"def",
"ParseEventFilesSpec",
"(",
"logdir",
")",
":",
"files",
"=",
"{",
"}",
"if",
"logdir",
"is",
"None",
":",
"return",
"files",
"for",
"specification",
"in",
"logdir",
".",
"split",
"(",
"','",
")",
":",
"# If it's a gcs path, don't split on colon",
"if",... | https://github.com/miyosuda/TensorFlowAndroidMNIST/blob/7b5a4603d2780a8a2834575706e9001977524007/jni-build/jni/include/tensorflow/tensorboard/backend/server.py#L48-L86 | |
hanpfei/chromium-net | 392cc1fa3a8f92f42e4071ab6e674d8e0482f83f | third_party/catapult/experimental/statistical_analysis/results_stats.py | python | DoesChartJSONContainPageset | (benchmark_result_json) | return len(arbitrary_metric_in_charts) > 2 | Checks if given Chart JSON contains results for a pageset.
A metric in a benchmark NOT containing a pageset contains only two elements
("Only_page_in_this_benchmark" and "Summary", as opposed to "Ex_page_1",
"Ex_page_2", ..., and "Summary"). | Checks if given Chart JSON contains results for a pageset. | [
"Checks",
"if",
"given",
"Chart",
"JSON",
"contains",
"results",
"for",
"a",
"pageset",
"."
] | def DoesChartJSONContainPageset(benchmark_result_json):
"""Checks if given Chart JSON contains results for a pageset.
A metric in a benchmark NOT containing a pageset contains only two elements
("Only_page_in_this_benchmark" and "Summary", as opposed to "Ex_page_1",
"Ex_page_2", ..., and "Summary").
"""
ch... | [
"def",
"DoesChartJSONContainPageset",
"(",
"benchmark_result_json",
")",
":",
"charts",
"=",
"GetChartsFromBenchmarkResultJson",
"(",
"benchmark_result_json",
")",
"arbitrary_metric_in_charts",
"=",
"charts",
".",
"itervalues",
"(",
")",
".",
"next",
"(",
")",
"return",... | https://github.com/hanpfei/chromium-net/blob/392cc1fa3a8f92f42e4071ab6e674d8e0482f83f/third_party/catapult/experimental/statistical_analysis/results_stats.py#L94-L104 | |
moflow/moflow | 2dfb27c799c90c6caf1477508eca3eec616ef7d2 | bap/libtracewrap/libtrace/protobuf/python/google/protobuf/internal/cpp_message.py | python | _AddDescriptors | (message_descriptor, dictionary) | Sets up a new protocol message class dictionary.
Args:
message_descriptor: A Descriptor instance describing this message type.
dictionary: Class dictionary to which we'll add a '__slots__' entry. | Sets up a new protocol message class dictionary. | [
"Sets",
"up",
"a",
"new",
"protocol",
"message",
"class",
"dictionary",
"."
] | def _AddDescriptors(message_descriptor, dictionary):
"""Sets up a new protocol message class dictionary.
Args:
message_descriptor: A Descriptor instance describing this message type.
dictionary: Class dictionary to which we'll add a '__slots__' entry.
"""
dictionary['__descriptors'] = {}
for field in... | [
"def",
"_AddDescriptors",
"(",
"message_descriptor",
",",
"dictionary",
")",
":",
"dictionary",
"[",
"'__descriptors'",
"]",
"=",
"{",
"}",
"for",
"field",
"in",
"message_descriptor",
".",
"fields",
":",
"dictionary",
"[",
"'__descriptors'",
"]",
"[",
"field",
... | https://github.com/moflow/moflow/blob/2dfb27c799c90c6caf1477508eca3eec616ef7d2/bap/libtracewrap/libtrace/protobuf/python/google/protobuf/internal/cpp_message.py#L391-L404 | ||
catboost/catboost | 167f64f237114a4d10b2b4ee42adb4569137debe | contrib/tools/python3/src/Lib/distutils/command/install.py | python | install.initialize_options | (self) | Initializes options. | Initializes options. | [
"Initializes",
"options",
"."
] | def initialize_options(self):
"""Initializes options."""
# High-level options: these select both an installation base
# and scheme.
self.prefix = None
self.exec_prefix = None
self.home = None
self.user = 0
# These select only the installation base; it's u... | [
"def",
"initialize_options",
"(",
"self",
")",
":",
"# High-level options: these select both an installation base",
"# and scheme.",
"self",
".",
"prefix",
"=",
"None",
"self",
".",
"exec_prefix",
"=",
"None",
"self",
".",
"home",
"=",
"None",
"self",
".",
"user",
... | https://github.com/catboost/catboost/blob/167f64f237114a4d10b2b4ee42adb4569137debe/contrib/tools/python3/src/Lib/distutils/command/install.py#L146-L215 | ||
pmq20/node-packer | 12c46c6e44fbc14d9ee645ebd17d5296b324f7e0 | current/deps/v8/tools/stats-viewer.py | python | CounterCollection.Counter | (self, index) | return Counter(self.data, 16 + index * self.CounterSize()) | Return the index'th counter. | Return the index'th counter. | [
"Return",
"the",
"index",
"th",
"counter",
"."
] | def Counter(self, index):
"""Return the index'th counter."""
return Counter(self.data, 16 + index * self.CounterSize()) | [
"def",
"Counter",
"(",
"self",
",",
"index",
")",
":",
"return",
"Counter",
"(",
"self",
".",
"data",
",",
"16",
"+",
"index",
"*",
"self",
".",
"CounterSize",
"(",
")",
")"
] | https://github.com/pmq20/node-packer/blob/12c46c6e44fbc14d9ee645ebd17d5296b324f7e0/current/deps/v8/tools/stats-viewer.py#L377-L379 | |
ZintrulCre/LeetCode_Archiver | de23e16ead29336b5ee7aa1898a392a5d6463d27 | LeetCode/python3/448.py | python | Solution.findDisappearedNumbers | (self, nums) | return list(set(range(1, len(nums) + 1)) - set(nums)) | :type nums: List[int]
:rtype: List[int] | :type nums: List[int]
:rtype: List[int] | [
":",
"type",
"nums",
":",
"List",
"[",
"int",
"]",
":",
"rtype",
":",
"List",
"[",
"int",
"]"
] | def findDisappearedNumbers(self, nums):
"""
:type nums: List[int]
:rtype: List[int]
"""
return list(set(range(1, len(nums) + 1)) - set(nums)) | [
"def",
"findDisappearedNumbers",
"(",
"self",
",",
"nums",
")",
":",
"return",
"list",
"(",
"set",
"(",
"range",
"(",
"1",
",",
"len",
"(",
"nums",
")",
"+",
"1",
")",
")",
"-",
"set",
"(",
"nums",
")",
")"
] | https://github.com/ZintrulCre/LeetCode_Archiver/blob/de23e16ead29336b5ee7aa1898a392a5d6463d27/LeetCode/python3/448.py#L2-L7 | |
hanpfei/chromium-net | 392cc1fa3a8f92f42e4071ab6e674d8e0482f83f | third_party/catapult/third_party/gsutil/third_party/protorpc/protorpc/messages.py | python | Enum.__cmp__ | (self, other) | return NotImplemented | Order is by number. | Order is by number. | [
"Order",
"is",
"by",
"number",
"."
] | def __cmp__(self, other):
"""Order is by number."""
if isinstance(other, type(self)):
return cmp(self.number, other.number)
return NotImplemented | [
"def",
"__cmp__",
"(",
"self",
",",
"other",
")",
":",
"if",
"isinstance",
"(",
"other",
",",
"type",
"(",
"self",
")",
")",
":",
"return",
"cmp",
"(",
"self",
".",
"number",
",",
"other",
".",
"number",
")",
"return",
"NotImplemented"
] | https://github.com/hanpfei/chromium-net/blob/392cc1fa3a8f92f42e4071ab6e674d8e0482f83f/third_party/catapult/third_party/gsutil/third_party/protorpc/protorpc/messages.py#L474-L478 | |
stan-dev/math | 5fd79f89933269a4ca4d8dd1fde2a36d53d4768c | lib/cpplint_1.4.5/cpplint.py | python | IsCppString | (line) | return ((line.count('"') - line.count(r'\"') - line.count("'\"'")) & 1) == 1 | Does line terminate so, that the next symbol is in string constant.
This function does not consider single-line nor multi-line comments.
Args:
line: is a partial line of code starting from the 0..n.
Returns:
True, if next character appended to 'line' is inside a
string constant. | Does line terminate so, that the next symbol is in string constant. | [
"Does",
"line",
"terminate",
"so",
"that",
"the",
"next",
"symbol",
"is",
"in",
"string",
"constant",
"."
] | def IsCppString(line):
"""Does line terminate so, that the next symbol is in string constant.
This function does not consider single-line nor multi-line comments.
Args:
line: is a partial line of code starting from the 0..n.
Returns:
True, if next character appended to 'line' is inside a
string c... | [
"def",
"IsCppString",
"(",
"line",
")",
":",
"line",
"=",
"line",
".",
"replace",
"(",
"r'\\\\'",
",",
"'XX'",
")",
"# after this, \\\\\" does not match to \\\"",
"return",
"(",
"(",
"line",
".",
"count",
"(",
"'\"'",
")",
"-",
"line",
".",
"count",
"(",
... | https://github.com/stan-dev/math/blob/5fd79f89933269a4ca4d8dd1fde2a36d53d4768c/lib/cpplint_1.4.5/cpplint.py#L1496-L1510 | |
wxWidgets/wxPython-Classic | 19571e1ae65f1ac445f5491474121998c97a1bf0 | wx/tools/Editra/scripts/i18n/mki18n.py | python | fileBaseOf | (filename, withPath=0) | fileBaseOf(filename,withPath) ---> string
Return base name of filename. The returned string never includes the
extension.
Use os.path.basename() to return the basename with the extension. The
second argument is optional. If specified and if set to 'true' (non zero)
the string returned contains ... | fileBaseOf(filename,withPath) ---> string | [
"fileBaseOf",
"(",
"filename",
"withPath",
")",
"---",
">",
"string"
] | def fileBaseOf(filename, withPath=0) :
"""fileBaseOf(filename,withPath) ---> string
Return base name of filename. The returned string never includes the
extension.
Use os.path.basename() to return the basename with the extension. The
second argument is optional. If specified and if set to 'true... | [
"def",
"fileBaseOf",
"(",
"filename",
",",
"withPath",
"=",
"0",
")",
":",
"pos",
"=",
"filename",
".",
"rfind",
"(",
"'.'",
")",
"if",
"pos",
">",
"0",
":",
"filename",
"=",
"filename",
"[",
":",
"pos",
"]",
"if",
"withPath",
":",
"return",
"filen... | https://github.com/wxWidgets/wxPython-Classic/blob/19571e1ae65f1ac445f5491474121998c97a1bf0/wx/tools/Editra/scripts/i18n/mki18n.py#L320-L357 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.