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 |
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
bristolcrypto/SPDZ-2 | 721abfae849625a02ea49aabc534f9cf41ca643f | Compiler/path_oram.py | python | shuffle | (x, config=None, value_type=sgf2n, reverse=False) | return config | Simulate secure shuffling with Waksman network for 2 players.
Returns the network switching config so it may be re-used later. | Simulate secure shuffling with Waksman network for 2 players. | [
"Simulate",
"secure",
"shuffling",
"with",
"Waksman",
"network",
"for",
"2",
"players",
"."
] | def shuffle(x, config=None, value_type=sgf2n, reverse=False):
""" Simulate secure shuffling with Waksman network for 2 players.
Returns the network switching config so it may be re-used later. """
n = len(x)
if n & (n-1) != 0:
raise CompilerError('shuffle requires n a power of 2')
if conf... | [
"def",
"shuffle",
"(",
"x",
",",
"config",
"=",
"None",
",",
"value_type",
"=",
"sgf2n",
",",
"reverse",
"=",
"False",
")",
":",
"n",
"=",
"len",
"(",
"x",
")",
"if",
"n",
"&",
"(",
"n",
"-",
"1",
")",
"!=",
"0",
":",
"raise",
"CompilerError",
... | https://github.com/bristolcrypto/SPDZ-2/blob/721abfae849625a02ea49aabc534f9cf41ca643f/Compiler/path_oram.py#L112-L127 | |
Kitware/ParaView | f760af9124ff4634b23ebbeab95a4f56e0261955 | ThirdParty/cinema/paraview/tpl/cinema_python/database/raster_wrangler.py | python | RasterWrangler.valuereader | (self, fname, shape=None) | Opens a value image file and returns it as either a color buffer
or a floating point array (depending on how the image was exported). | Opens a value image file and returns it as either a color buffer
or a floating point array (depending on how the image was exported). | [
"Opens",
"a",
"value",
"image",
"file",
"and",
"returns",
"it",
"as",
"either",
"a",
"color",
"buffer",
"or",
"a",
"floating",
"point",
"array",
"(",
"depending",
"on",
"how",
"the",
"image",
"was",
"exported",
")",
"."
] | def valuereader(self, fname, shape=None):
""" Opens a value image file and returns it as either a color buffer
or a floating point array (depending on how the image was exported)."""
baseName, ext = os.path.splitext(fname)
if ext == self.floatExtension():
# Treat as single ch... | [
"def",
"valuereader",
"(",
"self",
",",
"fname",
",",
"shape",
"=",
"None",
")",
":",
"baseName",
",",
"ext",
"=",
"os",
".",
"path",
".",
"splitext",
"(",
"fname",
")",
"if",
"ext",
"==",
"self",
".",
"floatExtension",
"(",
")",
":",
"# Treat as sin... | https://github.com/Kitware/ParaView/blob/f760af9124ff4634b23ebbeab95a4f56e0261955/ThirdParty/cinema/paraview/tpl/cinema_python/database/raster_wrangler.py#L275-L284 | ||
google/mozc | 7329757e1ad30e327c1ae823a8302c79482d6b9c | src/build_tools/embed_file.py | python | _FormatAsUint64LittleEndian | (s) | return six.b('0x%s') % binascii.b2a_hex(s) | Formats a string as uint64 value in little endian order. | Formats a string as uint64 value in little endian order. | [
"Formats",
"a",
"string",
"as",
"uint64",
"value",
"in",
"little",
"endian",
"order",
"."
] | def _FormatAsUint64LittleEndian(s):
"""Formats a string as uint64 value in little endian order."""
for _ in range(len(s), 8):
s += six.b('\0')
s = s[::-1] # Reverse the string
return six.b('0x%s') % binascii.b2a_hex(s) | [
"def",
"_FormatAsUint64LittleEndian",
"(",
"s",
")",
":",
"for",
"_",
"in",
"range",
"(",
"len",
"(",
"s",
")",
",",
"8",
")",
":",
"s",
"+=",
"six",
".",
"b",
"(",
"'\\0'",
")",
"s",
"=",
"s",
"[",
":",
":",
"-",
"1",
"]",
"# Reverse the strin... | https://github.com/google/mozc/blob/7329757e1ad30e327c1ae823a8302c79482d6b9c/src/build_tools/embed_file.py#L51-L56 | |
Xilinx/Vitis-AI | fc74d404563d9951b57245443c73bef389f3657f | tools/Vitis-AI-Quantizer/vai_q_tensorflow2.x/tensorflow_model_optimization/python/core/quantization/keras/layers/conv_batchnorm.py | python | _ConvBatchNormMixin._get_config | (self, conv_config) | return dict(
list(conv_config.items()) + list(batchnorm_config.items()) +
list(config.items())) | All shared get_config logic for fused layers. | All shared get_config logic for fused layers. | [
"All",
"shared",
"get_config",
"logic",
"for",
"fused",
"layers",
"."
] | def _get_config(self, conv_config):
"""All shared get_config logic for fused layers."""
batchnorm_config = self.batchnorm.get_config()
# Both BatchNorm and Conv2D have config items from base layer. Since
# _ConvBatchNorm2D inherits from Conv2D, we should use base layer config
# items from self, rat... | [
"def",
"_get_config",
"(",
"self",
",",
"conv_config",
")",
":",
"batchnorm_config",
"=",
"self",
".",
"batchnorm",
".",
"get_config",
"(",
")",
"# Both BatchNorm and Conv2D have config items from base layer. Since",
"# _ConvBatchNorm2D inherits from Conv2D, we should use base la... | https://github.com/Xilinx/Vitis-AI/blob/fc74d404563d9951b57245443c73bef389f3657f/tools/Vitis-AI-Quantizer/vai_q_tensorflow2.x/tensorflow_model_optimization/python/core/quantization/keras/layers/conv_batchnorm.py#L123-L149 | |
catboost/catboost | 167f64f237114a4d10b2b4ee42adb4569137debe | contrib/tools/python3/src/Lib/threading.py | python | Thread._delete | (self) | Remove current thread from the dict of currently running threads. | Remove current thread from the dict of currently running threads. | [
"Remove",
"current",
"thread",
"from",
"the",
"dict",
"of",
"currently",
"running",
"threads",
"."
] | def _delete(self):
"Remove current thread from the dict of currently running threads."
with _active_limbo_lock:
del _active[get_ident()] | [
"def",
"_delete",
"(",
"self",
")",
":",
"with",
"_active_limbo_lock",
":",
"del",
"_active",
"[",
"get_ident",
"(",
")",
"]"
] | https://github.com/catboost/catboost/blob/167f64f237114a4d10b2b4ee42adb4569137debe/contrib/tools/python3/src/Lib/threading.py#L1012-L1015 | ||
catboost/catboost | 167f64f237114a4d10b2b4ee42adb4569137debe | contrib/python/scikit-learn/py3/sklearn/utils/estimator_checks.py | python | _set_check_estimator_ids | (obj) | Create pytest ids for checks.
When `obj` is an estimator, this returns the pprint version of the
estimator (with `print_changed_only=True`). When `obj` is a function, the
name of the function is returned with its keyworld arguments.
`_set_check_estimator_ids` is designed to be used as the `id` in
... | Create pytest ids for checks. | [
"Create",
"pytest",
"ids",
"for",
"checks",
"."
] | def _set_check_estimator_ids(obj):
"""Create pytest ids for checks.
When `obj` is an estimator, this returns the pprint version of the
estimator (with `print_changed_only=True`). When `obj` is a function, the
name of the function is returned with its keyworld arguments.
`_set_check_estimator_ids` ... | [
"def",
"_set_check_estimator_ids",
"(",
"obj",
")",
":",
"if",
"callable",
"(",
"obj",
")",
":",
"if",
"not",
"isinstance",
"(",
"obj",
",",
"partial",
")",
":",
"return",
"obj",
".",
"__name__",
"if",
"not",
"obj",
".",
"keywords",
":",
"return",
"obj... | https://github.com/catboost/catboost/blob/167f64f237114a4d10b2b4ee42adb4569137debe/contrib/python/scikit-learn/py3/sklearn/utils/estimator_checks.py#L283-L319 | ||
genn-team/genn | 75e1eb218cafa228bf36ae4613d1ce26e877b12c | pygenn/genn_model.py | python | create_cksf_class | (cks_func) | return type("", (cksf,), {"__init__": ctor, "__call__": call}) | Helper function to create function class for calculating sizes
of kernels from connectivity initialiser parameters
Args:
cks_func -- a function which computes the kernel size and takes
one arg "pars" (vector of double) | Helper function to create function class for calculating sizes
of kernels from connectivity initialiser parameters | [
"Helper",
"function",
"to",
"create",
"function",
"class",
"for",
"calculating",
"sizes",
"of",
"kernels",
"from",
"connectivity",
"initialiser",
"parameters"
] | def create_cksf_class(cks_func):
"""Helper function to create function class for calculating sizes
of kernels from connectivity initialiser parameters
Args:
cks_func -- a function which computes the kernel size and takes
one arg "pars" (vector of double)
"""
cksf = genn_wrappe... | [
"def",
"create_cksf_class",
"(",
"cks_func",
")",
":",
"cksf",
"=",
"genn_wrapper",
".",
"InitSparseConnectivitySnippet",
".",
"CalcKernelSizeFunc",
"def",
"ctor",
"(",
"self",
")",
":",
"cksf",
".",
"__init__",
"(",
"self",
")",
"def",
"call",
"(",
"self",
... | https://github.com/genn-team/genn/blob/75e1eb218cafa228bf36ae4613d1ce26e877b12c/pygenn/genn_model.py#L1546-L1562 | |
RamadhanAmizudin/malware | 2c6c53c8b0d556f5d8078d6ca0fc4448f4697cf1 | Fuzzbunch/fuzzbunch/pluginmanager.py | python | PluginManager.do_validate | (self, *ignore) | Validate the current parameter settings | Validate the current parameter settings | [
"Validate",
"the",
"current",
"parameter",
"settings"
] | def do_validate(self, *ignore):
"""Validate the current parameter settings"""
plugin = self.get_active_plugin()
self.io.print_msg("Checking %s parameters" % plugin.getName())
self.io.newline()
if plugin.validate(self.session.get_dirs(), globalvars=self.fb.fbglobalvars) and self.... | [
"def",
"do_validate",
"(",
"self",
",",
"*",
"ignore",
")",
":",
"plugin",
"=",
"self",
".",
"get_active_plugin",
"(",
")",
"self",
".",
"io",
".",
"print_msg",
"(",
"\"Checking %s parameters\"",
"%",
"plugin",
".",
"getName",
"(",
")",
")",
"self",
".",... | https://github.com/RamadhanAmizudin/malware/blob/2c6c53c8b0d556f5d8078d6ca0fc4448f4697cf1/Fuzzbunch/fuzzbunch/pluginmanager.py#L243-L252 | ||
baidu-research/tensorflow-allreduce | 66d5b855e90b0949e9fa5cca5599fd729a70e874 | tensorflow/contrib/linalg/python/ops/linear_operator.py | python | LinearOperator.assert_positive_definite | (self, name="assert_positive_definite") | Returns an `Op` that asserts this operator is positive definite.
Here, positive definite means that the quadratic form `x^H A x` has positive
real part for all nonzero `x`. Note that we do not require the operator to
be self-adjoint to be positive definite.
Args:
name: A name to give this `Op`... | Returns an `Op` that asserts this operator is positive definite. | [
"Returns",
"an",
"Op",
"that",
"asserts",
"this",
"operator",
"is",
"positive",
"definite",
"."
] | def assert_positive_definite(self, name="assert_positive_definite"):
"""Returns an `Op` that asserts this operator is positive definite.
Here, positive definite means that the quadratic form `x^H A x` has positive
real part for all nonzero `x`. Note that we do not require the operator to
be self-adjoi... | [
"def",
"assert_positive_definite",
"(",
"self",
",",
"name",
"=",
"\"assert_positive_definite\"",
")",
":",
"with",
"self",
".",
"_name_scope",
"(",
"name",
")",
":",
"return",
"self",
".",
"_assert_positive_definite",
"(",
")"
] | https://github.com/baidu-research/tensorflow-allreduce/blob/66d5b855e90b0949e9fa5cca5599fd729a70e874/tensorflow/contrib/linalg/python/ops/linear_operator.py#L530-L545 | ||
tensorflow/tensorflow | 419e3a6b650ea4bd1b0cba23c4348f8a69f3272e | tensorflow/python/feature_column/feature_column_v2.py | python | is_feature_column_v2 | (feature_columns) | return True | Returns True if all feature columns are V2. | Returns True if all feature columns are V2. | [
"Returns",
"True",
"if",
"all",
"feature",
"columns",
"are",
"V2",
"."
] | def is_feature_column_v2(feature_columns):
"""Returns True if all feature columns are V2."""
for feature_column in feature_columns:
if not isinstance(feature_column, FeatureColumn):
return False
if not feature_column._is_v2_column: # pylint: disable=protected-access
return False
return True | [
"def",
"is_feature_column_v2",
"(",
"feature_columns",
")",
":",
"for",
"feature_column",
"in",
"feature_columns",
":",
"if",
"not",
"isinstance",
"(",
"feature_column",
",",
"FeatureColumn",
")",
":",
"return",
"False",
"if",
"not",
"feature_column",
".",
"_is_v2... | https://github.com/tensorflow/tensorflow/blob/419e3a6b650ea4bd1b0cba23c4348f8a69f3272e/tensorflow/python/feature_column/feature_column_v2.py#L2217-L2224 | |
catboost/catboost | 167f64f237114a4d10b2b4ee42adb4569137debe | contrib/tools/python/src/Lib/multiprocessing/util.py | python | get_logger | () | return _logger | Returns logger used by multiprocessing | Returns logger used by multiprocessing | [
"Returns",
"logger",
"used",
"by",
"multiprocessing"
] | def get_logger():
'''
Returns logger used by multiprocessing
'''
global _logger
import logging, atexit
logging._acquireLock()
try:
if not _logger:
_logger = logging.getLogger(LOGGER_NAME)
_logger.propagate = 0
logging.addLevelName(SUBDEBUG, 'SUBD... | [
"def",
"get_logger",
"(",
")",
":",
"global",
"_logger",
"import",
"logging",
",",
"atexit",
"logging",
".",
"_acquireLock",
"(",
")",
"try",
":",
"if",
"not",
"_logger",
":",
"_logger",
"=",
"logging",
".",
"getLogger",
"(",
"LOGGER_NAME",
")",
"_logger",... | https://github.com/catboost/catboost/blob/167f64f237114a4d10b2b4ee42adb4569137debe/contrib/tools/python/src/Lib/multiprocessing/util.py#L84-L111 | |
wxWidgets/wxPython-Classic | 19571e1ae65f1ac445f5491474121998c97a1bf0 | src/osx_carbon/html2.py | python | WebView.GetSelectedText | (*args, **kwargs) | return _html2.WebView_GetSelectedText(*args, **kwargs) | GetSelectedText(self) -> String | GetSelectedText(self) -> String | [
"GetSelectedText",
"(",
"self",
")",
"-",
">",
"String"
] | def GetSelectedText(*args, **kwargs):
"""GetSelectedText(self) -> String"""
return _html2.WebView_GetSelectedText(*args, **kwargs) | [
"def",
"GetSelectedText",
"(",
"*",
"args",
",",
"*",
"*",
"kwargs",
")",
":",
"return",
"_html2",
".",
"WebView_GetSelectedText",
"(",
"*",
"args",
",",
"*",
"*",
"kwargs",
")"
] | https://github.com/wxWidgets/wxPython-Classic/blob/19571e1ae65f1ac445f5491474121998c97a1bf0/src/osx_carbon/html2.py#L278-L280 | |
baidu-research/tensorflow-allreduce | 66d5b855e90b0949e9fa5cca5599fd729a70e874 | tensorflow/contrib/timeseries/python/timeseries/state_space_models/varma.py | python | VARMA.__init__ | (self,
autoregressive_order,
moving_average_order,
configuration=state_space_model.StateSpaceModelConfiguration()) | Construct a VARMA model.
The size of the latent state for this model is:
num_features * max(autoregressive_order, moving_average_order + 1)
Square matrices of this size are constructed and multiplied.
Args:
autoregressive_order: The maximum autoregressive lag.
moving_average_order: The m... | Construct a VARMA model. | [
"Construct",
"a",
"VARMA",
"model",
"."
] | def __init__(self,
autoregressive_order,
moving_average_order,
configuration=state_space_model.StateSpaceModelConfiguration()):
"""Construct a VARMA model.
The size of the latent state for this model is:
num_features * max(autoregressive_order, moving_average_... | [
"def",
"__init__",
"(",
"self",
",",
"autoregressive_order",
",",
"moving_average_order",
",",
"configuration",
"=",
"state_space_model",
".",
"StateSpaceModelConfiguration",
"(",
")",
")",
":",
"self",
".",
"ar_order",
"=",
"autoregressive_order",
"self",
".",
"ma_... | https://github.com/baidu-research/tensorflow-allreduce/blob/66d5b855e90b0949e9fa5cca5599fd729a70e874/tensorflow/contrib/timeseries/python/timeseries/state_space_models/varma.py#L65-L85 | ||
VowpalWabbit/vowpal_wabbit | 866b8fa88ff85a957c7eb72065ea44518b9ba416 | python/vowpalwabbit/sklearn.py | python | VWMultiClassifier.predict_proba | (self, X) | return VW.predict(self, X=X) | Predict probabilities for each class.
Args:
X : {array-like, sparse matrix}, shape = (n_samples, n_features)
Samples.
Returns:
array, shape=(n_samples,) if n_classes == 2 else (n_samples, n_classes)
Confidence scores per (sample, class) combinati... | Predict probabilities for each class. | [
"Predict",
"probabilities",
"for",
"each",
"class",
"."
] | def predict_proba(self, X):
"""Predict probabilities for each class.
Args:
X : {array-like, sparse matrix}, shape = (n_samples, n_features)
Samples.
Returns:
array, shape=(n_samples,) if n_classes == 2 else (n_samples, n_classes)
Confiden... | [
"def",
"predict_proba",
"(",
"self",
",",
"X",
")",
":",
"return",
"VW",
".",
"predict",
"(",
"self",
",",
"X",
"=",
"X",
")"
] | https://github.com/VowpalWabbit/vowpal_wabbit/blob/866b8fa88ff85a957c7eb72065ea44518b9ba416/python/vowpalwabbit/sklearn.py#L720-L748 | |
wxWidgets/wxPython-Classic | 19571e1ae65f1ac445f5491474121998c97a1bf0 | src/gtk/grid.py | python | Grid.MovePageDown | (*args, **kwargs) | return _grid.Grid_MovePageDown(*args, **kwargs) | MovePageDown(self) -> bool | MovePageDown(self) -> bool | [
"MovePageDown",
"(",
"self",
")",
"-",
">",
"bool"
] | def MovePageDown(*args, **kwargs):
"""MovePageDown(self) -> bool"""
return _grid.Grid_MovePageDown(*args, **kwargs) | [
"def",
"MovePageDown",
"(",
"*",
"args",
",",
"*",
"*",
"kwargs",
")",
":",
"return",
"_grid",
".",
"Grid_MovePageDown",
"(",
"*",
"args",
",",
"*",
"*",
"kwargs",
")"
] | https://github.com/wxWidgets/wxPython-Classic/blob/19571e1ae65f1ac445f5491474121998c97a1bf0/src/gtk/grid.py#L1446-L1448 | |
wxWidgets/wxPython-Classic | 19571e1ae65f1ac445f5491474121998c97a1bf0 | src/osx_cocoa/_gdi.py | python | Bitmap.SetDepth | (*args, **kwargs) | return _gdi_.Bitmap_SetDepth(*args, **kwargs) | SetDepth(self, int depth)
Set the depth property (does not affect the existing bitmap data). | SetDepth(self, int depth) | [
"SetDepth",
"(",
"self",
"int",
"depth",
")"
] | def SetDepth(*args, **kwargs):
"""
SetDepth(self, int depth)
Set the depth property (does not affect the existing bitmap data).
"""
return _gdi_.Bitmap_SetDepth(*args, **kwargs) | [
"def",
"SetDepth",
"(",
"*",
"args",
",",
"*",
"*",
"kwargs",
")",
":",
"return",
"_gdi_",
".",
"Bitmap_SetDepth",
"(",
"*",
"args",
",",
"*",
"*",
"kwargs",
")"
] | https://github.com/wxWidgets/wxPython-Classic/blob/19571e1ae65f1ac445f5491474121998c97a1bf0/src/osx_cocoa/_gdi.py#L773-L779 | |
aws/lumberyard | f85344403c1c2e77ec8c75deb2c116e97b713217 | dev/Tools/Python/3.7.10/windows/Lib/site-packages/setuptools/_vendor/pyparsing.py | python | ParseBaseException.__getattr__ | ( self, aname ) | supported attributes by name are:
- lineno - returns the line number of the exception text
- col - returns the column number of the exception text
- line - returns the line containing the exception text | supported attributes by name are:
- lineno - returns the line number of the exception text
- col - returns the column number of the exception text
- line - returns the line containing the exception text | [
"supported",
"attributes",
"by",
"name",
"are",
":",
"-",
"lineno",
"-",
"returns",
"the",
"line",
"number",
"of",
"the",
"exception",
"text",
"-",
"col",
"-",
"returns",
"the",
"column",
"number",
"of",
"the",
"exception",
"text",
"-",
"line",
"-",
"ret... | def __getattr__( self, aname ):
"""supported attributes by name are:
- lineno - returns the line number of the exception text
- col - returns the column number of the exception text
- line - returns the line containing the exception text
"""
if( aname == "line... | [
"def",
"__getattr__",
"(",
"self",
",",
"aname",
")",
":",
"if",
"(",
"aname",
"==",
"\"lineno\"",
")",
":",
"return",
"lineno",
"(",
"self",
".",
"loc",
",",
"self",
".",
"pstr",
")",
"elif",
"(",
"aname",
"in",
"(",
"\"col\"",
",",
"\"column\"",
... | https://github.com/aws/lumberyard/blob/f85344403c1c2e77ec8c75deb2c116e97b713217/dev/Tools/Python/3.7.10/windows/Lib/site-packages/setuptools/_vendor/pyparsing.py#L228-L241 | ||
idaholab/moose | 9eeebc65e098b4c30f8205fb41591fd5b61eb6ff | python/MooseDocs/base/renderers.py | python | Renderer.__getFunction | (self, token) | return self.__functions.get(token.name, None) | Return the desired function for the supplied token object.
Inputs:
token[tree.token]: token for which the associated RenderComponent function is desired. | Return the desired function for the supplied token object. | [
"Return",
"the",
"desired",
"function",
"for",
"the",
"supplied",
"token",
"object",
"."
] | def __getFunction(self, token):
"""
Return the desired function for the supplied token object.
Inputs:
token[tree.token]: token for which the associated RenderComponent function is desired.
"""
return self.__functions.get(token.name, None) | [
"def",
"__getFunction",
"(",
"self",
",",
"token",
")",
":",
"return",
"self",
".",
"__functions",
".",
"get",
"(",
"token",
".",
"name",
",",
"None",
")"
] | https://github.com/idaholab/moose/blob/9eeebc65e098b4c30f8205fb41591fd5b61eb6ff/python/MooseDocs/base/renderers.py#L210-L217 | |
aws/lumberyard | f85344403c1c2e77ec8c75deb2c116e97b713217 | dev/Tools/Python/3.7.10/windows/Lib/imaplib.py | python | Int2AP | (num) | return val | Convert integer to A-P string representation. | Convert integer to A-P string representation. | [
"Convert",
"integer",
"to",
"A",
"-",
"P",
"string",
"representation",
"."
] | def Int2AP(num):
"""Convert integer to A-P string representation."""
val = b''; AP = b'ABCDEFGHIJKLMNOP'
num = int(abs(num))
while num:
num, mod = divmod(num, 16)
val = AP[mod:mod+1] + val
return val | [
"def",
"Int2AP",
"(",
"num",
")",
":",
"val",
"=",
"b''",
"AP",
"=",
"b'ABCDEFGHIJKLMNOP'",
"num",
"=",
"int",
"(",
"abs",
"(",
"num",
")",
")",
"while",
"num",
":",
"num",
",",
"mod",
"=",
"divmod",
"(",
"num",
",",
"16",
")",
"val",
"=",
"AP"... | https://github.com/aws/lumberyard/blob/f85344403c1c2e77ec8c75deb2c116e97b713217/dev/Tools/Python/3.7.10/windows/Lib/imaplib.py#L1445-L1454 | |
GrammaTech/gtirb | 415dd72e1e3c475004d013723c16cdcb29c0826e | python/gtirb/module.py | python | Module.code_blocks_at | (
self, addrs: typing.Union[int, range]
) | return itertools.chain.from_iterable(
s.code_blocks_at(addrs) for s in self.sections
) | Finds all the code blocks that begin at an address or range of
addresses.
:param addrs: Either a ``range`` object or a single address. | Finds all the code blocks that begin at an address or range of
addresses. | [
"Finds",
"all",
"the",
"code",
"blocks",
"that",
"begin",
"at",
"an",
"address",
"or",
"range",
"of",
"addresses",
"."
] | def code_blocks_at(
self, addrs: typing.Union[int, range]
) -> typing.Iterable[CodeBlock]:
"""Finds all the code blocks that begin at an address or range of
addresses.
:param addrs: Either a ``range`` object or a single address.
"""
return itertools.chain.from_itera... | [
"def",
"code_blocks_at",
"(",
"self",
",",
"addrs",
":",
"typing",
".",
"Union",
"[",
"int",
",",
"range",
"]",
")",
"->",
"typing",
".",
"Iterable",
"[",
"CodeBlock",
"]",
":",
"return",
"itertools",
".",
"chain",
".",
"from_iterable",
"(",
"s",
".",
... | https://github.com/GrammaTech/gtirb/blob/415dd72e1e3c475004d013723c16cdcb29c0826e/python/gtirb/module.py#L523-L534 | |
ros-planning/moveit | ee48dc5cedc981d0869352aa3db0b41469c2735c | moveit_commander/src/moveit_commander/move_group.py | python | MoveGroupCommander.set_joint_value_target | (self, arg1, arg2=None, arg3=None) | Specify a target joint configuration for the group.
- if the type of arg1 is one of the following: dict, list, JointState message, then no other arguments should be provided.
The dict should specify pairs of joint variable names and their target values, the list should specify all the variable values
... | Specify a target joint configuration for the group.
- if the type of arg1 is one of the following: dict, list, JointState message, then no other arguments should be provided.
The dict should specify pairs of joint variable names and their target values, the list should specify all the variable values
... | [
"Specify",
"a",
"target",
"joint",
"configuration",
"for",
"the",
"group",
".",
"-",
"if",
"the",
"type",
"of",
"arg1",
"is",
"one",
"of",
"the",
"following",
":",
"dict",
"list",
"JointState",
"message",
"then",
"no",
"other",
"arguments",
"should",
"be",... | def set_joint_value_target(self, arg1, arg2=None, arg3=None):
"""
Specify a target joint configuration for the group.
- if the type of arg1 is one of the following: dict, list, JointState message, then no other arguments should be provided.
The dict should specify pairs of joint variable... | [
"def",
"set_joint_value_target",
"(",
"self",
",",
"arg1",
",",
"arg2",
"=",
"None",
",",
"arg3",
"=",
"None",
")",
":",
"if",
"isinstance",
"(",
"arg1",
",",
"RobotState",
")",
":",
"if",
"not",
"self",
".",
"_g",
".",
"set_state_value_target",
"(",
"... | https://github.com/ros-planning/moveit/blob/ee48dc5cedc981d0869352aa3db0b41469c2735c/moveit_commander/src/moveit_commander/move_group.py#L199-L290 | ||
openmm/openmm | cb293447c4fc8b03976dfe11399f107bab70f3d9 | wrappers/python/openmm/app/topology.py | python | Topology.addAtom | (self, name, element, residue, id=None) | return atom | Create a new Atom and add it to the Topology.
Parameters
----------
name : string
The name of the atom to add
element : Element
The element of the atom to add
residue : Residue
The Residue to add it to
id : string=None
An o... | Create a new Atom and add it to the Topology. | [
"Create",
"a",
"new",
"Atom",
"and",
"add",
"it",
"to",
"the",
"Topology",
"."
] | def addAtom(self, name, element, residue, id=None):
"""Create a new Atom and add it to the Topology.
Parameters
----------
name : string
The name of the atom to add
element : Element
The element of the atom to add
residue : Residue
The... | [
"def",
"addAtom",
"(",
"self",
",",
"name",
",",
"element",
",",
"residue",
",",
"id",
"=",
"None",
")",
":",
"if",
"len",
"(",
"residue",
".",
"_atoms",
")",
">",
"0",
"and",
"self",
".",
"_numAtoms",
"!=",
"residue",
".",
"_atoms",
"[",
"-",
"1... | https://github.com/openmm/openmm/blob/cb293447c4fc8b03976dfe11399f107bab70f3d9/wrappers/python/openmm/app/topology.py#L169-L196 | |
Xilinx/XRT | dd071c90309df61d3ecdd92dca39f43804915c99 | src/python/xrt_binding.py | python | xclLockDevice | (handle) | return 0 | The function is NOP; it exists for backward compatiblity. | The function is NOP; it exists for backward compatiblity. | [
"The",
"function",
"is",
"NOP",
";",
"it",
"exists",
"for",
"backward",
"compatiblity",
"."
] | def xclLockDevice(handle):
"""
The function is NOP; it exists for backward compatiblity.
"""
_xclDeprecation(sys._getframe().f_code.co_name)
return 0 | [
"def",
"xclLockDevice",
"(",
"handle",
")",
":",
"_xclDeprecation",
"(",
"sys",
".",
"_getframe",
"(",
")",
".",
"f_code",
".",
"co_name",
")",
"return",
"0"
] | https://github.com/Xilinx/XRT/blob/dd071c90309df61d3ecdd92dca39f43804915c99/src/python/xrt_binding.py#L320-L325 | |
mantidproject/mantid | 03deeb89254ec4289edb8771e0188c2090a02f32 | Framework/PythonInterface/plugins/algorithms/WorkflowAlgorithms/DirectILL_common.py | python | convertToWorkspaceIndex | (i, ws, indexType=INDEX_TYPE_DET_ID) | Convert given number to workspace index. | Convert given number to workspace index. | [
"Convert",
"given",
"number",
"to",
"workspace",
"index",
"."
] | def convertToWorkspaceIndex(i, ws, indexType=INDEX_TYPE_DET_ID):
"""Convert given number to workspace index."""
if indexType == INDEX_TYPE_WS_INDEX:
return i
elif indexType == INDEX_TYPE_SPECTRUM_NUMBER:
return ws.getIndexFromSpectrumNumber(i)
else: # INDEX_TYPE_DET_ID
for j in ... | [
"def",
"convertToWorkspaceIndex",
"(",
"i",
",",
"ws",
",",
"indexType",
"=",
"INDEX_TYPE_DET_ID",
")",
":",
"if",
"indexType",
"==",
"INDEX_TYPE_WS_INDEX",
":",
"return",
"i",
"elif",
"indexType",
"==",
"INDEX_TYPE_SPECTRUM_NUMBER",
":",
"return",
"ws",
".",
"g... | https://github.com/mantidproject/mantid/blob/03deeb89254ec4289edb8771e0188c2090a02f32/Framework/PythonInterface/plugins/algorithms/WorkflowAlgorithms/DirectILL_common.py#L136-L146 | ||
OGRECave/ogre-next | 287307980e6de8910f04f3cc0994451b075071fd | Tools/Wings3DExporter/pgon.py | python | triangulate | (pgon) | return t.process() | triangulate a polygon defined by its vertices | triangulate a polygon defined by its vertices | [
"triangulate",
"a",
"polygon",
"defined",
"by",
"its",
"vertices"
] | def triangulate(pgon):
"triangulate a polygon defined by its vertices"
t = Triangulator(pgon)
return t.process() | [
"def",
"triangulate",
"(",
"pgon",
")",
":",
"t",
"=",
"Triangulator",
"(",
"pgon",
")",
"return",
"t",
".",
"process",
"(",
")"
] | https://github.com/OGRECave/ogre-next/blob/287307980e6de8910f04f3cc0994451b075071fd/Tools/Wings3DExporter/pgon.py#L186-L191 | |
aws/lumberyard | f85344403c1c2e77ec8c75deb2c116e97b713217 | dev/Tools/build/waf-1.7.13/platforms/platform_impl_win_x64.py | python | run_unittest_launcher_for_win_x64 | (ctx, game_project_name) | Helper context function to execute the unit test launcher for a specific game project
:param ctx: Context
:param game_project_name: The current project name (extracted from bootstrap.cfg) | Helper context function to execute the unit test launcher for a specific game project | [
"Helper",
"context",
"function",
"to",
"execute",
"the",
"unit",
"test",
"launcher",
"for",
"a",
"specific",
"game",
"project"
] | def run_unittest_launcher_for_win_x64(ctx, game_project_name):
"""
Helper context function to execute the unit test launcher for a specific game project
:param ctx: Context
:param game_project_name: The current project name (extracted from bootstrap.cfg)
"""
output_folde... | [
"def",
"run_unittest_launcher_for_win_x64",
"(",
"ctx",
",",
"game_project_name",
")",
":",
"output_folder",
"=",
"ctx",
".",
"get_output_folders",
"(",
"ctx",
".",
"platform",
",",
"ctx",
".",
"config",
")",
"[",
"0",
"]",
"current_project_launcher",
"=",
"ctx"... | https://github.com/aws/lumberyard/blob/f85344403c1c2e77ec8c75deb2c116e97b713217/dev/Tools/build/waf-1.7.13/platforms/platform_impl_win_x64.py#L41-L74 | ||
SFTtech/openage | d6a08c53c48dc1e157807471df92197f6ca9e04d | openage/util/ordered_set.py | python | OrderedSet.union | (self, other) | return OrderedSet(element_list) | Returns a new ordered set with the elements from self and other. | Returns a new ordered set with the elements from self and other. | [
"Returns",
"a",
"new",
"ordered",
"set",
"with",
"the",
"elements",
"from",
"self",
"and",
"other",
"."
] | def union(self, other):
"""
Returns a new ordered set with the elements from self and other.
"""
element_list = self.get_list() + other.get_list()
return OrderedSet(element_list) | [
"def",
"union",
"(",
"self",
",",
"other",
")",
":",
"element_list",
"=",
"self",
".",
"get_list",
"(",
")",
"+",
"other",
".",
"get_list",
"(",
")",
"return",
"OrderedSet",
"(",
"element_list",
")"
] | https://github.com/SFTtech/openage/blob/d6a08c53c48dc1e157807471df92197f6ca9e04d/openage/util/ordered_set.py#L90-L95 | |
catboost/catboost | 167f64f237114a4d10b2b4ee42adb4569137debe | contrib/python/numpy/py3/numpy/lib/format.py | python | _wrap_header | (header, version) | return header_prefix + header + b' '*padlen + b'\n' | Takes a stringified header, and attaches the prefix and padding to it | Takes a stringified header, and attaches the prefix and padding to it | [
"Takes",
"a",
"stringified",
"header",
"and",
"attaches",
"the",
"prefix",
"and",
"padding",
"to",
"it"
] | def _wrap_header(header, version):
"""
Takes a stringified header, and attaches the prefix and padding to it
"""
import struct
assert version is not None
fmt, encoding = _header_size_info[version]
if not isinstance(header, bytes): # always true on python 3
header = header.encode(enc... | [
"def",
"_wrap_header",
"(",
"header",
",",
"version",
")",
":",
"import",
"struct",
"assert",
"version",
"is",
"not",
"None",
"fmt",
",",
"encoding",
"=",
"_header_size_info",
"[",
"version",
"]",
"if",
"not",
"isinstance",
"(",
"header",
",",
"bytes",
")"... | https://github.com/catboost/catboost/blob/167f64f237114a4d10b2b4ee42adb4569137debe/contrib/python/numpy/py3/numpy/lib/format.py#L367-L389 | |
catboost/catboost | 167f64f237114a4d10b2b4ee42adb4569137debe | contrib/tools/python/src/Lib/distutils/command/install_egg_info.py | python | safe_version | (version) | return re.sub('[^A-Za-z0-9.]+', '-', version) | Convert an arbitrary string to a standard version string
Spaces become dots, and all other non-alphanumeric characters become
dashes, with runs of multiple dashes condensed to a single dash. | Convert an arbitrary string to a standard version string | [
"Convert",
"an",
"arbitrary",
"string",
"to",
"a",
"standard",
"version",
"string"
] | def safe_version(version):
"""Convert an arbitrary string to a standard version string
Spaces become dots, and all other non-alphanumeric characters become
dashes, with runs of multiple dashes condensed to a single dash.
"""
version = version.replace(' ','.')
return re.sub('[^A-Za-z0-9.]+', '-'... | [
"def",
"safe_version",
"(",
"version",
")",
":",
"version",
"=",
"version",
".",
"replace",
"(",
"' '",
",",
"'.'",
")",
"return",
"re",
".",
"sub",
"(",
"'[^A-Za-z0-9.]+'",
",",
"'-'",
",",
"version",
")"
] | https://github.com/catboost/catboost/blob/167f64f237114a4d10b2b4ee42adb4569137debe/contrib/tools/python/src/Lib/distutils/command/install_egg_info.py#L63-L70 | |
wxWidgets/wxPython-Classic | 19571e1ae65f1ac445f5491474121998c97a1bf0 | contrib/gizmos/gtk/gizmos.py | python | ThinSplitterWindow.__init__ | (self, *args, **kwargs) | __init__(self, Window parent, int id=-1, Point pos=DefaultPosition,
Size size=DefaultSize, long style=wxSP_3D|wxCLIP_CHILDREN) -> ThinSplitterWindow | __init__(self, Window parent, int id=-1, Point pos=DefaultPosition,
Size size=DefaultSize, long style=wxSP_3D|wxCLIP_CHILDREN) -> ThinSplitterWindow | [
"__init__",
"(",
"self",
"Window",
"parent",
"int",
"id",
"=",
"-",
"1",
"Point",
"pos",
"=",
"DefaultPosition",
"Size",
"size",
"=",
"DefaultSize",
"long",
"style",
"=",
"wxSP_3D|wxCLIP_CHILDREN",
")",
"-",
">",
"ThinSplitterWindow"
] | def __init__(self, *args, **kwargs):
"""
__init__(self, Window parent, int id=-1, Point pos=DefaultPosition,
Size size=DefaultSize, long style=wxSP_3D|wxCLIP_CHILDREN) -> ThinSplitterWindow
"""
_gizmos.ThinSplitterWindow_swiginit(self,_gizmos.new_ThinSplitterWindow(*args, *... | [
"def",
"__init__",
"(",
"self",
",",
"*",
"args",
",",
"*",
"*",
"kwargs",
")",
":",
"_gizmos",
".",
"ThinSplitterWindow_swiginit",
"(",
"self",
",",
"_gizmos",
".",
"new_ThinSplitterWindow",
"(",
"*",
"args",
",",
"*",
"*",
"kwargs",
")",
")",
"self",
... | https://github.com/wxWidgets/wxPython-Classic/blob/19571e1ae65f1ac445f5491474121998c97a1bf0/contrib/gizmos/gtk/gizmos.py#L272-L278 | ||
wxWidgets/wxPython-Classic | 19571e1ae65f1ac445f5491474121998c97a1bf0 | src/osx_cocoa/richtext.py | python | RichTextPlainText.GetFirstLineBreakPosition | (*args, **kwargs) | return _richtext.RichTextPlainText_GetFirstLineBreakPosition(*args, **kwargs) | GetFirstLineBreakPosition(self, long pos) -> long | GetFirstLineBreakPosition(self, long pos) -> long | [
"GetFirstLineBreakPosition",
"(",
"self",
"long",
"pos",
")",
"-",
">",
"long"
] | def GetFirstLineBreakPosition(*args, **kwargs):
"""GetFirstLineBreakPosition(self, long pos) -> long"""
return _richtext.RichTextPlainText_GetFirstLineBreakPosition(*args, **kwargs) | [
"def",
"GetFirstLineBreakPosition",
"(",
"*",
"args",
",",
"*",
"*",
"kwargs",
")",
":",
"return",
"_richtext",
".",
"RichTextPlainText_GetFirstLineBreakPosition",
"(",
"*",
"args",
",",
"*",
"*",
"kwargs",
")"
] | https://github.com/wxWidgets/wxPython-Classic/blob/19571e1ae65f1ac445f5491474121998c97a1bf0/src/osx_cocoa/richtext.py#L2092-L2094 | |
fenderglass/Flye | 2013acc650356cc934a2a9b82eb90af260c8b52b | flye/utils/fasta_parser.py | python | _read_fastq | (file_handle) | bytes input / output | bytes input / output | [
"bytes",
"input",
"/",
"output"
] | def _read_fastq(file_handle):
"""
bytes input / output
"""
seq = None
qual = None
header = None
state_counter = 0
for no, line in enumerate(file_handle):
line = line.strip()
if not line:
continue
if state_counter == 0:
if line[0 : 1] != b... | [
"def",
"_read_fastq",
"(",
"file_handle",
")",
":",
"seq",
"=",
"None",
"qual",
"=",
"None",
"header",
"=",
"None",
"state_counter",
"=",
"0",
"for",
"no",
",",
"line",
"in",
"enumerate",
"(",
"file_handle",
")",
":",
"line",
"=",
"line",
".",
"strip",... | https://github.com/fenderglass/Flye/blob/2013acc650356cc934a2a9b82eb90af260c8b52b/flye/utils/fasta_parser.py#L154-L186 | ||
tensorflow/tensorflow | 419e3a6b650ea4bd1b0cba23c4348f8a69f3272e | tensorflow/python/eager/wrap_function.py | python | _filter_returned_ops | (fn) | return wrap_and_filter_returned_ops, returned_ops | Filtering out any ops returned by function.
Args:
fn: a function
Returns:
A tuple of (
Wrapped function that returns `None` in place of any ops,
dict that maps the index in the flat output structure to the returned op
) | Filtering out any ops returned by function. | [
"Filtering",
"out",
"any",
"ops",
"returned",
"by",
"function",
"."
] | def _filter_returned_ops(fn):
"""Filtering out any ops returned by function.
Args:
fn: a function
Returns:
A tuple of (
Wrapped function that returns `None` in place of any ops,
dict that maps the index in the flat output structure to the returned op
)
"""
returned_ops = {}
def wr... | [
"def",
"_filter_returned_ops",
"(",
"fn",
")",
":",
"returned_ops",
"=",
"{",
"}",
"def",
"wrap_and_filter_returned_ops",
"(",
"*",
"args",
",",
"*",
"*",
"kwargs",
")",
":",
"outputs",
"=",
"fn",
"(",
"*",
"args",
",",
"*",
"*",
"kwargs",
")",
"flat_o... | https://github.com/tensorflow/tensorflow/blob/419e3a6b650ea4bd1b0cba23c4348f8a69f3272e/tensorflow/python/eager/wrap_function.py#L380-L404 | |
miyosuda/TensorFlowAndroidMNIST | 7b5a4603d2780a8a2834575706e9001977524007 | jni-build/jni/include/tensorflow/contrib/distributions/python/ops/inverse_gamma.py | python | InverseGamma.get_event_shape | (self) | return self._get_event_shape | `TensorShape` available at graph construction time.
Same meaning as `event_shape`. May be only partially defined.
Returns:
`TensorShape` object. | `TensorShape` available at graph construction time. | [
"TensorShape",
"available",
"at",
"graph",
"construction",
"time",
"."
] | def get_event_shape(self):
"""`TensorShape` available at graph construction time.
Same meaning as `event_shape`. May be only partially defined.
Returns:
`TensorShape` object.
"""
return self._get_event_shape | [
"def",
"get_event_shape",
"(",
"self",
")",
":",
"return",
"self",
".",
"_get_event_shape"
] | https://github.com/miyosuda/TensorFlowAndroidMNIST/blob/7b5a4603d2780a8a2834575706e9001977524007/jni-build/jni/include/tensorflow/contrib/distributions/python/ops/inverse_gamma.py#L176-L184 | |
ablab/quast | 5f6709528129a6ad266a6b24ef3f40b88f0fe04b | quast_libs/site_packages/bz2.py | python | BZ2File.__init__ | (self, filename, mode="r", buffering=None, compresslevel=9) | Open a bzip2-compressed file.
If filename is a str or bytes object, it gives the name
of the file to be opened. Otherwise, it should be a file object,
which will be used to read or write the compressed data.
mode can be 'r' for reading (default), 'w' for (over)writing,
'x' for ... | Open a bzip2-compressed file. | [
"Open",
"a",
"bzip2",
"-",
"compressed",
"file",
"."
] | def __init__(self, filename, mode="r", buffering=None, compresslevel=9):
"""Open a bzip2-compressed file.
If filename is a str or bytes object, it gives the name
of the file to be opened. Otherwise, it should be a file object,
which will be used to read or write the compressed data.
... | [
"def",
"__init__",
"(",
"self",
",",
"filename",
",",
"mode",
"=",
"\"r\"",
",",
"buffering",
"=",
"None",
",",
"compresslevel",
"=",
"9",
")",
":",
"# This lock must be recursive, so that BufferedIOBase's",
"# writelines() does not deadlock.",
"self",
".",
"_lock",
... | https://github.com/ablab/quast/blob/5f6709528129a6ad266a6b24ef3f40b88f0fe04b/quast_libs/site_packages/bz2.py#L46-L113 | ||
okex/V3-Open-API-SDK | c5abb0db7e2287718e0055e17e57672ce0ec7fd9 | okex-python-sdk-api/venv/Lib/site-packages/pip-19.0.3-py3.8.egg/pip/_internal/index.py | python | _is_url_like_archive | (url) | return False | Return whether the URL looks like an archive. | Return whether the URL looks like an archive. | [
"Return",
"whether",
"the",
"URL",
"looks",
"like",
"an",
"archive",
"."
] | def _is_url_like_archive(url):
# type: (str) -> bool
"""Return whether the URL looks like an archive.
"""
filename = Link(url).filename
for bad_ext in ARCHIVE_EXTENSIONS:
if filename.endswith(bad_ext):
return True
return False | [
"def",
"_is_url_like_archive",
"(",
"url",
")",
":",
"# type: (str) -> bool",
"filename",
"=",
"Link",
"(",
"url",
")",
".",
"filename",
"for",
"bad_ext",
"in",
"ARCHIVE_EXTENSIONS",
":",
"if",
"filename",
".",
"endswith",
"(",
"bad_ext",
")",
":",
"return",
... | https://github.com/okex/V3-Open-API-SDK/blob/c5abb0db7e2287718e0055e17e57672ce0ec7fd9/okex-python-sdk-api/venv/Lib/site-packages/pip-19.0.3-py3.8.egg/pip/_internal/index.py#L90-L98 | |
pytorch/pytorch | 7176c92687d3cc847cc046bf002269c6949a21c2 | torch/distributed/elastic/rendezvous/etcd_store.py | python | EtcdStore.wait | (self, keys, override_timeout: Optional[datetime.timedelta] = None) | Waits until all of the keys are published, or until timeout.
Raises:
LookupError - if timeout occurs | Waits until all of the keys are published, or until timeout. | [
"Waits",
"until",
"all",
"of",
"the",
"keys",
"are",
"published",
"or",
"until",
"timeout",
"."
] | def wait(self, keys, override_timeout: Optional[datetime.timedelta] = None):
"""
Waits until all of the keys are published, or until timeout.
Raises:
LookupError - if timeout occurs
"""
b64_keys = [self.prefix + self._encode(key) for key in keys]
kvs = self._... | [
"def",
"wait",
"(",
"self",
",",
"keys",
",",
"override_timeout",
":",
"Optional",
"[",
"datetime",
".",
"timedelta",
"]",
"=",
"None",
")",
":",
"b64_keys",
"=",
"[",
"self",
".",
"prefix",
"+",
"self",
".",
"_encode",
"(",
"key",
")",
"for",
"key",... | https://github.com/pytorch/pytorch/blob/7176c92687d3cc847cc046bf002269c6949a21c2/torch/distributed/elastic/rendezvous/etcd_store.py#L116-L126 | ||
smilehao/xlua-framework | a03801538be2b0e92d39332d445b22caca1ef61f | ConfigData/trunk/tools/protobuf-2.5.0/protobuf-2.5.0/python/build/lib/google/protobuf/internal/containers.py | python | RepeatedScalarFieldContainer.__setitem__ | (self, key, value) | Sets the item on the specified position. | Sets the item on the specified position. | [
"Sets",
"the",
"item",
"on",
"the",
"specified",
"position",
"."
] | def __setitem__(self, key, value):
"""Sets the item on the specified position."""
self._type_checker.CheckValue(value)
self._values[key] = value
self._message_listener.Modified() | [
"def",
"__setitem__",
"(",
"self",
",",
"key",
",",
"value",
")",
":",
"self",
".",
"_type_checker",
".",
"CheckValue",
"(",
"value",
")",
"self",
".",
"_values",
"[",
"key",
"]",
"=",
"value",
"self",
".",
"_message_listener",
".",
"Modified",
"(",
")... | https://github.com/smilehao/xlua-framework/blob/a03801538be2b0e92d39332d445b22caca1ef61f/ConfigData/trunk/tools/protobuf-2.5.0/protobuf-2.5.0/python/build/lib/google/protobuf/internal/containers.py#L147-L151 | ||
aws/lumberyard | f85344403c1c2e77ec8c75deb2c116e97b713217 | dev/Gems/CloudGemDefectReporter/v1/AWS/common-code/Lib/pkg_resources/__init__.py | python | Environment.__iter__ | (self) | Yield the unique project names of the available distributions | Yield the unique project names of the available distributions | [
"Yield",
"the",
"unique",
"project",
"names",
"of",
"the",
"available",
"distributions"
] | def __iter__(self):
"""Yield the unique project names of the available distributions"""
for key in self._distmap.keys():
if self[key]:
yield key | [
"def",
"__iter__",
"(",
"self",
")",
":",
"for",
"key",
"in",
"self",
".",
"_distmap",
".",
"keys",
"(",
")",
":",
"if",
"self",
"[",
"key",
"]",
":",
"yield",
"key"
] | https://github.com/aws/lumberyard/blob/f85344403c1c2e77ec8c75deb2c116e97b713217/dev/Gems/CloudGemDefectReporter/v1/AWS/common-code/Lib/pkg_resources/__init__.py#L1160-L1164 | ||
Xilinx/Vitis-AI | fc74d404563d9951b57245443c73bef389f3657f | tools/Vitis-AI-Quantizer/vai_q_tensorflow1.x/tensorflow/python/ops/metrics_impl.py | python | _sparse_true_positive_at_k | (labels,
predictions_idx,
class_id=None,
weights=None,
name=None) | Calculates true positives for recall@k and precision@k.
If `class_id` is specified, calculate binary true positives for `class_id`
only.
If `class_id` is not specified, calculate metrics for `k` predicted vs
`n` label classes, where `n` is the 2nd dimension of `labels_sparse`.
Args:
labels: `int... | Calculates true positives for recall@k and precision@k. | [
"Calculates",
"true",
"positives",
"for",
"recall@k",
"and",
"precision@k",
"."
] | def _sparse_true_positive_at_k(labels,
predictions_idx,
class_id=None,
weights=None,
name=None):
"""Calculates true positives for recall@k and precision@k.
If `class_id` is specified, calcula... | [
"def",
"_sparse_true_positive_at_k",
"(",
"labels",
",",
"predictions_idx",
",",
"class_id",
"=",
"None",
",",
"weights",
"=",
"None",
",",
"name",
"=",
"None",
")",
":",
"with",
"ops",
".",
"name_scope",
"(",
"name",
",",
"'true_positives'",
",",
"(",
"pr... | https://github.com/Xilinx/Vitis-AI/blob/fc74d404563d9951b57245443c73bef389f3657f/tools/Vitis-AI-Quantizer/vai_q_tensorflow1.x/tensorflow/python/ops/metrics_impl.py#L2283-L2325 | ||
MegEngine/MegEngine | ce9ad07a27ec909fb8db4dd67943d24ba98fb93a | imperative/python/megengine/traced_module/node.py | python | Node.qualname | (self) | return self._qualname | r"""Get the `qualname` of this Node. The `qualname` can be used to get the
submodule from the traced Module or Module.
Example:
.. code-block::
import megengine.module as M
import megengine.functional as F
import megengine.traced_module as tm... | r"""Get the `qualname` of this Node. The `qualname` can be used to get the
submodule from the traced Module or Module. | [
"r",
"Get",
"the",
"qualname",
"of",
"this",
"Node",
".",
"The",
"qualname",
"can",
"be",
"used",
"to",
"get",
"the",
"submodule",
"from",
"the",
"traced",
"Module",
"or",
"Module",
"."
] | def qualname(self):
r"""Get the `qualname` of this Node. The `qualname` can be used to get the
submodule from the traced Module or Module.
Example:
.. code-block::
import megengine.module as M
import megengine.functional as F
import m... | [
"def",
"qualname",
"(",
"self",
")",
":",
"return",
"self",
".",
"_qualname"
] | https://github.com/MegEngine/MegEngine/blob/ce9ad07a27ec909fb8db4dd67943d24ba98fb93a/imperative/python/megengine/traced_module/node.py#L87-L131 | |
wlanjie/AndroidFFmpeg | 7baf9122f4b8e1c74e7baf4be5c422c7a5ba5aaf | tools/fdk-aac-build/armeabi-v7a/toolchain/lib/python2.7/mailbox.py | python | _ProxyFile.tell | (self) | return self._pos | Return the position. | Return the position. | [
"Return",
"the",
"position",
"."
] | def tell(self):
"""Return the position."""
return self._pos | [
"def",
"tell",
"(",
"self",
")",
":",
"return",
"self",
".",
"_pos"
] | https://github.com/wlanjie/AndroidFFmpeg/blob/7baf9122f4b8e1c74e7baf4be5c422c7a5ba5aaf/tools/fdk-aac-build/armeabi-v7a/toolchain/lib/python2.7/mailbox.py#L1894-L1896 | |
aws/lumberyard | f85344403c1c2e77ec8c75deb2c116e97b713217 | dev/Tools/Python/3.7.10/linux_x64/lib/python3.7/site-packages/botocore/monitoring.py | python | BaseMonitorEvent.__init__ | (self, service, operation, timestamp) | Base monitor event
:type service: str
:param service: A string identifying the service associated to
the event
:type operation: str
:param operation: A string identifying the operation of service
associated to the event
:type timestamp: int
:par... | Base monitor event | [
"Base",
"monitor",
"event"
] | def __init__(self, service, operation, timestamp):
"""Base monitor event
:type service: str
:param service: A string identifying the service associated to
the event
:type operation: str
:param operation: A string identifying the operation of service
asso... | [
"def",
"__init__",
"(",
"self",
",",
"service",
",",
"operation",
",",
"timestamp",
")",
":",
"self",
".",
"service",
"=",
"service",
"self",
".",
"operation",
"=",
"operation",
"self",
".",
"timestamp",
"=",
"timestamp"
] | https://github.com/aws/lumberyard/blob/f85344403c1c2e77ec8c75deb2c116e97b713217/dev/Tools/Python/3.7.10/linux_x64/lib/python3.7/site-packages/botocore/monitoring.py#L157-L173 | ||
Genius-x/genius-x | 9fc9f194e6d1fb92dd0e33d43db19ddb67cda7b0 | cocos2d/tools/bindings-generator/backup/clang-llvm-3.3-pybinding/cindex.py | python | Type.is_restrict_qualified | (self) | return conf.lib.clang_isRestrictQualifiedType(self) | Determine whether a Type has the "restrict" qualifier set.
This does not look through typedefs that may have added "restrict" at
a different level. | Determine whether a Type has the "restrict" qualifier set. | [
"Determine",
"whether",
"a",
"Type",
"has",
"the",
"restrict",
"qualifier",
"set",
"."
] | def is_restrict_qualified(self):
"""Determine whether a Type has the "restrict" qualifier set.
This does not look through typedefs that may have added "restrict" at
a different level.
"""
return conf.lib.clang_isRestrictQualifiedType(self) | [
"def",
"is_restrict_qualified",
"(",
"self",
")",
":",
"return",
"conf",
".",
"lib",
".",
"clang_isRestrictQualifiedType",
"(",
"self",
")"
] | https://github.com/Genius-x/genius-x/blob/9fc9f194e6d1fb92dd0e33d43db19ddb67cda7b0/cocos2d/tools/bindings-generator/backup/clang-llvm-3.3-pybinding/cindex.py#L1580-L1586 | |
hanpfei/chromium-net | 392cc1fa3a8f92f42e4071ab6e674d8e0482f83f | third_party/catapult/telemetry/telemetry/internal/platform/gpu_device.py | python | GPUDevice.device_id | (self) | return self._device_id | The GPU device's PCI ID as a number, or 0 if not available.
Most desktop machines supply this information rather than the
vendor and device strings. | The GPU device's PCI ID as a number, or 0 if not available. | [
"The",
"GPU",
"device",
"s",
"PCI",
"ID",
"as",
"a",
"number",
"or",
"0",
"if",
"not",
"available",
"."
] | def device_id(self):
"""The GPU device's PCI ID as a number, or 0 if not available.
Most desktop machines supply this information rather than the
vendor and device strings."""
return self._device_id | [
"def",
"device_id",
"(",
"self",
")",
":",
"return",
"self",
".",
"_device_id"
] | https://github.com/hanpfei/chromium-net/blob/392cc1fa3a8f92f42e4071ab6e674d8e0482f83f/third_party/catapult/telemetry/telemetry/internal/platform/gpu_device.py#L61-L66 | |
hfinkel/llvm-project-cxxjit | 91084ef018240bbb8e24235ff5cd8c355a9c1a1e | llvm/utils/benchmark/tools/gbench/report.py | python | generate_difference_report | (json1, json2, use_color=True) | return output_strs | Calculate and report the difference between each test of two benchmarks
runs specified as 'json1' and 'json2'. | Calculate and report the difference between each test of two benchmarks
runs specified as 'json1' and 'json2'. | [
"Calculate",
"and",
"report",
"the",
"difference",
"between",
"each",
"test",
"of",
"two",
"benchmarks",
"runs",
"specified",
"as",
"json1",
"and",
"json2",
"."
] | def generate_difference_report(json1, json2, use_color=True):
"""
Calculate and report the difference between each test of two benchmarks
runs specified as 'json1' and 'json2'.
"""
first_col_width = find_longest_name(json1['benchmarks'])
def find_test(name):
for b in json2['benchmarks']:... | [
"def",
"generate_difference_report",
"(",
"json1",
",",
"json2",
",",
"use_color",
"=",
"True",
")",
":",
"first_col_width",
"=",
"find_longest_name",
"(",
"json1",
"[",
"'benchmarks'",
"]",
")",
"def",
"find_test",
"(",
"name",
")",
":",
"for",
"b",
"in",
... | https://github.com/hfinkel/llvm-project-cxxjit/blob/91084ef018240bbb8e24235ff5cd8c355a9c1a1e/llvm/utils/benchmark/tools/gbench/report.py#L87-L128 | |
hpi-xnor/BMXNet-v2 | af2b1859eafc5c721b1397cef02f946aaf2ce20d | tools/caffe_translator/scripts/convert_caffe_model.py | python | CaffeModelConverter.add_aux_param | (self, param_name, layer_index, blob_index) | Add an aux param to .params file. Example: moving_mean in BatchNorm layer | Add an aux param to .params file. Example: moving_mean in BatchNorm layer | [
"Add",
"an",
"aux",
"param",
"to",
".",
"params",
"file",
".",
"Example",
":",
"moving_mean",
"in",
"BatchNorm",
"layer"
] | def add_aux_param(self, param_name, layer_index, blob_index):
"""Add an aux param to .params file. Example: moving_mean in BatchNorm layer """
self.add_param('aux:%s' % param_name, layer_index, blob_index) | [
"def",
"add_aux_param",
"(",
"self",
",",
"param_name",
",",
"layer_index",
",",
"blob_index",
")",
":",
"self",
".",
"add_param",
"(",
"'aux:%s'",
"%",
"param_name",
",",
"layer_index",
",",
"blob_index",
")"
] | https://github.com/hpi-xnor/BMXNet-v2/blob/af2b1859eafc5c721b1397cef02f946aaf2ce20d/tools/caffe_translator/scripts/convert_caffe_model.py#L42-L44 | ||
JumpingYang001/webrtc | c03d6e965e1f54aeadd670e491eabe5fdb8db968 | tools_webrtc/perf/catapult_uploader.py | python | _WaitForUploadConfirmation | (url, upload_token, wait_timeout,
wait_polling_period) | return response, resp_json | Make a HTTP GET requests to the Performance Dashboard untill upload
status is known or the time is out.
Args:
url: URL of Performance Dashboard instance, e.g.
"https://chromeperf.appspot.com".
upload_token: String that identifies Performance Dashboard and can be used
for the statu... | Make a HTTP GET requests to the Performance Dashboard untill upload
status is known or the time is out. | [
"Make",
"a",
"HTTP",
"GET",
"requests",
"to",
"the",
"Performance",
"Dashboard",
"untill",
"upload",
"status",
"is",
"known",
"or",
"the",
"time",
"is",
"out",
"."
] | def _WaitForUploadConfirmation(url, upload_token, wait_timeout,
wait_polling_period):
"""Make a HTTP GET requests to the Performance Dashboard untill upload
status is known or the time is out.
Args:
url: URL of Performance Dashboard instance, e.g.
"https://chr... | [
"def",
"_WaitForUploadConfirmation",
"(",
"url",
",",
"upload_token",
",",
"wait_timeout",
",",
"wait_polling_period",
")",
":",
"assert",
"wait_polling_period",
"<=",
"wait_timeout",
"headers",
"=",
"_CreateHeaders",
"(",
"_GenerateOauthToken",
"(",
")",
")",
"http",... | https://github.com/JumpingYang001/webrtc/blob/c03d6e965e1f54aeadd670e491eabe5fdb8db968/tools_webrtc/perf/catapult_uploader.py#L67-L117 | |
tensorflow/tensorflow | 419e3a6b650ea4bd1b0cba23c4348f8a69f3272e | tensorflow/python/ops/math_grad.py | python | _MinOrMaxGrad | (op, grad) | return [math_ops.divide(indicators, num_selected) * grad, None] | Gradient for Min or Max. Amazingly it's precisely the same code. | Gradient for Min or Max. Amazingly it's precisely the same code. | [
"Gradient",
"for",
"Min",
"or",
"Max",
".",
"Amazingly",
"it",
"s",
"precisely",
"the",
"same",
"code",
"."
] | def _MinOrMaxGrad(op, grad):
"""Gradient for Min or Max. Amazingly it's precisely the same code."""
input_shape = array_ops.shape(op.inputs[0])
y = op.outputs[0]
if not op.get_attr("keep_dims"):
output_shape_kept_dims = math_ops.reduced_shape(input_shape, op.inputs[1])
y = array_ops.reshape(y, output_sh... | [
"def",
"_MinOrMaxGrad",
"(",
"op",
",",
"grad",
")",
":",
"input_shape",
"=",
"array_ops",
".",
"shape",
"(",
"op",
".",
"inputs",
"[",
"0",
"]",
")",
"y",
"=",
"op",
".",
"outputs",
"[",
"0",
"]",
"if",
"not",
"op",
".",
"get_attr",
"(",
"\"keep... | https://github.com/tensorflow/tensorflow/blob/419e3a6b650ea4bd1b0cba23c4348f8a69f3272e/tensorflow/python/ops/math_grad.py#L217-L235 | |
wxWidgets/wxPython-Classic | 19571e1ae65f1ac445f5491474121998c97a1bf0 | wx/lib/agw/aui/framemanager.py | python | AuiPaneInfo.IsDockable | (self) | return self.IsTopDockable() or self.IsBottomDockable() or self.IsLeftDockable() or \
self.IsRightDockable() or self.IsNotebookDockable() | Returns ``True`` if the pane can be docked. | Returns ``True`` if the pane can be docked. | [
"Returns",
"True",
"if",
"the",
"pane",
"can",
"be",
"docked",
"."
] | def IsDockable(self):
""" Returns ``True`` if the pane can be docked. """
return self.IsTopDockable() or self.IsBottomDockable() or self.IsLeftDockable() or \
self.IsRightDockable() or self.IsNotebookDockable() | [
"def",
"IsDockable",
"(",
"self",
")",
":",
"return",
"self",
".",
"IsTopDockable",
"(",
")",
"or",
"self",
".",
"IsBottomDockable",
"(",
")",
"or",
"self",
".",
"IsLeftDockable",
"(",
")",
"or",
"self",
".",
"IsRightDockable",
"(",
")",
"or",
"self",
... | https://github.com/wxWidgets/wxPython-Classic/blob/19571e1ae65f1ac445f5491474121998c97a1bf0/wx/lib/agw/aui/framemanager.py#L689-L693 | |
microsoft/TSS.MSR | 0f2516fca2cd9929c31d5450e39301c9bde43688 | TSS.Py/src/TpmTypes.py | python | TPM2_ReadClock_REQUEST.__init__ | (self) | This command reads the current TPMS_TIME_INFO structure that
contains the current setting of Time, Clock, resetCount, and restartCount. | This command reads the current TPMS_TIME_INFO structure that
contains the current setting of Time, Clock, resetCount, and restartCount. | [
"This",
"command",
"reads",
"the",
"current",
"TPMS_TIME_INFO",
"structure",
"that",
"contains",
"the",
"current",
"setting",
"of",
"Time",
"Clock",
"resetCount",
"and",
"restartCount",
"."
] | def __init__(self):
""" This command reads the current TPMS_TIME_INFO structure that
contains the current setting of Time, Clock, resetCount, and restartCount.
"""
pass | [
"def",
"__init__",
"(",
"self",
")",
":",
"pass"
] | https://github.com/microsoft/TSS.MSR/blob/0f2516fca2cd9929c31d5450e39301c9bde43688/TSS.Py/src/TpmTypes.py#L16282-L16286 | ||
ninja-build/ninja | f404f0059d71c8c86da7b56c48794266b5befd10 | misc/write_fake_manifests.py | python | FileWriter | (path) | Context manager for a ninja_syntax object writing to a file. | Context manager for a ninja_syntax object writing to a file. | [
"Context",
"manager",
"for",
"a",
"ninja_syntax",
"object",
"writing",
"to",
"a",
"file",
"."
] | def FileWriter(path):
"""Context manager for a ninja_syntax object writing to a file."""
try:
os.makedirs(os.path.dirname(path))
except OSError:
pass
f = open(path, 'w')
yield ninja_syntax.Writer(f)
f.close() | [
"def",
"FileWriter",
"(",
"path",
")",
":",
"try",
":",
"os",
".",
"makedirs",
"(",
"os",
".",
"path",
".",
"dirname",
"(",
"path",
")",
")",
"except",
"OSError",
":",
"pass",
"f",
"=",
"open",
"(",
"path",
",",
"'w'",
")",
"yield",
"ninja_syntax",... | https://github.com/ninja-build/ninja/blob/f404f0059d71c8c86da7b56c48794266b5befd10/misc/write_fake_manifests.py#L215-L223 | ||
Xilinx/Vitis-AI | fc74d404563d9951b57245443c73bef389f3657f | tools/Vitis-AI-Quantizer/vai_q_tensorflow2.x/tensorflow_model_optimization/python/core/quantization/keras/vitis/common/vitis_quantize_strategy.py | python | VitisQuantizeStrategy.update | (self, qs_configs) | Update the current configurations by overriding.
Args:
new_config: String, file name of the new quantize strategy configurations.
Returns:
None | Update the current configurations by overriding. | [
"Update",
"the",
"current",
"configurations",
"by",
"overriding",
"."
] | def update(self, qs_configs):
"""Update the current configurations by overriding.
Args:
new_config: String, file name of the new quantize strategy configurations.
Returns:
None
"""
if 'quantize_registry_config' in qs_configs:
self._quantize_registry.update(qs_configs.pop('quanti... | [
"def",
"update",
"(",
"self",
",",
"qs_configs",
")",
":",
"if",
"'quantize_registry_config'",
"in",
"qs_configs",
":",
"self",
".",
"_quantize_registry",
".",
"update",
"(",
"qs_configs",
".",
"pop",
"(",
"'quantize_registry_config'",
")",
")",
"if",
"'optimize... | https://github.com/Xilinx/Vitis-AI/blob/fc74d404563d9951b57245443c73bef389f3657f/tools/Vitis-AI-Quantizer/vai_q_tensorflow2.x/tensorflow_model_optimization/python/core/quantization/keras/vitis/common/vitis_quantize_strategy.py#L27-L64 | ||
CaoWGG/TensorRT-CenterNet | f949252e37b51e60f873808f46d3683f15735e79 | onnx-tensorrt/third_party/onnx/third_party/pybind11/tools/clang/cindex.py | python | Cursor.walk_preorder | (self) | Depth-first preorder walk over the cursor and its descendants.
Yields cursors. | Depth-first preorder walk over the cursor and its descendants. | [
"Depth",
"-",
"first",
"preorder",
"walk",
"over",
"the",
"cursor",
"and",
"its",
"descendants",
"."
] | def walk_preorder(self):
"""Depth-first preorder walk over the cursor and its descendants.
Yields cursors.
"""
yield self
for child in self.get_children():
for descendant in child.walk_preorder():
yield descendant | [
"def",
"walk_preorder",
"(",
"self",
")",
":",
"yield",
"self",
"for",
"child",
"in",
"self",
".",
"get_children",
"(",
")",
":",
"for",
"descendant",
"in",
"child",
".",
"walk_preorder",
"(",
")",
":",
"yield",
"descendant"
] | https://github.com/CaoWGG/TensorRT-CenterNet/blob/f949252e37b51e60f873808f46d3683f15735e79/onnx-tensorrt/third_party/onnx/third_party/pybind11/tools/clang/cindex.py#L1661-L1669 | ||
anestisb/oatdump_plus | ba858c1596598f0d9ae79c14d08c708cecc50af3 | tools/cpplint.py | python | FilesBelongToSameModule | (filename_cc, filename_h) | return files_belong_to_same_module, common_path | Check if these two filenames belong to the same module.
The concept of a 'module' here is a as follows:
foo.h, foo-inl.h, foo.cc, foo_test.cc and foo_unittest.cc belong to the
same 'module' if they are in the same directory.
some/path/public/xyzzy and some/path/internal/xyzzy are also considered
to belong to... | Check if these two filenames belong to the same module. | [
"Check",
"if",
"these",
"two",
"filenames",
"belong",
"to",
"the",
"same",
"module",
"."
] | def FilesBelongToSameModule(filename_cc, filename_h):
"""Check if these two filenames belong to the same module.
The concept of a 'module' here is a as follows:
foo.h, foo-inl.h, foo.cc, foo_test.cc and foo_unittest.cc belong to the
same 'module' if they are in the same directory.
some/path/public/xyzzy and ... | [
"def",
"FilesBelongToSameModule",
"(",
"filename_cc",
",",
"filename_h",
")",
":",
"if",
"not",
"filename_cc",
".",
"endswith",
"(",
"'.cc'",
")",
":",
"return",
"(",
"False",
",",
"''",
")",
"filename_cc",
"=",
"filename_cc",
"[",
":",
"-",
"len",
"(",
... | https://github.com/anestisb/oatdump_plus/blob/ba858c1596598f0d9ae79c14d08c708cecc50af3/tools/cpplint.py#L3616-L3668 | |
hughperkins/tf-coriander | 970d3df6c11400ad68405f22b0c42a52374e94ca | tensorflow/python/framework/tensor_shape.py | python | Dimension.value | (self) | return self._value | The value of this dimension, or None if it is unknown. | The value of this dimension, or None if it is unknown. | [
"The",
"value",
"of",
"this",
"dimension",
"or",
"None",
"if",
"it",
"is",
"unknown",
"."
] | def value(self):
"""The value of this dimension, or None if it is unknown."""
return self._value | [
"def",
"value",
"(",
"self",
")",
":",
"return",
"self",
".",
"_value"
] | https://github.com/hughperkins/tf-coriander/blob/970d3df6c11400ad68405f22b0c42a52374e94ca/tensorflow/python/framework/tensor_shape.py#L75-L77 | |
ablab/spades | 3a754192b88540524ce6fb69eef5ea9273a38465 | assembler/src/tools/reads_utils/ideal_by_fasta.py | python | read_fasta | (filename) | return zip(res_name, res_seq) | Returns list of FASTA entries (in tuples: name, seq) | Returns list of FASTA entries (in tuples: name, seq) | [
"Returns",
"list",
"of",
"FASTA",
"entries",
"(",
"in",
"tuples",
":",
"name",
"seq",
")"
] | def read_fasta(filename):
"""
Returns list of FASTA entries (in tuples: name, seq)
"""
res_name = []
res_seq = []
first = True
seq = ''
for line in open(filename):
if line[0] == '>':
res_name.append(line.strip())
if not first:
res_seq.... | [
"def",
"read_fasta",
"(",
"filename",
")",
":",
"res_name",
"=",
"[",
"]",
"res_seq",
"=",
"[",
"]",
"first",
"=",
"True",
"seq",
"=",
"''",
"for",
"line",
"in",
"open",
"(",
"filename",
")",
":",
"if",
"line",
"[",
"0",
"]",
"==",
"'>'",
":",
... | https://github.com/ablab/spades/blob/3a754192b88540524ce6fb69eef5ea9273a38465/assembler/src/tools/reads_utils/ideal_by_fasta.py#L15-L35 | |
pytorch/pytorch | 7176c92687d3cc847cc046bf002269c6949a21c2 | torch/cuda/__init__.py | python | is_bf16_supported | () | return torch.cuda.get_device_properties(torch.cuda.current_device()).major >= 8 and cuda_maj_decide | r"""Returns a bool indicating if the current CUDA device supports dtype bfloat16 | r"""Returns a bool indicating if the current CUDA device supports dtype bfloat16 | [
"r",
"Returns",
"a",
"bool",
"indicating",
"if",
"the",
"current",
"CUDA",
"device",
"supports",
"dtype",
"bfloat16"
] | def is_bf16_supported():
r"""Returns a bool indicating if the current CUDA device supports dtype bfloat16"""
cu_vers = torch.version.cuda
if cu_vers is not None:
cuda_maj_decide = int(cu_vers.split('.')[0]) >= 11
else:
cuda_maj_decide = False
return torch.cuda.get_device_properties(... | [
"def",
"is_bf16_supported",
"(",
")",
":",
"cu_vers",
"=",
"torch",
".",
"version",
".",
"cuda",
"if",
"cu_vers",
"is",
"not",
"None",
":",
"cuda_maj_decide",
"=",
"int",
"(",
"cu_vers",
".",
"split",
"(",
"'.'",
")",
"[",
"0",
"]",
")",
">=",
"11",
... | https://github.com/pytorch/pytorch/blob/7176c92687d3cc847cc046bf002269c6949a21c2/torch/cuda/__init__.py#L84-L92 | |
tensorflow/minigo | 6d89c202cdceaf449aefc3149ab2110d44f1a6a4 | oneoffs/joseki/opening_freqs_export.py | python | main | (_) | Entrypoint for absl.app | Entrypoint for absl.app | [
"Entrypoint",
"for",
"absl",
".",
"app"
] | def main(_):
""" Entrypoint for absl.app """
create_top_report(FLAGS.top_n) | [
"def",
"main",
"(",
"_",
")",
":",
"create_top_report",
"(",
"FLAGS",
".",
"top_n",
")"
] | https://github.com/tensorflow/minigo/blob/6d89c202cdceaf449aefc3149ab2110d44f1a6a4/oneoffs/joseki/opening_freqs_export.py#L276-L278 | ||
PaddlePaddle/Paddle | 1252f4bb3e574df80aa6d18c7ddae1b3a90bd81c | python/paddle/fluid/dataset.py | python | InMemoryDataset.set_merge_by_lineid | (self, merge_size=2) | Set merge by line id, instances of same line id will be merged after
shuffle, you should parse line id in data generator.
Args:
merge_size(int): ins size to merge. default is 2.
Examples:
.. code-block:: python
import paddle.fluid as fluid
d... | Set merge by line id, instances of same line id will be merged after
shuffle, you should parse line id in data generator. | [
"Set",
"merge",
"by",
"line",
"id",
"instances",
"of",
"same",
"line",
"id",
"will",
"be",
"merged",
"after",
"shuffle",
"you",
"should",
"parse",
"line",
"id",
"in",
"data",
"generator",
"."
] | def set_merge_by_lineid(self, merge_size=2):
"""
Set merge by line id, instances of same line id will be merged after
shuffle, you should parse line id in data generator.
Args:
merge_size(int): ins size to merge. default is 2.
Examples:
.. code-block:: p... | [
"def",
"set_merge_by_lineid",
"(",
"self",
",",
"merge_size",
"=",
"2",
")",
":",
"self",
".",
"dataset",
".",
"set_merge_by_lineid",
"(",
"merge_size",
")",
"self",
".",
"merge_by_lineid",
"=",
"True",
"self",
".",
"parse_ins_id",
"=",
"True"
] | https://github.com/PaddlePaddle/Paddle/blob/1252f4bb3e574df80aa6d18c7ddae1b3a90bd81c/python/paddle/fluid/dataset.py#L681-L699 | ||
raymondlu/super-animation-samples | 04234269112ff0dc32447f27a761dbbb00b8ba17 | samples/cocos2d-x-3.1/CocosLuaGame2/frameworks/cocos2d-x/tools/bindings-generator/clang/cindex.py | python | register_functions | (lib, ignore_errors) | Register function prototypes with a libclang library instance.
This must be called as part of library instantiation so Python knows how
to call out to the shared library. | Register function prototypes with a libclang library instance. | [
"Register",
"function",
"prototypes",
"with",
"a",
"libclang",
"library",
"instance",
"."
] | def register_functions(lib, ignore_errors):
"""Register function prototypes with a libclang library instance.
This must be called as part of library instantiation so Python knows how
to call out to the shared library.
"""
def register(item):
return register_function(lib, item, ignore_error... | [
"def",
"register_functions",
"(",
"lib",
",",
"ignore_errors",
")",
":",
"def",
"register",
"(",
"item",
")",
":",
"return",
"register_function",
"(",
"lib",
",",
"item",
",",
"ignore_errors",
")",
"map",
"(",
"register",
",",
"functionList",
")"
] | https://github.com/raymondlu/super-animation-samples/blob/04234269112ff0dc32447f27a761dbbb00b8ba17/samples/cocos2d-x-3.1/CocosLuaGame2/frameworks/cocos2d-x/tools/bindings-generator/clang/cindex.py#L3297-L3307 | ||
htcondor/htcondor | 4829724575176d1d6c936e4693dfd78a728569b0 | src/condor_contrib/condor_pigeon/src/condor_pigeon_client/skype_linux_tools/Skype4Py/skype.py | python | ISkype.SendCommand | (self, Command) | Sends an API command.
@param Command: Command to send. Use L{Command} method to create a command.
@type Command: L{ICommand} | Sends an API command. | [
"Sends",
"an",
"API",
"command",
"."
] | def SendCommand(self, Command):
'''Sends an API command.
@param Command: Command to send. Use L{Command} method to create a command.
@type Command: L{ICommand}
'''
try:
self._API.SendCommand(Command)
except ISkypeAPIError:
self.ResetCache()
... | [
"def",
"SendCommand",
"(",
"self",
",",
"Command",
")",
":",
"try",
":",
"self",
".",
"_API",
".",
"SendCommand",
"(",
"Command",
")",
"except",
"ISkypeAPIError",
":",
"self",
".",
"ResetCache",
"(",
")",
"raise"
] | https://github.com/htcondor/htcondor/blob/4829724575176d1d6c936e4693dfd78a728569b0/src/condor_contrib/condor_pigeon/src/condor_pigeon_client/skype_linux_tools/Skype4Py/skype.py#L794-L804 | ||
wlanjie/AndroidFFmpeg | 7baf9122f4b8e1c74e7baf4be5c422c7a5ba5aaf | tools/fdk-aac-build/armeabi-v7a/toolchain/lib/python2.7/cgi.py | python | FieldStorage.skip_lines | (self) | Internal: skip lines until outer boundary if defined. | Internal: skip lines until outer boundary if defined. | [
"Internal",
":",
"skip",
"lines",
"until",
"outer",
"boundary",
"if",
"defined",
"."
] | def skip_lines(self):
"""Internal: skip lines until outer boundary if defined."""
if not self.outerboundary or self.done:
return
next = "--" + self.outerboundary
last = next + "--"
last_line_lfend = True
while 1:
line = self.fp.readline(1<<16)
... | [
"def",
"skip_lines",
"(",
"self",
")",
":",
"if",
"not",
"self",
".",
"outerboundary",
"or",
"self",
".",
"done",
":",
"return",
"next",
"=",
"\"--\"",
"+",
"self",
".",
"outerboundary",
"last",
"=",
"next",
"+",
"\"--\"",
"last_line_lfend",
"=",
"True",... | https://github.com/wlanjie/AndroidFFmpeg/blob/7baf9122f4b8e1c74e7baf4be5c422c7a5ba5aaf/tools/fdk-aac-build/armeabi-v7a/toolchain/lib/python2.7/cgi.py#L721-L740 | ||
albertz/openlierox | d316c14a8eb57848ef56e9bfa7b23a56f694a51b | tools/DedicatedServerVideo/gdata/spreadsheet/service.py | python | SpreadsheetsService.UpdateRow | (self, entry, new_row_data) | Updates a row with the provided data
Args:
entry: gdata.spreadsheet.SpreadsheetsList The entry to be updated
new_row_data: dict A dictionary of column header to row data
Returns:
The updated row | Updates a row with the provided data
Args:
entry: gdata.spreadsheet.SpreadsheetsList The entry to be updated
new_row_data: dict A dictionary of column header to row data
Returns:
The updated row | [
"Updates",
"a",
"row",
"with",
"the",
"provided",
"data",
"Args",
":",
"entry",
":",
"gdata",
".",
"spreadsheet",
".",
"SpreadsheetsList",
"The",
"entry",
"to",
"be",
"updated",
"new_row_data",
":",
"dict",
"A",
"dictionary",
"of",
"column",
"header",
"to",
... | def UpdateRow(self, entry, new_row_data):
"""Updates a row with the provided data
Args:
entry: gdata.spreadsheet.SpreadsheetsList The entry to be updated
new_row_data: dict A dictionary of column header to row data
Returns:
The updated row
"""
entry.custom = {}
for ... | [
"def",
"UpdateRow",
"(",
"self",
",",
"entry",
",",
"new_row_data",
")",
":",
"entry",
".",
"custom",
"=",
"{",
"}",
"for",
"k",
",",
"v",
"in",
"new_row_data",
".",
"iteritems",
"(",
")",
":",
"new_custom",
"=",
"gdata",
".",
"spreadsheet",
".",
"Cu... | https://github.com/albertz/openlierox/blob/d316c14a8eb57848ef56e9bfa7b23a56f694a51b/tools/DedicatedServerVideo/gdata/spreadsheet/service.py#L338-L357 | ||
Chia-Network/bls-signatures | a61089d653fa3653ac94452c73e97efcd461bdf2 | python-impl/ec.py | python | twist | (point: AffinePoint, ec=default_ec_twist) | return AffinePoint(new_x, new_y, False, ec) | Given an untwisted point, this converts it's
coordinates to a point on the twisted curve. See Craig Costello
book, look up twists. | Given an untwisted point, this converts it's
coordinates to a point on the twisted curve. See Craig Costello
book, look up twists. | [
"Given",
"an",
"untwisted",
"point",
"this",
"converts",
"it",
"s",
"coordinates",
"to",
"a",
"point",
"on",
"the",
"twisted",
"curve",
".",
"See",
"Craig",
"Costello",
"book",
"look",
"up",
"twists",
"."
] | def twist(point: AffinePoint, ec=default_ec_twist) -> AffinePoint:
"""
Given an untwisted point, this converts it's
coordinates to a point on the twisted curve. See Craig Costello
book, look up twists.
"""
f = Fq12.one(ec.q)
wsq = Fq12(ec.q, f.root, Fq6.zero(ec.q))
wcu = Fq12(ec.q, Fq6.z... | [
"def",
"twist",
"(",
"point",
":",
"AffinePoint",
",",
"ec",
"=",
"default_ec_twist",
")",
"->",
"AffinePoint",
":",
"f",
"=",
"Fq12",
".",
"one",
"(",
"ec",
".",
"q",
")",
"wsq",
"=",
"Fq12",
"(",
"ec",
".",
"q",
",",
"f",
".",
"root",
",",
"F... | https://github.com/Chia-Network/bls-signatures/blob/a61089d653fa3653ac94452c73e97efcd461bdf2/python-impl/ec.py#L506-L517 | |
KratosMultiphysics/Kratos | 0000833054ed0503424eb28205d6508d9ca6cbbc | applications/ShallowWaterApplication/python_scripts/postprocess/swap_coordinates_and_offset_ids_process.py | python | SwapCoordinatesAndOffsetIdsProcess.__init__ | (self, model, settings) | SwapCoordinatesAndOffsetIdsProcess.
This process provides several tools for post-processing.
- Swap the YZ coordinates in order to make 2D simulations consistent at post process.
- Offset the ids in order to differentiate the model parts at the post processing. | SwapCoordinatesAndOffsetIdsProcess. | [
"SwapCoordinatesAndOffsetIdsProcess",
"."
] | def __init__(self, model, settings):
""" SwapCoordinatesAndOffsetIdsProcess.
This process provides several tools for post-processing.
- Swap the YZ coordinates in order to make 2D simulations consistent at post process.
- Offset the ids in order to differentiate the model parts at the p... | [
"def",
"__init__",
"(",
"self",
",",
"model",
",",
"settings",
")",
":",
"KM",
".",
"Process",
".",
"__init__",
"(",
"self",
")",
"default_settings",
"=",
"KM",
".",
"Parameters",
"(",
"\"\"\"\n {\n \"model_part_name\" : \"model_part_n... | https://github.com/KratosMultiphysics/Kratos/blob/0000833054ed0503424eb28205d6508d9ca6cbbc/applications/ShallowWaterApplication/python_scripts/postprocess/swap_coordinates_and_offset_ids_process.py#L11-L40 | ||
mapnik/mapnik | f3da900c355e1d15059c4a91b00203dcc9d9f0ef | scons/scons-local-4.1.0/SCons/Util.py | python | NodeList.__getitem__ | (self, index) | This comes for free on py2,
but py3 slices of NodeList are returning a list
breaking slicing nodelist and refering to
properties and methods on contained object | This comes for free on py2,
but py3 slices of NodeList are returning a list
breaking slicing nodelist and refering to
properties and methods on contained object | [
"This",
"comes",
"for",
"free",
"on",
"py2",
"but",
"py3",
"slices",
"of",
"NodeList",
"are",
"returning",
"a",
"list",
"breaking",
"slicing",
"nodelist",
"and",
"refering",
"to",
"properties",
"and",
"methods",
"on",
"contained",
"object"
] | def __getitem__(self, index):
"""
This comes for free on py2,
but py3 slices of NodeList are returning a list
breaking slicing nodelist and refering to
properties and methods on contained object
"""
# return self.__class__(self.data[index])
if isinstance(i... | [
"def",
"__getitem__",
"(",
"self",
",",
"index",
")",
":",
"# return self.__class__(self.data[index])",
"if",
"isinstance",
"(",
"index",
",",
"slice",
")",
":",
"# Expand the slice object using range()",
"# limited by number of items in self.data",
"indices",
"=",
"... | https://github.com/mapnik/mapnik/blob/f3da900c355e1d15059c4a91b00203dcc9d9f0ef/scons/scons-local-4.1.0/SCons/Util.py#L145-L162 | ||
apple/swift-lldb | d74be846ef3e62de946df343e8c234bde93a8912 | examples/customization/bin-utils/binutils.py | python | itob | (debugger, command_line, result, dict) | Convert the integer to print its two's complement representation.
args[0] (mandatory) is the integer to be converted
args[1] (mandatory) is the bit width of the two's complement representation
args[2] (optional) if specified, turns on verbose printing | Convert the integer to print its two's complement representation.
args[0] (mandatory) is the integer to be converted
args[1] (mandatory) is the bit width of the two's complement representation
args[2] (optional) if specified, turns on verbose printing | [
"Convert",
"the",
"integer",
"to",
"print",
"its",
"two",
"s",
"complement",
"representation",
".",
"args",
"[",
"0",
"]",
"(",
"mandatory",
")",
"is",
"the",
"integer",
"to",
"be",
"converted",
"args",
"[",
"1",
"]",
"(",
"mandatory",
")",
"is",
"the"... | def itob(debugger, command_line, result, dict):
"""Convert the integer to print its two's complement representation.
args[0] (mandatory) is the integer to be converted
args[1] (mandatory) is the bit width of the two's complement representation
args[2] (optional) if specified, turns on verbose printing""... | [
"def",
"itob",
"(",
"debugger",
",",
"command_line",
",",
"result",
",",
"dict",
")",
":",
"args",
"=",
"command_line",
".",
"split",
"(",
")",
"try",
":",
"n",
"=",
"int",
"(",
"args",
"[",
"0",
"]",
",",
"0",
")",
"width",
"=",
"int",
"(",
"a... | https://github.com/apple/swift-lldb/blob/d74be846ef3e62de946df343e8c234bde93a8912/examples/customization/bin-utils/binutils.py#L97-L124 | ||
google/syzygy | 8164b24ebde9c5649c9a09e88a7fc0b0fcbd1bc5 | third_party/numpy/files/numpy/lib/scimath.py | python | _fix_real_abs_gt_1 | (x) | return x | Convert `x` to complex if it has real components x_i with abs(x_i)>1.
Otherwise, output is just the array version of the input (via asarray).
Parameters
----------
x : array_like
Returns
-------
array
Examples
--------
>>> np.lib.scimath._fix_real_abs_gt_1([0,1])
array([0... | Convert `x` to complex if it has real components x_i with abs(x_i)>1. | [
"Convert",
"x",
"to",
"complex",
"if",
"it",
"has",
"real",
"components",
"x_i",
"with",
"abs",
"(",
"x_i",
")",
">",
"1",
"."
] | def _fix_real_abs_gt_1(x):
"""Convert `x` to complex if it has real components x_i with abs(x_i)>1.
Otherwise, output is just the array version of the input (via asarray).
Parameters
----------
x : array_like
Returns
-------
array
Examples
--------
>>> np.lib.scimath._fix... | [
"def",
"_fix_real_abs_gt_1",
"(",
"x",
")",
":",
"x",
"=",
"asarray",
"(",
"x",
")",
"if",
"any",
"(",
"isreal",
"(",
"x",
")",
"&",
"(",
"abs",
"(",
"x",
")",
">",
"1",
")",
")",
":",
"x",
"=",
"_tocomplex",
"(",
"x",
")",
"return",
"x"
] | https://github.com/google/syzygy/blob/8164b24ebde9c5649c9a09e88a7fc0b0fcbd1bc5/third_party/numpy/files/numpy/lib/scimath.py#L143-L167 | |
google/or-tools | 2cb85b4eead4c38e1c54b48044f92087cf165bce | ortools/constraint_solver/samples/vrp_starts_ends.py | python | print_solution | (data, manager, routing, solution) | Prints solution on console. | Prints solution on console. | [
"Prints",
"solution",
"on",
"console",
"."
] | def print_solution(data, manager, routing, solution):
"""Prints solution on console."""
print(f'Objective: {solution.ObjectiveValue()}')
max_route_distance = 0
for vehicle_id in range(data['num_vehicles']):
index = routing.Start(vehicle_id)
plan_output = 'Route for vehicle {}:\n'.format(... | [
"def",
"print_solution",
"(",
"data",
",",
"manager",
",",
"routing",
",",
"solution",
")",
":",
"print",
"(",
"f'Objective: {solution.ObjectiveValue()}'",
")",
"max_route_distance",
"=",
"0",
"for",
"vehicle_id",
"in",
"range",
"(",
"data",
"[",
"'num_vehicles'",... | https://github.com/google/or-tools/blob/2cb85b4eead4c38e1c54b48044f92087cf165bce/ortools/constraint_solver/samples/vrp_starts_ends.py#L107-L125 | ||
hanpfei/chromium-net | 392cc1fa3a8f92f42e4071ab6e674d8e0482f83f | third_party/catapult/third_party/mapreduce/mapreduce/api/map_job/input_reader.py | python | InputReader.to_json | (self) | Returns input reader state for the remaining inputs.
Returns:
A json-serializable state for the InputReader. | Returns input reader state for the remaining inputs. | [
"Returns",
"input",
"reader",
"state",
"for",
"the",
"remaining",
"inputs",
"."
] | def to_json(self):
"""Returns input reader state for the remaining inputs.
Returns:
A json-serializable state for the InputReader.
"""
raise NotImplementedError("to_json() not implemented in %s" %
self.__class__) | [
"def",
"to_json",
"(",
"self",
")",
":",
"raise",
"NotImplementedError",
"(",
"\"to_json() not implemented in %s\"",
"%",
"self",
".",
"__class__",
")"
] | https://github.com/hanpfei/chromium-net/blob/392cc1fa3a8f92f42e4071ab6e674d8e0482f83f/third_party/catapult/third_party/mapreduce/mapreduce/api/map_job/input_reader.py#L63-L70 | ||
goldeneye-source/ges-code | 2630cd8ef3d015af53c72ec2e19fc1f7e7fe8d9d | thirdparty/protobuf-2.3.0/python/mox.py | python | UnorderedGroup.IsSatisfied | (self) | return len(self._methods) == 0 | Return True if there are not any methods in this group. | Return True if there are not any methods in this group. | [
"Return",
"True",
"if",
"there",
"are",
"not",
"any",
"methods",
"in",
"this",
"group",
"."
] | def IsSatisfied(self):
"""Return True if there are not any methods in this group."""
return len(self._methods) == 0 | [
"def",
"IsSatisfied",
"(",
"self",
")",
":",
"return",
"len",
"(",
"self",
".",
"_methods",
")",
"==",
"0"
] | https://github.com/goldeneye-source/ges-code/blob/2630cd8ef3d015af53c72ec2e19fc1f7e7fe8d9d/thirdparty/protobuf-2.3.0/python/mox.py#L1257-L1260 | |
catboost/catboost | 167f64f237114a4d10b2b4ee42adb4569137debe | contrib/python/scipy/py3/scipy/spatial/_spherical_voronoi.py | python | project_to_sphere | (points, center, radius) | return (points - center) / lengths * radius + center | Projects the elements of points onto the sphere defined
by center and radius.
Parameters
----------
points : array of floats of shape (npoints, ndim)
consisting of the points in a space of dimension ndim
center : array of floats of shape (ndim,)
the center of the sphere to ... | Projects the elements of points onto the sphere defined
by center and radius. | [
"Projects",
"the",
"elements",
"of",
"points",
"onto",
"the",
"sphere",
"defined",
"by",
"center",
"and",
"radius",
"."
] | def project_to_sphere(points, center, radius):
"""
Projects the elements of points onto the sphere defined
by center and radius.
Parameters
----------
points : array of floats of shape (npoints, ndim)
consisting of the points in a space of dimension ndim
center : array of float... | [
"def",
"project_to_sphere",
"(",
"points",
",",
"center",
",",
"radius",
")",
":",
"lengths",
"=",
"scipy",
".",
"spatial",
".",
"distance",
".",
"cdist",
"(",
"points",
",",
"np",
".",
"array",
"(",
"[",
"center",
"]",
")",
")",
"return",
"(",
"poin... | https://github.com/catboost/catboost/blob/167f64f237114a4d10b2b4ee42adb4569137debe/contrib/python/scipy/py3/scipy/spatial/_spherical_voronoi.py#L71-L90 | |
martinmoene/lest | f3e9dfe4a66c3e60dfdac7a3d3e4ddc0dcf06b26 | script/create-vcpkg.py | python | portfile_path | ( args ) | return tpl_path_vcpkg_portfile.format( vcpkg=args.vcpkg_root, prj=args.project ) | Create path like vcpks/ports/_project_/portfile.cmake | Create path like vcpks/ports/_project_/portfile.cmake | [
"Create",
"path",
"like",
"vcpks",
"/",
"ports",
"/",
"_project_",
"/",
"portfile",
".",
"cmake"
] | def portfile_path( args ):
"""Create path like vcpks/ports/_project_/portfile.cmake"""
return tpl_path_vcpkg_portfile.format( vcpkg=args.vcpkg_root, prj=args.project ) | [
"def",
"portfile_path",
"(",
"args",
")",
":",
"return",
"tpl_path_vcpkg_portfile",
".",
"format",
"(",
"vcpkg",
"=",
"args",
".",
"vcpkg_root",
",",
"prj",
"=",
"args",
".",
"project",
")"
] | https://github.com/martinmoene/lest/blob/f3e9dfe4a66c3e60dfdac7a3d3e4ddc0dcf06b26/script/create-vcpkg.py#L96-L98 | |
GJDuck/LowFat | ecf6a0f0fa1b73a27a626cf493cc39e477b6faea | llvm-4.0.0.src/tools/clang/bindings/python/clang/cindex.py | python | Type.translation_unit | (self) | return self._tu | The TranslationUnit to which this Type is associated. | The TranslationUnit to which this Type is associated. | [
"The",
"TranslationUnit",
"to",
"which",
"this",
"Type",
"is",
"associated",
"."
] | def translation_unit(self):
"""The TranslationUnit to which this Type is associated."""
# If this triggers an AttributeError, the instance was not properly
# instantiated.
return self._tu | [
"def",
"translation_unit",
"(",
"self",
")",
":",
"# If this triggers an AttributeError, the instance was not properly",
"# instantiated.",
"return",
"self",
".",
"_tu"
] | https://github.com/GJDuck/LowFat/blob/ecf6a0f0fa1b73a27a626cf493cc39e477b6faea/llvm-4.0.0.src/tools/clang/bindings/python/clang/cindex.py#L2005-L2009 | |
wyrover/book-code | 7f4883d9030d553bc6bcfa3da685e34789839900 | 3rdparty/protobuf/python/google/protobuf/internal/containers.py | python | RepeatedScalarFieldContainer.pop | (self, key=-1) | return value | Removes and returns an item at a given index. Similar to list.pop(). | Removes and returns an item at a given index. Similar to list.pop(). | [
"Removes",
"and",
"returns",
"an",
"item",
"at",
"a",
"given",
"index",
".",
"Similar",
"to",
"list",
".",
"pop",
"()",
"."
] | def pop(self, key=-1):
"""Removes and returns an item at a given index. Similar to list.pop()."""
value = self._values[key]
self.__delitem__(key)
return value | [
"def",
"pop",
"(",
"self",
",",
"key",
"=",
"-",
"1",
")",
":",
"value",
"=",
"self",
".",
"_values",
"[",
"key",
"]",
"self",
".",
"__delitem__",
"(",
"key",
")",
"return",
"value"
] | https://github.com/wyrover/book-code/blob/7f4883d9030d553bc6bcfa3da685e34789839900/3rdparty/protobuf/python/google/protobuf/internal/containers.py#L292-L296 | |
wxWidgets/wxPython-Classic | 19571e1ae65f1ac445f5491474121998c97a1bf0 | src/msw/_core.py | python | MouseEvent.Aux2DClick | (*args, **kwargs) | return _core_.MouseEvent_Aux2DClick(*args, **kwargs) | Aux2DClick(self) -> bool
Returns true if the event was a AUX2 button double click. | Aux2DClick(self) -> bool | [
"Aux2DClick",
"(",
"self",
")",
"-",
">",
"bool"
] | def Aux2DClick(*args, **kwargs):
"""
Aux2DClick(self) -> bool
Returns true if the event was a AUX2 button double click.
"""
return _core_.MouseEvent_Aux2DClick(*args, **kwargs) | [
"def",
"Aux2DClick",
"(",
"*",
"args",
",",
"*",
"*",
"kwargs",
")",
":",
"return",
"_core_",
".",
"MouseEvent_Aux2DClick",
"(",
"*",
"args",
",",
"*",
"*",
"kwargs",
")"
] | https://github.com/wxWidgets/wxPython-Classic/blob/19571e1ae65f1ac445f5491474121998c97a1bf0/src/msw/_core.py#L5737-L5743 | |
psi4/psi4 | be533f7f426b6ccc263904e55122899b16663395 | psi4/driver/mdi_engine.py | python | MDIEngine.run_scf | (self) | Run an energy calculation | Run an energy calculation | [
"Run",
"an",
"energy",
"calculation"
] | def run_scf(self):
""" Run an energy calculation
"""
self.energy = psi4.energy(self.scf_method, **self.kwargs) | [
"def",
"run_scf",
"(",
"self",
")",
":",
"self",
".",
"energy",
"=",
"psi4",
".",
"energy",
"(",
"self",
".",
"scf_method",
",",
"*",
"*",
"self",
".",
"kwargs",
")"
] | https://github.com/psi4/psi4/blob/be533f7f426b6ccc263904e55122899b16663395/psi4/driver/mdi_engine.py#L336-L339 | ||
aws/lumberyard | f85344403c1c2e77ec8c75deb2c116e97b713217 | dev/Tools/Python/3.7.10/linux_x64/lib/python3.7/site-packages/pkg_resources/__init__.py | python | IResourceProvider.resource_isdir | (resource_name) | Is the named resource a directory? (like ``os.path.isdir()``) | Is the named resource a directory? (like ``os.path.isdir()``) | [
"Is",
"the",
"named",
"resource",
"a",
"directory?",
"(",
"like",
"os",
".",
"path",
".",
"isdir",
"()",
")"
] | def resource_isdir(resource_name):
"""Is the named resource a directory? (like ``os.path.isdir()``)""" | [
"def",
"resource_isdir",
"(",
"resource_name",
")",
":"
] | https://github.com/aws/lumberyard/blob/f85344403c1c2e77ec8c75deb2c116e97b713217/dev/Tools/Python/3.7.10/linux_x64/lib/python3.7/site-packages/pkg_resources/__init__.py#L547-L548 | ||
aws/lumberyard | f85344403c1c2e77ec8c75deb2c116e97b713217 | dev/Gems/CloudGemMetric/v1/AWS/python/windows/Lib/pandas/core/series.py | python | Series.between | (self, left, right, inclusive=True) | return lmask & rmask | Return boolean Series equivalent to left <= series <= right.
This function returns a boolean vector containing `True` wherever the
corresponding Series element is between the boundary values `left` and
`right`. NA values are treated as `False`.
Parameters
----------
lef... | Return boolean Series equivalent to left <= series <= right. | [
"Return",
"boolean",
"Series",
"equivalent",
"to",
"left",
"<",
"=",
"series",
"<",
"=",
"right",
"."
] | def between(self, left, right, inclusive=True):
"""
Return boolean Series equivalent to left <= series <= right.
This function returns a boolean vector containing `True` wherever the
corresponding Series element is between the boundary values `left` and
`right`. NA values are tr... | [
"def",
"between",
"(",
"self",
",",
"left",
",",
"right",
",",
"inclusive",
"=",
"True",
")",
":",
"if",
"inclusive",
":",
"lmask",
"=",
"self",
">=",
"left",
"rmask",
"=",
"self",
"<=",
"right",
"else",
":",
"lmask",
"=",
"self",
">",
"left",
"rma... | https://github.com/aws/lumberyard/blob/f85344403c1c2e77ec8c75deb2c116e97b713217/dev/Gems/CloudGemMetric/v1/AWS/python/windows/Lib/pandas/core/series.py#L4297-L4370 | |
thalium/icebox | 99d147d5b9269222225443ce171b4fd46d8985d4 | third_party/virtualbox/src/libs/libxml2-2.9.4/python/libxml2class.py | python | xmlTextReader.ReadString | (self) | return ret | Reads the contents of an element or a text node as a string. | Reads the contents of an element or a text node as a string. | [
"Reads",
"the",
"contents",
"of",
"an",
"element",
"or",
"a",
"text",
"node",
"as",
"a",
"string",
"."
] | def ReadString(self):
"""Reads the contents of an element or a text node as a string. """
ret = libxml2mod.xmlTextReaderReadString(self._o)
return ret | [
"def",
"ReadString",
"(",
"self",
")",
":",
"ret",
"=",
"libxml2mod",
".",
"xmlTextReaderReadString",
"(",
"self",
".",
"_o",
")",
"return",
"ret"
] | https://github.com/thalium/icebox/blob/99d147d5b9269222225443ce171b4fd46d8985d4/third_party/virtualbox/src/libs/libxml2-2.9.4/python/libxml2class.py#L6067-L6070 | |
wlanjie/AndroidFFmpeg | 7baf9122f4b8e1c74e7baf4be5c422c7a5ba5aaf | tools/fdk-aac-build/x86/toolchain/lib/python2.7/decimal.py | python | Decimal.__long__ | (self) | return long(self.__int__()) | Converts to a long.
Equivalent to long(int(self)) | Converts to a long. | [
"Converts",
"to",
"a",
"long",
"."
] | def __long__(self):
"""Converts to a long.
Equivalent to long(int(self))
"""
return long(self.__int__()) | [
"def",
"__long__",
"(",
"self",
")",
":",
"return",
"long",
"(",
"self",
".",
"__int__",
"(",
")",
")"
] | https://github.com/wlanjie/AndroidFFmpeg/blob/7baf9122f4b8e1c74e7baf4be5c422c7a5ba5aaf/tools/fdk-aac-build/x86/toolchain/lib/python2.7/decimal.py#L1621-L1626 | |
pytorch/pytorch | 7176c92687d3cc847cc046bf002269c6949a21c2 | caffe2/python/workspace.py | python | FetchBlob | (name) | return result | Fetches a blob from the workspace.
Inputs:
name: the name of the blob - a string or a BlobReference
Returns:
Fetched blob (numpy array or string) if successful | Fetches a blob from the workspace. | [
"Fetches",
"a",
"blob",
"from",
"the",
"workspace",
"."
] | def FetchBlob(name):
"""Fetches a blob from the workspace.
Inputs:
name: the name of the blob - a string or a BlobReference
Returns:
Fetched blob (numpy array or string) if successful
"""
result = C.fetch_blob(StringifyBlobName(name))
if isinstance(result, tuple):
raise Type... | [
"def",
"FetchBlob",
"(",
"name",
")",
":",
"result",
"=",
"C",
".",
"fetch_blob",
"(",
"StringifyBlobName",
"(",
"name",
")",
")",
"if",
"isinstance",
"(",
"result",
",",
"tuple",
")",
":",
"raise",
"TypeError",
"(",
"\"Use FetchInt8Blob to fetch Int8 Blob {}\... | https://github.com/pytorch/pytorch/blob/7176c92687d3cc847cc046bf002269c6949a21c2/caffe2/python/workspace.py#L378-L393 | |
Kitware/ParaView | f760af9124ff4634b23ebbeab95a4f56e0261955 | Wrapping/Python/paraview/servermanager.py | python | ProxyProperty.GetData | (self) | return None | Returns all elements as either a list or a single value. | Returns all elements as either a list or a single value. | [
"Returns",
"all",
"elements",
"as",
"either",
"a",
"list",
"or",
"a",
"single",
"value",
"."
] | def GetData(self):
"Returns all elements as either a list or a single value."
property = self.SMProperty
if property.GetRepeatable() or property.GetNumberOfProxies() > 1:
return self[0:len(self)]
else:
if property.GetNumberOfProxies() > 0:
return _... | [
"def",
"GetData",
"(",
"self",
")",
":",
"property",
"=",
"self",
".",
"SMProperty",
"if",
"property",
".",
"GetRepeatable",
"(",
")",
"or",
"property",
".",
"GetNumberOfProxies",
"(",
")",
">",
"1",
":",
"return",
"self",
"[",
"0",
":",
"len",
"(",
... | https://github.com/Kitware/ParaView/blob/f760af9124ff4634b23ebbeab95a4f56e0261955/Wrapping/Python/paraview/servermanager.py#L1359-L1367 | |
ChromiumWebApps/chromium | c7361d39be8abd1574e6ce8957c8dbddd4c6ccf7 | tools/metrics/actions/extract_actions.py | python | AddWebUIActions | (actions) | Add user actions defined in WebUI files.
Arguments:
actions: set of actions to add to. | Add user actions defined in WebUI files. | [
"Add",
"user",
"actions",
"defined",
"in",
"WebUI",
"files",
"."
] | def AddWebUIActions(actions):
"""Add user actions defined in WebUI files.
Arguments:
actions: set of actions to add to.
"""
resources_root = os.path.join(REPOSITORY_ROOT, 'chrome', 'browser',
'resources')
WalkDirectory(resources_root, actions, ('.html'), GrepForWebUIAction... | [
"def",
"AddWebUIActions",
"(",
"actions",
")",
":",
"resources_root",
"=",
"os",
".",
"path",
".",
"join",
"(",
"REPOSITORY_ROOT",
",",
"'chrome'",
",",
"'browser'",
",",
"'resources'",
")",
"WalkDirectory",
"(",
"resources_root",
",",
"actions",
",",
"(",
"... | https://github.com/ChromiumWebApps/chromium/blob/c7361d39be8abd1574e6ce8957c8dbddd4c6ccf7/tools/metrics/actions/extract_actions.py#L520-L528 | ||
hanpfei/chromium-net | 392cc1fa3a8f92f42e4071ab6e674d8e0482f83f | build/get_syzygy_binaries.py | python | _Md5 | (path) | return hashlib.md5(open(path, 'rb').read()).hexdigest() | Returns the MD5 hash of the file at |path|, which must exist. | Returns the MD5 hash of the file at |path|, which must exist. | [
"Returns",
"the",
"MD5",
"hash",
"of",
"the",
"file",
"at",
"|path|",
"which",
"must",
"exist",
"."
] | def _Md5(path):
"""Returns the MD5 hash of the file at |path|, which must exist."""
return hashlib.md5(open(path, 'rb').read()).hexdigest() | [
"def",
"_Md5",
"(",
"path",
")",
":",
"return",
"hashlib",
".",
"md5",
"(",
"open",
"(",
"path",
",",
"'rb'",
")",
".",
"read",
"(",
")",
")",
".",
"hexdigest",
"(",
")"
] | https://github.com/hanpfei/chromium-net/blob/392cc1fa3a8f92f42e4071ab6e674d8e0482f83f/build/get_syzygy_binaries.py#L78-L80 | |
BlzFans/wke | b0fa21158312e40c5fbd84682d643022b6c34a93 | cygwin/lib/python2.6/xml/dom/expatbuilder.py | python | ExpatBuilder.parseFile | (self, file) | return doc | Parse a document from a file object, returning the document
node. | Parse a document from a file object, returning the document
node. | [
"Parse",
"a",
"document",
"from",
"a",
"file",
"object",
"returning",
"the",
"document",
"node",
"."
] | def parseFile(self, file):
"""Parse a document from a file object, returning the document
node."""
parser = self.getParser()
first_buffer = True
try:
while 1:
buffer = file.read(16*1024)
if not buffer:
break
... | [
"def",
"parseFile",
"(",
"self",
",",
"file",
")",
":",
"parser",
"=",
"self",
".",
"getParser",
"(",
")",
"first_buffer",
"=",
"True",
"try",
":",
"while",
"1",
":",
"buffer",
"=",
"file",
".",
"read",
"(",
"16",
"*",
"1024",
")",
"if",
"not",
"... | https://github.com/BlzFans/wke/blob/b0fa21158312e40c5fbd84682d643022b6c34a93/cygwin/lib/python2.6/xml/dom/expatbuilder.py#L197-L217 | |
pytorch/pytorch | 7176c92687d3cc847cc046bf002269c6949a21c2 | caffe2/python/data_parallel_model.py | python | _InterleaveOps | (model) | Data Parallel Model creates a net with ops in one device grouped together.
This will interleave the ops so that each op for each device is next
to each other in the net. Kind of like combining decks of cards. This
ensures that progress is made along the critical path roughly concurrently
for each device... | Data Parallel Model creates a net with ops in one device grouped together.
This will interleave the ops so that each op for each device is next
to each other in the net. Kind of like combining decks of cards. This
ensures that progress is made along the critical path roughly concurrently
for each device... | [
"Data",
"Parallel",
"Model",
"creates",
"a",
"net",
"with",
"ops",
"in",
"one",
"device",
"grouped",
"together",
".",
"This",
"will",
"interleave",
"the",
"ops",
"so",
"that",
"each",
"op",
"for",
"each",
"device",
"is",
"next",
"to",
"each",
"other",
"i... | def _InterleaveOps(model):
'''
Data Parallel Model creates a net with ops in one device grouped together.
This will interleave the ops so that each op for each device is next
to each other in the net. Kind of like combining decks of cards. This
ensures that progress is made along the critical path r... | [
"def",
"_InterleaveOps",
"(",
"model",
")",
":",
"orig_ops",
"=",
"list",
"(",
"model",
".",
"net",
".",
"Proto",
"(",
")",
".",
"op",
")",
"num_devices",
"=",
"len",
"(",
"model",
".",
"_devices",
")",
"num_ops_per_dev",
"=",
"len",
"(",
"orig_ops",
... | https://github.com/pytorch/pytorch/blob/7176c92687d3cc847cc046bf002269c6949a21c2/caffe2/python/data_parallel_model.py#L1935-L1965 | ||
catboost/catboost | 167f64f237114a4d10b2b4ee42adb4569137debe | contrib/tools/python/src/Lib/_abcoll.py | python | MutableSet.discard | (self, value) | Remove an element. Do not raise an exception if absent. | Remove an element. Do not raise an exception if absent. | [
"Remove",
"an",
"element",
".",
"Do",
"not",
"raise",
"an",
"exception",
"if",
"absent",
"."
] | def discard(self, value):
"""Remove an element. Do not raise an exception if absent."""
raise NotImplementedError | [
"def",
"discard",
"(",
"self",
",",
"value",
")",
":",
"raise",
"NotImplementedError"
] | https://github.com/catboost/catboost/blob/167f64f237114a4d10b2b4ee42adb4569137debe/contrib/tools/python/src/Lib/_abcoll.py#L300-L302 | ||
kevinlin311tw/Caffe-DeepBinaryCode | 9eaa7662be47d49f475ecbeea2bd51be105270d2 | scripts/cpp_lint.py | python | ParseNolintSuppressions | (filename, raw_line, linenum, error) | Updates the global list of error-suppressions.
Parses any NOLINT comments on the current line, updating the global
error_suppressions store. Reports an error if the NOLINT comment
was malformed.
Args:
filename: str, the name of the input file.
raw_line: str, the line of input text, with comments.
... | Updates the global list of error-suppressions. | [
"Updates",
"the",
"global",
"list",
"of",
"error",
"-",
"suppressions",
"."
] | def ParseNolintSuppressions(filename, raw_line, linenum, error):
"""Updates the global list of error-suppressions.
Parses any NOLINT comments on the current line, updating the global
error_suppressions store. Reports an error if the NOLINT comment
was malformed.
Args:
filename: str, the name of the inp... | [
"def",
"ParseNolintSuppressions",
"(",
"filename",
",",
"raw_line",
",",
"linenum",
",",
"error",
")",
":",
"# FIXME(adonovan): \"NOLINT(\" is misparsed as NOLINT(*).",
"matched",
"=",
"_RE_SUPPRESSION",
".",
"search",
"(",
"raw_line",
")",
"if",
"matched",
":",
"if",... | https://github.com/kevinlin311tw/Caffe-DeepBinaryCode/blob/9eaa7662be47d49f475ecbeea2bd51be105270d2/scripts/cpp_lint.py#L464-L492 | ||
plumonito/dtslam | 5994bb9cf7a11981b830370db206bceb654c085d | 3rdparty/opencv-git/doc/pattern_tools/svgfig.py | python | SVG.items | (self, sub=True, attr=True, text=True) | return output | Get a recursively-generated list of tree-index, sub-element/attribute pairs.
If sub == False, do not show sub-elements.
If attr == False, do not show attributes.
If text == False, do not show text/Unicode sub-elements. | Get a recursively-generated list of tree-index, sub-element/attribute pairs. | [
"Get",
"a",
"recursively",
"-",
"generated",
"list",
"of",
"tree",
"-",
"index",
"sub",
"-",
"element",
"/",
"attribute",
"pairs",
"."
] | def items(self, sub=True, attr=True, text=True):
"""Get a recursively-generated list of tree-index, sub-element/attribute pairs.
If sub == False, do not show sub-elements.
If attr == False, do not show attributes.
If text == False, do not show text/Unicode sub-elements.
"""
... | [
"def",
"items",
"(",
"self",
",",
"sub",
"=",
"True",
",",
"attr",
"=",
"True",
",",
"text",
"=",
"True",
")",
":",
"output",
"=",
"[",
"]",
"for",
"ti",
",",
"s",
"in",
"self",
":",
"show",
"=",
"False",
"if",
"isinstance",
"(",
"ti",
"[",
"... | https://github.com/plumonito/dtslam/blob/5994bb9cf7a11981b830370db206bceb654c085d/3rdparty/opencv-git/doc/pattern_tools/svgfig.py#L270-L290 | |
verilog-to-routing/vtr-verilog-to-routing | d9719cf7374821156c3cee31d66991cb85578562 | vtr_flow/scripts/benchtracker/flask_cors/core.py | python | re_fix | (reg) | return r".*" if reg == r"*" else reg | Replace the invalid regex r'*' with the valid, wildcard regex r'/.*' to
enable the CORS app extension to have a more user friendly api. | Replace the invalid regex r'*' with the valid, wildcard regex r'/.*' to
enable the CORS app extension to have a more user friendly api. | [
"Replace",
"the",
"invalid",
"regex",
"r",
"*",
"with",
"the",
"valid",
"wildcard",
"regex",
"r",
"/",
".",
"*",
"to",
"enable",
"the",
"CORS",
"app",
"extension",
"to",
"have",
"a",
"more",
"user",
"friendly",
"api",
"."
] | def re_fix(reg):
"""
Replace the invalid regex r'*' with the valid, wildcard regex r'/.*' to
enable the CORS app extension to have a more user friendly api.
"""
return r".*" if reg == r"*" else reg | [
"def",
"re_fix",
"(",
"reg",
")",
":",
"return",
"r\".*\"",
"if",
"reg",
"==",
"r\"*\"",
"else",
"reg"
] | https://github.com/verilog-to-routing/vtr-verilog-to-routing/blob/d9719cf7374821156c3cee31d66991cb85578562/vtr_flow/scripts/benchtracker/flask_cors/core.py#L251-L256 | |
apache/incubator-mxnet | f03fb23f1d103fec9541b5ae59ee06b1734a51d9 | python/mxnet/symbol/numpy/_symbol.py | python | blackman | (M, dtype=None, ctx=None) | return _npi.blackman(M, dtype=dtype, ctx=ctx) | r"""Return the Blackman window.
The Blackman window is a taper formed by using the first three
terms of a summation of cosines. It was designed to have close to the
minimal leakage possible. It is close to optimal, only slightly worse
than a Kaiser window.
Parameters
----------
M : int
... | r"""Return the Blackman window. | [
"r",
"Return",
"the",
"Blackman",
"window",
"."
] | def blackman(M, dtype=None, ctx=None):
r"""Return the Blackman window.
The Blackman window is a taper formed by using the first three
terms of a summation of cosines. It was designed to have close to the
minimal leakage possible. It is close to optimal, only slightly worse
than a Kaiser window.
... | [
"def",
"blackman",
"(",
"M",
",",
"dtype",
"=",
"None",
",",
"ctx",
"=",
"None",
")",
":",
"if",
"ctx",
"is",
"None",
":",
"ctx",
"=",
"current_context",
"(",
")",
"return",
"_npi",
".",
"blackman",
"(",
"M",
",",
"dtype",
"=",
"dtype",
",",
"ctx... | https://github.com/apache/incubator-mxnet/blob/f03fb23f1d103fec9541b5ae59ee06b1734a51d9/python/mxnet/symbol/numpy/_symbol.py#L5593-L5667 | |
aws/lumberyard | f85344403c1c2e77ec8c75deb2c116e97b713217 | dev/Gems/CloudGemMetric/v1/AWS/python/windows/Lib/llvmlite/ir/builder.py | python | IRBuilder.cbranch | (self, cond, truebr, falsebr) | return br | Conditional branch to *truebr* if *cond* is true, else to *falsebr*. | Conditional branch to *truebr* if *cond* is true, else to *falsebr*. | [
"Conditional",
"branch",
"to",
"*",
"truebr",
"*",
"if",
"*",
"cond",
"*",
"is",
"true",
"else",
"to",
"*",
"falsebr",
"*",
"."
] | def cbranch(self, cond, truebr, falsebr):
"""
Conditional branch to *truebr* if *cond* is true, else to *falsebr*.
"""
br = instructions.ConditionalBranch(self.block, "br",
[cond, truebr, falsebr])
self._set_terminator(br)
retur... | [
"def",
"cbranch",
"(",
"self",
",",
"cond",
",",
"truebr",
",",
"falsebr",
")",
":",
"br",
"=",
"instructions",
".",
"ConditionalBranch",
"(",
"self",
".",
"block",
",",
"\"br\"",
",",
"[",
"cond",
",",
"truebr",
",",
"falsebr",
"]",
")",
"self",
"."... | https://github.com/aws/lumberyard/blob/f85344403c1c2e77ec8c75deb2c116e97b713217/dev/Gems/CloudGemMetric/v1/AWS/python/windows/Lib/llvmlite/ir/builder.py#L794-L801 | |
catboost/catboost | 167f64f237114a4d10b2b4ee42adb4569137debe | contrib/tools/python/src/Lib/Queue.py | python | Queue.put | (self, item, block=True, timeout=None) | Put an item into the queue.
If optional args 'block' is true and 'timeout' is None (the default),
block if necessary until a free slot is available. If 'timeout' is
a non-negative number, it blocks at most 'timeout' seconds and raises
the Full exception if no free slot was available wit... | Put an item into the queue. | [
"Put",
"an",
"item",
"into",
"the",
"queue",
"."
] | def put(self, item, block=True, timeout=None):
"""Put an item into the queue.
If optional args 'block' is true and 'timeout' is None (the default),
block if necessary until a free slot is available. If 'timeout' is
a non-negative number, it blocks at most 'timeout' seconds and raises
... | [
"def",
"put",
"(",
"self",
",",
"item",
",",
"block",
"=",
"True",
",",
"timeout",
"=",
"None",
")",
":",
"self",
".",
"not_full",
".",
"acquire",
"(",
")",
"try",
":",
"if",
"self",
".",
"maxsize",
">",
"0",
":",
"if",
"not",
"block",
":",
"if... | https://github.com/catboost/catboost/blob/167f64f237114a4d10b2b4ee42adb4569137debe/contrib/tools/python/src/Lib/Queue.py#L107-L140 | ||
clementine-player/Clementine | 111379dfd027802b59125829fcf87e3e1d0ad73b | dist/cpplint.py | python | Match | (pattern, s) | return _regexp_compile_cache[pattern].match(s) | Matches the string with the pattern, caching the compiled regexp. | Matches the string with the pattern, caching the compiled regexp. | [
"Matches",
"the",
"string",
"with",
"the",
"pattern",
"caching",
"the",
"compiled",
"regexp",
"."
] | def Match(pattern, s):
"""Matches the string with the pattern, caching the compiled regexp."""
# The regexp compilation caching is inlined in both Match and Search for
# performance reasons; factoring it out into a separate function turns out
# to be noticeably expensive.
if pattern not in _regexp_compile_cac... | [
"def",
"Match",
"(",
"pattern",
",",
"s",
")",
":",
"# The regexp compilation caching is inlined in both Match and Search for",
"# performance reasons; factoring it out into a separate function turns out",
"# to be noticeably expensive.",
"if",
"pattern",
"not",
"in",
"_regexp_compile_... | https://github.com/clementine-player/Clementine/blob/111379dfd027802b59125829fcf87e3e1d0ad73b/dist/cpplint.py#L551-L558 | |
tensorflow/tensorflow | 419e3a6b650ea4bd1b0cba23c4348f8a69f3272e | tensorflow/python/keras/distribute/distribute_coordinator_utils.py | python | _WorkerContext.num_workers | (self) | return self._num_workers | Returns number of workers in the cluster, including chief. | Returns number of workers in the cluster, including chief. | [
"Returns",
"number",
"of",
"workers",
"in",
"the",
"cluster",
"including",
"chief",
"."
] | def num_workers(self):
"""Returns number of workers in the cluster, including chief."""
return self._num_workers | [
"def",
"num_workers",
"(",
"self",
")",
":",
"return",
"self",
".",
"_num_workers"
] | https://github.com/tensorflow/tensorflow/blob/419e3a6b650ea4bd1b0cba23c4348f8a69f3272e/tensorflow/python/keras/distribute/distribute_coordinator_utils.py#L267-L269 | |
FreeCAD/FreeCAD | ba42231b9c6889b89e064d6d563448ed81e376ec | src/Mod/Path/PathScripts/PathProfile.py | python | ObjectProfile.initAreaOp | (self, obj) | initAreaOp(obj) ... creates all profile specific properties. | initAreaOp(obj) ... creates all profile specific properties. | [
"initAreaOp",
"(",
"obj",
")",
"...",
"creates",
"all",
"profile",
"specific",
"properties",
"."
] | def initAreaOp(self, obj):
"""initAreaOp(obj) ... creates all profile specific properties."""
self.propertiesReady = False
self.initAreaOpProperties(obj)
obj.setEditorMode("MiterLimit", 2)
obj.setEditorMode("JoinType", 2) | [
"def",
"initAreaOp",
"(",
"self",
",",
"obj",
")",
":",
"self",
".",
"propertiesReady",
"=",
"False",
"self",
".",
"initAreaOpProperties",
"(",
"obj",
")",
"obj",
".",
"setEditorMode",
"(",
"\"MiterLimit\"",
",",
"2",
")",
"obj",
".",
"setEditorMode",
"(",... | https://github.com/FreeCAD/FreeCAD/blob/ba42231b9c6889b89e064d6d563448ed81e376ec/src/Mod/Path/PathScripts/PathProfile.py#L66-L72 | ||
aosp-mirror/platform_system_core | eb710bfa72ad6461ab147f77d8873c561efa1010 | storaged/tools/ranker.py | python | display_uids | (uid_rank, uids, args) | Display ranked uid io, along with task io if specified. | Display ranked uid io, along with task io if specified. | [
"Display",
"ranked",
"uid",
"io",
"along",
"with",
"task",
"io",
"if",
"specified",
"."
] | def display_uids(uid_rank, uids, args):
"""Display ranked uid io, along with task io if specified."""
fout = sys.stdout
if args.output != "stdout":
fout = open(args.output, "w")
for i in range(8):
fout.write("RANKING BY " + IO_NAMES[i] + "\n")
for j in range(min(args.uidcnt, len(uid_rank[0]))):
... | [
"def",
"display_uids",
"(",
"uid_rank",
",",
"uids",
",",
"args",
")",
":",
"fout",
"=",
"sys",
".",
"stdout",
"if",
"args",
".",
"output",
"!=",
"\"stdout\"",
":",
"fout",
"=",
"open",
"(",
"args",
".",
"output",
",",
"\"w\"",
")",
"for",
"i",
"in... | https://github.com/aosp-mirror/platform_system_core/blob/eb710bfa72ad6461ab147f77d8873c561efa1010/storaged/tools/ranker.py#L155-L171 | ||
thalium/icebox | 99d147d5b9269222225443ce171b4fd46d8985d4 | third_party/virtualbox/src/libs/libxml2-2.9.4/python/libxml.py | python | SAXCallback.attributeDecl | (self, elem, name, type, defi, defaultValue, nameList) | called when an ATTRIBUTE definition has been found | called when an ATTRIBUTE definition has been found | [
"called",
"when",
"an",
"ATTRIBUTE",
"definition",
"has",
"been",
"found"
] | def attributeDecl(self, elem, name, type, defi, defaultValue, nameList):
"""called when an ATTRIBUTE definition has been found"""
pass | [
"def",
"attributeDecl",
"(",
"self",
",",
"elem",
",",
"name",
",",
"type",
",",
"defi",
",",
"defaultValue",
",",
"nameList",
")",
":",
"pass"
] | https://github.com/thalium/icebox/blob/99d147d5b9269222225443ce171b4fd46d8985d4/third_party/virtualbox/src/libs/libxml2-2.9.4/python/libxml.py#L236-L238 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.