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 |
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
tensorflow/tensorflow | 419e3a6b650ea4bd1b0cba23c4348f8a69f3272e | tensorflow/python/ops/ragged/row_partition.py | python | RowPartition.has_precomputed_row_lengths | (self) | return self._row_lengths is not None | Returns true if `row_lengths` has already been computed.
If true, then `self.row_lengths()` will return its value without calling
any TensorFlow ops. | Returns true if `row_lengths` has already been computed. | [
"Returns",
"true",
"if",
"row_lengths",
"has",
"already",
"been",
"computed",
"."
] | def has_precomputed_row_lengths(self):
"""Returns true if `row_lengths` has already been computed.
If true, then `self.row_lengths()` will return its value without calling
any TensorFlow ops.
"""
return self._row_lengths is not None | [
"def",
"has_precomputed_row_lengths",
"(",
"self",
")",
":",
"return",
"self",
".",
"_row_lengths",
"is",
"not",
"None"
] | https://github.com/tensorflow/tensorflow/blob/419e3a6b650ea4bd1b0cba23c4348f8a69f3272e/tensorflow/python/ops/ragged/row_partition.py#L1038-L1044 | |
catboost/catboost | 167f64f237114a4d10b2b4ee42adb4569137debe | contrib/python/pandas/py2/pandas/core/panel.py | python | Panel._extract_axes | (self, data, axes, **kwargs) | return [self._extract_axis(self, data, axis=i, **kwargs)
for i, a in enumerate(axes)] | Return a list of the axis indices. | Return a list of the axis indices. | [
"Return",
"a",
"list",
"of",
"the",
"axis",
"indices",
"."
] | def _extract_axes(self, data, axes, **kwargs):
"""
Return a list of the axis indices.
"""
return [self._extract_axis(self, data, axis=i, **kwargs)
for i, a in enumerate(axes)] | [
"def",
"_extract_axes",
"(",
"self",
",",
"data",
",",
"axes",
",",
"*",
"*",
"kwargs",
")",
":",
"return",
"[",
"self",
".",
"_extract_axis",
"(",
"self",
",",
"data",
",",
"axis",
"=",
"i",
",",
"*",
"*",
"kwargs",
")",
"for",
"i",
",",
"a",
... | https://github.com/catboost/catboost/blob/167f64f237114a4d10b2b4ee42adb4569137debe/contrib/python/pandas/py2/pandas/core/panel.py#L1452-L1457 | |
wxWidgets/wxPython-Classic | 19571e1ae65f1ac445f5491474121998c97a1bf0 | src/osx_carbon/stc.py | python | StyledTextCtrl.StyleGetSizeFractional | (*args, **kwargs) | return _stc.StyledTextCtrl_StyleGetSizeFractional(*args, **kwargs) | StyleGetSizeFractional(self, int style) -> int | StyleGetSizeFractional(self, int style) -> int | [
"StyleGetSizeFractional",
"(",
"self",
"int",
"style",
")",
"-",
">",
"int"
] | def StyleGetSizeFractional(*args, **kwargs):
"""StyleGetSizeFractional(self, int style) -> int"""
return _stc.StyledTextCtrl_StyleGetSizeFractional(*args, **kwargs) | [
"def",
"StyleGetSizeFractional",
"(",
"*",
"args",
",",
"*",
"*",
"kwargs",
")",
":",
"return",
"_stc",
".",
"StyledTextCtrl_StyleGetSizeFractional",
"(",
"*",
"args",
",",
"*",
"*",
"kwargs",
")"
] | https://github.com/wxWidgets/wxPython-Classic/blob/19571e1ae65f1ac445f5491474121998c97a1bf0/src/osx_carbon/stc.py#L2703-L2705 | |
wlanjie/AndroidFFmpeg | 7baf9122f4b8e1c74e7baf4be5c422c7a5ba5aaf | tools/fdk-aac-build/armeabi-v7a/toolchain/lib/python2.7/difflib.py | python | SequenceMatcher.real_quick_ratio | (self) | return _calculate_ratio(min(la, lb), la + lb) | Return an upper bound on ratio() very quickly.
This isn't defined beyond that it is an upper bound on .ratio(), and
is faster to compute than either .ratio() or .quick_ratio(). | Return an upper bound on ratio() very quickly. | [
"Return",
"an",
"upper",
"bound",
"on",
"ratio",
"()",
"very",
"quickly",
"."
] | def real_quick_ratio(self):
"""Return an upper bound on ratio() very quickly.
This isn't defined beyond that it is an upper bound on .ratio(), and
is faster to compute than either .ratio() or .quick_ratio().
"""
la, lb = len(self.a), len(self.b)
# can't have more matche... | [
"def",
"real_quick_ratio",
"(",
"self",
")",
":",
"la",
",",
"lb",
"=",
"len",
"(",
"self",
".",
"a",
")",
",",
"len",
"(",
"self",
".",
"b",
")",
"# can't have more matches than the number of elements in the",
"# shorter sequence",
"return",
"_calculate_ratio",
... | https://github.com/wlanjie/AndroidFFmpeg/blob/7baf9122f4b8e1c74e7baf4be5c422c7a5ba5aaf/tools/fdk-aac-build/armeabi-v7a/toolchain/lib/python2.7/difflib.py#L691-L701 | |
lmb-freiburg/flownet2 | b92e198b56b0e52e1ba0a5a98dc0e39fa5ae70cc | python/caffe/coord_map.py | python | coord_map | (fn) | Define the coordinate mapping by its
- axis
- scale: output coord[i * scale] <- input_coord[i]
- shift: output coord[i] <- output_coord[i + shift]
s.t. the identity mapping, as for pointwise layers like ReLu, is defined by
(None, 1, 0) since it is independent of axis and does not transform coords. | Define the coordinate mapping by its
- axis
- scale: output coord[i * scale] <- input_coord[i]
- shift: output coord[i] <- output_coord[i + shift]
s.t. the identity mapping, as for pointwise layers like ReLu, is defined by
(None, 1, 0) since it is independent of axis and does not transform coords. | [
"Define",
"the",
"coordinate",
"mapping",
"by",
"its",
"-",
"axis",
"-",
"scale",
":",
"output",
"coord",
"[",
"i",
"*",
"scale",
"]",
"<",
"-",
"input_coord",
"[",
"i",
"]",
"-",
"shift",
":",
"output",
"coord",
"[",
"i",
"]",
"<",
"-",
"output_co... | def coord_map(fn):
"""
Define the coordinate mapping by its
- axis
- scale: output coord[i * scale] <- input_coord[i]
- shift: output coord[i] <- output_coord[i + shift]
s.t. the identity mapping, as for pointwise layers like ReLu, is defined by
(None, 1, 0) since it is independent of axis a... | [
"def",
"coord_map",
"(",
"fn",
")",
":",
"if",
"fn",
".",
"type_name",
"in",
"[",
"'Convolution'",
",",
"'Pooling'",
",",
"'Im2col'",
"]",
":",
"axis",
",",
"stride",
",",
"ks",
",",
"pad",
"=",
"conv_params",
"(",
"fn",
")",
"return",
"axis",
",",
... | https://github.com/lmb-freiburg/flownet2/blob/b92e198b56b0e52e1ba0a5a98dc0e39fa5ae70cc/python/caffe/coord_map.py#L57-L79 | ||
openvinotoolkit/openvino | dedcbeafa8b84cccdc55ca64b8da516682b381c7 | cmake/developer_package/cpplint/cpplint.py | python | ProcessConfigOverrides | (filename) | return True | Loads the configuration files and processes the config overrides.
Args:
filename: The name of the file being processed by the linter.
Returns:
False if the current |filename| should not be processed further. | Loads the configuration files and processes the config overrides. | [
"Loads",
"the",
"configuration",
"files",
"and",
"processes",
"the",
"config",
"overrides",
"."
] | def ProcessConfigOverrides(filename):
""" Loads the configuration files and processes the config overrides.
Args:
filename: The name of the file being processed by the linter.
Returns:
False if the current |filename| should not be processed further.
"""
abs_filename = os.path.abspath(filename)
... | [
"def",
"ProcessConfigOverrides",
"(",
"filename",
")",
":",
"abs_filename",
"=",
"os",
".",
"path",
".",
"abspath",
"(",
"filename",
")",
"cfg_filters",
"=",
"[",
"]",
"keep_looking",
"=",
"True",
"while",
"keep_looking",
":",
"abs_path",
",",
"base_name",
"... | https://github.com/openvinotoolkit/openvino/blob/dedcbeafa8b84cccdc55ca64b8da516682b381c7/cmake/developer_package/cpplint/cpplint.py#L6232-L6316 | |
krishauser/Klampt | 972cc83ea5befac3f653c1ba20f80155768ad519 | Python/klampt/src/robotsim.py | python | Mass.getMass | (self) | return _robotsim.Mass_getMass(self) | r"""
getMass(Mass self) -> double | r"""
getMass(Mass self) -> double | [
"r",
"getMass",
"(",
"Mass",
"self",
")",
"-",
">",
"double"
] | def getMass(self) -> "double":
r"""
getMass(Mass self) -> double
"""
return _robotsim.Mass_getMass(self) | [
"def",
"getMass",
"(",
"self",
")",
"->",
"\"double\"",
":",
"return",
"_robotsim",
".",
"Mass_getMass",
"(",
"self",
")"
] | https://github.com/krishauser/Klampt/blob/972cc83ea5befac3f653c1ba20f80155768ad519/Python/klampt/src/robotsim.py#L3898-L3904 | |
mindspore-ai/mindspore | fb8fd3338605bb34fa5cea054e535a8b1d753fab | mindspore/python/mindspore/scipy/linalg.py | python | block_diag | (*arrs) | return accum | Create a block diagonal matrix from provided arrays.
Given the list of Tensors `A`, `B`, and `C`, the output will have these
Tensors arranged on the diagonal:
.. code-block::
[[A, 0, 0],
[0, B, 0],
[0, 0, C]]
Args:
arrs (list): up to 2-D Input Tensors.
A... | Create a block diagonal matrix from provided arrays. | [
"Create",
"a",
"block",
"diagonal",
"matrix",
"from",
"provided",
"arrays",
"."
] | def block_diag(*arrs):
"""
Create a block diagonal matrix from provided arrays.
Given the list of Tensors `A`, `B`, and `C`, the output will have these
Tensors arranged on the diagonal:
.. code-block::
[[A, 0, 0],
[0, B, 0],
[0, 0, C]]
Args:
arrs (list): up ... | [
"def",
"block_diag",
"(",
"*",
"arrs",
")",
":",
"if",
"not",
"arrs",
":",
"return",
"mnp",
".",
"zeros",
"(",
"(",
"1",
",",
"0",
")",
")",
"bad_shapes",
"=",
"[",
"i",
"for",
"i",
",",
"a",
"in",
"enumerate",
"(",
"arrs",
")",
"if",
"a",
".... | https://github.com/mindspore-ai/mindspore/blob/fb8fd3338605bb34fa5cea054e535a8b1d753fab/mindspore/python/mindspore/scipy/linalg.py#L33-L96 | |
bigartm/bigartm | 47e37f982de87aa67bfd475ff1f39da696b181b3 | utils/cpplint.py | python | _CppLintState.RestoreFilters | (self) | Restores filters previously backed up. | Restores filters previously backed up. | [
"Restores",
"filters",
"previously",
"backed",
"up",
"."
] | def RestoreFilters(self):
""" Restores filters previously backed up."""
self.filters = self._filters_backup[:] | [
"def",
"RestoreFilters",
"(",
"self",
")",
":",
"self",
".",
"filters",
"=",
"self",
".",
"_filters_backup",
"[",
":",
"]"
] | https://github.com/bigartm/bigartm/blob/47e37f982de87aa67bfd475ff1f39da696b181b3/utils/cpplint.py#L822-L824 | ||
hpi-xnor/BMXNet | ed0b201da6667887222b8e4b5f997c4f6b61943d | python/mxnet/ndarray/ndarray.py | python | _get_indexing_dispatch_code | (key) | Returns a dispatch code for calling basic or advanced indexing functions. | Returns a dispatch code for calling basic or advanced indexing functions. | [
"Returns",
"a",
"dispatch",
"code",
"for",
"calling",
"basic",
"or",
"advanced",
"indexing",
"functions",
"."
] | def _get_indexing_dispatch_code(key):
"""Returns a dispatch code for calling basic or advanced indexing functions."""
if isinstance(key, (NDArray, np.ndarray)):
return _NDARRAY_ADVANCED_INDEXING
elif isinstance(key, list):
# TODO(junwu): Add support for nested lists besides integer list
... | [
"def",
"_get_indexing_dispatch_code",
"(",
"key",
")",
":",
"if",
"isinstance",
"(",
"key",
",",
"(",
"NDArray",
",",
"np",
".",
"ndarray",
")",
")",
":",
"return",
"_NDARRAY_ADVANCED_INDEXING",
"elif",
"isinstance",
"(",
"key",
",",
"list",
")",
":",
"# T... | https://github.com/hpi-xnor/BMXNet/blob/ed0b201da6667887222b8e4b5f997c4f6b61943d/python/mxnet/ndarray/ndarray.py#L2019-L2042 | ||
emscripten-core/emscripten | 0d413d3c5af8b28349682496edc14656f5700c2f | third_party/WebIDL.py | python | Parser.p_ConstValueInteger | (self, p) | ConstValue : INTEGER | ConstValue : INTEGER | [
"ConstValue",
":",
"INTEGER"
] | def p_ConstValueInteger(self, p):
"""
ConstValue : INTEGER
"""
location = self.getLocation(p, 1)
# We don't know ahead of time what type the integer literal is.
# Determine the smallest type it could possibly fit in and use that.
integerType = matchIntegerVal... | [
"def",
"p_ConstValueInteger",
"(",
"self",
",",
"p",
")",
":",
"location",
"=",
"self",
".",
"getLocation",
"(",
"p",
",",
"1",
")",
"# We don't know ahead of time what type the integer literal is.",
"# Determine the smallest type it could possibly fit in and use that.",
"int... | https://github.com/emscripten-core/emscripten/blob/0d413d3c5af8b28349682496edc14656f5700c2f/third_party/WebIDL.py#L3998-L4010 | ||
tensorflow/tensorflow | 419e3a6b650ea4bd1b0cba23c4348f8a69f3272e | tensorflow/python/ops/linalg/linear_operator_circulant.py | python | _BaseLinearOperatorCirculant._vectorize_then_blockify | (self, matrix) | return array_ops.reshape(vec, final_shape) | Shape batch matrix to batch vector, then blockify trailing dimensions. | Shape batch matrix to batch vector, then blockify trailing dimensions. | [
"Shape",
"batch",
"matrix",
"to",
"batch",
"vector",
"then",
"blockify",
"trailing",
"dimensions",
"."
] | def _vectorize_then_blockify(self, matrix):
"""Shape batch matrix to batch vector, then blockify trailing dimensions."""
# Suppose
# matrix.shape = [m0, m1, m2, m3],
# and matrix is a matrix because the final two dimensions are matrix dims.
# self.block_depth = 2,
# self.block_shape = [b0,... | [
"def",
"_vectorize_then_blockify",
"(",
"self",
",",
"matrix",
")",
":",
"# Suppose",
"# matrix.shape = [m0, m1, m2, m3],",
"# and matrix is a matrix because the final two dimensions are matrix dims.",
"# self.block_depth = 2,",
"# self.block_shape = [b0, b1] (note b0 * b1 = m2).",
... | https://github.com/tensorflow/tensorflow/blob/419e3a6b650ea4bd1b0cba23c4348f8a69f3272e/tensorflow/python/ops/linalg/linear_operator_circulant.py#L200-L228 | |
mantidproject/mantid | 03deeb89254ec4289edb8771e0188c2090a02f32 | scripts/Inelastic/CrystalField/fitting.py | python | CrystalField.Ion | (self, value) | Set new value of Ion attribute. For example:
cf = CrystalField(...)
...
cf.Ion = 'Pr' | Set new value of Ion attribute. For example: | [
"Set",
"new",
"value",
"of",
"Ion",
"attribute",
".",
"For",
"example",
":"
] | def Ion(self, value):
"""Set new value of Ion attribute. For example:
cf = CrystalField(...)
...
cf.Ion = 'Pr'
"""
self._nre = ionname2Nre(value)
self.crystalFieldFunction.setAttributeValue('Ion', value)
self._dirty_eigensystem = True
self._dirty_... | [
"def",
"Ion",
"(",
"self",
",",
"value",
")",
":",
"self",
".",
"_nre",
"=",
"ionname2Nre",
"(",
"value",
")",
"self",
".",
"crystalFieldFunction",
".",
"setAttributeValue",
"(",
"'Ion'",
",",
"value",
")",
"self",
".",
"_dirty_eigensystem",
"=",
"True",
... | https://github.com/mantidproject/mantid/blob/03deeb89254ec4289edb8771e0188c2090a02f32/scripts/Inelastic/CrystalField/fitting.py#L355-L365 | ||
FEniCS/dolfinx | 3dfdf038cccdb70962865b58a63bf29c2e55ec6e | python/dolfinx/fem/bcs.py | python | DirichletBCMetaClass.g | (self) | return self.value | The boundary condition value(s) | The boundary condition value(s) | [
"The",
"boundary",
"condition",
"value",
"(",
"s",
")"
] | def g(self):
"""The boundary condition value(s)"""
return self.value | [
"def",
"g",
"(",
"self",
")",
":",
"return",
"self",
".",
"value"
] | https://github.com/FEniCS/dolfinx/blob/3dfdf038cccdb70962865b58a63bf29c2e55ec6e/python/dolfinx/fem/bcs.py#L143-L145 | |
catboost/catboost | 167f64f237114a4d10b2b4ee42adb4569137debe | contrib/python/setuptools/py3/setuptools/_vendor/more_itertools/more.py | python | all_unique | (iterable, key=None) | return True | Returns ``True`` if all the elements of *iterable* are unique (no two
elements are equal).
>>> all_unique('ABCB')
False
If a *key* function is specified, it will be used to make comparisons.
>>> all_unique('ABCb')
True
>>> all_unique('ABCb', str.lower)
False
... | Returns ``True`` if all the elements of *iterable* are unique (no two
elements are equal). | [
"Returns",
"True",
"if",
"all",
"the",
"elements",
"of",
"*",
"iterable",
"*",
"are",
"unique",
"(",
"no",
"two",
"elements",
"are",
"equal",
")",
"."
] | def all_unique(iterable, key=None):
"""
Returns ``True`` if all the elements of *iterable* are unique (no two
elements are equal).
>>> all_unique('ABCB')
False
If a *key* function is specified, it will be used to make comparisons.
>>> all_unique('ABCb')
True
>>... | [
"def",
"all_unique",
"(",
"iterable",
",",
"key",
"=",
"None",
")",
":",
"seenset",
"=",
"set",
"(",
")",
"seenset_add",
"=",
"seenset",
".",
"add",
"seenlist",
"=",
"[",
"]",
"seenlist_add",
"=",
"seenlist",
".",
"append",
"for",
"element",
"in",
"map... | https://github.com/catboost/catboost/blob/167f64f237114a4d10b2b4ee42adb4569137debe/contrib/python/setuptools/py3/setuptools/_vendor/more_itertools/more.py#L3564-L3596 | |
catboost/catboost | 167f64f237114a4d10b2b4ee42adb4569137debe | contrib/python/scikit-learn/py3/sklearn/neural_network/_base.py | python | inplace_tanh_derivative | (Z, delta) | Apply the derivative of the hyperbolic tanh function.
It exploits the fact that the derivative is a simple function of the output
value from hyperbolic tangent.
Parameters
----------
Z : {array-like, sparse matrix}, shape (n_samples, n_features)
The data which was output from the hyperboli... | Apply the derivative of the hyperbolic tanh function. | [
"Apply",
"the",
"derivative",
"of",
"the",
"hyperbolic",
"tanh",
"function",
"."
] | def inplace_tanh_derivative(Z, delta):
"""Apply the derivative of the hyperbolic tanh function.
It exploits the fact that the derivative is a simple function of the output
value from hyperbolic tangent.
Parameters
----------
Z : {array-like, sparse matrix}, shape (n_samples, n_features)
... | [
"def",
"inplace_tanh_derivative",
"(",
"Z",
",",
"delta",
")",
":",
"delta",
"*=",
"(",
"1",
"-",
"Z",
"**",
"2",
")"
] | https://github.com/catboost/catboost/blob/167f64f237114a4d10b2b4ee42adb4569137debe/contrib/python/scikit-learn/py3/sklearn/neural_network/_base.py#L137-L152 | ||
Xilinx/Vitis-AI | fc74d404563d9951b57245443c73bef389f3657f | tools/Vitis-AI-Quantizer/vai_q_tensorflow1.x/tensorflow/python/distribute/all_reduce.py | python | _build_shuffle_hybrid | (input_tensors, gather_devices, red_op, upper_level_f) | return output_tensors | Construct a subgraph for Shuffle hybrid all-reduce.
Args:
input_tensors: list of T `tf.Tensor` of same-shape and type values to
be reduced.
gather_devices: list of device names on which to host gather shards.
red_op: binary elementwise reduction operator.
upper_level_f: function for reducing on... | Construct a subgraph for Shuffle hybrid all-reduce. | [
"Construct",
"a",
"subgraph",
"for",
"Shuffle",
"hybrid",
"all",
"-",
"reduce",
"."
] | def _build_shuffle_hybrid(input_tensors, gather_devices, red_op, upper_level_f):
"""Construct a subgraph for Shuffle hybrid all-reduce.
Args:
input_tensors: list of T `tf.Tensor` of same-shape and type values to
be reduced.
gather_devices: list of device names on which to host gather shards.
red_... | [
"def",
"_build_shuffle_hybrid",
"(",
"input_tensors",
",",
"gather_devices",
",",
"red_op",
",",
"upper_level_f",
")",
":",
"input_tensors",
",",
"shape",
"=",
"_flatten_tensors",
"(",
"input_tensors",
")",
"# First stage, reduce across each worker using gather_devices.",
"... | https://github.com/Xilinx/Vitis-AI/blob/fc74d404563d9951b57245443c73bef389f3657f/tools/Vitis-AI-Quantizer/vai_q_tensorflow1.x/tensorflow/python/distribute/all_reduce.py#L797-L836 | |
baidu-research/tensorflow-allreduce | 66d5b855e90b0949e9fa5cca5599fd729a70e874 | tensorflow/python/framework/ops.py | python | register_tensor_conversion_function | (base_type, conversion_func,
priority=100) | Registers a function for converting objects of `base_type` to `Tensor`.
The conversion function must have the following signature:
```python
def conversion_func(value, dtype=None, name=None, as_ref=False):
# ...
```
It must return a `Tensor` with the given `dtype` if specified. If the
convers... | Registers a function for converting objects of `base_type` to `Tensor`. | [
"Registers",
"a",
"function",
"for",
"converting",
"objects",
"of",
"base_type",
"to",
"Tensor",
"."
] | def register_tensor_conversion_function(base_type, conversion_func,
priority=100):
"""Registers a function for converting objects of `base_type` to `Tensor`.
The conversion function must have the following signature:
```python
def conversion_func(value, dtype=None, ... | [
"def",
"register_tensor_conversion_function",
"(",
"base_type",
",",
"conversion_func",
",",
"priority",
"=",
"100",
")",
":",
"if",
"not",
"(",
"isinstance",
"(",
"base_type",
",",
"type",
")",
"or",
"(",
"isinstance",
"(",
"base_type",
",",
"tuple",
")",
"... | https://github.com/baidu-research/tensorflow-allreduce/blob/66d5b855e90b0949e9fa5cca5599fd729a70e874/tensorflow/python/framework/ops.py#L902-L955 | ||
microsoft/clang | 86d4513d3e0daa4d5a29b0b1de7c854ca15f9fe5 | tools/scan-build-py/libscanbuild/arguments.py | python | parse_args_for_scan_build | () | return args | Parse and validate command-line arguments for scan-build. | Parse and validate command-line arguments for scan-build. | [
"Parse",
"and",
"validate",
"command",
"-",
"line",
"arguments",
"for",
"scan",
"-",
"build",
"."
] | def parse_args_for_scan_build():
""" Parse and validate command-line arguments for scan-build. """
from_build_command = True
parser = create_analyze_parser(from_build_command)
args = parser.parse_args()
reconfigure_logging(args.verbose)
logging.debug('Raw arguments %s', sys.argv)
normaliz... | [
"def",
"parse_args_for_scan_build",
"(",
")",
":",
"from_build_command",
"=",
"True",
"parser",
"=",
"create_analyze_parser",
"(",
"from_build_command",
")",
"args",
"=",
"parser",
".",
"parse_args",
"(",
")",
"reconfigure_logging",
"(",
"args",
".",
"verbose",
")... | https://github.com/microsoft/clang/blob/86d4513d3e0daa4d5a29b0b1de7c854ca15f9fe5/tools/scan-build-py/libscanbuild/arguments.py#L61-L74 | |
apache/incubator-mxnet | f03fb23f1d103fec9541b5ae59ee06b1734a51d9 | python/mxnet/gluon/model_zoo/vision/mobilenet.py | python | mobilenet1_0 | (**kwargs) | return get_mobilenet(1.0, **kwargs) | r"""MobileNet model from the
`"MobileNets: Efficient Convolutional Neural Networks for Mobile Vision Applications"
<https://arxiv.org/abs/1704.04861>`_ paper, with width multiplier 1.0.
Parameters
----------
pretrained : bool, default False
Whether to load the pretrained weights for model.
... | r"""MobileNet model from the
`"MobileNets: Efficient Convolutional Neural Networks for Mobile Vision Applications"
<https://arxiv.org/abs/1704.04861>`_ paper, with width multiplier 1.0. | [
"r",
"MobileNet",
"model",
"from",
"the",
"MobileNets",
":",
"Efficient",
"Convolutional",
"Neural",
"Networks",
"for",
"Mobile",
"Vision",
"Applications",
"<https",
":",
"//",
"arxiv",
".",
"org",
"/",
"abs",
"/",
"1704",
".",
"04861",
">",
"_",
"paper",
... | def mobilenet1_0(**kwargs):
r"""MobileNet model from the
`"MobileNets: Efficient Convolutional Neural Networks for Mobile Vision Applications"
<https://arxiv.org/abs/1704.04861>`_ paper, with width multiplier 1.0.
Parameters
----------
pretrained : bool, default False
Whether to load th... | [
"def",
"mobilenet1_0",
"(",
"*",
"*",
"kwargs",
")",
":",
"return",
"get_mobilenet",
"(",
"1.0",
",",
"*",
"*",
"kwargs",
")"
] | https://github.com/apache/incubator-mxnet/blob/f03fb23f1d103fec9541b5ae59ee06b1734a51d9/python/mxnet/gluon/model_zoo/vision/mobilenet.py#L256-L268 | |
pytorch/pytorch | 7176c92687d3cc847cc046bf002269c6949a21c2 | caffe2/python/core.py | python | CreatePythonOperator | (
f, inputs,
outputs,
grad_f=None,
pass_workspace=False,
python_func_type=None,
*args,
**kwargs
) | return CreateOperator("Python", inputs, outputs, *args, **kwargs) | `f` should have a signature (inputs, outputs)
If `pass_workspace` is True, the signature is changed to
(inputs, outputs, workspace) where `workspace` is the workspace the op
is going to run on. This is potentially dangerous (as the op can manipulate
the workspace directly), use on your own risk. | `f` should have a signature (inputs, outputs) | [
"f",
"should",
"have",
"a",
"signature",
"(",
"inputs",
"outputs",
")"
] | def CreatePythonOperator(
f, inputs,
outputs,
grad_f=None,
pass_workspace=False,
python_func_type=None,
*args,
**kwargs
):
"""
`f` should have a signature (inputs, outputs)
If `pass_workspace` is True, the signature is changed to
(inputs, outputs, workspace) where `workspace... | [
"def",
"CreatePythonOperator",
"(",
"f",
",",
"inputs",
",",
"outputs",
",",
"grad_f",
"=",
"None",
",",
"pass_workspace",
"=",
"False",
",",
"python_func_type",
"=",
"None",
",",
"*",
"args",
",",
"*",
"*",
"kwargs",
")",
":",
"kwargs",
"[",
"\"token\""... | https://github.com/pytorch/pytorch/blob/7176c92687d3cc847cc046bf002269c6949a21c2/caffe2/python/core.py#L445-L465 | |
catboost/catboost | 167f64f237114a4d10b2b4ee42adb4569137debe | contrib/tools/python3/src/Lib/smtplib.py | python | SMTP.mail | (self, sender, options=()) | return self.getreply() | SMTP 'mail' command -- begins mail xfer session.
This method may raise the following exceptions:
SMTPNotSupportedError The options parameter includes 'SMTPUTF8'
but the SMTPUTF8 extension is not supported by
the server. | SMTP 'mail' command -- begins mail xfer session. | [
"SMTP",
"mail",
"command",
"--",
"begins",
"mail",
"xfer",
"session",
"."
] | def mail(self, sender, options=()):
"""SMTP 'mail' command -- begins mail xfer session.
This method may raise the following exceptions:
SMTPNotSupportedError The options parameter includes 'SMTPUTF8'
but the SMTPUTF8 extension is not supported by
... | [
"def",
"mail",
"(",
"self",
",",
"sender",
",",
"options",
"=",
"(",
")",
")",
":",
"optionlist",
"=",
"''",
"if",
"options",
"and",
"self",
".",
"does_esmtp",
":",
"if",
"any",
"(",
"x",
".",
"lower",
"(",
")",
"==",
"'smtputf8'",
"for",
"x",
"i... | https://github.com/catboost/catboost/blob/167f64f237114a4d10b2b4ee42adb4569137debe/contrib/tools/python3/src/Lib/smtplib.py#L527-L546 | |
gnuradio/gnuradio | 09c3c4fa4bfb1a02caac74cb5334dfe065391e3b | tools/clang_format.py | python | Repo.get_working_tree_candidates | (self) | return valid_files | Get the set of candidate files to check by querying the repository
Returns the full path to the file for clang-format to consume. | Get the set of candidate files to check by querying the repository | [
"Get",
"the",
"set",
"of",
"candidate",
"files",
"to",
"check",
"by",
"querying",
"the",
"repository"
] | def get_working_tree_candidates(self):
"""Get the set of candidate files to check by querying the repository
Returns the full path to the file for clang-format to consume.
"""
valid_files = list(self.get_working_tree_candidate_files())
# Get the full file name here
vali... | [
"def",
"get_working_tree_candidates",
"(",
"self",
")",
":",
"valid_files",
"=",
"list",
"(",
"self",
".",
"get_working_tree_candidate_files",
"(",
")",
")",
"# Get the full file name here",
"valid_files",
"=",
"[",
"os",
".",
"path",
".",
"normpath",
"(",
"os",
... | https://github.com/gnuradio/gnuradio/blob/09c3c4fa4bfb1a02caac74cb5334dfe065391e3b/tools/clang_format.py#L394-L406 | |
microsoft/CNTK | e9396480025b9ca457d26b6f33dd07c474c6aa04 | bindings/python/cntk/ops/__init__.py | python | element_and | (x, y, name='') | return element_and(x, y, name) | Computes the element-wise logic AND of ``x``.
Example:
>>> C.element_and([1, 1, 0, 0], [1, 0, 1, 0]).eval()
array([ 1., 0., 0., 0.], dtype=float32)
Args:
x: numpy array or any :class:`~cntk.ops.functions.Function` that outputs a tensor
name (str, optional): the name of the F... | Computes the element-wise logic AND of ``x``. | [
"Computes",
"the",
"element",
"-",
"wise",
"logic",
"AND",
"of",
"x",
"."
] | def element_and(x, y, name=''):
'''
Computes the element-wise logic AND of ``x``.
Example:
>>> C.element_and([1, 1, 0, 0], [1, 0, 1, 0]).eval()
array([ 1., 0., 0., 0.], dtype=float32)
Args:
x: numpy array or any :class:`~cntk.ops.functions.Function` that outputs a tensor
... | [
"def",
"element_and",
"(",
"x",
",",
"y",
",",
"name",
"=",
"''",
")",
":",
"from",
"cntk",
".",
"cntk_py",
"import",
"element_and",
"x",
"=",
"sanitize_input",
"(",
"x",
")",
"y",
"=",
"sanitize_input",
"(",
"y",
")",
"return",
"element_and",
"(",
"... | https://github.com/microsoft/CNTK/blob/e9396480025b9ca457d26b6f33dd07c474c6aa04/bindings/python/cntk/ops/__init__.py#L2145-L2162 | |
aws/lumberyard | f85344403c1c2e77ec8c75deb2c116e97b713217 | dev/Tools/Python/3.7.10/windows/Lib/site-packages/pip/_internal/cache.py | python | _hash_dict | (d) | return hashlib.sha224(s.encode("ascii")).hexdigest() | Return a stable sha224 of a dictionary. | Return a stable sha224 of a dictionary. | [
"Return",
"a",
"stable",
"sha224",
"of",
"a",
"dictionary",
"."
] | def _hash_dict(d):
# type: (Dict[str, str]) -> str
"""Return a stable sha224 of a dictionary."""
s = json.dumps(d, sort_keys=True, separators=(",", ":"), ensure_ascii=True)
return hashlib.sha224(s.encode("ascii")).hexdigest() | [
"def",
"_hash_dict",
"(",
"d",
")",
":",
"# type: (Dict[str, str]) -> str",
"s",
"=",
"json",
".",
"dumps",
"(",
"d",
",",
"sort_keys",
"=",
"True",
",",
"separators",
"=",
"(",
"\",\"",
",",
"\":\"",
")",
",",
"ensure_ascii",
"=",
"True",
")",
"return",... | https://github.com/aws/lumberyard/blob/f85344403c1c2e77ec8c75deb2c116e97b713217/dev/Tools/Python/3.7.10/windows/Lib/site-packages/pip/_internal/cache.py#L29-L33 | |
wxWidgets/wxPython-Classic | 19571e1ae65f1ac445f5491474121998c97a1bf0 | src/msw/_core.py | python | StdDialogButtonSizer.SetAffirmativeButton | (*args, **kwargs) | return _core_.StdDialogButtonSizer_SetAffirmativeButton(*args, **kwargs) | SetAffirmativeButton(self, wxButton button) | SetAffirmativeButton(self, wxButton button) | [
"SetAffirmativeButton",
"(",
"self",
"wxButton",
"button",
")"
] | def SetAffirmativeButton(*args, **kwargs):
"""SetAffirmativeButton(self, wxButton button)"""
return _core_.StdDialogButtonSizer_SetAffirmativeButton(*args, **kwargs) | [
"def",
"SetAffirmativeButton",
"(",
"*",
"args",
",",
"*",
"*",
"kwargs",
")",
":",
"return",
"_core_",
".",
"StdDialogButtonSizer_SetAffirmativeButton",
"(",
"*",
"args",
",",
"*",
"*",
"kwargs",
")"
] | https://github.com/wxWidgets/wxPython-Classic/blob/19571e1ae65f1ac445f5491474121998c97a1bf0/src/msw/_core.py#L15512-L15514 | |
intel-iot-devkit/how-to-code-samples | b4ea616f36bbfa2e042beb1698f968cfd651d79f | color-match-game/python/iot_color_match_game/hardware/grove.py | python | GroveBoard.change_background | (self, color) | Change LCD screen background color. | Change LCD screen background color. | [
"Change",
"LCD",
"screen",
"background",
"color",
"."
] | def change_background(self, color):
"""
Change LCD screen background color.
"""
colors = {
"red": lambda: self.screen.setColor(255, 0, 0),
"purple": lambda: self.screen.setColor(255, 0, 255),
"blue": lambda: self.screen.setColor(0, 0, 255),
... | [
"def",
"change_background",
"(",
"self",
",",
"color",
")",
":",
"colors",
"=",
"{",
"\"red\"",
":",
"lambda",
":",
"self",
".",
"screen",
".",
"setColor",
"(",
"255",
",",
"0",
",",
"0",
")",
",",
"\"purple\"",
":",
"lambda",
":",
"self",
".",
"sc... | https://github.com/intel-iot-devkit/how-to-code-samples/blob/b4ea616f36bbfa2e042beb1698f968cfd651d79f/color-match-game/python/iot_color_match_game/hardware/grove.py#L70-L84 | ||
wlanjie/AndroidFFmpeg | 7baf9122f4b8e1c74e7baf4be5c422c7a5ba5aaf | tools/fdk-aac-build/armeabi-v7a/toolchain/lib/python2.7/threading.py | python | Thread.name | (self) | return self.__name | A string used for identification purposes only.
It has no semantics. Multiple threads may be given the same name. The
initial name is set by the constructor. | A string used for identification purposes only. | [
"A",
"string",
"used",
"for",
"identification",
"purposes",
"only",
"."
] | def name(self):
"""A string used for identification purposes only.
It has no semantics. Multiple threads may be given the same name. The
initial name is set by the constructor.
"""
assert self.__initialized, "Thread.__init__() not called"
return self.__name | [
"def",
"name",
"(",
"self",
")",
":",
"assert",
"self",
".",
"__initialized",
",",
"\"Thread.__init__() not called\"",
"return",
"self",
".",
"__name"
] | https://github.com/wlanjie/AndroidFFmpeg/blob/7baf9122f4b8e1c74e7baf4be5c422c7a5ba5aaf/tools/fdk-aac-build/armeabi-v7a/toolchain/lib/python2.7/threading.py#L966-L974 | |
jackaudio/jack2 | 21b293dbc37d42446141a08922cdec0d2550c6a0 | waflib/Build.py | python | BuildContext.execute | (self) | Restore data from previous builds and call :py:meth:`waflib.Build.BuildContext.execute_build`.
Overrides from :py:func:`waflib.Context.Context.execute` | Restore data from previous builds and call :py:meth:`waflib.Build.BuildContext.execute_build`.
Overrides from :py:func:`waflib.Context.Context.execute` | [
"Restore",
"data",
"from",
"previous",
"builds",
"and",
"call",
":",
"py",
":",
"meth",
":",
"waflib",
".",
"Build",
".",
"BuildContext",
".",
"execute_build",
".",
"Overrides",
"from",
":",
"py",
":",
"func",
":",
"waflib",
".",
"Context",
".",
"Context... | def execute(self):
"""
Restore data from previous builds and call :py:meth:`waflib.Build.BuildContext.execute_build`.
Overrides from :py:func:`waflib.Context.Context.execute`
"""
self.restore()
if not self.all_envs:
self.load_envs()
self.execute_build() | [
"def",
"execute",
"(",
"self",
")",
":",
"self",
".",
"restore",
"(",
")",
"if",
"not",
"self",
".",
"all_envs",
":",
"self",
".",
"load_envs",
"(",
")",
"self",
".",
"execute_build",
"(",
")"
] | https://github.com/jackaudio/jack2/blob/21b293dbc37d42446141a08922cdec0d2550c6a0/waflib/Build.py#L223-L231 | ||
catboost/catboost | 167f64f237114a4d10b2b4ee42adb4569137debe | contrib/python/numpy/py3/numpy/lib/arrayterator.py | python | Arrayterator.__array__ | (self) | return self.var[slice_] | Return corresponding data. | Return corresponding data. | [
"Return",
"corresponding",
"data",
"."
] | def __array__(self):
"""
Return corresponding data.
"""
slice_ = tuple(slice(*t) for t in zip(
self.start, self.stop, self.step))
return self.var[slice_] | [
"def",
"__array__",
"(",
"self",
")",
":",
"slice_",
"=",
"tuple",
"(",
"slice",
"(",
"*",
"t",
")",
"for",
"t",
"in",
"zip",
"(",
"self",
".",
"start",
",",
"self",
".",
"stop",
",",
"self",
".",
"step",
")",
")",
"return",
"self",
".",
"var",... | https://github.com/catboost/catboost/blob/167f64f237114a4d10b2b4ee42adb4569137debe/contrib/python/numpy/py3/numpy/lib/arrayterator.py#L127-L134 | |
mindspore-ai/mindspore | fb8fd3338605bb34fa5cea054e535a8b1d753fab | mindspore/python/mindspore/ops/operations/nn_ops.py | python | SigmoidCrossEntropyWithLogits.__init__ | (self) | Initialize SigmoidCrossEntropyWithLogits | Initialize SigmoidCrossEntropyWithLogits | [
"Initialize",
"SigmoidCrossEntropyWithLogits"
] | def __init__(self):
"""Initialize SigmoidCrossEntropyWithLogits"""
self.init_prim_io_names(inputs=['predict', 'target'], outputs=['loss']) | [
"def",
"__init__",
"(",
"self",
")",
":",
"self",
".",
"init_prim_io_names",
"(",
"inputs",
"=",
"[",
"'predict'",
",",
"'target'",
"]",
",",
"outputs",
"=",
"[",
"'loss'",
"]",
")"
] | https://github.com/mindspore-ai/mindspore/blob/fb8fd3338605bb34fa5cea054e535a8b1d753fab/mindspore/python/mindspore/ops/operations/nn_ops.py#L3788-L3790 | ||
windystrife/UnrealEngine_NVIDIAGameWorks | b50e6338a7c5b26374d66306ebc7807541ff815e | Engine/Extras/ThirdPartyNotUE/emsdk/Win64/python/2.7.5.3_64bit/Lib/site-packages/pip/vendor/distlib/_backport/shutil.py | python | _make_zipfile | (base_name, base_dir, verbose=0, dry_run=0, logger=None) | return zip_filename | Create a zip file from all the files under 'base_dir'.
The output zip file will be named 'base_name' + ".zip". Uses either the
"zipfile" Python module (if available) or the InfoZIP "zip" utility
(if installed and found on the default search path). If neither tool is
available, raises ExecError. Retu... | Create a zip file from all the files under 'base_dir'. | [
"Create",
"a",
"zip",
"file",
"from",
"all",
"the",
"files",
"under",
"base_dir",
"."
] | def _make_zipfile(base_name, base_dir, verbose=0, dry_run=0, logger=None):
"""Create a zip file from all the files under 'base_dir'.
The output zip file will be named 'base_name' + ".zip". Uses either the
"zipfile" Python module (if available) or the InfoZIP "zip" utility
(if installed and found on th... | [
"def",
"_make_zipfile",
"(",
"base_name",
",",
"base_dir",
",",
"verbose",
"=",
"0",
",",
"dry_run",
"=",
"0",
",",
"logger",
"=",
"None",
")",
":",
"zip_filename",
"=",
"base_name",
"+",
"\".zip\"",
"archive_dir",
"=",
"os",
".",
"path",
".",
"dirname",... | https://github.com/windystrife/UnrealEngine_NVIDIAGameWorks/blob/b50e6338a7c5b26374d66306ebc7807541ff815e/Engine/Extras/ThirdPartyNotUE/emsdk/Win64/python/2.7.5.3_64bit/Lib/site-packages/pip/vendor/distlib/_backport/shutil.py#L452-L497 | |
benoitsteiner/tensorflow-opencl | cb7cb40a57fde5cfd4731bc551e82a1e2fef43a5 | tensorflow/contrib/losses/python/losses/loss_ops.py | python | log_loss | (predictions, labels=None, weights=1.0, epsilon=1e-7, scope=None) | Adds a Log Loss term to the training procedure.
`weights` acts as a coefficient for the loss. If a scalar is provided, then
the loss is simply scaled by the given value. If `weights` is a tensor of size
[batch_size], then the total loss for each sample of the batch is rescaled
by the corresponding element in t... | Adds a Log Loss term to the training procedure. | [
"Adds",
"a",
"Log",
"Loss",
"term",
"to",
"the",
"training",
"procedure",
"."
] | def log_loss(predictions, labels=None, weights=1.0, epsilon=1e-7, scope=None):
"""Adds a Log Loss term to the training procedure.
`weights` acts as a coefficient for the loss. If a scalar is provided, then
the loss is simply scaled by the given value. If `weights` is a tensor of size
[batch_size], then the tot... | [
"def",
"log_loss",
"(",
"predictions",
",",
"labels",
"=",
"None",
",",
"weights",
"=",
"1.0",
",",
"epsilon",
"=",
"1e-7",
",",
"scope",
"=",
"None",
")",
":",
"with",
"ops",
".",
"name_scope",
"(",
"scope",
",",
"\"log_loss\"",
",",
"[",
"predictions... | https://github.com/benoitsteiner/tensorflow-opencl/blob/cb7cb40a57fde5cfd4731bc551e82a1e2fef43a5/tensorflow/contrib/losses/python/losses/loss_ops.py#L441-L476 | ||
windystrife/UnrealEngine_NVIDIAGameWorks | b50e6338a7c5b26374d66306ebc7807541ff815e | Engine/Extras/ThirdPartyNotUE/emsdk/Win64/python/2.7.5.3_64bit/Lib/site-packages/win32comext/axdebug/gateways.py | python | DebugDocumentText.GetContextOfPosition | (self, charPos, maxChars) | Params are integers.
Return value must be PyIDebugDocumentContext object | Params are integers.
Return value must be PyIDebugDocumentContext object | [
"Params",
"are",
"integers",
".",
"Return",
"value",
"must",
"be",
"PyIDebugDocumentContext",
"object"
] | def GetContextOfPosition(self, charPos, maxChars):
"""Params are integers.
Return value must be PyIDebugDocumentContext object
"""
print self
RaiseNotImpl("GetContextOfPosition") | [
"def",
"GetContextOfPosition",
"(",
"self",
",",
"charPos",
",",
"maxChars",
")",
":",
"print",
"self",
"RaiseNotImpl",
"(",
"\"GetContextOfPosition\"",
")"
] | https://github.com/windystrife/UnrealEngine_NVIDIAGameWorks/blob/b50e6338a7c5b26374d66306ebc7807541ff815e/Engine/Extras/ThirdPartyNotUE/emsdk/Win64/python/2.7.5.3_64bit/Lib/site-packages/win32comext/axdebug/gateways.py#L165-L170 | ||
simsong/bulk_extractor | 738911df22b7066ca9e1662f4131fb44090a4196 | python/module/bulkextractor.py | python | Session.featurefiles | (self) | return list(self._featurefiles) | Return the list of active feature files. | Return the list of active feature files. | [
"Return",
"the",
"list",
"of",
"active",
"feature",
"files",
"."
] | def featurefiles(self):
"""Return the list of active feature files."""
return list(self._featurefiles) | [
"def",
"featurefiles",
"(",
"self",
")",
":",
"return",
"list",
"(",
"self",
".",
"_featurefiles",
")"
] | https://github.com/simsong/bulk_extractor/blob/738911df22b7066ca9e1662f4131fb44090a4196/python/module/bulkextractor.py#L138-L140 | |
mindspore-ai/mindspore | fb8fd3338605bb34fa5cea054e535a8b1d753fab | mindspore/python/mindspore/numpy/math_ops.py | python | logaddexp | (x1, x2, dtype=None) | return _apply_tensor_op(_logaddexp, x1, x2, dtype=dtype) | Logarithm of the sum of exponentiations of the inputs.
Calculates ``log(exp(x1) + exp(x2))``. This function is useful in statistics where the
calculated probabilities of events may be so small as to exceed the range of normal
floating point numbers. In such cases the logarithm of the calculated probability... | Logarithm of the sum of exponentiations of the inputs. | [
"Logarithm",
"of",
"the",
"sum",
"of",
"exponentiations",
"of",
"the",
"inputs",
"."
] | def logaddexp(x1, x2, dtype=None):
"""
Logarithm of the sum of exponentiations of the inputs.
Calculates ``log(exp(x1) + exp(x2))``. This function is useful in statistics where the
calculated probabilities of events may be so small as to exceed the range of normal
floating point numbers. In such ca... | [
"def",
"logaddexp",
"(",
"x1",
",",
"x2",
",",
"dtype",
"=",
"None",
")",
":",
"def",
"_logaddexp",
"(",
"x1",
",",
"x2",
")",
":",
"return",
"F",
".",
"log",
"(",
"F",
".",
"tensor_add",
"(",
"F",
".",
"tensor_exp",
"(",
"x1",
")",
",",
"F",
... | https://github.com/mindspore-ai/mindspore/blob/fb8fd3338605bb34fa5cea054e535a8b1d753fab/mindspore/python/mindspore/numpy/math_ops.py#L3261-L3297 | |
aws/lumberyard | f85344403c1c2e77ec8c75deb2c116e97b713217 | dev/Gems/CloudGemFramework/v1/AWS/resource-manager-code/lib/setuptools/command/bdist_egg.py | python | walk_egg | (egg_dir) | Walk an unpacked egg's contents, skipping the metadata directory | Walk an unpacked egg's contents, skipping the metadata directory | [
"Walk",
"an",
"unpacked",
"egg",
"s",
"contents",
"skipping",
"the",
"metadata",
"directory"
] | def walk_egg(egg_dir):
"""Walk an unpacked egg's contents, skipping the metadata directory"""
walker = sorted_walk(egg_dir)
base, dirs, files = next(walker)
if 'EGG-INFO' in dirs:
dirs.remove('EGG-INFO')
yield base, dirs, files
for bdf in walker:
yield bdf | [
"def",
"walk_egg",
"(",
"egg_dir",
")",
":",
"walker",
"=",
"sorted_walk",
"(",
"egg_dir",
")",
"base",
",",
"dirs",
",",
"files",
"=",
"next",
"(",
"walker",
")",
"if",
"'EGG-INFO'",
"in",
"dirs",
":",
"dirs",
".",
"remove",
"(",
"'EGG-INFO'",
")",
... | https://github.com/aws/lumberyard/blob/f85344403c1c2e77ec8c75deb2c116e97b713217/dev/Gems/CloudGemFramework/v1/AWS/resource-manager-code/lib/setuptools/command/bdist_egg.py#L365-L373 | ||
wxWidgets/wxPython-Classic | 19571e1ae65f1ac445f5491474121998c97a1bf0 | src/msw/aui.py | python | AuiMDIChildFrame.__init__ | (self, *args, **kwargs) | __init__(self, AuiMDIParentFrame parent, int winid, String title,
Point pos=DefaultPosition, Size size=DefaultSize,
long style=DEFAULT_FRAME_STYLE, String name=wxFrameNameStr) -> AuiMDIChildFrame | __init__(self, AuiMDIParentFrame parent, int winid, String title,
Point pos=DefaultPosition, Size size=DefaultSize,
long style=DEFAULT_FRAME_STYLE, String name=wxFrameNameStr) -> AuiMDIChildFrame | [
"__init__",
"(",
"self",
"AuiMDIParentFrame",
"parent",
"int",
"winid",
"String",
"title",
"Point",
"pos",
"=",
"DefaultPosition",
"Size",
"size",
"=",
"DefaultSize",
"long",
"style",
"=",
"DEFAULT_FRAME_STYLE",
"String",
"name",
"=",
"wxFrameNameStr",
")",
"-",
... | def __init__(self, *args, **kwargs):
"""
__init__(self, AuiMDIParentFrame parent, int winid, String title,
Point pos=DefaultPosition, Size size=DefaultSize,
long style=DEFAULT_FRAME_STYLE, String name=wxFrameNameStr) -> AuiMDIChildFrame
"""
_aui.AuiMDIChildFram... | [
"def",
"__init__",
"(",
"self",
",",
"*",
"args",
",",
"*",
"*",
"kwargs",
")",
":",
"_aui",
".",
"AuiMDIChildFrame_swiginit",
"(",
"self",
",",
"_aui",
".",
"new_AuiMDIChildFrame",
"(",
"*",
"args",
",",
"*",
"*",
"kwargs",
")",
")",
"self",
".",
"_... | https://github.com/wxWidgets/wxPython-Classic/blob/19571e1ae65f1ac445f5491474121998c97a1bf0/src/msw/aui.py#L1509-L1516 | ||
giuspen/cherrytree | 84712f206478fcf9acf30174009ad28c648c6344 | pygtk2/modules/core.py | python | CherryTree.nodes_add_from_leo_file | (self, action) | Add Nodes Parsing a Leo File | Add Nodes Parsing a Leo File | [
"Add",
"Nodes",
"Parsing",
"a",
"Leo",
"File"
] | def nodes_add_from_leo_file(self, action):
"""Add Nodes Parsing a Leo File"""
filepath = support.dialog_file_select(filter_pattern=["*.leo"],
filter_name=_("Leo Document"),
curr_folder=self.pick_dir_import,
parent=self.window)
if not filepath: return
s... | [
"def",
"nodes_add_from_leo_file",
"(",
"self",
",",
"action",
")",
":",
"filepath",
"=",
"support",
".",
"dialog_file_select",
"(",
"filter_pattern",
"=",
"[",
"\"*.leo\"",
"]",
",",
"filter_name",
"=",
"_",
"(",
"\"Leo Document\"",
")",
",",
"curr_folder",
"=... | https://github.com/giuspen/cherrytree/blob/84712f206478fcf9acf30174009ad28c648c6344/pygtk2/modules/core.py#L1131-L1149 | ||
microsoft/TSS.MSR | 0f2516fca2cd9929c31d5450e39301c9bde43688 | TSS.Py/src/TpmTypes.py | python | TPM2_Commit_REQUEST.initFromTpm | (self, buf) | TpmMarshaller method | TpmMarshaller method | [
"TpmMarshaller",
"method"
] | def initFromTpm(self, buf):
""" TpmMarshaller method """
self.P1 = buf.createSizedObj(TPMS_ECC_POINT)
self.s2 = buf.readSizedByteBuf()
self.y2 = buf.readSizedByteBuf() | [
"def",
"initFromTpm",
"(",
"self",
",",
"buf",
")",
":",
"self",
".",
"P1",
"=",
"buf",
".",
"createSizedObj",
"(",
"TPMS_ECC_POINT",
")",
"self",
".",
"s2",
"=",
"buf",
".",
"readSizedByteBuf",
"(",
")",
"self",
".",
"y2",
"=",
"buf",
".",
"readSize... | https://github.com/microsoft/TSS.MSR/blob/0f2516fca2cd9929c31d5450e39301c9bde43688/TSS.Py/src/TpmTypes.py#L13277-L13281 | ||
kamyu104/LeetCode-Solutions | 77605708a927ea3b85aee5a479db733938c7c211 | Python/longest-common-subsequence-between-sorted-arrays.py | python | Solution.longestCommomSubsequence | (self, arrays) | return result | :type arrays: List[List[int]]
:rtype: List[int] | :type arrays: List[List[int]]
:rtype: List[int] | [
":",
"type",
"arrays",
":",
"List",
"[",
"List",
"[",
"int",
"]]",
":",
"rtype",
":",
"List",
"[",
"int",
"]"
] | def longestCommomSubsequence(self, arrays):
"""
:type arrays: List[List[int]]
:rtype: List[int]
"""
result = min(arrays, key=lambda x: len(x))
for arr in arrays:
new_result = []
i, j = 0, 0
while i != len(result) and j != len(arr):
... | [
"def",
"longestCommomSubsequence",
"(",
"self",
",",
"arrays",
")",
":",
"result",
"=",
"min",
"(",
"arrays",
",",
"key",
"=",
"lambda",
"x",
":",
"len",
"(",
"x",
")",
")",
"for",
"arr",
"in",
"arrays",
":",
"new_result",
"=",
"[",
"]",
"i",
",",
... | https://github.com/kamyu104/LeetCode-Solutions/blob/77605708a927ea3b85aee5a479db733938c7c211/Python/longest-common-subsequence-between-sorted-arrays.py#L5-L24 | |
hanpfei/chromium-net | 392cc1fa3a8f92f42e4071ab6e674d8e0482f83f | third_party/catapult/experimental/plot_bisect_results.py | python | _SavePlots | (results, file_path=None) | Saves histograms and empirial distribution plots showing the diff.
Args:
file_path: The location to save the plots go. | Saves histograms and empirial distribution plots showing the diff. | [
"Saves",
"histograms",
"and",
"empirial",
"distribution",
"plots",
"showing",
"the",
"diff",
"."
] | def _SavePlots(results, file_path=None):
"""Saves histograms and empirial distribution plots showing the diff.
Args:
file_path: The location to save the plots go.
"""
figsize = (_PLOT_WIDTH_INCHES * 2, _PLOT_HEIGHT_INCHES)
_, (axis0, axis1) = pyplot.subplots(nrows=1, ncols=2, figsize=figsize)
_DrawHis... | [
"def",
"_SavePlots",
"(",
"results",
",",
"file_path",
"=",
"None",
")",
":",
"figsize",
"=",
"(",
"_PLOT_WIDTH_INCHES",
"*",
"2",
",",
"_PLOT_HEIGHT_INCHES",
")",
"_",
",",
"(",
"axis0",
",",
"axis1",
")",
"=",
"pyplot",
".",
"subplots",
"(",
"nrows",
... | https://github.com/hanpfei/chromium-net/blob/392cc1fa3a8f92f42e4071ab6e674d8e0482f83f/third_party/catapult/experimental/plot_bisect_results.py#L59-L74 | ||
catboost/catboost | 167f64f237114a4d10b2b4ee42adb4569137debe | contrib/tools/python/src/Lib/distutils/sysconfig.py | python | get_python_version | () | return sys.version[:3] | Return a string containing the major and minor Python version,
leaving off the patchlevel. Sample return values could be '1.5'
or '2.2'. | Return a string containing the major and minor Python version,
leaving off the patchlevel. Sample return values could be '1.5'
or '2.2'. | [
"Return",
"a",
"string",
"containing",
"the",
"major",
"and",
"minor",
"Python",
"version",
"leaving",
"off",
"the",
"patchlevel",
".",
"Sample",
"return",
"values",
"could",
"be",
"1",
".",
"5",
"or",
"2",
".",
"2",
"."
] | def get_python_version():
"""Return a string containing the major and minor Python version,
leaving off the patchlevel. Sample return values could be '1.5'
or '2.2'.
"""
return sys.version[:3] | [
"def",
"get_python_version",
"(",
")",
":",
"return",
"sys",
".",
"version",
"[",
":",
"3",
"]"
] | https://github.com/catboost/catboost/blob/167f64f237114a4d10b2b4ee42adb4569137debe/contrib/tools/python/src/Lib/distutils/sysconfig.py#L58-L63 | |
Kitware/VTK | 5b4df4d90a4f31194d97d3c639dd38ea8f81e8b8 | Wrapping/Python/vtkmodules/tk/vtkTkRenderWidget.py | python | vtkTkRenderWidget.GetStillUpdateRate | (self) | return self._StillUpdateRate | Mirrors the method with the same name in
vtkRenderWindowInteractor. | Mirrors the method with the same name in
vtkRenderWindowInteractor. | [
"Mirrors",
"the",
"method",
"with",
"the",
"same",
"name",
"in",
"vtkRenderWindowInteractor",
"."
] | def GetStillUpdateRate(self):
"""Mirrors the method with the same name in
vtkRenderWindowInteractor."""
return self._StillUpdateRate | [
"def",
"GetStillUpdateRate",
"(",
"self",
")",
":",
"return",
"self",
".",
"_StillUpdateRate"
] | https://github.com/Kitware/VTK/blob/5b4df4d90a4f31194d97d3c639dd38ea8f81e8b8/Wrapping/Python/vtkmodules/tk/vtkTkRenderWidget.py#L205-L208 | |
wxWidgets/wxPython-Classic | 19571e1ae65f1ac445f5491474121998c97a1bf0 | wx/lib/sized_controls.py | python | SetSizerProps | (self, props={}, **kwargs) | Allows to set multiple sizer properties
:param props: a dictionary of prop name + value
:param kwargs: key words can be used for properties, e.g. expand=True | Allows to set multiple sizer properties | [
"Allows",
"to",
"set",
"multiple",
"sizer",
"properties"
] | def SetSizerProps(self, props={}, **kwargs):
"""
Allows to set multiple sizer properties
:param props: a dictionary of prop name + value
:param kwargs: key words can be used for properties, e.g. expand=True
"""
allprops = {}
allprops.update(props)
allprops.update(kwargs)
for p... | [
"def",
"SetSizerProps",
"(",
"self",
",",
"props",
"=",
"{",
"}",
",",
"*",
"*",
"kwargs",
")",
":",
"allprops",
"=",
"{",
"}",
"allprops",
".",
"update",
"(",
"props",
")",
"allprops",
".",
"update",
"(",
"kwargs",
")",
"for",
"prop",
"in",
"allpr... | https://github.com/wxWidgets/wxPython-Classic/blob/19571e1ae65f1ac445f5491474121998c97a1bf0/wx/lib/sized_controls.py#L407-L420 | ||
apiaryio/drafter | 4634ebd07f6c6f257cc656598ccd535492fdfb55 | tools/gyp/pylib/gyp/generator/ninja.py | python | Target.FinalOutput | (self) | return self.bundle or self.binary or self.actions_stamp | Return the last output of the target, which depends on all prior
steps. | Return the last output of the target, which depends on all prior
steps. | [
"Return",
"the",
"last",
"output",
"of",
"the",
"target",
"which",
"depends",
"on",
"all",
"prior",
"steps",
"."
] | def FinalOutput(self):
"""Return the last output of the target, which depends on all prior
steps."""
return self.bundle or self.binary or self.actions_stamp | [
"def",
"FinalOutput",
"(",
"self",
")",
":",
"return",
"self",
".",
"bundle",
"or",
"self",
".",
"binary",
"or",
"self",
".",
"actions_stamp"
] | https://github.com/apiaryio/drafter/blob/4634ebd07f6c6f257cc656598ccd535492fdfb55/tools/gyp/pylib/gyp/generator/ninja.py#L178-L181 | |
Samsung/veles | 95ed733c2e49bc011ad98ccf2416ecec23fbf352 | veles/external/pydot.py | python | Graph.get_edge | (self, src_or_list, dst=None) | return match | Retrieved an edge from the graph.
Given an edge's source and destination the corresponding
Edge instance(s) will be returned.
If one or more edges exist with that source and destination
a list of Edge instances is returned.
An empty list is returned otherwise. | Retrieved an edge from the graph.
Given an edge's source and destination the corresponding
Edge instance(s) will be returned.
If one or more edges exist with that source and destination
a list of Edge instances is returned.
An empty list is returned otherwise. | [
"Retrieved",
"an",
"edge",
"from",
"the",
"graph",
".",
"Given",
"an",
"edge",
"s",
"source",
"and",
"destination",
"the",
"corresponding",
"Edge",
"instance",
"(",
"s",
")",
"will",
"be",
"returned",
".",
"If",
"one",
"or",
"more",
"edges",
"exist",
"wi... | def get_edge(self, src_or_list, dst=None):
"""Retrieved an edge from the graph.
Given an edge's source and destination the corresponding
Edge instance(s) will be returned.
If one or more edges exist with that source and destination
a list of Edge instances is re... | [
"def",
"get_edge",
"(",
"self",
",",
"src_or_list",
",",
"dst",
"=",
"None",
")",
":",
"if",
"isinstance",
"(",
"src_or_list",
",",
"(",
"list",
",",
"tuple",
")",
")",
"and",
"dst",
"is",
"None",
":",
"edge_points",
"=",
"tuple",
"(",
"src_or_list",
... | https://github.com/Samsung/veles/blob/95ed733c2e49bc011ad98ccf2416ecec23fbf352/veles/external/pydot.py#L1424-L1454 | |
perilouswithadollarsign/cstrike15_src | f82112a2388b841d72cb62ca48ab1846dfcc11c8 | thirdparty/protobuf-2.5.0/python/google/protobuf/reflection.py | python | GeneratedProtocolMessageType.__new__ | (cls, name, bases, dictionary) | return new_class | Custom allocation for runtime-generated class types.
We override __new__ because this is apparently the only place
where we can meaningfully set __slots__ on the class we're creating(?).
(The interplay between metaclasses and slots is not very well-documented).
Args:
name: Name of the class (ign... | Custom allocation for runtime-generated class types. | [
"Custom",
"allocation",
"for",
"runtime",
"-",
"generated",
"class",
"types",
"."
] | def __new__(cls, name, bases, dictionary):
"""Custom allocation for runtime-generated class types.
We override __new__ because this is apparently the only place
where we can meaningfully set __slots__ on the class we're creating(?).
(The interplay between metaclasses and slots is not very well-document... | [
"def",
"__new__",
"(",
"cls",
",",
"name",
",",
"bases",
",",
"dictionary",
")",
":",
"descriptor",
"=",
"dictionary",
"[",
"GeneratedProtocolMessageType",
".",
"_DESCRIPTOR_KEY",
"]",
"bases",
"=",
"_NewMessage",
"(",
"bases",
",",
"descriptor",
",",
"diction... | https://github.com/perilouswithadollarsign/cstrike15_src/blob/f82112a2388b841d72cb62ca48ab1846dfcc11c8/thirdparty/protobuf-2.5.0/python/google/protobuf/reflection.py#L100-L127 | |
google/llvm-propeller | 45c226984fe8377ebfb2ad7713c680d652ba678d | lldb/examples/python/mach_o.py | python | TerminalColors.yellow | (self, fg=True) | return '' | Set the foreground or background color to yellow.
The foreground color will be set if "fg" tests True. The background color will be set if "fg" tests False. | Set the foreground or background color to yellow.
The foreground color will be set if "fg" tests True. The background color will be set if "fg" tests False. | [
"Set",
"the",
"foreground",
"or",
"background",
"color",
"to",
"yellow",
".",
"The",
"foreground",
"color",
"will",
"be",
"set",
"if",
"fg",
"tests",
"True",
".",
"The",
"background",
"color",
"will",
"be",
"set",
"if",
"fg",
"tests",
"False",
"."
] | def yellow(self, fg=True):
'''Set the foreground or background color to yellow.
The foreground color will be set if "fg" tests True. The background color will be set if "fg" tests False.'''
if self.enabled:
if fg:
return "\x1b[43m"
else:
re... | [
"def",
"yellow",
"(",
"self",
",",
"fg",
"=",
"True",
")",
":",
"if",
"self",
".",
"enabled",
":",
"if",
"fg",
":",
"return",
"\"\\x1b[43m\"",
"else",
":",
"return",
"\"\\x1b[33m\"",
"return",
"''"
] | https://github.com/google/llvm-propeller/blob/45c226984fe8377ebfb2ad7713c680d652ba678d/lldb/examples/python/mach_o.py#L301-L309 | |
openthread/openthread | 9fcdbed9c526c70f1556d1ed84099c1535c7cd32 | tools/otci/otci/otci.py | python | OTCI.enable_ipmaddr_promiscuous | (self) | Enable multicast promiscuous mode. | Enable multicast promiscuous mode. | [
"Enable",
"multicast",
"promiscuous",
"mode",
"."
] | def enable_ipmaddr_promiscuous(self):
"""Enable multicast promiscuous mode."""
self.execute_command('ipmaddr promiscuous enable') | [
"def",
"enable_ipmaddr_promiscuous",
"(",
"self",
")",
":",
"self",
".",
"execute_command",
"(",
"'ipmaddr promiscuous enable'",
")"
] | https://github.com/openthread/openthread/blob/9fcdbed9c526c70f1556d1ed84099c1535c7cd32/tools/otci/otci/otci.py#L1928-L1930 | ||
catboost/catboost | 167f64f237114a4d10b2b4ee42adb4569137debe | contrib/python/scikit-learn/py2/sklearn/decomposition/dict_learning.py | python | _sparse_encode | (X, dictionary, gram, cov=None, algorithm='lasso_lars',
regularization=None, copy_cov=True,
init=None, max_iter=1000, check_input=True, verbose=0) | return new_code | Generic sparse coding
Each column of the result is the solution to a Lasso problem.
Parameters
----------
X: array of shape (n_samples, n_features)
Data matrix.
dictionary: array of shape (n_components, n_features)
The dictionary matrix against which to solve the sparse coding of
... | Generic sparse coding | [
"Generic",
"sparse",
"coding"
] | def _sparse_encode(X, dictionary, gram, cov=None, algorithm='lasso_lars',
regularization=None, copy_cov=True,
init=None, max_iter=1000, check_input=True, verbose=0):
"""Generic sparse coding
Each column of the result is the solution to a Lasso problem.
Parameters
... | [
"def",
"_sparse_encode",
"(",
"X",
",",
"dictionary",
",",
"gram",
",",
"cov",
"=",
"None",
",",
"algorithm",
"=",
"'lasso_lars'",
",",
"regularization",
"=",
"None",
",",
"copy_cov",
"=",
"True",
",",
"init",
"=",
"None",
",",
"max_iter",
"=",
"1000",
... | https://github.com/catboost/catboost/blob/167f64f237114a4d10b2b4ee42adb4569137debe/contrib/python/scikit-learn/py2/sklearn/decomposition/dict_learning.py#L27-L157 | |
protocolbuffers/protobuf | b5ab0b7a18b7336c60130f4ddb2d97c51792f896 | python/google/protobuf/text_format.py | python | Tokenizer.TryConsume | (self, token) | return False | Tries to consume a given piece of text.
Args:
token: Text to consume.
Returns:
True iff the text was consumed. | Tries to consume a given piece of text. | [
"Tries",
"to",
"consume",
"a",
"given",
"piece",
"of",
"text",
"."
] | def TryConsume(self, token):
"""Tries to consume a given piece of text.
Args:
token: Text to consume.
Returns:
True iff the text was consumed.
"""
if self.token == token:
self.NextToken()
return True
return False | [
"def",
"TryConsume",
"(",
"self",
",",
"token",
")",
":",
"if",
"self",
".",
"token",
"==",
"token",
":",
"self",
".",
"NextToken",
"(",
")",
"return",
"True",
"return",
"False"
] | https://github.com/protocolbuffers/protobuf/blob/b5ab0b7a18b7336c60130f4ddb2d97c51792f896/python/google/protobuf/text_format.py#L1290-L1302 | |
wxWidgets/wxPython-Classic | 19571e1ae65f1ac445f5491474121998c97a1bf0 | wx/lib/agw/floatspin.py | python | FloatSpin.OnDestroy | (self, event) | Handles the ``wx.EVT_WINDOW_DESTROY`` event for :class:`FloatSpin`.
:param `event`: a :class:`WindowDestroyEvent` event to be processed.
:note: This method tries to correctly handle the control destruction under MSW. | Handles the ``wx.EVT_WINDOW_DESTROY`` event for :class:`FloatSpin`. | [
"Handles",
"the",
"wx",
".",
"EVT_WINDOW_DESTROY",
"event",
"for",
":",
"class",
":",
"FloatSpin",
"."
] | def OnDestroy(self, event):
"""
Handles the ``wx.EVT_WINDOW_DESTROY`` event for :class:`FloatSpin`.
:param `event`: a :class:`WindowDestroyEvent` event to be processed.
:note: This method tries to correctly handle the control destruction under MSW.
"""
# Null This Sinc... | [
"def",
"OnDestroy",
"(",
"self",
",",
"event",
")",
":",
"# Null This Since MSW Sends KILL_FOCUS On Deletion",
"if",
"self",
".",
"_textctrl",
":",
"self",
".",
"_textctrl",
".",
"_parent",
"=",
"None",
"self",
".",
"_textctrl",
".",
"Destroy",
"(",
")",
"self... | https://github.com/wxWidgets/wxPython-Classic/blob/19571e1ae65f1ac445f5491474121998c97a1bf0/wx/lib/agw/floatspin.py#L499-L515 | ||
wlanjie/AndroidFFmpeg | 7baf9122f4b8e1c74e7baf4be5c422c7a5ba5aaf | tools/fdk-aac-build/x86/toolchain/lib/python2.7/ntpath.py | python | islink | (path) | return False | Test for symbolic link.
On WindowsNT/95 and OS/2 always returns false | Test for symbolic link.
On WindowsNT/95 and OS/2 always returns false | [
"Test",
"for",
"symbolic",
"link",
".",
"On",
"WindowsNT",
"/",
"95",
"and",
"OS",
"/",
"2",
"always",
"returns",
"false"
] | def islink(path):
"""Test for symbolic link.
On WindowsNT/95 and OS/2 always returns false
"""
return False | [
"def",
"islink",
"(",
"path",
")",
":",
"return",
"False"
] | https://github.com/wlanjie/AndroidFFmpeg/blob/7baf9122f4b8e1c74e7baf4be5c422c7a5ba5aaf/tools/fdk-aac-build/x86/toolchain/lib/python2.7/ntpath.py#L210-L214 | |
BlzFans/wke | b0fa21158312e40c5fbd84682d643022b6c34a93 | cygwin/lib/python2.6/logging/__init__.py | python | StreamHandler.__init__ | (self, strm=None) | Initialize the handler.
If strm is not specified, sys.stderr is used. | Initialize the handler. | [
"Initialize",
"the",
"handler",
"."
] | def __init__(self, strm=None):
"""
Initialize the handler.
If strm is not specified, sys.stderr is used.
"""
Handler.__init__(self)
if strm is None:
strm = sys.stderr
self.stream = strm | [
"def",
"__init__",
"(",
"self",
",",
"strm",
"=",
"None",
")",
":",
"Handler",
".",
"__init__",
"(",
"self",
")",
"if",
"strm",
"is",
"None",
":",
"strm",
"=",
"sys",
".",
"stderr",
"self",
".",
"stream",
"=",
"strm"
] | https://github.com/BlzFans/wke/blob/b0fa21158312e40c5fbd84682d643022b6c34a93/cygwin/lib/python2.6/logging/__init__.py#L738-L747 | ||
benoitsteiner/tensorflow-opencl | cb7cb40a57fde5cfd4731bc551e82a1e2fef43a5 | tensorflow/python/ops/image_ops_impl.py | python | adjust_contrast | (images, contrast_factor) | Adjust contrast of RGB or grayscale images.
This is a convenience method that converts an RGB image to float
representation, adjusts its contrast, and then converts it back to the
original data type. If several adjustments are chained it is advisable to
minimize the number of redundant conversions.
`images`... | Adjust contrast of RGB or grayscale images. | [
"Adjust",
"contrast",
"of",
"RGB",
"or",
"grayscale",
"images",
"."
] | def adjust_contrast(images, contrast_factor):
"""Adjust contrast of RGB or grayscale images.
This is a convenience method that converts an RGB image to float
representation, adjusts its contrast, and then converts it back to the
original data type. If several adjustments are chained it is advisable to
minimi... | [
"def",
"adjust_contrast",
"(",
"images",
",",
"contrast_factor",
")",
":",
"with",
"ops",
".",
"name_scope",
"(",
"None",
",",
"'adjust_contrast'",
",",
"[",
"images",
",",
"contrast_factor",
"]",
")",
"as",
"name",
":",
"images",
"=",
"ops",
".",
"convert... | https://github.com/benoitsteiner/tensorflow-opencl/blob/cb7cb40a57fde5cfd4731bc551e82a1e2fef43a5/tensorflow/python/ops/image_ops_impl.py#L933-L971 | ||
ceph/ceph | 959663007321a369c83218414a29bd9dbc8bda3a | qa/tasks/mon_thrash.py | python | MonitorThrasher.unfreeze_mon | (self, mon) | Send CONT signal to unfreeze the monitor. | Send CONT signal to unfreeze the monitor. | [
"Send",
"CONT",
"signal",
"to",
"unfreeze",
"the",
"monitor",
"."
] | def unfreeze_mon(self, mon):
"""
Send CONT signal to unfreeze the monitor.
"""
log.info('Sending CONT to mon %s', mon)
self.manager.signal_mon(mon, 18) | [
"def",
"unfreeze_mon",
"(",
"self",
",",
"mon",
")",
":",
"log",
".",
"info",
"(",
"'Sending CONT to mon %s'",
",",
"mon",
")",
"self",
".",
"manager",
".",
"signal_mon",
"(",
"mon",
",",
"18",
")"
] | https://github.com/ceph/ceph/blob/959663007321a369c83218414a29bd9dbc8bda3a/qa/tasks/mon_thrash.py#L195-L200 | ||
wxWidgets/wxPython-Classic | 19571e1ae65f1ac445f5491474121998c97a1bf0 | src/osx_cocoa/_controls.py | python | RadioButton.Create | (*args, **kwargs) | return _controls_.RadioButton_Create(*args, **kwargs) | Create(self, Window parent, int id=-1, String label=EmptyString,
Point pos=DefaultPosition, Size size=DefaultSize,
long style=0, Validator validator=DefaultValidator,
String name=RadioButtonNameStr) -> bool | Create(self, Window parent, int id=-1, String label=EmptyString,
Point pos=DefaultPosition, Size size=DefaultSize,
long style=0, Validator validator=DefaultValidator,
String name=RadioButtonNameStr) -> bool | [
"Create",
"(",
"self",
"Window",
"parent",
"int",
"id",
"=",
"-",
"1",
"String",
"label",
"=",
"EmptyString",
"Point",
"pos",
"=",
"DefaultPosition",
"Size",
"size",
"=",
"DefaultSize",
"long",
"style",
"=",
"0",
"Validator",
"validator",
"=",
"DefaultValida... | def Create(*args, **kwargs):
"""
Create(self, Window parent, int id=-1, String label=EmptyString,
Point pos=DefaultPosition, Size size=DefaultSize,
long style=0, Validator validator=DefaultValidator,
String name=RadioButtonNameStr) -> bool
"""
retur... | [
"def",
"Create",
"(",
"*",
"args",
",",
"*",
"*",
"kwargs",
")",
":",
"return",
"_controls_",
".",
"RadioButton_Create",
"(",
"*",
"args",
",",
"*",
"*",
"kwargs",
")"
] | https://github.com/wxWidgets/wxPython-Classic/blob/19571e1ae65f1ac445f5491474121998c97a1bf0/src/osx_cocoa/_controls.py#L2738-L2745 | |
aws/lumberyard | f85344403c1c2e77ec8c75deb2c116e97b713217 | dev/Gems/CloudGemMetric/v1/AWS/python/windows/Lib/pandas/core/common.py | python | random_state | (state=None) | Helper function for processing random_state arguments.
Parameters
----------
state : int, np.random.RandomState, None.
If receives an int, passes to np.random.RandomState() as seed.
If receives an np.random.RandomState object, just returns object.
If receives `None`, returns np.rand... | Helper function for processing random_state arguments. | [
"Helper",
"function",
"for",
"processing",
"random_state",
"arguments",
"."
] | def random_state(state=None):
"""
Helper function for processing random_state arguments.
Parameters
----------
state : int, np.random.RandomState, None.
If receives an int, passes to np.random.RandomState() as seed.
If receives an np.random.RandomState object, just returns object.
... | [
"def",
"random_state",
"(",
"state",
"=",
"None",
")",
":",
"if",
"is_integer",
"(",
"state",
")",
":",
"return",
"np",
".",
"random",
".",
"RandomState",
"(",
"state",
")",
"elif",
"isinstance",
"(",
"state",
",",
"np",
".",
"random",
".",
"RandomStat... | https://github.com/aws/lumberyard/blob/f85344403c1c2e77ec8c75deb2c116e97b713217/dev/Gems/CloudGemMetric/v1/AWS/python/windows/Lib/pandas/core/common.py#L399-L426 | ||
wxWidgets/wxPython-Classic | 19571e1ae65f1ac445f5491474121998c97a1bf0 | src/msw/_windows.py | python | VarScrollHelperBase.RefreshAll | (*args, **kwargs) | return _windows_.VarScrollHelperBase_RefreshAll(*args, **kwargs) | RefreshAll(self) | RefreshAll(self) | [
"RefreshAll",
"(",
"self",
")"
] | def RefreshAll(*args, **kwargs):
"""RefreshAll(self)"""
return _windows_.VarScrollHelperBase_RefreshAll(*args, **kwargs) | [
"def",
"RefreshAll",
"(",
"*",
"args",
",",
"*",
"*",
"kwargs",
")",
":",
"return",
"_windows_",
".",
"VarScrollHelperBase_RefreshAll",
"(",
"*",
"args",
",",
"*",
"*",
"kwargs",
")"
] | https://github.com/wxWidgets/wxPython-Classic/blob/19571e1ae65f1ac445f5491474121998c97a1bf0/src/msw/_windows.py#L2214-L2216 | |
wxWidgets/wxPython-Classic | 19571e1ae65f1ac445f5491474121998c97a1bf0 | src/gtk/_core.py | python | MenuBar.Attach | (*args, **kwargs) | return _core_.MenuBar_Attach(*args, **kwargs) | Attach(self, wxFrame frame) | Attach(self, wxFrame frame) | [
"Attach",
"(",
"self",
"wxFrame",
"frame",
")"
] | def Attach(*args, **kwargs):
"""Attach(self, wxFrame frame)"""
return _core_.MenuBar_Attach(*args, **kwargs) | [
"def",
"Attach",
"(",
"*",
"args",
",",
"*",
"*",
"kwargs",
")",
":",
"return",
"_core_",
".",
"MenuBar_Attach",
"(",
"*",
"args",
",",
"*",
"*",
"kwargs",
")"
] | https://github.com/wxWidgets/wxPython-Classic/blob/19571e1ae65f1ac445f5491474121998c97a1bf0/src/gtk/_core.py#L12367-L12369 | |
LiquidPlayer/LiquidCore | 9405979363f2353ac9a71ad8ab59685dd7f919c9 | deps/node-10.15.3/deps/npm/node_modules/node-gyp/gyp/pylib/gyp/input.py | python | ValidateTargetType | (target, target_dict) | Ensures the 'type' field on the target is one of the known types.
Arguments:
target: string, name of target.
target_dict: dict, target spec.
Raises an exception on error. | Ensures the 'type' field on the target is one of the known types. | [
"Ensures",
"the",
"type",
"field",
"on",
"the",
"target",
"is",
"one",
"of",
"the",
"known",
"types",
"."
] | def ValidateTargetType(target, target_dict):
"""Ensures the 'type' field on the target is one of the known types.
Arguments:
target: string, name of target.
target_dict: dict, target spec.
Raises an exception on error.
"""
VALID_TARGET_TYPES = ('executable', 'loadable_module',
... | [
"def",
"ValidateTargetType",
"(",
"target",
",",
"target_dict",
")",
":",
"VALID_TARGET_TYPES",
"=",
"(",
"'executable'",
",",
"'loadable_module'",
",",
"'static_library'",
",",
"'shared_library'",
",",
"'mac_kernel_extension'",
",",
"'none'",
")",
"target_type",
"=",... | https://github.com/LiquidPlayer/LiquidCore/blob/9405979363f2353ac9a71ad8ab59685dd7f919c9/deps/node-10.15.3/deps/npm/node_modules/node-gyp/gyp/pylib/gyp/input.py#L2485-L2506 | ||
tensorflow/tensorflow | 419e3a6b650ea4bd1b0cba23c4348f8a69f3272e | tensorflow/python/ops/nn_grad.py | python | _BiasAddGradV1 | (unused_bias_op, received_grad) | return (received_grad, math_ops.reduce_sum(received_grad,
reduction_dim_tensor)) | Return the gradients for the 2 inputs of bias_op.
The first input of unused_bias_op is the tensor t, and its gradient is
just the gradient the unused_bias_op received.
The second input of unused_bias_op is the bias vector which has one fewer
dimension than "received_grad" (the batch dimension.) Its gradient ... | Return the gradients for the 2 inputs of bias_op. | [
"Return",
"the",
"gradients",
"for",
"the",
"2",
"inputs",
"of",
"bias_op",
"."
] | def _BiasAddGradV1(unused_bias_op, received_grad):
"""Return the gradients for the 2 inputs of bias_op.
The first input of unused_bias_op is the tensor t, and its gradient is
just the gradient the unused_bias_op received.
The second input of unused_bias_op is the bias vector which has one fewer
dimension th... | [
"def",
"_BiasAddGradV1",
"(",
"unused_bias_op",
",",
"received_grad",
")",
":",
"reduction_dim_tensor",
"=",
"math_ops",
".",
"range",
"(",
"array_ops",
".",
"rank",
"(",
"received_grad",
")",
"-",
"1",
")",
"return",
"(",
"received_grad",
",",
"math_ops",
"."... | https://github.com/tensorflow/tensorflow/blob/419e3a6b650ea4bd1b0cba23c4348f8a69f3272e/tensorflow/python/ops/nn_grad.py#L384-L404 | |
TGAC/KAT | e8870331de2b4bb0a1b3b91c6afb8fb9d59e9216 | deps/boost/tools/build/src/build/toolset.py | python | inherit_flags | (toolset, base, prohibited_properties = []) | Brings all flag definitions from the 'base' toolset into the 'toolset'
toolset. Flag definitions whose conditions make use of properties in
'prohibited-properties' are ignored. Don't confuse property and feature, for
example <debug-symbols>on and <debug-symbols>off, so blocking one of them does
not bloc... | Brings all flag definitions from the 'base' toolset into the 'toolset'
toolset. Flag definitions whose conditions make use of properties in
'prohibited-properties' are ignored. Don't confuse property and feature, for
example <debug-symbols>on and <debug-symbols>off, so blocking one of them does
not bloc... | [
"Brings",
"all",
"flag",
"definitions",
"from",
"the",
"base",
"toolset",
"into",
"the",
"toolset",
"toolset",
".",
"Flag",
"definitions",
"whose",
"conditions",
"make",
"use",
"of",
"properties",
"in",
"prohibited",
"-",
"properties",
"are",
"ignored",
".",
"... | def inherit_flags(toolset, base, prohibited_properties = []):
"""Brings all flag definitions from the 'base' toolset into the 'toolset'
toolset. Flag definitions whose conditions make use of properties in
'prohibited-properties' are ignored. Don't confuse property and feature, for
example <debug-symbols... | [
"def",
"inherit_flags",
"(",
"toolset",
",",
"base",
",",
"prohibited_properties",
"=",
"[",
"]",
")",
":",
"assert",
"isinstance",
"(",
"toolset",
",",
"basestring",
")",
"assert",
"isinstance",
"(",
"base",
",",
"basestring",
")",
"assert",
"is_iterable_type... | https://github.com/TGAC/KAT/blob/e8870331de2b4bb0a1b3b91c6afb8fb9d59e9216/deps/boost/tools/build/src/build/toolset.py#L251-L280 | ||
catboost/catboost | 167f64f237114a4d10b2b4ee42adb4569137debe | contrib/python/scipy/scipy/io/arff/arffread.py | python | MetaData.names | (self) | return self._attrnames | Return the list of attribute names. | Return the list of attribute names. | [
"Return",
"the",
"list",
"of",
"attribute",
"names",
"."
] | def names(self):
"""Return the list of attribute names."""
return self._attrnames | [
"def",
"names",
"(",
"self",
")",
":",
"return",
"self",
".",
"_attrnames"
] | https://github.com/catboost/catboost/blob/167f64f237114a4d10b2b4ee42adb4569137debe/contrib/python/scipy/scipy/io/arff/arffread.py#L457-L459 | |
Xilinx/Vitis-AI | fc74d404563d9951b57245443c73bef389f3657f | tools/Vitis-AI-Quantizer/vai_q_tensorflow1.x/tensorflow/python/debug/cli/debugger_cli_common.py | python | get_tensorflow_version_lines | (include_dependency_versions=False) | return RichTextLines(lines) | Generate RichTextLines with TensorFlow version info.
Args:
include_dependency_versions: Include the version of TensorFlow's key
dependencies, such as numpy.
Returns:
A formatted, multi-line `RichTextLines` object. | Generate RichTextLines with TensorFlow version info. | [
"Generate",
"RichTextLines",
"with",
"TensorFlow",
"version",
"info",
"."
] | def get_tensorflow_version_lines(include_dependency_versions=False):
"""Generate RichTextLines with TensorFlow version info.
Args:
include_dependency_versions: Include the version of TensorFlow's key
dependencies, such as numpy.
Returns:
A formatted, multi-line `RichTextLines` object.
"""
line... | [
"def",
"get_tensorflow_version_lines",
"(",
"include_dependency_versions",
"=",
"False",
")",
":",
"lines",
"=",
"[",
"\"TensorFlow version: %s\"",
"%",
"pywrap_tensorflow_internal",
".",
"__version__",
"]",
"lines",
".",
"append",
"(",
"\"\"",
")",
"if",
"include_dep... | https://github.com/Xilinx/Vitis-AI/blob/fc74d404563d9951b57245443c73bef389f3657f/tools/Vitis-AI-Quantizer/vai_q_tensorflow1.x/tensorflow/python/debug/cli/debugger_cli_common.py#L135-L151 | |
aws/lumberyard | f85344403c1c2e77ec8c75deb2c116e97b713217 | dev/Gems/CloudGemMetric/v1/AWS/python/windows/Lib/numpy/core/einsumfunc.py | python | _parse_possible_contraction | (positions, input_sets, output_set, idx_dict, memory_limit, path_cost, naive_cost) | return [sort, positions, new_input_sets] | Compute the cost (removed size + flops) and resultant indices for
performing the contraction specified by ``positions``.
Parameters
----------
positions : tuple of int
The locations of the proposed tensors to contract.
input_sets : list of sets
The indices found on each tensors.
... | Compute the cost (removed size + flops) and resultant indices for
performing the contraction specified by ``positions``. | [
"Compute",
"the",
"cost",
"(",
"removed",
"size",
"+",
"flops",
")",
"and",
"resultant",
"indices",
"for",
"performing",
"the",
"contraction",
"specified",
"by",
"positions",
"."
] | def _parse_possible_contraction(positions, input_sets, output_set, idx_dict, memory_limit, path_cost, naive_cost):
"""Compute the cost (removed size + flops) and resultant indices for
performing the contraction specified by ``positions``.
Parameters
----------
positions : tuple of int
The l... | [
"def",
"_parse_possible_contraction",
"(",
"positions",
",",
"input_sets",
",",
"output_set",
",",
"idx_dict",
",",
"memory_limit",
",",
"path_cost",
",",
"naive_cost",
")",
":",
"# Find the contraction",
"contract",
"=",
"_find_contraction",
"(",
"positions",
",",
... | https://github.com/aws/lumberyard/blob/f85344403c1c2e77ec8c75deb2c116e97b713217/dev/Gems/CloudGemMetric/v1/AWS/python/windows/Lib/numpy/core/einsumfunc.py#L217-L272 | |
aws/lumberyard | f85344403c1c2e77ec8c75deb2c116e97b713217 | dev/Gems/CloudGemMetric/v1/AWS/python/windows/Lib/pandas/core/indexes/base.py | python | Index._to_safe_for_reshape | (self) | return self | Convert to object if we are a categorical. | Convert to object if we are a categorical. | [
"Convert",
"to",
"object",
"if",
"we",
"are",
"a",
"categorical",
"."
] | def _to_safe_for_reshape(self):
"""
Convert to object if we are a categorical.
"""
return self | [
"def",
"_to_safe_for_reshape",
"(",
"self",
")",
":",
"return",
"self"
] | https://github.com/aws/lumberyard/blob/f85344403c1c2e77ec8c75deb2c116e97b713217/dev/Gems/CloudGemMetric/v1/AWS/python/windows/Lib/pandas/core/indexes/base.py#L3826-L3830 | |
arangodb/arangodb | 0d658689c7d1b721b314fa3ca27d38303e1570c8 | 3rdParty/V8/gyp/MSVS/MSVSNew.py | python | MSVSSolution.Write | (self, writer=gyp.common.WriteOnDiff) | Writes the solution file to disk.
Raises:
IndexError: An entry appears multiple times. | Writes the solution file to disk. | [
"Writes",
"the",
"solution",
"file",
"to",
"disk",
"."
] | def Write(self, writer=gyp.common.WriteOnDiff):
"""Writes the solution file to disk.
Raises:
IndexError: An entry appears multiple times.
"""
# Walk the entry tree and collect all the folders and projects.
all_entries = set()
entries_to_check = self.entries[:]
while entries_to_check:
... | [
"def",
"Write",
"(",
"self",
",",
"writer",
"=",
"gyp",
".",
"common",
".",
"WriteOnDiff",
")",
":",
"# Walk the entry tree and collect all the folders and projects.",
"all_entries",
"=",
"set",
"(",
")",
"entries_to_check",
"=",
"self",
".",
"entries",
"[",
":",
... | https://github.com/arangodb/arangodb/blob/0d658689c7d1b721b314fa3ca27d38303e1570c8/3rdParty/V8/gyp/MSVS/MSVSNew.py#L179-L304 | ||
catboost/catboost | 167f64f237114a4d10b2b4ee42adb4569137debe | contrib/tools/python/src/Lib/lib-tk/turtle.py | python | TurtleScreen.bgpic | (self, picname=None) | Set background image or return name of current backgroundimage.
Optional argument:
picname -- a string, name of a gif-file or "nopic".
If picname is a filename, set the corresponding image as background.
If picname is "nopic", delete backgroundimage, if present.
If picname is N... | Set background image or return name of current backgroundimage. | [
"Set",
"background",
"image",
"or",
"return",
"name",
"of",
"current",
"backgroundimage",
"."
] | def bgpic(self, picname=None):
"""Set background image or return name of current backgroundimage.
Optional argument:
picname -- a string, name of a gif-file or "nopic".
If picname is a filename, set the corresponding image as background.
If picname is "nopic", delete background... | [
"def",
"bgpic",
"(",
"self",
",",
"picname",
"=",
"None",
")",
":",
"if",
"picname",
"is",
"None",
":",
"return",
"self",
".",
"_bgpicname",
"if",
"picname",
"not",
"in",
"self",
".",
"_bgpics",
":",
"self",
".",
"_bgpics",
"[",
"picname",
"]",
"=",
... | https://github.com/catboost/catboost/blob/167f64f237114a4d10b2b4ee42adb4569137debe/contrib/tools/python/src/Lib/lib-tk/turtle.py#L1378-L1400 | ||
wxWidgets/wxPython-Classic | 19571e1ae65f1ac445f5491474121998c97a1bf0 | src/gtk/richtext.py | python | TextBoxAttr.GetRightBorder | (*args) | return _richtext.TextBoxAttr_GetRightBorder(*args) | GetRightBorder(self) -> TextAttrBorder
GetRightBorder(self) -> TextAttrBorder | GetRightBorder(self) -> TextAttrBorder
GetRightBorder(self) -> TextAttrBorder | [
"GetRightBorder",
"(",
"self",
")",
"-",
">",
"TextAttrBorder",
"GetRightBorder",
"(",
"self",
")",
"-",
">",
"TextAttrBorder"
] | def GetRightBorder(*args):
"""
GetRightBorder(self) -> TextAttrBorder
GetRightBorder(self) -> TextAttrBorder
"""
return _richtext.TextBoxAttr_GetRightBorder(*args) | [
"def",
"GetRightBorder",
"(",
"*",
"args",
")",
":",
"return",
"_richtext",
".",
"TextBoxAttr_GetRightBorder",
"(",
"*",
"args",
")"
] | https://github.com/wxWidgets/wxPython-Classic/blob/19571e1ae65f1ac445f5491474121998c97a1bf0/src/gtk/richtext.py#L754-L759 | |
wlanjie/AndroidFFmpeg | 7baf9122f4b8e1c74e7baf4be5c422c7a5ba5aaf | tools/fdk-aac-build/x86/toolchain/lib/python2.7/wsgiref/handlers.py | python | BaseHandler.get_stdin | (self) | Override in subclass to return suitable 'wsgi.input | Override in subclass to return suitable 'wsgi.input | [
"Override",
"in",
"subclass",
"to",
"return",
"suitable",
"wsgi",
".",
"input"
] | def get_stdin(self):
"""Override in subclass to return suitable 'wsgi.input'"""
raise NotImplementedError | [
"def",
"get_stdin",
"(",
"self",
")",
":",
"raise",
"NotImplementedError"
] | https://github.com/wlanjie/AndroidFFmpeg/blob/7baf9122f4b8e1c74e7baf4be5c422c7a5ba5aaf/tools/fdk-aac-build/x86/toolchain/lib/python2.7/wsgiref/handlers.py#L345-L347 | ||
kamyu104/LeetCode-Solutions | 77605708a927ea3b85aee5a479db733938c7c211 | Python/number-of-valid-subarrays.py | python | Solution.validSubarrays | (self, nums) | return result | :type nums: List[int]
:rtype: int | :type nums: List[int]
:rtype: int | [
":",
"type",
"nums",
":",
"List",
"[",
"int",
"]",
":",
"rtype",
":",
"int"
] | def validSubarrays(self, nums):
"""
:type nums: List[int]
:rtype: int
"""
result = 0
s = []
for num in nums:
while s and s[-1] > num:
s.pop()
s.append(num);
result += len(s)
return result | [
"def",
"validSubarrays",
"(",
"self",
",",
"nums",
")",
":",
"result",
"=",
"0",
"s",
"=",
"[",
"]",
"for",
"num",
"in",
"nums",
":",
"while",
"s",
"and",
"s",
"[",
"-",
"1",
"]",
">",
"num",
":",
"s",
".",
"pop",
"(",
")",
"s",
".",
"appen... | https://github.com/kamyu104/LeetCode-Solutions/blob/77605708a927ea3b85aee5a479db733938c7c211/Python/number-of-valid-subarrays.py#L5-L17 | |
wxWidgets/wxPython-Classic | 19571e1ae65f1ac445f5491474121998c97a1bf0 | src/osx_carbon/_misc.py | python | AboutDialogInfo.SetDescription | (*args, **kwargs) | return _misc_.AboutDialogInfo_SetDescription(*args, **kwargs) | SetDescription(self, String desc)
Set brief, but possibly multiline, description of the program. | SetDescription(self, String desc) | [
"SetDescription",
"(",
"self",
"String",
"desc",
")"
] | def SetDescription(*args, **kwargs):
"""
SetDescription(self, String desc)
Set brief, but possibly multiline, description of the program.
"""
return _misc_.AboutDialogInfo_SetDescription(*args, **kwargs) | [
"def",
"SetDescription",
"(",
"*",
"args",
",",
"*",
"*",
"kwargs",
")",
":",
"return",
"_misc_",
".",
"AboutDialogInfo_SetDescription",
"(",
"*",
"args",
",",
"*",
"*",
"kwargs",
")"
] | https://github.com/wxWidgets/wxPython-Classic/blob/19571e1ae65f1ac445f5491474121998c97a1bf0/src/osx_carbon/_misc.py#L6637-L6643 | |
pytorch/pytorch | 7176c92687d3cc847cc046bf002269c6949a21c2 | torch/nn/utils/parametrize.py | python | _inject_property | (module: Module, tensor_name: str) | r"""Injects a property into module[tensor_name].
It assumes that the class in the module has already been modified from its
original one using _inject_new_class and that the tensor under :attr:`tensor_name`
has already been moved out
Args:
module (nn.Module): module into which to inject the pr... | r"""Injects a property into module[tensor_name]. | [
"r",
"Injects",
"a",
"property",
"into",
"module",
"[",
"tensor_name",
"]",
"."
] | def _inject_property(module: Module, tensor_name: str) -> None:
r"""Injects a property into module[tensor_name].
It assumes that the class in the module has already been modified from its
original one using _inject_new_class and that the tensor under :attr:`tensor_name`
has already been moved out
... | [
"def",
"_inject_property",
"(",
"module",
":",
"Module",
",",
"tensor_name",
":",
"str",
")",
"->",
"None",
":",
"# We check the precondition.",
"# This should never fire if register_parametrization is correctly implemented",
"assert",
"not",
"hasattr",
"(",
"module",
",",
... | https://github.com/pytorch/pytorch/blob/7176c92687d3cc847cc046bf002269c6949a21c2/torch/nn/utils/parametrize.py#L303-L347 | ||
baidu-research/tensorflow-allreduce | 66d5b855e90b0949e9fa5cca5599fd729a70e874 | tensorflow/contrib/seq2seq/python/ops/beam_search_decoder.py | python | BeamSearchDecoder._maybe_split_batch_beams | (self, t, s) | Maybe splits the tensor from a batch by beams into a batch of beams.
We do this so that we can use nest and not run into problems with shapes.
Args:
t: Tensor of dimension [batch_size*beam_width, s]
s: Tensor, Python int, or TensorShape.
Returns:
Either a reshaped version of t with dime... | Maybe splits the tensor from a batch by beams into a batch of beams. | [
"Maybe",
"splits",
"the",
"tensor",
"from",
"a",
"batch",
"by",
"beams",
"into",
"a",
"batch",
"of",
"beams",
"."
] | def _maybe_split_batch_beams(self, t, s):
"""Maybe splits the tensor from a batch by beams into a batch of beams.
We do this so that we can use nest and not run into problems with shapes.
Args:
t: Tensor of dimension [batch_size*beam_width, s]
s: Tensor, Python int, or TensorShape.
Return... | [
"def",
"_maybe_split_batch_beams",
"(",
"self",
",",
"t",
",",
"s",
")",
":",
"_check_maybe",
"(",
"t",
")",
"if",
"t",
".",
"shape",
".",
"ndims",
">=",
"1",
":",
"return",
"self",
".",
"_split_batch_beams",
"(",
"t",
",",
"s",
")",
"else",
":",
"... | https://github.com/baidu-research/tensorflow-allreduce/blob/66d5b855e90b0949e9fa5cca5599fd729a70e874/tensorflow/contrib/seq2seq/python/ops/beam_search_decoder.py#L354-L376 | ||
psnonis/FinBERT | c0c555d833a14e2316a3701e59c0b5156f804b4e | bert-gpu/tokenization.py | python | validate_case_matches_checkpoint | (do_lower_case, init_checkpoint) | Checks whether the casing config is consistent with the checkpoint name. | Checks whether the casing config is consistent with the checkpoint name. | [
"Checks",
"whether",
"the",
"casing",
"config",
"is",
"consistent",
"with",
"the",
"checkpoint",
"name",
"."
] | def validate_case_matches_checkpoint(do_lower_case, init_checkpoint):
"""Checks whether the casing config is consistent with the checkpoint name."""
# The casing has to be passed in by the user and there is no explicit check
# as to whether it matches the checkpoint. The casing information probably
# should ha... | [
"def",
"validate_case_matches_checkpoint",
"(",
"do_lower_case",
",",
"init_checkpoint",
")",
":",
"# The casing has to be passed in by the user and there is no explicit check",
"# as to whether it matches the checkpoint. The casing information probably",
"# should have been stored in the bert_c... | https://github.com/psnonis/FinBERT/blob/c0c555d833a14e2316a3701e59c0b5156f804b4e/bert-gpu/tokenization.py#L27-L74 | ||
FreeCAD/FreeCAD | ba42231b9c6889b89e064d6d563448ed81e376ec | src/Mod/Arch/ArchSpace.py | python | _Space.getShape | (self,obj) | computes a shape from a base shape and/or boundary faces | computes a shape from a base shape and/or boundary faces | [
"computes",
"a",
"shape",
"from",
"a",
"base",
"shape",
"and",
"/",
"or",
"boundary",
"faces"
] | def getShape(self,obj):
"computes a shape from a base shape and/or boundary faces"
import Part
shape = None
faces = []
pl = obj.Placement
#print("starting compute")
# 1: if we have a base shape, we use it
if obj.Base:
if hasattr(obj.Base,'S... | [
"def",
"getShape",
"(",
"self",
",",
"obj",
")",
":",
"import",
"Part",
"shape",
"=",
"None",
"faces",
"=",
"[",
"]",
"pl",
"=",
"obj",
".",
"Placement",
"#print(\"starting compute\")",
"# 1: if we have a base shape, we use it",
"if",
"obj",
".",
"Base",
":",
... | https://github.com/FreeCAD/FreeCAD/blob/ba42231b9c6889b89e064d6d563448ed81e376ec/src/Mod/Arch/ArchSpace.py#L360-L439 | ||
baidu/unit-dmkit | 6b837ee07504d4d3e3675933c34de0c6246a49e5 | language_compiler/compiler_xml.py | python | run | (data) | return ps.write_json() | runs the parser and returns the parsed json | runs the parser and returns the parsed json | [
"runs",
"the",
"parser",
"and",
"returns",
"the",
"parsed",
"json"
] | def run(data):
"""
runs the parser and returns the parsed json
"""
ps = XmlParser(data)
return ps.write_json() | [
"def",
"run",
"(",
"data",
")",
":",
"ps",
"=",
"XmlParser",
"(",
"data",
")",
"return",
"ps",
".",
"write_json",
"(",
")"
] | https://github.com/baidu/unit-dmkit/blob/6b837ee07504d4d3e3675933c34de0c6246a49e5/language_compiler/compiler_xml.py#L337-L342 | |
yyzybb537/libgo | 4af17b7c67643c4d54aa354dcc77963ea07847d0 | third_party/boost.context/tools/build/src/build/virtual_target.py | python | VirtualTarget.actualize | (self, scanner = None) | Generates all the actual targets and sets up build actions for
this target.
If 'scanner' is specified, creates an additional target
with the same location as actual target, which will depend on the
actual target and be associated with 'scanner'. That additional
... | Generates all the actual targets and sets up build actions for
this target. | [
"Generates",
"all",
"the",
"actual",
"targets",
"and",
"sets",
"up",
"build",
"actions",
"for",
"this",
"target",
"."
] | def actualize (self, scanner = None):
""" Generates all the actual targets and sets up build actions for
this target.
If 'scanner' is specified, creates an additional target
with the same location as actual target, which will depend on the
actual target and be as... | [
"def",
"actualize",
"(",
"self",
",",
"scanner",
"=",
"None",
")",
":",
"if",
"__debug__",
":",
"from",
".",
"scanner",
"import",
"Scanner",
"assert",
"scanner",
"is",
"None",
"or",
"isinstance",
"(",
"scanner",
",",
"Scanner",
")",
"actual_name",
"=",
"... | https://github.com/yyzybb537/libgo/blob/4af17b7c67643c4d54aa354dcc77963ea07847d0/third_party/boost.context/tools/build/src/build/virtual_target.py#L308-L346 | ||
stack-of-tasks/pinocchio | 593d4d43fded997bb9aa2421f4e55294dbd233c4 | doc/d-practical-exercises/src/ur5x4.py | python | loadRobot | (M0, name) | return robot | This function load a UR5 robot n a new model, move the basis to placement <M0>
and add the corresponding visuals in gepetto viewer with name prefix given by string <name>.
It returns the robot wrapper (model,data). | This function load a UR5 robot n a new model, move the basis to placement <M0>
and add the corresponding visuals in gepetto viewer with name prefix given by string <name>.
It returns the robot wrapper (model,data). | [
"This",
"function",
"load",
"a",
"UR5",
"robot",
"n",
"a",
"new",
"model",
"move",
"the",
"basis",
"to",
"placement",
"<M0",
">",
"and",
"add",
"the",
"corresponding",
"visuals",
"in",
"gepetto",
"viewer",
"with",
"name",
"prefix",
"given",
"by",
"string",... | def loadRobot(M0, name):
'''
This function load a UR5 robot n a new model, move the basis to placement <M0>
and add the corresponding visuals in gepetto viewer with name prefix given by string <name>.
It returns the robot wrapper (model,data).
'''
robot = RobotWrapper(urdf, [PKG])
robot.mode... | [
"def",
"loadRobot",
"(",
"M0",
",",
"name",
")",
":",
"robot",
"=",
"RobotWrapper",
"(",
"urdf",
",",
"[",
"PKG",
"]",
")",
"robot",
".",
"model",
".",
"jointPlacements",
"[",
"1",
"]",
"=",
"M0",
"*",
"robot",
".",
"model",
".",
"jointPlacements",
... | https://github.com/stack-of-tasks/pinocchio/blob/593d4d43fded997bb9aa2421f4e55294dbd233c4/doc/d-practical-exercises/src/ur5x4.py#L18-L29 | |
bilibili/biliobs | 573613dc3b2b63fe7c1506cc94717609a2c52c0c | third_party/freetype/src/tools/docmaker/content.py | python | DocBlock.get_markup | ( self, tag_name ) | return None | Return the DocMarkup corresponding to a given tag in a block. | Return the DocMarkup corresponding to a given tag in a block. | [
"Return",
"the",
"DocMarkup",
"corresponding",
"to",
"a",
"given",
"tag",
"in",
"a",
"block",
"."
] | def get_markup( self, tag_name ):
"""Return the DocMarkup corresponding to a given tag in a block."""
for m in self.markups:
if m.tag == string.lower( tag_name ):
return m
return None | [
"def",
"get_markup",
"(",
"self",
",",
"tag_name",
")",
":",
"for",
"m",
"in",
"self",
".",
"markups",
":",
"if",
"m",
".",
"tag",
"==",
"string",
".",
"lower",
"(",
"tag_name",
")",
":",
"return",
"m",
"return",
"None"
] | https://github.com/bilibili/biliobs/blob/573613dc3b2b63fe7c1506cc94717609a2c52c0c/third_party/freetype/src/tools/docmaker/content.py#L615-L620 | |
RamadhanAmizudin/malware | 2c6c53c8b0d556f5d8078d6ca0fc4448f4697cf1 | Fuzzbunch/Resources/Python/Override/Lib/multiprocessing/util.py | python | is_exiting | () | return _exiting or _exiting is None | Returns true if the process is shutting down | Returns true if the process is shutting down | [
"Returns",
"true",
"if",
"the",
"process",
"is",
"shutting",
"down"
] | def is_exiting():
'''
Returns true if the process is shutting down
'''
return _exiting or _exiting is None | [
"def",
"is_exiting",
"(",
")",
":",
"return",
"_exiting",
"or",
"_exiting",
"is",
"None"
] | https://github.com/RamadhanAmizudin/malware/blob/2c6c53c8b0d556f5d8078d6ca0fc4448f4697cf1/Fuzzbunch/Resources/Python/Override/Lib/multiprocessing/util.py#L273-L277 | |
aws/lumberyard | f85344403c1c2e77ec8c75deb2c116e97b713217 | dev/Tools/Python/3.7.10/mac/Python.framework/Versions/3.7/lib/python3.7/mailbox.py | python | _singlefileMailbox.lock | (self) | Lock the mailbox. | Lock the mailbox. | [
"Lock",
"the",
"mailbox",
"."
] | def lock(self):
"""Lock the mailbox."""
if not self._locked:
_lock_file(self._file)
self._locked = True | [
"def",
"lock",
"(",
"self",
")",
":",
"if",
"not",
"self",
".",
"_locked",
":",
"_lock_file",
"(",
"self",
".",
"_file",
")",
"self",
".",
"_locked",
"=",
"True"
] | https://github.com/aws/lumberyard/blob/f85344403c1c2e77ec8c75deb2c116e97b713217/dev/Tools/Python/3.7.10/mac/Python.framework/Versions/3.7/lib/python3.7/mailbox.py#L637-L641 | ||
aws/lumberyard | f85344403c1c2e77ec8c75deb2c116e97b713217 | dev/Tools/Python/3.7.10/linux_x64/lib/python3.7/mailbox.py | python | _mboxMMDFMessage.get_flags | (self) | return self.get('Status', '') + self.get('X-Status', '') | Return as a string the flags that are set. | Return as a string the flags that are set. | [
"Return",
"as",
"a",
"string",
"the",
"flags",
"that",
"are",
"set",
"."
] | def get_flags(self):
"""Return as a string the flags that are set."""
return self.get('Status', '') + self.get('X-Status', '') | [
"def",
"get_flags",
"(",
"self",
")",
":",
"return",
"self",
".",
"get",
"(",
"'Status'",
",",
"''",
")",
"+",
"self",
".",
"get",
"(",
"'X-Status'",
",",
"''",
")"
] | https://github.com/aws/lumberyard/blob/f85344403c1c2e77ec8c75deb2c116e97b713217/dev/Tools/Python/3.7.10/linux_x64/lib/python3.7/mailbox.py#L1658-L1660 | |
aws/lumberyard | f85344403c1c2e77ec8c75deb2c116e97b713217 | dev/Tools/Python/3.7.10/linux_x64/lib/python3.7/site-packages/wheel/vendored/packaging/tags.py | python | sys_tags | (**kwargs) | Returns the sequence of tag triples for the running interpreter.
The order of the sequence corresponds to priority order for the
interpreter, from most to least important. | Returns the sequence of tag triples for the running interpreter. | [
"Returns",
"the",
"sequence",
"of",
"tag",
"triples",
"for",
"the",
"running",
"interpreter",
"."
] | def sys_tags(**kwargs):
# type: (bool) -> Iterator[Tag]
"""
Returns the sequence of tag triples for the running interpreter.
The order of the sequence corresponds to priority order for the
interpreter, from most to least important.
"""
warn = _warn_keyword_parameter("sys_tags", kwargs)
... | [
"def",
"sys_tags",
"(",
"*",
"*",
"kwargs",
")",
":",
"# type: (bool) -> Iterator[Tag]",
"warn",
"=",
"_warn_keyword_parameter",
"(",
"\"sys_tags\"",
",",
"kwargs",
")",
"interp_name",
"=",
"interpreter_name",
"(",
")",
"if",
"interp_name",
"==",
"\"cp\"",
":",
... | https://github.com/aws/lumberyard/blob/f85344403c1c2e77ec8c75deb2c116e97b713217/dev/Tools/Python/3.7.10/linux_x64/lib/python3.7/site-packages/wheel/vendored/packaging/tags.py#L833-L852 | ||
gnuradio/gnuradio | 09c3c4fa4bfb1a02caac74cb5334dfe065391e3b | grc/gui/canvas/drawable.py | python | Drawable.move | (self, delta_coor) | Move the element by adding the delta_coor to the current coordinate.
Args:
delta_coor: (delta_x,delta_y) tuple | Move the element by adding the delta_coor to the current coordinate. | [
"Move",
"the",
"element",
"by",
"adding",
"the",
"delta_coor",
"to",
"the",
"current",
"coordinate",
"."
] | def move(self, delta_coor):
"""
Move the element by adding the delta_coor to the current coordinate.
Args:
delta_coor: (delta_x,delta_y) tuple
"""
x, y = self.coordinate
dx, dy = delta_coor
self.coordinate = (x + dx, y + dy) | [
"def",
"move",
"(",
"self",
",",
"delta_coor",
")",
":",
"x",
",",
"y",
"=",
"self",
".",
"coordinate",
"dx",
",",
"dy",
"=",
"delta_coor",
"self",
".",
"coordinate",
"=",
"(",
"x",
"+",
"dx",
",",
"y",
"+",
"dy",
")"
] | https://github.com/gnuradio/gnuradio/blob/09c3c4fa4bfb1a02caac74cb5334dfe065391e3b/grc/gui/canvas/drawable.py#L74-L83 | ||
CRYTEK/CRYENGINE | 232227c59a220cbbd311576f0fbeba7bb53b2a8c | Editor/Python/windows/Lib/site-packages/setuptools/package_index.py | python | HashChecker.from_url | (cls, url) | return cls(**match.groupdict()) | Construct a (possibly null) ContentChecker from a URL | Construct a (possibly null) ContentChecker from a URL | [
"Construct",
"a",
"(",
"possibly",
"null",
")",
"ContentChecker",
"from",
"a",
"URL"
] | def from_url(cls, url):
"Construct a (possibly null) ContentChecker from a URL"
fragment = urllib.parse.urlparse(url)[-1]
if not fragment:
return ContentChecker()
match = cls.pattern.search(fragment)
if not match:
return ContentChecker()
return cls... | [
"def",
"from_url",
"(",
"cls",
",",
"url",
")",
":",
"fragment",
"=",
"urllib",
".",
"parse",
".",
"urlparse",
"(",
"url",
")",
"[",
"-",
"1",
"]",
"if",
"not",
"fragment",
":",
"return",
"ContentChecker",
"(",
")",
"match",
"=",
"cls",
".",
"patte... | https://github.com/CRYTEK/CRYENGINE/blob/232227c59a220cbbd311576f0fbeba7bb53b2a8c/Editor/Python/windows/Lib/site-packages/setuptools/package_index.py#L277-L285 | |
hanpfei/chromium-net | 392cc1fa3a8f92f42e4071ab6e674d8e0482f83f | tools/android/loading/resource_sack.py | python | GraphSack.CoreSet | (self, *graph_sets) | return reduce(lambda a, b: a & b,
(self._SingleCore(s) for s in graph_sets)) | Compute the core set of this sack.
The core set of a sack is the set of resource that are common to most of the
graphs in the sack. A core set of a set of graphs are the resources that
appear with frequency at least CORE_THRESHOLD. For a collection of graph
sets, for instance pulling the same page unde... | Compute the core set of this sack. | [
"Compute",
"the",
"core",
"set",
"of",
"this",
"sack",
"."
] | def CoreSet(self, *graph_sets):
"""Compute the core set of this sack.
The core set of a sack is the set of resource that are common to most of the
graphs in the sack. A core set of a set of graphs are the resources that
appear with frequency at least CORE_THRESHOLD. For a collection of graph
sets, ... | [
"def",
"CoreSet",
"(",
"self",
",",
"*",
"graph_sets",
")",
":",
"if",
"not",
"graph_sets",
":",
"graph_sets",
"=",
"[",
"self",
".",
"_graph_info",
".",
"keys",
"(",
")",
"]",
"return",
"reduce",
"(",
"lambda",
"a",
",",
"b",
":",
"a",
"&",
"b",
... | https://github.com/hanpfei/chromium-net/blob/392cc1fa3a8f92f42e4071ab6e674d8e0482f83f/tools/android/loading/resource_sack.py#L109-L133 | |
hanpfei/chromium-net | 392cc1fa3a8f92f42e4071ab6e674d8e0482f83f | tools/clang/scripts/run_tool.py | python | _ExtendDeletionIfElementIsInList | (contents, offset) | Extends the range of a deletion if the deleted element was part of a list.
This rewriter helper makes it easy for refactoring tools to remove elements
from a list. Even if a matcher callback knows that it is removing an element
from a list, it may not have enough information to accurately remove the list
eleme... | Extends the range of a deletion if the deleted element was part of a list. | [
"Extends",
"the",
"range",
"of",
"a",
"deletion",
"if",
"the",
"deleted",
"element",
"was",
"part",
"of",
"a",
"list",
"."
] | def _ExtendDeletionIfElementIsInList(contents, offset):
"""Extends the range of a deletion if the deleted element was part of a list.
This rewriter helper makes it easy for refactoring tools to remove elements
from a list. Even if a matcher callback knows that it is removing an element
from a list, it may not ... | [
"def",
"_ExtendDeletionIfElementIsInList",
"(",
"contents",
",",
"offset",
")",
":",
"char_before",
"=",
"char_after",
"=",
"None",
"left_trim_count",
"=",
"0",
"for",
"byte",
"in",
"reversed",
"(",
"contents",
"[",
":",
"offset",
"]",
")",
":",
"left_trim_cou... | https://github.com/hanpfei/chromium-net/blob/392cc1fa3a8f92f42e4071ab6e674d8e0482f83f/tools/clang/scripts/run_tool.py#L245-L284 | ||
wxWidgets/wxPython-Classic | 19571e1ae65f1ac445f5491474121998c97a1bf0 | src/msw/_misc.py | python | CustomDataObject.__init__ | (self, *args) | __init__(self, DataFormat format) -> CustomDataObject
__init__(self, String formatName) -> CustomDataObject
__init__(self) -> CustomDataObject
wx.CustomDataObject is a specialization of `wx.DataObjectSimple` for
some application-specific data in arbitrary format. Python strings
... | __init__(self, DataFormat format) -> CustomDataObject
__init__(self, String formatName) -> CustomDataObject
__init__(self) -> CustomDataObject | [
"__init__",
"(",
"self",
"DataFormat",
"format",
")",
"-",
">",
"CustomDataObject",
"__init__",
"(",
"self",
"String",
"formatName",
")",
"-",
">",
"CustomDataObject",
"__init__",
"(",
"self",
")",
"-",
">",
"CustomDataObject"
] | def __init__(self, *args):
"""
__init__(self, DataFormat format) -> CustomDataObject
__init__(self, String formatName) -> CustomDataObject
__init__(self) -> CustomDataObject
wx.CustomDataObject is a specialization of `wx.DataObjectSimple` for
some application-specific d... | [
"def",
"__init__",
"(",
"self",
",",
"*",
"args",
")",
":",
"_misc_",
".",
"CustomDataObject_swiginit",
"(",
"self",
",",
"_misc_",
".",
"new_CustomDataObject",
"(",
"*",
"args",
")",
")"
] | https://github.com/wxWidgets/wxPython-Classic/blob/19571e1ae65f1ac445f5491474121998c97a1bf0/src/msw/_misc.py#L5368-L5380 | ||
Manu343726/siplasplas | 9fae7559f87087cf8ef34f04bd1e774b84b2ea9c | reference/cindex.py | python | Cursor.get_template_argument_type | (self, num) | return conf.lib.clang_Cursor_getTemplateArgumentType(self, num) | Returns the CXType for the indicated template argument. | Returns the CXType for the indicated template argument. | [
"Returns",
"the",
"CXType",
"for",
"the",
"indicated",
"template",
"argument",
"."
] | def get_template_argument_type(self, num):
"""Returns the CXType for the indicated template argument."""
return conf.lib.clang_Cursor_getTemplateArgumentType(self, num) | [
"def",
"get_template_argument_type",
"(",
"self",
",",
"num",
")",
":",
"return",
"conf",
".",
"lib",
".",
"clang_Cursor_getTemplateArgumentType",
"(",
"self",
",",
"num",
")"
] | https://github.com/Manu343726/siplasplas/blob/9fae7559f87087cf8ef34f04bd1e774b84b2ea9c/reference/cindex.py#L1487-L1489 | |
LLNL/lbann | 26083e6c86050302ce33148aea70f62e61cacb92 | python/lbann/core/layer.py | python | Layer.export_proto | (self) | return proto | Construct and return a protobuf message. | Construct and return a protobuf message. | [
"Construct",
"and",
"return",
"a",
"protobuf",
"message",
"."
] | def export_proto(self):
"""Construct and return a protobuf message."""
proto = layers_pb2.Layer()
proto.parents = ' '.join([l.name for l in self.parents])
proto.children = ' '.join([l.name for l in self.children])
proto.weights = ' '.join([w.name for w in self.weights])
p... | [
"def",
"export_proto",
"(",
"self",
")",
":",
"proto",
"=",
"layers_pb2",
".",
"Layer",
"(",
")",
"proto",
".",
"parents",
"=",
"' '",
".",
"join",
"(",
"[",
"l",
".",
"name",
"for",
"l",
"in",
"self",
".",
"parents",
"]",
")",
"proto",
".",
"chi... | https://github.com/LLNL/lbann/blob/26083e6c86050302ce33148aea70f62e61cacb92/python/lbann/core/layer.py#L58-L75 | |
tfwu/FaceDetection-ConvNet-3D | f9251c48eb40c5aec8fba7455115c355466555be | python/build/lib.linux-x86_64-2.7/mxnet/executor_manager.py | python | DataParallelExecutorManager.copy_to | (self, arg_params, aux_params) | Copy data from each executor to `arg_params` and `aux_params`
Parameters
----------
arg_params : list of NDArray
target parameter arrays
aux_params : list of NDArray
target aux arrays
Notes
-----
- This function will inplace update the NDAr... | Copy data from each executor to `arg_params` and `aux_params`
Parameters
----------
arg_params : list of NDArray
target parameter arrays
aux_params : list of NDArray
target aux arrays
Notes
-----
- This function will inplace update the NDAr... | [
"Copy",
"data",
"from",
"each",
"executor",
"to",
"arg_params",
"and",
"aux_params",
"Parameters",
"----------",
"arg_params",
":",
"list",
"of",
"NDArray",
"target",
"parameter",
"arrays",
"aux_params",
":",
"list",
"of",
"NDArray",
"target",
"aux",
"arrays",
"... | def copy_to(self, arg_params, aux_params):
""" Copy data from each executor to `arg_params` and `aux_params`
Parameters
----------
arg_params : list of NDArray
target parameter arrays
aux_params : list of NDArray
target aux arrays
Notes
---... | [
"def",
"copy_to",
"(",
"self",
",",
"arg_params",
",",
"aux_params",
")",
":",
"for",
"name",
",",
"block",
"in",
"zip",
"(",
"self",
".",
"param_names",
",",
"self",
".",
"param_arrays",
")",
":",
"weight",
"=",
"sum",
"(",
"w",
".",
"copyto",
"(",
... | https://github.com/tfwu/FaceDetection-ConvNet-3D/blob/f9251c48eb40c5aec8fba7455115c355466555be/python/build/lib.linux-x86_64-2.7/mxnet/executor_manager.py#L328-L345 | ||
OSGeo/gdal | 3748fc4ba4fba727492774b2b908a2130c864a83 | swig/python/osgeo/ogr.py | python | Feature.SetFieldString | (self, *args) | return _ogr.Feature_SetFieldString(self, *args) | r"""
SetFieldString(Feature self, int id, char const * value)
void
OGR_F_SetFieldString(OGRFeatureH hFeat, int iField, const char
*pszValue)
Set field to string value.
OFTInteger fields will be set based on an atoi() conversion of the
string. OFTInteger64 fields... | r"""
SetFieldString(Feature self, int id, char const * value)
void
OGR_F_SetFieldString(OGRFeatureH hFeat, int iField, const char
*pszValue) | [
"r",
"SetFieldString",
"(",
"Feature",
"self",
"int",
"id",
"char",
"const",
"*",
"value",
")",
"void",
"OGR_F_SetFieldString",
"(",
"OGRFeatureH",
"hFeat",
"int",
"iField",
"const",
"char",
"*",
"pszValue",
")"
] | def SetFieldString(self, *args):
r"""
SetFieldString(Feature self, int id, char const * value)
void
OGR_F_SetFieldString(OGRFeatureH hFeat, int iField, const char
*pszValue)
Set field to string value.
OFTInteger fields will be set based on an atoi() conversion o... | [
"def",
"SetFieldString",
"(",
"self",
",",
"*",
"args",
")",
":",
"return",
"_ogr",
".",
"Feature_SetFieldString",
"(",
"self",
",",
"*",
"args",
")"
] | https://github.com/OSGeo/gdal/blob/3748fc4ba4fba727492774b2b908a2130c864a83/swig/python/osgeo/ogr.py#L4183-L4215 | |
aws/lumberyard | f85344403c1c2e77ec8c75deb2c116e97b713217 | dev/Gems/CloudGemMetric/v1/AWS/python/windows/Lib/numba/targets/arrayobj.py | python | make_view | (context, builder, aryty, ary, return_type,
data, shapes, strides) | return retary | Build a view over the given array with the given parameters. | Build a view over the given array with the given parameters. | [
"Build",
"a",
"view",
"over",
"the",
"given",
"array",
"with",
"the",
"given",
"parameters",
"."
] | def make_view(context, builder, aryty, ary, return_type,
data, shapes, strides):
"""
Build a view over the given array with the given parameters.
"""
retary = make_array(return_type)(context, builder)
populate_array(retary,
data=data,
shape=shapes,... | [
"def",
"make_view",
"(",
"context",
",",
"builder",
",",
"aryty",
",",
"ary",
",",
"return_type",
",",
"data",
",",
"shapes",
",",
"strides",
")",
":",
"retary",
"=",
"make_array",
"(",
"return_type",
")",
"(",
"context",
",",
"builder",
")",
"populate_a... | https://github.com/aws/lumberyard/blob/f85344403c1c2e77ec8c75deb2c116e97b713217/dev/Gems/CloudGemMetric/v1/AWS/python/windows/Lib/numba/targets/arrayobj.py#L380-L393 | |
niwinz/phantompy | ae25ddb6791e13cb7c35126971c410030ee5dfda | phantompy/context.py | python | Context.get_all_cookies | (self) | return json.loads(util.force_text(cookies_json)) | Get all available cookies. | Get all available cookies. | [
"Get",
"all",
"available",
"cookies",
"."
] | def get_all_cookies(self):
"""
Get all available cookies.
"""
cookies_json = lib.ph_context_get_all_cookies()
return json.loads(util.force_text(cookies_json)) | [
"def",
"get_all_cookies",
"(",
"self",
")",
":",
"cookies_json",
"=",
"lib",
".",
"ph_context_get_all_cookies",
"(",
")",
"return",
"json",
".",
"loads",
"(",
"util",
".",
"force_text",
"(",
"cookies_json",
")",
")"
] | https://github.com/niwinz/phantompy/blob/ae25ddb6791e13cb7c35126971c410030ee5dfda/phantompy/context.py#L34-L39 | |
baidu-research/tensorflow-allreduce | 66d5b855e90b0949e9fa5cca5599fd729a70e874 | tensorflow/contrib/labeled_tensor/python/ops/_typecheck.py | python | _type_repr | (t) | return string | A more succinct repr for typecheck tracebacks. | A more succinct repr for typecheck tracebacks. | [
"A",
"more",
"succinct",
"repr",
"for",
"typecheck",
"tracebacks",
"."
] | def _type_repr(t):
"""A more succinct repr for typecheck tracebacks."""
string = repr(t)
for type_, alias in _TYPE_ABBREVIATIONS.items():
string = string.replace(repr(type_), alias)
string = re.sub(r"<(class|type) '([\w.]+)'>", r"\2", string)
string = re.sub(r"typecheck\.(\w+)", r"\1", string)
return st... | [
"def",
"_type_repr",
"(",
"t",
")",
":",
"string",
"=",
"repr",
"(",
"t",
")",
"for",
"type_",
",",
"alias",
"in",
"_TYPE_ABBREVIATIONS",
".",
"items",
"(",
")",
":",
"string",
"=",
"string",
".",
"replace",
"(",
"repr",
"(",
"type_",
")",
",",
"al... | https://github.com/baidu-research/tensorflow-allreduce/blob/66d5b855e90b0949e9fa5cca5599fd729a70e874/tensorflow/contrib/labeled_tensor/python/ops/_typecheck.py#L202-L209 | |
PaddlePaddle/Paddle | 1252f4bb3e574df80aa6d18c7ddae1b3a90bd81c | python/paddle/fluid/transpiler/collective.py | python | MultiThread._update_adam_ops | (self) | remove the original adam op, and add new adam ops | remove the original adam op, and add new adam ops | [
"remove",
"the",
"original",
"adam",
"op",
"and",
"add",
"new",
"adam",
"ops"
] | def _update_adam_ops(self):
"""
remove the original adam op, and add new adam ops
"""
block = self.main_program.global_block()
for idx, op in reversed(list(enumerate(block.ops))):
if self._is_optimizer_op(op):
offset = idx
if op.type !... | [
"def",
"_update_adam_ops",
"(",
"self",
")",
":",
"block",
"=",
"self",
".",
"main_program",
".",
"global_block",
"(",
")",
"for",
"idx",
",",
"op",
"in",
"reversed",
"(",
"list",
"(",
"enumerate",
"(",
"block",
".",
"ops",
")",
")",
")",
":",
"if",
... | https://github.com/PaddlePaddle/Paddle/blob/1252f4bb3e574df80aa6d18c7ddae1b3a90bd81c/python/paddle/fluid/transpiler/collective.py#L552-L616 | ||
aws/lumberyard | f85344403c1c2e77ec8c75deb2c116e97b713217 | dev/Tools/Python/3.7.10/linux_x64/lib/python3.7/site-packages/botocore/config.py | python | Config.merge | (self, other_config) | return Config(**config_options) | Merges the config object with another config object
This will merge in all non-default values from the provided config
and return a new config object
:type other_config: botocore.config.Config
:param other config: Another config object to merge with. The values
in the provi... | Merges the config object with another config object | [
"Merges",
"the",
"config",
"object",
"with",
"another",
"config",
"object"
] | def merge(self, other_config):
"""Merges the config object with another config object
This will merge in all non-default values from the provided config
and return a new config object
:type other_config: botocore.config.Config
:param other config: Another config object to merge... | [
"def",
"merge",
"(",
"self",
",",
"other_config",
")",
":",
"# Make a copy of the current attributes in the config object.",
"config_options",
"=",
"copy",
".",
"copy",
"(",
"self",
".",
"_user_provided_options",
")",
"# Merge in the user provided options from the other config"... | https://github.com/aws/lumberyard/blob/f85344403c1c2e77ec8c75deb2c116e97b713217/dev/Tools/Python/3.7.10/linux_x64/lib/python3.7/site-packages/botocore/config.py#L249-L269 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.