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 |
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
windystrife/UnrealEngine_NVIDIAGameWorks | b50e6338a7c5b26374d66306ebc7807541ff815e | Engine/Extras/ThirdPartyNotUE/emsdk/Win64/python/2.7.5.3_64bit/Lib/site-packages/pip/vendor/distlib/locators.py | python | PyPIRPCLocator.__init__ | (self, url, **kwargs) | Initialise an instance.
:param url: The URL to use for XML-RPC.
:param kwargs: Passed to the superclass constructor. | Initialise an instance. | [
"Initialise",
"an",
"instance",
"."
] | def __init__(self, url, **kwargs):
"""
Initialise an instance.
:param url: The URL to use for XML-RPC.
:param kwargs: Passed to the superclass constructor.
"""
super(PyPIRPCLocator, self).__init__(**kwargs)
self.base_url = url
self.client = ServerProxy(ur... | [
"def",
"__init__",
"(",
"self",
",",
"url",
",",
"*",
"*",
"kwargs",
")",
":",
"super",
"(",
"PyPIRPCLocator",
",",
"self",
")",
".",
"__init__",
"(",
"*",
"*",
"kwargs",
")",
"self",
".",
"base_url",
"=",
"url",
"self",
".",
"client",
"=",
"Server... | https://github.com/windystrife/UnrealEngine_NVIDIAGameWorks/blob/b50e6338a7c5b26374d66306ebc7807541ff815e/Engine/Extras/ThirdPartyNotUE/emsdk/Win64/python/2.7.5.3_64bit/Lib/site-packages/pip/vendor/distlib/locators.py#L344-L353 | ||
wxWidgets/wxPython-Classic | 19571e1ae65f1ac445f5491474121998c97a1bf0 | wx/lib/agw/floatspin.py | python | FloatSpin.__init__ | (self, parent, id=wx.ID_ANY, pos=wx.DefaultPosition,
size=(95,-1), style=0, value=0.0, min_val=None, max_val=None,
increment=1.0, digits=-1, agwStyle=FS_LEFT,
name="FloatSpin") | Default class constructor.
:param `parent`: the :class:`FloatSpin` parent;
:param `id`: an identifier for the control: a value of -1 is taken to mean a default;
:param `pos`: the control position. A value of (-1, -1) indicates a default position,
chosen by either the windowing system o... | Default class constructor. | [
"Default",
"class",
"constructor",
"."
] | def __init__(self, parent, id=wx.ID_ANY, pos=wx.DefaultPosition,
size=(95,-1), style=0, value=0.0, min_val=None, max_val=None,
increment=1.0, digits=-1, agwStyle=FS_LEFT,
name="FloatSpin"):
"""
Default class constructor.
:param `parent`: the :c... | [
"def",
"__init__",
"(",
"self",
",",
"parent",
",",
"id",
"=",
"wx",
".",
"ID_ANY",
",",
"pos",
"=",
"wx",
".",
"DefaultPosition",
",",
"size",
"=",
"(",
"95",
",",
"-",
"1",
")",
",",
"style",
"=",
"0",
",",
"value",
"=",
"0.0",
",",
"min_val"... | https://github.com/wxWidgets/wxPython-Classic/blob/19571e1ae65f1ac445f5491474121998c97a1bf0/wx/lib/agw/floatspin.py#L332-L495 | ||
natanielruiz/android-yolo | 1ebb54f96a67a20ff83ddfc823ed83a13dc3a47f | jni-build/jni/include/tensorflow/python/ops/tensor_array_grad.py | python | _TensorArrayReadGrad | (op, grad) | return [None, None, w_g.flow] | Gradient for TensorArrayRead.
Args:
op: Forward TensorArrayRead op.
grad: Gradient `Tensor` to TensorArrayRead.
Returns:
A flow `Tensor`, which can be used in control dependencies to
force the write of `grad` to the gradient `TensorArray`. | Gradient for TensorArrayRead. | [
"Gradient",
"for",
"TensorArrayRead",
"."
] | def _TensorArrayReadGrad(op, grad):
"""Gradient for TensorArrayRead.
Args:
op: Forward TensorArrayRead op.
grad: Gradient `Tensor` to TensorArrayRead.
Returns:
A flow `Tensor`, which can be used in control dependencies to
force the write of `grad` to the gradient `TensorArray`.
"""
# Note: t... | [
"def",
"_TensorArrayReadGrad",
"(",
"op",
",",
"grad",
")",
":",
"# Note: the forward flow dependency in the call to grad() is necessary for",
"# the case of dynamic sized TensorArrays. When creating the gradient",
"# TensorArray, the final size of the forward array must be known.",
"# For th... | https://github.com/natanielruiz/android-yolo/blob/1ebb54f96a67a20ff83ddfc823ed83a13dc3a47f/jni-build/jni/include/tensorflow/python/ops/tensor_array_grad.py#L69-L93 | |
stan-dev/math | 5fd79f89933269a4ca4d8dd1fde2a36d53d4768c | runChecks.py | python | grep_patterns | (type, folder, patterns_and_messages, exclude_filters=[]) | return errors | Checks the files in the provided folder for matches
with any of the patterns. It returns an array of
messages and the provided type with
the line number. This check ignores comments.
@param type: type or group of the check, listed with the error
@param folder: folder in which to check for the patter... | Checks the files in the provided folder for matches
with any of the patterns. It returns an array of
messages and the provided type with
the line number. This check ignores comments. | [
"Checks",
"the",
"files",
"in",
"the",
"provided",
"folder",
"for",
"matches",
"with",
"any",
"of",
"the",
"patterns",
".",
"It",
"returns",
"an",
"array",
"of",
"messages",
"and",
"the",
"provided",
"type",
"with",
"the",
"line",
"number",
".",
"This",
... | def grep_patterns(type, folder, patterns_and_messages, exclude_filters=[]):
"""Checks the files in the provided folder for matches
with any of the patterns. It returns an array of
messages and the provided type with
the line number. This check ignores comments.
@param type: type or group of the chec... | [
"def",
"grep_patterns",
"(",
"type",
",",
"folder",
",",
"patterns_and_messages",
",",
"exclude_filters",
"=",
"[",
"]",
")",
":",
"errors",
"=",
"[",
"]",
"folder",
".",
"replace",
"(",
"\"/\"",
",",
"os",
".",
"sep",
")",
"exclude_files",
"=",
"[",
"... | https://github.com/stan-dev/math/blob/5fd79f89933269a4ca4d8dd1fde2a36d53d4768c/runChecks.py#L66-L125 | |
aws/lumberyard | f85344403c1c2e77ec8c75deb2c116e97b713217 | dev/Gems/CloudGemMetric/v1/AWS/common-code/Lib/numpy/lib/recfunctions.py | python | get_names_flat | (adtype) | return tuple(listnames) | Returns the field names of the input datatype as a tuple. Nested structure
are flattened beforehand.
Parameters
----------
adtype : dtype
Input datatype
Examples
--------
>>> from numpy.lib import recfunctions as rfn
>>> rfn.get_names_flat(np.empty((1,), dtype=int)) is None
... | Returns the field names of the input datatype as a tuple. Nested structure
are flattened beforehand. | [
"Returns",
"the",
"field",
"names",
"of",
"the",
"input",
"datatype",
"as",
"a",
"tuple",
".",
"Nested",
"structure",
"are",
"flattened",
"beforehand",
"."
] | def get_names_flat(adtype):
"""
Returns the field names of the input datatype as a tuple. Nested structure
are flattened beforehand.
Parameters
----------
adtype : dtype
Input datatype
Examples
--------
>>> from numpy.lib import recfunctions as rfn
>>> rfn.get_names_fla... | [
"def",
"get_names_flat",
"(",
"adtype",
")",
":",
"listnames",
"=",
"[",
"]",
"names",
"=",
"adtype",
".",
"names",
"for",
"name",
"in",
"names",
":",
"listnames",
".",
"append",
"(",
"name",
")",
"current",
"=",
"adtype",
"[",
"name",
"]",
"if",
"cu... | https://github.com/aws/lumberyard/blob/f85344403c1c2e77ec8c75deb2c116e97b713217/dev/Gems/CloudGemMetric/v1/AWS/common-code/Lib/numpy/lib/recfunctions.py#L149-L181 | |
RobotLocomotion/drake | 0e18a34604c45ed65bc9018a54f7610f91cdad5b | tools/lint/find_data.py | python | find_data | (relpath) | Given a relpath like drake/pkg/res.txt or external/repo/pkg/res.txt,
find the data file and return its path | Given a relpath like drake/pkg/res.txt or external/repo/pkg/res.txt,
find the data file and return its path | [
"Given",
"a",
"relpath",
"like",
"drake",
"/",
"pkg",
"/",
"res",
".",
"txt",
"or",
"external",
"/",
"repo",
"/",
"pkg",
"/",
"res",
".",
"txt",
"find",
"the",
"data",
"file",
"and",
"return",
"its",
"path"
] | def find_data(relpath):
"""Given a relpath like drake/pkg/res.txt or external/repo/pkg/res.txt,
find the data file and return its path"""
# Because we are in a py_binary, Bazel's wrapper script sets up our
# $PYTHONPATH to have our resources somewhere on a sys.path entry.
for one_path in sys.path:
... | [
"def",
"find_data",
"(",
"relpath",
")",
":",
"# Because we are in a py_binary, Bazel's wrapper script sets up our",
"# $PYTHONPATH to have our resources somewhere on a sys.path entry.",
"for",
"one_path",
"in",
"sys",
".",
"path",
":",
"possible",
"=",
"os",
".",
"path",
"."... | https://github.com/RobotLocomotion/drake/blob/0e18a34604c45ed65bc9018a54f7610f91cdad5b/tools/lint/find_data.py#L12-L24 | ||
pytorch/pytorch | 7176c92687d3cc847cc046bf002269c6949a21c2 | caffe2/python/onnx/backend.py | python | Caffe2Backend.prepare | (cls, model, device='CPU', raw_values_dict=None, **kwargs) | return retval | For Onnx Caffe2Backend, we require that init_graph don't initialize the actual input of the predict_graph,
for example, if "img" is the input blob for the predict_net, we require that in init_graph and in
initializer of the predict_graph, "img" is not initalized. We don't have a check for this, since
... | For Onnx Caffe2Backend, we require that init_graph don't initialize the actual input of the predict_graph, | [
"For",
"Onnx",
"Caffe2Backend",
"we",
"require",
"that",
"init_graph",
"don",
"t",
"initialize",
"the",
"actual",
"input",
"of",
"the",
"predict_graph"
] | def prepare(cls, model, device='CPU', raw_values_dict=None, **kwargs):
'''
For Onnx Caffe2Backend, we require that init_graph don't initialize the actual input of the predict_graph,
for example, if "img" is the input blob for the predict_net, we require that in init_graph and in
initial... | [
"def",
"prepare",
"(",
"cls",
",",
"model",
",",
"device",
"=",
"'CPU'",
",",
"raw_values_dict",
"=",
"None",
",",
"*",
"*",
"kwargs",
")",
":",
"if",
"not",
"kwargs",
".",
"pop",
"(",
"'no_check_UNSAFE'",
",",
"False",
")",
":",
"super",
"(",
"Caffe... | https://github.com/pytorch/pytorch/blob/7176c92687d3cc847cc046bf002269c6949a21c2/caffe2/python/onnx/backend.py#L672-L731 | |
SFTtech/openage | d6a08c53c48dc1e157807471df92197f6ca9e04d | openage/convert/entity_object/conversion/swgbcc/genie_unit.py | python | SWGBMonkGroup.is_unique | (self) | return False | Groups are unique if they belong to a specific civ.
:returns: True if the civ id is not Gaia's and no alternative lines
for this unit line exist. | Groups are unique if they belong to a specific civ. | [
"Groups",
"are",
"unique",
"if",
"they",
"belong",
"to",
"a",
"specific",
"civ",
"."
] | def is_unique(self):
"""
Groups are unique if they belong to a specific civ.
:returns: True if the civ id is not Gaia's and no alternative lines
for this unit line exist.
"""
return False | [
"def",
"is_unique",
"(",
"self",
")",
":",
"return",
"False"
] | https://github.com/SFTtech/openage/blob/d6a08c53c48dc1e157807471df92197f6ca9e04d/openage/convert/entity_object/conversion/swgbcc/genie_unit.py#L225-L232 | |
aws/lumberyard | f85344403c1c2e77ec8c75deb2c116e97b713217 | dev/Tools/Python/3.7.10/mac/Python.framework/Versions/3.7/lib/python3.7/site-packages/pip/_vendor/pkg_resources/__init__.py | python | ResourceManager.resource_listdir | (self, package_or_requirement, resource_name) | return get_provider(package_or_requirement).resource_listdir(
resource_name
) | List the contents of the named resource directory | List the contents of the named resource directory | [
"List",
"the",
"contents",
"of",
"the",
"named",
"resource",
"directory"
] | def resource_listdir(self, package_or_requirement, resource_name):
"""List the contents of the named resource directory"""
return get_provider(package_or_requirement).resource_listdir(
resource_name
) | [
"def",
"resource_listdir",
"(",
"self",
",",
"package_or_requirement",
",",
"resource_name",
")",
":",
"return",
"get_provider",
"(",
"package_or_requirement",
")",
".",
"resource_listdir",
"(",
"resource_name",
")"
] | https://github.com/aws/lumberyard/blob/f85344403c1c2e77ec8c75deb2c116e97b713217/dev/Tools/Python/3.7.10/mac/Python.framework/Versions/3.7/lib/python3.7/site-packages/pip/_vendor/pkg_resources/__init__.py#L1160-L1164 | |
idaholab/moose | 9eeebc65e098b4c30f8205fb41591fd5b61eb6ff | python/peacock/ExodusViewer/plugins/BackgroundPlugin.py | python | BackgroundPlugin._callbackBlackPreset | (self, value) | Called when the black preset is toggled. | Called when the black preset is toggled. | [
"Called",
"when",
"the",
"black",
"preset",
"is",
"toggled",
"."
] | def _callbackBlackPreset(self, value):
"""
Called when the black preset is toggled.
"""
self.BlackPreset.setChecked(value)
if value:
self.GradientToggle.blockSignals(True)
self.GradientToggle.setChecked(False)
self.GradientToggle.blockSignals(F... | [
"def",
"_callbackBlackPreset",
"(",
"self",
",",
"value",
")",
":",
"self",
".",
"BlackPreset",
".",
"setChecked",
"(",
"value",
")",
"if",
"value",
":",
"self",
".",
"GradientToggle",
".",
"blockSignals",
"(",
"True",
")",
"self",
".",
"GradientToggle",
"... | https://github.com/idaholab/moose/blob/9eeebc65e098b4c30f8205fb41591fd5b61eb6ff/python/peacock/ExodusViewer/plugins/BackgroundPlugin.py#L299-L327 | ||
qt/qtbase | 81b9ee66b8e40ed145185fe46b7c91929688cafd | util/cmake/qmake_parser.py | python | flatten_list | (input_list) | Flattens an irregular nested list into a simple list. | Flattens an irregular nested list into a simple list. | [
"Flattens",
"an",
"irregular",
"nested",
"list",
"into",
"a",
"simple",
"list",
"."
] | def flatten_list(input_list):
""" Flattens an irregular nested list into a simple list."""
for el in input_list:
if isinstance(el, collections.abc.Iterable) and not isinstance(el, (str, bytes)):
yield from flatten_list(el)
else:
yield el | [
"def",
"flatten_list",
"(",
"input_list",
")",
":",
"for",
"el",
"in",
"input_list",
":",
"if",
"isinstance",
"(",
"el",
",",
"collections",
".",
"abc",
".",
"Iterable",
")",
"and",
"not",
"isinstance",
"(",
"el",
",",
"(",
"str",
",",
"bytes",
")",
... | https://github.com/qt/qtbase/blob/81b9ee66b8e40ed145185fe46b7c91929688cafd/util/cmake/qmake_parser.py#L75-L81 | ||
larroy/clearskies_core | 3574ddf0edc8555454c7044126e786a6c29444dc | tools/gyp/pylib/gyp/generator/android.py | python | AndroidMkWriter.ComputeDeps | (self, spec) | return (gyp.common.uniquer(deps), gyp.common.uniquer(link_deps)) | Compute the dependencies of a gyp spec.
Returns a tuple (deps, link_deps), where each is a list of
filenames that will need to be put in front of make for either
building (deps) or linking (link_deps). | Compute the dependencies of a gyp spec. | [
"Compute",
"the",
"dependencies",
"of",
"a",
"gyp",
"spec",
"."
] | def ComputeDeps(self, spec):
"""Compute the dependencies of a gyp spec.
Returns a tuple (deps, link_deps), where each is a list of
filenames that will need to be put in front of make for either
building (deps) or linking (link_deps).
"""
deps = []
link_deps = []
if 'dependencies' in spe... | [
"def",
"ComputeDeps",
"(",
"self",
",",
"spec",
")",
":",
"deps",
"=",
"[",
"]",
"link_deps",
"=",
"[",
"]",
"if",
"'dependencies'",
"in",
"spec",
":",
"deps",
".",
"extend",
"(",
"[",
"target_outputs",
"[",
"dep",
"]",
"for",
"dep",
"in",
"spec",
... | https://github.com/larroy/clearskies_core/blob/3574ddf0edc8555454c7044126e786a6c29444dc/tools/gyp/pylib/gyp/generator/android.py#L773-L789 | |
apache/impala | 8ddac48f3428c86f2cbd037ced89cfb903298b12 | shell/impala_shell.py | python | ImpalaShell.print_runtime_profile | (self, profile, failed_profile,
profile_display_mode=QueryAttemptDisplayModes.LATEST, status=False) | Prints the given runtime profiles to the console. Optionally prints the failed
profile if the query was retried. The format the profiles are printed is controlled
by the option profile_display_mode, see QueryProfileDisplayModes docs above. | Prints the given runtime profiles to the console. Optionally prints the failed
profile if the query was retried. The format the profiles are printed is controlled
by the option profile_display_mode, see QueryProfileDisplayModes docs above. | [
"Prints",
"the",
"given",
"runtime",
"profiles",
"to",
"the",
"console",
".",
"Optionally",
"prints",
"the",
"failed",
"profile",
"if",
"the",
"query",
"was",
"retried",
".",
"The",
"format",
"the",
"profiles",
"are",
"printed",
"is",
"controlled",
"by",
"th... | def print_runtime_profile(self, profile, failed_profile,
profile_display_mode=QueryAttemptDisplayModes.LATEST, status=False):
"""Prints the given runtime profiles to the console. Optionally prints the failed
profile if the query was retried. The format the profiles are printed is controlled
by the o... | [
"def",
"print_runtime_profile",
"(",
"self",
",",
"profile",
",",
"failed_profile",
",",
"profile_display_mode",
"=",
"QueryAttemptDisplayModes",
".",
"LATEST",
",",
"status",
"=",
"False",
")",
":",
"if",
"self",
".",
"show_profiles",
"or",
"status",
":",
"if",... | https://github.com/apache/impala/blob/8ddac48f3428c86f2cbd037ced89cfb903298b12/shell/impala_shell.py#L1086-L1104 | ||
ChromiumWebApps/chromium | c7361d39be8abd1574e6ce8957c8dbddd4c6ccf7 | chrome/common/extensions/docs/examples/apps/hello-python/oauth2/__init__.py | python | SignatureMethod.signing_base | (self, request, consumer, token) | Calculates the string that needs to be signed.
This method returns a 2-tuple containing the starting key for the
signing and the message to be signed. The latter may be used in error
messages to help clients debug their software. | Calculates the string that needs to be signed. | [
"Calculates",
"the",
"string",
"that",
"needs",
"to",
"be",
"signed",
"."
] | def signing_base(self, request, consumer, token):
"""Calculates the string that needs to be signed.
This method returns a 2-tuple containing the starting key for the
signing and the message to be signed. The latter may be used in error
messages to help clients debug their software.
... | [
"def",
"signing_base",
"(",
"self",
",",
"request",
",",
"consumer",
",",
"token",
")",
":",
"raise",
"NotImplementedError"
] | https://github.com/ChromiumWebApps/chromium/blob/c7361d39be8abd1574e6ce8957c8dbddd4c6ccf7/chrome/common/extensions/docs/examples/apps/hello-python/oauth2/__init__.py#L682-L690 | ||
CRYTEK/CRYENGINE | 232227c59a220cbbd311576f0fbeba7bb53b2a8c | Editor/Python/windows/Lib/site-packages/setuptools/command/sdist.py | python | sdist.read_manifest | (self) | Read the manifest file (named by 'self.manifest') and use it to
fill in 'self.filelist', the list of files to include in the source
distribution. | Read the manifest file (named by 'self.manifest') and use it to
fill in 'self.filelist', the list of files to include in the source
distribution. | [
"Read",
"the",
"manifest",
"file",
"(",
"named",
"by",
"self",
".",
"manifest",
")",
"and",
"use",
"it",
"to",
"fill",
"in",
"self",
".",
"filelist",
"the",
"list",
"of",
"files",
"to",
"include",
"in",
"the",
"source",
"distribution",
"."
] | def read_manifest(self):
"""Read the manifest file (named by 'self.manifest') and use it to
fill in 'self.filelist', the list of files to include in the source
distribution.
"""
log.info("reading manifest file '%s'", self.manifest)
manifest = open(self.manifest, 'rb')
... | [
"def",
"read_manifest",
"(",
"self",
")",
":",
"log",
".",
"info",
"(",
"\"reading manifest file '%s'\"",
",",
"self",
".",
"manifest",
")",
"manifest",
"=",
"open",
"(",
"self",
".",
"manifest",
",",
"'rb'",
")",
"for",
"line",
"in",
"manifest",
":",
"#... | https://github.com/CRYTEK/CRYENGINE/blob/232227c59a220cbbd311576f0fbeba7bb53b2a8c/Editor/Python/windows/Lib/site-packages/setuptools/command/sdist.py#L180-L200 | ||
aws/lumberyard | f85344403c1c2e77ec8c75deb2c116e97b713217 | dev/Gems/CloudGemMetric/v1/AWS/python/windows/Lib/fsspec/core.py | python | OpenFile.open | (self) | return self.__enter__() | Materialise this as a real open file without context
The file should be explicitly closed to avoid enclosed open file
instances persisting | Materialise this as a real open file without context | [
"Materialise",
"this",
"as",
"a",
"real",
"open",
"file",
"without",
"context"
] | def open(self):
"""Materialise this as a real open file without context
The file should be explicitly closed to avoid enclosed open file
instances persisting
"""
return self.__enter__() | [
"def",
"open",
"(",
"self",
")",
":",
"return",
"self",
".",
"__enter__",
"(",
")"
] | https://github.com/aws/lumberyard/blob/f85344403c1c2e77ec8c75deb2c116e97b713217/dev/Gems/CloudGemMetric/v1/AWS/python/windows/Lib/fsspec/core.py#L123-L129 | |
wxWidgets/wxPython-Classic | 19571e1ae65f1ac445f5491474121998c97a1bf0 | src/msw/_controls.py | python | AnyButton.GetBitmapSelected | (*args, **kwargs) | return _controls_.AnyButton_GetBitmapSelected(*args, **kwargs) | GetBitmapSelected(self) -> Bitmap | GetBitmapSelected(self) -> Bitmap | [
"GetBitmapSelected",
"(",
"self",
")",
"-",
">",
"Bitmap"
] | def GetBitmapSelected(*args, **kwargs):
"""GetBitmapSelected(self) -> Bitmap"""
return _controls_.AnyButton_GetBitmapSelected(*args, **kwargs) | [
"def",
"GetBitmapSelected",
"(",
"*",
"args",
",",
"*",
"*",
"kwargs",
")",
":",
"return",
"_controls_",
".",
"AnyButton_GetBitmapSelected",
"(",
"*",
"args",
",",
"*",
"*",
"kwargs",
")"
] | https://github.com/wxWidgets/wxPython-Classic/blob/19571e1ae65f1ac445f5491474121998c97a1bf0/src/msw/_controls.py#L125-L127 | |
ApolloAuto/apollo-platform | 86d9dc6743b496ead18d597748ebabd34a513289 | ros/vision_opencv/image_geometry/src/image_geometry/cameramodels.py | python | StereoCameraModel.fromCameraInfo | (self, left_msg, right_msg) | :param left_msg: left camera parameters
:type left_msg: sensor_msgs.msg.CameraInfo
:param right_msg: right camera parameters
:type right_msg: sensor_msgs.msg.CameraInfo
Set the camera parameters from the :class:`sensor_msgs.msg.CameraInfo` messages. | :param left_msg: left camera parameters
:type left_msg: sensor_msgs.msg.CameraInfo
:param right_msg: right camera parameters
:type right_msg: sensor_msgs.msg.CameraInfo | [
":",
"param",
"left_msg",
":",
"left",
"camera",
"parameters",
":",
"type",
"left_msg",
":",
"sensor_msgs",
".",
"msg",
".",
"CameraInfo",
":",
"param",
"right_msg",
":",
"right",
"camera",
"parameters",
":",
"type",
"right_msg",
":",
"sensor_msgs",
".",
"ms... | def fromCameraInfo(self, left_msg, right_msg):
"""
:param left_msg: left camera parameters
:type left_msg: sensor_msgs.msg.CameraInfo
:param right_msg: right camera parameters
:type right_msg: sensor_msgs.msg.CameraInfo
Set the camera parameters from the :class:`sensor... | [
"def",
"fromCameraInfo",
"(",
"self",
",",
"left_msg",
",",
"right_msg",
")",
":",
"self",
".",
"left",
".",
"fromCameraInfo",
"(",
"left_msg",
")",
"self",
".",
"right",
".",
"fromCameraInfo",
"(",
"right_msg",
")",
"# [ Fx, 0, Cx, Fx*-Tx ]",
"# [ 0, Fy, Cy,... | https://github.com/ApolloAuto/apollo-platform/blob/86d9dc6743b496ead18d597748ebabd34a513289/ros/vision_opencv/image_geometry/src/image_geometry/cameramodels.py#L265-L299 | ||
mantidproject/mantid | 03deeb89254ec4289edb8771e0188c2090a02f32 | qt/python/mantidqtinterfaces/mantidqtinterfaces/Muon/GUI/Common/utilities/table_utils.py | python | ValidatedTableItem._modify_setData | (self) | Modify the setData method. | Modify the setData method. | [
"Modify",
"the",
"setData",
"method",
"."
] | def _modify_setData(self):
"""
Modify the setData method.
"""
setattr(self, "setData", self.validator_before_set(self.setData, self.validator)) | [
"def",
"_modify_setData",
"(",
"self",
")",
":",
"setattr",
"(",
"self",
",",
"\"setData\"",
",",
"self",
".",
"validator_before_set",
"(",
"self",
".",
"setData",
",",
"self",
".",
"validator",
")",
")"
] | https://github.com/mantidproject/mantid/blob/03deeb89254ec4289edb8771e0188c2090a02f32/qt/python/mantidqtinterfaces/mantidqtinterfaces/Muon/GUI/Common/utilities/table_utils.py#L75-L79 | ||
MythTV/mythtv | d282a209cb8be85d036f85a62a8ec971b67d45f4 | mythtv/programs/scripts/internetcontent/nv_python_libs/vimeo/oauth/oauth_api.py | python | OAuthServer.build_authenticate_header | (self, realm='') | return {'WWW-Authenticate': 'OAuth realm="%s"' % realm} | Optional support for the authenticate header. | Optional support for the authenticate header. | [
"Optional",
"support",
"for",
"the",
"authenticate",
"header",
"."
] | def build_authenticate_header(self, realm=''):
"""Optional support for the authenticate header."""
return {'WWW-Authenticate': 'OAuth realm="%s"' % realm} | [
"def",
"build_authenticate_header",
"(",
"self",
",",
"realm",
"=",
"''",
")",
":",
"return",
"{",
"'WWW-Authenticate'",
":",
"'OAuth realm=\"%s\"'",
"%",
"realm",
"}"
] | https://github.com/MythTV/mythtv/blob/d282a209cb8be85d036f85a62a8ec971b67d45f4/mythtv/programs/scripts/internetcontent/nv_python_libs/vimeo/oauth/oauth_api.py#L444-L446 | |
hanpfei/chromium-net | 392cc1fa3a8f92f42e4071ab6e674d8e0482f83f | third_party/catapult/third_party/closure_linter/closure_linter/closurizednamespacesinfo.py | python | ClosurizedNamespacesInfo._AddUsedNamespace | (self, state_tracker, identifier, token,
is_alias_definition=False) | Adds the namespace of an identifier to the list of used namespaces.
If the identifier is annotated with a 'missingRequire' suppression, it is
not added.
Args:
state_tracker: The JavaScriptStateTracker instance.
identifier: An identifier which has been used.
token: The token in which the ... | Adds the namespace of an identifier to the list of used namespaces. | [
"Adds",
"the",
"namespace",
"of",
"an",
"identifier",
"to",
"the",
"list",
"of",
"used",
"namespaces",
"."
] | def _AddUsedNamespace(self, state_tracker, identifier, token,
is_alias_definition=False):
"""Adds the namespace of an identifier to the list of used namespaces.
If the identifier is annotated with a 'missingRequire' suppression, it is
not added.
Args:
state_tracker: The J... | [
"def",
"_AddUsedNamespace",
"(",
"self",
",",
"state_tracker",
",",
"identifier",
",",
"token",
",",
"is_alias_definition",
"=",
"False",
")",
":",
"if",
"self",
".",
"_HasSuppression",
"(",
"state_tracker",
",",
"'missingRequire'",
")",
":",
"return",
"identifi... | https://github.com/hanpfei/chromium-net/blob/392cc1fa3a8f92f42e4071ab6e674d8e0482f83f/third_party/catapult/third_party/closure_linter/closure_linter/closurizednamespacesinfo.py#L502-L526 | ||
alibaba/weex_js_engine | 2bdf4b6f020c1fc99c63f649718f6faf7e27fdde | jni/v8core/v8/build/gyp/pylib/gyp/MSVSSettings.py | python | ValidateMSVSSettings | (settings, stderr=sys.stderr) | Validates that the names of the settings are valid for MSVS.
Args:
settings: A dictionary. The key is the tool name. The values are
themselves dictionaries of settings and their values.
stderr: The stream receiving the error messages. | Validates that the names of the settings are valid for MSVS. | [
"Validates",
"that",
"the",
"names",
"of",
"the",
"settings",
"are",
"valid",
"for",
"MSVS",
"."
] | def ValidateMSVSSettings(settings, stderr=sys.stderr):
"""Validates that the names of the settings are valid for MSVS.
Args:
settings: A dictionary. The key is the tool name. The values are
themselves dictionaries of settings and their values.
stderr: The stream receiving the error messages... | [
"def",
"ValidateMSVSSettings",
"(",
"settings",
",",
"stderr",
"=",
"sys",
".",
"stderr",
")",
":",
"_ValidateSettings",
"(",
"_msvs_validators",
",",
"settings",
",",
"stderr",
")"
] | https://github.com/alibaba/weex_js_engine/blob/2bdf4b6f020c1fc99c63f649718f6faf7e27fdde/jni/v8core/v8/build/gyp/pylib/gyp/MSVSSettings.py#L442-L450 | ||
lemenkov/libyuv | 5b3351bd07e83f9f9a4cb6629561331ecdb7c546 | tools_libyuv/autoroller/roll_deps.py | python | _GetBranches | () | return active, branches | Returns a tuple of active,branches.
The 'active' is the name of the currently active branch and 'branches' is a
list of all branches. | Returns a tuple of active,branches. | [
"Returns",
"a",
"tuple",
"of",
"active",
"branches",
"."
] | def _GetBranches():
"""Returns a tuple of active,branches.
The 'active' is the name of the currently active branch and 'branches' is a
list of all branches.
"""
lines = _RunCommand(['git', 'branch'])[0].split('\n')
branches = []
active = ''
for line in lines:
if '*' in line:
# The assumption ... | [
"def",
"_GetBranches",
"(",
")",
":",
"lines",
"=",
"_RunCommand",
"(",
"[",
"'git'",
",",
"'branch'",
"]",
")",
"[",
"0",
"]",
".",
"split",
"(",
"'\\n'",
")",
"branches",
"=",
"[",
"]",
"active",
"=",
"''",
"for",
"line",
"in",
"lines",
":",
"i... | https://github.com/lemenkov/libyuv/blob/5b3351bd07e83f9f9a4cb6629561331ecdb7c546/tools_libyuv/autoroller/roll_deps.py#L132-L150 | |
wxWidgets/wxPython-Classic | 19571e1ae65f1ac445f5491474121998c97a1bf0 | wx/lib/agw/hypertreelist.py | python | TreeListHeaderWindow.XToCol | (self, x) | return wx.NOT_FOUND | Returns the column that corresponds to the logical input `x` coordinate.
:param `x`: the `x` position to evaluate.
:return: The column that corresponds to the logical input `x` coordinate,
or ``wx.NOT_FOUND`` if there is no column at the `x` position. | Returns the column that corresponds to the logical input `x` coordinate. | [
"Returns",
"the",
"column",
"that",
"corresponds",
"to",
"the",
"logical",
"input",
"x",
"coordinate",
"."
] | def XToCol(self, x):
"""
Returns the column that corresponds to the logical input `x` coordinate.
:param `x`: the `x` position to evaluate.
:return: The column that corresponds to the logical input `x` coordinate,
or ``wx.NOT_FOUND`` if there is no column at the `x` position.
... | [
"def",
"XToCol",
"(",
"self",
",",
"x",
")",
":",
"colLeft",
"=",
"0",
"numColumns",
"=",
"self",
".",
"GetColumnCount",
"(",
")",
"for",
"col",
"in",
"xrange",
"(",
"numColumns",
")",
":",
"if",
"not",
"self",
".",
"IsColumnShown",
"(",
"col",
")",
... | https://github.com/wxWidgets/wxPython-Classic/blob/19571e1ae65f1ac445f5491474121998c97a1bf0/wx/lib/agw/hypertreelist.py#L928-L952 | |
baidu-research/tensorflow-allreduce | 66d5b855e90b0949e9fa5cca5599fd729a70e874 | tensorflow/contrib/keras/python/keras/layers/serialization.py | python | deserialize | (config, custom_objects=None) | return deserialize_keras_object(
config,
module_objects=globs,
custom_objects=custom_objects,
printable_module_name='layer') | Instantiates a layer from a config dictionary.
Arguments:
config: dict of the form {'class_name': str, 'config': dict}
custom_objects: dict mapping class names (or function names)
of custom (non-Keras) objects to class/functions
Returns:
Layer instance (may be Model, Sequential, Layer.... | Instantiates a layer from a config dictionary. | [
"Instantiates",
"a",
"layer",
"from",
"a",
"config",
"dictionary",
"."
] | def deserialize(config, custom_objects=None):
"""Instantiates a layer from a config dictionary.
Arguments:
config: dict of the form {'class_name': str, 'config': dict}
custom_objects: dict mapping class names (or function names)
of custom (non-Keras) objects to class/functions
Returns:
... | [
"def",
"deserialize",
"(",
"config",
",",
"custom_objects",
"=",
"None",
")",
":",
"from",
"tensorflow",
".",
"contrib",
".",
"keras",
".",
"python",
".",
"keras",
"import",
"models",
"# pylint: disable=g-import-not-at-top",
"globs",
"=",
"globals",
"(",
")",
... | https://github.com/baidu-research/tensorflow-allreduce/blob/66d5b855e90b0949e9fa5cca5599fd729a70e874/tensorflow/contrib/keras/python/keras/layers/serialization.py#L44-L63 | |
facebookarchive/LogDevice | ce7726050edc49a1e15d9160e81c890736b779e2 | build/fbcode_builder/getdeps/builder.py | python | CargoBuilder._resolve_config | (self) | return "\n".join(config) | Returns a configuration to be put inside root Cargo.toml file which
patches the dependencies git code with local getdeps versions.
See https://doc.rust-lang.org/cargo/reference/manifest.html#the-patch-section | Returns a configuration to be put inside root Cargo.toml file which
patches the dependencies git code with local getdeps versions.
See https://doc.rust-lang.org/cargo/reference/manifest.html#the-patch-section | [
"Returns",
"a",
"configuration",
"to",
"be",
"put",
"inside",
"root",
"Cargo",
".",
"toml",
"file",
"which",
"patches",
"the",
"dependencies",
"git",
"code",
"with",
"local",
"getdeps",
"versions",
".",
"See",
"https",
":",
"//",
"doc",
".",
"rust",
"-",
... | def _resolve_config(self):
"""
Returns a configuration to be put inside root Cargo.toml file which
patches the dependencies git code with local getdeps versions.
See https://doc.rust-lang.org/cargo/reference/manifest.html#the-patch-section
"""
dep_to_git = self._resolve_d... | [
"def",
"_resolve_config",
"(",
"self",
")",
":",
"dep_to_git",
"=",
"self",
".",
"_resolve_dep_to_git",
"(",
")",
"dep_to_crates",
"=",
"CargoBuilder",
".",
"_resolve_dep_to_crates",
"(",
"self",
".",
"build_source_dir",
"(",
")",
",",
"dep_to_git",
")",
"config... | https://github.com/facebookarchive/LogDevice/blob/ce7726050edc49a1e15d9160e81c890736b779e2/build/fbcode_builder/getdeps/builder.py#L1182-L1213 | |
FreeCAD/FreeCAD | ba42231b9c6889b89e064d6d563448ed81e376ec | src/Mod/Arch/ArchEquipment.py | python | _Equipment.executeSketchArchFeatures | (self, obj, linkObj=None, index=None, linkElement=None) | To execute features in the SketchArch External Add-on (https://github.com/paullee0/FreeCAD_SketchArch)
- import ArchSketchObject module, and
- execute features that are common to ArchObjects (including Links) and ArchSketch
To install SketchArch External Add-on, see https://github.c... | To execute features in the SketchArch External Add-on (https://github.com/paullee0/FreeCAD_SketchArch)
- import ArchSketchObject module, and
- execute features that are common to ArchObjects (including Links) and ArchSketch | [
"To",
"execute",
"features",
"in",
"the",
"SketchArch",
"External",
"Add",
"-",
"on",
"(",
"https",
":",
"//",
"github",
".",
"com",
"/",
"paullee0",
"/",
"FreeCAD_SketchArch",
")",
"-",
"import",
"ArchSketchObject",
"module",
"and",
"-",
"execute",
"feature... | def executeSketchArchFeatures(self, obj, linkObj=None, index=None, linkElement=None):
'''
To execute features in the SketchArch External Add-on (https://github.com/paullee0/FreeCAD_SketchArch)
- import ArchSketchObject module, and
- execute features that are common to ArchOb... | [
"def",
"executeSketchArchFeatures",
"(",
"self",
",",
"obj",
",",
"linkObj",
"=",
"None",
",",
"index",
"=",
"None",
",",
"linkElement",
"=",
"None",
")",
":",
"# To execute features in SketchArch External Add-on, if present",
"try",
":",
"import",
"ArchSketchObject",... | https://github.com/FreeCAD/FreeCAD/blob/ba42231b9c6889b89e064d6d563448ed81e376ec/src/Mod/Arch/ArchEquipment.py#L350-L366 | ||
bristolcrypto/SPDZ-2 | 721abfae849625a02ea49aabc534f9cf41ca643f | Compiler/comparison.py | python | PreMulC_with_inverses_and_vectors | (p, a) | p[i] = prod_{j=0}^{i-1} a[i]
Variant for vector registers using preprocessed inverses. | p[i] = prod_{j=0}^{i-1} a[i] | [
"p",
"[",
"i",
"]",
"=",
"prod_",
"{",
"j",
"=",
"0",
"}",
"^",
"{",
"i",
"-",
"1",
"}",
"a",
"[",
"i",
"]"
] | def PreMulC_with_inverses_and_vectors(p, a):
"""
p[i] = prod_{j=0}^{i-1} a[i]
Variant for vector registers using preprocessed inverses.
"""
k = len(p)
a_vec = program.curr_block.new_reg('s', size=k)
r = program.curr_block.new_reg('s', size=k)
w = program.curr_block.new_reg('s', size=k)
... | [
"def",
"PreMulC_with_inverses_and_vectors",
"(",
"p",
",",
"a",
")",
":",
"k",
"=",
"len",
"(",
"p",
")",
"a_vec",
"=",
"program",
".",
"curr_block",
".",
"new_reg",
"(",
"'s'",
",",
"size",
"=",
"k",
")",
"r",
"=",
"program",
".",
"curr_block",
".",... | https://github.com/bristolcrypto/SPDZ-2/blob/721abfae849625a02ea49aabc534f9cf41ca643f/Compiler/comparison.py#L370-L401 | ||
Kitware/ParaView | f760af9124ff4634b23ebbeab95a4f56e0261955 | Wrapping/Python/paraview/coprocessing.py | python | CoProcessor.WriteData | (self, datadescription) | This method will update all writes present in the pipeline, as
needed, to generate the output data files, respecting the
write-frequencies set on the writers. | This method will update all writes present in the pipeline, as
needed, to generate the output data files, respecting the
write-frequencies set on the writers. | [
"This",
"method",
"will",
"update",
"all",
"writes",
"present",
"in",
"the",
"pipeline",
"as",
"needed",
"to",
"generate",
"the",
"output",
"data",
"files",
"respecting",
"the",
"write",
"-",
"frequencies",
"set",
"on",
"the",
"writers",
"."
] | def WriteData(self, datadescription):
"""This method will update all writes present in the pipeline, as
needed, to generate the output data files, respecting the
write-frequencies set on the writers."""
timestep = datadescription.GetTimeStep()
for writer in self.__WritersLi... | [
"def",
"WriteData",
"(",
"self",
",",
"datadescription",
")",
":",
"timestep",
"=",
"datadescription",
".",
"GetTimeStep",
"(",
")",
"for",
"writer",
"in",
"self",
".",
"__WritersList",
":",
"frequency",
"=",
"writer",
".",
"parameters",
".",
"GetProperty",
... | https://github.com/Kitware/ParaView/blob/f760af9124ff4634b23ebbeab95a4f56e0261955/Wrapping/Python/paraview/coprocessing.py#L228-L265 | ||
Slicer/SlicerGitSVNArchive | 65e92bb16c2b32ea47a1a66bee71f238891ee1ca | Modules/Scripted/DICOMLib/DICOMUtils.py | python | registerSlicerURLHandler | () | Registers slicer:// protocol with this executable.
For now, only implemented on Windows. | Registers slicer:// protocol with this executable.
For now, only implemented on Windows. | [
"Registers",
"slicer",
":",
"//",
"protocol",
"with",
"this",
"executable",
".",
"For",
"now",
"only",
"implemented",
"on",
"Windows",
"."
] | def registerSlicerURLHandler():
"""
Registers slicer:// protocol with this executable.
For now, only implemented on Windows.
"""
if os.name == 'nt':
slicerLauncherPath = os.path.abspath(slicer.app.launcherExecutableFilePath)
urlHandlerRegFile = r"""Windows Registry Editor Version 5.00
[HKEY_CLASSES_RO... | [
"def",
"registerSlicerURLHandler",
"(",
")",
":",
"if",
"os",
".",
"name",
"==",
"'nt'",
":",
"slicerLauncherPath",
"=",
"os",
".",
"path",
".",
"abspath",
"(",
"slicer",
".",
"app",
".",
"launcherExecutableFilePath",
")",
"urlHandlerRegFile",
"=",
"r\"\"\"Win... | https://github.com/Slicer/SlicerGitSVNArchive/blob/65e92bb16c2b32ea47a1a66bee71f238891ee1ca/Modules/Scripted/DICOMLib/DICOMUtils.py#L739-L762 | ||
wxWidgets/wxPython-Classic | 19571e1ae65f1ac445f5491474121998c97a1bf0 | src/msw/_controls.py | python | TextAttr.GetBackgroundColour | (*args, **kwargs) | return _controls_.TextAttr_GetBackgroundColour(*args, **kwargs) | GetBackgroundColour(self) -> Colour | GetBackgroundColour(self) -> Colour | [
"GetBackgroundColour",
"(",
"self",
")",
"-",
">",
"Colour"
] | def GetBackgroundColour(*args, **kwargs):
"""GetBackgroundColour(self) -> Colour"""
return _controls_.TextAttr_GetBackgroundColour(*args, **kwargs) | [
"def",
"GetBackgroundColour",
"(",
"*",
"args",
",",
"*",
"*",
"kwargs",
")",
":",
"return",
"_controls_",
".",
"TextAttr_GetBackgroundColour",
"(",
"*",
"args",
",",
"*",
"*",
"kwargs",
")"
] | https://github.com/wxWidgets/wxPython-Classic/blob/19571e1ae65f1ac445f5491474121998c97a1bf0/src/msw/_controls.py#L1643-L1645 | |
tangzhenyu/Scene-Text-Understanding | 0f7ffc7aea5971a50cdc03d33d0a41075285948b | ctpn_crnn_ocr/CTPN/caffe/scripts/cpp_lint.py | python | _SetCountingStyle | (level) | Sets the module's counting options. | Sets the module's counting options. | [
"Sets",
"the",
"module",
"s",
"counting",
"options",
"."
] | def _SetCountingStyle(level):
"""Sets the module's counting options."""
_cpplint_state.SetCountingStyle(level) | [
"def",
"_SetCountingStyle",
"(",
"level",
")",
":",
"_cpplint_state",
".",
"SetCountingStyle",
"(",
"level",
")"
] | https://github.com/tangzhenyu/Scene-Text-Understanding/blob/0f7ffc7aea5971a50cdc03d33d0a41075285948b/ctpn_crnn_ocr/CTPN/caffe/scripts/cpp_lint.py#L787-L789 | ||
catboost/catboost | 167f64f237114a4d10b2b4ee42adb4569137debe | contrib/python/pandas/py3/pandas/core/reshape/merge.py | python | merge_asof | (
left: DataFrame | Series,
right: DataFrame | Series,
on: IndexLabel | None = None,
left_on: IndexLabel | None = None,
right_on: IndexLabel | None = None,
left_index: bool = False,
right_index: bool = False,
by=None,
left_by=None,
right_by=None,
suffixes: Suffixes = ("_x", "... | return op.get_result() | Perform an asof merge.
This is similar to a left-join except that we match on nearest
key rather than equal keys. Both DataFrames must be sorted by the key.
For each row in the left DataFrame:
- A "backward" search selects the last row in the right DataFrame whose
'on' key is less than or e... | Perform an asof merge. | [
"Perform",
"an",
"asof",
"merge",
"."
] | def merge_asof(
left: DataFrame | Series,
right: DataFrame | Series,
on: IndexLabel | None = None,
left_on: IndexLabel | None = None,
right_on: IndexLabel | None = None,
left_index: bool = False,
right_index: bool = False,
by=None,
left_by=None,
right_by=None,
suffixes: Suffi... | [
"def",
"merge_asof",
"(",
"left",
":",
"DataFrame",
"|",
"Series",
",",
"right",
":",
"DataFrame",
"|",
"Series",
",",
"on",
":",
"IndexLabel",
"|",
"None",
"=",
"None",
",",
"left_on",
":",
"IndexLabel",
"|",
"None",
"=",
"None",
",",
"right_on",
":",... | https://github.com/catboost/catboost/blob/167f64f237114a4d10b2b4ee42adb4569137debe/contrib/python/pandas/py3/pandas/core/reshape/merge.py#L325-L597 | |
pytorch/pytorch | 7176c92687d3cc847cc046bf002269c6949a21c2 | torch/distributed/_shard/sharded_tensor/__init__.py | python | pre_load_state_dict_hook | (module, state_dict, prefix, local_metadata, strict, missing_keys, unexpected_keys, error_msgs) | Pre-load state dict hook to add ShardedTensor to the module. | Pre-load state dict hook to add ShardedTensor to the module. | [
"Pre",
"-",
"load",
"state",
"dict",
"hook",
"to",
"add",
"ShardedTensor",
"to",
"the",
"module",
"."
] | def pre_load_state_dict_hook(module, state_dict, prefix, local_metadata, strict, missing_keys, unexpected_keys, error_msgs):
"""
Pre-load state dict hook to add ShardedTensor to the module.
"""
for submodule_name, submodule in module.named_modules():
for attr_name, attr in submodule.__dict__.ite... | [
"def",
"pre_load_state_dict_hook",
"(",
"module",
",",
"state_dict",
",",
"prefix",
",",
"local_metadata",
",",
"strict",
",",
"missing_keys",
",",
"unexpected_keys",
",",
"error_msgs",
")",
":",
"for",
"submodule_name",
",",
"submodule",
"in",
"module",
".",
"n... | https://github.com/pytorch/pytorch/blob/7176c92687d3cc847cc046bf002269c6949a21c2/torch/distributed/_shard/sharded_tensor/__init__.py#L357-L366 | ||
aws/lumberyard | f85344403c1c2e77ec8c75deb2c116e97b713217 | dev/Tools/Python/3.7.10/linux_x64/lib/python3.7/site-packages/pip/_internal/vcs/versioncontrol.py | python | RevOptions.make_new | (self, rev) | return self.vc_class.make_rev_options(rev, extra_args=self.extra_args) | Make a copy of the current instance, but with a new rev.
Args:
rev: the name of the revision for the new object. | [] | def make_new(self, rev):
# type: (str) -> RevOptions
"""
Make a copy of the current instance, but with a new rev.
Args:
rev: the name of the revision for the new object.
"""
return self.vc_class.make_rev_options(rev, extra_args=self.extra_args) | [
"def",
"make_new",
"(",
"self",
",",
"rev",
")",
":",
"# type: (str) -> RevOptions",
"return",
"self",
".",
"vc_class",
".",
"make_rev_options",
"(",
"rev",
",",
"extra_args",
"=",
"self",
".",
"extra_args",
")"
] | https://github.com/aws/lumberyard/blob/f85344403c1c2e77ec8c75deb2c116e97b713217/dev/Tools/Python/3.7.10/linux_x64/lib/python3.7/site-packages/pip/_internal/vcs/versioncontrol.py#L345-L361 | ||
tangzhenyu/Scene-Text-Understanding | 0f7ffc7aea5971a50cdc03d33d0a41075285948b | SynthText_Chinese/synth_utils.py | python | ssc | (v) | return np.array([[ 0, -v[2], v[1]],
[ v[2], 0, -v[0]],
[-v[1], v[0], 0]]) | Returns the skew-symmetric cross-product matrix corresponding to v. | Returns the skew-symmetric cross-product matrix corresponding to v. | [
"Returns",
"the",
"skew",
"-",
"symmetric",
"cross",
"-",
"product",
"matrix",
"corresponding",
"to",
"v",
"."
] | def ssc(v):
"""
Returns the skew-symmetric cross-product matrix corresponding to v.
"""
v /= np.linalg.norm(v)
return np.array([[ 0, -v[2], v[1]],
[ v[2], 0, -v[0]],
[-v[1], v[0], 0]]) | [
"def",
"ssc",
"(",
"v",
")",
":",
"v",
"/=",
"np",
".",
"linalg",
".",
"norm",
"(",
"v",
")",
"return",
"np",
".",
"array",
"(",
"[",
"[",
"0",
",",
"-",
"v",
"[",
"2",
"]",
",",
"v",
"[",
"1",
"]",
"]",
",",
"[",
"v",
"[",
"2",
"]",
... | https://github.com/tangzhenyu/Scene-Text-Understanding/blob/0f7ffc7aea5971a50cdc03d33d0a41075285948b/SynthText_Chinese/synth_utils.py#L232-L239 | |
wy1iu/LargeMargin_Softmax_Loss | c3e9f20e4f16e2b4daf7d358a614366b9b39a6ec | scripts/cpp_lint.py | python | UpdateIncludeState | (filename, include_state, io=codecs) | return True | Fill up the include_state with new includes found from the file.
Args:
filename: the name of the header to read.
include_state: an _IncludeState instance in which the headers are inserted.
io: The io factory to use to read the file. Provided for testability.
Returns:
True if a header was succesful... | Fill up the include_state with new includes found from the file. | [
"Fill",
"up",
"the",
"include_state",
"with",
"new",
"includes",
"found",
"from",
"the",
"file",
"."
] | def UpdateIncludeState(filename, include_state, io=codecs):
"""Fill up the include_state with new includes found from the file.
Args:
filename: the name of the header to read.
include_state: an _IncludeState instance in which the headers are inserted.
io: The io factory to use to read the file. Provide... | [
"def",
"UpdateIncludeState",
"(",
"filename",
",",
"include_state",
",",
"io",
"=",
"codecs",
")",
":",
"headerfile",
"=",
"None",
"try",
":",
"headerfile",
"=",
"io",
".",
"open",
"(",
"filename",
",",
"'r'",
",",
"'utf8'",
",",
"'replace'",
")",
"excep... | https://github.com/wy1iu/LargeMargin_Softmax_Loss/blob/c3e9f20e4f16e2b4daf7d358a614366b9b39a6ec/scripts/cpp_lint.py#L4454-L4480 | |
oracle/graaljs | 36a56e8e993d45fc40939a3a4d9c0c24990720f1 | graal-nodejs/tools/gyp/pylib/gyp/generator/make.py | python | EscapeMakeVariableExpansion | (s) | return s.replace("$", "$$") | Make has its own variable expansion syntax using $. We must escape it for
string to be interpreted literally. | Make has its own variable expansion syntax using $. We must escape it for
string to be interpreted literally. | [
"Make",
"has",
"its",
"own",
"variable",
"expansion",
"syntax",
"using",
"$",
".",
"We",
"must",
"escape",
"it",
"for",
"string",
"to",
"be",
"interpreted",
"literally",
"."
] | def EscapeMakeVariableExpansion(s):
"""Make has its own variable expansion syntax using $. We must escape it for
string to be interpreted literally."""
return s.replace("$", "$$") | [
"def",
"EscapeMakeVariableExpansion",
"(",
"s",
")",
":",
"return",
"s",
".",
"replace",
"(",
"\"$\"",
",",
"\"$$\"",
")"
] | https://github.com/oracle/graaljs/blob/36a56e8e993d45fc40939a3a4d9c0c24990720f1/graal-nodejs/tools/gyp/pylib/gyp/generator/make.py#L623-L626 | |
aws/lumberyard | f85344403c1c2e77ec8c75deb2c116e97b713217 | dev/Tools/Python/3.7.10/mac/Python.framework/Versions/3.7/lib/python3.7/importlib/_bootstrap_external.py | python | _LoaderBasics.exec_module | (self, module) | Execute the module. | Execute the module. | [
"Execute",
"the",
"module",
"."
] | def exec_module(self, module):
"""Execute the module."""
code = self.get_code(module.__name__)
if code is None:
raise ImportError('cannot load module {!r} when get_code() '
'returns None'.format(module.__name__))
_bootstrap._call_with_frames_remo... | [
"def",
"exec_module",
"(",
"self",
",",
"module",
")",
":",
"code",
"=",
"self",
".",
"get_code",
"(",
"module",
".",
"__name__",
")",
"if",
"code",
"is",
"None",
":",
"raise",
"ImportError",
"(",
"'cannot load module {!r} when get_code() '",
"'returns None'",
... | https://github.com/aws/lumberyard/blob/f85344403c1c2e77ec8c75deb2c116e97b713217/dev/Tools/Python/3.7.10/mac/Python.framework/Versions/3.7/lib/python3.7/importlib/_bootstrap_external.py#L722-L728 | ||
Jack-Cherish/Algorithm | ab3e0f05ff15972f282b6122b73dfa0e84b5960b | Sort Algorithms.py | python | MergeSort | (input_list) | return sorted_list | 函数说明:归并排序(升序)
Website:
http://cuijiahua.com
Parameters:
input_list - 待排序列表
Returns:
sorted_list - 升序排序好的列表 | 函数说明:归并排序(升序)
Website:
http://cuijiahua.com
Parameters:
input_list - 待排序列表
Returns:
sorted_list - 升序排序好的列表 | [
"函数说明",
":",
"归并排序(升序)",
"Website",
":",
"http",
":",
"//",
"cuijiahua",
".",
"com",
"Parameters",
":",
"input_list",
"-",
"待排序列表",
"Returns",
":",
"sorted_list",
"-",
"升序排序好的列表"
] | def MergeSort(input_list):
'''
函数说明:归并排序(升序)
Website:
http://cuijiahua.com
Parameters:
input_list - 待排序列表
Returns:
sorted_list - 升序排序好的列表
'''
def merge(input_list, left, mid, right, temp):
'''
函数说明:合并函数
Website:
http://cuijiahua.com
Parameters:
input_list - 待合并列表
left - 左指针
right - 右指针
... | [
"def",
"MergeSort",
"(",
"input_list",
")",
":",
"def",
"merge",
"(",
"input_list",
",",
"left",
",",
"mid",
",",
"right",
",",
"temp",
")",
":",
"'''\n\t\t函数说明:合并函数\n\t\tWebsite:\n\t\t\thttp://cuijiahua.com\n\t\tParameters:\n\t\t\tinput_list - 待合并列表\n\t\t\tleft - 左指针\n\t\t\t... | https://github.com/Jack-Cherish/Algorithm/blob/ab3e0f05ff15972f282b6122b73dfa0e84b5960b/Sort Algorithms.py#L245-L310 | |
ApolloAuto/apollo-platform | 86d9dc6743b496ead18d597748ebabd34a513289 | ros/ros/roslib/src/roslib/rosenv.py | python | get_test_results_dir | (env=None) | return os.path.join(get_ros_home(env), 'test_results') | Get directory to use for writing test result files. There are multiple
possible locations for this. If ROS_HOME is set ROS_HOME/test_results
is used. Otherwise $HOME/.ros/test_results is used.
@param env: environment dictionary (defaults to os.environ)
@type env: dict
@return: path to use use for ... | Get directory to use for writing test result files. There are multiple
possible locations for this. If ROS_HOME is set ROS_HOME/test_results
is used. Otherwise $HOME/.ros/test_results is used. | [
"Get",
"directory",
"to",
"use",
"for",
"writing",
"test",
"result",
"files",
".",
"There",
"are",
"multiple",
"possible",
"locations",
"for",
"this",
".",
"If",
"ROS_HOME",
"is",
"set",
"ROS_HOME",
"/",
"test_results",
"is",
"used",
".",
"Otherwise",
"$HOME... | def get_test_results_dir(env=None):
"""
Get directory to use for writing test result files. There are multiple
possible locations for this. If ROS_HOME is set ROS_HOME/test_results
is used. Otherwise $HOME/.ros/test_results is used.
@param env: environment dictionary (defaults to os.environ)
@t... | [
"def",
"get_test_results_dir",
"(",
"env",
"=",
"None",
")",
":",
"return",
"os",
".",
"path",
".",
"join",
"(",
"get_ros_home",
"(",
"env",
")",
",",
"'test_results'",
")"
] | https://github.com/ApolloAuto/apollo-platform/blob/86d9dc6743b496ead18d597748ebabd34a513289/ros/ros/roslib/src/roslib/rosenv.py#L188-L199 | |
cvxpy/cvxpy | 5165b4fb750dfd237de8659383ef24b4b2e33aaf | cvxpy/atoms/affine/conj.py | python | conj.is_incr | (self, idx) | return False | Is the composition non-decreasing in argument idx? | Is the composition non-decreasing in argument idx? | [
"Is",
"the",
"composition",
"non",
"-",
"decreasing",
"in",
"argument",
"idx?"
] | def is_incr(self, idx) -> bool:
"""Is the composition non-decreasing in argument idx?
"""
return False | [
"def",
"is_incr",
"(",
"self",
",",
"idx",
")",
"->",
"bool",
":",
"return",
"False"
] | https://github.com/cvxpy/cvxpy/blob/5165b4fb750dfd237de8659383ef24b4b2e33aaf/cvxpy/atoms/affine/conj.py#L42-L45 | |
blackberry/Boost | fc90c3fde129c62565c023f091eddc4a7ed9902b | tools/build/v2/tools/common.py | python | get_absolute_tool_path | (command) | Given an invocation command,
return the absolute path to the command. This works even if commnad
has not path element and is present in PATH. | Given an invocation command,
return the absolute path to the command. This works even if commnad
has not path element and is present in PATH. | [
"Given",
"an",
"invocation",
"command",
"return",
"the",
"absolute",
"path",
"to",
"the",
"command",
".",
"This",
"works",
"even",
"if",
"commnad",
"has",
"not",
"path",
"element",
"and",
"is",
"present",
"in",
"PATH",
"."
] | def get_absolute_tool_path(command):
"""
Given an invocation command,
return the absolute path to the command. This works even if commnad
has not path element and is present in PATH.
"""
if os.path.dirname(command):
return os.path.dirname(command)
else:
programs =... | [
"def",
"get_absolute_tool_path",
"(",
"command",
")",
":",
"if",
"os",
".",
"path",
".",
"dirname",
"(",
"command",
")",
":",
"return",
"os",
".",
"path",
".",
"dirname",
"(",
"command",
")",
"else",
":",
"programs",
"=",
"path",
".",
"programs_path",
... | https://github.com/blackberry/Boost/blob/fc90c3fde129c62565c023f091eddc4a7ed9902b/tools/build/v2/tools/common.py#L340-L355 | ||
wxWidgets/wxPython-Classic | 19571e1ae65f1ac445f5491474121998c97a1bf0 | wx/py/sliceshell.py | python | SlicesShell.quit | (self) | Quit the application. | Quit the application. | [
"Quit",
"the",
"application",
"."
] | def quit(self):
"""Quit the application."""
# XXX Good enough for now but later we want to send a close event.
# In the close event handler we can make sure they want to
# quit. Other applications, like PythonCard, may choose to
# hide rather than quit so we should just post the... | [
"def",
"quit",
"(",
"self",
")",
":",
"# XXX Good enough for now but later we want to send a close event.",
"# In the close event handler we can make sure they want to",
"# quit. Other applications, like PythonCard, may choose to",
"# hide rather than quit so we should just post the event and",
... | https://github.com/wxWidgets/wxPython-Classic/blob/19571e1ae65f1ac445f5491474121998c97a1bf0/wx/py/sliceshell.py#L980-L988 | ||
apache/incubator-mxnet | f03fb23f1d103fec9541b5ae59ee06b1734a51d9 | python/mxnet/ndarray/ndarray.py | python | moveaxis | (tensor, source, destination) | return op.transpose(tensor, order) | Moves the `source` axis into the `destination` position
while leaving the other axes in their original order
Parameters
----------
tensor : mx.nd.array
The array which axes should be reordered
source : int or sequence of int
Original position of the axes to move. Can be negative but... | Moves the `source` axis into the `destination` position
while leaving the other axes in their original order | [
"Moves",
"the",
"source",
"axis",
"into",
"the",
"destination",
"position",
"while",
"leaving",
"the",
"other",
"axes",
"in",
"their",
"original",
"order"
] | def moveaxis(tensor, source, destination):
"""Moves the `source` axis into the `destination` position
while leaving the other axes in their original order
Parameters
----------
tensor : mx.nd.array
The array which axes should be reordered
source : int or sequence of int
Original... | [
"def",
"moveaxis",
"(",
"tensor",
",",
"source",
",",
"destination",
")",
":",
"try",
":",
"source",
"=",
"np",
".",
"core",
".",
"numeric",
".",
"normalize_axis_tuple",
"(",
"source",
",",
"tensor",
".",
"ndim",
")",
"except",
"IndexError",
":",
"raise"... | https://github.com/apache/incubator-mxnet/blob/f03fb23f1d103fec9541b5ae59ee06b1734a51d9/python/mxnet/ndarray/ndarray.py#L3458-L3506 | |
catboost/catboost | 167f64f237114a4d10b2b4ee42adb4569137debe | contrib/python/pandas/py2/pandas/core/series.py | python | Series.rename | (self, index=None, **kwargs) | return super(Series, self).rename(index=index, **kwargs) | Alter Series index labels or name.
Function / dict values must be unique (1-to-1). Labels not contained in
a dict / Series will be left as-is. Extra labels listed don't throw an
error.
Alternatively, change ``Series.name`` with a scalar value.
See the :ref:`user guide <basics.... | Alter Series index labels or name. | [
"Alter",
"Series",
"index",
"labels",
"or",
"name",
"."
] | def rename(self, index=None, **kwargs):
"""
Alter Series index labels or name.
Function / dict values must be unique (1-to-1). Labels not contained in
a dict / Series will be left as-is. Extra labels listed don't throw an
error.
Alternatively, change ``Series.name`` wit... | [
"def",
"rename",
"(",
"self",
",",
"index",
"=",
"None",
",",
"*",
"*",
"kwargs",
")",
":",
"kwargs",
"[",
"'inplace'",
"]",
"=",
"validate_bool_kwarg",
"(",
"kwargs",
".",
"get",
"(",
"'inplace'",
",",
"False",
")",
",",
"'inplace'",
")",
"non_mapping... | https://github.com/catboost/catboost/blob/167f64f237114a4d10b2b4ee42adb4569137debe/contrib/python/pandas/py2/pandas/core/series.py#L3666-L3733 | |
catboost/catboost | 167f64f237114a4d10b2b4ee42adb4569137debe | contrib/python/py/py/_path/local.py | python | LocalPath.pyimport | (self, modname=None, ensuresyspath=True) | return path as an imported python module.
If modname is None, look for the containing package
and construct an according module name.
The module will be put/looked up in sys.modules.
if ensuresyspath is True then the root dir for importing
the file (taking __init__.py files into... | return path as an imported python module. | [
"return",
"path",
"as",
"an",
"imported",
"python",
"module",
"."
] | def pyimport(self, modname=None, ensuresyspath=True):
""" return path as an imported python module.
If modname is None, look for the containing package
and construct an according module name.
The module will be put/looked up in sys.modules.
if ensuresyspath is True then the root... | [
"def",
"pyimport",
"(",
"self",
",",
"modname",
"=",
"None",
",",
"ensuresyspath",
"=",
"True",
")",
":",
"if",
"not",
"self",
".",
"check",
"(",
")",
":",
"raise",
"py",
".",
"error",
".",
"ENOENT",
"(",
"self",
")",
"if",
"ensuresyspath",
"==",
"... | https://github.com/catboost/catboost/blob/167f64f237114a4d10b2b4ee42adb4569137debe/contrib/python/py/py/_path/local.py#L649-L740 | ||
ricardoquesada/Spidermonkey | 4a75ea2543408bd1b2c515aa95901523eeef7858 | ipc/ipdl/ipdl/parser.py | python | p_Trigger | (p) | Trigger : SEND
| RECV
| CALL
| ANSWER | Trigger : SEND
| RECV
| CALL
| ANSWER | [
"Trigger",
":",
"SEND",
"|",
"RECV",
"|",
"CALL",
"|",
"ANSWER"
] | def p_Trigger(p):
"""Trigger : SEND
| RECV
| CALL
| ANSWER"""
p[0] = [ locFromTok(p, 1), Transition.nameToTrigger(p[1]) ] | [
"def",
"p_Trigger",
"(",
"p",
")",
":",
"p",
"[",
"0",
"]",
"=",
"[",
"locFromTok",
"(",
"p",
",",
"1",
")",
",",
"Transition",
".",
"nameToTrigger",
"(",
"p",
"[",
"1",
"]",
")",
"]"
] | https://github.com/ricardoquesada/Spidermonkey/blob/4a75ea2543408bd1b2c515aa95901523eeef7858/ipc/ipdl/ipdl/parser.py#L596-L601 | ||
MythTV/mythtv | d282a209cb8be85d036f85a62a8ec971b67d45f4 | mythtv/contrib/imports/mirobridge/mirobridge/mirobridge_interpreter_2_0_3.py | python | MiroInterpreter.do_playlist | (self, line) | playlist <name> -- Selects a playlist. | playlist <name> -- Selects a playlist. | [
"playlist",
"<name",
">",
"--",
"Selects",
"a",
"playlist",
"."
] | def do_playlist(self, line):
"""playlist <name> -- Selects a playlist."""
for tab in self.playlistTabs.getView():
if tab.obj.get_title() == line:
self.tab = tab
self.tab_changed()
return
print "Error: %s not found" % line | [
"def",
"do_playlist",
"(",
"self",
",",
"line",
")",
":",
"for",
"tab",
"in",
"self",
".",
"playlistTabs",
".",
"getView",
"(",
")",
":",
"if",
"tab",
".",
"obj",
".",
"get_title",
"(",
")",
"==",
"line",
":",
"self",
".",
"tab",
"=",
"tab",
"sel... | https://github.com/MythTV/mythtv/blob/d282a209cb8be85d036f85a62a8ec971b67d45f4/mythtv/contrib/imports/mirobridge/mirobridge/mirobridge_interpreter_2_0_3.py#L488-L495 | ||
NVIDIAGameWorks/kaolin | e5148d05e9c1e2ce92a07881ce3593b1c5c3f166 | kaolin/io/usd.py | python | export_mesh | (file_path, scene_path='/World/Meshes/mesh_0', vertices=None, faces=None,
uvs=None, face_uvs_idx=None, face_normals=None, materials_order=None, materials=None,
up_axis='Y', time=None) | return stage | r"""Export a single mesh to USD.
Export a single mesh defined by vertices and faces and save the stage to disk.
Args:
file_path (str): Path to usd file (\*.usd, \*.usda).
scene_path (str, optional): Absolute path of mesh within the USD file scene. Must be a valid ``Sdf.Path``.
If n... | r"""Export a single mesh to USD. | [
"r",
"Export",
"a",
"single",
"mesh",
"to",
"USD",
"."
] | def export_mesh(file_path, scene_path='/World/Meshes/mesh_0', vertices=None, faces=None,
uvs=None, face_uvs_idx=None, face_normals=None, materials_order=None, materials=None,
up_axis='Y', time=None):
r"""Export a single mesh to USD.
Export a single mesh defined by vertices and f... | [
"def",
"export_mesh",
"(",
"file_path",
",",
"scene_path",
"=",
"'/World/Meshes/mesh_0'",
",",
"vertices",
"=",
"None",
",",
"faces",
"=",
"None",
",",
"uvs",
"=",
"None",
",",
"face_uvs_idx",
"=",
"None",
",",
"face_normals",
"=",
"None",
",",
"materials_or... | https://github.com/NVIDIAGameWorks/kaolin/blob/e5148d05e9c1e2ce92a07881ce3593b1c5c3f166/kaolin/io/usd.py#L689-L733 | |
aws/lumberyard | f85344403c1c2e77ec8c75deb2c116e97b713217 | dev/Tools/Python/3.7.10/windows/Lib/site-packages/pip/_vendor/urllib3/response.py | python | HTTPResponse.read | (self, amt=None, decode_content=None, cache_content=False) | return data | Similar to :meth:`http.client.HTTPResponse.read`, but with two additional
parameters: ``decode_content`` and ``cache_content``.
:param amt:
How much of the content to read. If specified, caching is skipped
because it doesn't make sense to cache partial content as the full
... | Similar to :meth:`http.client.HTTPResponse.read`, but with two additional
parameters: ``decode_content`` and ``cache_content``. | [
"Similar",
"to",
":",
"meth",
":",
"http",
".",
"client",
".",
"HTTPResponse",
".",
"read",
"but",
"with",
"two",
"additional",
"parameters",
":",
"decode_content",
"and",
"cache_content",
"."
] | def read(self, amt=None, decode_content=None, cache_content=False):
"""
Similar to :meth:`http.client.HTTPResponse.read`, but with two additional
parameters: ``decode_content`` and ``cache_content``.
:param amt:
How much of the content to read. If specified, caching is skipp... | [
"def",
"read",
"(",
"self",
",",
"amt",
"=",
"None",
",",
"decode_content",
"=",
"None",
",",
"cache_content",
"=",
"False",
")",
":",
"self",
".",
"_init_decoder",
"(",
")",
"if",
"decode_content",
"is",
"None",
":",
"decode_content",
"=",
"self",
".",
... | https://github.com/aws/lumberyard/blob/f85344403c1c2e77ec8c75deb2c116e97b713217/dev/Tools/Python/3.7.10/windows/Lib/site-packages/pip/_vendor/urllib3/response.py#L481-L553 | |
htcondor/htcondor | 4829724575176d1d6c936e4693dfd78a728569b0 | src/condor_contrib/condor_pigeon/src/condor_pigeon_client/skype_linux_tools/Skype4Py/skype.py | python | ISkypeEvents.Reply | (self, Command) | This event is triggered when the API replies to a command object.
@param Command: Command object.
@type Command: L{ICommand} | This event is triggered when the API replies to a command object. | [
"This",
"event",
"is",
"triggered",
"when",
"the",
"API",
"replies",
"to",
"a",
"command",
"object",
"."
] | def Reply(self, Command):
'''This event is triggered when the API replies to a command object.
@param Command: Command object.
@type Command: L{ICommand}
''' | [
"def",
"Reply",
"(",
"self",
",",
"Command",
")",
":"
] | https://github.com/htcondor/htcondor/blob/4829724575176d1d6c936e4693dfd78a728569b0/src/condor_contrib/condor_pigeon/src/condor_pigeon_client/skype_linux_tools/Skype4Py/skype.py#L1625-L1630 | ||
crosslife/OpenBird | 9e0198a1a2295f03fa1e8676e216e22c9c7d380b | cocos2d/tools/bindings-generator/clang/cindex.py | python | SourceLocation.file | (self) | return self._get_instantiation()[0] | Get the file represented by this source location. | Get the file represented by this source location. | [
"Get",
"the",
"file",
"represented",
"by",
"this",
"source",
"location",
"."
] | def file(self):
"""Get the file represented by this source location."""
return self._get_instantiation()[0] | [
"def",
"file",
"(",
"self",
")",
":",
"return",
"self",
".",
"_get_instantiation",
"(",
")",
"[",
"0",
"]"
] | https://github.com/crosslife/OpenBird/blob/9e0198a1a2295f03fa1e8676e216e22c9c7d380b/cocos2d/tools/bindings-generator/clang/cindex.py#L198-L200 | |
aws/lumberyard | f85344403c1c2e77ec8c75deb2c116e97b713217 | dev/Tools/Python/3.7.10/mac/Python.framework/Versions/3.7/lib/python3.7/site-packages/boto3/s3/inject.py | python | copy | (self, CopySource, Bucket, Key, ExtraArgs=None, Callback=None,
SourceClient=None, Config=None) | Copy an object from one S3 location to another.
This is a managed transfer which will perform a multipart copy in
multiple threads if necessary.
Usage::
import boto3
s3 = boto3.resource('s3')
copy_source = {
'Bucket': 'mybucket',
'Key': 'mykey'
}
... | Copy an object from one S3 location to another. | [
"Copy",
"an",
"object",
"from",
"one",
"S3",
"location",
"to",
"another",
"."
] | def copy(self, CopySource, Bucket, Key, ExtraArgs=None, Callback=None,
SourceClient=None, Config=None):
"""Copy an object from one S3 location to another.
This is a managed transfer which will perform a multipart copy in
multiple threads if necessary.
Usage::
import boto3
s3 ... | [
"def",
"copy",
"(",
"self",
",",
"CopySource",
",",
"Bucket",
",",
"Key",
",",
"ExtraArgs",
"=",
"None",
",",
"Callback",
"=",
"None",
",",
"SourceClient",
"=",
"None",
",",
"Config",
"=",
"None",
")",
":",
"subscribers",
"=",
"None",
"if",
"Callback",... | https://github.com/aws/lumberyard/blob/f85344403c1c2e77ec8c75deb2c116e97b713217/dev/Tools/Python/3.7.10/mac/Python.framework/Versions/3.7/lib/python3.7/site-packages/boto3/s3/inject.py#L317-L379 | ||
dmlc/xgboost | 2775c2a1abd4b5b759ff517617434c8b9aeb4cc0 | python-package/xgboost/core.py | python | Booster.set_attr | (self, **kwargs: Optional[str]) | Set the attribute of the Booster.
Parameters
----------
**kwargs
The attributes to set. Setting a value to None deletes an attribute. | Set the attribute of the Booster. | [
"Set",
"the",
"attribute",
"of",
"the",
"Booster",
"."
] | def set_attr(self, **kwargs: Optional[str]) -> None:
"""Set the attribute of the Booster.
Parameters
----------
**kwargs
The attributes to set. Setting a value to None deletes an attribute.
"""
for key, value in kwargs.items():
if value is not Non... | [
"def",
"set_attr",
"(",
"self",
",",
"*",
"*",
"kwargs",
":",
"Optional",
"[",
"str",
"]",
")",
"->",
"None",
":",
"for",
"key",
",",
"value",
"in",
"kwargs",
".",
"items",
"(",
")",
":",
"if",
"value",
"is",
"not",
"None",
":",
"if",
"not",
"i... | https://github.com/dmlc/xgboost/blob/2775c2a1abd4b5b759ff517617434c8b9aeb4cc0/python-package/xgboost/core.py#L1583-L1597 | ||
trailofbits/llvm-sanitizer-tutorial | d29dfeec7f51fbf234fd0080f28f2b30cd0b6e99 | llvm/tools/clang/bindings/python/clang/cindex.py | python | TypeKind.spelling | (self) | return conf.lib.clang_getTypeKindSpelling(self.value) | Retrieve the spelling of this TypeKind. | Retrieve the spelling of this TypeKind. | [
"Retrieve",
"the",
"spelling",
"of",
"this",
"TypeKind",
"."
] | def spelling(self):
"""Retrieve the spelling of this TypeKind."""
return conf.lib.clang_getTypeKindSpelling(self.value) | [
"def",
"spelling",
"(",
"self",
")",
":",
"return",
"conf",
".",
"lib",
".",
"clang_getTypeKindSpelling",
"(",
"self",
".",
"value",
")"
] | https://github.com/trailofbits/llvm-sanitizer-tutorial/blob/d29dfeec7f51fbf234fd0080f28f2b30cd0b6e99/llvm/tools/clang/bindings/python/clang/cindex.py#L2020-L2022 | |
weolar/miniblink49 | 1c4678db0594a4abde23d3ebbcc7cd13c3170777 | third_party/WebKit/Source/bindings/scripts/code_generator_v8.py | python | CodeGeneratorBase.generate_code | (self, definitions, definition_name) | return self.generate_code_internal(definitions, definition_name) | Returns .h/.cpp code as ((path, content)...). | Returns .h/.cpp code as ((path, content)...). | [
"Returns",
".",
"h",
"/",
".",
"cpp",
"code",
"as",
"((",
"path",
"content",
")",
"...",
")",
"."
] | def generate_code(self, definitions, definition_name):
"""Returns .h/.cpp code as ((path, content)...)."""
# Set local type info
if not should_generate_code(definitions):
return set()
IdlType.set_callback_functions(definitions.callback_functions.keys())
# Resolve typ... | [
"def",
"generate_code",
"(",
"self",
",",
"definitions",
",",
"definition_name",
")",
":",
"# Set local type info",
"if",
"not",
"should_generate_code",
"(",
"definitions",
")",
":",
"return",
"set",
"(",
")",
"IdlType",
".",
"set_callback_functions",
"(",
"defini... | https://github.com/weolar/miniblink49/blob/1c4678db0594a4abde23d3ebbcc7cd13c3170777/third_party/WebKit/Source/bindings/scripts/code_generator_v8.py#L185-L194 | |
wxWidgets/wxPython-Classic | 19571e1ae65f1ac445f5491474121998c97a1bf0 | demo/DelayedResult.py | python | FrameSimpleDelayed.handleClose | (self, event) | Only needed because in demo, closing the window does not kill the
app, so worker thread continues and sends result to dead frame; normally
your app would exit so this would not happen. | Only needed because in demo, closing the window does not kill the
app, so worker thread continues and sends result to dead frame; normally
your app would exit so this would not happen. | [
"Only",
"needed",
"because",
"in",
"demo",
"closing",
"the",
"window",
"does",
"not",
"kill",
"the",
"app",
"so",
"worker",
"thread",
"continues",
"and",
"sends",
"result",
"to",
"dead",
"frame",
";",
"normally",
"your",
"app",
"would",
"exit",
"so",
"this... | def handleClose(self, event):
"""Only needed because in demo, closing the window does not kill the
app, so worker thread continues and sends result to dead frame; normally
your app would exit so this would not happen."""
if self.buttonAbort.IsEnabled():
self.log( "Exiting: A... | [
"def",
"handleClose",
"(",
"self",
",",
"event",
")",
":",
"if",
"self",
".",
"buttonAbort",
".",
"IsEnabled",
"(",
")",
":",
"self",
".",
"log",
"(",
"\"Exiting: Aborting job %s\"",
"%",
"self",
".",
"jobID",
")",
"self",
".",
"abortEvent",
".",
"set",
... | https://github.com/wxWidgets/wxPython-Classic/blob/19571e1ae65f1ac445f5491474121998c97a1bf0/demo/DelayedResult.py#L66-L73 | ||
ouster-lidar/ouster_example | 13ea8e8b8a4951fb630dbc9108666995c8443bf6 | python/src/ouster/client/data.py | python | LidarPacket.header | (self, header: ColHeader) | return res | Create a view of the specified column header.
This method is deprecated. Use the ``timestamp``, ``measurement_id`` or
``status`` properties instead.
Args:
header: The column header to parse
Returns:
A numpy array containing a copy of the specified header values | Create a view of the specified column header. | [
"Create",
"a",
"view",
"of",
"the",
"specified",
"column",
"header",
"."
] | def header(self, header: ColHeader) -> np.ndarray:
"""Create a view of the specified column header.
This method is deprecated. Use the ``timestamp``, ``measurement_id`` or
``status`` properties instead.
Args:
header: The column header to parse
Returns:
... | [
"def",
"header",
"(",
"self",
",",
"header",
":",
"ColHeader",
")",
"->",
"np",
".",
"ndarray",
":",
"warnings",
".",
"warn",
"(",
"\"LidarPacket.header is deprecated\"",
",",
"DeprecationWarning",
")",
"res",
"=",
"self",
".",
"_pf",
".",
"packet_header",
"... | https://github.com/ouster-lidar/ouster_example/blob/13ea8e8b8a4951fb630dbc9108666995c8443bf6/python/src/ouster/client/data.py#L196-L212 | |
benoitsteiner/tensorflow-opencl | cb7cb40a57fde5cfd4731bc551e82a1e2fef43a5 | tensorflow/python/ops/tensor_array_ops.py | python | TensorArray.__init__ | (self,
dtype,
size=None,
dynamic_size=None,
clear_after_read=None,
tensor_array_name=None,
handle=None,
flow=None,
infer_shape=True,
element_shape=None,
colocate_with_fir... | Construct a new TensorArray or wrap an existing TensorArray handle.
A note about the parameter `name`:
The name of the `TensorArray` (even if passed in) is uniquified: each time
a new `TensorArray` is created at runtime it is assigned its own name for
the duration of the run. This avoids name collisi... | Construct a new TensorArray or wrap an existing TensorArray handle. | [
"Construct",
"a",
"new",
"TensorArray",
"or",
"wrap",
"an",
"existing",
"TensorArray",
"handle",
"."
] | def __init__(self,
dtype,
size=None,
dynamic_size=None,
clear_after_read=None,
tensor_array_name=None,
handle=None,
flow=None,
infer_shape=True,
element_shape=None,
coloc... | [
"def",
"__init__",
"(",
"self",
",",
"dtype",
",",
"size",
"=",
"None",
",",
"dynamic_size",
"=",
"None",
",",
"clear_after_read",
"=",
"None",
",",
"tensor_array_name",
"=",
"None",
",",
"handle",
"=",
"None",
",",
"flow",
"=",
"None",
",",
"infer_shape... | https://github.com/benoitsteiner/tensorflow-opencl/blob/cb7cb40a57fde5cfd4731bc551e82a1e2fef43a5/tensorflow/python/ops/tensor_array_ops.py#L48-L169 | ||
BlzFans/wke | b0fa21158312e40c5fbd84682d643022b6c34a93 | cygwin/lib/python2.6/nntplib.py | python | NNTP.quit | (self) | return resp | Process a QUIT command and close the socket. Returns:
- resp: server response if successful | Process a QUIT command and close the socket. Returns:
- resp: server response if successful | [
"Process",
"a",
"QUIT",
"command",
"and",
"close",
"the",
"socket",
".",
"Returns",
":",
"-",
"resp",
":",
"server",
"response",
"if",
"successful"
] | def quit(self):
"""Process a QUIT command and close the socket. Returns:
- resp: server response if successful"""
resp = self.shortcmd('QUIT')
self.file.close()
self.sock.close()
del self.file, self.sock
return resp | [
"def",
"quit",
"(",
"self",
")",
":",
"resp",
"=",
"self",
".",
"shortcmd",
"(",
"'QUIT'",
")",
"self",
".",
"file",
".",
"close",
"(",
")",
"self",
".",
"sock",
".",
"close",
"(",
")",
"del",
"self",
".",
"file",
",",
"self",
".",
"sock",
"ret... | https://github.com/BlzFans/wke/blob/b0fa21158312e40c5fbd84682d643022b6c34a93/cygwin/lib/python2.6/nntplib.py#L595-L603 | |
Xilinx/Vitis-AI | fc74d404563d9951b57245443c73bef389f3657f | tools/Vitis-AI-Quantizer/vai_q_tensorflow1.x/tensorflow/python/ops/variables.py | python | RefVariable.op | (self) | return self._variable.op | The `Operation` of this variable. | The `Operation` of this variable. | [
"The",
"Operation",
"of",
"this",
"variable",
"."
] | def op(self):
"""The `Operation` of this variable."""
return self._variable.op | [
"def",
"op",
"(",
"self",
")",
":",
"return",
"self",
".",
"_variable",
".",
"op"
] | https://github.com/Xilinx/Vitis-AI/blob/fc74d404563d9951b57245443c73bef389f3657f/tools/Vitis-AI-Quantizer/vai_q_tensorflow1.x/tensorflow/python/ops/variables.py#L2568-L2570 | |
apple/swift-clang | d7403439fc6641751840b723e7165fb02f52db95 | tools/scan-build-py/libscanbuild/analyze.py | python | run_analyzer_parallel | (args) | Runs the analyzer against the given compilation database. | Runs the analyzer against the given compilation database. | [
"Runs",
"the",
"analyzer",
"against",
"the",
"given",
"compilation",
"database",
"."
] | def run_analyzer_parallel(args):
""" Runs the analyzer against the given compilation database. """
def exclude(filename):
""" Return true when any excluded directory prefix the filename. """
return any(re.match(r'^' + directory, filename)
for directory in args.excludes)
... | [
"def",
"run_analyzer_parallel",
"(",
"args",
")",
":",
"def",
"exclude",
"(",
"filename",
")",
":",
"\"\"\" Return true when any excluded directory prefix the filename. \"\"\"",
"return",
"any",
"(",
"re",
".",
"match",
"(",
"r'^'",
"+",
"directory",
",",
"filename",
... | https://github.com/apple/swift-clang/blob/d7403439fc6641751840b723e7165fb02f52db95/tools/scan-build-py/libscanbuild/analyze.py#L206-L236 | ||
aws/lumberyard | f85344403c1c2e77ec8c75deb2c116e97b713217 | dev/Gems/CloudGemFramework/v1/ResourceManager/lib/Crypto/Util/asn1.py | python | DerSetOf.__init__ | (self, startSet=None, implicit=None) | Initialize the DER object as a SET OF.
:Parameters:
startSet : container
The initial set of integers or DER encoded objects.
implicit : integer
The IMPLICIT tag to use for the encoded object.
It overrides the universal tag for SET OF (17). | Initialize the DER object as a SET OF. | [
"Initialize",
"the",
"DER",
"object",
"as",
"a",
"SET",
"OF",
"."
] | def __init__(self, startSet=None, implicit=None):
"""Initialize the DER object as a SET OF.
:Parameters:
startSet : container
The initial set of integers or DER encoded objects.
implicit : integer
The IMPLICIT tag to use for the encoded object.
It... | [
"def",
"__init__",
"(",
"self",
",",
"startSet",
"=",
"None",
",",
"implicit",
"=",
"None",
")",
":",
"DerObject",
".",
"__init__",
"(",
"self",
",",
"0x11",
",",
"b''",
",",
"implicit",
",",
"True",
")",
"self",
".",
"_seq",
"=",
"[",
"]",
"# All ... | https://github.com/aws/lumberyard/blob/f85344403c1c2e77ec8c75deb2c116e97b713217/dev/Gems/CloudGemFramework/v1/ResourceManager/lib/Crypto/Util/asn1.py#L818-L837 | ||
apiaryio/drafter | 4634ebd07f6c6f257cc656598ccd535492fdfb55 | tools/gyp/pylib/gyp/common.py | python | DeepDependencyTargets | (target_dicts, roots) | return list(dependencies - set(roots)) | Returns the recursive list of target dependencies. | Returns the recursive list of target dependencies. | [
"Returns",
"the",
"recursive",
"list",
"of",
"target",
"dependencies",
"."
] | def DeepDependencyTargets(target_dicts, roots):
"""Returns the recursive list of target dependencies."""
dependencies = set()
pending = set(roots)
while pending:
# Pluck out one.
r = pending.pop()
# Skip if visited already.
if r in dependencies:
continue
# Add it.
dependencies.add(... | [
"def",
"DeepDependencyTargets",
"(",
"target_dicts",
",",
"roots",
")",
":",
"dependencies",
"=",
"set",
"(",
")",
"pending",
"=",
"set",
"(",
"roots",
")",
"while",
"pending",
":",
"# Pluck out one.",
"r",
"=",
"pending",
".",
"pop",
"(",
")",
"# Skip if ... | https://github.com/apiaryio/drafter/blob/4634ebd07f6c6f257cc656598ccd535492fdfb55/tools/gyp/pylib/gyp/common.py#L296-L312 | |
aws/lumberyard | f85344403c1c2e77ec8c75deb2c116e97b713217 | dev/Tools/Python/3.7.10/windows/Lib/threading.py | python | Barrier.abort | (self) | Place the barrier into a 'broken' state.
Useful in case of error. Any currently waiting threads and threads
attempting to 'wait()' will have BrokenBarrierError raised. | Place the barrier into a 'broken' state. | [
"Place",
"the",
"barrier",
"into",
"a",
"broken",
"state",
"."
] | def abort(self):
"""Place the barrier into a 'broken' state.
Useful in case of error. Any currently waiting threads and threads
attempting to 'wait()' will have BrokenBarrierError raised.
"""
with self._cond:
self._break() | [
"def",
"abort",
"(",
"self",
")",
":",
"with",
"self",
".",
"_cond",
":",
"self",
".",
"_break",
"(",
")"
] | https://github.com/aws/lumberyard/blob/f85344403c1c2e77ec8c75deb2c116e97b713217/dev/Tools/Python/3.7.10/windows/Lib/threading.py#L685-L693 | ||
hughperkins/tf-coriander | 970d3df6c11400ad68405f22b0c42a52374e94ca | tensorflow/python/ops/rnn.py | python | _dynamic_rnn_loop | (cell,
inputs,
initial_state,
parallel_iterations,
swap_memory,
sequence_length=None,
dtype=None) | return (final_outputs, final_state) | Internal implementation of Dynamic RNN.
Args:
cell: An instance of RNNCell.
inputs: A `Tensor` of shape [time, batch_size, input_size], or a nested
tuple of such elements.
initial_state: A `Tensor` of shape `[batch_size, state_size]`, or if
`cell.state_size` is a tuple, then this should be a ... | Internal implementation of Dynamic RNN. | [
"Internal",
"implementation",
"of",
"Dynamic",
"RNN",
"."
] | def _dynamic_rnn_loop(cell,
inputs,
initial_state,
parallel_iterations,
swap_memory,
sequence_length=None,
dtype=None):
"""Internal implementation of Dynamic RNN.
Args:
cell: An i... | [
"def",
"_dynamic_rnn_loop",
"(",
"cell",
",",
"inputs",
",",
"initial_state",
",",
"parallel_iterations",
",",
"swap_memory",
",",
"sequence_length",
"=",
"None",
",",
"dtype",
"=",
"None",
")",
":",
"state",
"=",
"initial_state",
"assert",
"isinstance",
"(",
... | https://github.com/hughperkins/tf-coriander/blob/970d3df6c11400ad68405f22b0c42a52374e94ca/tensorflow/python/ops/rnn.py#L864-L1029 | |
aws/lumberyard | f85344403c1c2e77ec8c75deb2c116e97b713217 | dev/Tools/AWSPythonSDK/1.5.8/docutils/utils/math/math2html.py | python | LimitsProcessor.checklimits | (self, contents, index) | return self.checkscript(contents, index + 1) | Check if the current position has a limits command. | Check if the current position has a limits command. | [
"Check",
"if",
"the",
"current",
"position",
"has",
"a",
"limits",
"command",
"."
] | def checklimits(self, contents, index):
"Check if the current position has a limits command."
if not DocumentParameters.displaymode:
return False
if self.checkcommand(contents, index + 1, LimitPreviousCommand):
self.limitsahead(contents, index)
return False
if not isinstance(contents[i... | [
"def",
"checklimits",
"(",
"self",
",",
"contents",
",",
"index",
")",
":",
"if",
"not",
"DocumentParameters",
".",
"displaymode",
":",
"return",
"False",
"if",
"self",
".",
"checkcommand",
"(",
"contents",
",",
"index",
"+",
"1",
",",
"LimitPreviousCommand"... | https://github.com/aws/lumberyard/blob/f85344403c1c2e77ec8c75deb2c116e97b713217/dev/Tools/AWSPythonSDK/1.5.8/docutils/utils/math/math2html.py#L4677-L4686 | |
bh107/bohrium | 5b83e7117285fefc7779ed0e9acb0f8e74c7e068 | bridge/npbackend/bohrium/user_kernel.py | python | gen_function_prototype | (operand_list, operand_name_list=None) | return "%s)\n" % ret[:-2] | Returns the `execute() definition based on the arrays in `operand_list` | Returns the `execute() definition based on the arrays in `operand_list` | [
"Returns",
"the",
"execute",
"()",
"definition",
"based",
"on",
"the",
"arrays",
"in",
"operand_list"
] | def gen_function_prototype(operand_list, operand_name_list=None):
""" Returns the `execute() definition based on the arrays in `operand_list` """
dtype_list = [dtype_to_c99(t.dtype) for t in operand_list]
ret = "#include <stdint.h>\n#include <complex.h>\n"
ret += "void execute("
for i in range(len(d... | [
"def",
"gen_function_prototype",
"(",
"operand_list",
",",
"operand_name_list",
"=",
"None",
")",
":",
"dtype_list",
"=",
"[",
"dtype_to_c99",
"(",
"t",
".",
"dtype",
")",
"for",
"t",
"in",
"operand_list",
"]",
"ret",
"=",
"\"#include <stdint.h>\\n#include <comple... | https://github.com/bh107/bohrium/blob/5b83e7117285fefc7779ed0e9acb0f8e74c7e068/bridge/npbackend/bohrium/user_kernel.py#L106-L117 | |
catboost/catboost | 167f64f237114a4d10b2b4ee42adb4569137debe | contrib/python/Jinja2/py2/jinja2/lexer.py | python | describe_token_expr | (expr) | return _describe_token_type(type) | Like `describe_token` but for token expressions. | Like `describe_token` but for token expressions. | [
"Like",
"describe_token",
"but",
"for",
"token",
"expressions",
"."
] | def describe_token_expr(expr):
"""Like `describe_token` but for token expressions."""
if ":" in expr:
type, value = expr.split(":", 1)
if type == TOKEN_NAME:
return value
else:
type = expr
return _describe_token_type(type) | [
"def",
"describe_token_expr",
"(",
"expr",
")",
":",
"if",
"\":\"",
"in",
"expr",
":",
"type",
",",
"value",
"=",
"expr",
".",
"split",
"(",
"\":\"",
",",
"1",
")",
"if",
"type",
"==",
"TOKEN_NAME",
":",
"return",
"value",
"else",
":",
"type",
"=",
... | https://github.com/catboost/catboost/blob/167f64f237114a4d10b2b4ee42adb4569137debe/contrib/python/Jinja2/py2/jinja2/lexer.py#L187-L195 | |
GoSSIP-SJTU/Armariris | ad5d868482956b2194a77b39c8d543c7c2318200 | bindings/python/llvm/object.py | python | ObjectFile.get_sections | (self, cache=False) | Obtain the sections in this object file.
This is a generator for llvm.object.Section instances.
Sections are exposed as limited-use objects. See the module's
documentation on iterators for more. | Obtain the sections in this object file. | [
"Obtain",
"the",
"sections",
"in",
"this",
"object",
"file",
"."
] | def get_sections(self, cache=False):
"""Obtain the sections in this object file.
This is a generator for llvm.object.Section instances.
Sections are exposed as limited-use objects. See the module's
documentation on iterators for more.
"""
sections = lib.LLVMGetSections(... | [
"def",
"get_sections",
"(",
"self",
",",
"cache",
"=",
"False",
")",
":",
"sections",
"=",
"lib",
".",
"LLVMGetSections",
"(",
"self",
")",
"last",
"=",
"None",
"while",
"True",
":",
"if",
"lib",
".",
"LLVMIsSectionIteratorAtEnd",
"(",
"self",
",",
"sect... | https://github.com/GoSSIP-SJTU/Armariris/blob/ad5d868482956b2194a77b39c8d543c7c2318200/bindings/python/llvm/object.py#L123-L149 | ||
benoitsteiner/tensorflow-opencl | cb7cb40a57fde5cfd4731bc551e82a1e2fef43a5 | tensorflow/python/debug/cli/base_ui.py | python | BaseUI.__init__ | (self, on_ui_exit=None, config=None) | Constructor of the base class.
Args:
on_ui_exit: (`Callable`) the callback to be called when the UI exits.
config: An instance of `cli_config.CLIConfig()` carrying user-facing
configurations. | Constructor of the base class. | [
"Constructor",
"of",
"the",
"base",
"class",
"."
] | def __init__(self, on_ui_exit=None, config=None):
"""Constructor of the base class.
Args:
on_ui_exit: (`Callable`) the callback to be called when the UI exits.
config: An instance of `cli_config.CLIConfig()` carrying user-facing
configurations.
"""
self._on_ui_exit = on_ui_exit
... | [
"def",
"__init__",
"(",
"self",
",",
"on_ui_exit",
"=",
"None",
",",
"config",
"=",
"None",
")",
":",
"self",
".",
"_on_ui_exit",
"=",
"on_ui_exit",
"self",
".",
"_command_handler_registry",
"=",
"(",
"debugger_cli_common",
".",
"CommandHandlerRegistry",
"(",
... | https://github.com/benoitsteiner/tensorflow-opencl/blob/cb7cb40a57fde5cfd4731bc551e82a1e2fef43a5/tensorflow/python/debug/cli/base_ui.py#L35-L70 | ||
aws/lumberyard | f85344403c1c2e77ec8c75deb2c116e97b713217 | dev/Gems/CloudGemMetric/v1/AWS/python/windows/Lib/psutil/_pswindows.py | python | py2_strencode | (s) | Encode a unicode string to a byte string by using the default fs
encoding + "replace" error handler. | Encode a unicode string to a byte string by using the default fs
encoding + "replace" error handler. | [
"Encode",
"a",
"unicode",
"string",
"to",
"a",
"byte",
"string",
"by",
"using",
"the",
"default",
"fs",
"encoding",
"+",
"replace",
"error",
"handler",
"."
] | def py2_strencode(s):
"""Encode a unicode string to a byte string by using the default fs
encoding + "replace" error handler.
"""
if PY3:
return s
else:
if isinstance(s, str):
return s
else:
return s.encode(ENCODING, ENCODING_ERRS) | [
"def",
"py2_strencode",
"(",
"s",
")",
":",
"if",
"PY3",
":",
"return",
"s",
"else",
":",
"if",
"isinstance",
"(",
"s",
",",
"str",
")",
":",
"return",
"s",
"else",
":",
"return",
"s",
".",
"encode",
"(",
"ENCODING",
",",
"ENCODING_ERRS",
")"
] | https://github.com/aws/lumberyard/blob/f85344403c1c2e77ec8c75deb2c116e97b713217/dev/Gems/CloudGemMetric/v1/AWS/python/windows/Lib/psutil/_pswindows.py#L205-L215 | ||
wxWidgets/wxPython-Classic | 19571e1ae65f1ac445f5491474121998c97a1bf0 | contrib/gizmos/gtk/gizmos.py | python | TreeListCtrl.GetChildrenCount | (*args, **kwargs) | return _gizmos.TreeListCtrl_GetChildrenCount(*args, **kwargs) | GetChildrenCount(self, TreeItemId item, bool recursively=True) -> size_t | GetChildrenCount(self, TreeItemId item, bool recursively=True) -> size_t | [
"GetChildrenCount",
"(",
"self",
"TreeItemId",
"item",
"bool",
"recursively",
"=",
"True",
")",
"-",
">",
"size_t"
] | def GetChildrenCount(*args, **kwargs):
"""GetChildrenCount(self, TreeItemId item, bool recursively=True) -> size_t"""
return _gizmos.TreeListCtrl_GetChildrenCount(*args, **kwargs) | [
"def",
"GetChildrenCount",
"(",
"*",
"args",
",",
"*",
"*",
"kwargs",
")",
":",
"return",
"_gizmos",
".",
"TreeListCtrl_GetChildrenCount",
"(",
"*",
"args",
",",
"*",
"*",
"kwargs",
")"
] | https://github.com/wxWidgets/wxPython-Classic/blob/19571e1ae65f1ac445f5491474121998c97a1bf0/contrib/gizmos/gtk/gizmos.py#L742-L744 | |
pytorch/pytorch | 7176c92687d3cc847cc046bf002269c6949a21c2 | torch/distributed/algorithms/ddp_comm_hooks/default_hooks.py | python | _allreduce_fut | (
process_group: dist.ProcessGroup, tensor: torch.Tensor
) | return (
dist.all_reduce(tensor, group=group_to_use, async_op=True)
.get_future()
.then(lambda fut: fut.value()[0])
) | Averages the input gradient tensor by allreduce and returns a future. | Averages the input gradient tensor by allreduce and returns a future. | [
"Averages",
"the",
"input",
"gradient",
"tensor",
"by",
"allreduce",
"and",
"returns",
"a",
"future",
"."
] | def _allreduce_fut(
process_group: dist.ProcessGroup, tensor: torch.Tensor
) -> torch.futures.Future[torch.Tensor]:
"Averages the input gradient tensor by allreduce and returns a future."
group_to_use = process_group if process_group is not None else dist.group.WORLD
# Apply the division first to avoid... | [
"def",
"_allreduce_fut",
"(",
"process_group",
":",
"dist",
".",
"ProcessGroup",
",",
"tensor",
":",
"torch",
".",
"Tensor",
")",
"->",
"torch",
".",
"futures",
".",
"Future",
"[",
"torch",
".",
"Tensor",
"]",
":",
"group_to_use",
"=",
"process_group",
"if... | https://github.com/pytorch/pytorch/blob/7176c92687d3cc847cc046bf002269c6949a21c2/torch/distributed/algorithms/ddp_comm_hooks/default_hooks.py#L7-L20 | |
catboost/catboost | 167f64f237114a4d10b2b4ee42adb4569137debe | contrib/python/pandas/py2/pandas/core/indexes/multi.py | python | MultiIndex.get_level_values | (self, level) | return values | Return vector of label values for requested level,
equal to the length of the index.
Parameters
----------
level : int or str
``level`` is either the integer position of the level in the
MultiIndex, or the name of the level.
Returns
-------
... | Return vector of label values for requested level,
equal to the length of the index. | [
"Return",
"vector",
"of",
"label",
"values",
"for",
"requested",
"level",
"equal",
"to",
"the",
"length",
"of",
"the",
"index",
"."
] | def get_level_values(self, level):
"""
Return vector of label values for requested level,
equal to the length of the index.
Parameters
----------
level : int or str
``level`` is either the integer position of the level in the
MultiIndex, or the na... | [
"def",
"get_level_values",
"(",
"self",
",",
"level",
")",
":",
"level",
"=",
"self",
".",
"_get_level_number",
"(",
"level",
")",
"values",
"=",
"self",
".",
"_get_level_values",
"(",
"level",
")",
"return",
"values"
] | https://github.com/catboost/catboost/blob/167f64f237114a4d10b2b4ee42adb4569137debe/contrib/python/pandas/py2/pandas/core/indexes/multi.py#L1380-L1414 | |
gimli-org/gimli | 17aa2160de9b15ababd9ef99e89b1bc3277bbb23 | pygimli/physics/traveltime/modelling.py | python | TravelTimeDijkstraModelling.response | (self, par) | return self._core.response(par) | Return forward response (simulated traveltimes). | Return forward response (simulated traveltimes). | [
"Return",
"forward",
"response",
"(",
"simulated",
"traveltimes",
")",
"."
] | def response(self, par):
"""Return forward response (simulated traveltimes)."""
if not self.mesh():
pg.critical("no mesh")
return self._core.response(par) | [
"def",
"response",
"(",
"self",
",",
"par",
")",
":",
"if",
"not",
"self",
".",
"mesh",
"(",
")",
":",
"pg",
".",
"critical",
"(",
"\"no mesh\"",
")",
"return",
"self",
".",
"_core",
".",
"response",
"(",
"par",
")"
] | https://github.com/gimli-org/gimli/blob/17aa2160de9b15ababd9ef99e89b1bc3277bbb23/pygimli/physics/traveltime/modelling.py#L86-L90 | |
PaddlePaddle/Paddle | 1252f4bb3e574df80aa6d18c7ddae1b3a90bd81c | python/paddle/vision/models/resnet.py | python | resnet101 | (pretrained=False, **kwargs) | return _resnet('resnet101', BottleneckBlock, 101, pretrained, **kwargs) | ResNet 101-layer model from
`"Deep Residual Learning for Image Recognition" <https://arxiv.org/pdf/1512.03385.pdf>`_
Args:
pretrained (bool): If True, returns a model pre-trained on ImageNet
Examples:
.. code-block:: python
import paddle
from paddle.vision.models i... | ResNet 101-layer model from
`"Deep Residual Learning for Image Recognition" <https://arxiv.org/pdf/1512.03385.pdf>`_ | [
"ResNet",
"101",
"-",
"layer",
"model",
"from",
"Deep",
"Residual",
"Learning",
"for",
"Image",
"Recognition",
"<https",
":",
"//",
"arxiv",
".",
"org",
"/",
"pdf",
"/",
"1512",
".",
"03385",
".",
"pdf",
">",
"_"
] | def resnet101(pretrained=False, **kwargs):
"""ResNet 101-layer model from
`"Deep Residual Learning for Image Recognition" <https://arxiv.org/pdf/1512.03385.pdf>`_
Args:
pretrained (bool): If True, returns a model pre-trained on ImageNet
Examples:
.. code-block:: python
imp... | [
"def",
"resnet101",
"(",
"pretrained",
"=",
"False",
",",
"*",
"*",
"kwargs",
")",
":",
"return",
"_resnet",
"(",
"'resnet101'",
",",
"BottleneckBlock",
",",
"101",
",",
"pretrained",
",",
"*",
"*",
"kwargs",
")"
] | https://github.com/PaddlePaddle/Paddle/blob/1252f4bb3e574df80aa6d18c7ddae1b3a90bd81c/python/paddle/vision/models/resnet.py#L379-L403 | |
wxWidgets/wxPython-Classic | 19571e1ae65f1ac445f5491474121998c97a1bf0 | src/osx_cocoa/dataview.py | python | DataViewModel.IsContainer | (*args, **kwargs) | return _dataview.DataViewModel_IsContainer(*args, **kwargs) | IsContainer(self, DataViewItem item) -> bool
Override this to indicate whether an item is a container, in other
words, if it is a parent item that can have children. | IsContainer(self, DataViewItem item) -> bool | [
"IsContainer",
"(",
"self",
"DataViewItem",
"item",
")",
"-",
">",
"bool"
] | def IsContainer(*args, **kwargs):
"""
IsContainer(self, DataViewItem item) -> bool
Override this to indicate whether an item is a container, in other
words, if it is a parent item that can have children.
"""
return _dataview.DataViewModel_IsContainer(*args, **kwargs) | [
"def",
"IsContainer",
"(",
"*",
"args",
",",
"*",
"*",
"kwargs",
")",
":",
"return",
"_dataview",
".",
"DataViewModel_IsContainer",
"(",
"*",
"args",
",",
"*",
"*",
"kwargs",
")"
] | https://github.com/wxWidgets/wxPython-Classic/blob/19571e1ae65f1ac445f5491474121998c97a1bf0/src/osx_cocoa/dataview.py#L537-L544 | |
Tencent/CMONGO | c40380caa14e05509f46993aa8b8da966b09b0b5 | src/third_party/scons-2.5.0/scons-local-2.5.0/SCons/Tool/BitKeeper.py | python | generate | (env) | Add a Builder factory function and construction variables for
BitKeeper to an Environment. | Add a Builder factory function and construction variables for
BitKeeper to an Environment. | [
"Add",
"a",
"Builder",
"factory",
"function",
"and",
"construction",
"variables",
"for",
"BitKeeper",
"to",
"an",
"Environment",
"."
] | def generate(env):
"""Add a Builder factory function and construction variables for
BitKeeper to an Environment."""
def BitKeeperFactory(env=env):
""" """
import SCons.Warnings as W
W.warn(W.DeprecatedSourceCodeWarning, """The BitKeeper() factory is deprecated and there is no replac... | [
"def",
"generate",
"(",
"env",
")",
":",
"def",
"BitKeeperFactory",
"(",
"env",
"=",
"env",
")",
":",
"\"\"\" \"\"\"",
"import",
"SCons",
".",
"Warnings",
"as",
"W",
"W",
".",
"warn",
"(",
"W",
".",
"DeprecatedSourceCodeWarning",
",",
"\"\"\"The BitKeeper() ... | https://github.com/Tencent/CMONGO/blob/c40380caa14e05509f46993aa8b8da966b09b0b5/src/third_party/scons-2.5.0/scons-local-2.5.0/SCons/Tool/BitKeeper.py#L41-L57 | ||
miyosuda/TensorFlowAndroidDemo | 35903e0221aa5f109ea2dbef27f20b52e317f42d | jni-build/jni/include/tensorflow/contrib/learn/python/learn/dataframe/transform.py | python | Transform.output_names | (self) | return _make_tuple_of_string(self._output_names) | The names of `Series` output by the `Transform`.
This function should depend only on `@parameter`s of this `Transform`.
Returns:
A tuple of names of outputs provided by this Transform. | The names of `Series` output by the `Transform`. | [
"The",
"names",
"of",
"Series",
"output",
"by",
"the",
"Transform",
"."
] | def output_names(self):
"""The names of `Series` output by the `Transform`.
This function should depend only on `@parameter`s of this `Transform`.
Returns:
A tuple of names of outputs provided by this Transform.
"""
return _make_tuple_of_string(self._output_names) | [
"def",
"output_names",
"(",
"self",
")",
":",
"return",
"_make_tuple_of_string",
"(",
"self",
".",
"_output_names",
")"
] | https://github.com/miyosuda/TensorFlowAndroidDemo/blob/35903e0221aa5f109ea2dbef27f20b52e317f42d/jni-build/jni/include/tensorflow/contrib/learn/python/learn/dataframe/transform.py#L142-L150 | |
wxWidgets/wxPython-Classic | 19571e1ae65f1ac445f5491474121998c97a1bf0 | src/msw/_controls.py | python | PickerBase.SetTextCtrlProportion | (*args, **kwargs) | return _controls_.PickerBase_SetTextCtrlProportion(*args, **kwargs) | SetTextCtrlProportion(self, int prop)
Sets the proportion between the text control and the picker button.
This is used to set relative sizes of the text contorl and the picker.
The value passed to this function must be >= 1. | SetTextCtrlProportion(self, int prop) | [
"SetTextCtrlProportion",
"(",
"self",
"int",
"prop",
")"
] | def SetTextCtrlProportion(*args, **kwargs):
"""
SetTextCtrlProportion(self, int prop)
Sets the proportion between the text control and the picker button.
This is used to set relative sizes of the text contorl and the picker.
The value passed to this function must be >= 1.
... | [
"def",
"SetTextCtrlProportion",
"(",
"*",
"args",
",",
"*",
"*",
"kwargs",
")",
":",
"return",
"_controls_",
".",
"PickerBase_SetTextCtrlProportion",
"(",
"*",
"args",
",",
"*",
"*",
"kwargs",
")"
] | https://github.com/wxWidgets/wxPython-Classic/blob/19571e1ae65f1ac445f5491474121998c97a1bf0/src/msw/_controls.py#L6767-L6775 | |
aws/lumberyard | f85344403c1c2e77ec8c75deb2c116e97b713217 | dev/Tools/Python/3.7.10/mac/Python.framework/Versions/3.7/lib/python3.7/xml/etree/ElementTree.py | python | TreeBuilder.end | (self, tag) | return self._last | Close and return current Element.
*tag* is the element name. | Close and return current Element. | [
"Close",
"and",
"return",
"current",
"Element",
"."
] | def end(self, tag):
"""Close and return current Element.
*tag* is the element name.
"""
self._flush()
self._last = self._elem.pop()
assert self._last.tag == tag,\
"end tag mismatch (expected %s, got %s)" % (
self._last.tag, tag)
... | [
"def",
"end",
"(",
"self",
",",
"tag",
")",
":",
"self",
".",
"_flush",
"(",
")",
"self",
".",
"_last",
"=",
"self",
".",
"_elem",
".",
"pop",
"(",
")",
"assert",
"self",
".",
"_last",
".",
"tag",
"==",
"tag",
",",
"\"end tag mismatch (expected %s, g... | https://github.com/aws/lumberyard/blob/f85344403c1c2e77ec8c75deb2c116e97b713217/dev/Tools/Python/3.7.10/mac/Python.framework/Versions/3.7/lib/python3.7/xml/etree/ElementTree.py#L1420-L1432 | |
catboost/catboost | 167f64f237114a4d10b2b4ee42adb4569137debe | contrib/python/setuptools/py2/setuptools/command/install_lib.py | python | install_lib._exclude_pkg_path | (self, pkg, exclusion_path) | return os.path.join(self.install_dir, *parts) | Given a package name and exclusion path within that package,
compute the full exclusion path. | Given a package name and exclusion path within that package,
compute the full exclusion path. | [
"Given",
"a",
"package",
"name",
"and",
"exclusion",
"path",
"within",
"that",
"package",
"compute",
"the",
"full",
"exclusion",
"path",
"."
] | def _exclude_pkg_path(self, pkg, exclusion_path):
"""
Given a package name and exclusion path within that package,
compute the full exclusion path.
"""
parts = pkg.split('.') + [exclusion_path]
return os.path.join(self.install_dir, *parts) | [
"def",
"_exclude_pkg_path",
"(",
"self",
",",
"pkg",
",",
"exclusion_path",
")",
":",
"parts",
"=",
"pkg",
".",
"split",
"(",
"'.'",
")",
"+",
"[",
"exclusion_path",
"]",
"return",
"os",
".",
"path",
".",
"join",
"(",
"self",
".",
"install_dir",
",",
... | https://github.com/catboost/catboost/blob/167f64f237114a4d10b2b4ee42adb4569137debe/contrib/python/setuptools/py2/setuptools/command/install_lib.py#L31-L37 | |
tfwu/FaceDetection-ConvNet-3D | f9251c48eb40c5aec8fba7455115c355466555be | python/build/lib.linux-x86_64-2.7/mxnet/model.py | python | _create_kvstore | (kvstore, num_device, arg_params) | return (kv, update_on_kvstore) | Create kvstore
This function select and create a proper kvstore if given the kvstore type
Parameters
----------
kvstore : KVStore or str
The kvstore
num_device : int
The number of devices
arg_params : dict of str to NDArray
Model parameter, dict of name to NDArray of net'... | Create kvstore
This function select and create a proper kvstore if given the kvstore type
Parameters
----------
kvstore : KVStore or str
The kvstore
num_device : int
The number of devices
arg_params : dict of str to NDArray
Model parameter, dict of name to NDArray of net'... | [
"Create",
"kvstore",
"This",
"function",
"select",
"and",
"create",
"a",
"proper",
"kvstore",
"if",
"given",
"the",
"kvstore",
"type",
"Parameters",
"----------",
"kvstore",
":",
"KVStore",
"or",
"str",
"The",
"kvstore",
"num_device",
":",
"int",
"The",
"numbe... | def _create_kvstore(kvstore, num_device, arg_params):
"""Create kvstore
This function select and create a proper kvstore if given the kvstore type
Parameters
----------
kvstore : KVStore or str
The kvstore
num_device : int
The number of devices
arg_params : dict of str to NDA... | [
"def",
"_create_kvstore",
"(",
"kvstore",
",",
"num_device",
",",
"arg_params",
")",
":",
"if",
"kvstore",
"is",
"None",
":",
"kv",
"=",
"None",
"elif",
"isinstance",
"(",
"kvstore",
",",
"kvs",
".",
"KVStore",
")",
":",
"kv",
"=",
"kvstore",
"elif",
"... | https://github.com/tfwu/FaceDetection-ConvNet-3D/blob/f9251c48eb40c5aec8fba7455115c355466555be/python/build/lib.linux-x86_64-2.7/mxnet/model.py#L36-L76 | |
idaholab/moose | 9eeebc65e098b4c30f8205fb41591fd5b61eb6ff | python/MooseDocs/common/box.py | python | box | (content, title=None, line=None, width=None, color='RESET') | return mooseutils.colorText(out, color) | Tool for building unicode box around text, this is used for error reporting. | Tool for building unicode box around text, this is used for error reporting. | [
"Tool",
"for",
"building",
"unicode",
"box",
"around",
"text",
"this",
"is",
"used",
"for",
"error",
"reporting",
"."
] | def box(content, title=None, line=None, width=None, color='RESET'):
"""Tool for building unicode box around text, this is used for error reporting."""
lines = content.split('\n')
n_lines = len(max(lines, key=len))
out = ''
if title:
out += title + '\n'
if line is not None:
num_... | [
"def",
"box",
"(",
"content",
",",
"title",
"=",
"None",
",",
"line",
"=",
"None",
",",
"width",
"=",
"None",
",",
"color",
"=",
"'RESET'",
")",
":",
"lines",
"=",
"content",
".",
"split",
"(",
"'\\n'",
")",
"n_lines",
"=",
"len",
"(",
"max",
"("... | https://github.com/idaholab/moose/blob/9eeebc65e098b4c30f8205fb41591fd5b61eb6ff/python/MooseDocs/common/box.py#L11-L40 | |
macchina-io/macchina.io | ef24ba0e18379c3dd48fb84e6dbf991101cb8db0 | platform/JS/V8/v8/third_party/jinja2/compiler.py | python | CodeGenerator.temporary_identifier | (self) | return 't_%d' % self._last_identifier | Get a new unique identifier. | Get a new unique identifier. | [
"Get",
"a",
"new",
"unique",
"identifier",
"."
] | def temporary_identifier(self):
"""Get a new unique identifier."""
self._last_identifier += 1
return 't_%d' % self._last_identifier | [
"def",
"temporary_identifier",
"(",
"self",
")",
":",
"self",
".",
"_last_identifier",
"+=",
"1",
"return",
"'t_%d'",
"%",
"self",
".",
"_last_identifier"
] | https://github.com/macchina-io/macchina.io/blob/ef24ba0e18379c3dd48fb84e6dbf991101cb8db0/platform/JS/V8/v8/third_party/jinja2/compiler.py#L429-L432 | |
deepmodeling/deepmd-kit | 159e45d248b0429844fb6a8cb3b3a201987c8d79 | deepmd/fit/polar.py | python | PolarFittingSeA.build | (self,
input_d : tf.Tensor,
rot_mat : tf.Tensor,
natoms : tf.Tensor,
reuse : bool = None,
suffix : str = '') | return tf.cast(tf.reshape(outs, [-1]), GLOBAL_TF_FLOAT_PRECISION) | Build the computational graph for fitting net
Parameters
----------
input_d
The input descriptor
rot_mat
The rotation matrix from the descriptor.
natoms
The number of atoms. This tensor has the length of Ntypes + 2
... | Build the computational graph for fitting net
Parameters
----------
input_d
The input descriptor
rot_mat
The rotation matrix from the descriptor.
natoms
The number of atoms. This tensor has the length of Ntypes + 2
... | [
"Build",
"the",
"computational",
"graph",
"for",
"fitting",
"net",
"Parameters",
"----------",
"input_d",
"The",
"input",
"descriptor",
"rot_mat",
"The",
"rotation",
"matrix",
"from",
"the",
"descriptor",
".",
"natoms",
"The",
"number",
"of",
"atoms",
".",
"This... | def build (self,
input_d : tf.Tensor,
rot_mat : tf.Tensor,
natoms : tf.Tensor,
reuse : bool = None,
suffix : str = '') :
"""
Build the computational graph for fitting net
Parameters
----------
in... | [
"def",
"build",
"(",
"self",
",",
"input_d",
":",
"tf",
".",
"Tensor",
",",
"rot_mat",
":",
"tf",
".",
"Tensor",
",",
"natoms",
":",
"tf",
".",
"Tensor",
",",
"reuse",
":",
"bool",
"=",
"None",
",",
"suffix",
":",
"str",
"=",
"''",
")",
":",
"s... | https://github.com/deepmodeling/deepmd-kit/blob/159e45d248b0429844fb6a8cb3b3a201987c8d79/deepmd/fit/polar.py#L274-L372 | |
wxWidgets/wxPython-Classic | 19571e1ae65f1ac445f5491474121998c97a1bf0 | wx/lib/agw/zoombar.py | python | ZoomBar.OnPaint | (self, event) | Handles the ``wx.EVT_PAINT`` event for :class:`ZoomBar`.
:param `event`: a :class:`PaintEvent` event to be processed. | Handles the ``wx.EVT_PAINT`` event for :class:`ZoomBar`. | [
"Handles",
"the",
"wx",
".",
"EVT_PAINT",
"event",
"for",
":",
"class",
":",
"ZoomBar",
"."
] | def OnPaint(self, event):
"""
Handles the ``wx.EVT_PAINT`` event for :class:`ZoomBar`.
:param `event`: a :class:`PaintEvent` event to be processed.
"""
dc = wx.AutoBufferedPaintDC(self)
dc.SetBackground(wx.WHITE_BRUSH)
dc.Clear()
background = self._img... | [
"def",
"OnPaint",
"(",
"self",
",",
"event",
")",
":",
"dc",
"=",
"wx",
".",
"AutoBufferedPaintDC",
"(",
"self",
")",
"dc",
".",
"SetBackground",
"(",
"wx",
".",
"WHITE_BRUSH",
")",
"dc",
".",
"Clear",
"(",
")",
"background",
"=",
"self",
".",
"_imgB... | https://github.com/wxWidgets/wxPython-Classic/blob/19571e1ae65f1ac445f5491474121998c97a1bf0/wx/lib/agw/zoombar.py#L1144-L1166 | ||
jsupancic/deep_hand_pose | 22cbeae1a8410ff5d37c060c7315719d0a5d608f | scripts/cpp_lint.py | python | PrintUsage | (message) | Prints a brief usage string and exits, optionally with an error message.
Args:
message: The optional error message. | Prints a brief usage string and exits, optionally with an error message. | [
"Prints",
"a",
"brief",
"usage",
"string",
"and",
"exits",
"optionally",
"with",
"an",
"error",
"message",
"."
] | def PrintUsage(message):
"""Prints a brief usage string and exits, optionally with an error message.
Args:
message: The optional error message.
"""
sys.stderr.write(_USAGE)
if message:
sys.exit('\nFATAL ERROR: ' + message)
else:
sys.exit(1) | [
"def",
"PrintUsage",
"(",
"message",
")",
":",
"sys",
".",
"stderr",
".",
"write",
"(",
"_USAGE",
")",
"if",
"message",
":",
"sys",
".",
"exit",
"(",
"'\\nFATAL ERROR: '",
"+",
"message",
")",
"else",
":",
"sys",
".",
"exit",
"(",
"1",
")"
] | https://github.com/jsupancic/deep_hand_pose/blob/22cbeae1a8410ff5d37c060c7315719d0a5d608f/scripts/cpp_lint.py#L4757-L4767 | ||
ChromiumWebApps/chromium | c7361d39be8abd1574e6ce8957c8dbddd4c6ccf7 | tools/telemetry/telemetry/core/platform/__init__.py | python | Platform.HasBeenThermallyThrottled | (self) | return self._platform_backend.HasBeenThermallyThrottled() | Returns True if the device has been thermally throttled. | Returns True if the device has been thermally throttled. | [
"Returns",
"True",
"if",
"the",
"device",
"has",
"been",
"thermally",
"throttled",
"."
] | def HasBeenThermallyThrottled(self):
"""Returns True if the device has been thermally throttled."""
return self._platform_backend.HasBeenThermallyThrottled() | [
"def",
"HasBeenThermallyThrottled",
"(",
"self",
")",
":",
"return",
"self",
".",
"_platform_backend",
".",
"HasBeenThermallyThrottled",
"(",
")"
] | https://github.com/ChromiumWebApps/chromium/blob/c7361d39be8abd1574e6ce8957c8dbddd4c6ccf7/tools/telemetry/telemetry/core/platform/__init__.py#L72-L74 | |
aws/lumberyard | f85344403c1c2e77ec8c75deb2c116e97b713217 | dev/Gems/CloudGemFramework/v1/ResourceManager/lib/Crypto/Cipher/_mode_cfb.py | python | CfbMode.encrypt | (self, plaintext, output=None) | Encrypt data with the key and the parameters set at initialization.
A cipher object is stateful: once you have encrypted a message
you cannot encrypt (or decrypt) another message using the same
object.
The data to encrypt can be broken up in two or
more pieces and `encrypt` can... | Encrypt data with the key and the parameters set at initialization. | [
"Encrypt",
"data",
"with",
"the",
"key",
"and",
"the",
"parameters",
"set",
"at",
"initialization",
"."
] | def encrypt(self, plaintext, output=None):
"""Encrypt data with the key and the parameters set at initialization.
A cipher object is stateful: once you have encrypted a message
you cannot encrypt (or decrypt) another message using the same
object.
The data to encrypt can be bro... | [
"def",
"encrypt",
"(",
"self",
",",
"plaintext",
",",
"output",
"=",
"None",
")",
":",
"if",
"self",
".",
"encrypt",
"not",
"in",
"self",
".",
"_next",
":",
"raise",
"TypeError",
"(",
"\"encrypt() cannot be called after decrypt()\"",
")",
"self",
".",
"_next... | https://github.com/aws/lumberyard/blob/f85344403c1c2e77ec8c75deb2c116e97b713217/dev/Gems/CloudGemFramework/v1/ResourceManager/lib/Crypto/Cipher/_mode_cfb.py#L124-L183 | ||
kamyu104/LeetCode-Solutions | 77605708a927ea3b85aee5a479db733938c7c211 | Python/finding-3-digit-even-numbers.py | python | Solution4.findEvenNumbers | (self, digits) | return result | :type digits: List[int]
:rtype: List[int] | :type digits: List[int]
:rtype: List[int] | [
":",
"type",
"digits",
":",
"List",
"[",
"int",
"]",
":",
"rtype",
":",
"List",
"[",
"int",
"]"
] | def findEvenNumbers(self, digits):
"""
:type digits: List[int]
:rtype: List[int]
"""
k = 3
def backtracking(curr, digit_cnt, result):
if len(curr) == k:
result.append(reduce(lambda x, y: x*10+y, curr))
return
for i, ... | [
"def",
"findEvenNumbers",
"(",
"self",
",",
"digits",
")",
":",
"k",
"=",
"3",
"def",
"backtracking",
"(",
"curr",
",",
"digit_cnt",
",",
"result",
")",
":",
"if",
"len",
"(",
"curr",
")",
"==",
"k",
":",
"result",
".",
"append",
"(",
"reduce",
"("... | https://github.com/kamyu104/LeetCode-Solutions/blob/77605708a927ea3b85aee5a479db733938c7c211/Python/finding-3-digit-even-numbers.py#L112-L143 | |
apple/swift-lldb | d74be846ef3e62de946df343e8c234bde93a8912 | scripts/Python/static-binding/lldb.py | python | SBFunction.GetDisplayName | (self) | return _lldb.SBFunction_GetDisplayName(self) | GetDisplayName(SBFunction self) -> char const * | GetDisplayName(SBFunction self) -> char const * | [
"GetDisplayName",
"(",
"SBFunction",
"self",
")",
"-",
">",
"char",
"const",
"*"
] | def GetDisplayName(self):
"""GetDisplayName(SBFunction self) -> char const *"""
return _lldb.SBFunction_GetDisplayName(self) | [
"def",
"GetDisplayName",
"(",
"self",
")",
":",
"return",
"_lldb",
".",
"SBFunction_GetDisplayName",
"(",
"self",
")"
] | https://github.com/apple/swift-lldb/blob/d74be846ef3e62de946df343e8c234bde93a8912/scripts/Python/static-binding/lldb.py#L5908-L5910 | |
aws/lumberyard | f85344403c1c2e77ec8c75deb2c116e97b713217 | dev/Tools/Python/3.7.10/linux_x64/lib/python3.7/asyncio/streams.py | python | StreamReader._wait_for_data | (self, func_name) | Wait until feed_data() or feed_eof() is called.
If stream was paused, automatically resume it. | Wait until feed_data() or feed_eof() is called. | [
"Wait",
"until",
"feed_data",
"()",
"or",
"feed_eof",
"()",
"is",
"called",
"."
] | async def _wait_for_data(self, func_name):
"""Wait until feed_data() or feed_eof() is called.
If stream was paused, automatically resume it.
"""
# StreamReader uses a future to link the protocol feed_data() method
# to a read coroutine. Running two read coroutines at the same ti... | [
"async",
"def",
"_wait_for_data",
"(",
"self",
",",
"func_name",
")",
":",
"# StreamReader uses a future to link the protocol feed_data() method",
"# to a read coroutine. Running two read coroutines at the same time",
"# would have an unexpected behaviour. It would not possible to know",
"# ... | https://github.com/aws/lumberyard/blob/f85344403c1c2e77ec8c75deb2c116e97b713217/dev/Tools/Python/3.7.10/linux_x64/lib/python3.7/asyncio/streams.py#L449-L475 | ||
nci/drishti | 89cd8b740239c5b2c8222dffd4e27432fde170a1 | bin/assets/scripts/unet3Plus/unet_collection/losses.py | python | iou_box | (y_true, y_pred, mode='giou', dtype=tf.float32) | return 1 - iou_box_coef(y_true, y_pred, mode=mode, dtype=dtype) | Inersection over Union (IoU) and generalized IoU losses for bounding boxes.
iou_box(y_true, y_pred, mode='giou', dtype=tf.float32)
----------
Rezatofighi, H., Tsoi, N., Gwak, J., Sadeghian, A., Reid, I. and Savarese, S., 2019.
Generalized intersection over union: A metric and a loss for boun... | Inersection over Union (IoU) and generalized IoU losses for bounding boxes.
iou_box(y_true, y_pred, mode='giou', dtype=tf.float32)
----------
Rezatofighi, H., Tsoi, N., Gwak, J., Sadeghian, A., Reid, I. and Savarese, S., 2019.
Generalized intersection over union: A metric and a loss for boun... | [
"Inersection",
"over",
"Union",
"(",
"IoU",
")",
"and",
"generalized",
"IoU",
"losses",
"for",
"bounding",
"boxes",
".",
"iou_box",
"(",
"y_true",
"y_pred",
"mode",
"=",
"giou",
"dtype",
"=",
"tf",
".",
"float32",
")",
"----------",
"Rezatofighi",
"H",
"."... | def iou_box(y_true, y_pred, mode='giou', dtype=tf.float32):
"""
Inersection over Union (IoU) and generalized IoU losses for bounding boxes.
iou_box(y_true, y_pred, mode='giou', dtype=tf.float32)
----------
Rezatofighi, H., Tsoi, N., Gwak, J., Sadeghian, A., Reid, I. and Savarese, S., 2019... | [
"def",
"iou_box",
"(",
"y_true",
",",
"y_pred",
",",
"mode",
"=",
"'giou'",
",",
"dtype",
"=",
"tf",
".",
"float32",
")",
":",
"y_pred",
"=",
"tf",
".",
"convert_to_tensor",
"(",
"y_pred",
")",
"y_pred",
"=",
"tf",
".",
"cast",
"(",
"y_pred",
",",
... | https://github.com/nci/drishti/blob/89cd8b740239c5b2c8222dffd4e27432fde170a1/bin/assets/scripts/unet3Plus/unet_collection/losses.py#L351-L385 | |
ChromiumWebApps/chromium | c7361d39be8abd1574e6ce8957c8dbddd4c6ccf7 | build/android/generate_emma_html.py | python | _GetFilesWithExt | (root_dir, ext) | return files | Gets all files with a given extension.
Args:
root_dir: Directory in which to search for files.
ext: Extension to look for (including dot)
Returns:
A list of absolute paths to files that match. | Gets all files with a given extension. | [
"Gets",
"all",
"files",
"with",
"a",
"given",
"extension",
"."
] | def _GetFilesWithExt(root_dir, ext):
"""Gets all files with a given extension.
Args:
root_dir: Directory in which to search for files.
ext: Extension to look for (including dot)
Returns:
A list of absolute paths to files that match.
"""
files = []
for root, _, filenames in os.walk(root_dir):
... | [
"def",
"_GetFilesWithExt",
"(",
"root_dir",
",",
"ext",
")",
":",
"files",
"=",
"[",
"]",
"for",
"root",
",",
"_",
",",
"filenames",
"in",
"os",
".",
"walk",
"(",
"root_dir",
")",
":",
"basenames",
"=",
"fnmatch",
".",
"filter",
"(",
"filenames",
","... | https://github.com/ChromiumWebApps/chromium/blob/c7361d39be8abd1574e6ce8957c8dbddd4c6ccf7/build/android/generate_emma_html.py#L20-L36 | |
tensorflow/tensorflow | 419e3a6b650ea4bd1b0cba23c4348f8a69f3272e | tensorflow/python/ops/math_ops.py | python | softplus | (features, name=None) | return gen_nn_ops.softplus(features, name) | Computes elementwise softplus: `softplus(x) = log(exp(x) + 1)`.
`softplus` is a smooth approximation of `relu`. Like `relu`, `softplus` always
takes on positive values.
<img style="width:100%" src="https://www.tensorflow.org/images/softplus.png">
Example:
>>> import tensorflow as tf
>>> tf.math.softplus... | Computes elementwise softplus: `softplus(x) = log(exp(x) + 1)`. | [
"Computes",
"elementwise",
"softplus",
":",
"softplus",
"(",
"x",
")",
"=",
"log",
"(",
"exp",
"(",
"x",
")",
"+",
"1",
")",
"."
] | def softplus(features, name=None):
"""Computes elementwise softplus: `softplus(x) = log(exp(x) + 1)`.
`softplus` is a smooth approximation of `relu`. Like `relu`, `softplus` always
takes on positive values.
<img style="width:100%" src="https://www.tensorflow.org/images/softplus.png">
Example:
>>> import... | [
"def",
"softplus",
"(",
"features",
",",
"name",
"=",
"None",
")",
":",
"return",
"gen_nn_ops",
".",
"softplus",
"(",
"features",
",",
"name",
")"
] | https://github.com/tensorflow/tensorflow/blob/419e3a6b650ea4bd1b0cba23c4348f8a69f3272e/tensorflow/python/ops/math_ops.py#L636-L656 | |
wxWidgets/wxPython-Classic | 19571e1ae65f1ac445f5491474121998c97a1bf0 | src/osx_carbon/_gdi.py | python | PseudoDC.DrawBitmapPoint | (*args, **kwargs) | return _gdi_.PseudoDC_DrawBitmapPoint(*args, **kwargs) | DrawBitmapPoint(self, Bitmap bmp, Point pt, bool useMask=False)
Draw a bitmap on the device context at the specified point. If
*transparent* is true and the bitmap has a transparency mask, (or
alpha channel on the platforms that support it) then the bitmap will
be drawn transparently. | DrawBitmapPoint(self, Bitmap bmp, Point pt, bool useMask=False) | [
"DrawBitmapPoint",
"(",
"self",
"Bitmap",
"bmp",
"Point",
"pt",
"bool",
"useMask",
"=",
"False",
")"
] | def DrawBitmapPoint(*args, **kwargs):
"""
DrawBitmapPoint(self, Bitmap bmp, Point pt, bool useMask=False)
Draw a bitmap on the device context at the specified point. If
*transparent* is true and the bitmap has a transparency mask, (or
alpha channel on the platforms that support ... | [
"def",
"DrawBitmapPoint",
"(",
"*",
"args",
",",
"*",
"*",
"kwargs",
")",
":",
"return",
"_gdi_",
".",
"PseudoDC_DrawBitmapPoint",
"(",
"*",
"args",
",",
"*",
"*",
"kwargs",
")"
] | https://github.com/wxWidgets/wxPython-Classic/blob/19571e1ae65f1ac445f5491474121998c97a1bf0/src/osx_carbon/_gdi.py#L8074-L8083 | |
robotology/yarp | 3d6e3f258db7755a3c44dd1e62c303cc36c49a8f | extern/thrift/thrift/lib/py/src/transport/TZlibTransport.py | python | TZlibTransport.cstringio_refill | (self, partialread, reqlen) | return self.__rbuf | Implement the CReadableTransport interface for refill | Implement the CReadableTransport interface for refill | [
"Implement",
"the",
"CReadableTransport",
"interface",
"for",
"refill"
] | def cstringio_refill(self, partialread, reqlen):
"""Implement the CReadableTransport interface for refill"""
retstring = partialread
if reqlen < self.DEFAULT_BUFFSIZE:
retstring += self.read(self.DEFAULT_BUFFSIZE)
while len(retstring) < reqlen:
retstring += self.r... | [
"def",
"cstringio_refill",
"(",
"self",
",",
"partialread",
",",
"reqlen",
")",
":",
"retstring",
"=",
"partialread",
"if",
"reqlen",
"<",
"self",
".",
"DEFAULT_BUFFSIZE",
":",
"retstring",
"+=",
"self",
".",
"read",
"(",
"self",
".",
"DEFAULT_BUFFSIZE",
")"... | https://github.com/robotology/yarp/blob/3d6e3f258db7755a3c44dd1e62c303cc36c49a8f/extern/thrift/thrift/lib/py/src/transport/TZlibTransport.py#L240-L248 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.