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 |
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
wxWidgets/wxPython-Classic | 19571e1ae65f1ac445f5491474121998c97a1bf0 | src/osx_carbon/_misc.py | python | AboutDialogInfo.HasDocWriters | (*args, **kwargs) | return _misc_.AboutDialogInfo_HasDocWriters(*args, **kwargs) | HasDocWriters(self) -> bool
Returns ``True if any documentation writers have been set. | HasDocWriters(self) -> bool | [
"HasDocWriters",
"(",
"self",
")",
"-",
">",
"bool"
] | def HasDocWriters(*args, **kwargs):
"""
HasDocWriters(self) -> bool
Returns ``True if any documentation writers have been set.
"""
return _misc_.AboutDialogInfo_HasDocWriters(*args, **kwargs) | [
"def",
"HasDocWriters",
"(",
"*",
"args",
",",
"*",
"*",
"kwargs",
")",
":",
"return",
"_misc_",
".",
"AboutDialogInfo_HasDocWriters",
"(",
"*",
"args",
",",
"*",
"*",
"kwargs",
")"
] | https://github.com/wxWidgets/wxPython-Classic/blob/19571e1ae65f1ac445f5491474121998c97a1bf0/src/osx_carbon/_misc.py#L6848-L6854 | |
QMCPACK/qmcpack | d0948ab455e38364458740cc8e2239600a14c5cd | utils/afqmctools/afqmctools/utils/optimizable_basis_set.py | python | OptimizableBasisSet.basis_str | (self, atm, x) | Returns a string with the basis set of a given species.
Parameters
----------
atm: string
String with the label of a species.
x: 1-D floating point array.
Array with variational parameters in the basis.
Dimension must be equal to ... | Returns a string with the basis set of a given species. | [
"Returns",
"a",
"string",
"with",
"the",
"basis",
"set",
"of",
"a",
"given",
"species",
"."
] | def basis_str(self, atm, x):
"""Returns a string with the basis set of a given species.
Parameters
----------
atm: string
String with the label of a species.
x: 1-D floating point array.
Array with variational parameters in the basis.
... | [
"def",
"basis_str",
"(",
"self",
",",
"atm",
",",
"x",
")",
":",
"assert",
"(",
"atm",
"in",
"self",
".",
"atom_id",
")",
"assert",
"(",
"atm",
"in",
"self",
".",
"default_basis",
")",
"assert",
"(",
"len",
"(",
"x",
")",
"==",
"self",
".",
"numb... | https://github.com/QMCPACK/qmcpack/blob/d0948ab455e38364458740cc8e2239600a14c5cd/utils/afqmctools/afqmctools/utils/optimizable_basis_set.py#L271-L292 | ||
windystrife/UnrealEngine_NVIDIAGameWorks | b50e6338a7c5b26374d66306ebc7807541ff815e | Engine/Extras/ThirdPartyNotUE/emsdk/Win64/python/2.7.5.3_64bit/Lib/site-packages/setuptools/dist.py | python | Distribution.handle_display_options | (self, option_order) | If there were any non-global "display-only" options
(--help-commands or the metadata display options) on the command
line, display the requested info and return true; else return
false. | If there were any non-global "display-only" options
(--help-commands or the metadata display options) on the command
line, display the requested info and return true; else return
false. | [
"If",
"there",
"were",
"any",
"non",
"-",
"global",
"display",
"-",
"only",
"options",
"(",
"--",
"help",
"-",
"commands",
"or",
"the",
"metadata",
"display",
"options",
")",
"on",
"the",
"command",
"line",
"display",
"the",
"requested",
"info",
"and",
"... | def handle_display_options(self, option_order):
"""If there were any non-global "display-only" options
(--help-commands or the metadata display options) on the command
line, display the requested info and return true; else return
false.
"""
import sys
if sys.vers... | [
"def",
"handle_display_options",
"(",
"self",
",",
"option_order",
")",
":",
"import",
"sys",
"if",
"sys",
".",
"version_info",
"<",
"(",
"3",
",",
")",
"or",
"self",
".",
"help_commands",
":",
"return",
"_Distribution",
".",
"handle_display_options",
"(",
"... | https://github.com/windystrife/UnrealEngine_NVIDIAGameWorks/blob/b50e6338a7c5b26374d66306ebc7807541ff815e/Engine/Extras/ThirdPartyNotUE/emsdk/Win64/python/2.7.5.3_64bit/Lib/site-packages/setuptools/dist.py#L693-L726 | ||
MegEngine/MegEngine | ce9ad07a27ec909fb8db4dd67943d24ba98fb93a | lite/pylite/megenginelite/tensor.py | python | LiteTensor.slice | (self, start, end, step=None) | return slice_tensor | slice the tensor with gaven start, end, step
:param start: silce begin index of each dim
:param end: silce end index of each dim
:param step: silce step of each dim | slice the tensor with gaven start, end, step
:param start: silce begin index of each dim
:param end: silce end index of each dim
:param step: silce step of each dim | [
"slice",
"the",
"tensor",
"with",
"gaven",
"start",
"end",
"step",
":",
"param",
"start",
":",
"silce",
"begin",
"index",
"of",
"each",
"dim",
":",
"param",
"end",
":",
"silce",
"end",
"index",
"of",
"each",
"dim",
":",
"param",
"step",
":",
"silce",
... | def slice(self, start, end, step=None):
"""
slice the tensor with gaven start, end, step
:param start: silce begin index of each dim
:param end: silce end index of each dim
:param step: silce step of each dim
"""
start = list(start)
end = list(end)
... | [
"def",
"slice",
"(",
"self",
",",
"start",
",",
"end",
",",
"step",
"=",
"None",
")",
":",
"start",
"=",
"list",
"(",
"start",
")",
"end",
"=",
"list",
"(",
"end",
")",
"length",
"=",
"len",
"(",
"start",
")",
"assert",
"length",
"==",
"len",
"... | https://github.com/MegEngine/MegEngine/blob/ce9ad07a27ec909fb8db4dd67943d24ba98fb93a/lite/pylite/megenginelite/tensor.py#L340-L364 | |
microsoft/LightGBM | 904b2d5158703c4900b68008617951dd2f9ff21b | python-package/lightgbm/sklearn.py | python | LGBMModel.n_features_in_ | (self) | return self._n_features_in | :obj:`int`: The number of features of fitted model. | :obj:`int`: The number of features of fitted model. | [
":",
"obj",
":",
"int",
":",
"The",
"number",
"of",
"features",
"of",
"fitted",
"model",
"."
] | def n_features_in_(self):
""":obj:`int`: The number of features of fitted model."""
if not self.__sklearn_is_fitted__():
raise LGBMNotFittedError('No n_features_in found. Need to call fit beforehand.')
return self._n_features_in | [
"def",
"n_features_in_",
"(",
"self",
")",
":",
"if",
"not",
"self",
".",
"__sklearn_is_fitted__",
"(",
")",
":",
"raise",
"LGBMNotFittedError",
"(",
"'No n_features_in found. Need to call fit beforehand.'",
")",
"return",
"self",
".",
"_n_features_in"
] | https://github.com/microsoft/LightGBM/blob/904b2d5158703c4900b68008617951dd2f9ff21b/python-package/lightgbm/sklearn.py#L851-L855 | |
apple/turicreate | cce55aa5311300e3ce6af93cb45ba791fd1bdf49 | src/python/turicreate/toolkits/graph_analytics/connected_components.py | python | ConnectedComponentsModel.__init__ | (self, model) | __init__(self) | __init__(self) | [
"__init__",
"(",
"self",
")"
] | def __init__(self, model):
"""__init__(self)"""
self.__proxy__ = model
self.__model_name__ = self.__class__._native_name() | [
"def",
"__init__",
"(",
"self",
",",
"model",
")",
":",
"self",
".",
"__proxy__",
"=",
"model",
"self",
".",
"__model_name__",
"=",
"self",
".",
"__class__",
".",
"_native_name",
"(",
")"
] | https://github.com/apple/turicreate/blob/cce55aa5311300e3ce6af93cb45ba791fd1bdf49/src/python/turicreate/toolkits/graph_analytics/connected_components.py#L49-L52 | ||
openvinotoolkit/openvino | dedcbeafa8b84cccdc55ca64b8da516682b381c7 | src/bindings/python/src/openvino/runtime/opset1/ops.py | python | gather_tree | (
step_ids: NodeInput,
parent_idx: NodeInput,
max_seq_len: NodeInput,
end_token: NodeInput,
name: Optional[str] = None,
) | return _get_node_factory_opset1().create("GatherTree", node_inputs) | Perform GatherTree operation.
@param step_ids: The tensor with indices from per each step.
@param parent_idx: The tensor with with parent beam indices.
@param max_seq_len: The tensor with maximum lengths for each sequence in the batch.
@param end_token: The scalar tensor with value of the end marker in... | Perform GatherTree operation. | [
"Perform",
"GatherTree",
"operation",
"."
] | def gather_tree(
step_ids: NodeInput,
parent_idx: NodeInput,
max_seq_len: NodeInput,
end_token: NodeInput,
name: Optional[str] = None,
) -> Node:
"""Perform GatherTree operation.
@param step_ids: The tensor with indices from per each step.
@param parent_idx: The tensor with with parent ... | [
"def",
"gather_tree",
"(",
"step_ids",
":",
"NodeInput",
",",
"parent_idx",
":",
"NodeInput",
",",
"max_seq_len",
":",
"NodeInput",
",",
"end_token",
":",
"NodeInput",
",",
"name",
":",
"Optional",
"[",
"str",
"]",
"=",
"None",
",",
")",
"->",
"Node",
":... | https://github.com/openvinotoolkit/openvino/blob/dedcbeafa8b84cccdc55ca64b8da516682b381c7/src/bindings/python/src/openvino/runtime/opset1/ops.py#L936-L970 | |
apple/turicreate | cce55aa5311300e3ce6af93cb45ba791fd1bdf49 | deps/src/libxml2-2.9.1/python/libxml2.py | python | xpathParserContext.xpathMultValues | (self) | Implement the multiply operation on XPath objects: The
numeric operators convert their operands to numbers as if
by calling the number function. | Implement the multiply operation on XPath objects: The
numeric operators convert their operands to numbers as if
by calling the number function. | [
"Implement",
"the",
"multiply",
"operation",
"on",
"XPath",
"objects",
":",
"The",
"numeric",
"operators",
"convert",
"their",
"operands",
"to",
"numbers",
"as",
"if",
"by",
"calling",
"the",
"number",
"function",
"."
] | def xpathMultValues(self):
"""Implement the multiply operation on XPath objects: The
numeric operators convert their operands to numbers as if
by calling the number function. """
libxml2mod.xmlXPathMultValues(self._o) | [
"def",
"xpathMultValues",
"(",
"self",
")",
":",
"libxml2mod",
".",
"xmlXPathMultValues",
"(",
"self",
".",
"_o",
")"
] | https://github.com/apple/turicreate/blob/cce55aa5311300e3ce6af93cb45ba791fd1bdf49/deps/src/libxml2-2.9.1/python/libxml2.py#L7577-L7581 | ||
BestSonny/SSTD | 174d452189f6bf9cf4b6957719392008bd974069 | python/caffe/io.py | python | load_image | (filename, color=True) | return img | Load an image converting from grayscale or alpha as needed.
Parameters
----------
filename : string
color : boolean
flag for color format. True (default) loads as RGB while False
loads as intensity (if image is already grayscale).
Returns
-------
image : an image with type ... | Load an image converting from grayscale or alpha as needed. | [
"Load",
"an",
"image",
"converting",
"from",
"grayscale",
"or",
"alpha",
"as",
"needed",
"."
] | def load_image(filename, color=True):
"""
Load an image converting from grayscale or alpha as needed.
Parameters
----------
filename : string
color : boolean
flag for color format. True (default) loads as RGB while False
loads as intensity (if image is already grayscale).
R... | [
"def",
"load_image",
"(",
"filename",
",",
"color",
"=",
"True",
")",
":",
"img",
"=",
"skimage",
".",
"img_as_float",
"(",
"skimage",
".",
"io",
".",
"imread",
"(",
"filename",
",",
"as_grey",
"=",
"not",
"color",
")",
")",
".",
"astype",
"(",
"np",... | https://github.com/BestSonny/SSTD/blob/174d452189f6bf9cf4b6957719392008bd974069/python/caffe/io.py#L279-L303 | |
JoseExposito/touchegg | 1f3fda214358d071c05da4bf17c070c33d67b5eb | cmake/cpplint.py | python | IsInitializerList | (clean_lines, linenum) | return False | Check if current line is inside constructor initializer list.
Args:
clean_lines: A CleansedLines instance containing the file.
linenum: The number of the line to check.
Returns:
True if current line appears to be inside constructor initializer
list, False otherwise. | Check if current line is inside constructor initializer list. | [
"Check",
"if",
"current",
"line",
"is",
"inside",
"constructor",
"initializer",
"list",
"."
] | def IsInitializerList(clean_lines, linenum):
"""Check if current line is inside constructor initializer list.
Args:
clean_lines: A CleansedLines instance containing the file.
linenum: The number of the line to check.
Returns:
True if current line appears to be inside constructor initializer
list,... | [
"def",
"IsInitializerList",
"(",
"clean_lines",
",",
"linenum",
")",
":",
"for",
"i",
"in",
"xrange",
"(",
"linenum",
",",
"1",
",",
"-",
"1",
")",
":",
"line",
"=",
"clean_lines",
".",
"elided",
"[",
"i",
"]",
"if",
"i",
"==",
"linenum",
":",
"rem... | https://github.com/JoseExposito/touchegg/blob/1f3fda214358d071c05da4bf17c070c33d67b5eb/cmake/cpplint.py#L4971-L5010 | |
aws/lumberyard | f85344403c1c2e77ec8c75deb2c116e97b713217 | dev/Tools/Python/3.7.10/mac/Python.framework/Versions/3.7/lib/python3.7/html/parser.py | python | HTMLParser.close | (self) | Handle any buffered data. | Handle any buffered data. | [
"Handle",
"any",
"buffered",
"data",
"."
] | def close(self):
"""Handle any buffered data."""
self.goahead(1) | [
"def",
"close",
"(",
"self",
")",
":",
"self",
".",
"goahead",
"(",
"1",
")"
] | https://github.com/aws/lumberyard/blob/f85344403c1c2e77ec8c75deb2c116e97b713217/dev/Tools/Python/3.7.10/mac/Python.framework/Versions/3.7/lib/python3.7/html/parser.py#L113-L115 | ||
tensorflow/tensorflow | 419e3a6b650ea4bd1b0cba23c4348f8a69f3272e | tensorflow/python/util/compat.py | python | path_to_str | (path) | return path | r"""Converts input which is a `PathLike` object to `str` type.
Converts from any python constant representation of a `PathLike` object to
a string. If the input is not a `PathLike` object, simply returns the input.
Args:
path: An object that can be converted to path representation.
Returns:
A `str` o... | r"""Converts input which is a `PathLike` object to `str` type. | [
"r",
"Converts",
"input",
"which",
"is",
"a",
"PathLike",
"object",
"to",
"str",
"type",
"."
] | def path_to_str(path):
r"""Converts input which is a `PathLike` object to `str` type.
Converts from any python constant representation of a `PathLike` object to
a string. If the input is not a `PathLike` object, simply returns the input.
Args:
path: An object that can be converted to path representation.
... | [
"def",
"path_to_str",
"(",
"path",
")",
":",
"if",
"hasattr",
"(",
"path",
",",
"'__fspath__'",
")",
":",
"path",
"=",
"as_str_any",
"(",
"path",
".",
"__fspath__",
"(",
")",
")",
"return",
"path"
] | https://github.com/tensorflow/tensorflow/blob/419e3a6b650ea4bd1b0cba23c4348f8a69f3272e/tensorflow/python/util/compat.py#L138-L173 | |
baidu/bigflow | 449245016c0df7d1252e85581e588bfc60cefad3 | bigflow_python/python/bigflow/input.py | python | _TextStreamInputFormat.get_entity_name | (self) | return "TextStreamInputFormat" | 内部方法 | 内部方法 | [
"内部方法"
] | def get_entity_name(self):
""" 内部方法 """
return "TextStreamInputFormat" | [
"def",
"get_entity_name",
"(",
"self",
")",
":",
"return",
"\"TextStreamInputFormat\""
] | https://github.com/baidu/bigflow/blob/449245016c0df7d1252e85581e588bfc60cefad3/bigflow_python/python/bigflow/input.py#L603-L605 | |
catboost/catboost | 167f64f237114a4d10b2b4ee42adb4569137debe | contrib/python/scipy/py3/scipy/optimize/_spectral.py | python | _wrap_result | (result, is_complex, shape=None) | return z | Convert from real to complex and reshape result arrays. | Convert from real to complex and reshape result arrays. | [
"Convert",
"from",
"real",
"to",
"complex",
"and",
"reshape",
"result",
"arrays",
"."
] | def _wrap_result(result, is_complex, shape=None):
"""
Convert from real to complex and reshape result arrays.
"""
if is_complex:
z = _real2complex(result)
else:
z = result
if shape is not None:
z = z.reshape(shape)
return z | [
"def",
"_wrap_result",
"(",
"result",
",",
"is_complex",
",",
"shape",
"=",
"None",
")",
":",
"if",
"is_complex",
":",
"z",
"=",
"_real2complex",
"(",
"result",
")",
"else",
":",
"z",
"=",
"result",
"if",
"shape",
"is",
"not",
"None",
":",
"z",
"=",
... | https://github.com/catboost/catboost/blob/167f64f237114a4d10b2b4ee42adb4569137debe/contrib/python/scipy/py3/scipy/optimize/_spectral.py#L241-L251 | |
baidu-research/tensorflow-allreduce | 66d5b855e90b0949e9fa5cca5599fd729a70e874 | tensorflow/contrib/bayesflow/python/ops/variational_inference_impl.py | python | elbo | (log_likelihood,
variational_with_prior=None,
keep_batch_dim=True,
form=None,
name="ELBO") | r"""Evidence Lower BOund. `log p(x) >= ELBO`.
Optimization objective for inference of hidden variables by variational
inference.
This function is meant to be used in conjunction with `StochasticTensor`.
The user should build out the inference network, using `StochasticTensor`s
as latent variables, and the g... | r"""Evidence Lower BOund. `log p(x) >= ELBO`. | [
"r",
"Evidence",
"Lower",
"BOund",
".",
"log",
"p",
"(",
"x",
")",
">",
"=",
"ELBO",
"."
] | def elbo(log_likelihood,
variational_with_prior=None,
keep_batch_dim=True,
form=None,
name="ELBO"):
r"""Evidence Lower BOund. `log p(x) >= ELBO`.
Optimization objective for inference of hidden variables by variational
inference.
This function is meant to be used in conjunct... | [
"def",
"elbo",
"(",
"log_likelihood",
",",
"variational_with_prior",
"=",
"None",
",",
"keep_batch_dim",
"=",
"True",
",",
"form",
"=",
"None",
",",
"name",
"=",
"\"ELBO\"",
")",
":",
"if",
"form",
"is",
"None",
":",
"form",
"=",
"ELBOForms",
".",
"defau... | https://github.com/baidu-research/tensorflow-allreduce/blob/66d5b855e90b0949e9fa5cca5599fd729a70e874/tensorflow/contrib/bayesflow/python/ops/variational_inference_impl.py#L94-L170 | ||
mantidproject/mantid | 03deeb89254ec4289edb8771e0188c2090a02f32 | qt/python/mantidqt/mantidqt/widgets/superplot/view.py | python | SuperplotView.get_spectrum_spin_box_value | (self) | return self._bottom_view.spectrumSpinBox.value() | Get the current spectrum spinbox value.
Returns:
int: spinbox value | Get the current spectrum spinbox value. | [
"Get",
"the",
"current",
"spectrum",
"spinbox",
"value",
"."
] | def get_spectrum_spin_box_value(self):
"""
Get the current spectrum spinbox value.
Returns:
int: spinbox value
"""
return self._bottom_view.spectrumSpinBox.value() | [
"def",
"get_spectrum_spin_box_value",
"(",
"self",
")",
":",
"return",
"self",
".",
"_bottom_view",
".",
"spectrumSpinBox",
".",
"value",
"(",
")"
] | https://github.com/mantidproject/mantid/blob/03deeb89254ec4289edb8771e0188c2090a02f32/qt/python/mantidqt/mantidqt/widgets/superplot/view.py#L515-L522 | |
InsightSoftwareConsortium/ITK | 87acfce9a93d928311c38bc371b666b515b9f19d | Modules/ThirdParty/pygccxml/src/pygccxml/parser/source_reader.py | python | source_reader_t.read_cpp_source_file | (self, source_file) | return decls | Reads C++ source file and returns declarations tree
:param source_file: path to C++ source file
:type source_file: str | Reads C++ source file and returns declarations tree | [
"Reads",
"C",
"++",
"source",
"file",
"and",
"returns",
"declarations",
"tree"
] | def read_cpp_source_file(self, source_file):
"""
Reads C++ source file and returns declarations tree
:param source_file: path to C++ source file
:type source_file: str
"""
xml_file = ''
try:
ffname = self.__file_full_name(source_file)
se... | [
"def",
"read_cpp_source_file",
"(",
"self",
",",
"source_file",
")",
":",
"xml_file",
"=",
"''",
"try",
":",
"ffname",
"=",
"self",
".",
"__file_full_name",
"(",
"source_file",
")",
"self",
".",
"logger",
".",
"debug",
"(",
"\"Reading source file: [%s].\"",
",... | https://github.com/InsightSoftwareConsortium/ITK/blob/87acfce9a93d928311c38bc371b666b515b9f19d/Modules/ThirdParty/pygccxml/src/pygccxml/parser/source_reader.py#L301-L333 | |
ispc/ispc | 0a7ee59b6ec50e54d545eb2a31056e54c4891d51 | common.py | python | TestTable.test_intersection | (self, test1, test2) | return list(set(test1.test_cases) & set(test2.test_cases)) | Return test cases common for test1 and test2. If test names are different than there is nothing in common | Return test cases common for test1 and test2. If test names are different than there is nothing in common | [
"Return",
"test",
"cases",
"common",
"for",
"test1",
"and",
"test2",
".",
"If",
"test",
"names",
"are",
"different",
"than",
"there",
"is",
"nothing",
"in",
"common"
] | def test_intersection(self, test1, test2):
""" Return test cases common for test1 and test2. If test names are different than there is nothing in common """
if test1.name != test2.name:
return []
return list(set(test1.test_cases) & set(test2.test_cases)) | [
"def",
"test_intersection",
"(",
"self",
",",
"test1",
",",
"test2",
")",
":",
"if",
"test1",
".",
"name",
"!=",
"test2",
".",
"name",
":",
"return",
"[",
"]",
"return",
"list",
"(",
"set",
"(",
"test1",
".",
"test_cases",
")",
"&",
"set",
"(",
"te... | https://github.com/ispc/ispc/blob/0a7ee59b6ec50e54d545eb2a31056e54c4891d51/common.py#L337-L341 | |
wxWidgets/wxPython-Classic | 19571e1ae65f1ac445f5491474121998c97a1bf0 | wx/tools/Editra/src/syntax/_vhdl.py | python | SyntaxData.GetCommentPattern | (self) | return [u'--'] | Returns a list of characters used to comment a block of code | Returns a list of characters used to comment a block of code | [
"Returns",
"a",
"list",
"of",
"characters",
"used",
"to",
"comment",
"a",
"block",
"of",
"code"
] | def GetCommentPattern(self):
"""Returns a list of characters used to comment a block of code """
return [u'--'] | [
"def",
"GetCommentPattern",
"(",
"self",
")",
":",
"return",
"[",
"u'--'",
"]"
] | https://github.com/wxWidgets/wxPython-Classic/blob/19571e1ae65f1ac445f5491474121998c97a1bf0/wx/tools/Editra/src/syntax/_vhdl.py#L128-L130 | |
tensorflow/tensorflow | 419e3a6b650ea4bd1b0cba23c4348f8a69f3272e | tensorflow/core/function/trace_type/default_types.py | python | OrderedCollection.is_subtype_of | (self, other: trace.TraceType) | return True | See base class. | See base class. | [
"See",
"base",
"class",
"."
] | def is_subtype_of(self, other: trace.TraceType) -> bool:
"""See base class."""
if not self._has_same_structure(other):
return False
if not all([
component.is_subtype_of(other.components[i])
for i, component in enumerate(self.components)
]):
return False
return True | [
"def",
"is_subtype_of",
"(",
"self",
",",
"other",
":",
"trace",
".",
"TraceType",
")",
"->",
"bool",
":",
"if",
"not",
"self",
".",
"_has_same_structure",
"(",
"other",
")",
":",
"return",
"False",
"if",
"not",
"all",
"(",
"[",
"component",
".",
"is_s... | https://github.com/tensorflow/tensorflow/blob/419e3a6b650ea4bd1b0cba23c4348f8a69f3272e/tensorflow/core/function/trace_type/default_types.py#L101-L112 | |
catboost/catboost | 167f64f237114a4d10b2b4ee42adb4569137debe | contrib/python/pandas/py2/pandas/core/indexes/multi.py | python | MultiIndex.__reduce__ | (self) | return ibase._new_Index, (self.__class__, d), None | Necessary for making this object picklable | Necessary for making this object picklable | [
"Necessary",
"for",
"making",
"this",
"object",
"picklable"
] | def __reduce__(self):
"""Necessary for making this object picklable"""
d = dict(levels=[lev for lev in self.levels],
codes=[level_codes for level_codes in self.codes],
sortorder=self.sortorder, names=list(self.names))
return ibase._new_Index, (self.__class__, d)... | [
"def",
"__reduce__",
"(",
"self",
")",
":",
"d",
"=",
"dict",
"(",
"levels",
"=",
"[",
"lev",
"for",
"lev",
"in",
"self",
".",
"levels",
"]",
",",
"codes",
"=",
"[",
"level_codes",
"for",
"level_codes",
"in",
"self",
".",
"codes",
"]",
",",
"sortor... | https://github.com/catboost/catboost/blob/167f64f237114a4d10b2b4ee42adb4569137debe/contrib/python/pandas/py2/pandas/core/indexes/multi.py#L1733-L1738 | |
mantidproject/mantid | 03deeb89254ec4289edb8771e0188c2090a02f32 | qt/applications/workbench/workbench/plugins/workspacewidget.py | python | WorkspaceWidget._do_sample_material | (self, names) | Show a sample material dialog for the workspace for names[0]. It only makes sense
to show the dialog for a single workspace, and the context menu option should
only be available if a single workspace is selected.
:param names: A list of workspace names | Show a sample material dialog for the workspace for names[0]. It only makes sense
to show the dialog for a single workspace, and the context menu option should
only be available if a single workspace is selected. | [
"Show",
"a",
"sample",
"material",
"dialog",
"for",
"the",
"workspace",
"for",
"names",
"[",
"0",
"]",
".",
"It",
"only",
"makes",
"sense",
"to",
"show",
"the",
"dialog",
"for",
"a",
"single",
"workspace",
"and",
"the",
"context",
"menu",
"option",
"shou... | def _do_sample_material(self, names):
"""
Show a sample material dialog for the workspace for names[0]. It only makes sense
to show the dialog for a single workspace, and the context menu option should
only be available if a single workspace is selected.
:param names: A list of ... | [
"def",
"_do_sample_material",
"(",
"self",
",",
"names",
")",
":",
"# It only makes sense to show the sample material dialog with one workspace",
"# selected. The context menu should only add the sample material action",
"# if there's only one workspace selected.",
"if",
"len",
"(",
"nam... | https://github.com/mantidproject/mantid/blob/03deeb89254ec4289edb8771e0188c2090a02f32/qt/applications/workbench/workbench/plugins/workspacewidget.py#L331-L351 | ||
CanalTP/navitia | cb84ce9859070187e708818b058e6a7e0b7f891b | source/jormungandr/jormungandr/new_relic.py | python | record_streetnetwork_call | (call_name, connector_name, mode, coverage_name) | Custom event that we publish to New Relic for external streetnetwork call such as:
Asgard, Kraken, Geovelo, Here, etc | Custom event that we publish to New Relic for external streetnetwork call such as:
Asgard, Kraken, Geovelo, Here, etc | [
"Custom",
"event",
"that",
"we",
"publish",
"to",
"New",
"Relic",
"for",
"external",
"streetnetwork",
"call",
"such",
"as",
":",
"Asgard",
"Kraken",
"Geovelo",
"Here",
"etc"
] | def record_streetnetwork_call(call_name, connector_name, mode, coverage_name):
"""
Custom event that we publish to New Relic for external streetnetwork call such as:
Asgard, Kraken, Geovelo, Here, etc
"""
newrelic_service_name = "streetnetwork_call"
event_params = {
"service": newrelic_s... | [
"def",
"record_streetnetwork_call",
"(",
"call_name",
",",
"connector_name",
",",
"mode",
",",
"coverage_name",
")",
":",
"newrelic_service_name",
"=",
"\"streetnetwork_call\"",
"event_params",
"=",
"{",
"\"service\"",
":",
"newrelic_service_name",
",",
"\"call\"",
":",... | https://github.com/CanalTP/navitia/blob/cb84ce9859070187e708818b058e6a7e0b7f891b/source/jormungandr/jormungandr/new_relic.py#L161-L187 | ||
eventql/eventql | 7ca0dbb2e683b525620ea30dc40540a22d5eb227 | deps/3rdparty/spidermonkey/mozjs/python/which/build.py | python | _run | (cmd, logstream=_RUN_DEFAULT_LOGSTREAM) | Run the given command.
"cmd" is the command to run
"logstream" is an optional logging stream on which to log the command.
If None, no logging is done. If unspecifed, this looks for a Logger
instance named 'log' and logs the command on log.debug().
Raises OSError is the comm... | Run the given command. | [
"Run",
"the",
"given",
"command",
"."
] | def _run(cmd, logstream=_RUN_DEFAULT_LOGSTREAM):
"""Run the given command.
"cmd" is the command to run
"logstream" is an optional logging stream on which to log the command.
If None, no logging is done. If unspecifed, this looks for a Logger
instance named 'log' and logs the... | [
"def",
"_run",
"(",
"cmd",
",",
"logstream",
"=",
"_RUN_DEFAULT_LOGSTREAM",
")",
":",
"__run_log",
"(",
"logstream",
",",
"\"running '%s'\"",
",",
"cmd",
")",
"retval",
"=",
"os",
".",
"system",
"(",
"cmd",
")",
"if",
"hasattr",
"(",
"os",
",",
"\"WEXITS... | https://github.com/eventql/eventql/blob/7ca0dbb2e683b525620ea30dc40540a22d5eb227/deps/3rdparty/spidermonkey/mozjs/python/which/build.py#L98-L116 | ||
hanpfei/chromium-net | 392cc1fa3a8f92f42e4071ab6e674d8e0482f83f | third_party/catapult/third_party/mox3/mox3/mox.py | python | _MockObjectFactory._Verify | (self) | Verify that all mocks have been created. | Verify that all mocks have been created. | [
"Verify",
"that",
"all",
"mocks",
"have",
"been",
"created",
"."
] | def _Verify(self):
"""Verify that all mocks have been created."""
if self._instance_queue:
raise ExpectedMockCreationError(self._instance_queue)
super(_MockObjectFactory, self)._Verify() | [
"def",
"_Verify",
"(",
"self",
")",
":",
"if",
"self",
".",
"_instance_queue",
":",
"raise",
"ExpectedMockCreationError",
"(",
"self",
".",
"_instance_queue",
")",
"super",
"(",
"_MockObjectFactory",
",",
"self",
")",
".",
"_Verify",
"(",
")"
] | https://github.com/hanpfei/chromium-net/blob/392cc1fa3a8f92f42e4071ab6e674d8e0482f83f/third_party/catapult/third_party/mox3/mox3/mox.py#L881-L885 | ||
weolar/miniblink49 | 1c4678db0594a4abde23d3ebbcc7cd13c3170777 | tools/idl_parser/idl_parser.py | python | IDLParser.p_Identifiers | (self, p) | Identifiers : ',' identifier Identifiers
| | Identifiers : ',' identifier Identifiers
| | [
"Identifiers",
":",
"identifier",
"Identifiers",
"|"
] | def p_Identifiers(self, p):
"""Identifiers : ',' identifier Identifiers
|"""
if len(p) > 1:
p[0] = ListFromConcat(p[2], p[3]) | [
"def",
"p_Identifiers",
"(",
"self",
",",
"p",
")",
":",
"if",
"len",
"(",
"p",
")",
">",
"1",
":",
"p",
"[",
"0",
"]",
"=",
"ListFromConcat",
"(",
"p",
"[",
"2",
"]",
",",
"p",
"[",
"3",
"]",
")"
] | https://github.com/weolar/miniblink49/blob/1c4678db0594a4abde23d3ebbcc7cd13c3170777/tools/idl_parser/idl_parser.py#L901-L905 | ||
wxWidgets/wxPython-Classic | 19571e1ae65f1ac445f5491474121998c97a1bf0 | src/gtk/propgrid.py | python | FileProperty.GetFileName | (*args, **kwargs) | return _propgrid.FileProperty_GetFileName(*args, **kwargs) | GetFileName(self) -> wxFileName | GetFileName(self) -> wxFileName | [
"GetFileName",
"(",
"self",
")",
"-",
">",
"wxFileName"
] | def GetFileName(*args, **kwargs):
"""GetFileName(self) -> wxFileName"""
return _propgrid.FileProperty_GetFileName(*args, **kwargs) | [
"def",
"GetFileName",
"(",
"*",
"args",
",",
"*",
"*",
"kwargs",
")",
":",
"return",
"_propgrid",
".",
"FileProperty_GetFileName",
"(",
"*",
"args",
",",
"*",
"*",
"kwargs",
")"
] | https://github.com/wxWidgets/wxPython-Classic/blob/19571e1ae65f1ac445f5491474121998c97a1bf0/src/gtk/propgrid.py#L3079-L3081 | |
wxWidgets/wxPython-Classic | 19571e1ae65f1ac445f5491474121998c97a1bf0 | wx/tools/Editra/src/ed_shelf.py | python | EdShelfBook.CloseAll | (self, name) | Close all of 'name' shelf items
@param name: shelf item name (string) | Close all of 'name' shelf items
@param name: shelf item name (string) | [
"Close",
"all",
"of",
"name",
"shelf",
"items",
"@param",
"name",
":",
"shelf",
"item",
"name",
"(",
"string",
")"
] | def CloseAll(self, name):
"""Close all of 'name' shelf items
@param name: shelf item name (string)
"""
idxs = self.GetAllIndexes(name)
idxs.reverse()
for idx in idxs:
self.DeletePage(idx) | [
"def",
"CloseAll",
"(",
"self",
",",
"name",
")",
":",
"idxs",
"=",
"self",
".",
"GetAllIndexes",
"(",
"name",
")",
"idxs",
".",
"reverse",
"(",
")",
"for",
"idx",
"in",
"idxs",
":",
"self",
".",
"DeletePage",
"(",
"idx",
")"
] | https://github.com/wxWidgets/wxPython-Classic/blob/19571e1ae65f1ac445f5491474121998c97a1bf0/wx/tools/Editra/src/ed_shelf.py#L229-L237 | ||
windystrife/UnrealEngine_NVIDIAGameWorks | b50e6338a7c5b26374d66306ebc7807541ff815e | Engine/Extras/ThirdPartyNotUE/emsdk/Win64/python/2.7.5.3_64bit/Lib/mailbox.py | python | Babyl.get_labels | (self) | return list(labels) | Return a list of user-defined labels in the mailbox. | Return a list of user-defined labels in the mailbox. | [
"Return",
"a",
"list",
"of",
"user",
"-",
"defined",
"labels",
"in",
"the",
"mailbox",
"."
] | def get_labels(self):
"""Return a list of user-defined labels in the mailbox."""
self._lookup()
labels = set()
for label_list in self._labels.values():
labels.update(label_list)
labels.difference_update(self._special_labels)
return list(labels) | [
"def",
"get_labels",
"(",
"self",
")",
":",
"self",
".",
"_lookup",
"(",
")",
"labels",
"=",
"set",
"(",
")",
"for",
"label_list",
"in",
"self",
".",
"_labels",
".",
"values",
"(",
")",
":",
"labels",
".",
"update",
"(",
"label_list",
")",
"labels",
... | https://github.com/windystrife/UnrealEngine_NVIDIAGameWorks/blob/b50e6338a7c5b26374d66306ebc7807541ff815e/Engine/Extras/ThirdPartyNotUE/emsdk/Win64/python/2.7.5.3_64bit/Lib/mailbox.py#L1297-L1304 | |
llvm-mirror/lldb | d01083a850f577b85501a0902b52fd0930de72c7 | utils/vim-lldb/python-vim-lldb/vim_ui.py | python | is_same_file | (a, b) | return a in b or b in a | returns true if paths a and b are the same file | returns true if paths a and b are the same file | [
"returns",
"true",
"if",
"paths",
"a",
"and",
"b",
"are",
"the",
"same",
"file"
] | def is_same_file(a, b):
""" returns true if paths a and b are the same file """
a = os.path.realpath(a)
b = os.path.realpath(b)
return a in b or b in a | [
"def",
"is_same_file",
"(",
"a",
",",
"b",
")",
":",
"a",
"=",
"os",
".",
"path",
".",
"realpath",
"(",
"a",
")",
"b",
"=",
"os",
".",
"path",
".",
"realpath",
"(",
"b",
")",
"return",
"a",
"in",
"b",
"or",
"b",
"in",
"a"
] | https://github.com/llvm-mirror/lldb/blob/d01083a850f577b85501a0902b52fd0930de72c7/utils/vim-lldb/python-vim-lldb/vim_ui.py#L15-L19 | |
ChromiumWebApps/chromium | c7361d39be8abd1574e6ce8957c8dbddd4c6ccf7 | tools/symsrc/pefile.py | python | PE.get_dword_at_rva | (self, rva) | Return the double word value at the given RVA.
Returns None if the value can't be read, i.e. the RVA can't be mapped
to a file offset. | Return the double word value at the given RVA.
Returns None if the value can't be read, i.e. the RVA can't be mapped
to a file offset. | [
"Return",
"the",
"double",
"word",
"value",
"at",
"the",
"given",
"RVA",
".",
"Returns",
"None",
"if",
"the",
"value",
"can",
"t",
"be",
"read",
"i",
".",
"e",
".",
"the",
"RVA",
"can",
"t",
"be",
"mapped",
"to",
"a",
"file",
"offset",
"."
] | def get_dword_at_rva(self, rva):
"""Return the double word value at the given RVA.
Returns None if the value can't be read, i.e. the RVA can't be mapped
to a file offset.
"""
try:
return self.get_dword_from_data(self.get_data(rva)[:4], 0)
exc... | [
"def",
"get_dword_at_rva",
"(",
"self",
",",
"rva",
")",
":",
"try",
":",
"return",
"self",
".",
"get_dword_from_data",
"(",
"self",
".",
"get_data",
"(",
"rva",
")",
"[",
":",
"4",
"]",
",",
"0",
")",
"except",
"PEFormatError",
":",
"return",
"None"
] | https://github.com/ChromiumWebApps/chromium/blob/c7361d39be8abd1574e6ce8957c8dbddd4c6ccf7/tools/symsrc/pefile.py#L3413-L3423 | ||
FreeCAD/FreeCAD | ba42231b9c6889b89e064d6d563448ed81e376ec | src/Mod/Part/BOPTools/GeneralFuseResult.py | python | GeneralFuseResult.parse | (self) | Parses the result of generalFuse recorded into self.gfa_return. Recovers missing
information. Fills in data structures.
It is called automatically by class constructor. | Parses the result of generalFuse recorded into self.gfa_return. Recovers missing
information. Fills in data structures. | [
"Parses",
"the",
"result",
"of",
"generalFuse",
"recorded",
"into",
"self",
".",
"gfa_return",
".",
"Recovers",
"missing",
"information",
".",
"Fills",
"in",
"data",
"structures",
"."
] | def parse(self):
"""Parses the result of generalFuse recorded into self.gfa_return. Recovers missing
information. Fills in data structures.
It is called automatically by class constructor."""
#save things to be parsed and wipe out all other data
gfa_return = self.gfa_return
... | [
"def",
"parse",
"(",
"self",
")",
":",
"#save things to be parsed and wipe out all other data",
"gfa_return",
"=",
"self",
".",
"gfa_return",
"source_shapes",
"=",
"self",
".",
"source_shapes",
"self",
".",
"__define_attributes",
"(",
")",
"self",
".",
"gfa_return",
... | https://github.com/FreeCAD/FreeCAD/blob/ba42231b9c6889b89e064d6d563448ed81e376ec/src/Mod/Part/BOPTools/GeneralFuseResult.py#L74-L161 | ||
aws/lumberyard | f85344403c1c2e77ec8c75deb2c116e97b713217 | dev/Tools/Python/3.7.10/windows/Lib/asyncio/futures.py | python | Future.done | (self) | return self._state != _PENDING | Return True if the future is done.
Done means either that a result / exception are available, or that the
future was cancelled. | Return True if the future is done. | [
"Return",
"True",
"if",
"the",
"future",
"is",
"done",
"."
] | def done(self):
"""Return True if the future is done.
Done means either that a result / exception are available, or that the
future was cancelled.
"""
return self._state != _PENDING | [
"def",
"done",
"(",
"self",
")",
":",
"return",
"self",
".",
"_state",
"!=",
"_PENDING"
] | https://github.com/aws/lumberyard/blob/f85344403c1c2e77ec8c75deb2c116e97b713217/dev/Tools/Python/3.7.10/windows/Lib/asyncio/futures.py#L160-L166 | |
google/earthenterprise | 0fe84e29be470cd857e3a0e52e5d0afd5bb8cee9 | earth_enterprise/src/fusion/portableglobe/servers/portable_web_interface.py | python | FileSize | (file_path) | return os.path.getsize(file_path) / BYTES_PER_MEGABYTE | Returns size of file in megabytes. | Returns size of file in megabytes. | [
"Returns",
"size",
"of",
"file",
"in",
"megabytes",
"."
] | def FileSize(file_path):
"""Returns size of file in megabytes."""
return os.path.getsize(file_path) / BYTES_PER_MEGABYTE | [
"def",
"FileSize",
"(",
"file_path",
")",
":",
"return",
"os",
".",
"path",
".",
"getsize",
"(",
"file_path",
")",
"/",
"BYTES_PER_MEGABYTE"
] | https://github.com/google/earthenterprise/blob/0fe84e29be470cd857e3a0e52e5d0afd5bb8cee9/earth_enterprise/src/fusion/portableglobe/servers/portable_web_interface.py#L60-L62 | |
adobe/chromium | cfe5bf0b51b1f6b9fe239c2a3c2f2364da9967d7 | third_party/closure_linter/closure_linter/indentation.py | python | IndentationRules._RemoveOverrides | (self, token_info) | Marks any token that was overridden by this token as active again.
Args:
token_info: The token that is being removed from the stack. | Marks any token that was overridden by this token as active again. | [
"Marks",
"any",
"token",
"that",
"was",
"overridden",
"by",
"this",
"token",
"as",
"active",
"again",
"."
] | def _RemoveOverrides(self, token_info):
"""Marks any token that was overridden by this token as active again.
Args:
token_info: The token that is being removed from the stack.
"""
for stack_token in self._stack:
if (stack_token.overridden_by == token_info and
not stack_token.is_pe... | [
"def",
"_RemoveOverrides",
"(",
"self",
",",
"token_info",
")",
":",
"for",
"stack_token",
"in",
"self",
".",
"_stack",
":",
"if",
"(",
"stack_token",
".",
"overridden_by",
"==",
"token_info",
"and",
"not",
"stack_token",
".",
"is_permanent_override",
")",
":"... | https://github.com/adobe/chromium/blob/cfe5bf0b51b1f6b9fe239c2a3c2f2364da9967d7/third_party/closure_linter/closure_linter/indentation.py#L575-L584 | ||
OSGeo/gdal | 3748fc4ba4fba727492774b2b908a2130c864a83 | swig/python/osgeo/ogr.py | python | FeatureDefn.GetGeomFieldCount | (self, *args) | return _ogr.FeatureDefn_GetGeomFieldCount(self, *args) | r"""
GetGeomFieldCount(FeatureDefn self) -> int
int
OGR_FD_GetGeomFieldCount(OGRFeatureDefnH hDefn)
Fetch number of geometry fields on the passed feature definition.
This function is the same as the C++
OGRFeatureDefn::GetGeomFieldCount().
Parameters:
-... | r"""
GetGeomFieldCount(FeatureDefn self) -> int
int
OGR_FD_GetGeomFieldCount(OGRFeatureDefnH hDefn) | [
"r",
"GetGeomFieldCount",
"(",
"FeatureDefn",
"self",
")",
"-",
">",
"int",
"int",
"OGR_FD_GetGeomFieldCount",
"(",
"OGRFeatureDefnH",
"hDefn",
")"
] | def GetGeomFieldCount(self, *args):
r"""
GetGeomFieldCount(FeatureDefn self) -> int
int
OGR_FD_GetGeomFieldCount(OGRFeatureDefnH hDefn)
Fetch number of geometry fields on the passed feature definition.
This function is the same as the C++
OGRFeatureDefn::GetGeom... | [
"def",
"GetGeomFieldCount",
"(",
"self",
",",
"*",
"args",
")",
":",
"return",
"_ogr",
".",
"FeatureDefn_GetGeomFieldCount",
"(",
"self",
",",
"*",
"args",
")"
] | https://github.com/OSGeo/gdal/blob/3748fc4ba4fba727492774b2b908a2130c864a83/swig/python/osgeo/ogr.py#L4609-L4629 | |
ApolloAuto/apollo-platform | 86d9dc6743b496ead18d597748ebabd34a513289 | ros/ros_comm/rosmaster/src/rosmaster/registrations.py | python | Registrations.iterkeys | (self) | return self.map.keys() | Iterate over registration keys
@return: iterator for registration keys | Iterate over registration keys | [
"Iterate",
"over",
"registration",
"keys"
] | def iterkeys(self):
"""
Iterate over registration keys
@return: iterator for registration keys
"""
return self.map.keys() | [
"def",
"iterkeys",
"(",
"self",
")",
":",
"return",
"self",
".",
"map",
".",
"keys",
"(",
")"
] | https://github.com/ApolloAuto/apollo-platform/blob/86d9dc6743b496ead18d597748ebabd34a513289/ros/ros_comm/rosmaster/src/rosmaster/registrations.py#L178-L183 | |
hanpfei/chromium-net | 392cc1fa3a8f92f42e4071ab6e674d8e0482f83f | third_party/catapult/third_party/html5lib-python/html5lib/inputstream.py | python | HTMLBinaryInputStream.detectBOM | (self) | return encoding | Attempts to detect at BOM at the start of the stream. If
an encoding can be determined from the BOM return the name of the
encoding otherwise return None | Attempts to detect at BOM at the start of the stream. If
an encoding can be determined from the BOM return the name of the
encoding otherwise return None | [
"Attempts",
"to",
"detect",
"at",
"BOM",
"at",
"the",
"start",
"of",
"the",
"stream",
".",
"If",
"an",
"encoding",
"can",
"be",
"determined",
"from",
"the",
"BOM",
"return",
"the",
"name",
"of",
"the",
"encoding",
"otherwise",
"return",
"None"
] | def detectBOM(self):
"""Attempts to detect at BOM at the start of the stream. If
an encoding can be determined from the BOM return the name of the
encoding otherwise return None"""
bomDict = {
codecs.BOM_UTF8: 'utf-8',
codecs.BOM_UTF16_LE: 'utf-16-le', codecs.BOM_... | [
"def",
"detectBOM",
"(",
"self",
")",
":",
"bomDict",
"=",
"{",
"codecs",
".",
"BOM_UTF8",
":",
"'utf-8'",
",",
"codecs",
".",
"BOM_UTF16_LE",
":",
"'utf-16-le'",
",",
"codecs",
".",
"BOM_UTF16_BE",
":",
"'utf-16-be'",
",",
"codecs",
".",
"BOM_UTF32_LE",
"... | https://github.com/hanpfei/chromium-net/blob/392cc1fa3a8f92f42e4071ab6e674d8e0482f83f/third_party/catapult/third_party/html5lib-python/html5lib/inputstream.py#L522-L551 | |
BlzFans/wke | b0fa21158312e40c5fbd84682d643022b6c34a93 | cygwin/lib/python2.6/io.py | python | IOBase.__enter__ | (self) | return self | Context management protocol. Returns self. | Context management protocol. Returns self. | [
"Context",
"management",
"protocol",
".",
"Returns",
"self",
"."
] | def __enter__(self):
"""Context management protocol. Returns self."""
self._checkClosed()
return self | [
"def",
"__enter__",
"(",
"self",
")",
":",
"self",
".",
"_checkClosed",
"(",
")",
"return",
"self"
] | https://github.com/BlzFans/wke/blob/b0fa21158312e40c5fbd84682d643022b6c34a93/cygwin/lib/python2.6/io.py#L462-L465 | |
cisco-open-source/qtwebdriver | 161780d3e816fc9dd52ad1af3933f0ecd77e05bd | src/base/android/jni_generator/jni_generator.py | python | ExtractNatives | (contents) | return natives | Returns a list of dict containing information about a native method. | Returns a list of dict containing information about a native method. | [
"Returns",
"a",
"list",
"of",
"dict",
"containing",
"information",
"about",
"a",
"native",
"method",
"."
] | def ExtractNatives(contents):
"""Returns a list of dict containing information about a native method."""
contents = contents.replace('\n', '')
natives = []
re_native = re.compile(r'(@NativeClassQualifiedName'
'\(\"(?P<native_class_name>.*?)\"\))?\s*'
'(@NativeCa... | [
"def",
"ExtractNatives",
"(",
"contents",
")",
":",
"contents",
"=",
"contents",
".",
"replace",
"(",
"'\\n'",
",",
"''",
")",
"natives",
"=",
"[",
"]",
"re_native",
"=",
"re",
".",
"compile",
"(",
"r'(@NativeClassQualifiedName'",
"'\\(\\\"(?P<native_class_name>... | https://github.com/cisco-open-source/qtwebdriver/blob/161780d3e816fc9dd52ad1af3933f0ecd77e05bd/src/base/android/jni_generator/jni_generator.py#L286-L305 | |
panda3d/panda3d | 833ad89ebad58395d0af0b7ec08538e5e4308265 | direct/src/distributed/ClockDelta.py | python | ClockDelta.resynchronize | (self, localTime, networkTime, newUncertainty,
trustNew = 1) | resynchronize(self, float localTime, int32 networkTime,
float newUncertainty)
Accepts a new networkTime value, which is understood to
represent the same moment as localTime, plus or minus
uncertainty seconds. Improves our current notion of the time
delta accord... | resynchronize(self, float localTime, int32 networkTime,
float newUncertainty) | [
"resynchronize",
"(",
"self",
"float",
"localTime",
"int32",
"networkTime",
"float",
"newUncertainty",
")"
] | def resynchronize(self, localTime, networkTime, newUncertainty,
trustNew = 1):
"""resynchronize(self, float localTime, int32 networkTime,
float newUncertainty)
Accepts a new networkTime value, which is understood to
represent the same moment as loc... | [
"def",
"resynchronize",
"(",
"self",
",",
"localTime",
",",
"networkTime",
",",
"newUncertainty",
",",
"trustNew",
"=",
"1",
")",
":",
"newDelta",
"=",
"(",
"float",
"(",
"localTime",
")",
"-",
"(",
"float",
"(",
"networkTime",
")",
"/",
"NetworkTimePrecis... | https://github.com/panda3d/panda3d/blob/833ad89ebad58395d0af0b7ec08538e5e4308265/direct/src/distributed/ClockDelta.py#L112-L125 | ||
krishauser/Klampt | 972cc83ea5befac3f653c1ba20f80155768ad519 | Python/python2_version/klampt/robotsim.py | python | RobotModelDriver.getAffectedLink | (self) | return _robotsim.RobotModelDriver_getAffectedLink(self) | getAffectedLink(RobotModelDriver self) -> int
Returns the single affected link for "normal" links. | getAffectedLink(RobotModelDriver self) -> int | [
"getAffectedLink",
"(",
"RobotModelDriver",
"self",
")",
"-",
">",
"int"
] | def getAffectedLink(self):
"""
getAffectedLink(RobotModelDriver self) -> int
Returns the single affected link for "normal" links.
"""
return _robotsim.RobotModelDriver_getAffectedLink(self) | [
"def",
"getAffectedLink",
"(",
"self",
")",
":",
"return",
"_robotsim",
".",
"RobotModelDriver_getAffectedLink",
"(",
"self",
")"
] | https://github.com/krishauser/Klampt/blob/972cc83ea5befac3f653c1ba20f80155768ad519/Python/python2_version/klampt/robotsim.py#L4338-L4347 | |
hanpfei/chromium-net | 392cc1fa3a8f92f42e4071ab6e674d8e0482f83f | third_party/protobuf/third_party/six/six.py | python | _import_module | (name) | return sys.modules[name] | Import module, returning the module after the last dot. | Import module, returning the module after the last dot. | [
"Import",
"module",
"returning",
"the",
"module",
"after",
"the",
"last",
"dot",
"."
] | def _import_module(name):
"""Import module, returning the module after the last dot."""
__import__(name)
return sys.modules[name] | [
"def",
"_import_module",
"(",
"name",
")",
":",
"__import__",
"(",
"name",
")",
"return",
"sys",
".",
"modules",
"[",
"name",
"]"
] | https://github.com/hanpfei/chromium-net/blob/392cc1fa3a8f92f42e4071ab6e674d8e0482f83f/third_party/protobuf/third_party/six/six.py#L80-L83 | |
wxWidgets/wxPython-Classic | 19571e1ae65f1ac445f5491474121998c97a1bf0 | src/osx_cocoa/_misc.py | python | Clipboard.IsSupported | (*args, **kwargs) | return _misc_.Clipboard_IsSupported(*args, **kwargs) | IsSupported(self, DataFormat format) -> bool
Returns True if the given format is available in the data object(s) on
the clipboard. | IsSupported(self, DataFormat format) -> bool | [
"IsSupported",
"(",
"self",
"DataFormat",
"format",
")",
"-",
">",
"bool"
] | def IsSupported(*args, **kwargs):
"""
IsSupported(self, DataFormat format) -> bool
Returns True if the given format is available in the data object(s) on
the clipboard.
"""
return _misc_.Clipboard_IsSupported(*args, **kwargs) | [
"def",
"IsSupported",
"(",
"*",
"args",
",",
"*",
"*",
"kwargs",
")",
":",
"return",
"_misc_",
".",
"Clipboard_IsSupported",
"(",
"*",
"args",
",",
"*",
"*",
"kwargs",
")"
] | https://github.com/wxWidgets/wxPython-Classic/blob/19571e1ae65f1ac445f5491474121998c97a1bf0/src/osx_cocoa/_misc.py#L5843-L5850 | |
linyouhappy/kongkongxiyou | 7a69b2913eb29f4be77f9a62fb90cdd72c4160f1 | cocosjs/frameworks/cocos2d-x/tools/bindings-generator/generator.py | python | NativeClass._is_ref_class | (self, depth = 0) | return False | Mark the class as 'cocos2d::Ref' or its subclass. | Mark the class as 'cocos2d::Ref' or its subclass. | [
"Mark",
"the",
"class",
"as",
"cocos2d",
"::",
"Ref",
"or",
"its",
"subclass",
"."
] | def _is_ref_class(self, depth = 0):
"""
Mark the class as 'cocos2d::Ref' or its subclass.
"""
# print ">" * (depth + 1) + " " + self.class_name
for parent in self.parents:
if parent._is_ref_class(depth + 1):
return True
if self.is_ref_class:
... | [
"def",
"_is_ref_class",
"(",
"self",
",",
"depth",
"=",
"0",
")",
":",
"# print \">\" * (depth + 1) + \" \" + self.class_name",
"for",
"parent",
"in",
"self",
".",
"parents",
":",
"if",
"parent",
".",
"_is_ref_class",
"(",
"depth",
"+",
"1",
")",
":",
"return"... | https://github.com/linyouhappy/kongkongxiyou/blob/7a69b2913eb29f4be77f9a62fb90cdd72c4160f1/cocosjs/frameworks/cocos2d-x/tools/bindings-generator/generator.py#L856-L869 | |
wlanjie/AndroidFFmpeg | 7baf9122f4b8e1c74e7baf4be5c422c7a5ba5aaf | tools/fdk-aac-build/x86/toolchain/lib/python2.7/lib-tk/Tkinter.py | python | Misc.winfo_rgb | (self, color) | return self._getints(
self.tk.call('winfo', 'rgb', self._w, color)) | Return tuple of decimal values for red, green, blue for
COLOR in this widget. | Return tuple of decimal values for red, green, blue for
COLOR in this widget. | [
"Return",
"tuple",
"of",
"decimal",
"values",
"for",
"red",
"green",
"blue",
"for",
"COLOR",
"in",
"this",
"widget",
"."
] | def winfo_rgb(self, color):
"""Return tuple of decimal values for red, green, blue for
COLOR in this widget."""
return self._getints(
self.tk.call('winfo', 'rgb', self._w, color)) | [
"def",
"winfo_rgb",
"(",
"self",
",",
"color",
")",
":",
"return",
"self",
".",
"_getints",
"(",
"self",
".",
"tk",
".",
"call",
"(",
"'winfo'",
",",
"'rgb'",
",",
"self",
".",
"_w",
",",
"color",
")",
")"
] | https://github.com/wlanjie/AndroidFFmpeg/blob/7baf9122f4b8e1c74e7baf4be5c422c7a5ba5aaf/tools/fdk-aac-build/x86/toolchain/lib/python2.7/lib-tk/Tkinter.py#L833-L837 | |
microsoft/EdgeML | ef9f8a77f096acbdeb941014791f8eda1c1bc35b | tf/edgeml_tf/trainer/bonsaiTrainer.py | python | BonsaiTrainer.loadModel | (self, currDir) | return paramDict, hyperParamDict | Load the Saved model and load it to the model using constructor
Returns two dict one for params and other for hyperParams | Load the Saved model and load it to the model using constructor
Returns two dict one for params and other for hyperParams | [
"Load",
"the",
"Saved",
"model",
"and",
"load",
"it",
"to",
"the",
"model",
"using",
"constructor",
"Returns",
"two",
"dict",
"one",
"for",
"params",
"and",
"other",
"for",
"hyperParams"
] | def loadModel(self, currDir):
'''
Load the Saved model and load it to the model using constructor
Returns two dict one for params and other for hyperParams
'''
paramDir = currDir + '/'
paramDict = {}
paramDict['W'] = np.load(paramDir + "W.npy")
paramDict['... | [
"def",
"loadModel",
"(",
"self",
",",
"currDir",
")",
":",
"paramDir",
"=",
"currDir",
"+",
"'/'",
"paramDict",
"=",
"{",
"}",
"paramDict",
"[",
"'W'",
"]",
"=",
"np",
".",
"load",
"(",
"paramDir",
"+",
"\"W.npy\"",
")",
"paramDict",
"[",
"'V'",
"]",... | https://github.com/microsoft/EdgeML/blob/ef9f8a77f096acbdeb941014791f8eda1c1bc35b/tf/edgeml_tf/trainer/bonsaiTrainer.py#L274-L286 | |
pyne/pyne | 0c2714d7c0d1b5e20be6ae6527da2c660dd6b1b3 | pyne/alara.py | python | _get_zone_idx | (line) | return int(last_word.split('_')[-1]) | This function is used to get the zone idx from a line of ALARA output.txt.
Parameters
----------
line : string
A line from ALARA output.txt
Returns
-------
int, zone index | This function is used to get the zone idx from a line of ALARA output.txt. | [
"This",
"function",
"is",
"used",
"to",
"get",
"the",
"zone",
"idx",
"from",
"a",
"line",
"of",
"ALARA",
"output",
".",
"txt",
"."
] | def _get_zone_idx(line):
"""
This function is used to get the zone idx from a line of ALARA output.txt.
Parameters
----------
line : string
A line from ALARA output.txt
Returns
-------
int, zone index
"""
last_word = line.strip().split()[-1]
return int(last_wor... | [
"def",
"_get_zone_idx",
"(",
"line",
")",
":",
"last_word",
"=",
"line",
".",
"strip",
"(",
")",
".",
"split",
"(",
")",
"[",
"-",
"1",
"]",
"return",
"int",
"(",
"last_word",
".",
"split",
"(",
"'_'",
")",
"[",
"-",
"1",
"]",
")"
] | https://github.com/pyne/pyne/blob/0c2714d7c0d1b5e20be6ae6527da2c660dd6b1b3/pyne/alara.py#L1216-L1231 | |
catboost/catboost | 167f64f237114a4d10b2b4ee42adb4569137debe | contrib/tools/python3/src/Lib/locale.py | python | resetlocale | (category=LC_ALL) | Sets the locale for category to the default setting.
The default setting is determined by calling
getdefaultlocale(). category defaults to LC_ALL. | Sets the locale for category to the default setting. | [
"Sets",
"the",
"locale",
"for",
"category",
"to",
"the",
"default",
"setting",
"."
] | def resetlocale(category=LC_ALL):
""" Sets the locale for category to the default setting.
The default setting is determined by calling
getdefaultlocale(). category defaults to LC_ALL.
"""
_setlocale(category, _build_localename(getdefaultlocale())) | [
"def",
"resetlocale",
"(",
"category",
"=",
"LC_ALL",
")",
":",
"_setlocale",
"(",
"category",
",",
"_build_localename",
"(",
"getdefaultlocale",
"(",
")",
")",
")"
] | https://github.com/catboost/catboost/blob/167f64f237114a4d10b2b4ee42adb4569137debe/contrib/tools/python3/src/Lib/locale.py#L612-L620 | ||
hanpfei/chromium-net | 392cc1fa3a8f92f42e4071ab6e674d8e0482f83f | third_party/catapult/third_party/gsutil/third_party/boto/boto/awslambda/layer1.py | python | AWSLambdaConnection.upload_function | (self, function_name, function_zip, runtime, role,
handler, mode, description=None, timeout=None,
memory_size=None) | return self.make_request('PUT', uri, expected_status=201,
data=function_zip, headers=headers,
params=query_params) | Creates a new Lambda function or updates an existing function.
The function metadata is created from the request parameters,
and the code for the function is provided by a .zip file in
the request body. If the function name already exists, the
existing Lambda function is updated with the... | Creates a new Lambda function or updates an existing function.
The function metadata is created from the request parameters,
and the code for the function is provided by a .zip file in
the request body. If the function name already exists, the
existing Lambda function is updated with the... | [
"Creates",
"a",
"new",
"Lambda",
"function",
"or",
"updates",
"an",
"existing",
"function",
".",
"The",
"function",
"metadata",
"is",
"created",
"from",
"the",
"request",
"parameters",
"and",
"the",
"code",
"for",
"the",
"function",
"is",
"provided",
"by",
"... | def upload_function(self, function_name, function_zip, runtime, role,
handler, mode, description=None, timeout=None,
memory_size=None):
"""
Creates a new Lambda function or updates an existing function.
The function metadata is created from the req... | [
"def",
"upload_function",
"(",
"self",
",",
"function_name",
",",
"function_zip",
",",
"runtime",
",",
"role",
",",
"handler",
",",
"mode",
",",
"description",
"=",
"None",
",",
"timeout",
"=",
"None",
",",
"memory_size",
"=",
"None",
")",
":",
"uri",
"=... | https://github.com/hanpfei/chromium-net/blob/392cc1fa3a8f92f42e4071ab6e674d8e0482f83f/third_party/catapult/third_party/gsutil/third_party/boto/boto/awslambda/layer1.py#L405-L501 | |
wxWidgets/wxPython-Classic | 19571e1ae65f1ac445f5491474121998c97a1bf0 | src/osx_cocoa/propgrid.py | python | PyArrayStringProperty.__init__ | (self, *args, **kwargs) | __init__(self, String label=(*wxPGProperty::sm_wxPG_LABEL), String name=(*wxPGProperty::sm_wxPG_LABEL),
wxArrayString value=wxArrayString()) -> PyArrayStringProperty | __init__(self, String label=(*wxPGProperty::sm_wxPG_LABEL), String name=(*wxPGProperty::sm_wxPG_LABEL),
wxArrayString value=wxArrayString()) -> PyArrayStringProperty | [
"__init__",
"(",
"self",
"String",
"label",
"=",
"(",
"*",
"wxPGProperty",
"::",
"sm_wxPG_LABEL",
")",
"String",
"name",
"=",
"(",
"*",
"wxPGProperty",
"::",
"sm_wxPG_LABEL",
")",
"wxArrayString",
"value",
"=",
"wxArrayString",
"()",
")",
"-",
">",
"PyArrayS... | def __init__(self, *args, **kwargs):
"""
__init__(self, String label=(*wxPGProperty::sm_wxPG_LABEL), String name=(*wxPGProperty::sm_wxPG_LABEL),
wxArrayString value=wxArrayString()) -> PyArrayStringProperty
"""
_propgrid.PyArrayStringProperty_swiginit(self,_propgrid.new_PyA... | [
"def",
"__init__",
"(",
"self",
",",
"*",
"args",
",",
"*",
"*",
"kwargs",
")",
":",
"_propgrid",
".",
"PyArrayStringProperty_swiginit",
"(",
"self",
",",
"_propgrid",
".",
"new_PyArrayStringProperty",
"(",
"*",
"args",
",",
"*",
"*",
"kwargs",
")",
")",
... | https://github.com/wxWidgets/wxPython-Classic/blob/19571e1ae65f1ac445f5491474121998c97a1bf0/src/osx_cocoa/propgrid.py#L3914-L3920 | ||
PaddlePaddle/Paddle | 1252f4bb3e574df80aa6d18c7ddae1b3a90bd81c | python/paddle/fluid/dygraph/dygraph_to_static/program_translator.py | python | ConcreteProgram.from_func_spec | (func_spec, input_spec, input_kwargs_spec, class_instance,
**kwargs) | return ConcreteProgram(
inputs=inputs,
outputs=outputs,
parameters=all_parameters_and_buffers,
function=dygraph_function,
main_program=main_program,
startup_program=startup_program,
**kwargs) | Builds the main_program with specialized inputs and returns outputs
of program as fetch_list.
Args:
func_spec(FunctionSpec): A FunctionSpec instance for decorated function.
input_spec(list[InputSpec]): | Builds the main_program with specialized inputs and returns outputs
of program as fetch_list. | [
"Builds",
"the",
"main_program",
"with",
"specialized",
"inputs",
"and",
"returns",
"outputs",
"of",
"program",
"as",
"fetch_list",
"."
] | def from_func_spec(func_spec, input_spec, input_kwargs_spec, class_instance,
**kwargs):
"""
Builds the main_program with specialized inputs and returns outputs
of program as fetch_list.
Args:
func_spec(FunctionSpec): A FunctionSpec instance for decorat... | [
"def",
"from_func_spec",
"(",
"func_spec",
",",
"input_spec",
",",
"input_kwargs_spec",
",",
"class_instance",
",",
"*",
"*",
"kwargs",
")",
":",
"# verify the instance is initialized in imperative mode.",
"_verify_init_in_dynamic_mode",
"(",
"class_instance",
")",
"# Trans... | https://github.com/PaddlePaddle/Paddle/blob/1252f4bb3e574df80aa6d18c7ddae1b3a90bd81c/python/paddle/fluid/dygraph/dygraph_to_static/program_translator.py#L616-L688 | |
kamyu104/LeetCode-Solutions | 77605708a927ea3b85aee5a479db733938c7c211 | Python/binary-tree-postorder-traversal.py | python | Solution2.postorderTraversal | (self, root) | return result | :type root: TreeNode
:rtype: List[int] | :type root: TreeNode
:rtype: List[int] | [
":",
"type",
"root",
":",
"TreeNode",
":",
"rtype",
":",
"List",
"[",
"int",
"]"
] | def postorderTraversal(self, root):
"""
:type root: TreeNode
:rtype: List[int]
"""
result, stack = [], [(root, False)]
while stack:
root, is_visited = stack.pop()
if root is None:
continue
if is_visited:
... | [
"def",
"postorderTraversal",
"(",
"self",
",",
"root",
")",
":",
"result",
",",
"stack",
"=",
"[",
"]",
",",
"[",
"(",
"root",
",",
"False",
")",
"]",
"while",
"stack",
":",
"root",
",",
"is_visited",
"=",
"stack",
".",
"pop",
"(",
")",
"if",
"ro... | https://github.com/kamyu104/LeetCode-Solutions/blob/77605708a927ea3b85aee5a479db733938c7c211/Python/binary-tree-postorder-traversal.py#L53-L69 | |
wxWidgets/wxPython-Classic | 19571e1ae65f1ac445f5491474121998c97a1bf0 | src/osx_cocoa/richtext.py | python | RichTextBuffer_FindHandlerByType | (*args, **kwargs) | return _richtext.RichTextBuffer_FindHandlerByType(*args, **kwargs) | RichTextBuffer_FindHandlerByType(int imageType) -> RichTextFileHandler | RichTextBuffer_FindHandlerByType(int imageType) -> RichTextFileHandler | [
"RichTextBuffer_FindHandlerByType",
"(",
"int",
"imageType",
")",
"-",
">",
"RichTextFileHandler"
] | def RichTextBuffer_FindHandlerByType(*args, **kwargs):
"""RichTextBuffer_FindHandlerByType(int imageType) -> RichTextFileHandler"""
return _richtext.RichTextBuffer_FindHandlerByType(*args, **kwargs) | [
"def",
"RichTextBuffer_FindHandlerByType",
"(",
"*",
"args",
",",
"*",
"*",
"kwargs",
")",
":",
"return",
"_richtext",
".",
"RichTextBuffer_FindHandlerByType",
"(",
"*",
"args",
",",
"*",
"*",
"kwargs",
")"
] | https://github.com/wxWidgets/wxPython-Classic/blob/19571e1ae65f1ac445f5491474121998c97a1bf0/src/osx_cocoa/richtext.py#L2683-L2685 | |
espressomd/espresso | 7e29f9052e710fe1ebf0f5d2a8076b32921fbc6a | src/python/espressomd/drude_helpers.py | python | DrudeHelpers.add_intramol_exclusion_bonds | (
self, drude_parts, core_parts, verbose=False) | Applies electrostatic short-range exclusion bonds for the given ids.
Has to be applied for all molecules.
Parameters
----------
system : :class:`espressomd.system.System`
drude_parts :
List of Drude particles within a molecule.
core_parts :
List ... | Applies electrostatic short-range exclusion bonds for the given ids.
Has to be applied for all molecules. | [
"Applies",
"electrostatic",
"short",
"-",
"range",
"exclusion",
"bonds",
"for",
"the",
"given",
"ids",
".",
"Has",
"to",
"be",
"applied",
"for",
"all",
"molecules",
"."
] | def add_intramol_exclusion_bonds(
self, drude_parts, core_parts, verbose=False):
"""
Applies electrostatic short-range exclusion bonds for the given ids.
Has to be applied for all molecules.
Parameters
----------
system : :class:`espressomd.system.System`
... | [
"def",
"add_intramol_exclusion_bonds",
"(",
"self",
",",
"drude_parts",
",",
"core_parts",
",",
"verbose",
"=",
"False",
")",
":",
"for",
"drude_part",
"in",
"drude_parts",
":",
"drude_id",
"=",
"drude_part",
".",
"id",
"for",
"core_part",
"in",
"core_parts",
... | https://github.com/espressomd/espresso/blob/7e29f9052e710fe1ebf0f5d2a8076b32921fbc6a/src/python/espressomd/drude_helpers.py#L283-L314 | ||
wxWidgets/wxPython-Classic | 19571e1ae65f1ac445f5491474121998c97a1bf0 | src/msw/stc.py | python | StyledTextCtrl.ClearAll | (*args, **kwargs) | return _stc.StyledTextCtrl_ClearAll(*args, **kwargs) | ClearAll(self)
Delete all text in the document. | ClearAll(self) | [
"ClearAll",
"(",
"self",
")"
] | def ClearAll(*args, **kwargs):
"""
ClearAll(self)
Delete all text in the document.
"""
return _stc.StyledTextCtrl_ClearAll(*args, **kwargs) | [
"def",
"ClearAll",
"(",
"*",
"args",
",",
"*",
"*",
"kwargs",
")",
":",
"return",
"_stc",
".",
"StyledTextCtrl_ClearAll",
"(",
"*",
"args",
",",
"*",
"*",
"kwargs",
")"
] | https://github.com/wxWidgets/wxPython-Classic/blob/19571e1ae65f1ac445f5491474121998c97a1bf0/src/msw/stc.py#L2059-L2065 | |
baidu/bigflow | 449245016c0df7d1252e85581e588bfc60cefad3 | bigflow_python/python/bigflow/ptable.py | python | PTable.inner_most_type | (self) | return self.__inner_most_value().__class__ | 返回其最内部Value的类型
Returns:
class: 最内部Value类型,PCollection或PObject
>>> _pipeline.parallelize({"A": 1}).inner_most_type()
>>> bigflow.pcollection.PCollection | 返回其最内部Value的类型 | [
"返回其最内部Value的类型"
] | def inner_most_type(self):
"""
返回其最内部Value的类型
Returns:
class: 最内部Value类型,PCollection或PObject
>>> _pipeline.parallelize({"A": 1}).inner_most_type()
>>> bigflow.pcollection.PCollection
"""
return self.__inner_most_value().__class__ | [
"def",
"inner_most_type",
"(",
"self",
")",
":",
"return",
"self",
".",
"__inner_most_value",
"(",
")",
".",
"__class__"
] | https://github.com/baidu/bigflow/blob/449245016c0df7d1252e85581e588bfc60cefad3/bigflow_python/python/bigflow/ptable.py#L148-L158 | |
Slicer/Slicer | ba9fadf332cb0303515b68d8d06a344c82e3e3e5 | Base/Python/slicer/ScriptedLoadableModule.py | python | ScriptedLoadableModuleWidget.onReload | (self) | Reload scripted module widget representation. | Reload scripted module widget representation. | [
"Reload",
"scripted",
"module",
"widget",
"representation",
"."
] | def onReload(self):
"""
Reload scripted module widget representation.
"""
# Print a clearly visible separator to make it easier
# to distinguish new error messages (during/after reload)
# from old ones.
print('\n' * 2)
print('-' * 30)
print('Reloading module: '+self.moduleName)
... | [
"def",
"onReload",
"(",
"self",
")",
":",
"# Print a clearly visible separator to make it easier",
"# to distinguish new error messages (during/after reload)",
"# from old ones.",
"print",
"(",
"'\\n'",
"*",
"2",
")",
"print",
"(",
"'-'",
"*",
"30",
")",
"print",
"(",
"... | https://github.com/Slicer/Slicer/blob/ba9fadf332cb0303515b68d8d06a344c82e3e3e5/Base/Python/slicer/ScriptedLoadableModule.py#L183-L197 | ||
macchina-io/macchina.io | ef24ba0e18379c3dd48fb84e6dbf991101cb8db0 | platform/JS/V8/v8/third_party/jinja2/compiler.py | python | Identifiers.add_special | (self, name) | Register a special name like `loop`. | Register a special name like `loop`. | [
"Register",
"a",
"special",
"name",
"like",
"loop",
"."
] | def add_special(self, name):
"""Register a special name like `loop`."""
self.undeclared.discard(name)
self.declared.add(name) | [
"def",
"add_special",
"(",
"self",
",",
"name",
")",
":",
"self",
".",
"undeclared",
".",
"discard",
"(",
"name",
")",
"self",
".",
"declared",
".",
"add",
"(",
"name",
")"
] | https://github.com/macchina-io/macchina.io/blob/ef24ba0e18379c3dd48fb84e6dbf991101cb8db0/platform/JS/V8/v8/third_party/jinja2/compiler.py#L124-L127 | ||
FreeCAD/FreeCAD | ba42231b9c6889b89e064d6d563448ed81e376ec | src/Mod/Path/PathScripts/PathSlot.py | python | ObjectSlot._getHighestPoint | (self, shape_1) | _getHighestPoint(shape)... Returns highest vertex of shape as vector. | _getHighestPoint(shape)... Returns highest vertex of shape as vector. | [
"_getHighestPoint",
"(",
"shape",
")",
"...",
"Returns",
"highest",
"vertex",
"of",
"shape",
"as",
"vector",
"."
] | def _getHighestPoint(self, shape_1):
"""_getHighestPoint(shape)... Returns highest vertex of shape as vector."""
# find highest vertex
vMax = shape_1.Vertexes[0]
zmax = vMax.Z
same = [vMax]
for V in shape_1.Vertexes:
if V.Z > zmax:
zmax = V.Z
... | [
"def",
"_getHighestPoint",
"(",
"self",
",",
"shape_1",
")",
":",
"# find highest vertex",
"vMax",
"=",
"shape_1",
".",
"Vertexes",
"[",
"0",
"]",
"zmax",
"=",
"vMax",
".",
"Z",
"same",
"=",
"[",
"vMax",
"]",
"for",
"V",
"in",
"shape_1",
".",
"Vertexes... | https://github.com/FreeCAD/FreeCAD/blob/ba42231b9c6889b89e064d6d563448ed81e376ec/src/Mod/Path/PathScripts/PathSlot.py#L1144-L1163 | ||
ChromiumWebApps/chromium | c7361d39be8abd1574e6ce8957c8dbddd4c6ccf7 | ppapi/generators/idl_lexer.py | python | IDLLexer.t_COMMENT | (self, t) | return t | r'(/\*(.|\n)*?\*/)|(//.*(\n[ \t]*//.*)*) | r'(/\*(.|\n)*?\*/)|(//.*(\n[ \t]*//.*)*) | [
"r",
"(",
"/",
"\\",
"*",
"(",
".",
"|",
"\\",
"n",
")",
"*",
"?",
"\\",
"*",
"/",
")",
"|",
"(",
"//",
".",
"*",
"(",
"\\",
"n",
"[",
"\\",
"t",
"]",
"*",
"//",
".",
"*",
")",
"*",
")"
] | def t_COMMENT(self, t):
r'(/\*(.|\n)*?\*/)|(//.*(\n[ \t]*//.*)*)'
self.AddLines(t.value.count('\n'))
return t | [
"def",
"t_COMMENT",
"(",
"self",
",",
"t",
")",
":",
"self",
".",
"AddLines",
"(",
"t",
".",
"value",
".",
"count",
"(",
"'\\n'",
")",
")",
"return",
"t"
] | https://github.com/ChromiumWebApps/chromium/blob/c7361d39be8abd1574e6ce8957c8dbddd4c6ccf7/ppapi/generators/idl_lexer.py#L133-L136 | |
gem5/gem5 | 141cc37c2d4b93959d4c249b8f7e6a8b2ef75338 | src/arch/isa_parser/isa_parser.py | python | ISAParser.p_opt_signed_0 | (self, t) | opt_signed : SIGNED | opt_signed : SIGNED | [
"opt_signed",
":",
"SIGNED"
] | def p_opt_signed_0(self, t):
'opt_signed : SIGNED'
t[0] = t[1] | [
"def",
"p_opt_signed_0",
"(",
"self",
",",
"t",
")",
":",
"t",
"[",
"0",
"]",
"=",
"t",
"[",
"1",
"]"
] | https://github.com/gem5/gem5/blob/141cc37c2d4b93959d4c249b8f7e6a8b2ef75338/src/arch/isa_parser/isa_parser.py#L1067-L1069 | ||
Xilinx/Vitis-AI | fc74d404563d9951b57245443c73bef389f3657f | tools/Vitis-AI-Quantizer/vai_q_tensorflow1.x/tensorflow/python/training/tracking/graph_view.py | python | ObjectGraphView._serialize_gathered_objects | (self, trackable_objects, path_to_root,
object_map=None) | return named_saveable_objects, object_graph_proto, feed_additions | Create SaveableObjects and protos for gathered objects. | Create SaveableObjects and protos for gathered objects. | [
"Create",
"SaveableObjects",
"and",
"protos",
"for",
"gathered",
"objects",
"."
] | def _serialize_gathered_objects(self, trackable_objects, path_to_root,
object_map=None):
"""Create SaveableObjects and protos for gathered objects."""
object_names = object_identity.ObjectIdentityDictionary()
for obj, path in path_to_root.items():
object_names[obj] = ... | [
"def",
"_serialize_gathered_objects",
"(",
"self",
",",
"trackable_objects",
",",
"path_to_root",
",",
"object_map",
"=",
"None",
")",
":",
"object_names",
"=",
"object_identity",
".",
"ObjectIdentityDictionary",
"(",
")",
"for",
"obj",
",",
"path",
"in",
"path_to... | https://github.com/Xilinx/Vitis-AI/blob/fc74d404563d9951b57245443c73bef389f3657f/tools/Vitis-AI-Quantizer/vai_q_tensorflow1.x/tensorflow/python/training/tracking/graph_view.py#L332-L356 | |
kushview/Element | 1cc16380caa2ab79461246ba758b9de1f46db2a5 | waflib/Tools/ccroot.py | python | create_compiled_task | (self, name, node) | return task | Create the compilation task: c, cxx, asm, etc. The output node is created automatically (object file with a typical **.o** extension).
The task is appended to the list *compiled_tasks* which is then used by :py:func:`waflib.Tools.ccroot.apply_link`
:param name: name of the task class
:type name: string
:param node... | Create the compilation task: c, cxx, asm, etc. The output node is created automatically (object file with a typical **.o** extension).
The task is appended to the list *compiled_tasks* which is then used by :py:func:`waflib.Tools.ccroot.apply_link` | [
"Create",
"the",
"compilation",
"task",
":",
"c",
"cxx",
"asm",
"etc",
".",
"The",
"output",
"node",
"is",
"created",
"automatically",
"(",
"object",
"file",
"with",
"a",
"typical",
"**",
".",
"o",
"**",
"extension",
")",
".",
"The",
"task",
"is",
"app... | def create_compiled_task(self, name, node):
"""
Create the compilation task: c, cxx, asm, etc. The output node is created automatically (object file with a typical **.o** extension).
The task is appended to the list *compiled_tasks* which is then used by :py:func:`waflib.Tools.ccroot.apply_link`
:param name: name ... | [
"def",
"create_compiled_task",
"(",
"self",
",",
"name",
",",
"node",
")",
":",
"out",
"=",
"'%s.%d.o'",
"%",
"(",
"node",
".",
"name",
",",
"self",
".",
"idx",
")",
"task",
"=",
"self",
".",
"create_task",
"(",
"name",
",",
"node",
",",
"node",
".... | https://github.com/kushview/Element/blob/1cc16380caa2ab79461246ba758b9de1f46db2a5/waflib/Tools/ccroot.py#L41-L59 | |
apache/incubator-mxnet | f03fb23f1d103fec9541b5ae59ee06b1734a51d9 | python/mxnet/symbol/numpy/_symbol.py | python | vstack | (arrays, out=None) | return _npi.vstack(*arrays) | r"""Stack arrays in sequence vertically (row wise).
This is equivalent to concatenation along the first axis after 1-D arrays
of shape `(N,)` have been reshaped to `(1,N)`. Rebuilds arrays divided by
`vsplit`.
This function makes most sense for arrays with up to 3 dimensions. For
instance, for pix... | r"""Stack arrays in sequence vertically (row wise). | [
"r",
"Stack",
"arrays",
"in",
"sequence",
"vertically",
"(",
"row",
"wise",
")",
"."
] | def vstack(arrays, out=None):
r"""Stack arrays in sequence vertically (row wise).
This is equivalent to concatenation along the first axis after 1-D arrays
of shape `(N,)` have been reshaped to `(1,N)`. Rebuilds arrays divided by
`vsplit`.
This function makes most sense for arrays with up to 3 dim... | [
"def",
"vstack",
"(",
"arrays",
",",
"out",
"=",
"None",
")",
":",
"def",
"get_list",
"(",
"arrays",
")",
":",
"if",
"not",
"hasattr",
"(",
"arrays",
",",
"'__getitem__'",
")",
"and",
"hasattr",
"(",
"arrays",
",",
"'__iter__'",
")",
":",
"raise",
"V... | https://github.com/apache/incubator-mxnet/blob/f03fb23f1d103fec9541b5ae59ee06b1734a51d9/python/mxnet/symbol/numpy/_symbol.py#L4353-L4381 | |
glotzerlab/hoomd-blue | f7f97abfa3fcc2522fa8d458d65d0aeca7ba781a | hoomd/mpcd/stream.py | python | _streaming_method.disable | (self) | Disable the streaming method
Examples::
method.disable()
Disabling the streaming method removes it from the current MPCD system definition.
Only one streaming method can be attached to the system at any time, so
use this method to remove the current streaming method before... | Disable the streaming method | [
"Disable",
"the",
"streaming",
"method"
] | def disable(self):
""" Disable the streaming method
Examples::
method.disable()
Disabling the streaming method removes it from the current MPCD system definition.
Only one streaming method can be attached to the system at any time, so
use this method to remove the ... | [
"def",
"disable",
"(",
"self",
")",
":",
"self",
".",
"enabled",
"=",
"False",
"hoomd",
".",
"context",
".",
"current",
".",
"mpcd",
".",
"_stream",
"=",
"None"
] | https://github.com/glotzerlab/hoomd-blue/blob/f7f97abfa3fcc2522fa8d458d65d0aeca7ba781a/hoomd/mpcd/stream.py#L114-L128 | ||
sccn/lsl_archived | 2ff44b7a5172b02fe845b1fc72b9ab5578a489ed | Apps/neuroPrax/lsl_server.py | python | ProtocolHandler.flush_protocol | (self) | reads and ignores each byte until the end of current protocol block | reads and ignores each byte until the end of current protocol block | [
"reads",
"and",
"ignores",
"each",
"byte",
"until",
"the",
"end",
"of",
"current",
"protocol",
"block"
] | def flush_protocol(self):
'reads and ignores each byte until the end of current protocol block'
msg = ''
while msg[-4:] != 'end$':
msg += self.recv_bytes(1).decode('ASCII', errors='replace')
print(f'Flushed protocol from {msg[:4]} to {msg[-4:]}') | [
"def",
"flush_protocol",
"(",
"self",
")",
":",
"msg",
"=",
"''",
"while",
"msg",
"[",
"-",
"4",
":",
"]",
"!=",
"'end$'",
":",
"msg",
"+=",
"self",
".",
"recv_bytes",
"(",
"1",
")",
".",
"decode",
"(",
"'ASCII'",
",",
"errors",
"=",
"'replace'",
... | https://github.com/sccn/lsl_archived/blob/2ff44b7a5172b02fe845b1fc72b9ab5578a489ed/Apps/neuroPrax/lsl_server.py#L97-L102 | ||
stan-dev/math | 5fd79f89933269a4ca4d8dd1fde2a36d53d4768c | lib/boost_1.75.0/tools/build/src/util/path.py | python | root | (path, root) | If 'path' is relative, it is rooted at 'root'. Otherwise, it's unchanged. | If 'path' is relative, it is rooted at 'root'. Otherwise, it's unchanged. | [
"If",
"path",
"is",
"relative",
"it",
"is",
"rooted",
"at",
"root",
".",
"Otherwise",
"it",
"s",
"unchanged",
"."
] | def root (path, root):
""" If 'path' is relative, it is rooted at 'root'. Otherwise, it's unchanged.
"""
if os.path.isabs (path):
return path
else:
return os.path.join (root, path) | [
"def",
"root",
"(",
"path",
",",
"root",
")",
":",
"if",
"os",
".",
"path",
".",
"isabs",
"(",
"path",
")",
":",
"return",
"path",
"else",
":",
"return",
"os",
".",
"path",
".",
"join",
"(",
"root",
",",
"path",
")"
] | https://github.com/stan-dev/math/blob/5fd79f89933269a4ca4d8dd1fde2a36d53d4768c/lib/boost_1.75.0/tools/build/src/util/path.py#L28-L34 | ||
supercollider/supercollider | 42715a73ce2de4720174583e9b66a4510fe289a3 | tools/clang-format.py | python | Repo._callgit | (self, args, stdout=None) | return subprocess.call(['git', '--git-dir', os.path.join(self.path, ".git"),
'--work-tree', self.path] + args, stdout=stdout) | Call git for this repository without capturing output
This is designed to be used when git returns non-zero exit codes. | Call git for this repository without capturing output
This is designed to be used when git returns non-zero exit codes. | [
"Call",
"git",
"for",
"this",
"repository",
"without",
"capturing",
"output",
"This",
"is",
"designed",
"to",
"be",
"used",
"when",
"git",
"returns",
"non",
"-",
"zero",
"exit",
"codes",
"."
] | def _callgit(self, args, stdout=None):
"""Call git for this repository without capturing output
This is designed to be used when git returns non-zero exit codes.
"""
# These two flags are the equivalent of -C in newer versions of Git
# but we use these to support versions pre 1.8... | [
"def",
"_callgit",
"(",
"self",
",",
"args",
",",
"stdout",
"=",
"None",
")",
":",
"# These two flags are the equivalent of -C in newer versions of Git",
"# but we use these to support versions pre 1.8.5 but it depends on the command",
"# and what the current directory is",
"return",
... | https://github.com/supercollider/supercollider/blob/42715a73ce2de4720174583e9b66a4510fe289a3/tools/clang-format.py#L182-L190 | |
FreeCAD/FreeCAD | ba42231b9c6889b89e064d6d563448ed81e376ec | src/Gui/FreeCADGuiInit.py | python | Workbench.GetClassName | (self) | return "Gui::PythonWorkbench" | Return the name of the associated C++ class. | Return the name of the associated C++ class. | [
"Return",
"the",
"name",
"of",
"the",
"associated",
"C",
"++",
"class",
"."
] | def GetClassName(self):
"""Return the name of the associated C++ class."""
# as default use this to simplify writing workbenches in Python
return "Gui::PythonWorkbench" | [
"def",
"GetClassName",
"(",
"self",
")",
":",
"# as default use this to simplify writing workbenches in Python",
"return",
"\"Gui::PythonWorkbench\""
] | https://github.com/FreeCAD/FreeCAD/blob/ba42231b9c6889b89e064d6d563448ed81e376ec/src/Gui/FreeCADGuiInit.py#L78-L81 | |
wxWidgets/wxPython-Classic | 19571e1ae65f1ac445f5491474121998c97a1bf0 | src/gtk/richtext.py | python | RichTextCtrl.IsPositionVisible | (*args, **kwargs) | return _richtext.RichTextCtrl_IsPositionVisible(*args, **kwargs) | IsPositionVisible(self, long pos) -> bool | IsPositionVisible(self, long pos) -> bool | [
"IsPositionVisible",
"(",
"self",
"long",
"pos",
")",
"-",
">",
"bool"
] | def IsPositionVisible(*args, **kwargs):
"""IsPositionVisible(self, long pos) -> bool"""
return _richtext.RichTextCtrl_IsPositionVisible(*args, **kwargs) | [
"def",
"IsPositionVisible",
"(",
"*",
"args",
",",
"*",
"*",
"kwargs",
")",
":",
"return",
"_richtext",
".",
"RichTextCtrl_IsPositionVisible",
"(",
"*",
"args",
",",
"*",
"*",
"kwargs",
")"
] | https://github.com/wxWidgets/wxPython-Classic/blob/19571e1ae65f1ac445f5491474121998c97a1bf0/src/gtk/richtext.py#L4116-L4118 | |
wxWidgets/wxPython-Classic | 19571e1ae65f1ac445f5491474121998c97a1bf0 | src/osx_cocoa/dataview.py | python | PyDataViewCustomRenderer.GetDC | (*args, **kwargs) | return _dataview.PyDataViewCustomRenderer_GetDC(*args, **kwargs) | GetDC(self) -> DC | GetDC(self) -> DC | [
"GetDC",
"(",
"self",
")",
"-",
">",
"DC"
] | def GetDC(*args, **kwargs):
"""GetDC(self) -> DC"""
return _dataview.PyDataViewCustomRenderer_GetDC(*args, **kwargs) | [
"def",
"GetDC",
"(",
"*",
"args",
",",
"*",
"*",
"kwargs",
")",
":",
"return",
"_dataview",
".",
"PyDataViewCustomRenderer_GetDC",
"(",
"*",
"args",
",",
"*",
"*",
"kwargs",
")"
] | https://github.com/wxWidgets/wxPython-Classic/blob/19571e1ae65f1ac445f5491474121998c97a1bf0/src/osx_cocoa/dataview.py#L1502-L1504 | |
tensorflow/io | 92b44e180674a8af0e12e405530f7343e3e693e4 | tensorflow_io/python/experimental/color_ops.py | python | ycbcr_to_rgb | (input, name=None) | return tf.cast(value, input.dtype) | Convert a YCbCr image to RGB.
Args:
input: A 3-D (`[H, W, 3]`) or 4-D (`[N, H, W, 3]`) Tensor.
name: A name for the operation (optional).
Returns:
A 3-D (`[H, W, 3]`) or 4-D (`[N, H, W, 3]`) Tensor. | Convert a YCbCr image to RGB. | [
"Convert",
"a",
"YCbCr",
"image",
"to",
"RGB",
"."
] | def ycbcr_to_rgb(input, name=None):
"""
Convert a YCbCr image to RGB.
Args:
input: A 3-D (`[H, W, 3]`) or 4-D (`[N, H, W, 3]`) Tensor.
name: A name for the operation (optional).
Returns:
A 3-D (`[H, W, 3]`) or 4-D (`[N, H, W, 3]`) Tensor.
"""
input = tf.convert_to_tensor(inpu... | [
"def",
"ycbcr_to_rgb",
"(",
"input",
",",
"name",
"=",
"None",
")",
":",
"input",
"=",
"tf",
".",
"convert_to_tensor",
"(",
"input",
")",
"assert",
"input",
".",
"dtype",
"==",
"tf",
".",
"uint8",
"value",
"=",
"tf",
".",
"cast",
"(",
"input",
",",
... | https://github.com/tensorflow/io/blob/92b44e180674a8af0e12e405530f7343e3e693e4/tensorflow_io/python/experimental/color_ops.py#L107-L126 | |
tensorflow/io | 92b44e180674a8af0e12e405530f7343e3e693e4 | tensorflow_io/python/ops/bigtable/bigtable_row_set.py | python | intersect | (row_set: RowSet, row_range: bigtable_row_range.RowRange) | return RowSet(core_ops.bigtable_row_set_intersect(row_set._impl, row_range._impl)) | Modify a RowSet by intersecting its contents with a RowRange.
All rows intersecting with the given range will be removed from the set
and all row ranges will either be adjusted so that they do not cover
anything beyond the given range or removed entirely (if they have an
empty intersection with the giv... | Modify a RowSet by intersecting its contents with a RowRange. | [
"Modify",
"a",
"RowSet",
"by",
"intersecting",
"its",
"contents",
"with",
"a",
"RowRange",
"."
] | def intersect(row_set: RowSet, row_range: bigtable_row_range.RowRange) -> RowSet:
"""Modify a RowSet by intersecting its contents with a RowRange.
All rows intersecting with the given range will be removed from the set
and all row ranges will either be adjusted so that they do not cover
anything beyond... | [
"def",
"intersect",
"(",
"row_set",
":",
"RowSet",
",",
"row_range",
":",
"bigtable_row_range",
".",
"RowRange",
")",
"->",
"RowSet",
":",
"return",
"RowSet",
"(",
"core_ops",
".",
"bigtable_row_set_intersect",
"(",
"row_set",
".",
"_impl",
",",
"row_range",
"... | https://github.com/tensorflow/io/blob/92b44e180674a8af0e12e405530f7343e3e693e4/tensorflow_io/python/ops/bigtable/bigtable_row_set.py#L60-L75 | |
pmq20/node-packer | 12c46c6e44fbc14d9ee645ebd17d5296b324f7e0 | lts/deps/v8/third_party/jinja2/nativetypes.py | python | native_concat | (nodes) | Return a native Python type from the list of compiled nodes. If the
result is a single node, its value is returned. Otherwise, the nodes are
concatenated as strings. If the result can be parsed with
:func:`ast.literal_eval`, the parsed value is returned. Otherwise, the
string is returned. | Return a native Python type from the list of compiled nodes. If the
result is a single node, its value is returned. Otherwise, the nodes are
concatenated as strings. If the result can be parsed with
:func:`ast.literal_eval`, the parsed value is returned. Otherwise, the
string is returned. | [
"Return",
"a",
"native",
"Python",
"type",
"from",
"the",
"list",
"of",
"compiled",
"nodes",
".",
"If",
"the",
"result",
"is",
"a",
"single",
"node",
"its",
"value",
"is",
"returned",
".",
"Otherwise",
"the",
"nodes",
"are",
"concatenated",
"as",
"strings"... | def native_concat(nodes):
"""Return a native Python type from the list of compiled nodes. If the
result is a single node, its value is returned. Otherwise, the nodes are
concatenated as strings. If the result can be parsed with
:func:`ast.literal_eval`, the parsed value is returned. Otherwise, the
s... | [
"def",
"native_concat",
"(",
"nodes",
")",
":",
"head",
"=",
"list",
"(",
"islice",
"(",
"nodes",
",",
"2",
")",
")",
"if",
"not",
"head",
":",
"return",
"None",
"if",
"len",
"(",
"head",
")",
"==",
"1",
":",
"out",
"=",
"head",
"[",
"0",
"]",
... | https://github.com/pmq20/node-packer/blob/12c46c6e44fbc14d9ee645ebd17d5296b324f7e0/lts/deps/v8/third_party/jinja2/nativetypes.py#L11-L31 | ||
wxWidgets/wxPython-Classic | 19571e1ae65f1ac445f5491474121998c97a1bf0 | wx/tools/Editra/src/style_editor.py | python | PreviewPanel.OnChoice | (self, evt) | Update the preview file | Update the preview file | [
"Update",
"the",
"preview",
"file"
] | def OnChoice(self, evt):
"""Update the preview file"""
if evt.GetId() == ed_glob.ID_LEXER:
e_obj = evt.GetEventObject()
val = e_obj.GetStringSelection()
self.OpenPreviewFile(val)
else:
evt.Skip() | [
"def",
"OnChoice",
"(",
"self",
",",
"evt",
")",
":",
"if",
"evt",
".",
"GetId",
"(",
")",
"==",
"ed_glob",
".",
"ID_LEXER",
":",
"e_obj",
"=",
"evt",
".",
"GetEventObject",
"(",
")",
"val",
"=",
"e_obj",
".",
"GetStringSelection",
"(",
")",
"self",
... | https://github.com/wxWidgets/wxPython-Classic/blob/19571e1ae65f1ac445f5491474121998c97a1bf0/wx/tools/Editra/src/style_editor.py#L866-L873 | ||
trilinos/Trilinos | 6168be6dd51e35e1cd681e9c4b24433e709df140 | packages/seacas/scripts/exomerge2.py | python | ExodusModel.calculate_node_field_maximum | (self,
node_field_names,
element_block_ids='auto',
calculate_location=False) | Store a node field maximum as a global variable.
If 'calculate_location=True', also store the location of the node with
this value.
Examples:
>>> model.calculate_node_field_maximum('temp')
>>> model.global_variables['temp_max'] | Store a node field maximum as a global variable. | [
"Store",
"a",
"node",
"field",
"maximum",
"as",
"a",
"global",
"variable",
"."
] | def calculate_node_field_maximum(self,
node_field_names,
element_block_ids='auto',
calculate_location=False):
"""
Store a node field maximum as a global variable.
If 'calculate_locatio... | [
"def",
"calculate_node_field_maximum",
"(",
"self",
",",
"node_field_names",
",",
"element_block_ids",
"=",
"'auto'",
",",
"calculate_location",
"=",
"False",
")",
":",
"self",
".",
"_calculate_node_field_extreme",
"(",
"node_field_names",
",",
"max",
",",
"'max'",
... | https://github.com/trilinos/Trilinos/blob/6168be6dd51e35e1cd681e9c4b24433e709df140/packages/seacas/scripts/exomerge2.py#L2181-L2201 | ||
FreeCAD/FreeCAD | ba42231b9c6889b89e064d6d563448ed81e376ec | src/Mod/Draft/WorkingPlane.py | python | Plane.__repr__ | (self) | return text | Show the string representation of the object. | Show the string representation of the object. | [
"Show",
"the",
"string",
"representation",
"of",
"the",
"object",
"."
] | def __repr__(self):
"""Show the string representation of the object."""
text = "Workplane"
text += " x=" + str(DraftVecUtils.rounded(self.u))
text += " y=" + str(DraftVecUtils.rounded(self.v))
text += " z=" + str(DraftVecUtils.rounded(self.axis))
return text | [
"def",
"__repr__",
"(",
"self",
")",
":",
"text",
"=",
"\"Workplane\"",
"text",
"+=",
"\" x=\"",
"+",
"str",
"(",
"DraftVecUtils",
".",
"rounded",
"(",
"self",
".",
"u",
")",
")",
"text",
"+=",
"\" y=\"",
"+",
"str",
"(",
"DraftVecUtils",
".",
"rounded... | https://github.com/FreeCAD/FreeCAD/blob/ba42231b9c6889b89e064d6d563448ed81e376ec/src/Mod/Draft/WorkingPlane.py#L119-L125 | |
ceph/ceph | 959663007321a369c83218414a29bd9dbc8bda3a | src/pybind/mgr/restful/api/osd.py | python | OsdId.get | (self, **kwargs) | return osd[0] | Show the information for the OSD id | Show the information for the OSD id | [
"Show",
"the",
"information",
"for",
"the",
"OSD",
"id"
] | def get(self, **kwargs):
"""
Show the information for the OSD id
"""
osd = context.instance.get_osds(ids=[str(self.osd_id)])
if len(osd) != 1:
response.status = 500
return {'message': 'Failed to identify the OSD id "{}"'.format(self.osd_id)}
retur... | [
"def",
"get",
"(",
"self",
",",
"*",
"*",
"kwargs",
")",
":",
"osd",
"=",
"context",
".",
"instance",
".",
"get_osds",
"(",
"ids",
"=",
"[",
"str",
"(",
"self",
".",
"osd_id",
")",
"]",
")",
"if",
"len",
"(",
"osd",
")",
"!=",
"1",
":",
"resp... | https://github.com/ceph/ceph/blob/959663007321a369c83218414a29bd9dbc8bda3a/src/pybind/mgr/restful/api/osd.py#L64-L73 | |
Tencent/CMONGO | c40380caa14e05509f46993aa8b8da966b09b0b5 | src/third_party/scons-2.5.0/scons-local-2.5.0/SCons/Script/Interactive.py | python | SConsInteractiveCmd.do_exit | (self, argv) | \
exit Exit SCons interactive mode. | \
exit Exit SCons interactive mode. | [
"\\",
"exit",
"Exit",
"SCons",
"interactive",
"mode",
"."
] | def do_exit(self, argv):
"""\
exit Exit SCons interactive mode.
"""
sys.exit(0) | [
"def",
"do_exit",
"(",
"self",
",",
"argv",
")",
":",
"sys",
".",
"exit",
"(",
"0",
")"
] | https://github.com/Tencent/CMONGO/blob/c40380caa14e05509f46993aa8b8da966b09b0b5/src/third_party/scons-2.5.0/scons-local-2.5.0/SCons/Script/Interactive.py#L316-L320 | ||
ricardoquesada/Spidermonkey | 4a75ea2543408bd1b2c515aa95901523eeef7858 | dom/bindings/Codegen.py | python | ForwardDeclarationBuilder._listAdd | (self, namespaces, name, isStruct=False) | Add a forward declaration, where |namespaces| is a list of namespaces.
|name| should not contain any other namespaces. | Add a forward declaration, where |namespaces| is a list of namespaces.
|name| should not contain any other namespaces. | [
"Add",
"a",
"forward",
"declaration",
"where",
"|namespaces|",
"is",
"a",
"list",
"of",
"namespaces",
".",
"|name|",
"should",
"not",
"contain",
"any",
"other",
"namespaces",
"."
] | def _listAdd(self, namespaces, name, isStruct=False):
"""
Add a forward declaration, where |namespaces| is a list of namespaces.
|name| should not contain any other namespaces.
"""
if namespaces:
child = self.children.setdefault(namespaces[0], ForwardDeclarationBuilde... | [
"def",
"_listAdd",
"(",
"self",
",",
"namespaces",
",",
"name",
",",
"isStruct",
"=",
"False",
")",
":",
"if",
"namespaces",
":",
"child",
"=",
"self",
".",
"children",
".",
"setdefault",
"(",
"namespaces",
"[",
"0",
"]",
",",
"ForwardDeclarationBuilder",
... | https://github.com/ricardoquesada/Spidermonkey/blob/4a75ea2543408bd1b2c515aa95901523eeef7858/dom/bindings/Codegen.py#L11813-L11823 | ||
baidu-research/tensorflow-allreduce | 66d5b855e90b0949e9fa5cca5599fd729a70e874 | tensorflow/contrib/learn/python/learn/export_strategy.py | python | ExportStrategy.export | (self,
estimator,
export_path,
checkpoint_path=None,
eval_result=None) | return self.export_fn(estimator, export_path, **kwargs) | Exports the given Estimator to a specific format.
Args:
estimator: the Estimator to export.
export_path: A string containing a directory where to write the export.
checkpoint_path: The checkpoint path to export. If None (the default),
the strategy may locate a checkpoint (e.g. the most r... | Exports the given Estimator to a specific format. | [
"Exports",
"the",
"given",
"Estimator",
"to",
"a",
"specific",
"format",
"."
] | def export(self,
estimator,
export_path,
checkpoint_path=None,
eval_result=None):
"""Exports the given Estimator to a specific format.
Args:
estimator: the Estimator to export.
export_path: A string containing a directory where to write the export... | [
"def",
"export",
"(",
"self",
",",
"estimator",
",",
"export_path",
",",
"checkpoint_path",
"=",
"None",
",",
"eval_result",
"=",
"None",
")",
":",
"# don't break existing export_fns that don't accept checkpoint_path and",
"# eval_result",
"export_fn_args",
"=",
"tf_inspe... | https://github.com/baidu-research/tensorflow-allreduce/blob/66d5b855e90b0949e9fa5cca5599fd729a70e874/tensorflow/contrib/learn/python/learn/export_strategy.py#L53-L87 | |
aws/lumberyard | f85344403c1c2e77ec8c75deb2c116e97b713217 | dev/Tools/Python/3.7.10/linux_x64/lib/python3.7/xml/etree/ElementTree.py | python | ElementTree.write | (self, file_or_filename,
encoding=None,
xml_declaration=None,
default_namespace=None,
method=None, *,
short_empty_elements=True) | Write element tree to a file as XML.
Arguments:
*file_or_filename* -- file name or a file object opened for writing
*encoding* -- the output encoding (default: US-ASCII)
*xml_declaration* -- bool indicating if an XML declaration should be
added to ... | Write element tree to a file as XML. | [
"Write",
"element",
"tree",
"to",
"a",
"file",
"as",
"XML",
"."
] | def write(self, file_or_filename,
encoding=None,
xml_declaration=None,
default_namespace=None,
method=None, *,
short_empty_elements=True):
"""Write element tree to a file as XML.
Arguments:
*file_or_filename* -- file name o... | [
"def",
"write",
"(",
"self",
",",
"file_or_filename",
",",
"encoding",
"=",
"None",
",",
"xml_declaration",
"=",
"None",
",",
"default_namespace",
"=",
"None",
",",
"method",
"=",
"None",
",",
"*",
",",
"short_empty_elements",
"=",
"True",
")",
":",
"if",
... | https://github.com/aws/lumberyard/blob/f85344403c1c2e77ec8c75deb2c116e97b713217/dev/Tools/Python/3.7.10/linux_x64/lib/python3.7/xml/etree/ElementTree.py#L721-L777 | ||
bairdzhang/smallhardface | 76fa1d87a9602d9b13d7a7fe693fc7aec91cab80 | lib/layers/generate_anchors.py | python | generate_anchors | (base_size=16, ratios=[0.5, 1, 2],
scales=2**np.arange(3, 6),
shifts=np.array([0]),
strides=np.array([0])) | return anchors | Generate anchor (reference) windows by enumerating aspect ratios X
scales wrt a reference (0, 0, 15, 15) window. | Generate anchor (reference) windows by enumerating aspect ratios X
scales wrt a reference (0, 0, 15, 15) window. | [
"Generate",
"anchor",
"(",
"reference",
")",
"windows",
"by",
"enumerating",
"aspect",
"ratios",
"X",
"scales",
"wrt",
"a",
"reference",
"(",
"0",
"0",
"15",
"15",
")",
"window",
"."
] | def generate_anchors(base_size=16, ratios=[0.5, 1, 2],
scales=2**np.arange(3, 6),
shifts=np.array([0]),
strides=np.array([0])):
"""
Generate anchor (reference) windows by enumerating aspect ratios X
scales wrt a reference (0, 0, 15, 15) window.
... | [
"def",
"generate_anchors",
"(",
"base_size",
"=",
"16",
",",
"ratios",
"=",
"[",
"0.5",
",",
"1",
",",
"2",
"]",
",",
"scales",
"=",
"2",
"**",
"np",
".",
"arange",
"(",
"3",
",",
"6",
")",
",",
"shifts",
"=",
"np",
".",
"array",
"(",
"[",
"0... | https://github.com/bairdzhang/smallhardface/blob/76fa1d87a9602d9b13d7a7fe693fc7aec91cab80/lib/layers/generate_anchors.py#L11-L26 | |
wxWidgets/wxPython-Classic | 19571e1ae65f1ac445f5491474121998c97a1bf0 | src/msw/_core.py | python | Sizer._ReplaceWin | (*args, **kwargs) | return _core_.Sizer__ReplaceWin(*args, **kwargs) | _ReplaceWin(self, Window oldwin, Window newwin, bool recursive=False) -> bool | _ReplaceWin(self, Window oldwin, Window newwin, bool recursive=False) -> bool | [
"_ReplaceWin",
"(",
"self",
"Window",
"oldwin",
"Window",
"newwin",
"bool",
"recursive",
"=",
"False",
")",
"-",
">",
"bool"
] | def _ReplaceWin(*args, **kwargs):
"""_ReplaceWin(self, Window oldwin, Window newwin, bool recursive=False) -> bool"""
return _core_.Sizer__ReplaceWin(*args, **kwargs) | [
"def",
"_ReplaceWin",
"(",
"*",
"args",
",",
"*",
"*",
"kwargs",
")",
":",
"return",
"_core_",
".",
"Sizer__ReplaceWin",
"(",
"*",
"args",
",",
"*",
"*",
"kwargs",
")"
] | https://github.com/wxWidgets/wxPython-Classic/blob/19571e1ae65f1ac445f5491474121998c97a1bf0/src/msw/_core.py#L14570-L14572 | |
mongodb/mongo | d8ff665343ad29cf286ee2cf4a1960d29371937b | buildscripts/idl/idl/writer.py | python | IndentedTextWriter.clear_template_mapping | (self) | Clear the current template mapping parameters for string.Template formatting. | Clear the current template mapping parameters for string.Template formatting. | [
"Clear",
"the",
"current",
"template",
"mapping",
"parameters",
"for",
"string",
".",
"Template",
"formatting",
"."
] | def clear_template_mapping(self):
# type: () -> None
"""Clear the current template mapping parameters for string.Template formatting."""
assert self._template_context
self._template_context = None | [
"def",
"clear_template_mapping",
"(",
"self",
")",
":",
"# type: () -> None",
"assert",
"self",
".",
"_template_context",
"self",
".",
"_template_context",
"=",
"None"
] | https://github.com/mongodb/mongo/blob/d8ff665343ad29cf286ee2cf4a1960d29371937b/buildscripts/idl/idl/writer.py#L140-L144 | ||
benoitsteiner/tensorflow-opencl | cb7cb40a57fde5cfd4731bc551e82a1e2fef43a5 | tensorflow/python/ops/sparse_ops.py | python | sparse_tensor_dense_matmul | (sp_a,
b,
adjoint_a=False,
adjoint_b=False,
name=None) | Multiply SparseTensor (of rank 2) "A" by dense matrix "B".
No validity checking is performed on the indices of `A`. However, the
following input format is recommended for optimal behavior:
* If `adjoint_a == false`: `A` should be sorted in lexicographically
increasing order. Use `sparse_reorder` if you're... | Multiply SparseTensor (of rank 2) "A" by dense matrix "B". | [
"Multiply",
"SparseTensor",
"(",
"of",
"rank",
"2",
")",
"A",
"by",
"dense",
"matrix",
"B",
"."
] | def sparse_tensor_dense_matmul(sp_a,
b,
adjoint_a=False,
adjoint_b=False,
name=None):
# pylint: disable=line-too-long
"""Multiply SparseTensor (of rank 2) "A" by dense matrix "B".
No validi... | [
"def",
"sparse_tensor_dense_matmul",
"(",
"sp_a",
",",
"b",
",",
"adjoint_a",
"=",
"False",
",",
"adjoint_b",
"=",
"False",
",",
"name",
"=",
"None",
")",
":",
"# pylint: disable=line-too-long",
"# pylint: enable=line-too-long",
"sp_a",
"=",
"_convert_to_sparse_tensor... | https://github.com/benoitsteiner/tensorflow-opencl/blob/cb7cb40a57fde5cfd4731bc551e82a1e2fef43a5/tensorflow/python/ops/sparse_ops.py#L1506-L1719 | ||
neopenx/Dragon | 0e639a7319035ddc81918bd3df059230436ee0a1 | Dragon/python/dragon/operators/arithmetic.py | python | Add | (inputs, **kwargs) | return output | Calculate A + B.
Parameters
----------
inputs : list of Tensor
The inputs, represent A and B respectively.
Returns
-------
Tensor
The output tensor. | Calculate A + B. | [
"Calculate",
"A",
"+",
"B",
"."
] | def Add(inputs, **kwargs):
"""Calculate A + B.
Parameters
----------
inputs : list of Tensor
The inputs, represent A and B respectively.
Returns
-------
Tensor
The output tensor.
"""
CheckInputs(inputs, 2)
arguments = ParseArguments(locals())
output = Tens... | [
"def",
"Add",
"(",
"inputs",
",",
"*",
"*",
"kwargs",
")",
":",
"CheckInputs",
"(",
"inputs",
",",
"2",
")",
"arguments",
"=",
"ParseArguments",
"(",
"locals",
"(",
")",
")",
"output",
"=",
"Tensor",
".",
"CreateOperator",
"(",
"nout",
"=",
"1",
",",... | https://github.com/neopenx/Dragon/blob/0e639a7319035ddc81918bd3df059230436ee0a1/Dragon/python/dragon/operators/arithmetic.py#L14-L36 | |
aws/lumberyard | f85344403c1c2e77ec8c75deb2c116e97b713217 | dev/Tools/Python/3.7.10/windows/Lib/ssl.py | python | SSLObject.shared_ciphers | (self) | return self._sslobj.shared_ciphers() | Return a list of ciphers shared by the client during the handshake or
None if this is not a valid server connection. | Return a list of ciphers shared by the client during the handshake or
None if this is not a valid server connection. | [
"Return",
"a",
"list",
"of",
"ciphers",
"shared",
"by",
"the",
"client",
"during",
"the",
"handshake",
"or",
"None",
"if",
"this",
"is",
"not",
"a",
"valid",
"server",
"connection",
"."
] | def shared_ciphers(self):
"""Return a list of ciphers shared by the client during the handshake or
None if this is not a valid server connection.
"""
return self._sslobj.shared_ciphers() | [
"def",
"shared_ciphers",
"(",
"self",
")",
":",
"return",
"self",
".",
"_sslobj",
".",
"shared_ciphers",
"(",
")"
] | https://github.com/aws/lumberyard/blob/f85344403c1c2e77ec8c75deb2c116e97b713217/dev/Tools/Python/3.7.10/windows/Lib/ssl.py#L757-L761 | |
cyberbotics/webots | af7fa7d68dcf7b4550f1f2e132092b41e83698fc | projects/humans/c3d/controllers/c3d_viewer/c3d.py | python | Group.get_string | (self, key) | return self.params[key.upper()].string_value | Get the value of the given parameter as a string. | Get the value of the given parameter as a string. | [
"Get",
"the",
"value",
"of",
"the",
"given",
"parameter",
"as",
"a",
"string",
"."
] | def get_string(self, key):
'''Get the value of the given parameter as a string.'''
return self.params[key.upper()].string_value | [
"def",
"get_string",
"(",
"self",
",",
"key",
")",
":",
"return",
"self",
".",
"params",
"[",
"key",
".",
"upper",
"(",
")",
"]",
".",
"string_value"
] | https://github.com/cyberbotics/webots/blob/af7fa7d68dcf7b4550f1f2e132092b41e83698fc/projects/humans/c3d/controllers/c3d_viewer/c3d.py#L498-L500 | |
catboost/catboost | 167f64f237114a4d10b2b4ee42adb4569137debe | contrib/python/scikit-learn/py2/sklearn/neighbors/base.py | python | _get_weights | (dist, weights) | Get the weights from an array of distances and a parameter ``weights``
Parameters
===========
dist: ndarray
The input distances
weights: {'uniform', 'distance' or a callable}
The kind of weighting used
Returns
========
weights_arr: array of the same shape as ``dist``
... | Get the weights from an array of distances and a parameter ``weights`` | [
"Get",
"the",
"weights",
"from",
"an",
"array",
"of",
"distances",
"and",
"a",
"parameter",
"weights"
] | def _get_weights(dist, weights):
"""Get the weights from an array of distances and a parameter ``weights``
Parameters
===========
dist: ndarray
The input distances
weights: {'uniform', 'distance' or a callable}
The kind of weighting used
Returns
========
weights_arr: ar... | [
"def",
"_get_weights",
"(",
"dist",
",",
"weights",
")",
":",
"if",
"weights",
"in",
"(",
"None",
",",
"'uniform'",
")",
":",
"return",
"None",
"elif",
"weights",
"==",
"'distance'",
":",
"# if user attempts to classify a point that was zero distance from one",
"# o... | https://github.com/catboost/catboost/blob/167f64f237114a4d10b2b4ee42adb4569137debe/contrib/python/scikit-learn/py2/sklearn/neighbors/base.py#L58-L99 | ||
hanpfei/chromium-net | 392cc1fa3a8f92f42e4071ab6e674d8e0482f83f | third_party/protobuf/python/google/protobuf/service_reflection.py | python | _ServiceBuilder._NonImplementedMethod | (self, method_name, rpc_controller, callback) | The body of all methods in the generated service class.
Args:
method_name: Name of the method being executed.
rpc_controller: RPC controller used to execute this method.
callback: A callback which will be invoked when the method finishes. | The body of all methods in the generated service class. | [
"The",
"body",
"of",
"all",
"methods",
"in",
"the",
"generated",
"service",
"class",
"."
] | def _NonImplementedMethod(self, method_name, rpc_controller, callback):
"""The body of all methods in the generated service class.
Args:
method_name: Name of the method being executed.
rpc_controller: RPC controller used to execute this method.
callback: A callback which will be invoked when ... | [
"def",
"_NonImplementedMethod",
"(",
"self",
",",
"method_name",
",",
"rpc_controller",
",",
"callback",
")",
":",
"rpc_controller",
".",
"SetFailed",
"(",
"'Method %s not implemented.'",
"%",
"method_name",
")",
"callback",
"(",
"None",
")"
] | https://github.com/hanpfei/chromium-net/blob/392cc1fa3a8f92f42e4071ab6e674d8e0482f83f/third_party/protobuf/python/google/protobuf/service_reflection.py#L218-L227 | ||
google/mysql-protobuf | 467cda676afaa49e762c5c9164a43f6ad31a1fbf | protobuf/python/google/protobuf/descriptor_pool.py | python | DescriptorPool.FindEnumTypeByName | (self, full_name) | return self._enum_descriptors[full_name] | Loads the named enum descriptor from the pool.
Args:
full_name: The full name of the enum descriptor to load.
Returns:
The enum descriptor for the named type. | Loads the named enum descriptor from the pool. | [
"Loads",
"the",
"named",
"enum",
"descriptor",
"from",
"the",
"pool",
"."
] | def FindEnumTypeByName(self, full_name):
"""Loads the named enum descriptor from the pool.
Args:
full_name: The full name of the enum descriptor to load.
Returns:
The enum descriptor for the named type.
"""
full_name = _NormalizeFullyQualifiedName(full_name)
if full_name not in se... | [
"def",
"FindEnumTypeByName",
"(",
"self",
",",
"full_name",
")",
":",
"full_name",
"=",
"_NormalizeFullyQualifiedName",
"(",
"full_name",
")",
"if",
"full_name",
"not",
"in",
"self",
".",
"_enum_descriptors",
":",
"self",
".",
"FindFileContainingSymbol",
"(",
"ful... | https://github.com/google/mysql-protobuf/blob/467cda676afaa49e762c5c9164a43f6ad31a1fbf/protobuf/python/google/protobuf/descriptor_pool.py#L256-L269 | |
pmq20/node-packer | 12c46c6e44fbc14d9ee645ebd17d5296b324f7e0 | lts/tools/gyp/pylib/gyp/input.py | python | QualifyDependencies | (targets) | Make dependency links fully-qualified relative to the current directory.
|targets| is a dict mapping fully-qualified target names to their target
dicts. For each target in this dict, keys known to contain dependency
links are examined, and any dependencies referenced will be rewritten
so that they are fully-q... | Make dependency links fully-qualified relative to the current directory. | [
"Make",
"dependency",
"links",
"fully",
"-",
"qualified",
"relative",
"to",
"the",
"current",
"directory",
"."
] | def QualifyDependencies(targets):
"""Make dependency links fully-qualified relative to the current directory.
|targets| is a dict mapping fully-qualified target names to their target
dicts. For each target in this dict, keys known to contain dependency
links are examined, and any dependencies referenced will ... | [
"def",
"QualifyDependencies",
"(",
"targets",
")",
":",
"all_dependency_sections",
"=",
"[",
"dep",
"+",
"op",
"for",
"dep",
"in",
"dependency_sections",
"for",
"op",
"in",
"(",
"''",
",",
"'!'",
",",
"'/'",
")",
"]",
"for",
"target",
",",
"target_dict",
... | https://github.com/pmq20/node-packer/blob/12c46c6e44fbc14d9ee645ebd17d5296b324f7e0/lts/tools/gyp/pylib/gyp/input.py#L1369-L1405 | ||
baidu-research/tensorflow-allreduce | 66d5b855e90b0949e9fa5cca5599fd729a70e874 | tensorflow/contrib/keras/python/keras/engine/topology.py | python | Container.losses | (self) | return losses | Retrieve the model's losses.
Will only include losses that are either
unconditional, or conditional on inputs to this model
(e.g. will not include losses that depend on tensors
that aren't inputs to this model).
Returns:
A list of loss tensors. | Retrieve the model's losses. | [
"Retrieve",
"the",
"model",
"s",
"losses",
"."
] | def losses(self):
"""Retrieve the model's losses.
Will only include losses that are either
unconditional, or conditional on inputs to this model
(e.g. will not include losses that depend on tensors
that aren't inputs to this model).
Returns:
A list of loss tensors.
"""
losses =... | [
"def",
"losses",
"(",
"self",
")",
":",
"losses",
"=",
"[",
"]",
"# Retrieve losses for all internal layers.",
"for",
"layer",
"in",
"self",
".",
"layers",
":",
"if",
"hasattr",
"(",
"layer",
",",
"'losses'",
")",
":",
"# Collect losses that are dependent on input... | https://github.com/baidu-research/tensorflow-allreduce/blob/66d5b855e90b0949e9fa5cca5599fd729a70e874/tensorflow/contrib/keras/python/keras/engine/topology.py#L1571-L1598 | |
aws/lumberyard | f85344403c1c2e77ec8c75deb2c116e97b713217 | dev/Tools/Python/3.7.10/mac/Python.framework/Versions/3.7/share/doc/python3.7/examples/Tools/pynche/ColorDB.py | python | ColorDB.find_byname | (self, name) | Return (red, green, blue) for name | Return (red, green, blue) for name | [
"Return",
"(",
"red",
"green",
"blue",
")",
"for",
"name"
] | def find_byname(self, name):
"""Return (red, green, blue) for name"""
name = name.lower()
try:
return self.__byname[name]
except KeyError:
raise BadColor(name) from None | [
"def",
"find_byname",
"(",
"self",
",",
"name",
")",
":",
"name",
"=",
"name",
".",
"lower",
"(",
")",
"try",
":",
"return",
"self",
".",
"__byname",
"[",
"name",
"]",
"except",
"KeyError",
":",
"raise",
"BadColor",
"(",
"name",
")",
"from",
"None"
] | https://github.com/aws/lumberyard/blob/f85344403c1c2e77ec8c75deb2c116e97b713217/dev/Tools/Python/3.7.10/mac/Python.framework/Versions/3.7/share/doc/python3.7/examples/Tools/pynche/ColorDB.py#L92-L98 | ||
krishauser/Klampt | 972cc83ea5befac3f653c1ba20f80155768ad519 | Python/python2_version/klampt/vis/visualization.py | python | _default_attributes | (item,type=None) | return res | Returns an attribute dictionary for the defaults of a given item.
If the item is ambiguous, you can provide the type argument. | Returns an attribute dictionary for the defaults of a given item. | [
"Returns",
"an",
"attribute",
"dictionary",
"for",
"the",
"defaults",
"of",
"a",
"given",
"item",
"."
] | def _default_attributes(item,type=None):
"""Returns an attribute dictionary for the defaults of a given item.
If the item is ambiguous, you can provide the type argument.
"""
res = {}
if isinstance(item,str):
return _default_str_attributes
elif isinstance(item,(WorldModel,RobotModel)):
... | [
"def",
"_default_attributes",
"(",
"item",
",",
"type",
"=",
"None",
")",
":",
"res",
"=",
"{",
"}",
"if",
"isinstance",
"(",
"item",
",",
"str",
")",
":",
"return",
"_default_str_attributes",
"elif",
"isinstance",
"(",
"item",
",",
"(",
"WorldModel",
",... | https://github.com/krishauser/Klampt/blob/972cc83ea5befac3f653c1ba20f80155768ad519/Python/python2_version/klampt/vis/visualization.py#L1705-L1771 | |
ceph/ceph | 959663007321a369c83218414a29bd9dbc8bda3a | src/pybind/mgr/pg_autoscaler/module.py | python | PgAutoscaler.set_scaling_threshold | (self, num: float) | return 0, "threshold updated", "" | set the autoscaler threshold
A.K.A. the factor by which the new PG_NUM must vary from the existing PG_NUM | set the autoscaler threshold
A.K.A. the factor by which the new PG_NUM must vary from the existing PG_NUM | [
"set",
"the",
"autoscaler",
"threshold",
"A",
".",
"K",
".",
"A",
".",
"the",
"factor",
"by",
"which",
"the",
"new",
"PG_NUM",
"must",
"vary",
"from",
"the",
"existing",
"PG_NUM"
] | def set_scaling_threshold(self, num: float) -> Tuple[int, str, str]:
"""
set the autoscaler threshold
A.K.A. the factor by which the new PG_NUM must vary from the existing PG_NUM
"""
if num < 1.0:
return 22, "", "threshold cannot be set less than 1.0"
self.se... | [
"def",
"set_scaling_threshold",
"(",
"self",
",",
"num",
":",
"float",
")",
"->",
"Tuple",
"[",
"int",
",",
"str",
",",
"str",
"]",
":",
"if",
"num",
"<",
"1.0",
":",
"return",
"22",
",",
"\"\"",
",",
"\"threshold cannot be set less than 1.0\"",
"self",
... | https://github.com/ceph/ceph/blob/959663007321a369c83218414a29bd9dbc8bda3a/src/pybind/mgr/pg_autoscaler/module.py#L247-L255 | |
pytorch/pytorch | 7176c92687d3cc847cc046bf002269c6949a21c2 | torch/cuda/random.py | python | manual_seed_all | (seed: int) | r"""Sets the seed for generating random numbers on all GPUs.
It's safe to call this function if CUDA is not available; in that
case, it is silently ignored.
Args:
seed (int): The desired seed. | r"""Sets the seed for generating random numbers on all GPUs.
It's safe to call this function if CUDA is not available; in that
case, it is silently ignored. | [
"r",
"Sets",
"the",
"seed",
"for",
"generating",
"random",
"numbers",
"on",
"all",
"GPUs",
".",
"It",
"s",
"safe",
"to",
"call",
"this",
"function",
"if",
"CUDA",
"is",
"not",
"available",
";",
"in",
"that",
"case",
"it",
"is",
"silently",
"ignored",
"... | def manual_seed_all(seed: int) -> None:
r"""Sets the seed for generating random numbers on all GPUs.
It's safe to call this function if CUDA is not available; in that
case, it is silently ignored.
Args:
seed (int): The desired seed.
"""
seed = int(seed)
def cb():
for i in r... | [
"def",
"manual_seed_all",
"(",
"seed",
":",
"int",
")",
"->",
"None",
":",
"seed",
"=",
"int",
"(",
"seed",
")",
"def",
"cb",
"(",
")",
":",
"for",
"i",
"in",
"range",
"(",
"device_count",
"(",
")",
")",
":",
"default_generator",
"=",
"torch",
".",... | https://github.com/pytorch/pytorch/blob/7176c92687d3cc847cc046bf002269c6949a21c2/torch/cuda/random.py#L98-L113 | ||
BlzFans/wke | b0fa21158312e40c5fbd84682d643022b6c34a93 | cygwin/lib/python2.6/encodings/zlib_codec.py | python | zlib_decode | (input,errors='strict') | return (output, len(input)) | Decodes the object input and returns a tuple (output
object, length consumed).
input must be an object which provides the bf_getreadbuf
buffer slot. Python strings, buffer objects and memory
mapped files are examples of objects providing this slot.
errors defines the error hand... | Decodes the object input and returns a tuple (output
object, length consumed). | [
"Decodes",
"the",
"object",
"input",
"and",
"returns",
"a",
"tuple",
"(",
"output",
"object",
"length",
"consumed",
")",
"."
] | def zlib_decode(input,errors='strict'):
""" Decodes the object input and returns a tuple (output
object, length consumed).
input must be an object which provides the bf_getreadbuf
buffer slot. Python strings, buffer objects and memory
mapped files are examples of objects providing ... | [
"def",
"zlib_decode",
"(",
"input",
",",
"errors",
"=",
"'strict'",
")",
":",
"assert",
"errors",
"==",
"'strict'",
"output",
"=",
"zlib",
".",
"decompress",
"(",
"input",
")",
"return",
"(",
"output",
",",
"len",
"(",
"input",
")",
")"
] | https://github.com/BlzFans/wke/blob/b0fa21158312e40c5fbd84682d643022b6c34a93/cygwin/lib/python2.6/encodings/zlib_codec.py#L28-L44 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.