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 |
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
aws/lumberyard | f85344403c1c2e77ec8c75deb2c116e97b713217 | dev/Tools/Python/3.7.10/mac/Python.framework/Versions/3.7/lib/python3.7/secrets.py | python | token_urlsafe | (nbytes=None) | return base64.urlsafe_b64encode(tok).rstrip(b'=').decode('ascii') | Return a random URL-safe text string, in Base64 encoding.
The string has *nbytes* random bytes. If *nbytes* is ``None``
or not supplied, a reasonable default is used.
>>> token_urlsafe(16) #doctest:+SKIP
'Drmhze6EPcv0fN_81Bj-nA' | Return a random URL-safe text string, in Base64 encoding. | [
"Return",
"a",
"random",
"URL",
"-",
"safe",
"text",
"string",
"in",
"Base64",
"encoding",
"."
] | def token_urlsafe(nbytes=None):
"""Return a random URL-safe text string, in Base64 encoding.
The string has *nbytes* random bytes. If *nbytes* is ``None``
or not supplied, a reasonable default is used.
>>> token_urlsafe(16) #doctest:+SKIP
'Drmhze6EPcv0fN_81Bj-nA'
"""
tok = token_bytes(n... | [
"def",
"token_urlsafe",
"(",
"nbytes",
"=",
"None",
")",
":",
"tok",
"=",
"token_bytes",
"(",
"nbytes",
")",
"return",
"base64",
".",
"urlsafe_b64encode",
"(",
"tok",
")",
".",
"rstrip",
"(",
"b'='",
")",
".",
"decode",
"(",
"'ascii'",
")"
] | https://github.com/aws/lumberyard/blob/f85344403c1c2e77ec8c75deb2c116e97b713217/dev/Tools/Python/3.7.10/mac/Python.framework/Versions/3.7/lib/python3.7/secrets.py#L62-L73 | |
kamyu104/LeetCode-Solutions | 77605708a927ea3b85aee5a479db733938c7c211 | Python/logger-rate-limiter.py | python | Logger.__init__ | (self) | Initialize your data structure here. | Initialize your data structure here. | [
"Initialize",
"your",
"data",
"structure",
"here",
"."
] | def __init__(self):
"""
Initialize your data structure here.
"""
self.__dq = collections.deque()
self.__printed = set() | [
"def",
"__init__",
"(",
"self",
")",
":",
"self",
".",
"__dq",
"=",
"collections",
".",
"deque",
"(",
")",
"self",
".",
"__printed",
"=",
"set",
"(",
")"
] | https://github.com/kamyu104/LeetCode-Solutions/blob/77605708a927ea3b85aee5a479db733938c7c211/Python/logger-rate-limiter.py#L9-L14 | ||
wxWidgets/wxPython-Classic | 19571e1ae65f1ac445f5491474121998c97a1bf0 | wx/lib/agw/aui/auibook.py | python | TabFrame.SetTabCtrlHeight | (self, h) | Sets the tab control height.
:param integer `h`: the tab area height. | Sets the tab control height. | [
"Sets",
"the",
"tab",
"control",
"height",
"."
] | def SetTabCtrlHeight(self, h):
"""
Sets the tab control height.
:param integer `h`: the tab area height.
"""
self._tab_ctrl_height = h | [
"def",
"SetTabCtrlHeight",
"(",
"self",
",",
"h",
")",
":",
"self",
".",
"_tab_ctrl_height",
"=",
"h"
] | https://github.com/wxWidgets/wxPython-Classic/blob/19571e1ae65f1ac445f5491474121998c97a1bf0/wx/lib/agw/aui/auibook.py#L2653-L2660 | ||
KratosMultiphysics/Kratos | 0000833054ed0503424eb28205d6508d9ca6cbbc | applications/MultilevelMonteCarloApplication/external_libraries/XMC/xmc/methodDefs_hierarchyOptimiser/optimalSampleNumbers.py | python | multiLevelDoubleAllSamples | (inputDict, newLevels) | return new_samples | Returns a list of sample numbers of same length as the number of entries
in newLevels. Doubles the number of samples from oldHierarchy if an
entry of newLevels exists in oldHierarchy. If not, allocate a default
newSampleNumber to the entry. | Returns a list of sample numbers of same length as the number of entries
in newLevels. Doubles the number of samples from oldHierarchy if an
entry of newLevels exists in oldHierarchy. If not, allocate a default
newSampleNumber to the entry. | [
"Returns",
"a",
"list",
"of",
"sample",
"numbers",
"of",
"same",
"length",
"as",
"the",
"number",
"of",
"entries",
"in",
"newLevels",
".",
"Doubles",
"the",
"number",
"of",
"samples",
"from",
"oldHierarchy",
"if",
"an",
"entry",
"of",
"newLevels",
"exists",
... | def multiLevelDoubleAllSamples(inputDict, newLevels):
"""
Returns a list of sample numbers of same length as the number of entries
in newLevels. Doubles the number of samples from oldHierarchy if an
entry of newLevels exists in oldHierarchy. If not, allocate a default
newSampleNumber to the entry.
... | [
"def",
"multiLevelDoubleAllSamples",
"(",
"inputDict",
",",
"newLevels",
")",
":",
"oldHierarchy",
"=",
"inputDict",
"[",
"\"oldHierarchy\"",
"]",
"newSampleNumber",
"=",
"inputDict",
"[",
"\"newSampleNumber\"",
"]",
"new_samples",
"=",
"[",
"]",
"for",
"newLevel",
... | https://github.com/KratosMultiphysics/Kratos/blob/0000833054ed0503424eb28205d6508d9ca6cbbc/applications/MultilevelMonteCarloApplication/external_libraries/XMC/xmc/methodDefs_hierarchyOptimiser/optimalSampleNumbers.py#L25-L44 | |
wxWidgets/wxPython-Classic | 19571e1ae65f1ac445f5491474121998c97a1bf0 | src/gtk/_controls.py | python | StaticLine_GetDefaultSize | (*args) | return _controls_.StaticLine_GetDefaultSize(*args) | StaticLine_GetDefaultSize() -> int | StaticLine_GetDefaultSize() -> int | [
"StaticLine_GetDefaultSize",
"()",
"-",
">",
"int"
] | def StaticLine_GetDefaultSize(*args):
"""StaticLine_GetDefaultSize() -> int"""
return _controls_.StaticLine_GetDefaultSize(*args) | [
"def",
"StaticLine_GetDefaultSize",
"(",
"*",
"args",
")",
":",
"return",
"_controls_",
".",
"StaticLine_GetDefaultSize",
"(",
"*",
"args",
")"
] | https://github.com/wxWidgets/wxPython-Classic/blob/19571e1ae65f1ac445f5491474121998c97a1bf0/src/gtk/_controls.py#L960-L962 | |
mantidproject/mantid | 03deeb89254ec4289edb8771e0188c2090a02f32 | qt/python/mantidqtinterfaces/mantidqtinterfaces/Muon/GUI/Common/corrections_tab_widget/background_corrections_presenter.py | python | BackgroundCorrectionsPresenter.handle_mode_combo_box_changed | (self) | Handles when the background corrections mode is changed. | Handles when the background corrections mode is changed. | [
"Handles",
"when",
"the",
"background",
"corrections",
"mode",
"is",
"changed",
"."
] | def handle_mode_combo_box_changed(self) -> None:
"""Handles when the background corrections mode is changed."""
self.model.set_background_correction_mode(self.view.background_correction_mode)
if self.model.is_background_mode_none():
self.view.set_none_background_correction_options_vi... | [
"def",
"handle_mode_combo_box_changed",
"(",
"self",
")",
"->",
"None",
":",
"self",
".",
"model",
".",
"set_background_correction_mode",
"(",
"self",
".",
"view",
".",
"background_correction_mode",
")",
"if",
"self",
".",
"model",
".",
"is_background_mode_none",
... | https://github.com/mantidproject/mantid/blob/03deeb89254ec4289edb8771e0188c2090a02f32/qt/python/mantidqtinterfaces/mantidqtinterfaces/Muon/GUI/Common/corrections_tab_widget/background_corrections_presenter.py#L61-L71 | ||
tensorflow/tensorflow | 419e3a6b650ea4bd1b0cba23c4348f8a69f3272e | tensorflow/python/keras/utils/tf_utils.py | python | type_spec_from_value | (value) | Grab type_spec without converting array-likes to tensors. | Grab type_spec without converting array-likes to tensors. | [
"Grab",
"type_spec",
"without",
"converting",
"array",
"-",
"likes",
"to",
"tensors",
"."
] | def type_spec_from_value(value):
"""Grab type_spec without converting array-likes to tensors."""
if is_extension_type(value):
return value._type_spec # pylint: disable=protected-access
# Get a TensorSpec for array-like data without
# converting the data to a Tensor
if hasattr(value, 'shape') and hasattr(... | [
"def",
"type_spec_from_value",
"(",
"value",
")",
":",
"if",
"is_extension_type",
"(",
"value",
")",
":",
"return",
"value",
".",
"_type_spec",
"# pylint: disable=protected-access",
"# Get a TensorSpec for array-like data without",
"# converting the data to a Tensor",
"if",
"... | https://github.com/tensorflow/tensorflow/blob/419e3a6b650ea4bd1b0cba23c4348f8a69f3272e/tensorflow/python/keras/utils/tf_utils.py#L374-L383 | ||
thalium/icebox | 99d147d5b9269222225443ce171b4fd46d8985d4 | third_party/virtualbox/src/VBox/GuestHost/OpenGL/glapi_parser/apiutil.py | python | ChromiumRelOpCode | (funcName) | return d[funcName].chrelopcode | Return list of Chromium-specific properties of the named GL function. | Return list of Chromium-specific properties of the named GL function. | [
"Return",
"list",
"of",
"Chromium",
"-",
"specific",
"properties",
"of",
"the",
"named",
"GL",
"function",
"."
] | def ChromiumRelOpCode(funcName):
"""Return list of Chromium-specific properties of the named GL function."""
d = GetFunctionDict()
return d[funcName].chrelopcode | [
"def",
"ChromiumRelOpCode",
"(",
"funcName",
")",
":",
"d",
"=",
"GetFunctionDict",
"(",
")",
"return",
"d",
"[",
"funcName",
"]",
".",
"chrelopcode"
] | https://github.com/thalium/icebox/blob/99d147d5b9269222225443ce171b4fd46d8985d4/third_party/virtualbox/src/VBox/GuestHost/OpenGL/glapi_parser/apiutil.py#L321-L324 | |
mantidproject/mantid | 03deeb89254ec4289edb8771e0188c2090a02f32 | qt/python/mantidqtinterfaces/mantidqtinterfaces/Muon/GUI/Common/grouping_tab_widget/grouping_tab_widget_presenter.py | python | GroupingTabPresenter.text_for_description | (self) | return text | Generate the text for the description edit at the top of the widget. | Generate the text for the description edit at the top of the widget. | [
"Generate",
"the",
"text",
"for",
"the",
"description",
"edit",
"at",
"the",
"top",
"of",
"the",
"widget",
"."
] | def text_for_description(self):
"""
Generate the text for the description edit at the top of the widget.
"""
instrument = self._model.instrument
n_detectors = self._model.num_detectors
main_field = self._model.main_field_direction
text = "{}, {} detectors".format(... | [
"def",
"text_for_description",
"(",
"self",
")",
":",
"instrument",
"=",
"self",
".",
"_model",
".",
"instrument",
"n_detectors",
"=",
"self",
".",
"_model",
".",
"num_detectors",
"main_field",
"=",
"self",
".",
"_model",
".",
"main_field_direction",
"text",
"... | https://github.com/mantidproject/mantid/blob/03deeb89254ec4289edb8771e0188c2090a02f32/qt/python/mantidqtinterfaces/mantidqtinterfaces/Muon/GUI/Common/grouping_tab_widget/grouping_tab_widget_presenter.py#L83-L94 | |
catboost/catboost | 167f64f237114a4d10b2b4ee42adb4569137debe | contrib/python/ipython/py3/IPython/core/completer.py | python | protect_filename | (s, protectables=PROTECTABLES) | Escape a string to protect certain characters. | Escape a string to protect certain characters. | [
"Escape",
"a",
"string",
"to",
"protect",
"certain",
"characters",
"."
] | def protect_filename(s, protectables=PROTECTABLES):
"""Escape a string to protect certain characters."""
if set(s) & set(protectables):
if sys.platform == "win32":
return '"' + s + '"'
else:
return "".join(("\\" + c if c in protectables else c) for c in s)
else:
... | [
"def",
"protect_filename",
"(",
"s",
",",
"protectables",
"=",
"PROTECTABLES",
")",
":",
"if",
"set",
"(",
"s",
")",
"&",
"set",
"(",
"protectables",
")",
":",
"if",
"sys",
".",
"platform",
"==",
"\"win32\"",
":",
"return",
"'\"'",
"+",
"s",
"+",
"'\... | https://github.com/catboost/catboost/blob/167f64f237114a4d10b2b4ee42adb4569137debe/contrib/python/ipython/py3/IPython/core/completer.py#L241-L249 | ||
aws/lumberyard | f85344403c1c2e77ec8c75deb2c116e97b713217 | dev/Tools/Python/3.7.10/windows/Lib/idlelib/search.py | python | SearchDialog.find_again | (self, text) | Repeat the last search.
If no search was previously run, open a new search dialog. In
this case, no search is done.
If a search was previously run, the search dialog won't be
shown and the options from the previous search (including the
search pattern) will be used to find the... | Repeat the last search. | [
"Repeat",
"the",
"last",
"search",
"."
] | def find_again(self, text):
"""Repeat the last search.
If no search was previously run, open a new search dialog. In
this case, no search is done.
If a search was previously run, the search dialog won't be
shown and the options from the previous search (including the
s... | [
"def",
"find_again",
"(",
"self",
",",
"text",
")",
":",
"if",
"not",
"self",
".",
"engine",
".",
"getpat",
"(",
")",
":",
"self",
".",
"open",
"(",
"text",
")",
"return",
"False",
"if",
"not",
"self",
".",
"engine",
".",
"getprog",
"(",
")",
":"... | https://github.com/aws/lumberyard/blob/f85344403c1c2e77ec8c75deb2c116e97b713217/dev/Tools/Python/3.7.10/windows/Lib/idlelib/search.py#L77-L119 | ||
pmq20/node-packer | 12c46c6e44fbc14d9ee645ebd17d5296b324f7e0 | lts/tools/gyp/pylib/gyp/MSVSProject.py | python | Writer.AddFileConfig | (self, path, config, attrs=None, tools=None) | Adds a configuration to a file.
Args:
path: Relative path to the file.
config: Name of configuration to add.
attrs: Dict of configuration attributes; may be None.
tools: List of tools (strings or Tool objects); may be None.
Raises:
ValueError: Relative path does not match any fil... | Adds a configuration to a file. | [
"Adds",
"a",
"configuration",
"to",
"a",
"file",
"."
] | def AddFileConfig(self, path, config, attrs=None, tools=None):
"""Adds a configuration to a file.
Args:
path: Relative path to the file.
config: Name of configuration to add.
attrs: Dict of configuration attributes; may be None.
tools: List of tools (strings or Tool objects); may be Non... | [
"def",
"AddFileConfig",
"(",
"self",
",",
"path",
",",
"config",
",",
"attrs",
"=",
"None",
",",
"tools",
"=",
"None",
")",
":",
"# Find the file node with the right relative path",
"parent",
"=",
"self",
".",
"files_dict",
".",
"get",
"(",
"path",
")",
"if"... | https://github.com/pmq20/node-packer/blob/12c46c6e44fbc14d9ee645ebd17d5296b324f7e0/lts/tools/gyp/pylib/gyp/MSVSProject.py#L166-L186 | ||
MTG/gaia | 0f7214dbdec6f9b651ca34211824841ffba0bc77 | src/doc/doxy2swig.py | python | Doxy2SWIG.get_specific_nodes | (self, node, names) | return dict(nodes) | Given a node and a sequence of strings in `names`, return a
dictionary containing the names as keys and child
`ELEMENT_NODEs`, that have a `tagName` equal to the name. | Given a node and a sequence of strings in `names`, return a
dictionary containing the names as keys and child
`ELEMENT_NODEs`, that have a `tagName` equal to the name. | [
"Given",
"a",
"node",
"and",
"a",
"sequence",
"of",
"strings",
"in",
"names",
"return",
"a",
"dictionary",
"containing",
"the",
"names",
"as",
"keys",
"and",
"child",
"ELEMENT_NODEs",
"that",
"have",
"a",
"tagName",
"equal",
"to",
"the",
"name",
"."
] | def get_specific_nodes(self, node, names):
"""Given a node and a sequence of strings in `names`, return a
dictionary containing the names as keys and child
`ELEMENT_NODEs`, that have a `tagName` equal to the name.
"""
nodes = [(x.tagName, x) for x in node.childNodes
... | [
"def",
"get_specific_nodes",
"(",
"self",
",",
"node",
",",
"names",
")",
":",
"nodes",
"=",
"[",
"(",
"x",
".",
"tagName",
",",
"x",
")",
"for",
"x",
"in",
"node",
".",
"childNodes",
"if",
"x",
".",
"nodeType",
"==",
"x",
".",
"ELEMENT_NODE",
"and... | https://github.com/MTG/gaia/blob/0f7214dbdec6f9b651ca34211824841ffba0bc77/src/doc/doxy2swig.py#L275-L284 | |
wlanjie/AndroidFFmpeg | 7baf9122f4b8e1c74e7baf4be5c422c7a5ba5aaf | tools/fdk-aac-build/armeabi-v7a/toolchain/lib/python2.7/decimal.py | python | Decimal.__float__ | (self) | return float(s) | Float representation. | Float representation. | [
"Float",
"representation",
"."
] | def __float__(self):
"""Float representation."""
if self._isnan():
if self.is_snan():
raise ValueError("Cannot convert signaling NaN to float")
s = "-nan" if self._sign else "nan"
else:
s = str(self)
return float(s) | [
"def",
"__float__",
"(",
"self",
")",
":",
"if",
"self",
".",
"_isnan",
"(",
")",
":",
"if",
"self",
".",
"is_snan",
"(",
")",
":",
"raise",
"ValueError",
"(",
"\"Cannot convert signaling NaN to float\"",
")",
"s",
"=",
"\"-nan\"",
"if",
"self",
".",
"_s... | https://github.com/wlanjie/AndroidFFmpeg/blob/7baf9122f4b8e1c74e7baf4be5c422c7a5ba5aaf/tools/fdk-aac-build/armeabi-v7a/toolchain/lib/python2.7/decimal.py#L1582-L1590 | |
miyosuda/TensorFlowAndroidDemo | 35903e0221aa5f109ea2dbef27f20b52e317f42d | jni-build/jni/include/tensorflow/contrib/distributions/python/ops/categorical.py | python | Categorical.log_prob | (self, k, name="log_prob") | Log-probability of class `k`.
Args:
k: `int32` or `int64` Tensor. Must be broadcastable with a `batch_shape`
`Tensor`.
name: A name for this operation (optional).
Returns:
The log-probabilities of the classes indexed by `k` | Log-probability of class `k`. | [
"Log",
"-",
"probability",
"of",
"class",
"k",
"."
] | def log_prob(self, k, name="log_prob"):
"""Log-probability of class `k`.
Args:
k: `int32` or `int64` Tensor. Must be broadcastable with a `batch_shape`
`Tensor`.
name: A name for this operation (optional).
Returns:
The log-probabilities of the classes indexed by `k`
"""
w... | [
"def",
"log_prob",
"(",
"self",
",",
"k",
",",
"name",
"=",
"\"log_prob\"",
")",
":",
"with",
"ops",
".",
"name_scope",
"(",
"self",
".",
"name",
")",
":",
"with",
"ops",
".",
"op_scope",
"(",
"[",
"k",
",",
"self",
".",
"logits",
"]",
",",
"name... | https://github.com/miyosuda/TensorFlowAndroidDemo/blob/35903e0221aa5f109ea2dbef27f20b52e317f42d/jni-build/jni/include/tensorflow/contrib/distributions/python/ops/categorical.py#L117-L141 | ||
aws/lumberyard | f85344403c1c2e77ec8c75deb2c116e97b713217 | dev/Gems/CloudGemMetric/v1/AWS/python/windows/Lib/psutil/_pswindows.py | python | cpu_freq | () | return [_common.scpufreq(float(curr), min_, float(max_))] | Return CPU frequency.
On Windows per-cpu frequency is not supported. | Return CPU frequency.
On Windows per-cpu frequency is not supported. | [
"Return",
"CPU",
"frequency",
".",
"On",
"Windows",
"per",
"-",
"cpu",
"frequency",
"is",
"not",
"supported",
"."
] | def cpu_freq():
"""Return CPU frequency.
On Windows per-cpu frequency is not supported.
"""
curr, max_ = cext.cpu_freq()
min_ = 0.0
return [_common.scpufreq(float(curr), min_, float(max_))] | [
"def",
"cpu_freq",
"(",
")",
":",
"curr",
",",
"max_",
"=",
"cext",
".",
"cpu_freq",
"(",
")",
"min_",
"=",
"0.0",
"return",
"[",
"_common",
".",
"scpufreq",
"(",
"float",
"(",
"curr",
")",
",",
"min_",
",",
"float",
"(",
"max_",
")",
")",
"]"
] | https://github.com/aws/lumberyard/blob/f85344403c1c2e77ec8c75deb2c116e97b713217/dev/Gems/CloudGemMetric/v1/AWS/python/windows/Lib/psutil/_pswindows.py#L320-L326 | |
microsoft/TSS.MSR | 0f2516fca2cd9929c31d5450e39301c9bde43688 | TSS.Py/src/TpmTypes.py | python | TPMS_SCHEME_ECDSA.__init__ | (self, hashAlg = TPM_ALG_ID.NULL) | Most of the ECC signature schemes only require a hash algorithm to
complete the definition and can be typed as TPMS_SCHEME_HASH. Anonymous
algorithms also require a count value so they are typed to be
TPMS_SCHEME_ECDAA.
Attributes:
hashAlg (TPM_ALG_ID): The hash algorithm us... | Most of the ECC signature schemes only require a hash algorithm to
complete the definition and can be typed as TPMS_SCHEME_HASH. Anonymous
algorithms also require a count value so they are typed to be
TPMS_SCHEME_ECDAA. | [
"Most",
"of",
"the",
"ECC",
"signature",
"schemes",
"only",
"require",
"a",
"hash",
"algorithm",
"to",
"complete",
"the",
"definition",
"and",
"can",
"be",
"typed",
"as",
"TPMS_SCHEME_HASH",
".",
"Anonymous",
"algorithms",
"also",
"require",
"a",
"count",
"val... | def __init__(self, hashAlg = TPM_ALG_ID.NULL):
""" Most of the ECC signature schemes only require a hash algorithm to
complete the definition and can be typed as TPMS_SCHEME_HASH. Anonymous
algorithms also require a count value so they are typed to be
TPMS_SCHEME_ECDAA.
Attribut... | [
"def",
"__init__",
"(",
"self",
",",
"hashAlg",
"=",
"TPM_ALG_ID",
".",
"NULL",
")",
":",
"super",
"(",
"TPMS_SCHEME_ECDSA",
",",
"self",
")",
".",
"__init__",
"(",
"hashAlg",
")"
] | https://github.com/microsoft/TSS.MSR/blob/0f2516fca2cd9929c31d5450e39301c9bde43688/TSS.Py/src/TpmTypes.py#L17713-L17722 | ||
aws/lumberyard | f85344403c1c2e77ec8c75deb2c116e97b713217 | dev/Gems/CloudGemFramework/v1/AWS/common-code/ServiceClient_Python/cgf_service_client/__init__.py | python | for_url | (url, **kwargs) | return Path(url, **kwargs) | Create a Path object that can be used to make requests using paths relative to the specified url.
Arguments:
url - The url.
**kwargs - Used to configure the Path object. | Create a Path object that can be used to make requests using paths relative to the specified url. | [
"Create",
"a",
"Path",
"object",
"that",
"can",
"be",
"used",
"to",
"make",
"requests",
"using",
"paths",
"relative",
"to",
"the",
"specified",
"url",
"."
] | def for_url(url, **kwargs):
'''Create a Path object that can be used to make requests using paths relative to the specified url.
Arguments:
url - The url.
**kwargs - Used to configure the Path object.
'''
return Path(url, **kwargs) | [
"def",
"for_url",
"(",
"url",
",",
"*",
"*",
"kwargs",
")",
":",
"return",
"Path",
"(",
"url",
",",
"*",
"*",
"kwargs",
")"
] | https://github.com/aws/lumberyard/blob/f85344403c1c2e77ec8c75deb2c116e97b713217/dev/Gems/CloudGemFramework/v1/AWS/common-code/ServiceClient_Python/cgf_service_client/__init__.py#L17-L27 | |
wxWidgets/wxPython-Classic | 19571e1ae65f1ac445f5491474121998c97a1bf0 | src/gtk/_misc.py | python | ConfigBase.DeleteGroup | (*args, **kwargs) | return _misc_.ConfigBase_DeleteGroup(*args, **kwargs) | DeleteGroup(self, String key) -> bool
Delete the group (with all subgroups) | DeleteGroup(self, String key) -> bool | [
"DeleteGroup",
"(",
"self",
"String",
"key",
")",
"-",
">",
"bool"
] | def DeleteGroup(*args, **kwargs):
"""
DeleteGroup(self, String key) -> bool
Delete the group (with all subgroups)
"""
return _misc_.ConfigBase_DeleteGroup(*args, **kwargs) | [
"def",
"DeleteGroup",
"(",
"*",
"args",
",",
"*",
"*",
"kwargs",
")",
":",
"return",
"_misc_",
".",
"ConfigBase_DeleteGroup",
"(",
"*",
"args",
",",
"*",
"*",
"kwargs",
")"
] | https://github.com/wxWidgets/wxPython-Classic/blob/19571e1ae65f1ac445f5491474121998c97a1bf0/src/gtk/_misc.py#L3354-L3360 | |
tensorflow/tensorflow | 419e3a6b650ea4bd1b0cba23c4348f8a69f3272e | tensorflow/python/ops/nn_grad.py | python | _Conv2DGrad | (op, grad) | return [
gen_nn_ops.conv2d_backprop_input(
shape_0,
op.inputs[1],
grad,
dilations=dilations,
strides=strides,
padding=padding,
explicit_paddings=explicit_paddings,
use_cudnn_on_gpu=use_cudnn_on_gpu,
data_format=data_format),... | Gradient function for Conv2D. | Gradient function for Conv2D. | [
"Gradient",
"function",
"for",
"Conv2D",
"."
] | def _Conv2DGrad(op, grad):
"""Gradient function for Conv2D."""
dilations = op.get_attr("dilations")
strides = op.get_attr("strides")
padding = op.get_attr("padding")
explicit_paddings = op.get_attr("explicit_paddings")
use_cudnn_on_gpu = op.get_attr("use_cudnn_on_gpu")
data_format = op.get_attr("data_form... | [
"def",
"_Conv2DGrad",
"(",
"op",
",",
"grad",
")",
":",
"dilations",
"=",
"op",
".",
"get_attr",
"(",
"\"dilations\"",
")",
"strides",
"=",
"op",
".",
"get_attr",
"(",
"\"strides\"",
")",
"padding",
"=",
"op",
".",
"get_attr",
"(",
"\"padding\"",
")",
... | https://github.com/tensorflow/tensorflow/blob/419e3a6b650ea4bd1b0cba23c4348f8a69f3272e/tensorflow/python/ops/nn_grad.py#L560-L597 | |
catboost/catboost | 167f64f237114a4d10b2b4ee42adb4569137debe | contrib/python/scipy/py2/scipy/signal/filter_design.py | python | bilinear | (b, a, fs=1.0) | return normalize(bprime, aprime) | Return a digital filter from an analog one using a bilinear transform.
The bilinear transform substitutes ``(z-1) / (z+1)`` for ``s``.
See Also
--------
lp2lp, lp2hp, lp2bp, lp2bs
bilinear_zpk | Return a digital filter from an analog one using a bilinear transform. | [
"Return",
"a",
"digital",
"filter",
"from",
"an",
"analog",
"one",
"using",
"a",
"bilinear",
"transform",
"."
] | def bilinear(b, a, fs=1.0):
"""Return a digital filter from an analog one using a bilinear transform.
The bilinear transform substitutes ``(z-1) / (z+1)`` for ``s``.
See Also
--------
lp2lp, lp2hp, lp2bp, lp2bs
bilinear_zpk
"""
fs = float(fs)
a, b = map(atleast_1d, (a, b))
D =... | [
"def",
"bilinear",
"(",
"b",
",",
"a",
",",
"fs",
"=",
"1.0",
")",
":",
"fs",
"=",
"float",
"(",
"fs",
")",
"a",
",",
"b",
"=",
"map",
"(",
"atleast_1d",
",",
"(",
"a",
",",
"b",
")",
")",
"D",
"=",
"len",
"(",
"a",
")",
"-",
"1",
"N",
... | https://github.com/catboost/catboost/blob/167f64f237114a4d10b2b4ee42adb4569137debe/contrib/python/scipy/py2/scipy/signal/filter_design.py#L1787-L1827 | |
wxWidgets/wxPython-Classic | 19571e1ae65f1ac445f5491474121998c97a1bf0 | src/osx_carbon/dataview.py | python | DataViewModelNotifier.BeforeReset | (*args, **kwargs) | return _dataview.DataViewModelNotifier_BeforeReset(*args, **kwargs) | BeforeReset(self) -> bool | BeforeReset(self) -> bool | [
"BeforeReset",
"(",
"self",
")",
"-",
">",
"bool"
] | def BeforeReset(*args, **kwargs):
"""BeforeReset(self) -> bool"""
return _dataview.DataViewModelNotifier_BeforeReset(*args, **kwargs) | [
"def",
"BeforeReset",
"(",
"*",
"args",
",",
"*",
"*",
"kwargs",
")",
":",
"return",
"_dataview",
".",
"DataViewModelNotifier_BeforeReset",
"(",
"*",
"args",
",",
"*",
"*",
"kwargs",
")"
] | https://github.com/wxWidgets/wxPython-Classic/blob/19571e1ae65f1ac445f5491474121998c97a1bf0/src/osx_carbon/dataview.py#L259-L261 | |
cms-sw/cmssw | fd9de012d503d3405420bcbeec0ec879baa57cf2 | Alignment/OfflineValidation/python/TkAlAllInOneTool/genericValidation.py | python | ValidationWithPlots.plottingscriptname | (cls) | override with a classmethod | override with a classmethod | [
"override",
"with",
"a",
"classmethod"
] | def plottingscriptname(cls):
"""override with a classmethod""" | [
"def",
"plottingscriptname",
"(",
"cls",
")",
":"
] | https://github.com/cms-sw/cmssw/blob/fd9de012d503d3405420bcbeec0ec879baa57cf2/Alignment/OfflineValidation/python/TkAlAllInOneTool/genericValidation.py#L607-L608 | ||
hanpfei/chromium-net | 392cc1fa3a8f92f42e4071ab6e674d8e0482f83f | third_party/protobuf/python/google/protobuf/internal/python_message.py | python | _InternalUnpackAny | (msg) | return message | Unpacks Any message and returns the unpacked message.
This internal method is differnt from public Any Unpack method which takes
the target message as argument. _InternalUnpackAny method does not have
target message type and need to find the message type in descriptor pool.
Args:
msg: An Any message to be... | Unpacks Any message and returns the unpacked message. | [
"Unpacks",
"Any",
"message",
"and",
"returns",
"the",
"unpacked",
"message",
"."
] | def _InternalUnpackAny(msg):
"""Unpacks Any message and returns the unpacked message.
This internal method is differnt from public Any Unpack method which takes
the target message as argument. _InternalUnpackAny method does not have
target message type and need to find the message type in descriptor pool.
A... | [
"def",
"_InternalUnpackAny",
"(",
"msg",
")",
":",
"type_url",
"=",
"msg",
".",
"type_url",
"db",
"=",
"symbol_database",
".",
"Default",
"(",
")",
"if",
"not",
"type_url",
":",
"return",
"None",
"# TODO(haberman): For now we just strip the hostname. Better logic wil... | https://github.com/hanpfei/chromium-net/blob/392cc1fa3a8f92f42e4071ab6e674d8e0482f83f/third_party/protobuf/python/google/protobuf/internal/python_message.py#L916-L947 | |
mantidproject/mantid | 03deeb89254ec4289edb8771e0188c2090a02f32 | qt/python/mantidqtinterfaces/mantidqtinterfaces/Muon/GUI/Common/corrections_tab_widget/background_corrections_presenter.py | python | BackgroundCorrectionsPresenter.handle_background_changed | (self) | Handles when a Background table cell is changed. | Handles when a Background table cell is changed. | [
"Handles",
"when",
"a",
"Background",
"table",
"cell",
"is",
"changed",
"."
] | def handle_background_changed(self) -> None:
"""Handles when a Background table cell is changed."""
runs, groups = self._selected_runs_and_groups()
background = self.view.selected_background()
for run, group in zip(runs, groups):
self._update_background_in_view_and_model(run,... | [
"def",
"handle_background_changed",
"(",
"self",
")",
"->",
"None",
":",
"runs",
",",
"groups",
"=",
"self",
".",
"_selected_runs_and_groups",
"(",
")",
"background",
"=",
"self",
".",
"view",
".",
"selected_background",
"(",
")",
"for",
"run",
",",
"group",... | https://github.com/mantidproject/mantid/blob/03deeb89254ec4289edb8771e0188c2090a02f32/qt/python/mantidqtinterfaces/mantidqtinterfaces/Muon/GUI/Common/corrections_tab_widget/background_corrections_presenter.py#L105-L112 | ||
aws/lumberyard | f85344403c1c2e77ec8c75deb2c116e97b713217 | dev/Gems/CloudGemDefectReporter/v1/AWS/common-code/Lib/pkg_resources/__init__.py | python | non_empty_lines | (path) | Yield non-empty lines from file at path | Yield non-empty lines from file at path | [
"Yield",
"non",
"-",
"empty",
"lines",
"from",
"file",
"at",
"path"
] | def non_empty_lines(path):
"""
Yield non-empty lines from file at path
"""
with open(path) as f:
for line in f:
line = line.strip()
if line:
yield line | [
"def",
"non_empty_lines",
"(",
"path",
")",
":",
"with",
"open",
"(",
"path",
")",
"as",
"f",
":",
"for",
"line",
"in",
"f",
":",
"line",
"=",
"line",
".",
"strip",
"(",
")",
"if",
"line",
":",
"yield",
"line"
] | https://github.com/aws/lumberyard/blob/f85344403c1c2e77ec8c75deb2c116e97b713217/dev/Gems/CloudGemDefectReporter/v1/AWS/common-code/Lib/pkg_resources/__init__.py#L2122-L2130 | ||
aws/lumberyard | f85344403c1c2e77ec8c75deb2c116e97b713217 | dev/Tools/Python/3.7.10/windows/Lib/_pydecimal.py | python | Context.divide_int | (self, a, b) | Divides two numbers and returns the integer part of the result.
>>> ExtendedContext.divide_int(Decimal('2'), Decimal('3'))
Decimal('0')
>>> ExtendedContext.divide_int(Decimal('10'), Decimal('3'))
Decimal('3')
>>> ExtendedContext.divide_int(Decimal('1'), Decimal('0.3'))
D... | Divides two numbers and returns the integer part of the result. | [
"Divides",
"two",
"numbers",
"and",
"returns",
"the",
"integer",
"part",
"of",
"the",
"result",
"."
] | def divide_int(self, a, b):
"""Divides two numbers and returns the integer part of the result.
>>> ExtendedContext.divide_int(Decimal('2'), Decimal('3'))
Decimal('0')
>>> ExtendedContext.divide_int(Decimal('10'), Decimal('3'))
Decimal('3')
>>> ExtendedContext.divide_int(... | [
"def",
"divide_int",
"(",
"self",
",",
"a",
",",
"b",
")",
":",
"a",
"=",
"_convert_other",
"(",
"a",
",",
"raiseit",
"=",
"True",
")",
"r",
"=",
"a",
".",
"__floordiv__",
"(",
"b",
",",
"context",
"=",
"self",
")",
"if",
"r",
"is",
"NotImplement... | https://github.com/aws/lumberyard/blob/f85344403c1c2e77ec8c75deb2c116e97b713217/dev/Tools/Python/3.7.10/windows/Lib/_pydecimal.py#L4395-L4416 | ||
microsoft/TSS.MSR | 0f2516fca2cd9929c31d5450e39301c9bde43688 | TSS.Py/src/TpmTypes.py | python | TPM2_PCR_Reset_REQUEST.fromTpm | (buf) | return buf.createObj(TPM2_PCR_Reset_REQUEST) | Returns new TPM2_PCR_Reset_REQUEST object constructed from its
marshaled representation in the given TpmBuffer buffer | Returns new TPM2_PCR_Reset_REQUEST object constructed from its
marshaled representation in the given TpmBuffer buffer | [
"Returns",
"new",
"TPM2_PCR_Reset_REQUEST",
"object",
"constructed",
"from",
"its",
"marshaled",
"representation",
"in",
"the",
"given",
"TpmBuffer",
"buffer"
] | def fromTpm(buf):
""" Returns new TPM2_PCR_Reset_REQUEST object constructed from its
marshaled representation in the given TpmBuffer buffer
"""
return buf.createObj(TPM2_PCR_Reset_REQUEST) | [
"def",
"fromTpm",
"(",
"buf",
")",
":",
"return",
"buf",
".",
"createObj",
"(",
"TPM2_PCR_Reset_REQUEST",
")"
] | https://github.com/microsoft/TSS.MSR/blob/0f2516fca2cd9929c31d5450e39301c9bde43688/TSS.Py/src/TpmTypes.py#L14096-L14100 | |
miyosuda/TensorFlowAndroidMNIST | 7b5a4603d2780a8a2834575706e9001977524007 | jni-build/jni/include/tensorflow/contrib/slim/python/slim/data/parallel_reader.py | python | get_data_files | (data_sources) | return data_files | Get data_files from data_sources.
Args:
data_sources: a list/tuple of files or the location of the data, i.e.
/cns/../train@128, /cns/.../train* or /tmp/.../train*
Returns:
a list of data_files.
Raises:
ValueError: if not data files are not found | Get data_files from data_sources. | [
"Get",
"data_files",
"from",
"data_sources",
"."
] | def get_data_files(data_sources):
"""Get data_files from data_sources.
Args:
data_sources: a list/tuple of files or the location of the data, i.e.
/cns/../train@128, /cns/.../train* or /tmp/.../train*
Returns:
a list of data_files.
Raises:
ValueError: if not data files are not found
"""
... | [
"def",
"get_data_files",
"(",
"data_sources",
")",
":",
"if",
"isinstance",
"(",
"data_sources",
",",
"(",
"list",
",",
"tuple",
")",
")",
":",
"data_files",
"=",
"[",
"]",
"for",
"source",
"in",
"data_sources",
":",
"data_files",
"+=",
"get_data_files",
"... | https://github.com/miyosuda/TensorFlowAndroidMNIST/blob/7b5a4603d2780a8a2834575706e9001977524007/jni-build/jni/include/tensorflow/contrib/slim/python/slim/data/parallel_reader.py#L254-L279 | |
D-X-Y/caffe-faster-rcnn | eb50c97ff48f3df115d0e85fe0a32b0c7e2aa4cb | scripts/cpp_lint.py | python | _NestingState.Update | (self, filename, clean_lines, linenum, error) | Update nesting state with current line.
Args:
filename: The name of the current file.
clean_lines: A CleansedLines instance containing the file.
linenum: The number of the line to check.
error: The function to call with any errors found. | Update nesting state with current line. | [
"Update",
"nesting",
"state",
"with",
"current",
"line",
"."
] | def Update(self, filename, clean_lines, linenum, error):
"""Update nesting state with current line.
Args:
filename: The name of the current file.
clean_lines: A CleansedLines instance containing the file.
linenum: The number of the line to check.
error: The function to call with any err... | [
"def",
"Update",
"(",
"self",
",",
"filename",
",",
"clean_lines",
",",
"linenum",
",",
"error",
")",
":",
"line",
"=",
"clean_lines",
".",
"elided",
"[",
"linenum",
"]",
"# Update pp_stack first",
"self",
".",
"UpdatePreprocessor",
"(",
"line",
")",
"# Coun... | https://github.com/D-X-Y/caffe-faster-rcnn/blob/eb50c97ff48f3df115d0e85fe0a32b0c7e2aa4cb/scripts/cpp_lint.py#L2008-L2162 | ||
apple/swift-lldb | d74be846ef3e62de946df343e8c234bde93a8912 | examples/python/dict_utils.py | python | LookupDictionary.get_keys_for_value | (self, value, fail_value=None) | return fail_value | find the key(s) as a list given a value | find the key(s) as a list given a value | [
"find",
"the",
"key",
"(",
"s",
")",
"as",
"a",
"list",
"given",
"a",
"value"
] | def get_keys_for_value(self, value, fail_value=None):
"""find the key(s) as a list given a value"""
list_result = [item[0] for item in self.items() if item[1] == value]
if len(list_result) > 0:
return list_result
return fail_value | [
"def",
"get_keys_for_value",
"(",
"self",
",",
"value",
",",
"fail_value",
"=",
"None",
")",
":",
"list_result",
"=",
"[",
"item",
"[",
"0",
"]",
"for",
"item",
"in",
"self",
".",
"items",
"(",
")",
"if",
"item",
"[",
"1",
"]",
"==",
"value",
"]",
... | https://github.com/apple/swift-lldb/blob/d74be846ef3e62de946df343e8c234bde93a8912/examples/python/dict_utils.py#L11-L16 | |
aws/lumberyard | f85344403c1c2e77ec8c75deb2c116e97b713217 | dev/Gems/CloudGemDefectReporter/v1/AWS/common-code/Lib/urllib3/poolmanager.py | python | PoolManager.connection_from_context | (self, request_context) | return self.connection_from_pool_key(pool_key, request_context=request_context) | Get a :class:`ConnectionPool` based on the request context.
``request_context`` must at least contain the ``scheme`` key and its
value must be a key in ``key_fn_by_scheme`` instance variable. | Get a :class:`ConnectionPool` based on the request context. | [
"Get",
"a",
":",
"class",
":",
"ConnectionPool",
"based",
"on",
"the",
"request",
"context",
"."
] | def connection_from_context(self, request_context):
"""
Get a :class:`ConnectionPool` based on the request context.
``request_context`` must at least contain the ``scheme`` key and its
value must be a key in ``key_fn_by_scheme`` instance variable.
"""
scheme = request_co... | [
"def",
"connection_from_context",
"(",
"self",
",",
"request_context",
")",
":",
"scheme",
"=",
"request_context",
"[",
"'scheme'",
"]",
".",
"lower",
"(",
")",
"pool_key_constructor",
"=",
"self",
".",
"key_fn_by_scheme",
"[",
"scheme",
"]",
"pool_key",
"=",
... | https://github.com/aws/lumberyard/blob/f85344403c1c2e77ec8c75deb2c116e97b713217/dev/Gems/CloudGemDefectReporter/v1/AWS/common-code/Lib/urllib3/poolmanager.py#L229-L240 | |
windystrife/UnrealEngine_NVIDIAGameWorks | b50e6338a7c5b26374d66306ebc7807541ff815e | Engine/Extras/ThirdPartyNotUE/emsdk/Win64/python/2.7.5.3_64bit/Lib/_abcoll.py | python | MutableMapping.update | (*args, **kwds) | D.update([E, ]**F) -> None. Update D from mapping/iterable E and F.
If E present and has a .keys() method, does: for k in E: D[k] = E[k]
If E present and lacks .keys() method, does: for (k, v) in E: D[k] = v
In either case, this is followed by: for k, v in F.items(): D[k] = ... | D.update([E, ]**F) -> None. Update D from mapping/iterable E and F.
If E present and has a .keys() method, does: for k in E: D[k] = E[k]
If E present and lacks .keys() method, does: for (k, v) in E: D[k] = v
In either case, this is followed by: for k, v in F.items(): D[k] = ... | [
"D",
".",
"update",
"(",
"[",
"E",
"]",
"**",
"F",
")",
"-",
">",
"None",
".",
"Update",
"D",
"from",
"mapping",
"/",
"iterable",
"E",
"and",
"F",
".",
"If",
"E",
"present",
"and",
"has",
"a",
".",
"keys",
"()",
"method",
"does",
":",
"for",
... | def update(*args, **kwds):
''' D.update([E, ]**F) -> None. Update D from mapping/iterable E and F.
If E present and has a .keys() method, does: for k in E: D[k] = E[k]
If E present and lacks .keys() method, does: for (k, v) in E: D[k] = v
In either case, this is foll... | [
"def",
"update",
"(",
"*",
"args",
",",
"*",
"*",
"kwds",
")",
":",
"if",
"len",
"(",
"args",
")",
">",
"2",
":",
"raise",
"TypeError",
"(",
"\"update() takes at most 2 positional \"",
"\"arguments ({} given)\"",
".",
"format",
"(",
"len",
"(",
"args",
")"... | https://github.com/windystrife/UnrealEngine_NVIDIAGameWorks/blob/b50e6338a7c5b26374d66306ebc7807541ff815e/Engine/Extras/ThirdPartyNotUE/emsdk/Win64/python/2.7.5.3_64bit/Lib/_abcoll.py#L526-L550 | ||
gnuradio/gnuradio | 09c3c4fa4bfb1a02caac74cb5334dfe065391e3b | grc/gui/StateCache.py | python | StateCache.get_next_state | (self) | return None | Get the nest state and increment the current index.
Returns:
the next state or None | Get the nest state and increment the current index. | [
"Get",
"the",
"nest",
"state",
"and",
"increment",
"the",
"current",
"index",
"."
] | def get_next_state(self):
"""
Get the nest state and increment the current index.
Returns:
the next state or None
"""
if self.num_next_states > 0:
self.current_state_index = (
self.current_state_index + 1) % STATE_CACHE_SIZE
se... | [
"def",
"get_next_state",
"(",
"self",
")",
":",
"if",
"self",
".",
"num_next_states",
">",
"0",
":",
"self",
".",
"current_state_index",
"=",
"(",
"self",
".",
"current_state_index",
"+",
"1",
")",
"%",
"STATE_CACHE_SIZE",
"self",
".",
"num_next_states",
"="... | https://github.com/gnuradio/gnuradio/blob/09c3c4fa4bfb1a02caac74cb5334dfe065391e3b/grc/gui/StateCache.py#L76-L89 | |
SoarGroup/Soar | a1c5e249499137a27da60533c72969eef3b8ab6b | scons/scons-local-4.1.0/SCons/Environment.py | python | Base.get_factory | (self, factory, default='File') | return factory | Return a factory function for creating Nodes for this
construction environment. | Return a factory function for creating Nodes for this
construction environment. | [
"Return",
"a",
"factory",
"function",
"for",
"creating",
"Nodes",
"for",
"this",
"construction",
"environment",
"."
] | def get_factory(self, factory, default='File'):
"""Return a factory function for creating Nodes for this
construction environment.
"""
name = default
try:
is_node = issubclass(factory, SCons.Node.FS.Base)
except TypeError:
# The specified factory i... | [
"def",
"get_factory",
"(",
"self",
",",
"factory",
",",
"default",
"=",
"'File'",
")",
":",
"name",
"=",
"default",
"try",
":",
"is_node",
"=",
"issubclass",
"(",
"factory",
",",
"SCons",
".",
"Node",
".",
"FS",
".",
"Base",
")",
"except",
"TypeError",... | https://github.com/SoarGroup/Soar/blob/a1c5e249499137a27da60533c72969eef3b8ab6b/scons/scons-local-4.1.0/SCons/Environment.py#L1053-L1080 | |
baidu-research/tensorflow-allreduce | 66d5b855e90b0949e9fa5cca5599fd729a70e874 | tensorflow/python/ops/distributions/util.py | python | _is_known_unsigned_by_dtype | (dt) | return {
dtypes.bool: True,
dtypes.uint8: True,
dtypes.uint16: True,
}.get(dt.base_dtype, False) | Helper returning True if dtype is known to be unsigned. | Helper returning True if dtype is known to be unsigned. | [
"Helper",
"returning",
"True",
"if",
"dtype",
"is",
"known",
"to",
"be",
"unsigned",
"."
] | def _is_known_unsigned_by_dtype(dt):
"""Helper returning True if dtype is known to be unsigned."""
return {
dtypes.bool: True,
dtypes.uint8: True,
dtypes.uint16: True,
}.get(dt.base_dtype, False) | [
"def",
"_is_known_unsigned_by_dtype",
"(",
"dt",
")",
":",
"return",
"{",
"dtypes",
".",
"bool",
":",
"True",
",",
"dtypes",
".",
"uint8",
":",
"True",
",",
"dtypes",
".",
"uint16",
":",
"True",
",",
"}",
".",
"get",
"(",
"dt",
".",
"base_dtype",
","... | https://github.com/baidu-research/tensorflow-allreduce/blob/66d5b855e90b0949e9fa5cca5599fd729a70e874/tensorflow/python/ops/distributions/util.py#L239-L245 | |
panda3d/panda3d | 833ad89ebad58395d0af0b7ec08538e5e4308265 | direct/src/distributed/ServerRepository.py | python | ServerRepository.handleClientObjectUpdateField | (self, datagram, dgi, targeted = False) | Received an update request from a client. | Received an update request from a client. | [
"Received",
"an",
"update",
"request",
"from",
"a",
"client",
"."
] | def handleClientObjectUpdateField(self, datagram, dgi, targeted = False):
""" Received an update request from a client. """
connection = datagram.getConnection()
client = self.clientsByConnection[connection]
if targeted:
targetId = dgi.getUint32()
doId = dgi.getUint3... | [
"def",
"handleClientObjectUpdateField",
"(",
"self",
",",
"datagram",
",",
"dgi",
",",
"targeted",
"=",
"False",
")",
":",
"connection",
"=",
"datagram",
".",
"getConnection",
"(",
")",
"client",
"=",
"self",
".",
"clientsByConnection",
"[",
"connection",
"]",... | https://github.com/panda3d/panda3d/blob/833ad89ebad58395d0af0b7ec08538e5e4308265/direct/src/distributed/ServerRepository.py#L445-L514 | ||
hanpfei/chromium-net | 392cc1fa3a8f92f42e4071ab6e674d8e0482f83f | third_party/catapult/third_party/gsutil/third_party/httplib2/upload-diffs.py | python | VersionControlSystem.CheckForUnknownFiles | (self) | Show an "are you sure?" prompt if there are unknown files. | Show an "are you sure?" prompt if there are unknown files. | [
"Show",
"an",
"are",
"you",
"sure?",
"prompt",
"if",
"there",
"are",
"unknown",
"files",
"."
] | def CheckForUnknownFiles(self):
"""Show an "are you sure?" prompt if there are unknown files."""
unknown_files = self.GetUnknownFiles()
if unknown_files:
print "The following files are not added to version control:"
for line in unknown_files:
print line
prompt = "Are you sure to co... | [
"def",
"CheckForUnknownFiles",
"(",
"self",
")",
":",
"unknown_files",
"=",
"self",
".",
"GetUnknownFiles",
"(",
")",
"if",
"unknown_files",
":",
"print",
"\"The following files are not added to version control:\"",
"for",
"line",
"in",
"unknown_files",
":",
"print",
... | https://github.com/hanpfei/chromium-net/blob/392cc1fa3a8f92f42e4071ab6e674d8e0482f83f/third_party/catapult/third_party/gsutil/third_party/httplib2/upload-diffs.py#L839-L849 | ||
eventql/eventql | 7ca0dbb2e683b525620ea30dc40540a22d5eb227 | deps/3rdparty/spidermonkey/mozjs/python/mach/mach/mixin/logging.py | python | LoggingMixin.populate_logger | (self, name=None) | Ensure this class instance has a logger associated with it.
Users of this mixin that call log() will need to ensure self._logger is
a logging.Logger instance before they call log(). This function ensures
self._logger is defined by populating it if it isn't. | Ensure this class instance has a logger associated with it. | [
"Ensure",
"this",
"class",
"instance",
"has",
"a",
"logger",
"associated",
"with",
"it",
"."
] | def populate_logger(self, name=None):
"""Ensure this class instance has a logger associated with it.
Users of this mixin that call log() will need to ensure self._logger is
a logging.Logger instance before they call log(). This function ensures
self._logger is defined by populating it i... | [
"def",
"populate_logger",
"(",
"self",
",",
"name",
"=",
"None",
")",
":",
"if",
"hasattr",
"(",
"self",
",",
"'_logger'",
")",
":",
"return",
"if",
"name",
"is",
"None",
":",
"name",
"=",
"'.'",
".",
"join",
"(",
"[",
"self",
".",
"__module__",
",... | https://github.com/eventql/eventql/blob/7ca0dbb2e683b525620ea30dc40540a22d5eb227/deps/3rdparty/spidermonkey/mozjs/python/mach/mach/mixin/logging.py#L13-L26 | ||
windystrife/UnrealEngine_NVIDIAGameWorks | b50e6338a7c5b26374d66306ebc7807541ff815e | Engine/Extras/ThirdPartyNotUE/emsdk/Win64/python/2.7.5.3_64bit/Lib/fileinput.py | python | isfirstline | () | return _state.isfirstline() | Returns true the line just read is the first line of its file,
otherwise returns false. | Returns true the line just read is the first line of its file,
otherwise returns false. | [
"Returns",
"true",
"the",
"line",
"just",
"read",
"is",
"the",
"first",
"line",
"of",
"its",
"file",
"otherwise",
"returns",
"false",
"."
] | def isfirstline():
"""
Returns true the line just read is the first line of its file,
otherwise returns false.
"""
if not _state:
raise RuntimeError, "no active input()"
return _state.isfirstline() | [
"def",
"isfirstline",
"(",
")",
":",
"if",
"not",
"_state",
":",
"raise",
"RuntimeError",
",",
"\"no active input()\"",
"return",
"_state",
".",
"isfirstline",
"(",
")"
] | https://github.com/windystrife/UnrealEngine_NVIDIAGameWorks/blob/b50e6338a7c5b26374d66306ebc7807541ff815e/Engine/Extras/ThirdPartyNotUE/emsdk/Win64/python/2.7.5.3_64bit/Lib/fileinput.py#L166-L173 | |
LiquidPlayer/LiquidCore | 9405979363f2353ac9a71ad8ab59685dd7f919c9 | deps/boost_1_66_0/tools/build/src/build/virtual_target.py | python | VirtualTarget.name | (self) | return self.name_ | Name of this target. | Name of this target. | [
"Name",
"of",
"this",
"target",
"."
] | def name (self):
""" Name of this target.
"""
return self.name_ | [
"def",
"name",
"(",
"self",
")",
":",
"return",
"self",
".",
"name_"
] | https://github.com/LiquidPlayer/LiquidCore/blob/9405979363f2353ac9a71ad8ab59685dd7f919c9/deps/boost_1_66_0/tools/build/src/build/virtual_target.py#L289-L292 | |
openvinotoolkit/openvino | dedcbeafa8b84cccdc55ca64b8da516682b381c7 | docs/scripts/create_mapping.py | python | create_mapping | (xml_input: Path, output_dir: Path, strip_path: Path) | Create a mapping between doxygen label and file path for edit on github button. | Create a mapping between doxygen label and file path for edit on github button. | [
"Create",
"a",
"mapping",
"between",
"doxygen",
"label",
"and",
"file",
"path",
"for",
"edit",
"on",
"github",
"button",
"."
] | def create_mapping(xml_input: Path, output_dir: Path, strip_path: Path):
"""
Create a mapping between doxygen label and file path for edit on github button.
"""
xml_input = xml_input.resolve()
output_dir = output_dir.resolve()
strip_path = strip_path.resolve()
mapping = {
'get_starte... | [
"def",
"create_mapping",
"(",
"xml_input",
":",
"Path",
",",
"output_dir",
":",
"Path",
",",
"strip_path",
":",
"Path",
")",
":",
"xml_input",
"=",
"xml_input",
".",
"resolve",
"(",
")",
"output_dir",
"=",
"output_dir",
".",
"resolve",
"(",
")",
"strip_pat... | https://github.com/openvinotoolkit/openvino/blob/dedcbeafa8b84cccdc55ca64b8da516682b381c7/docs/scripts/create_mapping.py#L15-L68 | ||
aws/lumberyard | f85344403c1c2e77ec8c75deb2c116e97b713217 | dev/Tools/Python/3.7.10/mac/Python.framework/Versions/3.7/lib/python3.7/site-packages/pip/_internal/operations/install/wheel.py | python | _normalized_outrows | (outrows) | return sorted(
(ensure_str(record_path, encoding='utf-8'), hash_, str(size))
for record_path, hash_, size in outrows
) | Normalize the given rows of a RECORD file.
Items in each row are converted into str. Rows are then sorted to make
the value more predictable for tests.
Each row is a 3-tuple (path, hash, size) and corresponds to a record of
a RECORD file (see PEP 376 and PEP 427 for details). For the rows
passed ... | Normalize the given rows of a RECORD file. | [
"Normalize",
"the",
"given",
"rows",
"of",
"a",
"RECORD",
"file",
"."
] | def _normalized_outrows(outrows):
# type: (Iterable[InstalledCSVRow]) -> List[Tuple[str, str, str]]
"""Normalize the given rows of a RECORD file.
Items in each row are converted into str. Rows are then sorted to make
the value more predictable for tests.
Each row is a 3-tuple (path, hash, size) an... | [
"def",
"_normalized_outrows",
"(",
"outrows",
")",
":",
"# type: (Iterable[InstalledCSVRow]) -> List[Tuple[str, str, str]]",
"# Normally, there should only be one row per path, in which case the",
"# second and third elements don't come into play when sorting.",
"# However, in cases in the wild wh... | 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/_internal/operations/install/wheel.py#L226-L249 | |
pmq20/node-packer | 12c46c6e44fbc14d9ee645ebd17d5296b324f7e0 | lts/tools/gyp/pylib/gyp/win_tool.py | python | WinTool._UseSeparateMspdbsrv | (self, env, args) | Allows to use a unique instance of mspdbsrv.exe per linker instead of a
shared one. | Allows to use a unique instance of mspdbsrv.exe per linker instead of a
shared one. | [
"Allows",
"to",
"use",
"a",
"unique",
"instance",
"of",
"mspdbsrv",
".",
"exe",
"per",
"linker",
"instead",
"of",
"a",
"shared",
"one",
"."
] | def _UseSeparateMspdbsrv(self, env, args):
"""Allows to use a unique instance of mspdbsrv.exe per linker instead of a
shared one."""
if len(args) < 1:
raise Exception("Not enough arguments")
if args[0] != 'link.exe':
return
# Use the output filename passed to the linker to generate an ... | [
"def",
"_UseSeparateMspdbsrv",
"(",
"self",
",",
"env",
",",
"args",
")",
":",
"if",
"len",
"(",
"args",
")",
"<",
"1",
":",
"raise",
"Exception",
"(",
"\"Not enough arguments\"",
")",
"if",
"args",
"[",
"0",
"]",
"!=",
"'link.exe'",
":",
"return",
"# ... | https://github.com/pmq20/node-packer/blob/12c46c6e44fbc14d9ee645ebd17d5296b324f7e0/lts/tools/gyp/pylib/gyp/win_tool.py#L40-L65 | ||
forkineye/ESPixelStick | 22926f1c0d1131f1369fc7cad405689a095ae3cb | dist/bin/esptool/esptool.py | python | timeout_per_mb | (seconds_per_mb, size_bytes) | return result | Scales timeouts which are size-specific | Scales timeouts which are size-specific | [
"Scales",
"timeouts",
"which",
"are",
"size",
"-",
"specific"
] | def timeout_per_mb(seconds_per_mb, size_bytes):
""" Scales timeouts which are size-specific """
result = seconds_per_mb * (size_bytes / 1e6)
if result < DEFAULT_TIMEOUT:
return DEFAULT_TIMEOUT
return result | [
"def",
"timeout_per_mb",
"(",
"seconds_per_mb",
",",
"size_bytes",
")",
":",
"result",
"=",
"seconds_per_mb",
"*",
"(",
"size_bytes",
"/",
"1e6",
")",
"if",
"result",
"<",
"DEFAULT_TIMEOUT",
":",
"return",
"DEFAULT_TIMEOUT",
"return",
"result"
] | https://github.com/forkineye/ESPixelStick/blob/22926f1c0d1131f1369fc7cad405689a095ae3cb/dist/bin/esptool/esptool.py#L79-L84 | |
Yaafe/Yaafe | f5ed847bdbf540b47e8fe1980dddfb5509ae7f9d | src_python/yaafelib/engine.py | python | Engine.getInputs | (self) | return res | Get input metadata. Result format is the same as for
:py:meth:`getOutputs` method, but the general case is
that there is only one input named 'audio' and the sole
relevant metadata are:
:sampleRate: expected audio sampleRate
:parameters: attached parameters
... | Get input metadata. Result format is the same as for
:py:meth:`getOutputs` method, but the general case is
that there is only one input named 'audio' and the sole
relevant metadata are: | [
"Get",
"input",
"metadata",
".",
"Result",
"format",
"is",
"the",
"same",
"as",
"for",
":",
"py",
":",
"meth",
":",
"getOutputs",
"method",
"but",
"the",
"general",
"case",
"is",
"that",
"there",
"is",
"only",
"one",
"input",
"named",
"audio",
"and",
"... | def getInputs(self):
"""
Get input metadata. Result format is the same as for
:py:meth:`getOutputs` method, but the general case is
that there is only one input named 'audio' and the sole
relevant metadata are:
:sampleRate: expected audio sampleRate
... | [
"def",
"getInputs",
"(",
"self",
")",
":",
"res",
"=",
"{",
"}",
"iList",
"=",
"yc",
".",
"engine_getInputList",
"(",
"self",
".",
"ptr",
")",
"for",
"inputname",
"in",
"iterPtrList",
"(",
"iList",
")",
":",
"ptr",
"=",
"yc",
".",
"engine_getInputInfos... | https://github.com/Yaafe/Yaafe/blob/f5ed847bdbf540b47e8fe1980dddfb5509ae7f9d/src_python/yaafelib/engine.py#L156-L184 | |
catboost/catboost | 167f64f237114a4d10b2b4ee42adb4569137debe | contrib/python/scipy/py2/scipy/linalg/decomp_schur.py | python | rsf2csf | (T, Z, check_finite=True) | return T, Z | Convert real Schur form to complex Schur form.
Convert a quasi-diagonal real-valued Schur form to the upper triangular
complex-valued Schur form.
Parameters
----------
T : (M, M) array_like
Real Schur form of the original array
Z : (M, M) array_like
Schur transformation matrix
... | Convert real Schur form to complex Schur form. | [
"Convert",
"real",
"Schur",
"form",
"to",
"complex",
"Schur",
"form",
"."
] | def rsf2csf(T, Z, check_finite=True):
"""
Convert real Schur form to complex Schur form.
Convert a quasi-diagonal real-valued Schur form to the upper triangular
complex-valued Schur form.
Parameters
----------
T : (M, M) array_like
Real Schur form of the original array
Z : (M, ... | [
"def",
"rsf2csf",
"(",
"T",
",",
"Z",
",",
"check_finite",
"=",
"True",
")",
":",
"if",
"check_finite",
":",
"Z",
",",
"T",
"=",
"map",
"(",
"asarray_chkfinite",
",",
"(",
"Z",
",",
"T",
")",
")",
"else",
":",
"Z",
",",
"T",
"=",
"map",
"(",
... | https://github.com/catboost/catboost/blob/167f64f237114a4d10b2b4ee42adb4569137debe/contrib/python/scipy/py2/scipy/linalg/decomp_schur.py#L213-L295 | |
BSVino/DoubleAction | c550b168a3e919926c198c30240f506538b92e75 | mp/src/thirdparty/protobuf-2.3.0/python/google/protobuf/descriptor.py | python | EnumDescriptor.CopyToProto | (self, proto) | Copies this to a descriptor_pb2.EnumDescriptorProto.
Args:
proto: An empty descriptor_pb2.EnumDescriptorProto. | Copies this to a descriptor_pb2.EnumDescriptorProto. | [
"Copies",
"this",
"to",
"a",
"descriptor_pb2",
".",
"EnumDescriptorProto",
"."
] | def CopyToProto(self, proto):
"""Copies this to a descriptor_pb2.EnumDescriptorProto.
Args:
proto: An empty descriptor_pb2.EnumDescriptorProto.
"""
# This function is overriden to give a better doc comment.
super(EnumDescriptor, self).CopyToProto(proto) | [
"def",
"CopyToProto",
"(",
"self",
",",
"proto",
")",
":",
"# This function is overriden to give a better doc comment.",
"super",
"(",
"EnumDescriptor",
",",
"self",
")",
".",
"CopyToProto",
"(",
"proto",
")"
] | https://github.com/BSVino/DoubleAction/blob/c550b168a3e919926c198c30240f506538b92e75/mp/src/thirdparty/protobuf-2.3.0/python/google/protobuf/descriptor.py#L448-L455 | ||
wxWidgets/wxPython-Classic | 19571e1ae65f1ac445f5491474121998c97a1bf0 | wx/lib/agw/ribbon/bar.py | python | RibbonBar.RecalculateMinSize | (self) | Recalculates the :class:`RibbonBar` minimum size. | Recalculates the :class:`RibbonBar` minimum size. | [
"Recalculates",
"the",
":",
"class",
":",
"RibbonBar",
"minimum",
"size",
"."
] | def RecalculateMinSize(self):
""" Recalculates the :class:`RibbonBar` minimum size. """
min_size = wx.Size(-1, -1)
numtabs = len(self._pages)
if numtabs != 0:
min_size = wx.Size(*self._pages[0].page.GetMinSize())
for info in self._pages:
... | [
"def",
"RecalculateMinSize",
"(",
"self",
")",
":",
"min_size",
"=",
"wx",
".",
"Size",
"(",
"-",
"1",
",",
"-",
"1",
")",
"numtabs",
"=",
"len",
"(",
"self",
".",
"_pages",
")",
"if",
"numtabs",
"!=",
"0",
":",
"min_size",
"=",
"wx",
".",
"Size"... | https://github.com/wxWidgets/wxPython-Classic/blob/19571e1ae65f1ac445f5491474121998c97a1bf0/wx/lib/agw/ribbon/bar.py#L1186-L1206 | ||
aws/lumberyard | f85344403c1c2e77ec8c75deb2c116e97b713217 | dev/Gems/CloudGemMetric/v1/AWS/python/windows/Lib/pandas/core/arrays/period.py | python | PeriodArray._format_native_types | (self, na_rep="NaT", date_format=None, **kwargs) | return values | actually format my specific types | actually format my specific types | [
"actually",
"format",
"my",
"specific",
"types"
] | def _format_native_types(self, na_rep="NaT", date_format=None, **kwargs):
"""
actually format my specific types
"""
values = self.astype(object)
if date_format:
formatter = lambda dt: dt.strftime(date_format)
else:
formatter = lambda dt: str(dt)
... | [
"def",
"_format_native_types",
"(",
"self",
",",
"na_rep",
"=",
"\"NaT\"",
",",
"date_format",
"=",
"None",
",",
"*",
"*",
"kwargs",
")",
":",
"values",
"=",
"self",
".",
"astype",
"(",
"object",
")",
"if",
"date_format",
":",
"formatter",
"=",
"lambda",... | https://github.com/aws/lumberyard/blob/f85344403c1c2e77ec8c75deb2c116e97b713217/dev/Gems/CloudGemMetric/v1/AWS/python/windows/Lib/pandas/core/arrays/period.py#L558-L576 | |
waymo-research/waymo-open-dataset | 5de359f3429e1496761790770868296140161b66 | waymo_open_dataset/utils/frame_utils.py | python | convert_range_image_to_cartesian | (frame,
range_images,
range_image_top_pose,
ri_index=0,
keep_polar_features=False) | return cartesian_range_images | Convert range images from polar coordinates to Cartesian coordinates.
Args:
frame: open dataset frame
range_images: A dict of {laser_name, [range_image_first_return,
range_image_second_return]}.
range_image_top_pose: range image pixel pose for top lidar.
ri_index: 0 for the first return, 1 for... | Convert range images from polar coordinates to Cartesian coordinates. | [
"Convert",
"range",
"images",
"from",
"polar",
"coordinates",
"to",
"Cartesian",
"coordinates",
"."
] | def convert_range_image_to_cartesian(frame,
range_images,
range_image_top_pose,
ri_index=0,
keep_polar_features=False):
"""Convert range images from polar coordinates to ... | [
"def",
"convert_range_image_to_cartesian",
"(",
"frame",
",",
"range_images",
",",
"range_image_top_pose",
",",
"ri_index",
"=",
"0",
",",
"keep_polar_features",
"=",
"False",
")",
":",
"cartesian_range_images",
"=",
"{",
"}",
"frame_pose",
"=",
"tf",
".",
"conver... | https://github.com/waymo-research/waymo-open-dataset/blob/5de359f3429e1496761790770868296140161b66/waymo_open_dataset/utils/frame_utils.py#L81-L158 | |
eventql/eventql | 7ca0dbb2e683b525620ea30dc40540a22d5eb227 | deps/3rdparty/spidermonkey/mozjs/python/jsmin/jsmin/__init__.py | python | jsmin | (js, **kwargs) | return outs.getvalue() | returns a minified version of the javascript string | returns a minified version of the javascript string | [
"returns",
"a",
"minified",
"version",
"of",
"the",
"javascript",
"string"
] | def jsmin(js, **kwargs):
"""
returns a minified version of the javascript string
"""
if not is_3:
if cStringIO and not isinstance(js, unicode):
# strings can use cStringIO for a 3x performance
# improvement, but unicode (in python2) cannot
klass = cStr... | [
"def",
"jsmin",
"(",
"js",
",",
"*",
"*",
"kwargs",
")",
":",
"if",
"not",
"is_3",
":",
"if",
"cStringIO",
"and",
"not",
"isinstance",
"(",
"js",
",",
"unicode",
")",
":",
"# strings can use cStringIO for a 3x performance",
"# improvement, but unicode (in python2)... | https://github.com/eventql/eventql/blob/7ca0dbb2e683b525620ea30dc40540a22d5eb227/deps/3rdparty/spidermonkey/mozjs/python/jsmin/jsmin/__init__.py#L43-L59 | |
xhzdeng/crpn | a5aef0f80dbe486103123f740c634fb01e6cc9a1 | lib/pycocotools/coco.py | python | COCO.download | ( self, tarDir = None, imgIds = [] ) | Download COCO images from mscoco.org server.
:param tarDir (str): COCO results directory name
imgIds (list): images to be downloaded
:return: | Download COCO images from mscoco.org server.
:param tarDir (str): COCO results directory name
imgIds (list): images to be downloaded
:return: | [
"Download",
"COCO",
"images",
"from",
"mscoco",
".",
"org",
"server",
".",
":",
"param",
"tarDir",
"(",
"str",
")",
":",
"COCO",
"results",
"directory",
"name",
"imgIds",
"(",
"list",
")",
":",
"images",
"to",
"be",
"downloaded",
":",
"return",
":"
] | def download( self, tarDir = None, imgIds = [] ):
'''
Download COCO images from mscoco.org server.
:param tarDir (str): COCO results directory name
imgIds (list): images to be downloaded
:return:
'''
if tarDir is None:
print 'Please specify targ... | [
"def",
"download",
"(",
"self",
",",
"tarDir",
"=",
"None",
",",
"imgIds",
"=",
"[",
"]",
")",
":",
"if",
"tarDir",
"is",
"None",
":",
"print",
"'Please specify target directory'",
"return",
"-",
"1",
"if",
"len",
"(",
"imgIds",
")",
"==",
"0",
":",
... | https://github.com/xhzdeng/crpn/blob/a5aef0f80dbe486103123f740c634fb01e6cc9a1/lib/pycocotools/coco.py#L329-L351 | ||
baidu-research/tensorflow-allreduce | 66d5b855e90b0949e9fa5cca5599fd729a70e874 | tensorflow/contrib/learn/python/learn/dataframe/transform.py | python | TensorFlowTransform._check_output_tensors | (self, output_tensors) | Helper for `build(...)`; verifies the output of `_build_transform`.
Args:
output_tensors: value returned by a call to `_build_transform`.
Raises:
TypeError: `transform_output` is not a list.
ValueError: `transform_output` does not match `output_names`. | Helper for `build(...)`; verifies the output of `_build_transform`. | [
"Helper",
"for",
"build",
"(",
"...",
")",
";",
"verifies",
"the",
"output",
"of",
"_build_transform",
"."
] | def _check_output_tensors(self, output_tensors):
"""Helper for `build(...)`; verifies the output of `_build_transform`.
Args:
output_tensors: value returned by a call to `_build_transform`.
Raises:
TypeError: `transform_output` is not a list.
ValueError: `transform_output` does not match... | [
"def",
"_check_output_tensors",
"(",
"self",
",",
"output_tensors",
")",
":",
"if",
"not",
"isinstance",
"(",
"output_tensors",
",",
"self",
".",
"return_type",
")",
":",
"raise",
"TypeError",
"(",
"\"Expected a NamedTuple of Tensors with elements %s; got %s.\"",
"%",
... | https://github.com/baidu-research/tensorflow-allreduce/blob/66d5b855e90b0949e9fa5cca5599fd729a70e874/tensorflow/contrib/learn/python/learn/dataframe/transform.py#L251-L264 | ||
borglab/gtsam | a5bee157efce6a0563704bce6a5d188c29817f39 | gtsam/3rdparty/GeographicLib/python/geographiclib/polygonarea.py | python | PolygonArea.AddEdge | (self, azi, s) | Add the next edge to the polygon
:param azi: the azimuth at the current the point in degrees
:param s: the length of the edge in meters
This specifies the new vertex in terms of the edge from the current
vertex. | Add the next edge to the polygon | [
"Add",
"the",
"next",
"edge",
"to",
"the",
"polygon"
] | def AddEdge(self, azi, s):
"""Add the next edge to the polygon
:param azi: the azimuth at the current the point in degrees
:param s: the length of the edge in meters
This specifies the new vertex in terms of the edge from the current
vertex.
"""
if self.num != 0:
_, lat, lon, _, _,... | [
"def",
"AddEdge",
"(",
"self",
",",
"azi",
",",
"s",
")",
":",
"if",
"self",
".",
"num",
"!=",
"0",
":",
"_",
",",
"lat",
",",
"lon",
",",
"_",
",",
"_",
",",
"_",
",",
"_",
",",
"_",
",",
"S12",
"=",
"self",
".",
"earth",
".",
"_GenDirec... | https://github.com/borglab/gtsam/blob/a5bee157efce6a0563704bce6a5d188c29817f39/gtsam/3rdparty/GeographicLib/python/geographiclib/polygonarea.py#L139-L159 | ||
apache/trafodion | 8455c839ad6b6d7b6e04edda5715053095b78046 | install/python-installer/scripts/common.py | python | ParseJson.load | (self) | load json file to a dict | load json file to a dict | [
"load",
"json",
"file",
"to",
"a",
"dict"
] | def load(self):
""" load json file to a dict """
if not os.path.exists(self.__js_file): err_m('Cannot find json file %s' % self.__js_file)
with open(self.__js_file, 'r') as f:
tmparray = f.readlines()
content = ''
for t in tmparray:
content += t
t... | [
"def",
"load",
"(",
"self",
")",
":",
"if",
"not",
"os",
".",
"path",
".",
"exists",
"(",
"self",
".",
"__js_file",
")",
":",
"err_m",
"(",
"'Cannot find json file %s'",
"%",
"self",
".",
"__js_file",
")",
"with",
"open",
"(",
"self",
".",
"__js_file",... | https://github.com/apache/trafodion/blob/8455c839ad6b6d7b6e04edda5715053095b78046/install/python-installer/scripts/common.py#L554-L566 | ||
Samsung/veles | 95ed733c2e49bc011ad98ccf2416ecec23fbf352 | libVeles/cpplint.py | python | CleanseComments | (line) | return _RE_PATTERN_CLEANSE_LINE_C_COMMENTS.sub('', line) | Removes //-comments and single-line C-style /* */ comments.
Args:
line: A line of C++ source.
Returns:
The line with single-line comments removed. | Removes //-comments and single-line C-style /* */ comments. | [
"Removes",
"//",
"-",
"comments",
"and",
"single",
"-",
"line",
"C",
"-",
"style",
"/",
"*",
"*",
"/",
"comments",
"."
] | def CleanseComments(line):
"""Removes //-comments and single-line C-style /* */ comments.
Args:
line: A line of C++ source.
Returns:
The line with single-line comments removed.
"""
commentpos = line.find('//')
if commentpos != -1 and not IsCppString(line[:commentpos]):
line = line[:commentpos]... | [
"def",
"CleanseComments",
"(",
"line",
")",
":",
"commentpos",
"=",
"line",
".",
"find",
"(",
"'//'",
")",
"if",
"commentpos",
"!=",
"-",
"1",
"and",
"not",
"IsCppString",
"(",
"line",
"[",
":",
"commentpos",
"]",
")",
":",
"line",
"=",
"line",
"[",
... | https://github.com/Samsung/veles/blob/95ed733c2e49bc011ad98ccf2416ecec23fbf352/libVeles/cpplint.py#L972-L985 | |
benoitsteiner/tensorflow-opencl | cb7cb40a57fde5cfd4731bc551e82a1e2fef43a5 | configure.py | python | set_mpi_home | (environ_cp) | Set MPI_HOME. | Set MPI_HOME. | [
"Set",
"MPI_HOME",
"."
] | def set_mpi_home(environ_cp):
"""Set MPI_HOME."""
default_mpi_home = which('mpirun') or which('mpiexec') or ''
default_mpi_home = os.path.dirname(os.path.dirname(default_mpi_home))
ask_mpi_home = ('Please specify the MPI toolkit folder. [Default is %s]: '
) % default_mpi_home
while True:
... | [
"def",
"set_mpi_home",
"(",
"environ_cp",
")",
":",
"default_mpi_home",
"=",
"which",
"(",
"'mpirun'",
")",
"or",
"which",
"(",
"'mpiexec'",
")",
"or",
"''",
"default_mpi_home",
"=",
"os",
".",
"path",
".",
"dirname",
"(",
"os",
".",
"path",
".",
"dirnam... | https://github.com/benoitsteiner/tensorflow-opencl/blob/cb7cb40a57fde5cfd4731bc551e82a1e2fef43a5/configure.py#L885-L906 | ||
aws/lumberyard | f85344403c1c2e77ec8c75deb2c116e97b713217 | dev/Tools/Python/3.7.10/windows/Lib/turtle.py | python | read_docstrings | (lang) | Read in docstrings from lang-specific docstring dictionary.
Transfer docstrings, translated to lang, from a dictionary-file
to the methods of classes Screen and Turtle and - in revised form -
to the corresponding functions. | Read in docstrings from lang-specific docstring dictionary. | [
"Read",
"in",
"docstrings",
"from",
"lang",
"-",
"specific",
"docstring",
"dictionary",
"."
] | def read_docstrings(lang):
"""Read in docstrings from lang-specific docstring dictionary.
Transfer docstrings, translated to lang, from a dictionary-file
to the methods of classes Screen and Turtle and - in revised form -
to the corresponding functions.
"""
modname = "turtle_docstringdict_%(lan... | [
"def",
"read_docstrings",
"(",
"lang",
")",
":",
"modname",
"=",
"\"turtle_docstringdict_%(language)s\"",
"%",
"{",
"'language'",
":",
"lang",
".",
"lower",
"(",
")",
"}",
"module",
"=",
"__import__",
"(",
"modname",
")",
"docsdict",
"=",
"module",
".",
"doc... | https://github.com/aws/lumberyard/blob/f85344403c1c2e77ec8c75deb2c116e97b713217/dev/Tools/Python/3.7.10/windows/Lib/turtle.py#L3854-L3869 | ||
aws/lumberyard | f85344403c1c2e77ec8c75deb2c116e97b713217 | dev/Tools/Python/3.7.10/mac/Python.framework/Versions/3.7/lib/python3.7/datetime.py | python | datetime.timetz | (self) | return time(self.hour, self.minute, self.second, self.microsecond,
self._tzinfo, fold=self.fold) | Return the time part, with same tzinfo. | Return the time part, with same tzinfo. | [
"Return",
"the",
"time",
"part",
"with",
"same",
"tzinfo",
"."
] | def timetz(self):
"Return the time part, with same tzinfo."
return time(self.hour, self.minute, self.second, self.microsecond,
self._tzinfo, fold=self.fold) | [
"def",
"timetz",
"(",
"self",
")",
":",
"return",
"time",
"(",
"self",
".",
"hour",
",",
"self",
".",
"minute",
",",
"self",
".",
"second",
",",
"self",
".",
"microsecond",
",",
"self",
".",
"_tzinfo",
",",
"fold",
"=",
"self",
".",
"fold",
")"
] | https://github.com/aws/lumberyard/blob/f85344403c1c2e77ec8c75deb2c116e97b713217/dev/Tools/Python/3.7.10/mac/Python.framework/Versions/3.7/lib/python3.7/datetime.py#L1764-L1767 | |
mhammond/pywin32 | 44afd86ba8485194df93234639243252deeb40d5 | com/win32com/client/gencache.py | python | GetModuleForTypelib | (typelibCLSID, lcid, major, minor) | return mod | Get a Python module for a type library ID
Given the CLSID of a typelibrary, return an imported Python module,
else None
Params
typelibCLSID -- IID of the type library.
major -- Integer major version.
minor -- Integer minor version
lcid -- Integer LCID for the library. | Get a Python module for a type library ID | [
"Get",
"a",
"Python",
"module",
"for",
"a",
"type",
"library",
"ID"
] | def GetModuleForTypelib(typelibCLSID, lcid, major, minor):
"""Get a Python module for a type library ID
Given the CLSID of a typelibrary, return an imported Python module,
else None
Params
typelibCLSID -- IID of the type library.
major -- Integer major version.
minor -- Integer minor versi... | [
"def",
"GetModuleForTypelib",
"(",
"typelibCLSID",
",",
"lcid",
",",
"major",
",",
"minor",
")",
":",
"modName",
"=",
"GetGeneratedFileName",
"(",
"typelibCLSID",
",",
"lcid",
",",
"major",
",",
"minor",
")",
"mod",
"=",
"_GetModule",
"(",
"modName",
")",
... | https://github.com/mhammond/pywin32/blob/44afd86ba8485194df93234639243252deeb40d5/com/win32com/client/gencache.py#L267-L286 | |
eclipse/sumo | 7132a9b8b6eea734bdec38479026b4d8c4336d03 | tools/simpla/_platoonmanager.py | python | PlatoonManager.getPlatoonLeaders | (self) | return [pltn.getVehicles()[0] for pltn in self._platoons.values() if pltn.size() > 1] | getPlatoonLeaders() -> list(PVehicle)
Returns all vehicles currently leading a platoon (of size > 1).
These can be in PlatoonMode.LEADER or in PlatoonMode.CATCHUP | getPlatoonLeaders() -> list(PVehicle) | [
"getPlatoonLeaders",
"()",
"-",
">",
"list",
"(",
"PVehicle",
")"
] | def getPlatoonLeaders(self):
'''getPlatoonLeaders() -> list(PVehicle)
Returns all vehicles currently leading a platoon (of size > 1).
These can be in PlatoonMode.LEADER or in PlatoonMode.CATCHUP
'''
return [pltn.getVehicles()[0] for pltn in self._platoons.values() if pltn.size()... | [
"def",
"getPlatoonLeaders",
"(",
"self",
")",
":",
"return",
"[",
"pltn",
".",
"getVehicles",
"(",
")",
"[",
"0",
"]",
"for",
"pltn",
"in",
"self",
".",
"_platoons",
".",
"values",
"(",
")",
"if",
"pltn",
".",
"size",
"(",
")",
">",
"1",
"]"
] | https://github.com/eclipse/sumo/blob/7132a9b8b6eea734bdec38479026b4d8c4336d03/tools/simpla/_platoonmanager.py#L180-L186 | |
forkineye/ESPixelStick | 22926f1c0d1131f1369fc7cad405689a095ae3cb | dist/bin/pyserial/serial/rfc2217.py | python | PortManager.telnet_send_option | (self, action, option) | Send DO, DONT, WILL, WONT. | Send DO, DONT, WILL, WONT. | [
"Send",
"DO",
"DONT",
"WILL",
"WONT",
"."
] | def telnet_send_option(self, action, option):
"""Send DO, DONT, WILL, WONT."""
self.connection.write(IAC + action + option) | [
"def",
"telnet_send_option",
"(",
"self",
",",
"action",
",",
"option",
")",
":",
"self",
".",
"connection",
".",
"write",
"(",
"IAC",
"+",
"action",
"+",
"option",
")"
] | https://github.com/forkineye/ESPixelStick/blob/22926f1c0d1131f1369fc7cad405689a095ae3cb/dist/bin/pyserial/serial/rfc2217.py#L993-L995 | ||
benoitsteiner/tensorflow-opencl | cb7cb40a57fde5cfd4731bc551e82a1e2fef43a5 | configure.py | python | set_tf_cuda_compute_capabilities | (environ_cp) | Set TF_CUDA_COMPUTE_CAPABILITIES. | Set TF_CUDA_COMPUTE_CAPABILITIES. | [
"Set",
"TF_CUDA_COMPUTE_CAPABILITIES",
"."
] | def set_tf_cuda_compute_capabilities(environ_cp):
"""Set TF_CUDA_COMPUTE_CAPABILITIES."""
while True:
native_cuda_compute_capabilities = get_native_cuda_compute_capabilities(
environ_cp)
if not native_cuda_compute_capabilities:
default_cuda_compute_capabilities = _DEFAULT_CUDA_COMPUTE_CAPABILI... | [
"def",
"set_tf_cuda_compute_capabilities",
"(",
"environ_cp",
")",
":",
"while",
"True",
":",
"native_cuda_compute_capabilities",
"=",
"get_native_cuda_compute_capabilities",
"(",
"environ_cp",
")",
"if",
"not",
"native_cuda_compute_capabilities",
":",
"default_cuda_compute_cap... | https://github.com/benoitsteiner/tensorflow-opencl/blob/cb7cb40a57fde5cfd4731bc551e82a1e2fef43a5/configure.py#L734-L779 | ||
Kitware/VTK | 5b4df4d90a4f31194d97d3c639dd38ea8f81e8b8 | Wrapping/Python/vtkmodules/numpy_interface/dataset_adapter.py | python | CompositeDataSetAttributes.keys | (self) | return self.ArrayNames | Returns the names of the arrays as a list. | Returns the names of the arrays as a list. | [
"Returns",
"the",
"names",
"of",
"the",
"arrays",
"as",
"a",
"list",
"."
] | def keys(self):
"""Returns the names of the arrays as a list."""
return self.ArrayNames | [
"def",
"keys",
"(",
"self",
")",
":",
"return",
"self",
".",
"ArrayNames"
] | https://github.com/Kitware/VTK/blob/5b4df4d90a4f31194d97d3c639dd38ea8f81e8b8/Wrapping/Python/vtkmodules/numpy_interface/dataset_adapter.py#L783-L785 | |
tensorflow/tensorflow | 419e3a6b650ea4bd1b0cba23c4348f8a69f3272e | tensorflow/python/tpu/tensor_tracer.py | python | TensorTracer.reason | (op_idx, details) | return '%d %s'%(op_idx, details) | Returns reason why the Op at op_idx is traced or not. | Returns reason why the Op at op_idx is traced or not. | [
"Returns",
"reason",
"why",
"the",
"Op",
"at",
"op_idx",
"is",
"traced",
"or",
"not",
"."
] | def reason(op_idx, details):
"""Returns reason why the Op at op_idx is traced or not."""
return '%d %s'%(op_idx, details) | [
"def",
"reason",
"(",
"op_idx",
",",
"details",
")",
":",
"return",
"'%d %s'",
"%",
"(",
"op_idx",
",",
"details",
")"
] | https://github.com/tensorflow/tensorflow/blob/419e3a6b650ea4bd1b0cba23c4348f8a69f3272e/tensorflow/python/tpu/tensor_tracer.py#L546-L549 | |
aws/lumberyard | f85344403c1c2e77ec8c75deb2c116e97b713217 | dev/Tools/Python/3.7.10/windows/Lib/tkinter/tix.py | python | Grid.anchor_clear | (self) | Removes the selection anchor. | Removes the selection anchor. | [
"Removes",
"the",
"selection",
"anchor",
"."
] | def anchor_clear(self):
"""Removes the selection anchor."""
self.tk.call(self, 'anchor', 'clear') | [
"def",
"anchor_clear",
"(",
"self",
")",
":",
"self",
".",
"tk",
".",
"call",
"(",
"self",
",",
"'anchor'",
",",
"'clear'",
")"
] | https://github.com/aws/lumberyard/blob/f85344403c1c2e77ec8c75deb2c116e97b713217/dev/Tools/Python/3.7.10/windows/Lib/tkinter/tix.py#L1797-L1799 | ||
google/shaka-packager | e1b0c7c45431327fd3ce193514a5407d07b39b22 | packager/third_party/protobuf/python/google/protobuf/internal/well_known_types.py | python | _FieldMaskTree.__init__ | (self, field_mask=None) | Initializes the tree by FieldMask. | Initializes the tree by FieldMask. | [
"Initializes",
"the",
"tree",
"by",
"FieldMask",
"."
] | def __init__(self, field_mask=None):
"""Initializes the tree by FieldMask."""
self._root = {}
if field_mask:
self.MergeFromFieldMask(field_mask) | [
"def",
"__init__",
"(",
"self",
",",
"field_mask",
"=",
"None",
")",
":",
"self",
".",
"_root",
"=",
"{",
"}",
"if",
"field_mask",
":",
"self",
".",
"MergeFromFieldMask",
"(",
"field_mask",
")"
] | https://github.com/google/shaka-packager/blob/e1b0c7c45431327fd3ce193514a5407d07b39b22/packager/third_party/protobuf/python/google/protobuf/internal/well_known_types.py#L549-L553 | ||
apache/incubator-mxnet | f03fb23f1d103fec9541b5ae59ee06b1734a51d9 | python/mxnet/image/image.py | python | ImageIter.next_sample | (self) | Helper function for reading in next sample. | Helper function for reading in next sample. | [
"Helper",
"function",
"for",
"reading",
"in",
"next",
"sample",
"."
] | def next_sample(self):
"""Helper function for reading in next sample."""
if self._allow_read is False:
raise StopIteration
if self.seq is not None:
if self.cur < self.num_image:
idx = self.seq[self.cur]
else:
if self.last_batch_... | [
"def",
"next_sample",
"(",
"self",
")",
":",
"if",
"self",
".",
"_allow_read",
"is",
"False",
":",
"raise",
"StopIteration",
"if",
"self",
".",
"seq",
"is",
"not",
"None",
":",
"if",
"self",
".",
"cur",
"<",
"self",
".",
"num_image",
":",
"idx",
"=",... | https://github.com/apache/incubator-mxnet/blob/f03fb23f1d103fec9541b5ae59ee06b1734a51d9/python/mxnet/image/image.py#L1459-L1488 | ||
assimp/assimp | 97c7e084c2f7f8c9355ea42f73605890481bddc5 | port/PyAssimp/scripts/transformations.py | python | inverse_matrix | (matrix) | return numpy.linalg.inv(matrix) | Return inverse of square transformation matrix.
>>> M0 = random_rotation_matrix()
>>> M1 = inverse_matrix(M0.T)
>>> numpy.allclose(M1, numpy.linalg.inv(M0.T))
True
>>> for size in range(1, 7):
... M0 = numpy.random.rand(size, size)
... M1 = inverse_matrix(M0)
... if not nump... | Return inverse of square transformation matrix. | [
"Return",
"inverse",
"of",
"square",
"transformation",
"matrix",
"."
] | def inverse_matrix(matrix):
"""Return inverse of square transformation matrix.
>>> M0 = random_rotation_matrix()
>>> M1 = inverse_matrix(M0.T)
>>> numpy.allclose(M1, numpy.linalg.inv(M0.T))
True
>>> for size in range(1, 7):
... M0 = numpy.random.rand(size, size)
... M1 = inverse... | [
"def",
"inverse_matrix",
"(",
"matrix",
")",
":",
"return",
"numpy",
".",
"linalg",
".",
"inv",
"(",
"matrix",
")"
] | https://github.com/assimp/assimp/blob/97c7e084c2f7f8c9355ea42f73605890481bddc5/port/PyAssimp/scripts/transformations.py#L1633-L1646 | |
lammps/lammps | b75c3065430a75b1b5543a10e10f46d9b4c91913 | python/lammps/pylammps.py | python | Atom.torque | (self) | return self.get("torque", self.index) | Return the total torque acting on the particle
:type: numpy.array (float, float, float) | Return the total torque acting on the particle | [
"Return",
"the",
"total",
"torque",
"acting",
"on",
"the",
"particle"
] | def torque(self):
"""
Return the total torque acting on the particle
:type: numpy.array (float, float, float)
"""
return self.get("torque", self.index) | [
"def",
"torque",
"(",
"self",
")",
":",
"return",
"self",
".",
"get",
"(",
"\"torque\"",
",",
"self",
".",
"index",
")"
] | https://github.com/lammps/lammps/blob/b75c3065430a75b1b5543a10e10f46d9b4c91913/python/lammps/pylammps.py#L259-L265 | |
openthread/openthread | 9fcdbed9c526c70f1556d1ed84099c1535c7cd32 | third_party/mbedtls/repo/scripts/config.py | python | keep_in_baremetal | (name) | return True | Rules for symbols in the "baremetal" configuration. | Rules for symbols in the "baremetal" configuration. | [
"Rules",
"for",
"symbols",
"in",
"the",
"baremetal",
"configuration",
"."
] | def keep_in_baremetal(name):
"""Rules for symbols in the "baremetal" configuration."""
if name in EXCLUDE_FROM_BAREMETAL:
return False
return True | [
"def",
"keep_in_baremetal",
"(",
"name",
")",
":",
"if",
"name",
"in",
"EXCLUDE_FROM_BAREMETAL",
":",
"return",
"False",
"return",
"True"
] | https://github.com/openthread/openthread/blob/9fcdbed9c526c70f1556d1ed84099c1535c7cd32/third_party/mbedtls/repo/scripts/config.py#L258-L262 | |
mantidproject/mantid | 03deeb89254ec4289edb8771e0188c2090a02f32 | scripts/Diffraction/isis_powder/abstract_inst.py | python | AbstractInst._generate_out_file_paths | (self, run_details) | return out_file_names | Generates the various output paths and file names to be used during saving or as workspace names
:param run_details: The run details associated with this run
:return: A dictionary containing the various output paths and generated output name | Generates the various output paths and file names to be used during saving or as workspace names
:param run_details: The run details associated with this run
:return: A dictionary containing the various output paths and generated output name | [
"Generates",
"the",
"various",
"output",
"paths",
"and",
"file",
"names",
"to",
"be",
"used",
"during",
"saving",
"or",
"as",
"workspace",
"names",
":",
"param",
"run_details",
":",
"The",
"run",
"details",
"associated",
"with",
"this",
"run",
":",
"return",... | def _generate_out_file_paths(self, run_details):
"""
Generates the various output paths and file names to be used during saving or as workspace names
:param run_details: The run details associated with this run
:return: A dictionary containing the various output paths and generated outpu... | [
"def",
"_generate_out_file_paths",
"(",
"self",
",",
"run_details",
")",
":",
"output_directory",
"=",
"os",
".",
"path",
".",
"join",
"(",
"self",
".",
"_output_dir",
",",
"run_details",
".",
"label",
",",
"self",
".",
"_user_name",
")",
"output_directory",
... | https://github.com/mantidproject/mantid/blob/03deeb89254ec4289edb8771e0188c2090a02f32/scripts/Diffraction/isis_powder/abstract_inst.py#L294-L334 | |
acbull/Unbiased_LambdaMart | 7c39abe5caa18ca07df2d23c2db392916d92956c | evaluation/scripts/click_models.py | python | PositionBiasedModel.estimatePropensityWeightsForOneList | (self, click_list, use_non_clicked_data=False) | return propensity_weights | Estimate propensity for clicks in a list.
Parameters
----------
click_list : [type]
[description]
use_non_clicked_data : bool, optional
[description], by default False
Returns
-------
[type]
[description] | Estimate propensity for clicks in a list. | [
"Estimate",
"propensity",
"for",
"clicks",
"in",
"a",
"list",
"."
] | def estimatePropensityWeightsForOneList(self, click_list, use_non_clicked_data=False):
"""Estimate propensity for clicks in a list.
Parameters
----------
click_list : [type]
[description]
use_non_clicked_data : bool, optional
[description], by default Fal... | [
"def",
"estimatePropensityWeightsForOneList",
"(",
"self",
",",
"click_list",
",",
"use_non_clicked_data",
"=",
"False",
")",
":",
"propensity_weights",
"=",
"[",
"]",
"for",
"r",
"in",
"range",
"(",
"len",
"(",
"click_list",
")",
")",
":",
"pw",
"=",
"0.0",... | https://github.com/acbull/Unbiased_LambdaMart/blob/7c39abe5caa18ca07df2d23c2db392916d92956c/evaluation/scripts/click_models.py#L188-L210 | |
aws/lumberyard | f85344403c1c2e77ec8c75deb2c116e97b713217 | dev/Gems/CloudGemMetric/v1/AWS/python/windows/Lib/numpy/lib/histograms.py | python | _ptp | (x) | return _unsigned_subtract(x.max(), x.min()) | Peak-to-peak value of x.
This implementation avoids the problem of signed integer arrays having a
peak-to-peak value that cannot be represented with the array's data type.
This function returns an unsigned value for signed integer arrays. | Peak-to-peak value of x. | [
"Peak",
"-",
"to",
"-",
"peak",
"value",
"of",
"x",
"."
] | def _ptp(x):
"""Peak-to-peak value of x.
This implementation avoids the problem of signed integer arrays having a
peak-to-peak value that cannot be represented with the array's data type.
This function returns an unsigned value for signed integer arrays.
"""
return _unsigned_subtract(x.max(), x... | [
"def",
"_ptp",
"(",
"x",
")",
":",
"return",
"_unsigned_subtract",
"(",
"x",
".",
"max",
"(",
")",
",",
"x",
".",
"min",
"(",
")",
")"
] | https://github.com/aws/lumberyard/blob/f85344403c1c2e77ec8c75deb2c116e97b713217/dev/Gems/CloudGemMetric/v1/AWS/python/windows/Lib/numpy/lib/histograms.py#L25-L32 | |
ApolloAuto/apollo | 463fb82f9e979d02dcb25044e60931293ab2dba0 | modules/tools/record_analyzer/common/distribution_analyzer.py | python | DistributionAnalyzer.print_distribution_results | (self, data) | distribution analyzer | distribution analyzer | [
"distribution",
"analyzer"
] | def print_distribution_results(self, data):
"""distribution analyzer"""
if len(data) == 0:
print(PrintColors.FAIL + "No Data Generated!" + PrintColors.ENDC)
return
total = 0
for k, v in data.items():
total += v
for k, v in data.items():
... | [
"def",
"print_distribution_results",
"(",
"self",
",",
"data",
")",
":",
"if",
"len",
"(",
"data",
")",
"==",
"0",
":",
"print",
"(",
"PrintColors",
".",
"FAIL",
"+",
"\"No Data Generated!\"",
"+",
"PrintColors",
".",
"ENDC",
")",
"return",
"total",
"=",
... | https://github.com/ApolloAuto/apollo/blob/463fb82f9e979d02dcb25044e60931293ab2dba0/modules/tools/record_analyzer/common/distribution_analyzer.py#L25-L38 | ||
mongodb/mongo | d8ff665343ad29cf286ee2cf4a1960d29371937b | buildscripts/idl/idl/struct_types.py | python | StructTypeInfoBase.get_op_msg_request_deserializer_method | (self) | Get the protected OpMsg deserializer method for a struct. | Get the protected OpMsg deserializer method for a struct. | [
"Get",
"the",
"protected",
"OpMsg",
"deserializer",
"method",
"for",
"a",
"struct",
"."
] | def get_op_msg_request_deserializer_method(self):
# type: () -> Optional[MethodInfo]
"""Get the protected OpMsg deserializer method for a struct."""
# pylint: disable=invalid-name
pass | [
"def",
"get_op_msg_request_deserializer_method",
"(",
"self",
")",
":",
"# type: () -> Optional[MethodInfo]",
"# pylint: disable=invalid-name",
"pass"
] | https://github.com/mongodb/mongo/blob/d8ff665343ad29cf286ee2cf4a1960d29371937b/buildscripts/idl/idl/struct_types.py#L207-L211 | ||
wxWidgets/wxPython-Classic | 19571e1ae65f1ac445f5491474121998c97a1bf0 | src/msw/richtext.py | python | RichTextBuffer_FindHandlerByFilename | (*args, **kwargs) | return _richtext.RichTextBuffer_FindHandlerByFilename(*args, **kwargs) | RichTextBuffer_FindHandlerByFilename(String filename, int imageType) -> RichTextFileHandler | RichTextBuffer_FindHandlerByFilename(String filename, int imageType) -> RichTextFileHandler | [
"RichTextBuffer_FindHandlerByFilename",
"(",
"String",
"filename",
"int",
"imageType",
")",
"-",
">",
"RichTextFileHandler"
] | def RichTextBuffer_FindHandlerByFilename(*args, **kwargs):
"""RichTextBuffer_FindHandlerByFilename(String filename, int imageType) -> RichTextFileHandler"""
return _richtext.RichTextBuffer_FindHandlerByFilename(*args, **kwargs) | [
"def",
"RichTextBuffer_FindHandlerByFilename",
"(",
"*",
"args",
",",
"*",
"*",
"kwargs",
")",
":",
"return",
"_richtext",
".",
"RichTextBuffer_FindHandlerByFilename",
"(",
"*",
"args",
",",
"*",
"*",
"kwargs",
")"
] | https://github.com/wxWidgets/wxPython-Classic/blob/19571e1ae65f1ac445f5491474121998c97a1bf0/src/msw/richtext.py#L2679-L2681 | |
baidu-research/tensorflow-allreduce | 66d5b855e90b0949e9fa5cca5599fd729a70e874 | tensorflow/python/ops/script_ops.py | python | FuncRegistry._next_unique_token | (self) | return "pyfunc_%d" % uid | Returns a unique token. | Returns a unique token. | [
"Returns",
"a",
"unique",
"token",
"."
] | def _next_unique_token(self):
"""Returns a unique token."""
with self._lock:
uid = self._unique_id
self._unique_id += 1
return "pyfunc_%d" % uid | [
"def",
"_next_unique_token",
"(",
"self",
")",
":",
"with",
"self",
".",
"_lock",
":",
"uid",
"=",
"self",
".",
"_unique_id",
"self",
".",
"_unique_id",
"+=",
"1",
"return",
"\"pyfunc_%d\"",
"%",
"uid"
] | https://github.com/baidu-research/tensorflow-allreduce/blob/66d5b855e90b0949e9fa5cca5599fd729a70e874/tensorflow/python/ops/script_ops.py#L100-L105 | |
nest/nest-simulator | f2623eb78518cdbd55e77e0ed486bf1111bcb62f | pynest/nest/lib/hl_api_models.py | python | GetDefaults | (model, keys=None, output='') | return result | Return default parameters of the given model, specified by a string.
Parameters
----------
model : str
Name of the model
keys : str or list, optional
String or a list of strings naming model properties. `GetDefaults` then
returns a single value or a list of values belonging to t... | Return default parameters of the given model, specified by a string. | [
"Return",
"default",
"parameters",
"of",
"the",
"given",
"model",
"specified",
"by",
"a",
"string",
"."
] | def GetDefaults(model, keys=None, output=''):
"""Return default parameters of the given model, specified by a string.
Parameters
----------
model : str
Name of the model
keys : str or list, optional
String or a list of strings naming model properties. `GetDefaults` then
retu... | [
"def",
"GetDefaults",
"(",
"model",
",",
"keys",
"=",
"None",
",",
"output",
"=",
"''",
")",
":",
"if",
"keys",
"is",
"None",
":",
"cmd",
"=",
"\"/{0} GetDefaults\"",
".",
"format",
"(",
"model",
")",
"elif",
"is_literal",
"(",
"keys",
")",
":",
"cmd... | https://github.com/nest/nest-simulator/blob/f2623eb78518cdbd55e77e0ed486bf1111bcb62f/pynest/nest/lib/hl_api_models.py#L138-L188 | |
baidu-research/tensorflow-allreduce | 66d5b855e90b0949e9fa5cca5599fd729a70e874 | tensorflow/python/ops/math_grad.py | python | _ComplexAbsGrad | (op, grad) | return (math_ops.complex(grad, array_ops.zeros_like(grad)) *
math_ops.sign(op.inputs[0])) | Returns the gradient of ComplexAbs. | Returns the gradient of ComplexAbs. | [
"Returns",
"the",
"gradient",
"of",
"ComplexAbs",
"."
] | def _ComplexAbsGrad(op, grad):
"""Returns the gradient of ComplexAbs."""
# TODO(b/27786104): The cast to complex could be removed once arithmetic
# supports mixtures of complex64 and real values.
return (math_ops.complex(grad, array_ops.zeros_like(grad)) *
math_ops.sign(op.inputs[0])) | [
"def",
"_ComplexAbsGrad",
"(",
"op",
",",
"grad",
")",
":",
"# TODO(b/27786104): The cast to complex could be removed once arithmetic",
"# supports mixtures of complex64 and real values.",
"return",
"(",
"math_ops",
".",
"complex",
"(",
"grad",
",",
"array_ops",
".",
"zeros_l... | https://github.com/baidu-research/tensorflow-allreduce/blob/66d5b855e90b0949e9fa5cca5599fd729a70e874/tensorflow/python/ops/math_grad.py#L1025-L1030 | |
timi-liuliang/echo | 40a5a24d430eee4118314459ab7e03afcb3b8719 | thirdparty/protobuf/python/google/protobuf/internal/python_message.py | python | _Listener.__init__ | (self, parent_message) | Args:
parent_message: The message whose _Modified() method we should call when
we receive Modified() messages. | Args:
parent_message: The message whose _Modified() method we should call when
we receive Modified() messages. | [
"Args",
":",
"parent_message",
":",
"The",
"message",
"whose",
"_Modified",
"()",
"method",
"we",
"should",
"call",
"when",
"we",
"receive",
"Modified",
"()",
"messages",
"."
] | def __init__(self, parent_message):
"""Args:
parent_message: The message whose _Modified() method we should call when
we receive Modified() messages.
"""
# This listener establishes a back reference from a child (contained) object
# to its parent (containing) object. We make this a weak r... | [
"def",
"__init__",
"(",
"self",
",",
"parent_message",
")",
":",
"# This listener establishes a back reference from a child (contained) object",
"# to its parent (containing) object. We make this a weak reference to avoid",
"# creating cyclic garbage when the client finishes with the 'parent' o... | https://github.com/timi-liuliang/echo/blob/40a5a24d430eee4118314459ab7e03afcb3b8719/thirdparty/protobuf/python/google/protobuf/internal/python_message.py#L1092-L1109 | ||
wxWidgets/wxPython-Classic | 19571e1ae65f1ac445f5491474121998c97a1bf0 | src/gtk/stc.py | python | StyledTextCtrl.StyleSetWeight | (*args, **kwargs) | return _stc.StyledTextCtrl_StyleSetWeight(*args, **kwargs) | StyleSetWeight(self, int style, int weight) | StyleSetWeight(self, int style, int weight) | [
"StyleSetWeight",
"(",
"self",
"int",
"style",
"int",
"weight",
")"
] | def StyleSetWeight(*args, **kwargs):
"""StyleSetWeight(self, int style, int weight)"""
return _stc.StyledTextCtrl_StyleSetWeight(*args, **kwargs) | [
"def",
"StyleSetWeight",
"(",
"*",
"args",
",",
"*",
"*",
"kwargs",
")",
":",
"return",
"_stc",
".",
"StyledTextCtrl_StyleSetWeight",
"(",
"*",
"args",
",",
"*",
"*",
"kwargs",
")"
] | https://github.com/wxWidgets/wxPython-Classic/blob/19571e1ae65f1ac445f5491474121998c97a1bf0/src/gtk/stc.py#L2707-L2709 | |
FreeCAD/FreeCAD | ba42231b9c6889b89e064d6d563448ed81e376ec | src/Mod/Draft/draftguitools/gui_scale.py | python | Scale.pickRef | (self) | Pick a point of reference. | Pick a point of reference. | [
"Pick",
"a",
"point",
"of",
"reference",
"."
] | def pickRef(self):
"""Pick a point of reference."""
self.pickmode = True
if self.node:
self.node = self.node[:1] # remove previous picks
_msg(translate("draft", "Pick reference distance from base point"))
self.call = self.view.addEventCallback("SoEvent", self.action) | [
"def",
"pickRef",
"(",
"self",
")",
":",
"self",
".",
"pickmode",
"=",
"True",
"if",
"self",
".",
"node",
":",
"self",
".",
"node",
"=",
"self",
".",
"node",
"[",
":",
"1",
"]",
"# remove previous picks",
"_msg",
"(",
"translate",
"(",
"\"draft\"",
"... | https://github.com/FreeCAD/FreeCAD/blob/ba42231b9c6889b89e064d6d563448ed81e376ec/src/Mod/Draft/draftguitools/gui_scale.py#L130-L136 | ||
benoitsteiner/tensorflow-opencl | cb7cb40a57fde5cfd4731bc551e82a1e2fef43a5 | tensorflow/python/eager/tape.py | python | Tape.export | (self) | return pywrap_tensorflow.TFE_Py_TapeExport(self._tape) | Exports the internal state of this tape.
Returns:
tensor_tape: a map from tensor_id(tensor) to <identifier for op>
responsible for generating that tensor.
op_tape: a map from <identifier for op> to TapeEntry for that op. | Exports the internal state of this tape. | [
"Exports",
"the",
"internal",
"state",
"of",
"this",
"tape",
"."
] | def export(self):
"""Exports the internal state of this tape.
Returns:
tensor_tape: a map from tensor_id(tensor) to <identifier for op>
responsible for generating that tensor.
op_tape: a map from <identifier for op> to TapeEntry for that op.
"""
return pywrap_tensorflow.TFE_Py_TapeEx... | [
"def",
"export",
"(",
"self",
")",
":",
"return",
"pywrap_tensorflow",
".",
"TFE_Py_TapeExport",
"(",
"self",
".",
"_tape",
")"
] | https://github.com/benoitsteiner/tensorflow-opencl/blob/cb7cb40a57fde5cfd4731bc551e82a1e2fef43a5/tensorflow/python/eager/tape.py#L102-L110 | |
baidu-research/tensorflow-allreduce | 66d5b855e90b0949e9fa5cca5599fd729a70e874 | tensorflow/contrib/rnn/python/ops/rnn_cell.py | python | GridLSTMCell.__init__ | (self, num_units, use_peepholes=False,
share_time_frequency_weights=False,
cell_clip=None, initializer=None,
num_unit_shards=1, forget_bias=1.0,
feature_size=None, frequency_skip=None,
num_frequency_blocks=None,
start_freqindex_li... | Initialize the parameters for an LSTM cell.
Args:
num_units: int, The number of units in the LSTM cell
use_peepholes: (optional) bool, default False. Set True to enable
diagonal/peephole connections.
share_time_frequency_weights: (optional) bool, default False. Set True to
enable ... | Initialize the parameters for an LSTM cell. | [
"Initialize",
"the",
"parameters",
"for",
"an",
"LSTM",
"cell",
"."
] | def __init__(self, num_units, use_peepholes=False,
share_time_frequency_weights=False,
cell_clip=None, initializer=None,
num_unit_shards=1, forget_bias=1.0,
feature_size=None, frequency_skip=None,
num_frequency_blocks=None,
start_... | [
"def",
"__init__",
"(",
"self",
",",
"num_units",
",",
"use_peepholes",
"=",
"False",
",",
"share_time_frequency_weights",
"=",
"False",
",",
"cell_clip",
"=",
"None",
",",
"initializer",
"=",
"None",
",",
"num_unit_shards",
"=",
"1",
",",
"forget_bias",
"=",
... | https://github.com/baidu-research/tensorflow-allreduce/blob/66d5b855e90b0949e9fa5cca5599fd729a70e874/tensorflow/contrib/rnn/python/ops/rnn_cell.py#L442-L531 | ||
aws/lumberyard | f85344403c1c2e77ec8c75deb2c116e97b713217 | dev/Gems/CloudGemMetric/v1/AWS/common-code/Lib/llvmlite/binding/executionengine.py | python | ExecutionEngine._find_module_ptr | (self, module_ptr) | return None | Find the ModuleRef corresponding to the given pointer. | Find the ModuleRef corresponding to the given pointer. | [
"Find",
"the",
"ModuleRef",
"corresponding",
"to",
"the",
"given",
"pointer",
"."
] | def _find_module_ptr(self, module_ptr):
"""
Find the ModuleRef corresponding to the given pointer.
"""
ptr = cast(module_ptr, c_void_p).value
for module in self._modules:
if cast(module._ptr, c_void_p).value == ptr:
return module
return None | [
"def",
"_find_module_ptr",
"(",
"self",
",",
"module_ptr",
")",
":",
"ptr",
"=",
"cast",
"(",
"module_ptr",
",",
"c_void_p",
")",
".",
"value",
"for",
"module",
"in",
"self",
".",
"_modules",
":",
"if",
"cast",
"(",
"module",
".",
"_ptr",
",",
"c_void_... | https://github.com/aws/lumberyard/blob/f85344403c1c2e77ec8c75deb2c116e97b713217/dev/Gems/CloudGemMetric/v1/AWS/common-code/Lib/llvmlite/binding/executionengine.py#L136-L144 | |
SFTtech/openage | d6a08c53c48dc1e157807471df92197f6ca9e04d | openage/convert/processor/conversion/aoc/upgrade_ability_subprocessor.py | python | AoCUpgradeAbilitySubprocessor.selectable_ability | (converter_group, line, container_obj_ref, diff=None) | return patches | Creates a patch for the Selectable ability of a line.
:param converter_group: Group that gets the patch.
:type converter_group: ...dataformat.converter_object.ConverterObjectGroup
:param line: Unit/Building line that has the ability.
:type line: ...dataformat.converter_object.ConverterO... | Creates a patch for the Selectable ability of a line. | [
"Creates",
"a",
"patch",
"for",
"the",
"Selectable",
"ability",
"of",
"a",
"line",
"."
] | def selectable_ability(converter_group, line, container_obj_ref, diff=None):
"""
Creates a patch for the Selectable ability of a line.
:param converter_group: Group that gets the patch.
:type converter_group: ...dataformat.converter_object.ConverterObjectGroup
:param line: Unit/... | [
"def",
"selectable_ability",
"(",
"converter_group",
",",
"line",
",",
"container_obj_ref",
",",
"diff",
"=",
"None",
")",
":",
"head_unit_id",
"=",
"line",
".",
"get_head_unit_id",
"(",
")",
"tech_id",
"=",
"converter_group",
".",
"get_id",
"(",
")",
"dataset... | https://github.com/SFTtech/openage/blob/d6a08c53c48dc1e157807471df92197f6ca9e04d/openage/convert/processor/conversion/aoc/upgrade_ability_subprocessor.py#L1228-L1397 | |
bingwin/MicroChat | 81d9a71a212c1cbca5bba497ec42659a7d25dccf | mars/lint/cpplint.py | python | IsBlankLine | (line) | return not line or line.isspace() | Returns true if the given line is blank.
We consider a line to be blank if the line is empty or consists of
only white spaces.
Args:
line: A line of a string.
Returns:
True, if the given line is blank. | Returns true if the given line is blank. | [
"Returns",
"true",
"if",
"the",
"given",
"line",
"is",
"blank",
"."
] | def IsBlankLine(line):
"""Returns true if the given line is blank.
We consider a line to be blank if the line is empty or consists of
only white spaces.
Args:
line: A line of a string.
Returns:
True, if the given line is blank.
"""
return not line or line.isspace() | [
"def",
"IsBlankLine",
"(",
"line",
")",
":",
"return",
"not",
"line",
"or",
"line",
".",
"isspace",
"(",
")"
] | https://github.com/bingwin/MicroChat/blob/81d9a71a212c1cbca5bba497ec42659a7d25dccf/mars/lint/cpplint.py#L2818-L2830 | |
FEniCS/dolfinx | 3dfdf038cccdb70962865b58a63bf29c2e55ec6e | python/dolfinx/fem/forms.py | python | form | (form: typing.Union[ufl.Form, typing.Iterable[ufl.Form]], dtype: np.dtype = PETSc.ScalarType,
form_compiler_parameters: dict = {}, jit_parameters: dict = {}) | return _create_form(form) | Create a DOLFINx Form or an array of Forms
Args:
form: A UFL form or list(s) of UFL forms
dtype: Scalar type to use for the compiled form
form_compiler_parameters: See :func:`ffcx_jit <dolfinx.jit.ffcx_jit>`
jit_parameters:See :func:`ffcx_jit <dolfinx.jit.ffcx_jit>`
Returns:
... | Create a DOLFINx Form or an array of Forms | [
"Create",
"a",
"DOLFINx",
"Form",
"or",
"an",
"array",
"of",
"Forms"
] | def form(form: typing.Union[ufl.Form, typing.Iterable[ufl.Form]], dtype: np.dtype = PETSc.ScalarType,
form_compiler_parameters: dict = {}, jit_parameters: dict = {}) -> FormMetaClass:
"""Create a DOLFINx Form or an array of Forms
Args:
form: A UFL form or list(s) of UFL forms
dtype: Sc... | [
"def",
"form",
"(",
"form",
":",
"typing",
".",
"Union",
"[",
"ufl",
".",
"Form",
",",
"typing",
".",
"Iterable",
"[",
"ufl",
".",
"Form",
"]",
"]",
",",
"dtype",
":",
"np",
".",
"dtype",
"=",
"PETSc",
".",
"ScalarType",
",",
"form_compiler_parameter... | https://github.com/FEniCS/dolfinx/blob/3dfdf038cccdb70962865b58a63bf29c2e55ec6e/python/dolfinx/fem/forms.py#L63-L140 | |
catboost/catboost | 167f64f237114a4d10b2b4ee42adb4569137debe | contrib/python/pandas/py2/pandas/core/indexes/datetimelike.py | python | DatetimeIndexOpsMixin._create_comparison_method | (cls, op) | return wrapper | Create a comparison method that dispatches to ``cls.values``. | Create a comparison method that dispatches to ``cls.values``. | [
"Create",
"a",
"comparison",
"method",
"that",
"dispatches",
"to",
"cls",
".",
"values",
"."
] | def _create_comparison_method(cls, op):
"""
Create a comparison method that dispatches to ``cls.values``.
"""
def wrapper(self, other):
if isinstance(other, ABCSeries):
# the arrays defer to Series for comparison ops but the indexes
# don't, s... | [
"def",
"_create_comparison_method",
"(",
"cls",
",",
"op",
")",
":",
"def",
"wrapper",
"(",
"self",
",",
"other",
")",
":",
"if",
"isinstance",
"(",
"other",
",",
"ABCSeries",
")",
":",
"# the arrays defer to Series for comparison ops but the indexes",
"# don't, so... | https://github.com/catboost/catboost/blob/167f64f237114a4d10b2b4ee42adb4569137debe/contrib/python/pandas/py2/pandas/core/indexes/datetimelike.py#L107-L122 | |
LiquidPlayer/LiquidCore | 9405979363f2353ac9a71ad8ab59685dd7f919c9 | deps/node-10.15.3/deps/npm/node_modules/node-gyp/gyp/pylib/gyp/generator/make.py | python | MakefileWriter.Absolutify | (self, path) | return os.path.normpath(os.path.join(self.path, path)) | Convert a subdirectory-relative path into a base-relative path.
Skips over paths that contain variables. | Convert a subdirectory-relative path into a base-relative path.
Skips over paths that contain variables. | [
"Convert",
"a",
"subdirectory",
"-",
"relative",
"path",
"into",
"a",
"base",
"-",
"relative",
"path",
".",
"Skips",
"over",
"paths",
"that",
"contain",
"variables",
"."
] | def Absolutify(self, path):
"""Convert a subdirectory-relative path into a base-relative path.
Skips over paths that contain variables."""
if '$(' in path:
# Don't call normpath in this case, as it might collapse the
# path too aggressively if it features '..'. However it's still
# importa... | [
"def",
"Absolutify",
"(",
"self",
",",
"path",
")",
":",
"if",
"'$('",
"in",
"path",
":",
"# Don't call normpath in this case, as it might collapse the",
"# path too aggressively if it features '..'. However it's still",
"# important to strip trailing slashes.",
"return",
"path",
... | https://github.com/LiquidPlayer/LiquidCore/blob/9405979363f2353ac9a71ad8ab59685dd7f919c9/deps/node-10.15.3/deps/npm/node_modules/node-gyp/gyp/pylib/gyp/generator/make.py#L1928-L1936 | |
echronos/echronos | c996f1d2c8af6c6536205eb319c1bf1d4d84569c | external_tools/ply_info/example/ansic/cparse.py | python | p_shift_expression_1 | (t) | shift_expression : additive_expression | shift_expression : additive_expression | [
"shift_expression",
":",
"additive_expression"
] | def p_shift_expression_1(t):
'shift_expression : additive_expression'
pass | [
"def",
"p_shift_expression_1",
"(",
"t",
")",
":",
"pass"
] | https://github.com/echronos/echronos/blob/c996f1d2c8af6c6536205eb319c1bf1d4d84569c/external_tools/ply_info/example/ansic/cparse.py#L703-L705 | ||
tensorflow/tensorflow | 419e3a6b650ea4bd1b0cba23c4348f8a69f3272e | tensorflow/python/ops/ragged/ragged_tensor_shape.py | python | RaggedTensorDynamicShape.rank | (self) | The number of dimensions in this shape, or None if unknown. | The number of dimensions in this shape, or None if unknown. | [
"The",
"number",
"of",
"dimensions",
"in",
"this",
"shape",
"or",
"None",
"if",
"unknown",
"."
] | def rank(self):
"""The number of dimensions in this shape, or None if unknown."""
inner_ndims = tensor_shape.dimension_value(self._inner_dim_sizes.shape[0])
if inner_ndims is None:
return None
else:
return len(self._partitioned_dim_sizes) + inner_ndims | [
"def",
"rank",
"(",
"self",
")",
":",
"inner_ndims",
"=",
"tensor_shape",
".",
"dimension_value",
"(",
"self",
".",
"_inner_dim_sizes",
".",
"shape",
"[",
"0",
"]",
")",
"if",
"inner_ndims",
"is",
"None",
":",
"return",
"None",
"else",
":",
"return",
"le... | https://github.com/tensorflow/tensorflow/blob/419e3a6b650ea4bd1b0cba23c4348f8a69f3272e/tensorflow/python/ops/ragged/ragged_tensor_shape.py#L215-L221 | ||
catboost/catboost | 167f64f237114a4d10b2b4ee42adb4569137debe | contrib/python/packaging/py2/packaging/tags.py | python | _abi3_applies | (python_version) | return len(python_version) > 1 and tuple(python_version) >= (3, 2) | Determine if the Python version supports abi3.
PEP 384 was first implemented in Python 3.2. | Determine if the Python version supports abi3. | [
"Determine",
"if",
"the",
"Python",
"version",
"supports",
"abi3",
"."
] | def _abi3_applies(python_version):
# type: (PythonVersion) -> bool
"""
Determine if the Python version supports abi3.
PEP 384 was first implemented in Python 3.2.
"""
return len(python_version) > 1 and tuple(python_version) >= (3, 2) | [
"def",
"_abi3_applies",
"(",
"python_version",
")",
":",
"# type: (PythonVersion) -> bool",
"return",
"len",
"(",
"python_version",
")",
">",
"1",
"and",
"tuple",
"(",
"python_version",
")",
">=",
"(",
"3",
",",
"2",
")"
] | https://github.com/catboost/catboost/blob/167f64f237114a4d10b2b4ee42adb4569137debe/contrib/python/packaging/py2/packaging/tags.py#L188-L195 | |
timi-liuliang/echo | 40a5a24d430eee4118314459ab7e03afcb3b8719 | thirdparty/protobuf/python/mox.py | python | Reset | (*args) | Reset mocks.
Args:
# args is any number of mocks to be reset. | Reset mocks. | [
"Reset",
"mocks",
"."
] | def Reset(*args):
"""Reset mocks.
Args:
# args is any number of mocks to be reset.
"""
for mock in args:
mock._Reset() | [
"def",
"Reset",
"(",
"*",
"args",
")",
":",
"for",
"mock",
"in",
"args",
":",
"mock",
".",
"_Reset",
"(",
")"
] | https://github.com/timi-liuliang/echo/blob/40a5a24d430eee4118314459ab7e03afcb3b8719/thirdparty/protobuf/python/mox.py#L257-L265 | ||
wxWidgets/wxPython-Classic | 19571e1ae65f1ac445f5491474121998c97a1bf0 | src/osx_cocoa/richtext.py | python | RichTextCtrl.DeleteSelection | (*args, **kwargs) | return _richtext.RichTextCtrl_DeleteSelection(*args, **kwargs) | DeleteSelection(self)
Remove the current selection. | DeleteSelection(self) | [
"DeleteSelection",
"(",
"self",
")"
] | def DeleteSelection(*args, **kwargs):
"""
DeleteSelection(self)
Remove the current selection.
"""
return _richtext.RichTextCtrl_DeleteSelection(*args, **kwargs) | [
"def",
"DeleteSelection",
"(",
"*",
"args",
",",
"*",
"*",
"kwargs",
")",
":",
"return",
"_richtext",
".",
"RichTextCtrl_DeleteSelection",
"(",
"*",
"args",
",",
"*",
"*",
"kwargs",
")"
] | https://github.com/wxWidgets/wxPython-Classic/blob/19571e1ae65f1ac445f5491474121998c97a1bf0/src/osx_cocoa/richtext.py#L3228-L3234 | |
thalium/icebox | 99d147d5b9269222225443ce171b4fd46d8985d4 | third_party/virtualbox/src/VBox/VMM/VMMAll/IEMAllInstructionsPython.py | python | SimpleParser.parse | (self) | return self.printErrors() | Parses the given file.
Returns number or errors.
Raises exception on fatal trouble. | Parses the given file.
Returns number or errors.
Raises exception on fatal trouble. | [
"Parses",
"the",
"given",
"file",
".",
"Returns",
"number",
"or",
"errors",
".",
"Raises",
"exception",
"on",
"fatal",
"trouble",
"."
] | def parse(self):
"""
Parses the given file.
Returns number or errors.
Raises exception on fatal trouble.
"""
#self.debug('Parsing %s' % (self.sSrcFile,));
while self.iLine < len(self.asLines):
sLine = self.asLines[self.iLine];
self.iLine ... | [
"def",
"parse",
"(",
"self",
")",
":",
"#self.debug('Parsing %s' % (self.sSrcFile,));",
"while",
"self",
".",
"iLine",
"<",
"len",
"(",
"self",
".",
"asLines",
")",
":",
"sLine",
"=",
"self",
".",
"asLines",
"[",
"self",
".",
"iLine",
"]",
"self",
".",
"... | https://github.com/thalium/icebox/blob/99d147d5b9269222225443ce171b4fd46d8985d4/third_party/virtualbox/src/VBox/VMM/VMMAll/IEMAllInstructionsPython.py#L3228-L3293 | |
PaddlePaddle/Paddle | 1252f4bb3e574df80aa6d18c7ddae1b3a90bd81c | python/paddle/fluid/metrics.py | python | MetricBase.__init__ | (self, name) | The constructor of the metric class.
Args:
name(str): The name of metric instance. such as, "accuracy".
It can be used to distinguish different metric instances in a model.
Returns:
The constructed class instance.
Return types:
The MetricB... | The constructor of the metric class. | [
"The",
"constructor",
"of",
"the",
"metric",
"class",
"."
] | def __init__(self, name):
"""
The constructor of the metric class.
Args:
name(str): The name of metric instance. such as, "accuracy".
It can be used to distinguish different metric instances in a model.
Returns:
The constructed class instance.
... | [
"def",
"__init__",
"(",
"self",
",",
"name",
")",
":",
"self",
".",
"_name",
"=",
"str",
"(",
"name",
")",
"if",
"name",
"!=",
"None",
"else",
"self",
".",
"__class__",
".",
"__name__"
] | https://github.com/PaddlePaddle/Paddle/blob/1252f4bb3e574df80aa6d18c7ddae1b3a90bd81c/python/paddle/fluid/metrics.py#L87-L102 | ||
gimli-org/gimli | 17aa2160de9b15ababd9ef99e89b1bc3277bbb23 | pygimli/_version.py | python | render_pep440_post | (pieces) | return rendered | TAG[.postDISTANCE[.dev0]+gHEX] .
The ".dev0" means dirty. Note that .dev0 sorts backwards
(a dirty tree will appear "older" than the corresponding clean one),
but you shouldn't be releasing software with -dirty anyways.
Exceptions:
1: no tags. 0.postDISTANCE[.dev0] | TAG[.postDISTANCE[.dev0]+gHEX] . | [
"TAG",
"[",
".",
"postDISTANCE",
"[",
".",
"dev0",
"]",
"+",
"gHEX",
"]",
"."
] | def render_pep440_post(pieces):
"""TAG[.postDISTANCE[.dev0]+gHEX] .
The ".dev0" means dirty. Note that .dev0 sorts backwards
(a dirty tree will appear "older" than the corresponding clean one),
but you shouldn't be releasing software with -dirty anyways.
Exceptions:
1: no tags. 0.postDISTANCE[... | [
"def",
"render_pep440_post",
"(",
"pieces",
")",
":",
"if",
"pieces",
"[",
"\"closest-tag\"",
"]",
":",
"rendered",
"=",
"pieces",
"[",
"\"closest-tag\"",
"]",
"if",
"pieces",
"[",
"\"distance\"",
"]",
"or",
"pieces",
"[",
"\"dirty\"",
"]",
":",
"rendered",
... | https://github.com/gimli-org/gimli/blob/17aa2160de9b15ababd9ef99e89b1bc3277bbb23/pygimli/_version.py#L363-L387 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.