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 |
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
eventql/eventql | 7ca0dbb2e683b525620ea30dc40540a22d5eb227 | deps/3rdparty/spidermonkey/mozjs/media/webrtc/trunk/tools/gyp/pylib/gyp/generator/make.py | python | MakefileWriter.ComputeDeps | (self, spec) | return (gyp.common.uniquer(deps), gyp.common.uniquer(link_deps)) | Compute the dependencies of a gyp spec.
Returns a tuple (deps, link_deps), where each is a list of
filenames that will need to be put in front of make for either
building (deps) or linking (link_deps). | Compute the dependencies of a gyp spec. | [
"Compute",
"the",
"dependencies",
"of",
"a",
"gyp",
"spec",
"."
] | def ComputeDeps(self, spec):
"""Compute the dependencies of a gyp spec.
Returns a tuple (deps, link_deps), where each is a list of
filenames that will need to be put in front of make for either
building (deps) or linking (link_deps).
"""
deps = []
link_deps = []
if 'dependencies' in spe... | [
"def",
"ComputeDeps",
"(",
"self",
",",
"spec",
")",
":",
"deps",
"=",
"[",
"]",
"link_deps",
"=",
"[",
"]",
"if",
"'dependencies'",
"in",
"spec",
":",
"deps",
".",
"extend",
"(",
"[",
"target_outputs",
"[",
"dep",
"]",
"for",
"dep",
"in",
"spec",
... | https://github.com/eventql/eventql/blob/7ca0dbb2e683b525620ea30dc40540a22d5eb227/deps/3rdparty/spidermonkey/mozjs/media/webrtc/trunk/tools/gyp/pylib/gyp/generator/make.py#L1363-L1382 | |
root-project/root | fcd3583bb14852bf2e8cd2415717cbaac0e75896 | bindings/pyroot/pythonizations/python/ROOT/_pythonization/_roofit/_rooabsdata.py | python | RooAbsData.reduce | (self, *args, **kwargs) | return self._reduce(*args, **kwargs) | r"""The RooAbsData::reduce() function is pythonized with the command argument pythonization.
The keywords must correspond to the CmdArgs of the function. | r"""The RooAbsData::reduce() function is pythonized with the command argument pythonization.
The keywords must correspond to the CmdArgs of the function. | [
"r",
"The",
"RooAbsData",
"::",
"reduce",
"()",
"function",
"is",
"pythonized",
"with",
"the",
"command",
"argument",
"pythonization",
".",
"The",
"keywords",
"must",
"correspond",
"to",
"the",
"CmdArgs",
"of",
"the",
"function",
"."
] | def reduce(self, *args, **kwargs):
r"""The RooAbsData::reduce() function is pythonized with the command argument pythonization.
The keywords must correspond to the CmdArgs of the function.
"""
# Redefinition of `RooAbsData.reduce` for keyword arguments.
args, kwargs = _kwargs_to_... | [
"def",
"reduce",
"(",
"self",
",",
"*",
"args",
",",
"*",
"*",
"kwargs",
")",
":",
"# Redefinition of `RooAbsData.reduce` for keyword arguments.",
"args",
",",
"kwargs",
"=",
"_kwargs_to_roocmdargs",
"(",
"*",
"args",
",",
"*",
"*",
"kwargs",
")",
"return",
"s... | https://github.com/root-project/root/blob/fcd3583bb14852bf2e8cd2415717cbaac0e75896/bindings/pyroot/pythonizations/python/ROOT/_pythonization/_roofit/_rooabsdata.py#L67-L73 | |
wxWidgets/wxPython-Classic | 19571e1ae65f1ac445f5491474121998c97a1bf0 | src/msw/dataview.py | python | DataViewRenderer.GetAlignment | (*args, **kwargs) | return _dataview.DataViewRenderer_GetAlignment(*args, **kwargs) | GetAlignment(self) -> int | GetAlignment(self) -> int | [
"GetAlignment",
"(",
"self",
")",
"-",
">",
"int"
] | def GetAlignment(*args, **kwargs):
"""GetAlignment(self) -> int"""
return _dataview.DataViewRenderer_GetAlignment(*args, **kwargs) | [
"def",
"GetAlignment",
"(",
"*",
"args",
",",
"*",
"*",
"kwargs",
")",
":",
"return",
"_dataview",
".",
"DataViewRenderer_GetAlignment",
"(",
"*",
"args",
",",
"*",
"*",
"kwargs",
")"
] | https://github.com/wxWidgets/wxPython-Classic/blob/19571e1ae65f1ac445f5491474121998c97a1bf0/src/msw/dataview.py#L1180-L1182 | |
catboost/catboost | 167f64f237114a4d10b2b4ee42adb4569137debe | contrib/tools/python/src/Lib/logging/__init__.py | python | LogRecord.getMessage | (self) | return msg | Return the message for this LogRecord.
Return the message for this LogRecord after merging any user-supplied
arguments with the message. | Return the message for this LogRecord. | [
"Return",
"the",
"message",
"for",
"this",
"LogRecord",
"."
] | def getMessage(self):
"""
Return the message for this LogRecord.
Return the message for this LogRecord after merging any user-supplied
arguments with the message.
"""
if not _unicode: #if no unicode support...
msg = str(self.msg)
else:
msg... | [
"def",
"getMessage",
"(",
"self",
")",
":",
"if",
"not",
"_unicode",
":",
"#if no unicode support...",
"msg",
"=",
"str",
"(",
"self",
".",
"msg",
")",
"else",
":",
"msg",
"=",
"self",
".",
"msg",
"if",
"not",
"isinstance",
"(",
"msg",
",",
"basestring... | https://github.com/catboost/catboost/blob/167f64f237114a4d10b2b4ee42adb4569137debe/contrib/tools/python/src/Lib/logging/__init__.py#L312-L330 | |
baidu-research/tensorflow-allreduce | 66d5b855e90b0949e9fa5cca5599fd729a70e874 | tensorflow/contrib/layers/python/layers/initializers.py | python | xavier_initializer | (uniform=True, seed=None, dtype=dtypes.float32) | return variance_scaling_initializer(factor=1.0, mode='FAN_AVG',
uniform=uniform, seed=seed, dtype=dtype) | Returns an initializer performing "Xavier" initialization for weights.
This function implements the weight initialization from:
Xavier Glorot and Yoshua Bengio (2010):
[Understanding the difficulty of training deep feedforward neural
networks. International conference on artificial intellige... | Returns an initializer performing "Xavier" initialization for weights. | [
"Returns",
"an",
"initializer",
"performing",
"Xavier",
"initialization",
"for",
"weights",
"."
] | def xavier_initializer(uniform=True, seed=None, dtype=dtypes.float32):
"""Returns an initializer performing "Xavier" initialization for weights.
This function implements the weight initialization from:
Xavier Glorot and Yoshua Bengio (2010):
[Understanding the difficulty of training deep feedforward ... | [
"def",
"xavier_initializer",
"(",
"uniform",
"=",
"True",
",",
"seed",
"=",
"None",
",",
"dtype",
"=",
"dtypes",
".",
"float32",
")",
":",
"return",
"variance_scaling_initializer",
"(",
"factor",
"=",
"1.0",
",",
"mode",
"=",
"'FAN_AVG'",
",",
"uniform",
"... | https://github.com/baidu-research/tensorflow-allreduce/blob/66d5b855e90b0949e9fa5cca5599fd729a70e874/tensorflow/contrib/layers/python/layers/initializers.py#L31-L57 | |
idaholab/moose | 9eeebc65e098b4c30f8205fb41591fd5b61eb6ff | python/MooseDocs/base/components.py | python | ReaderComponent.__init__ | (self) | Constructs the object and sets the default settings of the object. | Constructs the object and sets the default settings of the object. | [
"Constructs",
"the",
"object",
"and",
"sets",
"the",
"default",
"settings",
"of",
"the",
"object",
"."
] | def __init__(self):
"""
Constructs the object and sets the default settings of the object.
"""
Component.__init__(self)
mixins.ReaderObject.__init__(self)
# Check return type of default settings
defaults = self.defaultSettings()
if not isinstance(defaults... | [
"def",
"__init__",
"(",
"self",
")",
":",
"Component",
".",
"__init__",
"(",
"self",
")",
"mixins",
".",
"ReaderObject",
".",
"__init__",
"(",
"self",
")",
"# Check return type of default settings",
"defaults",
"=",
"self",
".",
"defaultSettings",
"(",
")",
"i... | https://github.com/idaholab/moose/blob/9eeebc65e098b4c30f8205fb41591fd5b61eb6ff/python/MooseDocs/base/components.py#L85-L96 | ||
wxWidgets/wxPython-Classic | 19571e1ae65f1ac445f5491474121998c97a1bf0 | src/msw/_gdi.py | python | Cursor.GetHandle | (*args, **kwargs) | return _gdi_.Cursor_GetHandle(*args, **kwargs) | GetHandle(self) -> long
Get the MS Windows handle for the cursor | GetHandle(self) -> long | [
"GetHandle",
"(",
"self",
")",
"-",
">",
"long"
] | def GetHandle(*args, **kwargs):
"""
GetHandle(self) -> long
Get the MS Windows handle for the cursor
"""
return _gdi_.Cursor_GetHandle(*args, **kwargs) | [
"def",
"GetHandle",
"(",
"*",
"args",
",",
"*",
"*",
"kwargs",
")",
":",
"return",
"_gdi_",
".",
"Cursor_GetHandle",
"(",
"*",
"args",
",",
"*",
"*",
"kwargs",
")"
] | https://github.com/wxWidgets/wxPython-Classic/blob/19571e1ae65f1ac445f5491474121998c97a1bf0/src/msw/_gdi.py#L1550-L1556 | |
miyosuda/TensorFlowAndroidDemo | 35903e0221aa5f109ea2dbef27f20b52e317f42d | jni-build/jni/include/tensorflow/python/ops/control_flow_ops.py | python | WhileContext.grad_state | (self) | return self._grad_state | The gradient loop state. | The gradient loop state. | [
"The",
"gradient",
"loop",
"state",
"."
] | def grad_state(self):
"""The gradient loop state."""
return self._grad_state | [
"def",
"grad_state",
"(",
"self",
")",
":",
"return",
"self",
".",
"_grad_state"
] | https://github.com/miyosuda/TensorFlowAndroidDemo/blob/35903e0221aa5f109ea2dbef27f20b52e317f42d/jni-build/jni/include/tensorflow/python/ops/control_flow_ops.py#L1425-L1427 | |
pytorch/pytorch | 7176c92687d3cc847cc046bf002269c6949a21c2 | caffe2/python/schema.py | python | Field._child_base_id | (self, child_index=None) | return pos | Get the base id of the given child | Get the base id of the given child | [
"Get",
"the",
"base",
"id",
"of",
"the",
"given",
"child"
] | def _child_base_id(self, child_index=None):
"""Get the base id of the given child"""
p, i = self._parent
pos = 0 if child_index is None else self._field_offsets[child_index]
if p:
pos += p._child_base_id(i)
return pos | [
"def",
"_child_base_id",
"(",
"self",
",",
"child_index",
"=",
"None",
")",
":",
"p",
",",
"i",
"=",
"self",
".",
"_parent",
"pos",
"=",
"0",
"if",
"child_index",
"is",
"None",
"else",
"self",
".",
"_field_offsets",
"[",
"child_index",
"]",
"if",
"p",
... | https://github.com/pytorch/pytorch/blob/7176c92687d3cc847cc046bf002269c6949a21c2/caffe2/python/schema.py#L175-L181 | |
windystrife/UnrealEngine_NVIDIAGameWorks | b50e6338a7c5b26374d66306ebc7807541ff815e | Engine/Extras/ThirdPartyNotUE/emsdk/Win64/python/2.7.5.3_64bit/Lib/shutil.py | python | copytree | (src, dst, symlinks=False, ignore=None) | Recursively copy a directory tree using copy2().
The destination directory must not already exist.
If exception(s) occur, an Error is raised with a list of reasons.
If the optional symlinks flag is true, symbolic links in the
source tree result in symbolic links in the destination tree; if
it is f... | Recursively copy a directory tree using copy2(). | [
"Recursively",
"copy",
"a",
"directory",
"tree",
"using",
"copy2",
"()",
"."
] | def copytree(src, dst, symlinks=False, ignore=None):
"""Recursively copy a directory tree using copy2().
The destination directory must not already exist.
If exception(s) occur, an Error is raised with a list of reasons.
If the optional symlinks flag is true, symbolic links in the
source tree resu... | [
"def",
"copytree",
"(",
"src",
",",
"dst",
",",
"symlinks",
"=",
"False",
",",
"ignore",
"=",
"None",
")",
":",
"names",
"=",
"os",
".",
"listdir",
"(",
"src",
")",
"if",
"ignore",
"is",
"not",
"None",
":",
"ignored_names",
"=",
"ignore",
"(",
"src... | https://github.com/windystrife/UnrealEngine_NVIDIAGameWorks/blob/b50e6338a7c5b26374d66306ebc7807541ff815e/Engine/Extras/ThirdPartyNotUE/emsdk/Win64/python/2.7.5.3_64bit/Lib/shutil.py#L145-L208 | ||
aws/lumberyard | f85344403c1c2e77ec8c75deb2c116e97b713217 | dev/Tools/AWSPythonSDK/1.5.8/botocore/vendored/requests/cookies.py | python | remove_cookie_by_name | (cookiejar, name, domain=None, path=None) | Unsets a cookie by name, by default over all domains and paths.
Wraps CookieJar.clear(), is O(n). | Unsets a cookie by name, by default over all domains and paths. | [
"Unsets",
"a",
"cookie",
"by",
"name",
"by",
"default",
"over",
"all",
"domains",
"and",
"paths",
"."
] | def remove_cookie_by_name(cookiejar, name, domain=None, path=None):
"""Unsets a cookie by name, by default over all domains and paths.
Wraps CookieJar.clear(), is O(n).
"""
clearables = []
for cookie in cookiejar:
if cookie.name == name:
if domain is None or domain == cookie.dom... | [
"def",
"remove_cookie_by_name",
"(",
"cookiejar",
",",
"name",
",",
"domain",
"=",
"None",
",",
"path",
"=",
"None",
")",
":",
"clearables",
"=",
"[",
"]",
"for",
"cookie",
"in",
"cookiejar",
":",
"if",
"cookie",
".",
"name",
"==",
"name",
":",
"if",
... | https://github.com/aws/lumberyard/blob/f85344403c1c2e77ec8c75deb2c116e97b713217/dev/Tools/AWSPythonSDK/1.5.8/botocore/vendored/requests/cookies.py#L139-L152 | ||
windystrife/UnrealEngine_NVIDIAGameWorks | b50e6338a7c5b26374d66306ebc7807541ff815e | Engine/Extras/ThirdPartyNotUE/emsdk/Win64/python/2.7.5.3_64bit/Lib/site.py | python | check_enableusersite | () | return True | Check if user site directory is safe for inclusion
The function tests for the command line flag (including environment var),
process uid/gid equal to effective uid/gid.
None: Disabled for security reasons
False: Disabled by user (command line option)
True: Safe and enabled | Check if user site directory is safe for inclusion | [
"Check",
"if",
"user",
"site",
"directory",
"is",
"safe",
"for",
"inclusion"
] | def check_enableusersite():
"""Check if user site directory is safe for inclusion
The function tests for the command line flag (including environment var),
process uid/gid equal to effective uid/gid.
None: Disabled for security reasons
False: Disabled by user (command line option)
True: Safe a... | [
"def",
"check_enableusersite",
"(",
")",
":",
"if",
"sys",
".",
"flags",
".",
"no_user_site",
":",
"return",
"False",
"if",
"hasattr",
"(",
"os",
",",
"\"getuid\"",
")",
"and",
"hasattr",
"(",
"os",
",",
"\"geteuid\"",
")",
":",
"# check process uid == effec... | https://github.com/windystrife/UnrealEngine_NVIDIAGameWorks/blob/b50e6338a7c5b26374d66306ebc7807541ff815e/Engine/Extras/ThirdPartyNotUE/emsdk/Win64/python/2.7.5.3_64bit/Lib/site.py#L196-L218 | |
vgough/encfs | c444f9b9176beea1ad41a7b2e29ca26e709b57f7 | vendor/github.com/google/benchmark/tools/gbench/util.py | python | check_input_file | (filename) | return ftype | Classify the file named by 'filename' and return the classification.
If the file is classified as 'IT_Invalid' print an error message and exit
the program. | Classify the file named by 'filename' and return the classification.
If the file is classified as 'IT_Invalid' print an error message and exit
the program. | [
"Classify",
"the",
"file",
"named",
"by",
"filename",
"and",
"return",
"the",
"classification",
".",
"If",
"the",
"file",
"is",
"classified",
"as",
"IT_Invalid",
"print",
"an",
"error",
"message",
"and",
"exit",
"the",
"program",
"."
] | def check_input_file(filename):
"""
Classify the file named by 'filename' and return the classification.
If the file is classified as 'IT_Invalid' print an error message and exit
the program.
"""
ftype, msg = classify_input_file(filename)
if ftype == IT_Invalid:
print("Invalid input ... | [
"def",
"check_input_file",
"(",
"filename",
")",
":",
"ftype",
",",
"msg",
"=",
"classify_input_file",
"(",
"filename",
")",
"if",
"ftype",
"==",
"IT_Invalid",
":",
"print",
"(",
"\"Invalid input file: %s\"",
"%",
"msg",
")",
"sys",
".",
"exit",
"(",
"1",
... | https://github.com/vgough/encfs/blob/c444f9b9176beea1ad41a7b2e29ca26e709b57f7/vendor/github.com/google/benchmark/tools/gbench/util.py#L75-L85 | |
tensorflow/tensorflow | 419e3a6b650ea4bd1b0cba23c4348f8a69f3272e | tensorflow/python/keras/engine/data_adapter.py | python | train_validation_split | (arrays, validation_split) | return train_arrays, val_arrays | Split arrays into train and validation subsets in deterministic order.
The last part of data will become validation data.
Args:
arrays: Tensors to split. Allowed inputs are arbitrarily nested structures
of Tensors and NumPy arrays.
validation_split: Float between 0 and 1. The proportion of the datas... | Split arrays into train and validation subsets in deterministic order. | [
"Split",
"arrays",
"into",
"train",
"and",
"validation",
"subsets",
"in",
"deterministic",
"order",
"."
] | def train_validation_split(arrays, validation_split):
"""Split arrays into train and validation subsets in deterministic order.
The last part of data will become validation data.
Args:
arrays: Tensors to split. Allowed inputs are arbitrarily nested structures
of Tensors and NumPy arrays.
validatio... | [
"def",
"train_validation_split",
"(",
"arrays",
",",
"validation_split",
")",
":",
"def",
"_can_split",
"(",
"t",
")",
":",
"tensor_types",
"=",
"_get_tensor_types",
"(",
")",
"return",
"isinstance",
"(",
"t",
",",
"tensor_types",
")",
"or",
"t",
"is",
"None... | https://github.com/tensorflow/tensorflow/blob/419e3a6b650ea4bd1b0cba23c4348f8a69f3272e/tensorflow/python/keras/engine/data_adapter.py#L1466-L1523 | |
mindspore-ai/mindspore | fb8fd3338605bb34fa5cea054e535a8b1d753fab | mindspore/python/mindspore/ops/composite/multitype_ops/logic_not_impl.py | python | _logical_not_tensor | (x) | return F.logical_not(x.__bool__()) | Return logical not operation result of x.
Args:
x(Tensor): Tensor.
Returns:
Tensor, Return logical not operation result of x. | Return logical not operation result of x.
Args:
x(Tensor): Tensor.
Returns:
Tensor, Return logical not operation result of x. | [
"Return",
"logical",
"not",
"operation",
"result",
"of",
"x",
".",
"Args",
":",
"x",
"(",
"Tensor",
")",
":",
"Tensor",
".",
"Returns",
":",
"Tensor",
"Return",
"logical",
"not",
"operation",
"result",
"of",
"x",
"."
] | def _logical_not_tensor(x):
"""
Return logical not operation result of x.
Args:
x(Tensor): Tensor.
Returns:
Tensor, Return logical not operation result of x.
"""
if F.isconstant(x):
return F.bool_not(x.__bool__())
return F.logical_not(x.__bool__()) | [
"def",
"_logical_not_tensor",
"(",
"x",
")",
":",
"if",
"F",
".",
"isconstant",
"(",
"x",
")",
":",
"return",
"F",
".",
"bool_not",
"(",
"x",
".",
"__bool__",
"(",
")",
")",
"return",
"F",
".",
"logical_not",
"(",
"x",
".",
"__bool__",
"(",
")",
... | https://github.com/mindspore-ai/mindspore/blob/fb8fd3338605bb34fa5cea054e535a8b1d753fab/mindspore/python/mindspore/ops/composite/multitype_ops/logic_not_impl.py#L40-L50 | |
tensorflow/deepmath | b5b721f54de1d5d6a02d78f5da5995237f9995f9 | deepmath/holstep_baselines/conditioned_classification_models.py | python | cnn_2x_siamese | (voc_size, max_len, dropout=0.5) | return model | Two siamese branches, each embedding a statement.
Binary classifier on top.
Args:
voc_size: size of the vocabulary for the input statements.
max_len: maximum length for the input statements.
dropout: Fraction of units to drop.
Returns:
A Keras model instance. | Two siamese branches, each embedding a statement. | [
"Two",
"siamese",
"branches",
"each",
"embedding",
"a",
"statement",
"."
] | def cnn_2x_siamese(voc_size, max_len, dropout=0.5):
"""Two siamese branches, each embedding a statement.
Binary classifier on top.
Args:
voc_size: size of the vocabulary for the input statements.
max_len: maximum length for the input statements.
dropout: Fraction of units to drop.
Returns:
A K... | [
"def",
"cnn_2x_siamese",
"(",
"voc_size",
",",
"max_len",
",",
"dropout",
"=",
"0.5",
")",
":",
"pivot_input",
"=",
"layers",
".",
"Input",
"(",
"shape",
"=",
"(",
"max_len",
",",
")",
",",
"dtype",
"=",
"'int32'",
")",
"statement_input",
"=",
"layers",
... | https://github.com/tensorflow/deepmath/blob/b5b721f54de1d5d6a02d78f5da5995237f9995f9/deepmath/holstep_baselines/conditioned_classification_models.py#L25-L58 | |
apiaryio/snowcrash | b5b39faa85f88ee17459edf39fdc6fe4fc70d2e3 | tools/gyp/pylib/gyp/xcode_emulation.py | python | XcodeSettings.GetInstallName | (self) | return install_name | Return LD_DYLIB_INSTALL_NAME for this target. | Return LD_DYLIB_INSTALL_NAME for this target. | [
"Return",
"LD_DYLIB_INSTALL_NAME",
"for",
"this",
"target",
"."
] | def GetInstallName(self):
"""Return LD_DYLIB_INSTALL_NAME for this target."""
# Xcode sets this for shared_libraries, and for nonbundled loadable_modules.
if (self.spec['type'] != 'shared_library' and
(self.spec['type'] != 'loadable_module' or self._IsBundle())):
return None
default_insta... | [
"def",
"GetInstallName",
"(",
"self",
")",
":",
"# Xcode sets this for shared_libraries, and for nonbundled loadable_modules.",
"if",
"(",
"self",
".",
"spec",
"[",
"'type'",
"]",
"!=",
"'shared_library'",
"and",
"(",
"self",
".",
"spec",
"[",
"'type'",
"]",
"!=",
... | https://github.com/apiaryio/snowcrash/blob/b5b39faa85f88ee17459edf39fdc6fe4fc70d2e3/tools/gyp/pylib/gyp/xcode_emulation.py#L713-L749 | |
cms-sw/cmssw | fd9de012d503d3405420bcbeec0ec879baa57cf2 | RecoEgamma/PhotonIdentification/python/Identification/cutBasedPhotonID_tools.py | python | configureVIDCutBasedPhoID_V2 | ( wpEB, wpEE, isoInputs ) | return parameterSet | This function configures the full cms.PSet for a VID ID and returns it.
The inputs: first object is of the type WorkingPoint_V2, second object
is of the type WorkingPoint_V1, containing the cuts for the Barrel (EB)
and the other one for the Endcap (EE).
The third argument contains data for isolation ca... | This function configures the full cms.PSet for a VID ID and returns it.
The inputs: first object is of the type WorkingPoint_V2, second object
is of the type WorkingPoint_V1, containing the cuts for the Barrel (EB)
and the other one for the Endcap (EE).
The third argument contains data for isolation ca... | [
"This",
"function",
"configures",
"the",
"full",
"cms",
".",
"PSet",
"for",
"a",
"VID",
"ID",
"and",
"returns",
"it",
".",
"The",
"inputs",
":",
"first",
"object",
"is",
"of",
"the",
"type",
"WorkingPoint_V2",
"second",
"object",
"is",
"of",
"the",
"type... | def configureVIDCutBasedPhoID_V2( wpEB, wpEE, isoInputs ):
"""
This function configures the full cms.PSet for a VID ID and returns it.
The inputs: first object is of the type WorkingPoint_V2, second object
is of the type WorkingPoint_V1, containing the cuts for the Barrel (EB)
and the other one for... | [
"def",
"configureVIDCutBasedPhoID_V2",
"(",
"wpEB",
",",
"wpEE",
",",
"isoInputs",
")",
":",
"# print \"VID: Configuring cut set %s\" % wpEB.idName",
"parameterSet",
"=",
"cms",
".",
"PSet",
"(",
"#",
"idName",
"=",
"cms",
".",
"string",
"(",
"wpEB",
".",
"idName"... | https://github.com/cms-sw/cmssw/blob/fd9de012d503d3405420bcbeec0ec879baa57cf2/RecoEgamma/PhotonIdentification/python/Identification/cutBasedPhotonID_tools.py#L345-L371 | |
SequoiaDB/SequoiaDB | 2894ed7e5bd6fe57330afc900cf76d0ff0df9f64 | driver/python/pysequoiadb/client.py | python | client.create_collection_space | (self, cs_name, options=0) | return cs | Create collection space with specified pagesize.
Parameters:
Name Type Info:
cs_name str The name of collection space to be created.
options int/dict The options to create collection space.
When type is int, means ... | Create collection space with specified pagesize. | [
"Create",
"collection",
"space",
"with",
"specified",
"pagesize",
"."
] | def create_collection_space(self, cs_name, options=0):
"""Create collection space with specified pagesize.
Parameters:
Name Type Info:
cs_name str The name of collection space to be created.
options int/dict The options to create collection... | [
"def",
"create_collection_space",
"(",
"self",
",",
"cs_name",
",",
"options",
"=",
"0",
")",
":",
"ops",
"=",
"{",
"}",
"if",
"not",
"isinstance",
"(",
"cs_name",
",",
"str_type",
")",
":",
"raise",
"SDBTypeError",
"(",
"\"name of collection space must be an ... | https://github.com/SequoiaDB/SequoiaDB/blob/2894ed7e5bd6fe57330afc900cf76d0ff0df9f64/driver/python/pysequoiadb/client.py#L666-L724 | |
netket/netket | 0d534e54ecbf25b677ea72af6b85947979420652 | netket/operator/_pauli_strings.py | python | PauliStrings.__init__ | (
self,
hilbert: AbstractHilbert,
operators: List[str] = None,
weights: List[Union[float, complex]] = None,
*,
cutoff: float = 1.0e-10,
dtype: DType = complex,
) | Constructs a new ``PauliStrings`` operator given a set of Pauli operators.
This class has two possible forms for initialization: ``PauliStrings(hilbert, operators, ...)`` or ``PauliStrings(operators, ...)``.
When no hilbert argument is passed, the hilbert defaults to Qubit, where the number of qubits i... | Constructs a new ``PauliStrings`` operator given a set of Pauli operators.
This class has two possible forms for initialization: ``PauliStrings(hilbert, operators, ...)`` or ``PauliStrings(operators, ...)``.
When no hilbert argument is passed, the hilbert defaults to Qubit, where the number of qubits i... | [
"Constructs",
"a",
"new",
"PauliStrings",
"operator",
"given",
"a",
"set",
"of",
"Pauli",
"operators",
".",
"This",
"class",
"has",
"two",
"possible",
"forms",
"for",
"initialization",
":",
"PauliStrings",
"(",
"hilbert",
"operators",
"...",
")",
"or",
"PauliS... | def __init__(
self,
hilbert: AbstractHilbert,
operators: List[str] = None,
weights: List[Union[float, complex]] = None,
*,
cutoff: float = 1.0e-10,
dtype: DType = complex,
):
"""
Constructs a new ``PauliStrings`` operator given a set of Pauli o... | [
"def",
"__init__",
"(",
"self",
",",
"hilbert",
":",
"AbstractHilbert",
",",
"operators",
":",
"List",
"[",
"str",
"]",
"=",
"None",
",",
"weights",
":",
"List",
"[",
"Union",
"[",
"float",
",",
"complex",
"]",
"]",
"=",
"None",
",",
"*",
",",
"cut... | https://github.com/netket/netket/blob/0d534e54ecbf25b677ea72af6b85947979420652/netket/operator/_pauli_strings.py#L33-L122 | ||
Xilinx/Vitis-AI | fc74d404563d9951b57245443c73bef389f3657f | tools/Vitis-AI-Quantizer/vai_q_tensorflow1.x/tensorflow/python/training/saver.py | python | BaseSaverBuilder.sharded_filename | (self, filename_tensor, shard, num_shards) | return gen_io_ops.sharded_filename(filename_tensor, shard, num_shards) | Append sharding information to a filename.
Args:
filename_tensor: A string tensor.
shard: Integer. The shard for the filename.
num_shards: An int Tensor for the number of shards.
Returns:
A string tensor. | Append sharding information to a filename. | [
"Append",
"sharding",
"information",
"to",
"a",
"filename",
"."
] | def sharded_filename(self, filename_tensor, shard, num_shards):
"""Append sharding information to a filename.
Args:
filename_tensor: A string tensor.
shard: Integer. The shard for the filename.
num_shards: An int Tensor for the number of shards.
Returns:
A string tensor.
"""
... | [
"def",
"sharded_filename",
"(",
"self",
",",
"filename_tensor",
",",
"shard",
",",
"num_shards",
")",
":",
"return",
"gen_io_ops",
".",
"sharded_filename",
"(",
"filename_tensor",
",",
"shard",
",",
"num_shards",
")"
] | https://github.com/Xilinx/Vitis-AI/blob/fc74d404563d9951b57245443c73bef389f3657f/tools/Vitis-AI-Quantizer/vai_q_tensorflow1.x/tensorflow/python/training/saver.py#L183-L194 | |
aws/lumberyard | f85344403c1c2e77ec8c75deb2c116e97b713217 | dev/Tools/Python/3.7.10/mac/Python.framework/Versions/3.7/lib/python3.7/threading.py | python | _RLock.acquire | (self, blocking=True, timeout=-1) | return rc | Acquire a lock, blocking or non-blocking.
When invoked without arguments: if this thread already owns the lock,
increment the recursion level by one, and return immediately. Otherwise,
if another thread owns the lock, block until the lock is unlocked. Once
the lock is unlocked (not owne... | Acquire a lock, blocking or non-blocking. | [
"Acquire",
"a",
"lock",
"blocking",
"or",
"non",
"-",
"blocking",
"."
] | def acquire(self, blocking=True, timeout=-1):
"""Acquire a lock, blocking or non-blocking.
When invoked without arguments: if this thread already owns the lock,
increment the recursion level by one, and return immediately. Otherwise,
if another thread owns the lock, block until the lock... | [
"def",
"acquire",
"(",
"self",
",",
"blocking",
"=",
"True",
",",
"timeout",
"=",
"-",
"1",
")",
":",
"me",
"=",
"get_ident",
"(",
")",
"if",
"self",
".",
"_owner",
"==",
"me",
":",
"self",
".",
"_count",
"+=",
"1",
"return",
"1",
"rc",
"=",
"s... | https://github.com/aws/lumberyard/blob/f85344403c1c2e77ec8c75deb2c116e97b713217/dev/Tools/Python/3.7.10/mac/Python.framework/Versions/3.7/lib/python3.7/threading.py#L118-L152 | |
wxWidgets/wxPython-Classic | 19571e1ae65f1ac445f5491474121998c97a1bf0 | src/osx_cocoa/dataview.py | python | DataViewTreeCtrl.IsContainer | (*args, **kwargs) | return _dataview.DataViewTreeCtrl_IsContainer(*args, **kwargs) | IsContainer(self, DataViewItem item) -> bool | IsContainer(self, DataViewItem item) -> bool | [
"IsContainer",
"(",
"self",
"DataViewItem",
"item",
")",
"-",
">",
"bool"
] | def IsContainer(*args, **kwargs):
"""IsContainer(self, DataViewItem item) -> bool"""
return _dataview.DataViewTreeCtrl_IsContainer(*args, **kwargs) | [
"def",
"IsContainer",
"(",
"*",
"args",
",",
"*",
"*",
"kwargs",
")",
":",
"return",
"_dataview",
".",
"DataViewTreeCtrl_IsContainer",
"(",
"*",
"args",
",",
"*",
"*",
"kwargs",
")"
] | https://github.com/wxWidgets/wxPython-Classic/blob/19571e1ae65f1ac445f5491474121998c97a1bf0/src/osx_cocoa/dataview.py#L2485-L2487 | |
neoml-lib/neoml | a0d370fba05269a1b2258cef126f77bbd2054a3e | NeoML/Python/neoml/Dnn/Accuracy.py | python | ConfusionMatrix.reset | (self, reset) | Specifies if the calculations should be reset on each run. | Specifies if the calculations should be reset on each run. | [
"Specifies",
"if",
"the",
"calculations",
"should",
"be",
"reset",
"on",
"each",
"run",
"."
] | def reset(self, reset):
"""Specifies if the calculations should be reset on each run.
"""
self._internal.set_reset(bool(reset)) | [
"def",
"reset",
"(",
"self",
",",
"reset",
")",
":",
"self",
".",
"_internal",
".",
"set_reset",
"(",
"bool",
"(",
"reset",
")",
")"
] | https://github.com/neoml-lib/neoml/blob/a0d370fba05269a1b2258cef126f77bbd2054a3e/NeoML/Python/neoml/Dnn/Accuracy.py#L140-L143 | ||
catboost/catboost | 167f64f237114a4d10b2b4ee42adb4569137debe | contrib/python/scipy/py2/scipy/stats/_binned_statistic.py | python | binned_statistic_dd | (sample, values, statistic='mean',
bins=10, range=None, expand_binnumbers=False) | return BinnedStatisticddResult(result, edges, binnumbers) | Compute a multidimensional binned statistic for a set of data.
This is a generalization of a histogramdd function. A histogram divides
the space into bins, and returns the count of the number of points in
each bin. This function allows the computation of the sum, mean, median,
or other statistic of t... | Compute a multidimensional binned statistic for a set of data. | [
"Compute",
"a",
"multidimensional",
"binned",
"statistic",
"for",
"a",
"set",
"of",
"data",
"."
] | def binned_statistic_dd(sample, values, statistic='mean',
bins=10, range=None, expand_binnumbers=False):
"""
Compute a multidimensional binned statistic for a set of data.
This is a generalization of a histogramdd function. A histogram divides
the space into bins, and returns t... | [
"def",
"binned_statistic_dd",
"(",
"sample",
",",
"values",
",",
"statistic",
"=",
"'mean'",
",",
"bins",
"=",
"10",
",",
"range",
"=",
"None",
",",
"expand_binnumbers",
"=",
"False",
")",
":",
"known_stats",
"=",
"[",
"'mean'",
",",
"'median'",
",",
"'c... | https://github.com/catboost/catboost/blob/167f64f237114a4d10b2b4ee42adb4569137debe/contrib/python/scipy/py2/scipy/stats/_binned_statistic.py#L354-L619 | |
wlanjie/AndroidFFmpeg | 7baf9122f4b8e1c74e7baf4be5c422c7a5ba5aaf | tools/fdk-aac-build/armeabi/toolchain/lib/python2.7/trace.py | python | find_lines_from_code | (code, strs) | return linenos | Return dict where keys are lines in the line number table. | Return dict where keys are lines in the line number table. | [
"Return",
"dict",
"where",
"keys",
"are",
"lines",
"in",
"the",
"line",
"number",
"table",
"."
] | def find_lines_from_code(code, strs):
"""Return dict where keys are lines in the line number table."""
linenos = {}
for _, lineno in dis.findlinestarts(code):
if lineno not in strs:
linenos[lineno] = 1
return linenos | [
"def",
"find_lines_from_code",
"(",
"code",
",",
"strs",
")",
":",
"linenos",
"=",
"{",
"}",
"for",
"_",
",",
"lineno",
"in",
"dis",
".",
"findlinestarts",
"(",
"code",
")",
":",
"if",
"lineno",
"not",
"in",
"strs",
":",
"linenos",
"[",
"lineno",
"]"... | https://github.com/wlanjie/AndroidFFmpeg/blob/7baf9122f4b8e1c74e7baf4be5c422c7a5ba5aaf/tools/fdk-aac-build/armeabi/toolchain/lib/python2.7/trace.py#L393-L401 | |
hughperkins/tf-coriander | 970d3df6c11400ad68405f22b0c42a52374e94ca | tensorflow/python/framework/function.py | python | Defun.__init__ | (self, *input_types, **kwargs) | Create a `Defun` decorator.
Args:
*input_types: A list of `tf.DType`
**kwargs: Optional keyword arguments, including
func_name - (optional). A python string, the name to use to
declare this `Function` in the graph.
grad_func - (optional). A function implementing the grad... | Create a `Defun` decorator. | [
"Create",
"a",
"Defun",
"decorator",
"."
] | def __init__(self, *input_types, **kwargs):
"""Create a `Defun` decorator.
Args:
*input_types: A list of `tf.DType`
**kwargs: Optional keyword arguments, including
func_name - (optional). A python string, the name to use to
declare this `Function` in the graph.
grad_f... | [
"def",
"__init__",
"(",
"self",
",",
"*",
"input_types",
",",
"*",
"*",
"kwargs",
")",
":",
"self",
".",
"_input_types",
"=",
"input_types",
"self",
".",
"_func_name",
"=",
"kwargs",
".",
"pop",
"(",
"\"func_name\"",
",",
"None",
")",
"self",
".",
"_gr... | https://github.com/hughperkins/tf-coriander/blob/970d3df6c11400ad68405f22b0c42a52374e94ca/tensorflow/python/framework/function.py#L715-L743 | ||
catboost/catboost | 167f64f237114a4d10b2b4ee42adb4569137debe | contrib/python/scipy/scipy/sparse/compressed.py | python | _cs_matrix._scalar_binopt | (self, other, op) | return res | Scalar version of self._binopt, for cases in which no new nonzeros
are added. Produces a new spmatrix in canonical form. | Scalar version of self._binopt, for cases in which no new nonzeros
are added. Produces a new spmatrix in canonical form. | [
"Scalar",
"version",
"of",
"self",
".",
"_binopt",
"for",
"cases",
"in",
"which",
"no",
"new",
"nonzeros",
"are",
"added",
".",
"Produces",
"a",
"new",
"spmatrix",
"in",
"canonical",
"form",
"."
] | def _scalar_binopt(self, other, op):
"""Scalar version of self._binopt, for cases in which no new nonzeros
are added. Produces a new spmatrix in canonical form.
"""
self.sum_duplicates()
res = self._with_data(op(self.data, other), copy=True)
res.eliminate_zeros()
... | [
"def",
"_scalar_binopt",
"(",
"self",
",",
"other",
",",
"op",
")",
":",
"self",
".",
"sum_duplicates",
"(",
")",
"res",
"=",
"self",
".",
"_with_data",
"(",
"op",
"(",
"self",
".",
"data",
",",
"other",
")",
",",
"copy",
"=",
"True",
")",
"res",
... | https://github.com/catboost/catboost/blob/167f64f237114a4d10b2b4ee42adb4569137debe/contrib/python/scipy/scipy/sparse/compressed.py#L196-L203 | |
pmq20/node-packer | 12c46c6e44fbc14d9ee645ebd17d5296b324f7e0 | lts/deps/npm/node_modules/node-gyp/gyp/pylib/gyp/MSVSUtil.py | python | ShardTargets | (target_list, target_dicts) | return (new_target_list, new_target_dicts) | Shard some targets apart to work around the linkers limits.
Arguments:
target_list: List of target pairs: 'base/base.gyp:base'.
target_dicts: Dict of target properties keyed on target pair.
Returns:
Tuple of the new sharded versions of the inputs. | Shard some targets apart to work around the linkers limits. | [
"Shard",
"some",
"targets",
"apart",
"to",
"work",
"around",
"the",
"linkers",
"limits",
"."
] | def ShardTargets(target_list, target_dicts):
"""Shard some targets apart to work around the linkers limits.
Arguments:
target_list: List of target pairs: 'base/base.gyp:base'.
target_dicts: Dict of target properties keyed on target pair.
Returns:
Tuple of the new sharded versions of the inputs.
"""... | [
"def",
"ShardTargets",
"(",
"target_list",
",",
"target_dicts",
")",
":",
"# Gather the targets to shard, and how many pieces.",
"targets_to_shard",
"=",
"{",
"}",
"for",
"t",
"in",
"target_dicts",
":",
"shards",
"=",
"int",
"(",
"target_dicts",
"[",
"t",
"]",
"."... | https://github.com/pmq20/node-packer/blob/12c46c6e44fbc14d9ee645ebd17d5296b324f7e0/lts/deps/npm/node_modules/node-gyp/gyp/pylib/gyp/MSVSUtil.py#L73-L125 | |
wyrover/book-code | 7f4883d9030d553bc6bcfa3da685e34789839900 | 3rdparty/protobuf/python/google/protobuf/descriptor.py | python | FileDescriptor.__init__ | (self, name, package, options=None, serialized_pb=None,
dependencies=None, public_dependencies=None,
syntax=None, pool=None) | Constructor. | Constructor. | [
"Constructor",
"."
] | def __init__(self, name, package, options=None, serialized_pb=None,
dependencies=None, public_dependencies=None,
syntax=None, pool=None):
"""Constructor."""
super(FileDescriptor, self).__init__(options, 'FileOptions')
if pool is None:
from google.protobuf import descript... | [
"def",
"__init__",
"(",
"self",
",",
"name",
",",
"package",
",",
"options",
"=",
"None",
",",
"serialized_pb",
"=",
"None",
",",
"dependencies",
"=",
"None",
",",
"public_dependencies",
"=",
"None",
",",
"syntax",
"=",
"None",
",",
"pool",
"=",
"None",
... | https://github.com/wyrover/book-code/blob/7f4883d9030d553bc6bcfa3da685e34789839900/3rdparty/protobuf/python/google/protobuf/descriptor.py#L831-L855 | ||
apache/mesos | 97d9a4063332aae3825d78de71611657e05cf5e2 | support/apply-reviews.py | python | review_api_url | (review_id) | return '{base}/{review}/'.format(
base=REVIEWBOARD_API_URL,
review=review_id) | Returns a Review Board API URL given a review ID. | Returns a Review Board API URL given a review ID. | [
"Returns",
"a",
"Review",
"Board",
"API",
"URL",
"given",
"a",
"review",
"ID",
"."
] | def review_api_url(review_id):
"""Returns a Review Board API URL given a review ID."""
# Reviewboard REST API expects '/' at the end of the URL.
return '{base}/{review}/'.format(
base=REVIEWBOARD_API_URL,
review=review_id) | [
"def",
"review_api_url",
"(",
"review_id",
")",
":",
"# Reviewboard REST API expects '/' at the end of the URL.",
"return",
"'{base}/{review}/'",
".",
"format",
"(",
"base",
"=",
"REVIEWBOARD_API_URL",
",",
"review",
"=",
"review_id",
")"
] | https://github.com/apache/mesos/blob/97d9a4063332aae3825d78de71611657e05cf5e2/support/apply-reviews.py#L51-L56 | |
domino-team/openwrt-cc | 8b181297c34d14d3ca521cc9f31430d561dbc688 | package/gli-pub/openwrt-node-packages-master/node/node-v6.9.1/deps/v8_inspector/third_party/jinja2/jinja2/debug.py | python | translate_syntax_error | (error, source=None) | return fake_exc_info(exc_info, filename, error.lineno) | Rewrites a syntax error to please traceback systems. | Rewrites a syntax error to please traceback systems. | [
"Rewrites",
"a",
"syntax",
"error",
"to",
"please",
"traceback",
"systems",
"."
] | def translate_syntax_error(error, source=None):
"""Rewrites a syntax error to please traceback systems."""
error.source = source
error.translated = True
exc_info = (error.__class__, error, None)
filename = error.filename
if filename is None:
filename = '<unknown>'
return fake_exc_inf... | [
"def",
"translate_syntax_error",
"(",
"error",
",",
"source",
"=",
"None",
")",
":",
"error",
".",
"source",
"=",
"source",
"error",
".",
"translated",
"=",
"True",
"exc_info",
"=",
"(",
"error",
".",
"__class__",
",",
"error",
",",
"None",
")",
"filenam... | https://github.com/domino-team/openwrt-cc/blob/8b181297c34d14d3ca521cc9f31430d561dbc688/package/gli-pub/openwrt-node-packages-master/node/node-v6.9.1/deps/v8_inspector/third_party/jinja2/jinja2/debug.py#L143-L151 | |
ideawu/ssdb | f229ba277c7f7d0ca5a441c0c6fb3d1209af68e4 | deps/cpy/antlr3/tree.py | python | TreeNodeStream.get | (self, i) | Get a tree node at an absolute index i; 0..n-1.
If you don't want to buffer up nodes, then this method makes no
sense for you. | Get a tree node at an absolute index i; 0..n-1.
If you don't want to buffer up nodes, then this method makes no
sense for you. | [
"Get",
"a",
"tree",
"node",
"at",
"an",
"absolute",
"index",
"i",
";",
"0",
"..",
"n",
"-",
"1",
".",
"If",
"you",
"don",
"t",
"want",
"to",
"buffer",
"up",
"nodes",
"then",
"this",
"method",
"makes",
"no",
"sense",
"for",
"you",
"."
] | def get(self, i):
"""Get a tree node at an absolute index i; 0..n-1.
If you don't want to buffer up nodes, then this method makes no
sense for you.
"""
raise NotImplementedError | [
"def",
"get",
"(",
"self",
",",
"i",
")",
":",
"raise",
"NotImplementedError"
] | https://github.com/ideawu/ssdb/blob/f229ba277c7f7d0ca5a441c0c6fb3d1209af68e4/deps/cpy/antlr3/tree.py#L1558-L1564 | ||
Ewenwan/MVision | 97b394dfa48cb21c82cd003b1a952745e413a17f | CNN/MobileNet/MobileNet_v2_ssd_caffe/ssd_detect.py | python | main | (args) | main | main | [
"main"
] | def main(args):
'''main '''
# 定义一个检测器类
detection = CaffeDetection(args.gpu_id,
args.model_def, args.model_weights,
args.image_resize, args.labelmap_file)
# 检测并获取结果
result = detection.detect(args.image_file)
# 打印结果
print result
... | [
"def",
"main",
"(",
"args",
")",
":",
"# 定义一个检测器类",
"detection",
"=",
"CaffeDetection",
"(",
"args",
".",
"gpu_id",
",",
"args",
".",
"model_def",
",",
"args",
".",
"model_weights",
",",
"args",
".",
"image_resize",
",",
"args",
".",
"labelmap_file",
")",
... | https://github.com/Ewenwan/MVision/blob/97b394dfa48cb21c82cd003b1a952745e413a17f/CNN/MobileNet/MobileNet_v2_ssd_caffe/ssd_detect.py#L122-L149 | ||
adobe/chromium | cfe5bf0b51b1f6b9fe239c2a3c2f2364da9967d7 | third_party/closure_linter/closure_linter/ecmametadatapass.py | python | ParseError.__init__ | (self, token, message=None) | Initialize a parse error at the given token with an optional message.
Args:
token: The token where the parse error occurred.
message: A message describing the parse error. | Initialize a parse error at the given token with an optional message. | [
"Initialize",
"a",
"parse",
"error",
"at",
"the",
"given",
"token",
"with",
"an",
"optional",
"message",
"."
] | def __init__(self, token, message=None):
"""Initialize a parse error at the given token with an optional message.
Args:
token: The token where the parse error occurred.
message: A message describing the parse error.
"""
Exception.__init__(self, message)
self.token = token | [
"def",
"__init__",
"(",
"self",
",",
"token",
",",
"message",
"=",
"None",
")",
":",
"Exception",
".",
"__init__",
"(",
"self",
",",
"message",
")",
"self",
".",
"token",
"=",
"token"
] | https://github.com/adobe/chromium/blob/cfe5bf0b51b1f6b9fe239c2a3c2f2364da9967d7/third_party/closure_linter/closure_linter/ecmametadatapass.py#L35-L43 | ||
weolar/miniblink49 | 1c4678db0594a4abde23d3ebbcc7cd13c3170777 | third_party/jinja2/optimizer.py | python | Optimizer.fold | (self, node) | Do constant folding. | Do constant folding. | [
"Do",
"constant",
"folding",
"."
] | def fold(self, node):
"""Do constant folding."""
node = self.generic_visit(node)
try:
return nodes.Const.from_untrusted(node.as_const(),
lineno=node.lineno,
environment=self.environment)
... | [
"def",
"fold",
"(",
"self",
",",
"node",
")",
":",
"node",
"=",
"self",
".",
"generic_visit",
"(",
"node",
")",
"try",
":",
"return",
"nodes",
".",
"Const",
".",
"from_untrusted",
"(",
"node",
".",
"as_const",
"(",
")",
",",
"lineno",
"=",
"node",
... | https://github.com/weolar/miniblink49/blob/1c4678db0594a4abde23d3ebbcc7cd13c3170777/third_party/jinja2/optimizer.py#L54-L62 | ||
wxWidgets/wxPython-Classic | 19571e1ae65f1ac445f5491474121998c97a1bf0 | src/gtk/dataview.py | python | DataViewIconText.GetIcon | (*args, **kwargs) | return _dataview.DataViewIconText_GetIcon(*args, **kwargs) | GetIcon(self) -> Icon | GetIcon(self) -> Icon | [
"GetIcon",
"(",
"self",
")",
"-",
">",
"Icon"
] | def GetIcon(*args, **kwargs):
"""GetIcon(self) -> Icon"""
return _dataview.DataViewIconText_GetIcon(*args, **kwargs) | [
"def",
"GetIcon",
"(",
"*",
"args",
",",
"*",
"*",
"kwargs",
")",
":",
"return",
"_dataview",
".",
"DataViewIconText_GetIcon",
"(",
"*",
"args",
",",
"*",
"*",
"kwargs",
")"
] | https://github.com/wxWidgets/wxPython-Classic/blob/19571e1ae65f1ac445f5491474121998c97a1bf0/src/gtk/dataview.py#L1315-L1317 | |
catboost/catboost | 167f64f237114a4d10b2b4ee42adb4569137debe | contrib/python/traitlets/py3/traitlets/config/application.py | python | Application.print_description | (self) | Print the application description. | Print the application description. | [
"Print",
"the",
"application",
"description",
"."
] | def print_description(self):
"""Print the application description."""
print('\n'.join(self.emit_description())) | [
"def",
"print_description",
"(",
"self",
")",
":",
"print",
"(",
"'\\n'",
".",
"join",
"(",
"self",
".",
"emit_description",
"(",
")",
")",
")"
] | https://github.com/catboost/catboost/blob/167f64f237114a4d10b2b4ee42adb4569137debe/contrib/python/traitlets/py3/traitlets/config/application.py#L552-L554 | ||
aws/lumberyard | f85344403c1c2e77ec8c75deb2c116e97b713217 | dev/Tools/Python/3.7.10/windows/Lib/mailbox.py | python | _mboxMMDFMessage.remove_flag | (self, flag) | Unset the given string flag(s) without changing others. | Unset the given string flag(s) without changing others. | [
"Unset",
"the",
"given",
"string",
"flag",
"(",
"s",
")",
"without",
"changing",
"others",
"."
] | def remove_flag(self, flag):
"""Unset the given string flag(s) without changing others."""
if 'Status' in self or 'X-Status' in self:
self.set_flags(''.join(set(self.get_flags()) - set(flag))) | [
"def",
"remove_flag",
"(",
"self",
",",
"flag",
")",
":",
"if",
"'Status'",
"in",
"self",
"or",
"'X-Status'",
"in",
"self",
":",
"self",
".",
"set_flags",
"(",
"''",
".",
"join",
"(",
"set",
"(",
"self",
".",
"get_flags",
"(",
")",
")",
"-",
"set",... | https://github.com/aws/lumberyard/blob/f85344403c1c2e77ec8c75deb2c116e97b713217/dev/Tools/Python/3.7.10/windows/Lib/mailbox.py#L1688-L1691 | ||
miyosuda/TensorFlowAndroidMNIST | 7b5a4603d2780a8a2834575706e9001977524007 | jni-build/jni/include/tensorflow/python/framework/function.py | python | _add_output_list | (op, start, limit, dtype_lst, func) | return ret_name | Adds a _ArrayToList node in the func for op.outputs[start:limit]. | Adds a _ArrayToList node in the func for op.outputs[start:limit]. | [
"Adds",
"a",
"_ArrayToList",
"node",
"in",
"the",
"func",
"for",
"op",
".",
"outputs",
"[",
"start",
":",
"limit",
"]",
"."
] | def _add_output_list(op, start, limit, dtype_lst, func):
"""Adds a _ArrayToList node in the func for op.outputs[start:limit]."""
ret_name = op.name + "_Lst_" + str(start) + "_" + str(limit)
num = limit - start
assert len(dtype_lst) == num
# Adds an identity node for each element in the array N*T so that
# u... | [
"def",
"_add_output_list",
"(",
"op",
",",
"start",
",",
"limit",
",",
"dtype_lst",
",",
"func",
")",
":",
"ret_name",
"=",
"op",
".",
"name",
"+",
"\"_Lst_\"",
"+",
"str",
"(",
"start",
")",
"+",
"\"_\"",
"+",
"str",
"(",
"limit",
")",
"num",
"=",... | https://github.com/miyosuda/TensorFlowAndroidMNIST/blob/7b5a4603d2780a8a2834575706e9001977524007/jni-build/jni/include/tensorflow/python/framework/function.py#L99-L114 | |
aws/lumberyard | f85344403c1c2e77ec8c75deb2c116e97b713217 | dev/Tools/Python/3.7.10/linux_x64/lib/python3.7/enum.py | python | Flag._generate_next_value_ | (name, start, count, last_values) | return 2 ** (high_bit+1) | Generate the next value when not given.
name: the name of the member
start: the initial start value or None
count: the number of existing members
last_value: the last value assigned or None | Generate the next value when not given. | [
"Generate",
"the",
"next",
"value",
"when",
"not",
"given",
"."
] | def _generate_next_value_(name, start, count, last_values):
"""
Generate the next value when not given.
name: the name of the member
start: the initial start value or None
count: the number of existing members
last_value: the last value assigned or None
"""
... | [
"def",
"_generate_next_value_",
"(",
"name",
",",
"start",
",",
"count",
",",
"last_values",
")",
":",
"if",
"not",
"count",
":",
"return",
"start",
"if",
"start",
"is",
"not",
"None",
"else",
"1",
"for",
"last_value",
"in",
"reversed",
"(",
"last_values",... | https://github.com/aws/lumberyard/blob/f85344403c1c2e77ec8c75deb2c116e97b713217/dev/Tools/Python/3.7.10/linux_x64/lib/python3.7/enum.py#L685-L702 | |
idaholab/moose | 9eeebc65e098b4c30f8205fb41591fd5b61eb6ff | python/MooseDocs/common/get_content.py | python | get_content | (items, in_ext) | return list(nodes.values()) | Create a tree of files for processing.
Inputs:
items: [list[dict(),...] A list of dict items, each dict entry must contain the 'root_dir'
and 'content' fields that are passed to the doc_import function.
in_ext[tuple]: Set of extensions to be converted (e.g., ('.md', )).
out_... | Create a tree of files for processing. | [
"Create",
"a",
"tree",
"of",
"files",
"for",
"processing",
"."
] | def get_content(items, in_ext):
"""
Create a tree of files for processing.
Inputs:
items: [list[dict(),...] A list of dict items, each dict entry must contain the 'root_dir'
and 'content' fields that are passed to the doc_import function.
in_ext[tuple]: Set of extensions to ... | [
"def",
"get_content",
"(",
"items",
",",
"in_ext",
")",
":",
"if",
"not",
"isinstance",
"(",
"items",
",",
"list",
")",
"or",
"any",
"(",
"not",
"isinstance",
"(",
"x",
",",
"dict",
")",
"for",
"x",
"in",
"items",
")",
":",
"LOG",
".",
"error",
"... | https://github.com/idaholab/moose/blob/9eeebc65e098b4c30f8205fb41591fd5b61eb6ff/python/MooseDocs/common/get_content.py#L169-L212 | |
root-project/root | fcd3583bb14852bf2e8cd2415717cbaac0e75896 | interpreter/llvm/src/tools/clang/bindings/python/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",
")",
"for",
"f",
"in",
"functionList",
":",
"register",
"(",
"f... | https://github.com/root-project/root/blob/fcd3583bb14852bf2e8cd2415717cbaac0e75896/interpreter/llvm/src/tools/clang/bindings/python/clang/cindex.py#L4083-L4094 | ||
mantidproject/mantid | 03deeb89254ec4289edb8771e0188c2090a02f32 | qt/python/mantidqtinterfaces/mantidqtinterfaces/reduction_gui/instruments/interface.py | python | InstrumentInterface.reduce | (self) | Pass the interface data to the scripter and reduce | Pass the interface data to the scripter and reduce | [
"Pass",
"the",
"interface",
"data",
"to",
"the",
"scripter",
"and",
"reduce"
] | def reduce(self):
"""
Pass the interface data to the scripter and reduce
"""
try:
self.scripter.update()
except:
print("Error in the user interface\n %s" % str(traceback.format_exc()))
self.scripter.push_state()
return
... | [
"def",
"reduce",
"(",
"self",
")",
":",
"try",
":",
"self",
".",
"scripter",
".",
"update",
"(",
")",
"except",
":",
"print",
"(",
"\"Error in the user interface\\n %s\"",
"%",
"str",
"(",
"traceback",
".",
"format_exc",
"(",
")",
")",
")",
"self",
".",... | https://github.com/mantidproject/mantid/blob/03deeb89254ec4289edb8771e0188c2090a02f32/qt/python/mantidqtinterfaces/mantidqtinterfaces/reduction_gui/instruments/interface.py#L166-L210 | ||
benoitsteiner/tensorflow-opencl | cb7cb40a57fde5cfd4731bc551e82a1e2fef43a5 | tensorflow/python/training/monitored_session.py | python | _MonitoredSession.run_step_fn | (self, step_fn) | Run ops using a step function.
Args:
step_fn: A function or a method with a single argument of type
`StepContext`. The function may use methods of the argument to
perform computations with access to a raw session.
The returned value of the `step_fn` will be returned from `run_step_f... | Run ops using a step function. | [
"Run",
"ops",
"using",
"a",
"step",
"function",
"."
] | def run_step_fn(self, step_fn):
"""Run ops using a step function.
Args:
step_fn: A function or a method with a single argument of type
`StepContext`. The function may use methods of the argument to
perform computations with access to a raw session.
The returned value of the `ste... | [
"def",
"run_step_fn",
"(",
"self",
",",
"step_fn",
")",
":",
"step_fn_arguments",
"=",
"util",
".",
"fn_args",
"(",
"step_fn",
")",
"if",
"step_fn_arguments",
"!=",
"(",
"'step_context'",
",",
")",
"and",
"step_fn_arguments",
"!=",
"(",
"'self'",
",",
"'step... | https://github.com/benoitsteiner/tensorflow-opencl/blob/cb7cb40a57fde5cfd4731bc551e82a1e2fef43a5/tensorflow/python/training/monitored_session.py#L525-L581 | ||
ricardoquesada/Spidermonkey | 4a75ea2543408bd1b2c515aa95901523eeef7858 | python/mozbuild/mozpack/manifests.py | python | InstallManifest.write | (self, path=None, fileobj=None) | Serialize this manifest to a file or file object.
If path is specified, that file will be written to. If fileobj is specified,
the serialized content will be written to that file object.
It is an error if both are specified. | Serialize this manifest to a file or file object. | [
"Serialize",
"this",
"manifest",
"to",
"a",
"file",
"or",
"file",
"object",
"."
] | def write(self, path=None, fileobj=None):
"""Serialize this manifest to a file or file object.
If path is specified, that file will be written to. If fileobj is specified,
the serialized content will be written to that file object.
It is an error if both are specified.
"""
... | [
"def",
"write",
"(",
"self",
",",
"path",
"=",
"None",
",",
"fileobj",
"=",
"None",
")",
":",
"with",
"_auto_fileobj",
"(",
"path",
",",
"fileobj",
",",
"'wb'",
")",
"as",
"fh",
":",
"fh",
".",
"write",
"(",
"'%d\\n'",
"%",
"self",
".",
"CURRENT_VE... | https://github.com/ricardoquesada/Spidermonkey/blob/4a75ea2543408bd1b2c515aa95901523eeef7858/python/mozbuild/mozpack/manifests.py#L212-L229 | ||
LisaAnne/lisa-caffe-public | 49b8643ddef23a4f6120017968de30c45e693f59 | python/caffe/io.py | python | Transformer.set_transpose | (self, in_, order) | Set the input channel order for e.g. RGB to BGR conversion
as needed for the reference ImageNet model.
Take
in_: which input to assign this channel order
order: the order to transpose the dimensions | Set the input channel order for e.g. RGB to BGR conversion
as needed for the reference ImageNet model. | [
"Set",
"the",
"input",
"channel",
"order",
"for",
"e",
".",
"g",
".",
"RGB",
"to",
"BGR",
"conversion",
"as",
"needed",
"for",
"the",
"reference",
"ImageNet",
"model",
"."
] | def set_transpose(self, in_, order):
"""
Set the input channel order for e.g. RGB to BGR conversion
as needed for the reference ImageNet model.
Take
in_: which input to assign this channel order
order: the order to transpose the dimensions
"""
self.__chec... | [
"def",
"set_transpose",
"(",
"self",
",",
"in_",
",",
"order",
")",
":",
"self",
".",
"__check_input",
"(",
"in_",
")",
"if",
"len",
"(",
"order",
")",
"!=",
"len",
"(",
"self",
".",
"inputs",
"[",
"in_",
"]",
")",
"-",
"1",
":",
"raise",
"Except... | https://github.com/LisaAnne/lisa-caffe-public/blob/49b8643ddef23a4f6120017968de30c45e693f59/python/caffe/io.py#L183-L196 | ||
catboost/catboost | 167f64f237114a4d10b2b4ee42adb4569137debe | contrib/python/traitlets/py2/traitlets/traitlets.py | python | MetaHasDescriptors.__new__ | (mcls, name, bases, classdict) | return super(MetaHasDescriptors, mcls).__new__(mcls, name, bases, classdict) | Create the HasDescriptors class. | Create the HasDescriptors class. | [
"Create",
"the",
"HasDescriptors",
"class",
"."
] | def __new__(mcls, name, bases, classdict):
"""Create the HasDescriptors class."""
for k, v in classdict.items():
# ----------------------------------------------------------------
# Support of deprecated behavior allowing for TraitType types
# to be used instead of Tr... | [
"def",
"__new__",
"(",
"mcls",
",",
"name",
",",
"bases",
",",
"classdict",
")",
":",
"for",
"k",
",",
"v",
"in",
"classdict",
".",
"items",
"(",
")",
":",
"# ----------------------------------------------------------------",
"# Support of deprecated behavior allowing... | https://github.com/catboost/catboost/blob/167f64f237114a4d10b2b4ee42adb4569137debe/contrib/python/traitlets/py2/traitlets/traitlets.py#L722-L735 | |
krishauser/Klampt | 972cc83ea5befac3f653c1ba20f80155768ad519 | Python/python2_version/klampt/math/so3.py | python | quaternion | (R) | Given a Klamp't rotation representation, produces the corresponding
unit quaternion (w,x,y,z). | Given a Klamp't rotation representation, produces the corresponding
unit quaternion (w,x,y,z). | [
"Given",
"a",
"Klamp",
"t",
"rotation",
"representation",
"produces",
"the",
"corresponding",
"unit",
"quaternion",
"(",
"w",
"x",
"y",
"z",
")",
"."
] | def quaternion(R):
"""Given a Klamp't rotation representation, produces the corresponding
unit quaternion (w,x,y,z)."""
tr = trace(R) + 1.0;
a11,a21,a31,a12,a22,a32,a13,a23,a33 = R
#If the trace is nonzero, it's a nondegenerate rotation
if tr > 1e-5:
s = math.sqrt(tr)
w = s * 0.... | [
"def",
"quaternion",
"(",
"R",
")",
":",
"tr",
"=",
"trace",
"(",
"R",
")",
"+",
"1.0",
"a11",
",",
"a21",
",",
"a31",
",",
"a12",
",",
"a22",
",",
"a32",
",",
"a13",
",",
"a23",
",",
"a33",
"=",
"R",
"#If the trace is nonzero, it's a nondegenerate r... | https://github.com/krishauser/Klampt/blob/972cc83ea5befac3f653c1ba20f80155768ad519/Python/python2_version/klampt/math/so3.py#L226-L264 | ||
edvardHua/PoseEstimationForMobile | e31fb850c92ba7e220f861e9484b9cd1bdd5696f | training/docker/cocoapi/PythonAPI/pycocotools/coco.py | python | COCO.info | (self) | Print information about the annotation file.
:return: | Print information about the annotation file.
:return: | [
"Print",
"information",
"about",
"the",
"annotation",
"file",
".",
":",
"return",
":"
] | def info(self):
"""
Print information about the annotation file.
:return:
"""
for key, value in self.dataset['info'].items():
print('{}: {}'.format(key, value)) | [
"def",
"info",
"(",
"self",
")",
":",
"for",
"key",
",",
"value",
"in",
"self",
".",
"dataset",
"[",
"'info'",
"]",
".",
"items",
"(",
")",
":",
"print",
"(",
"'{}: {}'",
".",
"format",
"(",
"key",
",",
"value",
")",
")"
] | https://github.com/edvardHua/PoseEstimationForMobile/blob/e31fb850c92ba7e220f861e9484b9cd1bdd5696f/training/docker/cocoapi/PythonAPI/pycocotools/coco.py#L121-L127 | ||
mantidproject/mantid | 03deeb89254ec4289edb8771e0188c2090a02f32 | qt/python/mantidqt/mantidqt/widgets/superplot/presenter.py | python | SuperplotPresenter.on_drop | (self, name) | Triggered when a drop event is received in the list widget. Here, name
is assumed to be a workspace name.
Args:
name (str): workspace name | Triggered when a drop event is received in the list widget. Here, name
is assumed to be a workspace name. | [
"Triggered",
"when",
"a",
"drop",
"event",
"is",
"received",
"in",
"the",
"list",
"widget",
".",
"Here",
"name",
"is",
"assumed",
"to",
"be",
"a",
"workspace",
"name",
"."
] | def on_drop(self, name):
"""
Triggered when a drop event is received in the list widget. Here, name
is assumed to be a workspace name.
Args:
name (str): workspace name
"""
selection = self._view.get_selection()
self._model.add_workspace(name)
... | [
"def",
"on_drop",
"(",
"self",
",",
"name",
")",
":",
"selection",
"=",
"self",
".",
"_view",
".",
"get_selection",
"(",
")",
"self",
".",
"_model",
".",
"add_workspace",
"(",
"name",
")",
"self",
".",
"_update_list",
"(",
")",
"self",
".",
"_view",
... | https://github.com/mantidproject/mantid/blob/03deeb89254ec4289edb8771e0188c2090a02f32/qt/python/mantidqt/mantidqt/widgets/superplot/presenter.py#L240-L252 | ||
benoitsteiner/tensorflow-opencl | cb7cb40a57fde5cfd4731bc551e82a1e2fef43a5 | tensorflow/contrib/slim/python/slim/data/dataset_data_provider.py | python | DatasetDataProvider.__init__ | (self,
dataset,
num_readers=1,
reader_kwargs=None,
shuffle=True,
num_epochs=None,
common_queue_capacity=256,
common_queue_min=128,
record_key='record_key',
seed=None,
sco... | Creates a DatasetDataProvider.
Args:
dataset: An instance of the Dataset class.
num_readers: The number of parallel readers to use.
reader_kwargs: An optional dict of kwargs for the reader.
shuffle: Whether to shuffle the data sources and common queue when
reading.
num_epochs:... | Creates a DatasetDataProvider. | [
"Creates",
"a",
"DatasetDataProvider",
"."
] | def __init__(self,
dataset,
num_readers=1,
reader_kwargs=None,
shuffle=True,
num_epochs=None,
common_queue_capacity=256,
common_queue_min=128,
record_key='record_key',
seed=None,
... | [
"def",
"__init__",
"(",
"self",
",",
"dataset",
",",
"num_readers",
"=",
"1",
",",
"reader_kwargs",
"=",
"None",
",",
"shuffle",
"=",
"True",
",",
"num_epochs",
"=",
"None",
",",
"common_queue_capacity",
"=",
"256",
",",
"common_queue_min",
"=",
"128",
","... | https://github.com/benoitsteiner/tensorflow-opencl/blob/cb7cb40a57fde5cfd4731bc551e82a1e2fef43a5/tensorflow/contrib/slim/python/slim/data/dataset_data_provider.py#L53-L107 | ||
wxWidgets/wxPython-Classic | 19571e1ae65f1ac445f5491474121998c97a1bf0 | wx/lib/masked/numctrl.py | python | NumCtrl.SetAllowNone | (self, allow_none) | Change the behavior of the validation code, allowing control
to have a value of None or not, as appropriate. If the value
of the control is currently None, and allow_none is False, the
value of the control will be set to the minimum value of the
control, or 0 if no lower bound is set. | Change the behavior of the validation code, allowing control
to have a value of None or not, as appropriate. If the value
of the control is currently None, and allow_none is False, the
value of the control will be set to the minimum value of the
control, or 0 if no lower bound is set. | [
"Change",
"the",
"behavior",
"of",
"the",
"validation",
"code",
"allowing",
"control",
"to",
"have",
"a",
"value",
"of",
"None",
"or",
"not",
"as",
"appropriate",
".",
"If",
"the",
"value",
"of",
"the",
"control",
"is",
"currently",
"None",
"and",
"allow_n... | def SetAllowNone(self, allow_none):
"""
Change the behavior of the validation code, allowing control
to have a value of None or not, as appropriate. If the value
of the control is currently None, and allow_none is False, the
value of the control will be set to the minimum value ... | [
"def",
"SetAllowNone",
"(",
"self",
",",
"allow_none",
")",
":",
"self",
".",
"_allowNone",
"=",
"allow_none",
"if",
"not",
"allow_none",
"and",
"self",
".",
"GetValue",
"(",
")",
"is",
"None",
":",
"min",
"=",
"self",
".",
"GetMin",
"(",
")",
"if",
... | https://github.com/wxWidgets/wxPython-Classic/blob/19571e1ae65f1ac445f5491474121998c97a1bf0/wx/lib/masked/numctrl.py#L1497-L1509 | ||
domino-team/openwrt-cc | 8b181297c34d14d3ca521cc9f31430d561dbc688 | package/gli-pub/openwrt-node-packages-master/node/node-v6.9.1/deps/v8_inspector/third_party/jinja2/jinja2/sandbox.py | python | modifies_known_mutable | (obj, attr) | return False | This function checks if an attribute on a builtin mutable object
(list, dict, set or deque) would modify it if called. It also supports
the "user"-versions of the objects (`sets.Set`, `UserDict.*` etc.) and
with Python 2.6 onwards the abstract base classes `MutableSet`,
`MutableMapping`, and `MutableSe... | This function checks if an attribute on a builtin mutable object
(list, dict, set or deque) would modify it if called. It also supports
the "user"-versions of the objects (`sets.Set`, `UserDict.*` etc.) and
with Python 2.6 onwards the abstract base classes `MutableSet`,
`MutableMapping`, and `MutableSe... | [
"This",
"function",
"checks",
"if",
"an",
"attribute",
"on",
"a",
"builtin",
"mutable",
"object",
"(",
"list",
"dict",
"set",
"or",
"deque",
")",
"would",
"modify",
"it",
"if",
"called",
".",
"It",
"also",
"supports",
"the",
"user",
"-",
"versions",
"of"... | def modifies_known_mutable(obj, attr):
"""This function checks if an attribute on a builtin mutable object
(list, dict, set or deque) would modify it if called. It also supports
the "user"-versions of the objects (`sets.Set`, `UserDict.*` etc.) and
with Python 2.6 onwards the abstract base classes `Mut... | [
"def",
"modifies_known_mutable",
"(",
"obj",
",",
"attr",
")",
":",
"for",
"typespec",
",",
"unsafe",
"in",
"_mutable_spec",
":",
"if",
"isinstance",
"(",
"obj",
",",
"typespec",
")",
":",
"return",
"attr",
"in",
"unsafe",
"return",
"False"
] | https://github.com/domino-team/openwrt-cc/blob/8b181297c34d14d3ca521cc9f31430d561dbc688/package/gli-pub/openwrt-node-packages-master/node/node-v6.9.1/deps/v8_inspector/third_party/jinja2/jinja2/sandbox.py#L151-L176 | |
smilehao/xlua-framework | a03801538be2b0e92d39332d445b22caca1ef61f | ConfigData/trunk/tools/protobuf-2.5.0/protobuf-2.5.0/python/google/protobuf/descriptor_pool.py | python | DescriptorPool._MakeEnumValueDescriptor | (self, value_proto, index) | return descriptor.EnumValueDescriptor(
name=value_proto.name,
index=index,
number=value_proto.number,
options=value_proto.options,
type=None) | Creates a enum value descriptor object from a enum value proto.
Args:
value_proto: The proto describing the enum value.
index: The index of the enum value.
Returns:
An initialized EnumValueDescriptor object. | Creates a enum value descriptor object from a enum value proto. | [
"Creates",
"a",
"enum",
"value",
"descriptor",
"object",
"from",
"a",
"enum",
"value",
"proto",
"."
] | def _MakeEnumValueDescriptor(self, value_proto, index):
"""Creates a enum value descriptor object from a enum value proto.
Args:
value_proto: The proto describing the enum value.
index: The index of the enum value.
Returns:
An initialized EnumValueDescriptor object.
"""
return d... | [
"def",
"_MakeEnumValueDescriptor",
"(",
"self",
",",
"value_proto",
",",
"index",
")",
":",
"return",
"descriptor",
".",
"EnumValueDescriptor",
"(",
"name",
"=",
"value_proto",
".",
"name",
",",
"index",
"=",
"index",
",",
"number",
"=",
"value_proto",
".",
... | https://github.com/smilehao/xlua-framework/blob/a03801538be2b0e92d39332d445b22caca1ef61f/ConfigData/trunk/tools/protobuf-2.5.0/protobuf-2.5.0/python/google/protobuf/descriptor_pool.py#L437-L453 | |
ricardoquesada/Spidermonkey | 4a75ea2543408bd1b2c515aa95901523eeef7858 | config/configobj.py | python | Section.merge | (self, indict) | A recursive update - useful for merging config files.
>>> a = '''[section1]
... option1 = True
... [[subsection]]
... more_options = False
... # end of file'''.splitlines()
>>> b = '''# File is user.ini
... [section1]
... o... | A recursive update - useful for merging config files.
>>> a = '''[section1]
... option1 = True
... [[subsection]]
... more_options = False
... # end of file'''.splitlines()
>>> b = '''# File is user.ini
... [section1]
... o... | [
"A",
"recursive",
"update",
"-",
"useful",
"for",
"merging",
"config",
"files",
".",
">>>",
"a",
"=",
"[",
"section1",
"]",
"...",
"option1",
"=",
"True",
"...",
"[[",
"subsection",
"]]",
"...",
"more_options",
"=",
"False",
"...",
"#",
"end",
"of",
"f... | def merge(self, indict):
"""
A recursive update - useful for merging config files.
>>> a = '''[section1]
... option1 = True
... [[subsection]]
... more_options = False
... # end of file'''.splitlines()
>>> b = '''# File is user.ini... | [
"def",
"merge",
"(",
"self",
",",
"indict",
")",
":",
"for",
"key",
",",
"val",
"in",
"indict",
".",
"items",
"(",
")",
":",
"if",
"(",
"key",
"in",
"self",
"and",
"isinstance",
"(",
"self",
"[",
"key",
"]",
",",
"dict",
")",
"and",
"isinstance",... | https://github.com/ricardoquesada/Spidermonkey/blob/4a75ea2543408bd1b2c515aa95901523eeef7858/config/configobj.py#L728-L752 | ||
hpi-xnor/BMXNet-v2 | af2b1859eafc5c721b1397cef02f946aaf2ce20d | example/rnn/large_word_lm/run_utils.py | python | evaluate | (mod, data_iter, epoch, log_interval) | return loss | Run evaluation on cpu. | Run evaluation on cpu. | [
"Run",
"evaluation",
"on",
"cpu",
"."
] | def evaluate(mod, data_iter, epoch, log_interval):
""" Run evaluation on cpu. """
start = time.time()
total_L = 0.0
nbatch = 0
density = 0
mod.set_states(value=0)
for batch in data_iter:
mod.forward(batch, is_train=False)
outputs = mod.get_outputs(merge_multi_context=False)
... | [
"def",
"evaluate",
"(",
"mod",
",",
"data_iter",
",",
"epoch",
",",
"log_interval",
")",
":",
"start",
"=",
"time",
".",
"time",
"(",
")",
"total_L",
"=",
"0.0",
"nbatch",
"=",
"0",
"density",
"=",
"0",
"mod",
".",
"set_states",
"(",
"value",
"=",
... | https://github.com/hpi-xnor/BMXNet-v2/blob/af2b1859eafc5c721b1397cef02f946aaf2ce20d/example/rnn/large_word_lm/run_utils.py#L66-L90 | |
leela-zero/leela-zero | e3ed6310d33d75078ba74c3adf887d18439fc2e3 | training/tf/chunkparser.py | python | ChunkParser.parse | (self) | Read data from child workers and yield batches
of raw tensors | Read data from child workers and yield batches
of raw tensors | [
"Read",
"data",
"from",
"child",
"workers",
"and",
"yield",
"batches",
"of",
"raw",
"tensors"
] | def parse(self):
"""
Read data from child workers and yield batches
of raw tensors
"""
gen = self.v2_gen() # read from workers
gen = self.tuple_gen(gen) # convert v2->tuple
gen = self.batch_gen(gen) # assemble into batches
for b in gen:
... | [
"def",
"parse",
"(",
"self",
")",
":",
"gen",
"=",
"self",
".",
"v2_gen",
"(",
")",
"# read from workers",
"gen",
"=",
"self",
".",
"tuple_gen",
"(",
"gen",
")",
"# convert v2->tuple",
"gen",
"=",
"self",
".",
"batch_gen",
"(",
"gen",
")",
"# assemble in... | https://github.com/leela-zero/leela-zero/blob/e3ed6310d33d75078ba74c3adf887d18439fc2e3/training/tf/chunkparser.py#L377-L386 | ||
nvdla/sw | 79538ba1b52b040a4a4645f630e457fa01839e90 | umd/external/protobuf-2.6/python/mox.py | python | And.equals | (self, rhs) | return True | Checks whether all Comparators are equal to rhs.
Args:
# rhs: can be anything
Returns:
bool | Checks whether all Comparators are equal to rhs. | [
"Checks",
"whether",
"all",
"Comparators",
"are",
"equal",
"to",
"rhs",
"."
] | def equals(self, rhs):
"""Checks whether all Comparators are equal to rhs.
Args:
# rhs: can be anything
Returns:
bool
"""
for comparator in self._comparators:
if not comparator.equals(rhs):
return False
return True | [
"def",
"equals",
"(",
"self",
",",
"rhs",
")",
":",
"for",
"comparator",
"in",
"self",
".",
"_comparators",
":",
"if",
"not",
"comparator",
".",
"equals",
"(",
"rhs",
")",
":",
"return",
"False",
"return",
"True"
] | https://github.com/nvdla/sw/blob/79538ba1b52b040a4a4645f630e457fa01839e90/umd/external/protobuf-2.6/python/mox.py#L1059-L1073 | |
aws/lumberyard | f85344403c1c2e77ec8c75deb2c116e97b713217 | dev/Tools/Python/3.7.10/windows/Lib/pydoc.py | python | render_doc | (thing, title='Python Library Documentation: %s', forceload=0,
renderer=None) | return title % desc + '\n\n' + renderer.document(object, name) | Render text documentation, given an object or a path to an object. | Render text documentation, given an object or a path to an object. | [
"Render",
"text",
"documentation",
"given",
"an",
"object",
"or",
"a",
"path",
"to",
"an",
"object",
"."
] | def render_doc(thing, title='Python Library Documentation: %s', forceload=0,
renderer=None):
"""Render text documentation, given an object or a path to an object."""
if renderer is None:
renderer = text
object, name = resolve(thing, forceload)
desc = describe(object)
module = inspect... | [
"def",
"render_doc",
"(",
"thing",
",",
"title",
"=",
"'Python Library Documentation: %s'",
",",
"forceload",
"=",
"0",
",",
"renderer",
"=",
"None",
")",
":",
"if",
"renderer",
"is",
"None",
":",
"renderer",
"=",
"text",
"object",
",",
"name",
"=",
"resol... | https://github.com/aws/lumberyard/blob/f85344403c1c2e77ec8c75deb2c116e97b713217/dev/Tools/Python/3.7.10/windows/Lib/pydoc.py#L1641-L1664 | |
catboost/catboost | 167f64f237114a4d10b2b4ee42adb4569137debe | contrib/python/numpy/py2/numpy/polynomial/laguerre.py | python | laggrid3d | (x, y, z, c) | return c | Evaluate a 3-D Laguerre series on the Cartesian product of x, y, and z.
This function returns the values:
.. math:: p(a,b,c) = \\sum_{i,j,k} c_{i,j,k} * L_i(a) * L_j(b) * L_k(c)
where the points `(a, b, c)` consist of all triples formed by taking
`a` from `x`, `b` from `y`, and `c` from `z`. The resu... | Evaluate a 3-D Laguerre series on the Cartesian product of x, y, and z. | [
"Evaluate",
"a",
"3",
"-",
"D",
"Laguerre",
"series",
"on",
"the",
"Cartesian",
"product",
"of",
"x",
"y",
"and",
"z",
"."
] | def laggrid3d(x, y, z, c):
"""
Evaluate a 3-D Laguerre series on the Cartesian product of x, y, and z.
This function returns the values:
.. math:: p(a,b,c) = \\sum_{i,j,k} c_{i,j,k} * L_i(a) * L_j(b) * L_k(c)
where the points `(a, b, c)` consist of all triples formed by taking
`a` from `x`, `... | [
"def",
"laggrid3d",
"(",
"x",
",",
"y",
",",
"z",
",",
"c",
")",
":",
"c",
"=",
"lagval",
"(",
"x",
",",
"c",
")",
"c",
"=",
"lagval",
"(",
"y",
",",
"c",
")",
"c",
"=",
"lagval",
"(",
"z",
",",
"c",
")",
"return",
"c"
] | https://github.com/catboost/catboost/blob/167f64f237114a4d10b2b4ee42adb4569137debe/contrib/python/numpy/py2/numpy/polynomial/laguerre.py#L1122-L1178 | |
aws/lumberyard | f85344403c1c2e77ec8c75deb2c116e97b713217 | dev/Gems/CloudGemFramework/v1/ResourceManager/resource_manager/view.py | python | ViewContext.__output_table | (self, items, specs, sort_column_count=1, indent=False, first_sort_column=0) | Displays a table containing data from items formatted as defined by specs.
items is an array of dict. The properties shown are determined by specs.
specs is an array of dict with the following properties:
Field -- Identifies a property in an item. Required.
Heading -- The head... | Displays a table containing data from items formatted as defined by specs. | [
"Displays",
"a",
"table",
"containing",
"data",
"from",
"items",
"formatted",
"as",
"defined",
"by",
"specs",
"."
] | def __output_table(self, items, specs, sort_column_count=1, indent=False, first_sort_column=0):
""" Displays a table containing data from items formatted as defined by specs.
items is an array of dict. The properties shown are determined by specs.
specs is an array of dict with the following p... | [
"def",
"__output_table",
"(",
"self",
",",
"items",
",",
"specs",
",",
"sort_column_count",
"=",
"1",
",",
"indent",
"=",
"False",
",",
"first_sort_column",
"=",
"0",
")",
":",
"def",
"default_formatter",
"(",
"v",
")",
":",
"return",
"str",
"(",
"v",
... | https://github.com/aws/lumberyard/blob/f85344403c1c2e77ec8c75deb2c116e97b713217/dev/Gems/CloudGemFramework/v1/ResourceManager/resource_manager/view.py#L766-L851 | ||
ArduPilot/ardupilot | 6e684b3496122b8158ac412b609d00004b7ac306 | libraries/AP_HAL_ChibiOS/hwdef/scripts/chibios_hwdef.py | python | get_extra_bylabel | (label, name, default=None) | return p.extra_value(name, type=str, default=default) | get extra setting for a label by name | get extra setting for a label by name | [
"get",
"extra",
"setting",
"for",
"a",
"label",
"by",
"name"
] | def get_extra_bylabel(label, name, default=None):
'''get extra setting for a label by name'''
p = bylabel.get(label)
if p is None:
return default
return p.extra_value(name, type=str, default=default) | [
"def",
"get_extra_bylabel",
"(",
"label",
",",
"name",
",",
"default",
"=",
"None",
")",
":",
"p",
"=",
"bylabel",
".",
"get",
"(",
"label",
")",
"if",
"p",
"is",
"None",
":",
"return",
"default",
"return",
"p",
".",
"extra_value",
"(",
"name",
",",
... | https://github.com/ArduPilot/ardupilot/blob/6e684b3496122b8158ac412b609d00004b7ac306/libraries/AP_HAL_ChibiOS/hwdef/scripts/chibios_hwdef.py#L1510-L1515 | |
klzgrad/naiveproxy | ed2c513637c77b18721fe428d7ed395b4d284c83 | src/build/android/method_count.py | python | DexStatsCollector.GetTotalCounts | (self) | return ret | Returns dict of {metric -> count}, where |count| is sum(metric). | Returns dict of {metric -> count}, where |count| is sum(metric). | [
"Returns",
"dict",
"of",
"{",
"metric",
"-",
">",
"count",
"}",
"where",
"|count|",
"is",
"sum",
"(",
"metric",
")",
"."
] | def GetTotalCounts(self):
"""Returns dict of {metric -> count}, where |count| is sum(metric)."""
ret = {}
for metric in ('fields', 'methods', 'strings', 'types'):
ret[metric] = sum(x[metric] for x in self._counts_by_label.values())
return ret | [
"def",
"GetTotalCounts",
"(",
"self",
")",
":",
"ret",
"=",
"{",
"}",
"for",
"metric",
"in",
"(",
"'fields'",
",",
"'methods'",
",",
"'strings'",
",",
"'types'",
")",
":",
"ret",
"[",
"metric",
"]",
"=",
"sum",
"(",
"x",
"[",
"metric",
"]",
"for",
... | https://github.com/klzgrad/naiveproxy/blob/ed2c513637c77b18721fe428d7ed395b4d284c83/src/build/android/method_count.py#L67-L72 | |
cms-sw/cmssw | fd9de012d503d3405420bcbeec0ec879baa57cf2 | Validation/RecoTrack/python/plotting/ntupleDataFormat.py | python | _HitObject.ntracks | (self) | return getattr(self._tree, self._prefix+"_trkIdx")[self._index].size() | Returns number of tracks containing this hit. | Returns number of tracks containing this hit. | [
"Returns",
"number",
"of",
"tracks",
"containing",
"this",
"hit",
"."
] | def ntracks(self):
"""Returns number of tracks containing this hit."""
self._checkIsValid()
return getattr(self._tree, self._prefix+"_trkIdx")[self._index].size() | [
"def",
"ntracks",
"(",
"self",
")",
":",
"self",
".",
"_checkIsValid",
"(",
")",
"return",
"getattr",
"(",
"self",
".",
"_tree",
",",
"self",
".",
"_prefix",
"+",
"\"_trkIdx\"",
")",
"[",
"self",
".",
"_index",
"]",
".",
"size",
"(",
")"
] | https://github.com/cms-sw/cmssw/blob/fd9de012d503d3405420bcbeec0ec879baa57cf2/Validation/RecoTrack/python/plotting/ntupleDataFormat.py#L169-L172 | |
facebook/ThreatExchange | 31914a51820c73c8a0daffe62ccca29a6e3d359e | api-reference-examples/python/pytx/pytx/malware.py | python | Malware.zfh | (self) | return zfh | Return a file handle of the base64-decoded sample in a zip file. | Return a file handle of the base64-decoded sample in a zip file. | [
"Return",
"a",
"file",
"handle",
"of",
"the",
"base64",
"-",
"decoded",
"sample",
"in",
"a",
"zip",
"file",
"."
] | def zfh(self):
"""
Return a file handle of the base64-decoded sample in a zip file.
"""
if self.get(m.SAMPLE) is None:
self.details()
zfh = io.BytesIO()
zfh.write(base64.b64decode(self.get(m.SAMPLE)))
zfh.seek(0)
return zfh | [
"def",
"zfh",
"(",
"self",
")",
":",
"if",
"self",
".",
"get",
"(",
"m",
".",
"SAMPLE",
")",
"is",
"None",
":",
"self",
".",
"details",
"(",
")",
"zfh",
"=",
"io",
".",
"BytesIO",
"(",
")",
"zfh",
".",
"write",
"(",
"base64",
".",
"b64decode",
... | https://github.com/facebook/ThreatExchange/blob/31914a51820c73c8a0daffe62ccca29a6e3d359e/api-reference-examples/python/pytx/pytx/malware.py#L84-L94 | |
miyosuda/TensorFlowAndroidDemo | 35903e0221aa5f109ea2dbef27f20b52e317f42d | jni-build/jni/include/tensorflow/contrib/learn/python/learn/graph_actions.py | python | train | (graph,
output_dir,
train_op,
loss_op,
global_step_tensor=None,
init_op=None,
init_feed_dict=None,
init_fn=None,
log_every_steps=10,
supervisor_is_chief=True,
supervisor_master='',
supervisor_save_model_secs=60... | Train a model.
Given `graph`, a directory to write outputs to (`output_dir`), and some ops,
run a training loop. The given `train_op` performs one step of training on the
model. The `loss_op` represents the objective function of the training. It is
expected to increment the `global_step_tensor`, a scalar integ... | Train a model. | [
"Train",
"a",
"model",
"."
] | def train(graph,
output_dir,
train_op,
loss_op,
global_step_tensor=None,
init_op=None,
init_feed_dict=None,
init_fn=None,
log_every_steps=10,
supervisor_is_chief=True,
supervisor_master='',
supervisor_save_mode... | [
"def",
"train",
"(",
"graph",
",",
"output_dir",
",",
"train_op",
",",
"loss_op",
",",
"global_step_tensor",
"=",
"None",
",",
"init_op",
"=",
"None",
",",
"init_feed_dict",
"=",
"None",
",",
"init_fn",
"=",
"None",
",",
"log_every_steps",
"=",
"10",
",",
... | https://github.com/miyosuda/TensorFlowAndroidDemo/blob/35903e0221aa5f109ea2dbef27f20b52e317f42d/jni-build/jni/include/tensorflow/contrib/learn/python/learn/graph_actions.py#L286-L392 | ||
aws/lumberyard | f85344403c1c2e77ec8c75deb2c116e97b713217 | dev/Tools/Python/3.7.10/windows/Lib/site-packages/pkg_resources/__init__.py | python | _by_version_descending | (names) | return sorted(names, key=_by_version, reverse=True) | Given a list of filenames, return them in descending order
by version number.
>>> names = 'bar', 'foo', 'Python-2.7.10.egg', 'Python-2.7.2.egg'
>>> _by_version_descending(names)
['Python-2.7.10.egg', 'Python-2.7.2.egg', 'foo', 'bar']
>>> names = 'Setuptools-1.2.3b1.egg', 'Setuptools-1.2.3.egg'
... | Given a list of filenames, return them in descending order
by version number. | [
"Given",
"a",
"list",
"of",
"filenames",
"return",
"them",
"in",
"descending",
"order",
"by",
"version",
"number",
"."
] | def _by_version_descending(names):
"""
Given a list of filenames, return them in descending order
by version number.
>>> names = 'bar', 'foo', 'Python-2.7.10.egg', 'Python-2.7.2.egg'
>>> _by_version_descending(names)
['Python-2.7.10.egg', 'Python-2.7.2.egg', 'foo', 'bar']
>>> names = 'Setup... | [
"def",
"_by_version_descending",
"(",
"names",
")",
":",
"def",
"_by_version",
"(",
"name",
")",
":",
"\"\"\"\n Parse each component of the filename\n \"\"\"",
"name",
",",
"ext",
"=",
"os",
".",
"path",
".",
"splitext",
"(",
"name",
")",
"parts",
"=... | https://github.com/aws/lumberyard/blob/f85344403c1c2e77ec8c75deb2c116e97b713217/dev/Tools/Python/3.7.10/windows/Lib/site-packages/pkg_resources/__init__.py#L2022-L2045 | |
windystrife/UnrealEngine_NVIDIAGameWorks | b50e6338a7c5b26374d66306ebc7807541ff815e | Engine/Extras/ThirdPartyNotUE/emsdk/Win64/python/2.7.5.3_64bit/Tools/pynche/pyColorChooser.py | python | askcolor | (color = None, **options) | return _chooser.show(color, options) | Ask for a color | Ask for a color | [
"Ask",
"for",
"a",
"color"
] | def askcolor(color = None, **options):
"""Ask for a color"""
global _chooser
if not _chooser:
_chooser = apply(Chooser, (), options)
return _chooser.show(color, options) | [
"def",
"askcolor",
"(",
"color",
"=",
"None",
",",
"*",
"*",
"options",
")",
":",
"global",
"_chooser",
"if",
"not",
"_chooser",
":",
"_chooser",
"=",
"apply",
"(",
"Chooser",
",",
"(",
")",
",",
"options",
")",
"return",
"_chooser",
".",
"show",
"("... | https://github.com/windystrife/UnrealEngine_NVIDIAGameWorks/blob/b50e6338a7c5b26374d66306ebc7807541ff815e/Engine/Extras/ThirdPartyNotUE/emsdk/Win64/python/2.7.5.3_64bit/Tools/pynche/pyColorChooser.py#L80-L85 | |
stellar-deprecated/stellard | 67eabb2217bdfa9a6ea317f62338fb6bca458c90 | src/protobuf/python/google/protobuf/service.py | python | RpcController.ErrorText | (self) | If Failed is true, returns a human-readable description of the error. | If Failed is true, returns a human-readable description of the error. | [
"If",
"Failed",
"is",
"true",
"returns",
"a",
"human",
"-",
"readable",
"description",
"of",
"the",
"error",
"."
] | def ErrorText(self):
"""If Failed is true, returns a human-readable description of the error."""
raise NotImplementedError | [
"def",
"ErrorText",
"(",
"self",
")",
":",
"raise",
"NotImplementedError"
] | https://github.com/stellar-deprecated/stellard/blob/67eabb2217bdfa9a6ea317f62338fb6bca458c90/src/protobuf/python/google/protobuf/service.py#L150-L152 | ||
trilinos/Trilinos | 6168be6dd51e35e1cd681e9c4b24433e709df140 | packages/seacas/scripts/exodus2.in.py | python | exodus.put_node_set_dist_fact | (self, id, nodeSetDistFact) | exo.put_node_set_dist_fact(node_set_id, ns_dist_facts)
-> store the list of distribution factors for nodes in a node set
input value(s):
<int> node_set_id node set *ID* (not *INDEX*)
<list<float>> ns_dist_facts a list of distribution factors,
e.g... | exo.put_node_set_dist_fact(node_set_id, ns_dist_facts) | [
"exo",
".",
"put_node_set_dist_fact",
"(",
"node_set_id",
"ns_dist_facts",
")"
] | def put_node_set_dist_fact(self, id, nodeSetDistFact):
"""
exo.put_node_set_dist_fact(node_set_id, ns_dist_facts)
-> store the list of distribution factors for nodes in a node set
input value(s):
<int> node_set_id node set *ID* (not *INDEX*)
<lis... | [
"def",
"put_node_set_dist_fact",
"(",
"self",
",",
"id",
",",
"nodeSetDistFact",
")",
":",
"self",
".",
"__ex_put_node_set_dist_fact",
"(",
"id",
",",
"nodeSetDistFact",
")"
] | https://github.com/trilinos/Trilinos/blob/6168be6dd51e35e1cd681e9c4b24433e709df140/packages/seacas/scripts/exodus2.in.py#L2133-L2144 | ||
adobe/chromium | cfe5bf0b51b1f6b9fe239c2a3c2f2364da9967d7 | third_party/closure_linter/closure_linter/checkerbase.py | python | CheckerBase._ExecutePass | (self, token, pass_function, parse_error=None,
debug_tokens=False) | return True | Calls the given function for every token in the given token stream.
As each token is passed to the given function, state is kept up to date and,
depending on the error_trace flag, errors are either caught and reported, or
allowed to bubble up so developers can see the full stack trace. If a parse
error... | Calls the given function for every token in the given token stream. | [
"Calls",
"the",
"given",
"function",
"for",
"every",
"token",
"in",
"the",
"given",
"token",
"stream",
"."
] | def _ExecutePass(self, token, pass_function, parse_error=None,
debug_tokens=False):
"""Calls the given function for every token in the given token stream.
As each token is passed to the given function, state is kept up to date and,
depending on the error_trace flag, errors are either cau... | [
"def",
"_ExecutePass",
"(",
"self",
",",
"token",
",",
"pass_function",
",",
"parse_error",
"=",
"None",
",",
"debug_tokens",
"=",
"False",
")",
":",
"self",
".",
"_state_tracker",
".",
"Reset",
"(",
")",
"while",
"token",
":",
"if",
"debug_tokens",
":",
... | https://github.com/adobe/chromium/blob/cfe5bf0b51b1f6b9fe239c2a3c2f2364da9967d7/third_party/closure_linter/closure_linter/checkerbase.py#L260-L312 | |
rsummers11/CADLab | 976ed959a0b5208bb4173127a7ef732ac73a9b6f | MULAN_universal_lesion_analysis/maskrcnn/modeling/roi_heads/box_head/loss.py | python | FastRCNNLossComputation.__init__ | (self, proposal_matcher, fg_bg_sampler, box_coder) | Arguments:
proposal_matcher (Matcher)
fg_bg_sampler (BalancedPositiveNegativeSampler)
box_coder (BoxCoder) | Arguments:
proposal_matcher (Matcher)
fg_bg_sampler (BalancedPositiveNegativeSampler)
box_coder (BoxCoder) | [
"Arguments",
":",
"proposal_matcher",
"(",
"Matcher",
")",
"fg_bg_sampler",
"(",
"BalancedPositiveNegativeSampler",
")",
"box_coder",
"(",
"BoxCoder",
")"
] | def __init__(self, proposal_matcher, fg_bg_sampler, box_coder):
"""
Arguments:
proposal_matcher (Matcher)
fg_bg_sampler (BalancedPositiveNegativeSampler)
box_coder (BoxCoder)
"""
self.proposal_matcher = proposal_matcher
self.fg_bg_sampler = fg_... | [
"def",
"__init__",
"(",
"self",
",",
"proposal_matcher",
",",
"fg_bg_sampler",
",",
"box_coder",
")",
":",
"self",
".",
"proposal_matcher",
"=",
"proposal_matcher",
"self",
".",
"fg_bg_sampler",
"=",
"fg_bg_sampler",
"self",
".",
"box_coder",
"=",
"box_coder"
] | https://github.com/rsummers11/CADLab/blob/976ed959a0b5208bb4173127a7ef732ac73a9b6f/MULAN_universal_lesion_analysis/maskrcnn/modeling/roi_heads/box_head/loss.py#L22-L31 | ||
Tom94/practical-path-guiding | fcf01afb436184e8a74bf300aa89f69b03ab25a2 | visualizer/nanogui/docs/exhale.py | python | ExhaleRoot.reparentClassLike | (self) | Helper method for :func:`exhale.ExhaleRoot.reparentAll`. Iterates over the
``self.class_like`` list and adds each object as a child to a namespace if the
class, or struct is a member of that namespace. Many classes / structs will be
reparented to a namespace node, these will remain in ``self.c... | Helper method for :func:`exhale.ExhaleRoot.reparentAll`. Iterates over the
``self.class_like`` list and adds each object as a child to a namespace if the
class, or struct is a member of that namespace. Many classes / structs will be
reparented to a namespace node, these will remain in ``self.c... | [
"Helper",
"method",
"for",
":",
"func",
":",
"exhale",
".",
"ExhaleRoot",
".",
"reparentAll",
".",
"Iterates",
"over",
"the",
"self",
".",
"class_like",
"list",
"and",
"adds",
"each",
"object",
"as",
"a",
"child",
"to",
"a",
"namespace",
"if",
"the",
"cl... | def reparentClassLike(self):
'''
Helper method for :func:`exhale.ExhaleRoot.reparentAll`. Iterates over the
``self.class_like`` list and adds each object as a child to a namespace if the
class, or struct is a member of that namespace. Many classes / structs will be
reparented t... | [
"def",
"reparentClassLike",
"(",
"self",
")",
":",
"removals",
"=",
"[",
"]",
"for",
"cl",
"in",
"self",
".",
"class_like",
":",
"parts",
"=",
"cl",
".",
"name",
".",
"split",
"(",
"\"::\"",
")",
"if",
"len",
"(",
"parts",
")",
">",
"1",
":",
"# ... | https://github.com/Tom94/practical-path-guiding/blob/fcf01afb436184e8a74bf300aa89f69b03ab25a2/visualizer/nanogui/docs/exhale.py#L1653-L1689 | ||
google/earthenterprise | 0fe84e29be470cd857e3a0e52e5d0afd5bb8cee9 | earth_enterprise/src/fusion/portableglobe/cutter/cgi-bin/common/utils.py | python | OutputFile | (file_name, replace_params) | Outputs a file to standard out with the globe name replaced. | Outputs a file to standard out with the globe name replaced. | [
"Outputs",
"a",
"file",
"to",
"standard",
"out",
"with",
"the",
"globe",
"name",
"replaced",
"."
] | def OutputFile(file_name, replace_params):
"""Outputs a file to standard out with the globe name replaced."""
fp = open(file_name)
text = fp.read()
fp.close()
print ReplaceParams(text, replace_params) | [
"def",
"OutputFile",
"(",
"file_name",
",",
"replace_params",
")",
":",
"fp",
"=",
"open",
"(",
"file_name",
")",
"text",
"=",
"fp",
".",
"read",
"(",
")",
"fp",
".",
"close",
"(",
")",
"print",
"ReplaceParams",
"(",
"text",
",",
"replace_params",
")"
... | https://github.com/google/earthenterprise/blob/0fe84e29be470cd857e3a0e52e5d0afd5bb8cee9/earth_enterprise/src/fusion/portableglobe/cutter/cgi-bin/common/utils.py#L180-L185 | ||
wxWidgets/wxPython-Classic | 19571e1ae65f1ac445f5491474121998c97a1bf0 | src/msw/grid.py | python | GridTableBase.AppendCols | (*args, **kwargs) | return _grid.GridTableBase_AppendCols(*args, **kwargs) | AppendCols(self, size_t numCols=1) -> bool | AppendCols(self, size_t numCols=1) -> bool | [
"AppendCols",
"(",
"self",
"size_t",
"numCols",
"=",
"1",
")",
"-",
">",
"bool"
] | def AppendCols(*args, **kwargs):
"""AppendCols(self, size_t numCols=1) -> bool"""
return _grid.GridTableBase_AppendCols(*args, **kwargs) | [
"def",
"AppendCols",
"(",
"*",
"args",
",",
"*",
"*",
"kwargs",
")",
":",
"return",
"_grid",
".",
"GridTableBase_AppendCols",
"(",
"*",
"args",
",",
"*",
"*",
"kwargs",
")"
] | https://github.com/wxWidgets/wxPython-Classic/blob/19571e1ae65f1ac445f5491474121998c97a1bf0/src/msw/grid.py#L878-L880 | |
makefile/frcnn | 8d9b9ebf8be8315ba2f374d460121b0adf1df29c | scripts/cpp_lint.py | python | Search | (pattern, s) | return _regexp_compile_cache[pattern].search(s) | Searches the string for the pattern, caching the compiled regexp. | Searches the string for the pattern, caching the compiled regexp. | [
"Searches",
"the",
"string",
"for",
"the",
"pattern",
"caching",
"the",
"compiled",
"regexp",
"."
] | def Search(pattern, s):
"""Searches the string for the pattern, caching the compiled regexp."""
if pattern not in _regexp_compile_cache:
_regexp_compile_cache[pattern] = sre_compile.compile(pattern)
return _regexp_compile_cache[pattern].search(s) | [
"def",
"Search",
"(",
"pattern",
",",
"s",
")",
":",
"if",
"pattern",
"not",
"in",
"_regexp_compile_cache",
":",
"_regexp_compile_cache",
"[",
"pattern",
"]",
"=",
"sre_compile",
".",
"compile",
"(",
"pattern",
")",
"return",
"_regexp_compile_cache",
"[",
"pat... | https://github.com/makefile/frcnn/blob/8d9b9ebf8be8315ba2f374d460121b0adf1df29c/scripts/cpp_lint.py#L543-L547 | |
ApolloAuto/apollo-platform | 86d9dc6743b496ead18d597748ebabd34a513289 | ros/third_party/lib_x86_64/python2.7/dist-packages/numpy/oldnumeric/ma.py | python | power | (a, b, third=None) | a**b | a**b | [
"a",
"**",
"b"
] | def power (a, b, third=None):
"a**b"
if third is not None:
raise MAError("3-argument power not supported.")
ma = getmask(a)
mb = getmask(b)
m = mask_or(ma, mb)
fa = filled(a, 1)
fb = filled(b, 1)
if fb.dtype.char in typecodes["Integer"]:
return masked_array(umath.power(fa... | [
"def",
"power",
"(",
"a",
",",
"b",
",",
"third",
"=",
"None",
")",
":",
"if",
"third",
"is",
"not",
"None",
":",
"raise",
"MAError",
"(",
"\"3-argument power not supported.\"",
")",
"ma",
"=",
"getmask",
"(",
"a",
")",
"mb",
"=",
"getmask",
"(",
"b"... | https://github.com/ApolloAuto/apollo-platform/blob/86d9dc6743b496ead18d597748ebabd34a513289/ros/third_party/lib_x86_64/python2.7/dist-packages/numpy/oldnumeric/ma.py#L1591-L1608 | ||
tensorflow/tensorflow | 419e3a6b650ea4bd1b0cba23c4348f8a69f3272e | tensorflow/python/keras/saving/save.py | python | save_model | (model,
filepath,
overwrite=True,
include_optimizer=True,
save_format=None,
signatures=None,
options=None,
save_traces=True) | Saves a model as a TensorFlow SavedModel or HDF5 file.
See the [Serialization and Saving guide](https://keras.io/guides/serialization_and_saving/)
for details.
Usage:
>>> model = tf.keras.Sequential([
... tf.keras.layers.Dense(5, input_shape=(3,)),
... tf.keras.layers.Softmax()])
>>> model.save... | Saves a model as a TensorFlow SavedModel or HDF5 file. | [
"Saves",
"a",
"model",
"as",
"a",
"TensorFlow",
"SavedModel",
"or",
"HDF5",
"file",
"."
] | def save_model(model,
filepath,
overwrite=True,
include_optimizer=True,
save_format=None,
signatures=None,
options=None,
save_traces=True):
# pylint: disable=line-too-long
"""Saves a model as a TensorFlow SavedM... | [
"def",
"save_model",
"(",
"model",
",",
"filepath",
",",
"overwrite",
"=",
"True",
",",
"include_optimizer",
"=",
"True",
",",
"save_format",
"=",
"None",
",",
"signatures",
"=",
"None",
",",
"options",
"=",
"None",
",",
"save_traces",
"=",
"True",
")",
... | https://github.com/tensorflow/tensorflow/blob/419e3a6b650ea4bd1b0cba23c4348f8a69f3272e/tensorflow/python/keras/saving/save.py#L37-L151 | ||
msftguy/ssh-rd | a5f3a79daeac5844edebf01916c9613563f1c390 | _3rd/boost_1_48_0/tools/build/v2/util/utility.py | python | get_value | (property) | return replace_grist (property, '') | Gets the value of a property, that is, the part following the grist, if any. | Gets the value of a property, that is, the part following the grist, if any. | [
"Gets",
"the",
"value",
"of",
"a",
"property",
"that",
"is",
"the",
"part",
"following",
"the",
"grist",
"if",
"any",
"."
] | def get_value (property):
""" Gets the value of a property, that is, the part following the grist, if any.
"""
return replace_grist (property, '') | [
"def",
"get_value",
"(",
"property",
")",
":",
"return",
"replace_grist",
"(",
"property",
",",
"''",
")"
] | https://github.com/msftguy/ssh-rd/blob/a5f3a79daeac5844edebf01916c9613563f1c390/_3rd/boost_1_48_0/tools/build/v2/util/utility.py#L71-L74 | |
francinexue/xuefu | b6ff79747a42e020588c0c0a921048e08fe4680c | api/ctpx/ctptd.py | python | CtpTd.onRspQryParkedOrderAction | (self, ParkedOrderActionField, RspInfoField, requestId, final) | 请求查询预埋撤单响应 | 请求查询预埋撤单响应 | [
"请求查询预埋撤单响应"
] | def onRspQryParkedOrderAction(self, ParkedOrderActionField, RspInfoField, requestId, final):
"""请求查询预埋撤单响应"""
pass | [
"def",
"onRspQryParkedOrderAction",
"(",
"self",
",",
"ParkedOrderActionField",
",",
"RspInfoField",
",",
"requestId",
",",
"final",
")",
":",
"pass"
] | https://github.com/francinexue/xuefu/blob/b6ff79747a42e020588c0c0a921048e08fe4680c/api/ctpx/ctptd.py#L439-L441 | ||
adobe/chromium | cfe5bf0b51b1f6b9fe239c2a3c2f2364da9967d7 | gpu/command_buffer/build_gles2_cmd_buffer.py | python | ImmediatePointerArgument.WriteValidationCode | (self, file, func) | Overridden from Argument. | Overridden from Argument. | [
"Overridden",
"from",
"Argument",
"."
] | def WriteValidationCode(self, file, func):
"""Overridden from Argument."""
file.Write(" if (%s == NULL) {\n" % self.name)
file.Write(" return error::kOutOfBounds;\n")
file.Write(" }\n") | [
"def",
"WriteValidationCode",
"(",
"self",
",",
"file",
",",
"func",
")",
":",
"file",
".",
"Write",
"(",
"\" if (%s == NULL) {\\n\"",
"%",
"self",
".",
"name",
")",
"file",
".",
"Write",
"(",
"\" return error::kOutOfBounds;\\n\"",
")",
"file",
".",
"Write... | https://github.com/adobe/chromium/blob/cfe5bf0b51b1f6b9fe239c2a3c2f2364da9967d7/gpu/command_buffer/build_gles2_cmd_buffer.py#L4862-L4866 | ||
wlanjie/AndroidFFmpeg | 7baf9122f4b8e1c74e7baf4be5c422c7a5ba5aaf | tools/fdk-aac-build/armeabi/toolchain/lib/python2.7/lib-tk/Tkinter.py | python | Tk.readprofile | (self, baseName, className) | Internal function. It reads BASENAME.tcl and CLASSNAME.tcl into
the Tcl Interpreter and calls execfile on BASENAME.py and CLASSNAME.py if
such a file exists in the home directory. | Internal function. It reads BASENAME.tcl and CLASSNAME.tcl into
the Tcl Interpreter and calls execfile on BASENAME.py and CLASSNAME.py if
such a file exists in the home directory. | [
"Internal",
"function",
".",
"It",
"reads",
"BASENAME",
".",
"tcl",
"and",
"CLASSNAME",
".",
"tcl",
"into",
"the",
"Tcl",
"Interpreter",
"and",
"calls",
"execfile",
"on",
"BASENAME",
".",
"py",
"and",
"CLASSNAME",
".",
"py",
"if",
"such",
"a",
"file",
"e... | def readprofile(self, baseName, className):
"""Internal function. It reads BASENAME.tcl and CLASSNAME.tcl into
the Tcl Interpreter and calls execfile on BASENAME.py and CLASSNAME.py if
such a file exists in the home directory."""
import os
if 'HOME' in os.environ: home = os.envir... | [
"def",
"readprofile",
"(",
"self",
",",
"baseName",
",",
"className",
")",
":",
"import",
"os",
"if",
"'HOME'",
"in",
"os",
".",
"environ",
":",
"home",
"=",
"os",
".",
"environ",
"[",
"'HOME'",
"]",
"else",
":",
"home",
"=",
"os",
".",
"curdir",
"... | https://github.com/wlanjie/AndroidFFmpeg/blob/7baf9122f4b8e1c74e7baf4be5c422c7a5ba5aaf/tools/fdk-aac-build/armeabi/toolchain/lib/python2.7/lib-tk/Tkinter.py#L1795-L1815 | ||
mantidproject/mantid | 03deeb89254ec4289edb8771e0188c2090a02f32 | qt/python/mantidqtinterfaces/mantidqtinterfaces/Muon/GUI/Common/fitting_widgets/basic_fitting/fit_function_options_view.py | python | FitFunctionOptionsView.set_slot_for_plot_guess_start_x_updated | (self, slot) | Connect the slot for the start x option. | Connect the slot for the start x option. | [
"Connect",
"the",
"slot",
"for",
"the",
"start",
"x",
"option",
"."
] | def set_slot_for_plot_guess_start_x_updated(self, slot) -> None:
"""Connect the slot for the start x option."""
self.plot_guess_start_x_line_edit.editingFinished.connect(slot) | [
"def",
"set_slot_for_plot_guess_start_x_updated",
"(",
"self",
",",
"slot",
")",
"->",
"None",
":",
"self",
".",
"plot_guess_start_x_line_edit",
".",
"editingFinished",
".",
"connect",
"(",
"slot",
")"
] | https://github.com/mantidproject/mantid/blob/03deeb89254ec4289edb8771e0188c2090a02f32/qt/python/mantidqtinterfaces/mantidqtinterfaces/Muon/GUI/Common/fitting_widgets/basic_fitting/fit_function_options_view.py#L134-L136 | ||
baidu-research/tensorflow-allreduce | 66d5b855e90b0949e9fa5cca5599fd729a70e874 | tensorflow/contrib/layers/python/layers/feature_column.py | python | _SparseColumn.weight_tensor | (self, input_tensor) | return None | Returns the weight tensor from the given transformed input_tensor. | Returns the weight tensor from the given transformed input_tensor. | [
"Returns",
"the",
"weight",
"tensor",
"from",
"the",
"given",
"transformed",
"input_tensor",
"."
] | def weight_tensor(self, input_tensor):
"""Returns the weight tensor from the given transformed input_tensor."""
return None | [
"def",
"weight_tensor",
"(",
"self",
",",
"input_tensor",
")",
":",
"return",
"None"
] | https://github.com/baidu-research/tensorflow-allreduce/blob/66d5b855e90b0949e9fa5cca5599fd729a70e874/tensorflow/contrib/layers/python/layers/feature_column.py#L414-L416 | |
htcondor/htcondor | 4829724575176d1d6c936e4693dfd78a728569b0 | src/condor_contrib/condor_pigeon/src/condor_pigeon_client/skype_linux_tools/Skype4Py/skype.py | python | ISkypeEvents.CallTransferStatusChanged | (self, Call, Status) | This event occurs when a call transfer status changes.
@param Call: Call object.
@type Call: L{ICall}
@param Status: New status of the call transfer.
@type Status: L{Call status<enums.clsUnknown>} | This event occurs when a call transfer status changes. | [
"This",
"event",
"occurs",
"when",
"a",
"call",
"transfer",
"status",
"changes",
"."
] | def CallTransferStatusChanged(self, Call, Status):
'''This event occurs when a call transfer status changes.
@param Call: Call object.
@type Call: L{ICall}
@param Status: New status of the call transfer.
@type Status: L{Call status<enums.clsUnknown>}
''' | [
"def",
"CallTransferStatusChanged",
"(",
"self",
",",
"Call",
",",
"Status",
")",
":"
] | https://github.com/htcondor/htcondor/blob/4829724575176d1d6c936e4693dfd78a728569b0/src/condor_contrib/condor_pigeon/src/condor_pigeon_client/skype_linux_tools/Skype4Py/skype.py#L1419-L1426 | ||
mantidproject/mantid | 03deeb89254ec4289edb8771e0188c2090a02f32 | qt/python/mantidqtinterfaces/mantidqtinterfaces/Muon/GUI/Common/fitting_widgets/basic_fitting/basic_fitting_presenter.py | python | BasicFittingPresenter.handle_exclude_range_state_changed | (self) | Handles when Exclude Range is ticked or unticked. | Handles when Exclude Range is ticked or unticked. | [
"Handles",
"when",
"Exclude",
"Range",
"is",
"ticked",
"or",
"unticked",
"."
] | def handle_exclude_range_state_changed(self) -> None:
"""Handles when Exclude Range is ticked or unticked."""
self.model.exclude_range = self.view.exclude_range
self.view.set_exclude_start_and_end_x_visible(self.model.exclude_range) | [
"def",
"handle_exclude_range_state_changed",
"(",
"self",
")",
"->",
"None",
":",
"self",
".",
"model",
".",
"exclude_range",
"=",
"self",
".",
"view",
".",
"exclude_range",
"self",
".",
"view",
".",
"set_exclude_start_and_end_x_visible",
"(",
"self",
".",
"mode... | https://github.com/mantidproject/mantid/blob/03deeb89254ec4289edb8771e0188c2090a02f32/qt/python/mantidqtinterfaces/mantidqtinterfaces/Muon/GUI/Common/fitting_widgets/basic_fitting/basic_fitting_presenter.py#L322-L325 | ||
mantidproject/mantid | 03deeb89254ec4289edb8771e0188c2090a02f32 | qt/python/mantidqtinterfaces/mantidqtinterfaces/HFIR_4Circle_Reduction/hfctables.py | python | ScanSurveyTable.get_hkl | (self, row_index) | return index_h, index_k, index_l | Get peak index (HKL) from survey table (i.e., SPICE file)
:param row_index:
:return: | Get peak index (HKL) from survey table (i.e., SPICE file)
:param row_index:
:return: | [
"Get",
"peak",
"index",
"(",
"HKL",
")",
"from",
"survey",
"table",
"(",
"i",
".",
"e",
".",
"SPICE",
"file",
")",
":",
"param",
"row_index",
":",
":",
"return",
":"
] | def get_hkl(self, row_index):
"""
Get peak index (HKL) from survey table (i.e., SPICE file)
:param row_index:
:return:
"""
index_h = self.get_cell_value(row_index, self._colIndexH)
index_k = self.get_cell_value(row_index, self._colIndexK)
index_l = self.ge... | [
"def",
"get_hkl",
"(",
"self",
",",
"row_index",
")",
":",
"index_h",
"=",
"self",
".",
"get_cell_value",
"(",
"row_index",
",",
"self",
".",
"_colIndexH",
")",
"index_k",
"=",
"self",
".",
"get_cell_value",
"(",
"row_index",
",",
"self",
".",
"_colIndexK"... | https://github.com/mantidproject/mantid/blob/03deeb89254ec4289edb8771e0188c2090a02f32/qt/python/mantidqtinterfaces/mantidqtinterfaces/HFIR_4Circle_Reduction/hfctables.py#L1229-L1239 | |
aws/lumberyard | f85344403c1c2e77ec8c75deb2c116e97b713217 | dev/Gems/CloudGemDefectReporter/v1/AWS/common-code/Lib/requests_oauthlib/oauth2_session.py | python | OAuth2Session.register_compliance_hook | (self, hook_type, hook) | Register a hook for request/response tweaking.
Available hooks are:
access_token_response invoked before token parsing.
refresh_token_response invoked before refresh token parsing.
protected_request invoked before making a request.
If you find a new hook is needed p... | Register a hook for request/response tweaking. | [
"Register",
"a",
"hook",
"for",
"request",
"/",
"response",
"tweaking",
"."
] | def register_compliance_hook(self, hook_type, hook):
"""Register a hook for request/response tweaking.
Available hooks are:
access_token_response invoked before token parsing.
refresh_token_response invoked before refresh token parsing.
protected_request invoked befo... | [
"def",
"register_compliance_hook",
"(",
"self",
",",
"hook_type",
",",
"hook",
")",
":",
"if",
"hook_type",
"not",
"in",
"self",
".",
"compliance_hook",
":",
"raise",
"ValueError",
"(",
"'Hook type %s is not in %s.'",
",",
"hook_type",
",",
"self",
".",
"complia... | https://github.com/aws/lumberyard/blob/f85344403c1c2e77ec8c75deb2c116e97b713217/dev/Gems/CloudGemDefectReporter/v1/AWS/common-code/Lib/requests_oauthlib/oauth2_session.py#L362-L376 | ||
ChromiumWebApps/chromium | c7361d39be8abd1574e6ce8957c8dbddd4c6ccf7 | third_party/markdown/extensions/abbr.py | python | AbbrExtension.extendMarkdown | (self, md, md_globals) | Insert AbbrPreprocessor before ReferencePreprocessor. | Insert AbbrPreprocessor before ReferencePreprocessor. | [
"Insert",
"AbbrPreprocessor",
"before",
"ReferencePreprocessor",
"."
] | def extendMarkdown(self, md, md_globals):
""" Insert AbbrPreprocessor before ReferencePreprocessor. """
md.preprocessors.add('abbr', AbbrPreprocessor(md), '<reference') | [
"def",
"extendMarkdown",
"(",
"self",
",",
"md",
",",
"md_globals",
")",
":",
"md",
".",
"preprocessors",
".",
"add",
"(",
"'abbr'",
",",
"AbbrPreprocessor",
"(",
"md",
")",
",",
"'<reference'",
")"
] | https://github.com/ChromiumWebApps/chromium/blob/c7361d39be8abd1574e6ce8957c8dbddd4c6ccf7/third_party/markdown/extensions/abbr.py#L72-L74 | ||
krishauser/Klampt | 972cc83ea5befac3f653c1ba20f80155768ad519 | Python/klampt/src/robotsim.py | python | IKObjective.setAxialRotConstraint | (self, alocal: "double const [3]", aworld: "double const [3]") | return _robotsim.IKObjective_setAxialRotConstraint(self, alocal, aworld) | r"""
setAxialRotConstraint(IKObjective self, double const [3] alocal, double const [3] aworld)
Manual: Sets an axial rotation constraint. | r"""
setAxialRotConstraint(IKObjective self, double const [3] alocal, double const [3] aworld) | [
"r",
"setAxialRotConstraint",
"(",
"IKObjective",
"self",
"double",
"const",
"[",
"3",
"]",
"alocal",
"double",
"const",
"[",
"3",
"]",
"aworld",
")"
] | def setAxialRotConstraint(self, alocal: "double const [3]", aworld: "double const [3]") -> "void":
r"""
setAxialRotConstraint(IKObjective self, double const [3] alocal, double const [3] aworld)
Manual: Sets an axial rotation constraint.
"""
return _robotsim.IKObjective_setAx... | [
"def",
"setAxialRotConstraint",
"(",
"self",
",",
"alocal",
":",
"\"double const [3]\"",
",",
"aworld",
":",
"\"double const [3]\"",
")",
"->",
"\"void\"",
":",
"return",
"_robotsim",
".",
"IKObjective_setAxialRotConstraint",
"(",
"self",
",",
"alocal",
",",
"aworld... | https://github.com/krishauser/Klampt/blob/972cc83ea5befac3f653c1ba20f80155768ad519/Python/klampt/src/robotsim.py#L6477-L6485 | |
hanpfei/chromium-net | 392cc1fa3a8f92f42e4071ab6e674d8e0482f83f | tools/perf/metrics/network.py | python | NetworkMetric.Stop | (self, _, tab) | Prepare the results for this page.
The results are the differences between the current values
and the values when Start() was called. | Prepare the results for this page. | [
"Prepare",
"the",
"results",
"for",
"this",
"page",
"."
] | def Stop(self, _, tab):
"""Prepare the results for this page.
The results are the differences between the current values
and the values when Start() was called.
"""
if not self._platform.CanMonitorNetworkData():
return
data = self._platform.GetNetworkData(self._browser)
if data is no... | [
"def",
"Stop",
"(",
"self",
",",
"_",
",",
"tab",
")",
":",
"if",
"not",
"self",
".",
"_platform",
".",
"CanMonitorNetworkData",
"(",
")",
":",
"return",
"data",
"=",
"self",
".",
"_platform",
".",
"GetNetworkData",
"(",
"self",
".",
"_browser",
")",
... | https://github.com/hanpfei/chromium-net/blob/392cc1fa3a8f92f42e4071ab6e674d8e0482f83f/tools/perf/metrics/network.py#L38-L56 | ||
aws/lumberyard | f85344403c1c2e77ec8c75deb2c116e97b713217 | dev/Tools/Python/3.7.10/linux_x64/lib/python3.7/compileall.py | python | compile_path | (skip_curdir=1, maxlevels=0, force=False, quiet=0,
legacy=False, optimize=-1,
invalidation_mode=None) | return success | Byte-compile all module on sys.path.
Arguments (all optional):
skip_curdir: if true, skip current directory (default True)
maxlevels: max recursion level (default 0)
force: as for compile_dir() (default False)
quiet: as for compile_dir() (default 0)
legacy: as for compile_dir() (default Fals... | Byte-compile all module on sys.path. | [
"Byte",
"-",
"compile",
"all",
"module",
"on",
"sys",
".",
"path",
"."
] | def compile_path(skip_curdir=1, maxlevels=0, force=False, quiet=0,
legacy=False, optimize=-1,
invalidation_mode=None):
"""Byte-compile all module on sys.path.
Arguments (all optional):
skip_curdir: if true, skip current directory (default True)
maxlevels: max recurs... | [
"def",
"compile_path",
"(",
"skip_curdir",
"=",
"1",
",",
"maxlevels",
"=",
"0",
",",
"force",
"=",
"False",
",",
"quiet",
"=",
"0",
",",
"legacy",
"=",
"False",
",",
"optimize",
"=",
"-",
"1",
",",
"invalidation_mode",
"=",
"None",
")",
":",
"succes... | https://github.com/aws/lumberyard/blob/f85344403c1c2e77ec8c75deb2c116e97b713217/dev/Tools/Python/3.7.10/linux_x64/lib/python3.7/compileall.py#L192-L223 | |
zju3dv/clean-pvnet | 5870c509e3cc205e1bb28910a7b1a9a3c8add9a8 | lib/utils/vsd/misc.py | python | paste_im | (src, trg, pos) | Pastes src to trg with the top left corner at pos. | Pastes src to trg with the top left corner at pos. | [
"Pastes",
"src",
"to",
"trg",
"with",
"the",
"top",
"left",
"corner",
"at",
"pos",
"."
] | def paste_im(src, trg, pos):
"""
Pastes src to trg with the top left corner at pos.
"""
assert(src.ndim == trg.ndim)
# Size of the region to be pasted
w = min(src.shape[1], trg.shape[1] - pos[0])
h = min(src.shape[0], trg.shape[0] - pos[1])
if src.ndim == 3:
trg[pos[1]:(pos[1] ... | [
"def",
"paste_im",
"(",
"src",
",",
"trg",
",",
"pos",
")",
":",
"assert",
"(",
"src",
".",
"ndim",
"==",
"trg",
".",
"ndim",
")",
"# Size of the region to be pasted",
"w",
"=",
"min",
"(",
"src",
".",
"shape",
"[",
"1",
"]",
",",
"trg",
".",
"shap... | https://github.com/zju3dv/clean-pvnet/blob/5870c509e3cc205e1bb28910a7b1a9a3c8add9a8/lib/utils/vsd/misc.py#L103-L116 | ||
PaddlePaddle/Paddle | 1252f4bb3e574df80aa6d18c7ddae1b3a90bd81c | python/paddle/utils/cpp_extension/extension_utils.py | python | custom_write_stub | (resource, pyfile) | Customized write_stub function to allow us to inject generated python
api codes into egg python file. | Customized write_stub function to allow us to inject generated python
api codes into egg python file. | [
"Customized",
"write_stub",
"function",
"to",
"allow",
"us",
"to",
"inject",
"generated",
"python",
"api",
"codes",
"into",
"egg",
"python",
"file",
"."
] | def custom_write_stub(resource, pyfile):
"""
Customized write_stub function to allow us to inject generated python
api codes into egg python file.
"""
_stub_template = textwrap.dedent("""
import os
import sys
import types
import paddle
def inject_ext_... | [
"def",
"custom_write_stub",
"(",
"resource",
",",
"pyfile",
")",
":",
"_stub_template",
"=",
"textwrap",
".",
"dedent",
"(",
"\"\"\"\n import os\n import sys\n import types\n import paddle\n \n def inject_ext_module(module_name, api_names):\n ... | https://github.com/PaddlePaddle/Paddle/blob/1252f4bb3e574df80aa6d18c7ddae1b3a90bd81c/python/paddle/utils/cpp_extension/extension_utils.py#L138-L196 | ||
benoitsteiner/tensorflow-opencl | cb7cb40a57fde5cfd4731bc551e82a1e2fef43a5 | tensorflow/python/ops/resource_variable_ops.py | python | ResourceVariable._as_graph_element | (self) | return self._graph_element | Conversion function for Graph.as_graph_element(). | Conversion function for Graph.as_graph_element(). | [
"Conversion",
"function",
"for",
"Graph",
".",
"as_graph_element",
"()",
"."
] | def _as_graph_element(self):
"""Conversion function for Graph.as_graph_element()."""
return self._graph_element | [
"def",
"_as_graph_element",
"(",
"self",
")",
":",
"return",
"self",
".",
"_graph_element"
] | https://github.com/benoitsteiner/tensorflow-opencl/blob/cb7cb40a57fde5cfd4731bc551e82a1e2fef43a5/tensorflow/python/ops/resource_variable_ops.py#L533-L535 | |
ApolloAuto/apollo-platform | 86d9dc6743b496ead18d597748ebabd34a513289 | ros/third_party/lib_x86_64/python2.7/dist-packages/numpy/oldnumeric/ma.py | python | MaskedArray.__idiv__ | (self, other) | return self | Divide self by other in place. | Divide self by other in place. | [
"Divide",
"self",
"by",
"other",
"in",
"place",
"."
] | def __idiv__(self, other):
"Divide self by other in place."
t = self._data.dtype.char
f = filled(other, 0)
t1 = f.dtype.char
if t == t1:
pass
elif t in typecodes['Integer']:
if t1 in typecodes['Integer']:
f = f.astype(t)
... | [
"def",
"__idiv__",
"(",
"self",
",",
"other",
")",
":",
"t",
"=",
"self",
".",
"_data",
".",
"dtype",
".",
"char",
"f",
"=",
"filled",
"(",
"other",
",",
"0",
")",
"t1",
"=",
"f",
".",
"dtype",
".",
"char",
"if",
"t",
"==",
"t1",
":",
"pass",... | https://github.com/ApolloAuto/apollo-platform/blob/86d9dc6743b496ead18d597748ebabd34a513289/ros/third_party/lib_x86_64/python2.7/dist-packages/numpy/oldnumeric/ma.py#L1120-L1157 | |
aws/lumberyard | f85344403c1c2e77ec8c75deb2c116e97b713217 | dev/Tools/Python/3.7.10/mac/Python.framework/Versions/3.7/lib/python3.7/mailbox.py | python | _mboxMMDF.get_file | (self, key, from_=False) | return _PartialFile(self._file, self._file.tell(), stop) | Return a file-like representation or raise a KeyError. | Return a file-like representation or raise a KeyError. | [
"Return",
"a",
"file",
"-",
"like",
"representation",
"or",
"raise",
"a",
"KeyError",
"."
] | def get_file(self, key, from_=False):
"""Return a file-like representation or raise a KeyError."""
start, stop = self._lookup(key)
self._file.seek(start)
if not from_:
self._file.readline()
return _PartialFile(self._file, self._file.tell(), stop) | [
"def",
"get_file",
"(",
"self",
",",
"key",
",",
"from_",
"=",
"False",
")",
":",
"start",
",",
"stop",
"=",
"self",
".",
"_lookup",
"(",
"key",
")",
"self",
".",
"_file",
".",
"seek",
"(",
"start",
")",
"if",
"not",
"from_",
":",
"self",
".",
... | https://github.com/aws/lumberyard/blob/f85344403c1c2e77ec8c75deb2c116e97b713217/dev/Tools/Python/3.7.10/mac/Python.framework/Versions/3.7/lib/python3.7/mailbox.py#L798-L804 | |
aws/lumberyard | f85344403c1c2e77ec8c75deb2c116e97b713217 | dev/Gems/CloudGemFramework/v1/AWS/resource-manager-code/lib/pkg_resources/_vendor/pyparsing.py | python | removeQuotes | (s,l,t) | return t[0][1:-1] | Helper parse action for removing quotation marks from parsed quoted strings.
Example::
# by default, quotation marks are included in parsed results
quotedString.parseString("'Now is the Winter of our Discontent'") # -> ["'Now is the Winter of our Discontent'"]
# use removeQuotes to strip q... | Helper parse action for removing quotation marks from parsed quoted strings. | [
"Helper",
"parse",
"action",
"for",
"removing",
"quotation",
"marks",
"from",
"parsed",
"quoted",
"strings",
"."
] | def removeQuotes(s,l,t):
"""
Helper parse action for removing quotation marks from parsed quoted strings.
Example::
# by default, quotation marks are included in parsed results
quotedString.parseString("'Now is the Winter of our Discontent'") # -> ["'Now is the Winter of our Discontent'"]
... | [
"def",
"removeQuotes",
"(",
"s",
",",
"l",
",",
"t",
")",
":",
"return",
"t",
"[",
"0",
"]",
"[",
"1",
":",
"-",
"1",
"]"
] | https://github.com/aws/lumberyard/blob/f85344403c1c2e77ec8c75deb2c116e97b713217/dev/Gems/CloudGemFramework/v1/AWS/resource-manager-code/lib/pkg_resources/_vendor/pyparsing.py#L4811-L4823 | |
NeoGeographyToolkit/StereoPipeline | eedf54a919fb5cce1ab0e280bb0df4050763aa11 | src/asp/IceBridge/icebridge_common.py | python | findMatchingLidarFileFromList | (imageFile, lidarFiles) | return bestLidarFile | Find the best matching lidar file from a list. | Find the best matching lidar file from a list. | [
"Find",
"the",
"best",
"matching",
"lidar",
"file",
"from",
"a",
"list",
"."
] | def findMatchingLidarFileFromList(imageFile, lidarFiles):
'''Find the best matching lidar file from a list.'''
vals = parseTimeStamps(imageFile)
if len(vals) < 2:
raise Exception('Failed to parse the date and time from: ' + imageFile)
useTimeFix = False
returnMinAndSecOnly = False
i... | [
"def",
"findMatchingLidarFileFromList",
"(",
"imageFile",
",",
"lidarFiles",
")",
":",
"vals",
"=",
"parseTimeStamps",
"(",
"imageFile",
")",
"if",
"len",
"(",
"vals",
")",
"<",
"2",
":",
"raise",
"Exception",
"(",
"'Failed to parse the date and time from: '",
"+"... | https://github.com/NeoGeographyToolkit/StereoPipeline/blob/eedf54a919fb5cce1ab0e280bb0df4050763aa11/src/asp/IceBridge/icebridge_common.py#L1225-L1308 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.