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 |
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
catboost/catboost | 167f64f237114a4d10b2b4ee42adb4569137debe | contrib/python/scikit-learn/py2/sklearn/grid_search.py | python | BaseSearchCV.predict_log_proba | (self, X) | return self.best_estimator_.predict_log_proba(X) | Call predict_log_proba on the estimator with the best found parameters.
Only available if ``refit=True`` and the underlying estimator supports
``predict_log_proba``.
Parameters
-----------
X : indexable, length n_samples
Must fulfill the input assumptions of the
... | Call predict_log_proba on the estimator with the best found parameters. | [
"Call",
"predict_log_proba",
"on",
"the",
"estimator",
"with",
"the",
"best",
"found",
"parameters",
"."
] | def predict_log_proba(self, X):
"""Call predict_log_proba on the estimator with the best found parameters.
Only available if ``refit=True`` and the underlying estimator supports
``predict_log_proba``.
Parameters
-----------
X : indexable, length n_samples
Mu... | [
"def",
"predict_log_proba",
"(",
"self",
",",
"X",
")",
":",
"return",
"self",
".",
"best_estimator_",
".",
"predict_log_proba",
"(",
"X",
")"
] | https://github.com/catboost/catboost/blob/167f64f237114a4d10b2b4ee42adb4569137debe/contrib/python/scikit-learn/py2/sklearn/grid_search.py#L474-L487 | |
google/shaka-player-embedded | dabbeb5b47cc257b37b9a254661546352aaf0afe | gen_docs.py | python | CompileDoxygen | () | return subprocess.call(['make', '-j4'], cwd=BUILD_PATH) | Compiles the doxygen program, if needed. | Compiles the doxygen program, if needed. | [
"Compiles",
"the",
"doxygen",
"program",
"if",
"needed",
"."
] | def CompileDoxygen():
"""Compiles the doxygen program, if needed."""
if os.path.exists(BIN_PATH):
return 0
if not os.path.exists(BUILD_PATH):
os.mkdir(BUILD_PATH)
if subprocess.call(['cmake', '../src'], cwd=BUILD_PATH) != 0:
return 1
return subprocess.call(['make', '-j4'], cwd=BUILD_PATH) | [
"def",
"CompileDoxygen",
"(",
")",
":",
"if",
"os",
".",
"path",
".",
"exists",
"(",
"BIN_PATH",
")",
":",
"return",
"0",
"if",
"not",
"os",
".",
"path",
".",
"exists",
"(",
"BUILD_PATH",
")",
":",
"os",
".",
"mkdir",
"(",
"BUILD_PATH",
")",
"if",
... | https://github.com/google/shaka-player-embedded/blob/dabbeb5b47cc257b37b9a254661546352aaf0afe/gen_docs.py#L30-L40 | |
Studio3T/robomongo | 2411cd032e2e69b968dadda13ac91ca4ef3483b0 | src/third-party/qscintilla-2.8.4/sources/Python/configure-old.py | python | generate_code | () | Generate the code for the QScintilla module. | Generate the code for the QScintilla module. | [
"Generate",
"the",
"code",
"for",
"the",
"QScintilla",
"module",
"."
] | def generate_code():
"""Generate the code for the QScintilla module.
"""
if pyqt.pyqt_version >= 0x040000:
mname = "Qsci"
else:
mname = "qsci"
sipconfig.inform("Generating the C++ source for the %s module..." % mname)
# Build the SIP command line.
argv = ['"' + pyqt.sip_bin... | [
"def",
"generate_code",
"(",
")",
":",
"if",
"pyqt",
".",
"pyqt_version",
">=",
"0x040000",
":",
"mname",
"=",
"\"Qsci\"",
"else",
":",
"mname",
"=",
"\"qsci\"",
"sipconfig",
".",
"inform",
"(",
"\"Generating the C++ source for the %s module...\"",
"%",
"mname",
... | https://github.com/Studio3T/robomongo/blob/2411cd032e2e69b968dadda13ac91ca4ef3483b0/src/third-party/qscintilla-2.8.4/sources/Python/configure-old.py#L220-L330 | ||
PaddlePaddle/Paddle | 1252f4bb3e574df80aa6d18c7ddae1b3a90bd81c | python/paddle/distributed/fleet/meta_optimizers/sharding/utils.py | python | get_var_size | (param) | return reduce(lambda x, y: x * y,
param.shape) * DtypeToSize[param.dtype] / 1024.0 / 1024.0 | input:
- param: var
return:
var size in MB | input:
- param: var
return:
var size in MB | [
"input",
":",
"-",
"param",
":",
"var",
"return",
":",
"var",
"size",
"in",
"MB"
] | def get_var_size(param):
"""
input:
- param: var
return:
var size in MB
"""
assert -1 not in param.shape
return reduce(lambda x, y: x * y,
param.shape) * DtypeToSize[param.dtype] / 1024.0 / 1024.0 | [
"def",
"get_var_size",
"(",
"param",
")",
":",
"assert",
"-",
"1",
"not",
"in",
"param",
".",
"shape",
"return",
"reduce",
"(",
"lambda",
"x",
",",
"y",
":",
"x",
"*",
"y",
",",
"param",
".",
"shape",
")",
"*",
"DtypeToSize",
"[",
"param",
".",
"... | https://github.com/PaddlePaddle/Paddle/blob/1252f4bb3e574df80aa6d18c7ddae1b3a90bd81c/python/paddle/distributed/fleet/meta_optimizers/sharding/utils.py#L788-L797 | |
aws/lumberyard | f85344403c1c2e77ec8c75deb2c116e97b713217 | dev/Tools/Python/3.7.10/windows/Lib/asyncio/protocols.py | python | Protocol.eof_received | (self) | Called when the other end calls write_eof() or equivalent.
If this returns a false value (including None), the transport
will close itself. If it returns a true value, closing the
transport is up to the protocol. | Called when the other end calls write_eof() or equivalent. | [
"Called",
"when",
"the",
"other",
"end",
"calls",
"write_eof",
"()",
"or",
"equivalent",
"."
] | def eof_received(self):
"""Called when the other end calls write_eof() or equivalent.
If this returns a false value (including None), the transport
will close itself. If it returns a true value, closing the
transport is up to the protocol.
""" | [
"def",
"eof_received",
"(",
"self",
")",
":"
] | https://github.com/aws/lumberyard/blob/f85344403c1c2e77ec8c75deb2c116e97b713217/dev/Tools/Python/3.7.10/windows/Lib/asyncio/protocols.py#L96-L102 | ||
tensorflow/deepmath | b5b721f54de1d5d6a02d78f5da5995237f9995f9 | deepmath/util/model_utils.py | python | merge_hparams | (*params) | return tf.contrib.training.HParams(**all_params) | Merge several HParams objects into one, complaining about duplicates.
Args:
*params: Zero or more HParams.
Returns:
A single HParams with all hyperparameters together.
Raises:
ValueError: If any hyperparameters are duplicated | Merge several HParams objects into one, complaining about duplicates. | [
"Merge",
"several",
"HParams",
"objects",
"into",
"one",
"complaining",
"about",
"duplicates",
"."
] | def merge_hparams(*params):
"""Merge several HParams objects into one, complaining about duplicates.
Args:
*params: Zero or more HParams.
Returns:
A single HParams with all hyperparameters together.
Raises:
ValueError: If any hyperparameters are duplicated
"""
all_params = {}
for ps in para... | [
"def",
"merge_hparams",
"(",
"*",
"params",
")",
":",
"all_params",
"=",
"{",
"}",
"for",
"ps",
"in",
"params",
":",
"for",
"k",
",",
"v",
"in",
"ps",
".",
"values",
"(",
")",
".",
"items",
"(",
")",
":",
"if",
"k",
"in",
"all_params",
":",
"ra... | https://github.com/tensorflow/deepmath/blob/b5b721f54de1d5d6a02d78f5da5995237f9995f9/deepmath/util/model_utils.py#L166-L185 | |
LiquidPlayer/LiquidCore | 9405979363f2353ac9a71ad8ab59685dd7f919c9 | deps/node-10.15.3/deps/v8/tools/grokdump.py | python | InspectionShell.do_do_desc | (self, address) | Print a descriptor array in a readable format. | Print a descriptor array in a readable format. | [
"Print",
"a",
"descriptor",
"array",
"in",
"a",
"readable",
"format",
"."
] | def do_do_desc(self, address):
"""
Print a descriptor array in a readable format.
"""
start = self.ParseAddressExpr(address)
if ((start & 1) == 1): start = start - 1
DescriptorArray(FixedArray(self.heap, None, start)).Print(Printer()) | [
"def",
"do_do_desc",
"(",
"self",
",",
"address",
")",
":",
"start",
"=",
"self",
".",
"ParseAddressExpr",
"(",
"address",
")",
"if",
"(",
"(",
"start",
"&",
"1",
")",
"==",
"1",
")",
":",
"start",
"=",
"start",
"-",
"1",
"DescriptorArray",
"(",
"F... | https://github.com/LiquidPlayer/LiquidCore/blob/9405979363f2353ac9a71ad8ab59685dd7f919c9/deps/node-10.15.3/deps/v8/tools/grokdump.py#L3586-L3592 | ||
dmlc/treelite | df56babb6a4a2d7c29d719c28ce53acfa7dbab3c | runtime/python/treelite_runtime/predictor.py | python | Predictor.ratio_c | (self) | return self.ratio_c_ | Query sigmoid alpha of the model | Query sigmoid alpha of the model | [
"Query",
"sigmoid",
"alpha",
"of",
"the",
"model"
] | def ratio_c(self):
"""Query sigmoid alpha of the model"""
return self.ratio_c_ | [
"def",
"ratio_c",
"(",
"self",
")",
":",
"return",
"self",
".",
"ratio_c_"
] | https://github.com/dmlc/treelite/blob/df56babb6a4a2d7c29d719c28ce53acfa7dbab3c/runtime/python/treelite_runtime/predictor.py#L237-L239 | |
bumptop/BumpTop | 466d23597a07ae738f4265262fa01087fc6e257c | trunk/win/Source/bin/jinja2/compiler.py | python | CodeGenerator.unoptimize_scope | (self, frame) | Disable Python optimizations for the frame. | Disable Python optimizations for the frame. | [
"Disable",
"Python",
"optimizations",
"for",
"the",
"frame",
"."
] | def unoptimize_scope(self, frame):
"""Disable Python optimizations for the frame."""
# XXX: this is not that nice but it has no real overhead. It
# mainly works because python finds the locals before dead code
# is removed. If that breaks we have to add a dummy function
# that ... | [
"def",
"unoptimize_scope",
"(",
"self",
",",
"frame",
")",
":",
"# XXX: this is not that nice but it has no real overhead. It",
"# mainly works because python finds the locals before dead code",
"# is removed. If that breaks we have to add a dummy function",
"# that just accepts the argument... | https://github.com/bumptop/BumpTop/blob/466d23597a07ae738f4265262fa01087fc6e257c/trunk/win/Source/bin/jinja2/compiler.py#L529-L537 | ||
hpi-xnor/BMXNet-v2 | af2b1859eafc5c721b1397cef02f946aaf2ce20d | python/mxnet/contrib/onnx/mx2onnx/_op_translations.py | python | convert_squeeze | (node, **kwargs) | return [node] | Map MXNet's squeeze operator attributes to onnx's squeeze operator
and return the created node. | Map MXNet's squeeze operator attributes to onnx's squeeze operator
and return the created node. | [
"Map",
"MXNet",
"s",
"squeeze",
"operator",
"attributes",
"to",
"onnx",
"s",
"squeeze",
"operator",
"and",
"return",
"the",
"created",
"node",
"."
] | def convert_squeeze(node, **kwargs):
"""Map MXNet's squeeze operator attributes to onnx's squeeze operator
and return the created node.
"""
name, input_nodes, attrs = get_inputs(node, kwargs)
axis = attrs.get("axis", None)
if not axis:
raise AttributeError("Squeeze: Missing axis attribu... | [
"def",
"convert_squeeze",
"(",
"node",
",",
"*",
"*",
"kwargs",
")",
":",
"name",
",",
"input_nodes",
",",
"attrs",
"=",
"get_inputs",
"(",
"node",
",",
"kwargs",
")",
"axis",
"=",
"attrs",
".",
"get",
"(",
"\"axis\"",
",",
"None",
")",
"if",
"not",
... | https://github.com/hpi-xnor/BMXNet-v2/blob/af2b1859eafc5c721b1397cef02f946aaf2ce20d/python/mxnet/contrib/onnx/mx2onnx/_op_translations.py#L1575-L1594 | |
wxWidgets/wxPython-Classic | 19571e1ae65f1ac445f5491474121998c97a1bf0 | wx/lib/agw/ribbon/gallery.py | python | RibbonGallery.Realize | (self) | return self.Layout() | Perform initial size and layout calculations after children have been added,
and/or realize children. | Perform initial size and layout calculations after children have been added,
and/or realize children. | [
"Perform",
"initial",
"size",
"and",
"layout",
"calculations",
"after",
"children",
"have",
"been",
"added",
"and",
"/",
"or",
"realize",
"children",
"."
] | def Realize(self):
"""
Perform initial size and layout calculations after children have been added,
and/or realize children.
"""
self.CalculateMinSize()
return self.Layout() | [
"def",
"Realize",
"(",
"self",
")",
":",
"self",
".",
"CalculateMinSize",
"(",
")",
"return",
"self",
".",
"Layout",
"(",
")"
] | https://github.com/wxWidgets/wxPython-Classic/blob/19571e1ae65f1ac445f5491474121998c97a1bf0/wx/lib/agw/ribbon/gallery.py#L680-L687 | |
catboost/catboost | 167f64f237114a4d10b2b4ee42adb4569137debe | contrib/tools/python3/src/Lib/zipapp.py | python | main | (args=None) | Run the zipapp command line interface.
The ARGS parameter lets you specify the argument list directly.
Omitting ARGS (or setting it to None) works as for argparse, using
sys.argv[1:] as the argument list. | Run the zipapp command line interface. | [
"Run",
"the",
"zipapp",
"command",
"line",
"interface",
"."
] | def main(args=None):
"""Run the zipapp command line interface.
The ARGS parameter lets you specify the argument list directly.
Omitting ARGS (or setting it to None) works as for argparse, using
sys.argv[1:] as the argument list.
"""
import argparse
parser = argparse.ArgumentParser()
pa... | [
"def",
"main",
"(",
"args",
"=",
"None",
")",
":",
"import",
"argparse",
"parser",
"=",
"argparse",
".",
"ArgumentParser",
"(",
")",
"parser",
".",
"add_argument",
"(",
"'--output'",
",",
"'-o'",
",",
"default",
"=",
"None",
",",
"help",
"=",
"\"The name... | https://github.com/catboost/catboost/blob/167f64f237114a4d10b2b4ee42adb4569137debe/contrib/tools/python3/src/Lib/zipapp.py#L156-L202 | ||
catboost/catboost | 167f64f237114a4d10b2b4ee42adb4569137debe | contrib/tools/python3/src/Lib/posixpath.py | python | isabs | (s) | return s.startswith(sep) | Test whether a path is absolute | Test whether a path is absolute | [
"Test",
"whether",
"a",
"path",
"is",
"absolute"
] | def isabs(s):
"""Test whether a path is absolute"""
s = os.fspath(s)
sep = _get_sep(s)
return s.startswith(sep) | [
"def",
"isabs",
"(",
"s",
")",
":",
"s",
"=",
"os",
".",
"fspath",
"(",
"s",
")",
"sep",
"=",
"_get_sep",
"(",
"s",
")",
"return",
"s",
".",
"startswith",
"(",
"sep",
")"
] | https://github.com/catboost/catboost/blob/167f64f237114a4d10b2b4ee42adb4569137debe/contrib/tools/python3/src/Lib/posixpath.py#L60-L64 | |
nvdla/sw | 79538ba1b52b040a4a4645f630e457fa01839e90 | umd/external/protobuf-2.6/python/google/protobuf/internal/cpp_message.py | python | RepeatedScalarProperty | (cdescriptor) | return property(Getter, Setter, doc=doc) | Returns a Python property the given repeated scalar field. | Returns a Python property the given repeated scalar field. | [
"Returns",
"a",
"Python",
"property",
"the",
"given",
"repeated",
"scalar",
"field",
"."
] | def RepeatedScalarProperty(cdescriptor):
"""Returns a Python property the given repeated scalar field."""
def Getter(self):
container = self._composite_fields.get(cdescriptor.name, None)
if container is None:
container = RepeatedScalarContainer(self, cdescriptor)
self._composite_fields[cdescrip... | [
"def",
"RepeatedScalarProperty",
"(",
"cdescriptor",
")",
":",
"def",
"Getter",
"(",
"self",
")",
":",
"container",
"=",
"self",
".",
"_composite_fields",
".",
"get",
"(",
"cdescriptor",
".",
"name",
",",
"None",
")",
"if",
"container",
"is",
"None",
":",
... | https://github.com/nvdla/sw/blob/79538ba1b52b040a4a4645f630e457fa01839e90/umd/external/protobuf-2.6/python/google/protobuf/internal/cpp_message.py#L169-L184 | |
nest/nest-simulator | f2623eb78518cdbd55e77e0ed486bf1111bcb62f | pynest/examples/structural_plasticity.py | python | StructralPlasticityExample.create_nodes | (self) | Assign growth curves to synaptic elements | Assign growth curves to synaptic elements | [
"Assign",
"growth",
"curves",
"to",
"synaptic",
"elements"
] | def create_nodes(self):
"""
Assign growth curves to synaptic elements
"""
synaptic_elements = {
'Den_ex': self.growth_curve_e_e,
'Den_in': self.growth_curve_e_i,
'Axon_ex': self.growth_curve_e_e,
}
synaptic_elements_i = {
... | [
"def",
"create_nodes",
"(",
"self",
")",
":",
"synaptic_elements",
"=",
"{",
"'Den_ex'",
":",
"self",
".",
"growth_curve_e_e",
",",
"'Den_in'",
":",
"self",
".",
"growth_curve_e_i",
",",
"'Axon_ex'",
":",
"self",
".",
"growth_curve_e_e",
",",
"}",
"synaptic_el... | https://github.com/nest/nest-simulator/blob/f2623eb78518cdbd55e77e0ed486bf1111bcb62f/pynest/examples/structural_plasticity.py#L197-L228 | ||
mindspore-ai/mindspore | fb8fd3338605bb34fa5cea054e535a8b1d753fab | mindspore/python/mindspore/dataset/transforms/py_transforms.py | python | not_random | (function) | return function | Specify the function as "not random", i.e., it produces deterministic result.
A Python function can only be cached after it is specified as "not random". | Specify the function as "not random", i.e., it produces deterministic result.
A Python function can only be cached after it is specified as "not random". | [
"Specify",
"the",
"function",
"as",
"not",
"random",
"i",
".",
"e",
".",
"it",
"produces",
"deterministic",
"result",
".",
"A",
"Python",
"function",
"can",
"only",
"be",
"cached",
"after",
"it",
"is",
"specified",
"as",
"not",
"random",
"."
] | def not_random(function):
"""
Specify the function as "not random", i.e., it produces deterministic result.
A Python function can only be cached after it is specified as "not random".
"""
function.random = False
return function | [
"def",
"not_random",
"(",
"function",
")",
":",
"function",
".",
"random",
"=",
"False",
"return",
"function"
] | https://github.com/mindspore-ai/mindspore/blob/fb8fd3338605bb34fa5cea054e535a8b1d753fab/mindspore/python/mindspore/dataset/transforms/py_transforms.py#L29-L35 | |
wxWidgets/wxPython-Classic | 19571e1ae65f1ac445f5491474121998c97a1bf0 | src/osx_cocoa/_core.py | python | Image_CanRead | (*args, **kwargs) | return _core_.Image_CanRead(*args, **kwargs) | Image_CanRead(String filename) -> bool
Returns True if the image handlers can read this file. | Image_CanRead(String filename) -> bool | [
"Image_CanRead",
"(",
"String",
"filename",
")",
"-",
">",
"bool"
] | def Image_CanRead(*args, **kwargs):
"""
Image_CanRead(String filename) -> bool
Returns True if the image handlers can read this file.
"""
return _core_.Image_CanRead(*args, **kwargs) | [
"def",
"Image_CanRead",
"(",
"*",
"args",
",",
"*",
"*",
"kwargs",
")",
":",
"return",
"_core_",
".",
"Image_CanRead",
"(",
"*",
"args",
",",
"*",
"*",
"kwargs",
")"
] | https://github.com/wxWidgets/wxPython-Classic/blob/19571e1ae65f1ac445f5491474121998c97a1bf0/src/osx_cocoa/_core.py#L3776-L3782 | |
tensorflow/tensorflow | 419e3a6b650ea4bd1b0cba23c4348f8a69f3272e | tensorflow/python/ops/parallel_for/pfor.py | python | WhileOp._convert_enter | (self, parent_pfor, enter) | return inp, stacked | Converts an Enter node. | Converts an Enter node. | [
"Converts",
"an",
"Enter",
"node",
"."
] | def _convert_enter(self, parent_pfor, enter):
"""Converts an Enter node."""
inp, stacked, _ = parent_pfor._convert_helper(enter.op.inputs[0])
control_inputs = []
for x in enter.op.control_inputs:
converted = parent_pfor._convert_helper(x)
if not isinstance(converted, ops.Operation):
... | [
"def",
"_convert_enter",
"(",
"self",
",",
"parent_pfor",
",",
"enter",
")",
":",
"inp",
",",
"stacked",
",",
"_",
"=",
"parent_pfor",
".",
"_convert_helper",
"(",
"enter",
".",
"op",
".",
"inputs",
"[",
"0",
"]",
")",
"control_inputs",
"=",
"[",
"]",
... | https://github.com/tensorflow/tensorflow/blob/419e3a6b650ea4bd1b0cba23c4348f8a69f3272e/tensorflow/python/ops/parallel_for/pfor.py#L438-L450 | |
aws/lumberyard | f85344403c1c2e77ec8c75deb2c116e97b713217 | dev/Tools/Python/3.7.10/windows/Lib/site-packages/pip/_vendor/pkg_resources/__init__.py | python | EntryPoint.resolve | (self) | Resolve the entry point from its module and attrs. | Resolve the entry point from its module and attrs. | [
"Resolve",
"the",
"entry",
"point",
"from",
"its",
"module",
"and",
"attrs",
"."
] | def resolve(self):
"""
Resolve the entry point from its module and attrs.
"""
module = __import__(self.module_name, fromlist=['__name__'], level=0)
try:
return functools.reduce(getattr, self.attrs, module)
except AttributeError as exc:
raise Import... | [
"def",
"resolve",
"(",
"self",
")",
":",
"module",
"=",
"__import__",
"(",
"self",
".",
"module_name",
",",
"fromlist",
"=",
"[",
"'__name__'",
"]",
",",
"level",
"=",
"0",
")",
"try",
":",
"return",
"functools",
".",
"reduce",
"(",
"getattr",
",",
"... | https://github.com/aws/lumberyard/blob/f85344403c1c2e77ec8c75deb2c116e97b713217/dev/Tools/Python/3.7.10/windows/Lib/site-packages/pip/_vendor/pkg_resources/__init__.py#L2445-L2453 | ||
apple/turicreate | cce55aa5311300e3ce6af93cb45ba791fd1bdf49 | src/external/coremltools_wrap/coremltools/coremltools/converters/onnx/_operators_nd.py | python | _convert_min | (builder, node, graph, err) | convert to CoreML Min Broadcastable Layer:
https://github.com/apple/coremltools/blob/655b3be5cc0d42c3c4fa49f0f0e4a93a26b3e492/mlmodel/format/NeuralNetwork.proto#L4135 | convert to CoreML Min Broadcastable Layer:
https://github.com/apple/coremltools/blob/655b3be5cc0d42c3c4fa49f0f0e4a93a26b3e492/mlmodel/format/NeuralNetwork.proto#L4135 | [
"convert",
"to",
"CoreML",
"Min",
"Broadcastable",
"Layer",
":",
"https",
":",
"//",
"github",
".",
"com",
"/",
"apple",
"/",
"coremltools",
"/",
"blob",
"/",
"655b3be5cc0d42c3c4fa49f0f0e4a93a26b3e492",
"/",
"mlmodel",
"/",
"format",
"/",
"NeuralNetwork",
".",
... | def _convert_min(builder, node, graph, err):
"""
convert to CoreML Min Broadcastable Layer:
https://github.com/apple/coremltools/blob/655b3be5cc0d42c3c4fa49f0f0e4a93a26b3e492/mlmodel/format/NeuralNetwork.proto#L4135
"""
load_input_constants(builder, node, graph, err)
add_broadcastable_op_chain(b... | [
"def",
"_convert_min",
"(",
"builder",
",",
"node",
",",
"graph",
",",
"err",
")",
":",
"load_input_constants",
"(",
"builder",
",",
"node",
",",
"graph",
",",
"err",
")",
"add_broadcastable_op_chain",
"(",
"builder",
",",
"node",
",",
"err",
",",
"builder... | https://github.com/apple/turicreate/blob/cce55aa5311300e3ce6af93cb45ba791fd1bdf49/src/external/coremltools_wrap/coremltools/coremltools/converters/onnx/_operators_nd.py#L1759-L1765 | ||
apple/turicreate | cce55aa5311300e3ce6af93cb45ba791fd1bdf49 | src/python/turicreate/meta/decompiler/control_flow_instructions.py | python | refactor_ifs | (stmnt, ifs) | return stmnt | for if statements in list comprehension | for if statements in list comprehension | [
"for",
"if",
"statements",
"in",
"list",
"comprehension"
] | def refactor_ifs(stmnt, ifs):
"""
for if statements in list comprehension
"""
if isinstance(stmnt, _ast.BoolOp):
test, right = stmnt.values
if isinstance(stmnt.op, _ast.Or):
test = _ast.UnaryOp(op=_ast.Not(), operand=test, lineno=0, col_offset=0)
ifs.append(test)
... | [
"def",
"refactor_ifs",
"(",
"stmnt",
",",
"ifs",
")",
":",
"if",
"isinstance",
"(",
"stmnt",
",",
"_ast",
".",
"BoolOp",
")",
":",
"test",
",",
"right",
"=",
"stmnt",
".",
"values",
"if",
"isinstance",
"(",
"stmnt",
".",
"op",
",",
"_ast",
".",
"Or... | https://github.com/apple/turicreate/blob/cce55aa5311300e3ce6af93cb45ba791fd1bdf49/src/python/turicreate/meta/decompiler/control_flow_instructions.py#L63-L75 | |
windystrife/UnrealEngine_NVIDIAGameWorks | b50e6338a7c5b26374d66306ebc7807541ff815e | Engine/Extras/ThirdPartyNotUE/emsdk/Win64/python/2.7.5.3_64bit/Lib/bdb.py | python | Bdb.set_step | (self) | Stop after one line of code. | Stop after one line of code. | [
"Stop",
"after",
"one",
"line",
"of",
"code",
"."
] | def set_step(self):
"""Stop after one line of code."""
# Issue #13183: pdb skips frames after hitting a breakpoint and running
# step commands.
# Restore the trace function in the caller (that may not have been set
# for performance reasons) when returning from the current frame.... | [
"def",
"set_step",
"(",
"self",
")",
":",
"# Issue #13183: pdb skips frames after hitting a breakpoint and running",
"# step commands.",
"# Restore the trace function in the caller (that may not have been set",
"# for performance reasons) when returning from the current frame.",
"if",
"self",
... | https://github.com/windystrife/UnrealEngine_NVIDIAGameWorks/blob/b50e6338a7c5b26374d66306ebc7807541ff815e/Engine/Extras/ThirdPartyNotUE/emsdk/Win64/python/2.7.5.3_64bit/Lib/bdb.py#L192-L202 | ||
wlanjie/AndroidFFmpeg | 7baf9122f4b8e1c74e7baf4be5c422c7a5ba5aaf | tools/fdk-aac-build/armeabi/toolchain/lib/python2.7/SocketServer.py | python | BaseServer.server_activate | (self) | Called by constructor to activate the server.
May be overridden. | Called by constructor to activate the server. | [
"Called",
"by",
"constructor",
"to",
"activate",
"the",
"server",
"."
] | def server_activate(self):
"""Called by constructor to activate the server.
May be overridden.
"""
pass | [
"def",
"server_activate",
"(",
"self",
")",
":",
"pass"
] | https://github.com/wlanjie/AndroidFFmpeg/blob/7baf9122f4b8e1c74e7baf4be5c422c7a5ba5aaf/tools/fdk-aac-build/armeabi/toolchain/lib/python2.7/SocketServer.py#L213-L219 | ||
mantidproject/mantid | 03deeb89254ec4289edb8771e0188c2090a02f32 | qt/python/mantidqt/mantidqt/widgets/superplot/presenter.py | python | SuperplotPresenter.get_kwargs_from_settings | (self) | return kwargs | Get the useful plot keyword arguments from the global settings.
Returns:
dict(str: str): plot keyword arguments | Get the useful plot keyword arguments from the global settings. | [
"Get",
"the",
"useful",
"plot",
"keyword",
"arguments",
"from",
"the",
"global",
"settings",
"."
] | def get_kwargs_from_settings(self):
"""
Get the useful plot keyword arguments from the global settings.
Returns:
dict(str: str): plot keyword arguments
"""
kwargs = dict()
kwargs['linestyle'] = ConfigService.getString("plots.line.Style")
kwargs['draws... | [
"def",
"get_kwargs_from_settings",
"(",
"self",
")",
":",
"kwargs",
"=",
"dict",
"(",
")",
"kwargs",
"[",
"'linestyle'",
"]",
"=",
"ConfigService",
".",
"getString",
"(",
"\"plots.line.Style\"",
")",
"kwargs",
"[",
"'drawstyle'",
"]",
"=",
"ConfigService",
"."... | https://github.com/mantidproject/mantid/blob/03deeb89254ec4289edb8771e0188c2090a02f32/qt/python/mantidqt/mantidqt/widgets/superplot/presenter.py#L205-L222 | |
catboost/catboost | 167f64f237114a4d10b2b4ee42adb4569137debe | contrib/python/pandas/py2/pandas/core/indexes/multi.py | python | MultiIndex.intersection | (self, other, sort=False) | Form the intersection of two MultiIndex objects.
Parameters
----------
other : MultiIndex or array / Index of tuples
sort : False or None, default False
Sort the resulting MultiIndex if possible
.. versionadded:: 0.24.0
.. versionchanged:: 0.24.1
... | Form the intersection of two MultiIndex objects. | [
"Form",
"the",
"intersection",
"of",
"two",
"MultiIndex",
"objects",
"."
] | def intersection(self, other, sort=False):
"""
Form the intersection of two MultiIndex objects.
Parameters
----------
other : MultiIndex or array / Index of tuples
sort : False or None, default False
Sort the resulting MultiIndex if possible
.. v... | [
"def",
"intersection",
"(",
"self",
",",
"other",
",",
"sort",
"=",
"False",
")",
":",
"self",
".",
"_validate_sort_keyword",
"(",
"sort",
")",
"self",
".",
"_assert_can_do_setop",
"(",
"other",
")",
"other",
",",
"result_names",
"=",
"self",
".",
"_conver... | https://github.com/catboost/catboost/blob/167f64f237114a4d10b2b4ee42adb4569137debe/contrib/python/pandas/py2/pandas/core/indexes/multi.py#L2930-L2971 | ||
aws/lumberyard | f85344403c1c2e77ec8c75deb2c116e97b713217 | dev/Tools/Python/3.7.10/windows/Lib/inspect.py | python | isclass | (object) | return isinstance(object, type) | Return true if the object is a class.
Class objects provide these attributes:
__doc__ documentation string
__module__ name of module in which this class was defined | Return true if the object is a class. | [
"Return",
"true",
"if",
"the",
"object",
"is",
"a",
"class",
"."
] | def isclass(object):
"""Return true if the object is a class.
Class objects provide these attributes:
__doc__ documentation string
__module__ name of module in which this class was defined"""
return isinstance(object, type) | [
"def",
"isclass",
"(",
"object",
")",
":",
"return",
"isinstance",
"(",
"object",
",",
"type",
")"
] | https://github.com/aws/lumberyard/blob/f85344403c1c2e77ec8c75deb2c116e97b713217/dev/Tools/Python/3.7.10/windows/Lib/inspect.py#L72-L78 | |
fatih/subvim | 241b6d170597857105da219c9b7d36059e9f11fb | vim/base/YouCompleteMe/third_party/bottle/bottle.py | python | AppStack.__call__ | (self) | return self[-1] | Return the current default application. | Return the current default application. | [
"Return",
"the",
"current",
"default",
"application",
"."
] | def __call__(self):
""" Return the current default application. """
return self[-1] | [
"def",
"__call__",
"(",
"self",
")",
":",
"return",
"self",
"[",
"-",
"1",
"]"
] | https://github.com/fatih/subvim/blob/241b6d170597857105da219c9b7d36059e9f11fb/vim/base/YouCompleteMe/third_party/bottle/bottle.py#L2112-L2114 | |
hpi-xnor/BMXNet-v2 | af2b1859eafc5c721b1397cef02f946aaf2ce20d | python/mxnet/ndarray/ndarray.py | python | from_numpy | (ndarray, zero_copy=True) | return NDArray(handle=handle) | Returns an MXNet's ndarray backed by numpy's ndarray.
When `zero_copy` is set to be true,
this API consumes numpy's ndarray and produces MXNet's ndarray
without having to copy the content. In this case, we disallow
users to modify the given numpy ndarray, and it is suggested
not to read the numpy nd... | Returns an MXNet's ndarray backed by numpy's ndarray.
When `zero_copy` is set to be true,
this API consumes numpy's ndarray and produces MXNet's ndarray
without having to copy the content. In this case, we disallow
users to modify the given numpy ndarray, and it is suggested
not to read the numpy nd... | [
"Returns",
"an",
"MXNet",
"s",
"ndarray",
"backed",
"by",
"numpy",
"s",
"ndarray",
".",
"When",
"zero_copy",
"is",
"set",
"to",
"be",
"true",
"this",
"API",
"consumes",
"numpy",
"s",
"ndarray",
"and",
"produces",
"MXNet",
"s",
"ndarray",
"without",
"having... | def from_numpy(ndarray, zero_copy=True):
"""Returns an MXNet's ndarray backed by numpy's ndarray.
When `zero_copy` is set to be true,
this API consumes numpy's ndarray and produces MXNet's ndarray
without having to copy the content. In this case, we disallow
users to modify the given numpy ndarray, ... | [
"def",
"from_numpy",
"(",
"ndarray",
",",
"zero_copy",
"=",
"True",
")",
":",
"def",
"_make_manager_ctx",
"(",
"obj",
")",
":",
"pyobj",
"=",
"ctypes",
".",
"py_object",
"(",
"obj",
")",
"void_p",
"=",
"ctypes",
".",
"c_void_p",
".",
"from_buffer",
"(",
... | https://github.com/hpi-xnor/BMXNet-v2/blob/af2b1859eafc5c721b1397cef02f946aaf2ce20d/python/mxnet/ndarray/ndarray.py#L4238-L4297 | |
olliw42/storm32bgc | 99d62a6130ae2950514022f50eb669c45a8cc1ba | old/betacopter/old/betacopter36dev-v005/modules/uavcan/libuavcan/dsdl_compiler/libuavcan_dsdl_compiler/pyratemp.py | python | TemplateBase.__str__ | (self) | return self.__call__() | Alias for __call__(). | Alias for __call__(). | [
"Alias",
"for",
"__call__",
"()",
"."
] | def __str__(self):
"""Alias for __call__()."""
return self.__call__() | [
"def",
"__str__",
"(",
"self",
")",
":",
"return",
"self",
".",
"__call__",
"(",
")"
] | https://github.com/olliw42/storm32bgc/blob/99d62a6130ae2950514022f50eb669c45a8cc1ba/old/betacopter/old/betacopter36dev-v005/modules/uavcan/libuavcan/dsdl_compiler/libuavcan_dsdl_compiler/pyratemp.py#L1037-L1039 | |
gimli-org/gimli | 17aa2160de9b15ababd9ef99e89b1bc3277bbb23 | pygimli/physics/em/hemmodelling.py | python | hankelfc | (order) | return (np.reshape(fc, (-1, 1)), nc, nc0) | Filter coefficients for Hankel transformation. | Filter coefficients for Hankel transformation. | [
"Filter",
"coefficients",
"for",
"Hankel",
"transformation",
"."
] | def hankelfc(order):
"""Filter coefficients for Hankel transformation."""
if order == 1: # sin
fc = np.array([
2.59526236e-7, 3.66544843e-7, 5.17830795e-7, 7.31340622e-7,
1.03322805e-6, 1.45918500e-6, 2.06161065e-6, 2.91137793e-6,
4.11357863e-6, 5.80876420e-6, 8.2079... | [
"def",
"hankelfc",
"(",
"order",
")",
":",
"if",
"order",
"==",
"1",
":",
"# sin",
"fc",
"=",
"np",
".",
"array",
"(",
"[",
"2.59526236e-7",
",",
"3.66544843e-7",
",",
"5.17830795e-7",
",",
"7.31340622e-7",
",",
"1.03322805e-6",
",",
"1.45918500e-6",
",",
... | https://github.com/gimli-org/gimli/blob/17aa2160de9b15ababd9ef99e89b1bc3277bbb23/pygimli/physics/em/hemmodelling.py#L330-L463 | |
s9xie/DSN | 065e49898d239f5c96be558616b2556eabc50351 | scripts/cpp_lint.py | python | _NamespaceInfo.CheckEnd | (self, filename, clean_lines, linenum, error) | Check end of namespace comments. | Check end of namespace comments. | [
"Check",
"end",
"of",
"namespace",
"comments",
"."
] | def CheckEnd(self, filename, clean_lines, linenum, error):
"""Check end of namespace comments."""
line = clean_lines.raw_lines[linenum]
# Check how many lines is enclosed in this namespace. Don't issue
# warning for missing namespace comments if there aren't enough
# lines. However, do apply chec... | [
"def",
"CheckEnd",
"(",
"self",
",",
"filename",
",",
"clean_lines",
",",
"linenum",
",",
"error",
")",
":",
"line",
"=",
"clean_lines",
".",
"raw_lines",
"[",
"linenum",
"]",
"# Check how many lines is enclosed in this namespace. Don't issue",
"# warning for missing n... | https://github.com/s9xie/DSN/blob/065e49898d239f5c96be558616b2556eabc50351/scripts/cpp_lint.py#L1751-L1794 | ||
catboost/catboost | 167f64f237114a4d10b2b4ee42adb4569137debe | contrib/tools/python3/src/Lib/distutils/cmd.py | python | Command.debug_print | (self, msg) | Print 'msg' to stdout if the global DEBUG (taken from the
DISTUTILS_DEBUG environment variable) flag is true. | Print 'msg' to stdout if the global DEBUG (taken from the
DISTUTILS_DEBUG environment variable) flag is true. | [
"Print",
"msg",
"to",
"stdout",
"if",
"the",
"global",
"DEBUG",
"(",
"taken",
"from",
"the",
"DISTUTILS_DEBUG",
"environment",
"variable",
")",
"flag",
"is",
"true",
"."
] | def debug_print(self, msg):
"""Print 'msg' to stdout if the global DEBUG (taken from the
DISTUTILS_DEBUG environment variable) flag is true.
"""
from distutils.debug import DEBUG
if DEBUG:
print(msg)
sys.stdout.flush() | [
"def",
"debug_print",
"(",
"self",
",",
"msg",
")",
":",
"from",
"distutils",
".",
"debug",
"import",
"DEBUG",
"if",
"DEBUG",
":",
"print",
"(",
"msg",
")",
"sys",
".",
"stdout",
".",
"flush",
"(",
")"
] | https://github.com/catboost/catboost/blob/167f64f237114a4d10b2b4ee42adb4569137debe/contrib/tools/python3/src/Lib/distutils/cmd.py#L184-L191 | ||
wxWidgets/wxPython-Classic | 19571e1ae65f1ac445f5491474121998c97a1bf0 | src/osx_carbon/html.py | python | HtmlRenderingStyle.GetSelectedTextColour | (*args, **kwargs) | return _html.HtmlRenderingStyle_GetSelectedTextColour(*args, **kwargs) | GetSelectedTextColour(self, Colour clr) -> Colour | GetSelectedTextColour(self, Colour clr) -> Colour | [
"GetSelectedTextColour",
"(",
"self",
"Colour",
"clr",
")",
"-",
">",
"Colour"
] | def GetSelectedTextColour(*args, **kwargs):
"""GetSelectedTextColour(self, Colour clr) -> Colour"""
return _html.HtmlRenderingStyle_GetSelectedTextColour(*args, **kwargs) | [
"def",
"GetSelectedTextColour",
"(",
"*",
"args",
",",
"*",
"*",
"kwargs",
")",
":",
"return",
"_html",
".",
"HtmlRenderingStyle_GetSelectedTextColour",
"(",
"*",
"args",
",",
"*",
"*",
"kwargs",
")"
] | https://github.com/wxWidgets/wxPython-Classic/blob/19571e1ae65f1ac445f5491474121998c97a1bf0/src/osx_carbon/html.py#L543-L545 | |
GeometryCollective/boundary-first-flattening | 8250e5a0e85980ec50b5e8aa8f49dd6519f915cd | deps/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/GeometryCollective/boundary-first-flattening/blob/8250e5a0e85980ec50b5e8aa8f49dd6519f915cd/deps/nanogui/docs/exhale.py#L1653-L1689 | ||
wxWidgets/wxPython-Classic | 19571e1ae65f1ac445f5491474121998c97a1bf0 | src/osx_cocoa/_windows.py | python | StandardDialogLayoutAdapter.__init__ | (self, *args, **kwargs) | __init__(self) -> StandardDialogLayoutAdapter | __init__(self) -> StandardDialogLayoutAdapter | [
"__init__",
"(",
"self",
")",
"-",
">",
"StandardDialogLayoutAdapter"
] | def __init__(self, *args, **kwargs):
"""__init__(self) -> StandardDialogLayoutAdapter"""
_windows_.StandardDialogLayoutAdapter_swiginit(self,_windows_.new_StandardDialogLayoutAdapter(*args, **kwargs)) | [
"def",
"__init__",
"(",
"self",
",",
"*",
"args",
",",
"*",
"*",
"kwargs",
")",
":",
"_windows_",
".",
"StandardDialogLayoutAdapter_swiginit",
"(",
"self",
",",
"_windows_",
".",
"new_StandardDialogLayoutAdapter",
"(",
"*",
"args",
",",
"*",
"*",
"kwargs",
"... | https://github.com/wxWidgets/wxPython-Classic/blob/19571e1ae65f1ac445f5491474121998c97a1bf0/src/osx_cocoa/_windows.py#L976-L978 | ||
thalium/icebox | 99d147d5b9269222225443ce171b4fd46d8985d4 | src/icebox/icebox_py/__init__.py | python | Processes.break_on_create | (self, callback) | return BreakpointId(bpid, fproc) | Return breakpoint on process creation. | Return breakpoint on process creation. | [
"Return",
"breakpoint",
"on",
"process",
"creation",
"."
] | def break_on_create(self, callback):
"""Return breakpoint on process creation."""
def fproc(proc):
return callback(Process(proc))
bpid = libicebox.process_listen_create(fproc)
return BreakpointId(bpid, fproc) | [
"def",
"break_on_create",
"(",
"self",
",",
"callback",
")",
":",
"def",
"fproc",
"(",
"proc",
")",
":",
"return",
"callback",
"(",
"Process",
"(",
"proc",
")",
")",
"bpid",
"=",
"libicebox",
".",
"process_listen_create",
"(",
"fproc",
")",
"return",
"Br... | https://github.com/thalium/icebox/blob/99d147d5b9269222225443ce171b4fd46d8985d4/src/icebox/icebox_py/__init__.py#L402-L409 | |
ValveSoftware/source-sdk-2013 | 0d8dceea4310fde5706b3ce1c70609d72a38efdf | mp/src/thirdparty/protobuf-2.3.0/python/mox.py | python | Or.equals | (self, rhs) | return False | Checks whether any Comparator is equal to rhs.
Args:
# rhs: can be anything
Returns:
bool | Checks whether any Comparator is equal to rhs. | [
"Checks",
"whether",
"any",
"Comparator",
"is",
"equal",
"to",
"rhs",
"."
] | def equals(self, rhs):
"""Checks whether any Comparator is equal to rhs.
Args:
# rhs: can be anything
Returns:
bool
"""
for comparator in self._comparators:
if comparator.equals(rhs):
return True
return False | [
"def",
"equals",
"(",
"self",
",",
"rhs",
")",
":",
"for",
"comparator",
"in",
"self",
".",
"_comparators",
":",
"if",
"comparator",
".",
"equals",
"(",
"rhs",
")",
":",
"return",
"True",
"return",
"False"
] | https://github.com/ValveSoftware/source-sdk-2013/blob/0d8dceea4310fde5706b3ce1c70609d72a38efdf/mp/src/thirdparty/protobuf-2.3.0/python/mox.py#L1092-L1106 | |
Tencent/CMONGO | c40380caa14e05509f46993aa8b8da966b09b0b5 | src/third_party/scons-2.5.0/scons-local-2.5.0/SCons/Script/SConscript.py | python | SConsEnvironment._get_major_minor_revision | (self, version_string) | return v_major, v_minor, v_revision | Split a version string into major, minor and (optionally)
revision parts.
This is complicated by the fact that a version string can be
something like 3.2b1. | Split a version string into major, minor and (optionally)
revision parts. | [
"Split",
"a",
"version",
"string",
"into",
"major",
"minor",
"and",
"(",
"optionally",
")",
"revision",
"parts",
"."
] | def _get_major_minor_revision(self, version_string):
"""Split a version string into major, minor and (optionally)
revision parts.
This is complicated by the fact that a version string can be
something like 3.2b1."""
version = version_string.split(' ')[0].split('.')
v_maj... | [
"def",
"_get_major_minor_revision",
"(",
"self",
",",
"version_string",
")",
":",
"version",
"=",
"version_string",
".",
"split",
"(",
"' '",
")",
"[",
"0",
"]",
".",
"split",
"(",
"'.'",
")",
"v_major",
"=",
"int",
"(",
"version",
"[",
"0",
"]",
")",
... | https://github.com/Tencent/CMONGO/blob/c40380caa14e05509f46993aa8b8da966b09b0b5/src/third_party/scons-2.5.0/scons-local-2.5.0/SCons/Script/SConscript.py#L354-L367 | |
Tencent/ncnn | 6f824c57a1f8ee6dd3902fb13bef947cf4e6a73f | python/ncnn/model_zoo/mobilenetv2ssdlite.py | python | MobileNetV2_SSDLite.__call__ | (self, img) | return objects | #method 2, use ncnn.Mat->numpy.array to get the result, no memory copy too
out = np.array(mat_out)
for i in range(len(out)):
values = out[i]
obj = Detect_Object()
obj.label = values[0]
obj.prob = values[1]
obj.rect.x = values[2] * img_w
... | #method 2, use ncnn.Mat->numpy.array to get the result, no memory copy too
out = np.array(mat_out)
for i in range(len(out)):
values = out[i]
obj = Detect_Object()
obj.label = values[0]
obj.prob = values[1]
obj.rect.x = values[2] * img_w
... | [
"#method",
"2",
"use",
"ncnn",
".",
"Mat",
"-",
">",
"numpy",
".",
"array",
"to",
"get",
"the",
"result",
"no",
"memory",
"copy",
"too",
"out",
"=",
"np",
".",
"array",
"(",
"mat_out",
")",
"for",
"i",
"in",
"range",
"(",
"len",
"(",
"out",
"))",... | def __call__(self, img):
img_h = img.shape[0]
img_w = img.shape[1]
mat_in = ncnn.Mat.from_pixels_resize(
img,
ncnn.Mat.PixelType.PIXEL_BGR,
img_w,
img_h,
self.target_size,
self.target_size,
)
mat_in.substrac... | [
"def",
"__call__",
"(",
"self",
",",
"img",
")",
":",
"img_h",
"=",
"img",
".",
"shape",
"[",
"0",
"]",
"img_w",
"=",
"img",
".",
"shape",
"[",
"1",
"]",
"mat_in",
"=",
"ncnn",
".",
"Mat",
".",
"from_pixels_resize",
"(",
"img",
",",
"ncnn",
".",
... | https://github.com/Tencent/ncnn/blob/6f824c57a1f8ee6dd3902fb13bef947cf4e6a73f/python/ncnn/model_zoo/mobilenetv2ssdlite.py#L74-L129 | |
wxWidgets/wxPython-Classic | 19571e1ae65f1ac445f5491474121998c97a1bf0 | src/gtk/_misc.py | python | DateSpan.__isub__ | (*args, **kwargs) | return _misc_.DateSpan___isub__(*args, **kwargs) | __isub__(self, DateSpan other) -> DateSpan | __isub__(self, DateSpan other) -> DateSpan | [
"__isub__",
"(",
"self",
"DateSpan",
"other",
")",
"-",
">",
"DateSpan"
] | def __isub__(*args, **kwargs):
"""__isub__(self, DateSpan other) -> DateSpan"""
return _misc_.DateSpan___isub__(*args, **kwargs) | [
"def",
"__isub__",
"(",
"*",
"args",
",",
"*",
"*",
"kwargs",
")",
":",
"return",
"_misc_",
".",
"DateSpan___isub__",
"(",
"*",
"args",
",",
"*",
"*",
"kwargs",
")"
] | https://github.com/wxWidgets/wxPython-Classic/blob/19571e1ae65f1ac445f5491474121998c97a1bf0/src/gtk/_misc.py#L4709-L4711 | |
hughperkins/tf-coriander | 970d3df6c11400ad68405f22b0c42a52374e94ca | tensorflow/python/training/supervisor.py | python | Supervisor.summary_writer | (self) | return self._summary_writer | Return the SummaryWriter used by the chief supervisor.
Returns:
A SummaryWriter. | Return the SummaryWriter used by the chief supervisor. | [
"Return",
"the",
"SummaryWriter",
"used",
"by",
"the",
"chief",
"supervisor",
"."
] | def summary_writer(self):
"""Return the SummaryWriter used by the chief supervisor.
Returns:
A SummaryWriter.
"""
return self._summary_writer | [
"def",
"summary_writer",
"(",
"self",
")",
":",
"return",
"self",
".",
"_summary_writer"
] | https://github.com/hughperkins/tf-coriander/blob/970d3df6c11400ad68405f22b0c42a52374e94ca/tensorflow/python/training/supervisor.py#L557-L563 | |
aws/lumberyard | f85344403c1c2e77ec8c75deb2c116e97b713217 | dev/Tools/Python/3.7.10/linux_x64/lib/python3.7/encodings/punycode.py | python | generate_integers | (baselen, deltas) | return bytes(result) | 3.4 Bias adaptation | 3.4 Bias adaptation | [
"3",
".",
"4",
"Bias",
"adaptation"
] | def generate_integers(baselen, deltas):
"""3.4 Bias adaptation"""
# Punycode parameters: initial bias = 72, damp = 700, skew = 38
result = bytearray()
bias = 72
for points, delta in enumerate(deltas):
s = generate_generalized_integer(delta, bias)
result.extend(s)
bias = adapt... | [
"def",
"generate_integers",
"(",
"baselen",
",",
"deltas",
")",
":",
"# Punycode parameters: initial bias = 72, damp = 700, skew = 38",
"result",
"=",
"bytearray",
"(",
")",
"bias",
"=",
"72",
"for",
"points",
",",
"delta",
"in",
"enumerate",
"(",
"deltas",
")",
"... | https://github.com/aws/lumberyard/blob/f85344403c1c2e77ec8c75deb2c116e97b713217/dev/Tools/Python/3.7.10/linux_x64/lib/python3.7/encodings/punycode.py#L106-L115 | |
benoitsteiner/tensorflow-opencl | cb7cb40a57fde5cfd4731bc551e82a1e2fef43a5 | tensorflow/tools/docs/parser.py | python | _ClassPageInfo.other_members | (self) | return self._other_members | Returns a list of `_OtherMemberInfo` describing any other contents. | Returns a list of `_OtherMemberInfo` describing any other contents. | [
"Returns",
"a",
"list",
"of",
"_OtherMemberInfo",
"describing",
"any",
"other",
"contents",
"."
] | def other_members(self):
"""Returns a list of `_OtherMemberInfo` describing any other contents."""
return self._other_members | [
"def",
"other_members",
"(",
"self",
")",
":",
"return",
"self",
".",
"_other_members"
] | https://github.com/benoitsteiner/tensorflow-opencl/blob/cb7cb40a57fde5cfd4731bc551e82a1e2fef43a5/tensorflow/tools/docs/parser.py#L1054-L1056 | |
apache/incubator-mxnet | f03fb23f1d103fec9541b5ae59ee06b1734a51d9 | python/mxnet/profiler.py | python | Counter.set_value | (self, value) | Set counter value.
Parameters
----------
value : int
Value for the counter | Set counter value. | [
"Set",
"counter",
"value",
"."
] | def set_value(self, value):
"""Set counter value.
Parameters
----------
value : int
Value for the counter
"""
check_call(_LIB.MXProfileSetCounter(self.handle, int(value))) | [
"def",
"set_value",
"(",
"self",
",",
"value",
")",
":",
"check_call",
"(",
"_LIB",
".",
"MXProfileSetCounter",
"(",
"self",
".",
"handle",
",",
"int",
"(",
"value",
")",
")",
")"
] | https://github.com/apache/incubator-mxnet/blob/f03fb23f1d103fec9541b5ae59ee06b1734a51d9/python/mxnet/profiler.py#L435-L443 | ||
htcondor/htcondor | 4829724575176d1d6c936e4693dfd78a728569b0 | src/condor_contrib/condor_pigeon/src/condor_pigeon_client/skype_linux_tools/Skype4Py/skype.py | python | ISkypeEvents.CallStatus | (self, Call, Status) | This event is caused by a change in call status.
@param Call: Call object.
@type Call: L{ICall}
@param Status: New status of the call.
@type Status: L{Call status<enums.clsUnknown>} | This event is caused by a change in call status. | [
"This",
"event",
"is",
"caused",
"by",
"a",
"change",
"in",
"call",
"status",
"."
] | def CallStatus(self, Call, Status):
'''This event is caused by a change in call status.
@param Call: Call object.
@type Call: L{ICall}
@param Status: New status of the call.
@type Status: L{Call status<enums.clsUnknown>}
''' | [
"def",
"CallStatus",
"(",
"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#L1410-L1417 | ||
panda3d/panda3d | 833ad89ebad58395d0af0b7ec08538e5e4308265 | samples/culling/portal_culling.py | python | CellManager.add_cell | (self, collider, name) | Add a new cell. | Add a new cell. | [
"Add",
"a",
"new",
"cell",
"."
] | def add_cell(self, collider, name):
"""Add a new cell."""
cell = Cell(self, name, collider)
self.cells[name] = cell
self.cells_by_collider[collider.node()] = cell | [
"def",
"add_cell",
"(",
"self",
",",
"collider",
",",
"name",
")",
":",
"cell",
"=",
"Cell",
"(",
"self",
",",
"name",
",",
"collider",
")",
"self",
".",
"cells",
"[",
"name",
"]",
"=",
"cell",
"self",
".",
"cells_by_collider",
"[",
"collider",
".",
... | https://github.com/panda3d/panda3d/blob/833ad89ebad58395d0af0b7ec08538e5e4308265/samples/culling/portal_culling.py#L191-L195 | ||
tensorflow/io | 92b44e180674a8af0e12e405530f7343e3e693e4 | tensorflow_io/python/experimental/serialization_ops.py | python | process_record | (data, name) | return {
v["name"]: process_entry(v, "{}/{}".format(name, v["name"]))
for v in data["fields"]
} | process_record | process_record | [
"process_record"
] | def process_record(data, name):
"""process_record"""
return {
v["name"]: process_entry(v, "{}/{}".format(name, v["name"]))
for v in data["fields"]
} | [
"def",
"process_record",
"(",
"data",
",",
"name",
")",
":",
"return",
"{",
"v",
"[",
"\"name\"",
"]",
":",
"process_entry",
"(",
"v",
",",
"\"{}/{}\"",
".",
"format",
"(",
"name",
",",
"v",
"[",
"\"name\"",
"]",
")",
")",
"for",
"v",
"in",
"data",... | https://github.com/tensorflow/io/blob/92b44e180674a8af0e12e405530f7343e3e693e4/tensorflow_io/python/experimental/serialization_ops.py#L96-L101 | |
openvinotoolkit/openvino | dedcbeafa8b84cccdc55ca64b8da516682b381c7 | tools/mo/openvino/tools/mo/front/subgraph_matcher.py | python | find_object_by_pattern | (names: list, pattern: str) | return [name for name in names if re.match(compiled_pattern, name)] | :param names: list of names to find objects from.
:param pattern: regular expression for the name.
:return: list of matched objects. | :param names: list of names to find objects from.
:param pattern: regular expression for the name.
:return: list of matched objects. | [
":",
"param",
"names",
":",
"list",
"of",
"names",
"to",
"find",
"objects",
"from",
".",
":",
"param",
"pattern",
":",
"regular",
"expression",
"for",
"the",
"name",
".",
":",
"return",
":",
"list",
"of",
"matched",
"objects",
"."
] | def find_object_by_pattern(names: list, pattern: str):
"""
:param names: list of names to find objects from.
:param pattern: regular expression for the name.
:return: list of matched objects.
"""
compiled_pattern = re.compile(pattern)
return [name for name in names if re.match(compiled_patte... | [
"def",
"find_object_by_pattern",
"(",
"names",
":",
"list",
",",
"pattern",
":",
"str",
")",
":",
"compiled_pattern",
"=",
"re",
".",
"compile",
"(",
"pattern",
")",
"return",
"[",
"name",
"for",
"name",
"in",
"names",
"if",
"re",
".",
"match",
"(",
"c... | https://github.com/openvinotoolkit/openvino/blob/dedcbeafa8b84cccdc55ca64b8da516682b381c7/tools/mo/openvino/tools/mo/front/subgraph_matcher.py#L14-L21 | |
natanielruiz/android-yolo | 1ebb54f96a67a20ff83ddfc823ed83a13dc3a47f | jni-build/jni/include/tensorflow/contrib/distributions/python/ops/bernoulli.py | python | Bernoulli.log_prob | (self, event, name="log_prob") | Log of the probability mass function.
Args:
event: `int32` or `int64` binary Tensor.
name: A name for this operation (optional).
Returns:
The log-probabilities of the events. | Log of the probability mass function. | [
"Log",
"of",
"the",
"probability",
"mass",
"function",
"."
] | def log_prob(self, event, name="log_prob"):
"""Log of the probability mass function.
Args:
event: `int32` or `int64` binary Tensor.
name: A name for this operation (optional).
Returns:
The log-probabilities of the events.
"""
# TODO(jaana): The current sigmoid_cross_entropy_with_... | [
"def",
"log_prob",
"(",
"self",
",",
"event",
",",
"name",
"=",
"\"log_prob\"",
")",
":",
"# TODO(jaana): The current sigmoid_cross_entropy_with_logits has",
"# inconsistent behavior for logits = inf/-inf.",
"with",
"ops",
".",
"name_scope",
"(",
"self",
".",
"name",
")"... | https://github.com/natanielruiz/android-yolo/blob/1ebb54f96a67a20ff83ddfc823ed83a13dc3a47f/jni-build/jni/include/tensorflow/contrib/distributions/python/ops/bernoulli.py#L145-L171 | ||
wlanjie/AndroidFFmpeg | 7baf9122f4b8e1c74e7baf4be5c422c7a5ba5aaf | tools/fdk-aac-build/armeabi-v7a/toolchain/lib/python2.7/lib-tk/Tkinter.py | python | Scrollbar.activate | (self, index) | Display the element at INDEX with activebackground and activerelief.
INDEX can be "arrow1","slider" or "arrow2". | Display the element at INDEX with activebackground and activerelief.
INDEX can be "arrow1","slider" or "arrow2". | [
"Display",
"the",
"element",
"at",
"INDEX",
"with",
"activebackground",
"and",
"activerelief",
".",
"INDEX",
"can",
"be",
"arrow1",
"slider",
"or",
"arrow2",
"."
] | def activate(self, index):
"""Display the element at INDEX with activebackground and activerelief.
INDEX can be "arrow1","slider" or "arrow2"."""
self.tk.call(self._w, 'activate', index) | [
"def",
"activate",
"(",
"self",
",",
"index",
")",
":",
"self",
".",
"tk",
".",
"call",
"(",
"self",
".",
"_w",
",",
"'activate'",
",",
"index",
")"
] | https://github.com/wlanjie/AndroidFFmpeg/blob/7baf9122f4b8e1c74e7baf4be5c422c7a5ba5aaf/tools/fdk-aac-build/armeabi-v7a/toolchain/lib/python2.7/lib-tk/Tkinter.py#L2836-L2839 | ||
Tencent/mars | 54969ba56b402a622db123e780a4f760b38c5c36 | mars/lint/cpplint.py | python | _CppLintState.SetOutputFormat | (self, output_format) | Sets the output format for errors. | Sets the output format for errors. | [
"Sets",
"the",
"output",
"format",
"for",
"errors",
"."
] | def SetOutputFormat(self, output_format):
"""Sets the output format for errors."""
self.output_format = output_format | [
"def",
"SetOutputFormat",
"(",
"self",
",",
"output_format",
")",
":",
"self",
".",
"output_format",
"=",
"output_format"
] | https://github.com/Tencent/mars/blob/54969ba56b402a622db123e780a4f760b38c5c36/mars/lint/cpplint.py#L776-L778 | ||
catboost/catboost | 167f64f237114a4d10b2b4ee42adb4569137debe | contrib/python/scipy/py2/scipy/linalg/_matfuncs_inv_ssq.py | python | _briggs_helper_function | (a, k) | Computes r = a^(1 / (2^k)) - 1.
This is algorithm (2) of [1]_.
The purpose is to avoid a danger of subtractive cancellation.
For more computational efficiency it should probably be cythonized.
Parameters
----------
a : complex
A complex number.
k : integer
A nonnegative int... | Computes r = a^(1 / (2^k)) - 1. | [
"Computes",
"r",
"=",
"a^",
"(",
"1",
"/",
"(",
"2^k",
"))",
"-",
"1",
"."
] | def _briggs_helper_function(a, k):
"""
Computes r = a^(1 / (2^k)) - 1.
This is algorithm (2) of [1]_.
The purpose is to avoid a danger of subtractive cancellation.
For more computational efficiency it should probably be cythonized.
Parameters
----------
a : complex
A complex nu... | [
"def",
"_briggs_helper_function",
"(",
"a",
",",
"k",
")",
":",
"if",
"k",
"<",
"0",
"or",
"int",
"(",
"k",
")",
"!=",
"k",
":",
"raise",
"ValueError",
"(",
"'expected a nonnegative integer k'",
")",
"if",
"k",
"==",
"0",
":",
"return",
"a",
"-",
"1"... | https://github.com/catboost/catboost/blob/167f64f237114a4d10b2b4ee42adb4569137debe/contrib/python/scipy/py2/scipy/linalg/_matfuncs_inv_ssq.py#L156-L208 | ||
aws/lumberyard | f85344403c1c2e77ec8c75deb2c116e97b713217 | dev/Tools/Python/3.7.10/mac/Python.framework/Versions/3.7/lib/python3.7/importlib/_bootstrap_external.py | python | SourceLoader.set_data | (self, path, data) | Optional method which writes data (bytes) to a file path (a str).
Implementing this method allows for the writing of bytecode files. | Optional method which writes data (bytes) to a file path (a str). | [
"Optional",
"method",
"which",
"writes",
"data",
"(",
"bytes",
")",
"to",
"a",
"file",
"path",
"(",
"a",
"str",
")",
"."
] | def set_data(self, path, data):
"""Optional method which writes data (bytes) to a file path (a str).
Implementing this method allows for the writing of bytecode files.
""" | [
"def",
"set_data",
"(",
"self",
",",
"path",
",",
"data",
")",
":"
] | https://github.com/aws/lumberyard/blob/f85344403c1c2e77ec8c75deb2c116e97b713217/dev/Tools/Python/3.7.10/mac/Python.framework/Versions/3.7/lib/python3.7/importlib/_bootstrap_external.py#L768-L772 | ||
wlanjie/AndroidFFmpeg | 7baf9122f4b8e1c74e7baf4be5c422c7a5ba5aaf | tools/fdk-aac-build/x86/toolchain/lib/python2.7/lib-tk/turtle.py | python | TurtleScreenBase._blankimage | () | return img | return a blank image object | return a blank image object | [
"return",
"a",
"blank",
"image",
"object"
] | def _blankimage():
"""return a blank image object
"""
img = TK.PhotoImage(width=1, height=1)
img.blank()
return img | [
"def",
"_blankimage",
"(",
")",
":",
"img",
"=",
"TK",
".",
"PhotoImage",
"(",
"width",
"=",
"1",
",",
"height",
"=",
"1",
")",
"img",
".",
"blank",
"(",
")",
"return",
"img"
] | https://github.com/wlanjie/AndroidFFmpeg/blob/7baf9122f4b8e1c74e7baf4be5c422c7a5ba5aaf/tools/fdk-aac-build/x86/toolchain/lib/python2.7/lib-tk/turtle.py#L491-L496 | |
benoitsteiner/tensorflow-opencl | cb7cb40a57fde5cfd4731bc551e82a1e2fef43a5 | tensorflow/contrib/distributions/python/ops/sinh_arcsinh.py | python | SinhArcsinh.scale | (self) | return self._scale | The `LinearOperator` `scale` in `Y := loc + scale @ F(Z) * (2 / F(2)). | The `LinearOperator` `scale` in `Y := loc + scale | [
"The",
"LinearOperator",
"scale",
"in",
"Y",
":",
"=",
"loc",
"+",
"scale"
] | def scale(self):
"""The `LinearOperator` `scale` in `Y := loc + scale @ F(Z) * (2 / F(2))."""
return self._scale | [
"def",
"scale",
"(",
"self",
")",
":",
"return",
"self",
".",
"_scale"
] | https://github.com/benoitsteiner/tensorflow-opencl/blob/cb7cb40a57fde5cfd4731bc551e82a1e2fef43a5/tensorflow/contrib/distributions/python/ops/sinh_arcsinh.py#L205-L207 | |
raymondlu/super-animation-samples | 04234269112ff0dc32447f27a761dbbb00b8ba17 | samples/cocos2d-x-3.1/CocosLuaGame2/frameworks/cocos2d-x/download-deps.py | python | CocosZipInstaller.unpack_zipfile | (self, extract_dir) | Unpack zip `filename` to `extract_dir`
Raises ``UnrecognizedFormat`` if `filename` is not a zipfile (as determined
by ``zipfile.is_zipfile()``). | Unpack zip `filename` to `extract_dir` | [
"Unpack",
"zip",
"filename",
"to",
"extract_dir"
] | def unpack_zipfile(self, extract_dir):
"""Unpack zip `filename` to `extract_dir`
Raises ``UnrecognizedFormat`` if `filename` is not a zipfile (as determined
by ``zipfile.is_zipfile()``).
"""
if not zipfile.is_zipfile(self._filename):
raise UnrecognizedFormat("%s is ... | [
"def",
"unpack_zipfile",
"(",
"self",
",",
"extract_dir",
")",
":",
"if",
"not",
"zipfile",
".",
"is_zipfile",
"(",
"self",
".",
"_filename",
")",
":",
"raise",
"UnrecognizedFormat",
"(",
"\"%s is not a zip file\"",
"%",
"(",
"self",
".",
"_filename",
")",
"... | https://github.com/raymondlu/super-animation-samples/blob/04234269112ff0dc32447f27a761dbbb00b8ba17/samples/cocos2d-x-3.1/CocosLuaGame2/frameworks/cocos2d-x/download-deps.py#L149-L189 | ||
catboost/catboost | 167f64f237114a4d10b2b4ee42adb4569137debe | contrib/python/pexpect/pexpect/FSM.py | python | FSM.reset | (self) | This sets the current_state to the initial_state and sets
input_symbol to None. The initial state was set by the constructor
__init__(). | This sets the current_state to the initial_state and sets
input_symbol to None. The initial state was set by the constructor
__init__(). | [
"This",
"sets",
"the",
"current_state",
"to",
"the",
"initial_state",
"and",
"sets",
"input_symbol",
"to",
"None",
".",
"The",
"initial",
"state",
"was",
"set",
"by",
"the",
"constructor",
"__init__",
"()",
"."
] | def reset (self):
'''This sets the current_state to the initial_state and sets
input_symbol to None. The initial state was set by the constructor
__init__(). '''
self.current_state = self.initial_state
self.input_symbol = None | [
"def",
"reset",
"(",
"self",
")",
":",
"self",
".",
"current_state",
"=",
"self",
".",
"initial_state",
"self",
".",
"input_symbol",
"=",
"None"
] | https://github.com/catboost/catboost/blob/167f64f237114a4d10b2b4ee42adb4569137debe/contrib/python/pexpect/pexpect/FSM.py#L122-L129 | ||
Tencent/Pebble | 68315f176d9e328a233ace29b7579a829f89879f | tools/blade/src/blade/binary_runner.py | python | BinaryRunner.run_target | (self, target_key) | return p.returncode | Run one single target. | Run one single target. | [
"Run",
"one",
"single",
"target",
"."
] | def run_target(self, target_key):
"""Run one single target. """
target = self.targets[target_key]
if target.type not in self.run_list:
console.error_exit('target %s:%s is not a target that could run' % (
target_key[0], target_key[1]))
self._prepare_env(... | [
"def",
"run_target",
"(",
"self",
",",
"target_key",
")",
":",
"target",
"=",
"self",
".",
"targets",
"[",
"target_key",
"]",
"if",
"target",
".",
"type",
"not",
"in",
"self",
".",
"run_list",
":",
"console",
".",
"error_exit",
"(",
"'target %s:%s is not a... | https://github.com/Tencent/Pebble/blob/68315f176d9e328a233ace29b7579a829f89879f/tools/blade/src/blade/binary_runner.py#L168-L185 | |
Cantera/cantera | 0119484b261967ccb55a0066c020599cacc312e4 | interfaces/cython/cantera/ctml2yaml.py | python | Reaction.sri | (self, rate_coeff: etree.Element) | return reaction_attribs | Process an SRI reaction.
:param rate_coeff:
The XML node with rate coefficient information for this reaction. | Process an SRI reaction. | [
"Process",
"an",
"SRI",
"reaction",
"."
] | def sri(self, rate_coeff: etree.Element) -> "SRI_TYPE":
"""Process an SRI reaction.
:param rate_coeff:
The XML node with rate coefficient information for this reaction.
"""
reaction_attribs = self.lindemann((rate_coeff))
falloff_node = rate_coeff.find("falloff")
... | [
"def",
"sri",
"(",
"self",
",",
"rate_coeff",
":",
"etree",
".",
"Element",
")",
"->",
"\"SRI_TYPE\"",
":",
"reaction_attribs",
"=",
"self",
".",
"lindemann",
"(",
"(",
"rate_coeff",
")",
")",
"falloff_node",
"=",
"rate_coeff",
".",
"find",
"(",
"\"falloff... | https://github.com/Cantera/cantera/blob/0119484b261967ccb55a0066c020599cacc312e4/interfaces/cython/cantera/ctml2yaml.py#L2142-L2158 | |
rampageX/firmware-mod-kit | c94cd6aeee50d92ec5280a6dba6d74828fd3606b | src/bff/bffxtractor.py | python | _mkdir | (newdir) | works the way a good mkdir should :)
- already exists, silently complete
- regular file in the way, raise an exception
- parent directory(ies) does not exist, make them as well | works the way a good mkdir should :)
- already exists, silently complete
- regular file in the way, raise an exception
- parent directory(ies) does not exist, make them as well | [
"works",
"the",
"way",
"a",
"good",
"mkdir",
"should",
":",
")",
"-",
"already",
"exists",
"silently",
"complete",
"-",
"regular",
"file",
"in",
"the",
"way",
"raise",
"an",
"exception",
"-",
"parent",
"directory",
"(",
"ies",
")",
"does",
"not",
"exist"... | def _mkdir(newdir):
"""works the way a good mkdir should :)
- already exists, silently complete
- regular file in the way, raise an exception
- parent directory(ies) does not exist, make them as well
"""
if os.path.isdir(newdir):
pass
elif os.path.isfile(newdir):
... | [
"def",
"_mkdir",
"(",
"newdir",
")",
":",
"if",
"os",
".",
"path",
".",
"isdir",
"(",
"newdir",
")",
":",
"pass",
"elif",
"os",
".",
"path",
".",
"isfile",
"(",
"newdir",
")",
":",
"raise",
"OSError",
"(",
"\"a file with the same name as the desired \"",
... | https://github.com/rampageX/firmware-mod-kit/blob/c94cd6aeee50d92ec5280a6dba6d74828fd3606b/src/bff/bffxtractor.py#L13-L30 | ||
wlanjie/AndroidFFmpeg | 7baf9122f4b8e1c74e7baf4be5c422c7a5ba5aaf | tools/fdk-aac-build/armeabi-v7a/toolchain/lib/python2.7/warnings.py | python | simplefilter | (action, category=Warning, lineno=0, append=0) | Insert a simple entry into the list of warnings filters (at the front).
A simple filter matches all modules and messages.
'action' -- one of "error", "ignore", "always", "default", "module",
or "once"
'category' -- a class that the warning must be a subclass of
'lineno' -- an integer li... | Insert a simple entry into the list of warnings filters (at the front). | [
"Insert",
"a",
"simple",
"entry",
"into",
"the",
"list",
"of",
"warnings",
"filters",
"(",
"at",
"the",
"front",
")",
"."
] | def simplefilter(action, category=Warning, lineno=0, append=0):
"""Insert a simple entry into the list of warnings filters (at the front).
A simple filter matches all modules and messages.
'action' -- one of "error", "ignore", "always", "default", "module",
or "once"
'category' -- a cla... | [
"def",
"simplefilter",
"(",
"action",
",",
"category",
"=",
"Warning",
",",
"lineno",
"=",
"0",
",",
"append",
"=",
"0",
")",
":",
"assert",
"action",
"in",
"(",
"\"error\"",
",",
"\"ignore\"",
",",
"\"always\"",
",",
"\"default\"",
",",
"\"module\"",
",... | https://github.com/wlanjie/AndroidFFmpeg/blob/7baf9122f4b8e1c74e7baf4be5c422c7a5ba5aaf/tools/fdk-aac-build/armeabi-v7a/toolchain/lib/python2.7/warnings.py#L74-L92 | ||
zhaoweicai/mscnn | 534bcac5710a579d60827f192035f7eef6d8c585 | scripts/cpp_lint.py | python | CheckForNonConstReference | (filename, clean_lines, linenum,
nesting_state, error) | Check for non-const references.
Separate from CheckLanguage since it scans backwards from current
line, instead of scanning forward.
Args:
filename: The name of the current file.
clean_lines: A CleansedLines instance containing the file.
linenum: The number of the line to check.
nesting_state: A... | Check for non-const references. | [
"Check",
"for",
"non",
"-",
"const",
"references",
"."
] | def CheckForNonConstReference(filename, clean_lines, linenum,
nesting_state, error):
"""Check for non-const references.
Separate from CheckLanguage since it scans backwards from current
line, instead of scanning forward.
Args:
filename: The name of the current file.
clean... | [
"def",
"CheckForNonConstReference",
"(",
"filename",
",",
"clean_lines",
",",
"linenum",
",",
"nesting_state",
",",
"error",
")",
":",
"# Do nothing if there is no '&' on current line.",
"line",
"=",
"clean_lines",
".",
"elided",
"[",
"linenum",
"]",
"if",
"'&'",
"n... | https://github.com/zhaoweicai/mscnn/blob/534bcac5710a579d60827f192035f7eef6d8c585/scripts/cpp_lint.py#L4134-L4244 | ||
catboost/catboost | 167f64f237114a4d10b2b4ee42adb4569137debe | contrib/python/ipython/py2/IPython/core/ultratb.py | python | FormattedTB.stb2text | (self, stb) | return self.tb_join_char.join(stb) | Convert a structured traceback (a list) to a string. | Convert a structured traceback (a list) to a string. | [
"Convert",
"a",
"structured",
"traceback",
"(",
"a",
"list",
")",
"to",
"a",
"string",
"."
] | def stb2text(self, stb):
"""Convert a structured traceback (a list) to a string."""
return self.tb_join_char.join(stb) | [
"def",
"stb2text",
"(",
"self",
",",
"stb",
")",
":",
"return",
"self",
".",
"tb_join_char",
".",
"join",
"(",
"stb",
")"
] | https://github.com/catboost/catboost/blob/167f64f237114a4d10b2b4ee42adb4569137debe/contrib/python/ipython/py2/IPython/core/ultratb.py#L1331-L1333 | |
OpenGenus/cosmos | 1a94e8880068e51d571543be179c323936bd0936 | code/data_structures/src/hashs/bloom_filter/bloom_filter.py | python | bloomFilter.__contains__ | (self, value) | return True | Determine whether a value is present. A false positive might be returned even if the element is
not present. However, a false negative will never be returned. | Determine whether a value is present. A false positive might be returned even if the element is
not present. However, a false negative will never be returned. | [
"Determine",
"whether",
"a",
"value",
"is",
"present",
".",
"A",
"false",
"positive",
"might",
"be",
"returned",
"even",
"if",
"the",
"element",
"is",
"not",
"present",
".",
"However",
"a",
"false",
"negative",
"will",
"never",
"be",
"returned",
"."
] | def __contains__(self, value):
"""
Determine whether a value is present. A false positive might be returned even if the element is
not present. However, a false negative will never be returned.
"""
for hf in self.hashFunctions:
if self.bits & 1 << hf(value, self.M) ==... | [
"def",
"__contains__",
"(",
"self",
",",
"value",
")",
":",
"for",
"hf",
"in",
"self",
".",
"hashFunctions",
":",
"if",
"self",
".",
"bits",
"&",
"1",
"<<",
"hf",
"(",
"value",
",",
"self",
".",
"M",
")",
"==",
"0",
":",
"return",
"False",
"retur... | https://github.com/OpenGenus/cosmos/blob/1a94e8880068e51d571543be179c323936bd0936/code/data_structures/src/hashs/bloom_filter/bloom_filter.py#L25-L33 | |
llvm-mirror/lldb | d01083a850f577b85501a0902b52fd0930de72c7 | third_party/Python/module/pexpect-4.6/pexpect/screen.py | python | screen.dump | (self) | return u''.join ([ u''.join(c) for c in self.w ]) | This returns a copy of the screen as a unicode string. This is similar to
__str__/__unicode__ except that lines are not terminated with line
feeds. | This returns a copy of the screen as a unicode string. This is similar to
__str__/__unicode__ except that lines are not terminated with line
feeds. | [
"This",
"returns",
"a",
"copy",
"of",
"the",
"screen",
"as",
"a",
"unicode",
"string",
".",
"This",
"is",
"similar",
"to",
"__str__",
"/",
"__unicode__",
"except",
"that",
"lines",
"are",
"not",
"terminated",
"with",
"line",
"feeds",
"."
] | def dump (self):
'''This returns a copy of the screen as a unicode string. This is similar to
__str__/__unicode__ except that lines are not terminated with line
feeds.'''
return u''.join ([ u''.join(c) for c in self.w ]) | [
"def",
"dump",
"(",
"self",
")",
":",
"return",
"u''",
".",
"join",
"(",
"[",
"u''",
".",
"join",
"(",
"c",
")",
"for",
"c",
"in",
"self",
".",
"w",
"]",
")"
] | https://github.com/llvm-mirror/lldb/blob/d01083a850f577b85501a0902b52fd0930de72c7/third_party/Python/module/pexpect-4.6/pexpect/screen.py#L131-L136 | |
okex/V3-Open-API-SDK | c5abb0db7e2287718e0055e17e57672ce0ec7fd9 | okex-python-sdk-api/venv/Lib/site-packages/pip-19.0.3-py3.8.egg/pip/_vendor/distlib/locators.py | python | SimpleScrapingLocator.get_distribution_names | (self) | return result | Return all the distribution names known to this locator. | Return all the distribution names known to this locator. | [
"Return",
"all",
"the",
"distribution",
"names",
"known",
"to",
"this",
"locator",
"."
] | def get_distribution_names(self):
"""
Return all the distribution names known to this locator.
"""
result = set()
page = self.get_page(self.base_url)
if not page:
raise DistlibException('Unable to get %s' % self.base_url)
for match in self._distname_re... | [
"def",
"get_distribution_names",
"(",
"self",
")",
":",
"result",
"=",
"set",
"(",
")",
"page",
"=",
"self",
".",
"get_page",
"(",
"self",
".",
"base_url",
")",
"if",
"not",
"page",
":",
"raise",
"DistlibException",
"(",
"'Unable to get %s'",
"%",
"self",
... | https://github.com/okex/V3-Open-API-SDK/blob/c5abb0db7e2287718e0055e17e57672ce0ec7fd9/okex-python-sdk-api/venv/Lib/site-packages/pip-19.0.3-py3.8.egg/pip/_vendor/distlib/locators.py#L816-L826 | |
TheLegendAli/DeepLab-Context | fb04e9e2fc2682490ad9f60533b9d6c4c0e0479c | scripts/cpp_lint.py | python | Error | (filename, linenum, category, confidence, message) | Logs the fact we've found a lint error.
We log where the error was found, and also our confidence in the error,
that is, how certain we are this is a legitimate style regression, and
not a misidentification or a use that's sometimes justified.
False positives can be suppressed by the use of
"cpplint(categor... | Logs the fact we've found a lint error. | [
"Logs",
"the",
"fact",
"we",
"ve",
"found",
"a",
"lint",
"error",
"."
] | def Error(filename, linenum, category, confidence, message):
"""Logs the fact we've found a lint error.
We log where the error was found, and also our confidence in the error,
that is, how certain we are this is a legitimate style regression, and
not a misidentification or a use that's sometimes justified.
... | [
"def",
"Error",
"(",
"filename",
",",
"linenum",
",",
"category",
",",
"confidence",
",",
"message",
")",
":",
"if",
"_ShouldPrintError",
"(",
"category",
",",
"confidence",
",",
"linenum",
")",
":",
"_cpplint_state",
".",
"IncrementErrorCount",
"(",
"category... | https://github.com/TheLegendAli/DeepLab-Context/blob/fb04e9e2fc2682490ad9f60533b9d6c4c0e0479c/scripts/cpp_lint.py#L988-L1020 | ||
catboost/catboost | 167f64f237114a4d10b2b4ee42adb4569137debe | contrib/python/scipy/py2/scipy/sparse/csc.py | python | csc_matrix.getrow | (self, i) | return self._get_submatrix(i, slice(None)).tocsr() | Returns a copy of row i of the matrix, as a (1 x n)
CSR matrix (row vector). | Returns a copy of row i of the matrix, as a (1 x n)
CSR matrix (row vector). | [
"Returns",
"a",
"copy",
"of",
"row",
"i",
"of",
"the",
"matrix",
"as",
"a",
"(",
"1",
"x",
"n",
")",
"CSR",
"matrix",
"(",
"row",
"vector",
")",
"."
] | def getrow(self, i):
"""Returns a copy of row i of the matrix, as a (1 x n)
CSR matrix (row vector).
"""
# we convert to CSR to maintain compatibility with old impl.
# in spmatrix.getrow()
return self._get_submatrix(i, slice(None)).tocsr() | [
"def",
"getrow",
"(",
"self",
",",
"i",
")",
":",
"# we convert to CSR to maintain compatibility with old impl.",
"# in spmatrix.getrow()",
"return",
"self",
".",
"_get_submatrix",
"(",
"i",
",",
"slice",
"(",
"None",
")",
")",
".",
"tocsr",
"(",
")"
] | https://github.com/catboost/catboost/blob/167f64f237114a4d10b2b4ee42adb4569137debe/contrib/python/scipy/py2/scipy/sparse/csc.py#L197-L203 | |
mongodb/mongo | d8ff665343ad29cf286ee2cf4a1960d29371937b | buildscripts/debugsymb_mapper.py | python | Mapper.cleanup | (self) | Remove temporary files & folders. | Remove temporary files & folders. | [
"Remove",
"temporary",
"files",
"&",
"folders",
"."
] | def cleanup(self):
"""Remove temporary files & folders."""
if os.path.exists(self.cache_dir):
shutil.rmtree(self.cache_dir) | [
"def",
"cleanup",
"(",
"self",
")",
":",
"if",
"os",
".",
"path",
".",
"exists",
"(",
"self",
".",
"cache_dir",
")",
":",
"shutil",
".",
"rmtree",
"(",
"self",
".",
"cache_dir",
")"
] | https://github.com/mongodb/mongo/blob/d8ff665343ad29cf286ee2cf4a1960d29371937b/buildscripts/debugsymb_mapper.py#L168-L172 | ||
catboost/catboost | 167f64f237114a4d10b2b4ee42adb4569137debe | contrib/tools/python3/src/Lib/imaplib.py | python | IMAP4.capability | (self) | return self._untagged_response(typ, dat, name) | (typ, [data]) = <instance>.capability()
Fetch capabilities list from server. | (typ, [data]) = <instance>.capability()
Fetch capabilities list from server. | [
"(",
"typ",
"[",
"data",
"]",
")",
"=",
"<instance",
">",
".",
"capability",
"()",
"Fetch",
"capabilities",
"list",
"from",
"server",
"."
] | def capability(self):
"""(typ, [data]) = <instance>.capability()
Fetch capabilities list from server."""
name = 'CAPABILITY'
typ, dat = self._simple_command(name)
return self._untagged_response(typ, dat, name) | [
"def",
"capability",
"(",
"self",
")",
":",
"name",
"=",
"'CAPABILITY'",
"typ",
",",
"dat",
"=",
"self",
".",
"_simple_command",
"(",
"name",
")",
"return",
"self",
".",
"_untagged_response",
"(",
"typ",
",",
"dat",
",",
"name",
")"
] | https://github.com/catboost/catboost/blob/167f64f237114a4d10b2b4ee42adb4569137debe/contrib/tools/python3/src/Lib/imaplib.py#L449-L455 | |
arangodb/arangodb | 0d658689c7d1b721b314fa3ca27d38303e1570c8 | 3rdParty/boost/1.78.0/libs/metaparse/tools/benchmark/generate.py | python | Mode.description | (self) | The description of the mode | The description of the mode | [
"The",
"description",
"of",
"the",
"mode"
] | def description(self):
"""The description of the mode"""
if self.identifier == 'bmp':
return 'Using BOOST_METAPARSE_STRING'
elif self.identifier == 'man':
return 'Generating strings manually' | [
"def",
"description",
"(",
"self",
")",
":",
"if",
"self",
".",
"identifier",
"==",
"'bmp'",
":",
"return",
"'Using BOOST_METAPARSE_STRING'",
"elif",
"self",
".",
"identifier",
"==",
"'man'",
":",
"return",
"'Generating strings manually'"
] | https://github.com/arangodb/arangodb/blob/0d658689c7d1b721b314fa3ca27d38303e1570c8/3rdParty/boost/1.78.0/libs/metaparse/tools/benchmark/generate.py#L82-L87 | ||
aws/lumberyard | f85344403c1c2e77ec8c75deb2c116e97b713217 | dev/Gems/CloudGemMetric/v1/AWS/python/windows/Lib/psutil/_psbsd.py | python | virtual_memory | () | return svmem(total, avail, percent, used, free,
active, inactive, buffers, cached, shared, wired) | System virtual memory as a namedtuple. | System virtual memory as a namedtuple. | [
"System",
"virtual",
"memory",
"as",
"a",
"namedtuple",
"."
] | def virtual_memory():
"""System virtual memory as a namedtuple."""
mem = cext.virtual_mem()
total, free, active, inactive, wired, cached, buffers, shared = mem
if NETBSD:
# On NetBSD buffers and shared mem is determined via /proc.
# The C ext set them to 0.
with open('/proc/memin... | [
"def",
"virtual_memory",
"(",
")",
":",
"mem",
"=",
"cext",
".",
"virtual_mem",
"(",
")",
"total",
",",
"free",
",",
"active",
",",
"inactive",
",",
"wired",
",",
"cached",
",",
"buffers",
",",
"shared",
"=",
"mem",
"if",
"NETBSD",
":",
"# On NetBSD bu... | https://github.com/aws/lumberyard/blob/f85344403c1c2e77ec8c75deb2c116e97b713217/dev/Gems/CloudGemMetric/v1/AWS/python/windows/Lib/psutil/_psbsd.py#L183-L200 | |
Komnomnomnom/swigibpy | cfd307fdbfaffabc69a2dc037538d7e34a8b8daf | swigibpy.py | python | OrderState.__init__ | (self) | __init__(OrderState self) -> OrderState | __init__(OrderState self) -> OrderState | [
"__init__",
"(",
"OrderState",
"self",
")",
"-",
">",
"OrderState"
] | def __init__(self):
"""__init__(OrderState self) -> OrderState"""
_swigibpy.OrderState_swiginit(self, _swigibpy.new_OrderState()) | [
"def",
"__init__",
"(",
"self",
")",
":",
"_swigibpy",
".",
"OrderState_swiginit",
"(",
"self",
",",
"_swigibpy",
".",
"new_OrderState",
"(",
")",
")"
] | https://github.com/Komnomnomnom/swigibpy/blob/cfd307fdbfaffabc69a2dc037538d7e34a8b8daf/swigibpy.py#L1949-L1951 | ||
google/iree | 1224bbdbe65b0d1fdf40e7324f60f68beeaf7c76 | integrations/tensorflow/python_projects/iree_tf/iree/tf/support/module_utils.py | python | TfLiteCompiledModule.reinitialize | (self) | Reinitializes all stateful variables. | Reinitializes all stateful variables. | [
"Reinitializes",
"all",
"stateful",
"variables",
"."
] | def reinitialize(self):
"""Reinitializes all stateful variables."""
# This is a noop because TFLite (mostly) doesn't support stateful modules.
pass | [
"def",
"reinitialize",
"(",
"self",
")",
":",
"# This is a noop because TFLite (mostly) doesn't support stateful modules.",
"pass"
] | https://github.com/google/iree/blob/1224bbdbe65b0d1fdf40e7324f60f68beeaf7c76/integrations/tensorflow/python_projects/iree_tf/iree/tf/support/module_utils.py#L867-L870 | ||
fifengine/fifengine | 4b62c42e85bec19893cef8e63e6855927cff2c47 | engine/python/fife/extensions/fife_settings.py | python | Setting.get | (self, module, name, defaultValue=None) | Gets the value of a specified setting
@param module: Name of the module to get the setting from
@param name: Setting name
@param defaultValue: Specifies the default value to return if the setting is not found
@type defaultValue: C{str} or C{unicode} or C{int} or C{float} or C{bool} or C{list} or C{dict} | Gets the value of a specified setting | [
"Gets",
"the",
"value",
"of",
"a",
"specified",
"setting"
] | def get(self, module, name, defaultValue=None):
""" Gets the value of a specified setting
@param module: Name of the module to get the setting from
@param name: Setting name
@param defaultValue: Specifies the default value to return if the setting is not found
@type defaultValue: C{str} or C{unicode} or C{in... | [
"def",
"get",
"(",
"self",
",",
"module",
",",
"name",
",",
"defaultValue",
"=",
"None",
")",
":",
"if",
"self",
".",
"_serializer",
":",
"if",
"module",
"is",
"\"FIFE\"",
":",
"# check whether getAllSettings has been called already",
"if",
"self",
".",
"_read... | https://github.com/fifengine/fifengine/blob/4b62c42e85bec19893cef8e63e6855927cff2c47/engine/python/fife/extensions/fife_settings.py#L425-L461 | ||
mantidproject/mantid | 03deeb89254ec4289edb8771e0188c2090a02f32 | qt/python/mantidqtinterfaces/mantidqtinterfaces/FilterEvents/eventFilterGUI.py | python | MainWindow._loadFile | (self, filename) | return ws | Load file or run
File will be loaded to a workspace shown in MantidPlot | Load file or run
File will be loaded to a workspace shown in MantidPlot | [
"Load",
"file",
"or",
"run",
"File",
"will",
"be",
"loaded",
"to",
"a",
"workspace",
"shown",
"in",
"MantidPlot"
] | def _loadFile(self, filename):
""" Load file or run
File will be loaded to a workspace shown in MantidPlot
"""
config = ConfigService
# Check input file name and output workspace name
if filename.isdigit() is True:
# Construct a file name from run number
... | [
"def",
"_loadFile",
"(",
"self",
",",
"filename",
")",
":",
"config",
"=",
"ConfigService",
"# Check input file name and output workspace name",
"if",
"filename",
".",
"isdigit",
"(",
")",
"is",
"True",
":",
"# Construct a file name from run number",
"runnumber",
"=",
... | https://github.com/mantidproject/mantid/blob/03deeb89254ec4289edb8771e0188c2090a02f32/qt/python/mantidqtinterfaces/mantidqtinterfaces/FilterEvents/eventFilterGUI.py#L783-L834 | |
hanpfei/chromium-net | 392cc1fa3a8f92f42e4071ab6e674d8e0482f83f | build/android/gradle/generate_gradle.py | python | _GenerateLocalProperties | (sdk_dir) | return '\n'.join([
'# Generated by //build/android/gradle/generate_gradle.py',
'sdk.dir=%s' % sdk_dir,
'']) | Returns the data for project.properties as a string. | Returns the data for project.properties as a string. | [
"Returns",
"the",
"data",
"for",
"project",
".",
"properties",
"as",
"a",
"string",
"."
] | def _GenerateLocalProperties(sdk_dir):
"""Returns the data for project.properties as a string."""
return '\n'.join([
'# Generated by //build/android/gradle/generate_gradle.py',
'sdk.dir=%s' % sdk_dir,
'']) | [
"def",
"_GenerateLocalProperties",
"(",
"sdk_dir",
")",
":",
"return",
"'\\n'",
".",
"join",
"(",
"[",
"'# Generated by //build/android/gradle/generate_gradle.py'",
",",
"'sdk.dir=%s'",
"%",
"sdk_dir",
",",
"''",
"]",
")"
] | https://github.com/hanpfei/chromium-net/blob/392cc1fa3a8f92f42e4071ab6e674d8e0482f83f/build/android/gradle/generate_gradle.py#L196-L201 | |
wxWidgets/wxPython-Classic | 19571e1ae65f1ac445f5491474121998c97a1bf0 | demo/GridCustEditor.py | python | MyCellEditor.ApplyEdit | (self, row, col, grid) | This function should save the value of the control into the
grid or grid table. It is called only after EndEdit() returns
a non-None value.
*Must Override* | This function should save the value of the control into the
grid or grid table. It is called only after EndEdit() returns
a non-None value.
*Must Override* | [
"This",
"function",
"should",
"save",
"the",
"value",
"of",
"the",
"control",
"into",
"the",
"grid",
"or",
"grid",
"table",
".",
"It",
"is",
"called",
"only",
"after",
"EndEdit",
"()",
"returns",
"a",
"non",
"-",
"None",
"value",
".",
"*",
"Must",
"Ove... | def ApplyEdit(self, row, col, grid):
"""
This function should save the value of the control into the
grid or grid table. It is called only after EndEdit() returns
a non-None value.
*Must Override*
"""
self.log.write("MyCellEditor: ApplyEdit (%d,%d)\n" % (row, col)... | [
"def",
"ApplyEdit",
"(",
"self",
",",
"row",
",",
"col",
",",
"grid",
")",
":",
"self",
".",
"log",
".",
"write",
"(",
"\"MyCellEditor: ApplyEdit (%d,%d)\\n\"",
"%",
"(",
"row",
",",
"col",
")",
")",
"val",
"=",
"self",
".",
"_tc",
".",
"GetValue",
"... | https://github.com/wxWidgets/wxPython-Classic/blob/19571e1ae65f1ac445f5491474121998c97a1bf0/demo/GridCustEditor.py#L98-L110 | ||
google/lmctfy | 94729318edb06f7d149f67581a07a4c70ed29250 | gmock/scripts/fuse_gmock_files.py | python | FuseGMockGTestAllCc | (gmock_root, output_dir) | Scans folder gmock_root to generate gmock-gtest-all.cc in output_dir. | Scans folder gmock_root to generate gmock-gtest-all.cc in output_dir. | [
"Scans",
"folder",
"gmock_root",
"to",
"generate",
"gmock",
"-",
"gtest",
"-",
"all",
".",
"cc",
"in",
"output_dir",
"."
] | def FuseGMockGTestAllCc(gmock_root, output_dir):
"""Scans folder gmock_root to generate gmock-gtest-all.cc in output_dir."""
output_file = file(os.path.join(output_dir, GMOCK_GTEST_ALL_CC_OUTPUT), 'w')
# First, fuse gtest-all.cc into gmock-gtest-all.cc.
gtest.FuseGTestAllCcToFile(GetGTestRootDir(gmock_root), o... | [
"def",
"FuseGMockGTestAllCc",
"(",
"gmock_root",
",",
"output_dir",
")",
":",
"output_file",
"=",
"file",
"(",
"os",
".",
"path",
".",
"join",
"(",
"output_dir",
",",
"GMOCK_GTEST_ALL_CC_OUTPUT",
")",
",",
"'w'",
")",
"# First, fuse gtest-all.cc into gmock-gtest-all... | https://github.com/google/lmctfy/blob/94729318edb06f7d149f67581a07a4c70ed29250/gmock/scripts/fuse_gmock_files.py#L204-L212 | ||
pytorch/pytorch | 7176c92687d3cc847cc046bf002269c6949a21c2 | torch/profiler/profiler.py | python | supported_activities | () | return torch.autograd._supported_activities() | Returns a set of supported profiler tracing activities.
Note: profiler uses CUPTI library to trace on-device CUDA kernels.
In case when CUDA is enabled but CUPTI is not available, passing
``ProfilerActivity.CUDA`` to profiler results in using the legacy CUDA
profiling code (same as in the legacy ``torc... | Returns a set of supported profiler tracing activities. | [
"Returns",
"a",
"set",
"of",
"supported",
"profiler",
"tracing",
"activities",
"."
] | def supported_activities():
"""
Returns a set of supported profiler tracing activities.
Note: profiler uses CUPTI library to trace on-device CUDA kernels.
In case when CUDA is enabled but CUPTI is not available, passing
``ProfilerActivity.CUDA`` to profiler results in using the legacy CUDA
prof... | [
"def",
"supported_activities",
"(",
")",
":",
"return",
"torch",
".",
"autograd",
".",
"_supported_activities",
"(",
")"
] | https://github.com/pytorch/pytorch/blob/7176c92687d3cc847cc046bf002269c6949a21c2/torch/profiler/profiler.py#L15-L26 | |
deepmind/open_spiel | 4ca53bea32bb2875c7385d215424048ae92f78c8 | open_spiel/python/algorithms/alpha_zero/alpha_zero.py | python | alpha_zero | (config: Config) | Start all the worker processes for a full alphazero setup. | Start all the worker processes for a full alphazero setup. | [
"Start",
"all",
"the",
"worker",
"processes",
"for",
"a",
"full",
"alphazero",
"setup",
"."
] | def alpha_zero(config: Config):
"""Start all the worker processes for a full alphazero setup."""
game = pyspiel.load_game(config.game)
config = config._replace(
observation_shape=game.observation_tensor_shape(),
output_size=game.num_distinct_actions())
print("Starting game", config.game)
if game.... | [
"def",
"alpha_zero",
"(",
"config",
":",
"Config",
")",
":",
"game",
"=",
"pyspiel",
".",
"load_game",
"(",
"config",
".",
"game",
")",
"config",
"=",
"config",
".",
"_replace",
"(",
"observation_shape",
"=",
"game",
".",
"observation_tensor_shape",
"(",
"... | https://github.com/deepmind/open_spiel/blob/4ca53bea32bb2875c7385d215424048ae92f78c8/open_spiel/python/algorithms/alpha_zero/alpha_zero.py#L488-L549 | ||
wlanjie/AndroidFFmpeg | 7baf9122f4b8e1c74e7baf4be5c422c7a5ba5aaf | tools/fdk-aac-build/armeabi/toolchain/lib/python2.7/plat-mac/bundlebuilder.py | python | copy | (src, dst, mkdirs=0) | Copy a file or a directory. | Copy a file or a directory. | [
"Copy",
"a",
"file",
"or",
"a",
"directory",
"."
] | def copy(src, dst, mkdirs=0):
"""Copy a file or a directory."""
if mkdirs:
makedirs(os.path.dirname(dst))
if os.path.isdir(src):
shutil.copytree(src, dst, symlinks=1)
else:
shutil.copy2(src, dst) | [
"def",
"copy",
"(",
"src",
",",
"dst",
",",
"mkdirs",
"=",
"0",
")",
":",
"if",
"mkdirs",
":",
"makedirs",
"(",
"os",
".",
"path",
".",
"dirname",
"(",
"dst",
")",
")",
"if",
"os",
".",
"path",
".",
"isdir",
"(",
"src",
")",
":",
"shutil",
".... | https://github.com/wlanjie/AndroidFFmpeg/blob/7baf9122f4b8e1c74e7baf4be5c422c7a5ba5aaf/tools/fdk-aac-build/armeabi/toolchain/lib/python2.7/plat-mac/bundlebuilder.py#L758-L765 | ||
openthread/openthread | 9fcdbed9c526c70f1556d1ed84099c1535c7cd32 | tools/otci/otci/otci.py | python | OTCI.get_leader_weight | (self) | return self.__parse_int(self.execute_command('leaderweight')) | Get the Thread Leader Weight. | Get the Thread Leader Weight. | [
"Get",
"the",
"Thread",
"Leader",
"Weight",
"."
] | def get_leader_weight(self) -> int:
"""Get the Thread Leader Weight."""
return self.__parse_int(self.execute_command('leaderweight')) | [
"def",
"get_leader_weight",
"(",
"self",
")",
"->",
"int",
":",
"return",
"self",
".",
"__parse_int",
"(",
"self",
".",
"execute_command",
"(",
"'leaderweight'",
")",
")"
] | https://github.com/openthread/openthread/blob/9fcdbed9c526c70f1556d1ed84099c1535c7cd32/tools/otci/otci/otci.py#L556-L558 | |
protocolbuffers/protobuf | b5ab0b7a18b7336c60130f4ddb2d97c51792f896 | python/google/protobuf/descriptor.py | python | ServiceDescriptor.FindMethodByName | (self, name) | return self.methods_by_name.get(name, None) | Searches for the specified method, and returns its descriptor.
Args:
name (str): Name of the method.
Returns:
MethodDescriptor or None: the descriptor for the requested method, if
found. | Searches for the specified method, and returns its descriptor. | [
"Searches",
"for",
"the",
"specified",
"method",
"and",
"returns",
"its",
"descriptor",
"."
] | def FindMethodByName(self, name):
"""Searches for the specified method, and returns its descriptor.
Args:
name (str): Name of the method.
Returns:
MethodDescriptor or None: the descriptor for the requested method, if
found.
"""
return self.methods_by_name.get(name, None) | [
"def",
"FindMethodByName",
"(",
"self",
",",
"name",
")",
":",
"return",
"self",
".",
"methods_by_name",
".",
"get",
"(",
"name",
",",
"None",
")"
] | https://github.com/protocolbuffers/protobuf/blob/b5ab0b7a18b7336c60130f4ddb2d97c51792f896/python/google/protobuf/descriptor.py#L847-L856 | |
wxWidgets/wxPython-Classic | 19571e1ae65f1ac445f5491474121998c97a1bf0 | src/gtk/_core.py | python | Image.SetData | (*args, **kwargs) | return _core_.Image_SetData(*args, **kwargs) | SetData(self, buffer data)
Resets the Image's RGB data from a buffer of RGB bytes. Accepts
either a string or a buffer object holding the data and the length of
the data must be width*height*3. | SetData(self, buffer data) | [
"SetData",
"(",
"self",
"buffer",
"data",
")"
] | def SetData(*args, **kwargs):
"""
SetData(self, buffer data)
Resets the Image's RGB data from a buffer of RGB bytes. Accepts
either a string or a buffer object holding the data and the length of
the data must be width*height*3.
"""
return _core_.Image_SetData(*a... | [
"def",
"SetData",
"(",
"*",
"args",
",",
"*",
"*",
"kwargs",
")",
":",
"return",
"_core_",
".",
"Image_SetData",
"(",
"*",
"args",
",",
"*",
"*",
"kwargs",
")"
] | https://github.com/wxWidgets/wxPython-Classic/blob/19571e1ae65f1ac445f5491474121998c97a1bf0/src/gtk/_core.py#L3365-L3373 | |
mindspore-ai/mindspore | fb8fd3338605bb34fa5cea054e535a8b1d753fab | mindspore/python/mindspore/ops/operations/_grad_ops.py | python | RsqrtGrad.__init__ | (self) | Initialize RsqrtGrad | Initialize RsqrtGrad | [
"Initialize",
"RsqrtGrad"
] | def __init__(self):
"""Initialize RsqrtGrad""" | [
"def",
"__init__",
"(",
"self",
")",
":"
] | https://github.com/mindspore-ai/mindspore/blob/fb8fd3338605bb34fa5cea054e535a8b1d753fab/mindspore/python/mindspore/ops/operations/_grad_ops.py#L87-L88 | ||
wxWidgets/wxPython-Classic | 19571e1ae65f1ac445f5491474121998c97a1bf0 | wx/lib/agw/flatmenu.py | python | FlatMenu.GetItemHeight | (self) | return self._itemHeight | Returns the height of a particular item, in pixels. | Returns the height of a particular item, in pixels. | [
"Returns",
"the",
"height",
"of",
"a",
"particular",
"item",
"in",
"pixels",
"."
] | def GetItemHeight(self):
""" Returns the height of a particular item, in pixels. """
return self._itemHeight | [
"def",
"GetItemHeight",
"(",
"self",
")",
":",
"return",
"self",
".",
"_itemHeight"
] | https://github.com/wxWidgets/wxPython-Classic/blob/19571e1ae65f1ac445f5491474121998c97a1bf0/wx/lib/agw/flatmenu.py#L5689-L5692 | |
catboost/catboost | 167f64f237114a4d10b2b4ee42adb4569137debe | contrib/python/scipy/py2/scipy/integrate/quadpack.py | python | _OptFunc.__call__ | (self, *args) | return self.opt | Return stored dict. | Return stored dict. | [
"Return",
"stored",
"dict",
"."
] | def __call__(self, *args):
"""Return stored dict."""
return self.opt | [
"def",
"__call__",
"(",
"self",
",",
"*",
"args",
")",
":",
"return",
"self",
".",
"opt"
] | https://github.com/catboost/catboost/blob/167f64f237114a4d10b2b4ee42adb4569137debe/contrib/python/scipy/py2/scipy/integrate/quadpack.py#L825-L827 | |
wlanjie/AndroidFFmpeg | 7baf9122f4b8e1c74e7baf4be5c422c7a5ba5aaf | tools/fdk-aac-build/armeabi/toolchain/lib/python2.7/lib-tk/Tkinter.py | python | PanedWindow.identify | (self, x, y) | return self.tk.call(self._w, 'identify', x, y) | Identify the panedwindow component at point x, y
If the point is over a sash or a sash handle, the result
is a two element list containing the index of the sash or
handle, and a word indicating whether it is over a sash
or a handle, such as {0 sash} or {2 handle}. If the point
i... | Identify the panedwindow component at point x, y | [
"Identify",
"the",
"panedwindow",
"component",
"at",
"point",
"x",
"y"
] | def identify(self, x, y):
"""Identify the panedwindow component at point x, y
If the point is over a sash or a sash handle, the result
is a two element list containing the index of the sash or
handle, and a word indicating whether it is over a sash
or a handle, such as {0 sash} ... | [
"def",
"identify",
"(",
"self",
",",
"x",
",",
"y",
")",
":",
"return",
"self",
".",
"tk",
".",
"call",
"(",
"self",
".",
"_w",
",",
"'identify'",
",",
"x",
",",
"y",
")"
] | https://github.com/wlanjie/AndroidFFmpeg/blob/7baf9122f4b8e1c74e7baf4be5c422c7a5ba5aaf/tools/fdk-aac-build/armeabi/toolchain/lib/python2.7/lib-tk/Tkinter.py#L3587-L3597 | |
pmq20/node-packer | 12c46c6e44fbc14d9ee645ebd17d5296b324f7e0 | lts/tools/gyp/pylib/gyp/mac_tool.py | python | MacTool._WritePkgInfo | (self, info_plist) | This writes the PkgInfo file from the data stored in Info.plist. | This writes the PkgInfo file from the data stored in Info.plist. | [
"This",
"writes",
"the",
"PkgInfo",
"file",
"from",
"the",
"data",
"stored",
"in",
"Info",
".",
"plist",
"."
] | def _WritePkgInfo(self, info_plist):
"""This writes the PkgInfo file from the data stored in Info.plist."""
plist = plistlib.readPlist(info_plist)
if not plist:
return
# Only create PkgInfo for executable types.
package_type = plist['CFBundlePackageType']
if package_type != 'APPL':
... | [
"def",
"_WritePkgInfo",
"(",
"self",
",",
"info_plist",
")",
":",
"plist",
"=",
"plistlib",
".",
"readPlist",
"(",
"info_plist",
")",
"if",
"not",
"plist",
":",
"return",
"# Only create PkgInfo for executable types.",
"package_type",
"=",
"plist",
"[",
"'CFBundleP... | https://github.com/pmq20/node-packer/blob/12c46c6e44fbc14d9ee645ebd17d5296b324f7e0/lts/tools/gyp/pylib/gyp/mac_tool.py#L222-L242 | ||
stan-dev/math | 5fd79f89933269a4ca4d8dd1fde2a36d53d4768c | lib/cpplint_1.4.5/cpplint.py | python | _FunctionState.Begin | (self, function_name) | Start analyzing function body.
Args:
function_name: The name of the function being tracked. | Start analyzing function body. | [
"Start",
"analyzing",
"function",
"body",
"."
] | def Begin(self, function_name):
"""Start analyzing function body.
Args:
function_name: The name of the function being tracked.
"""
self.in_a_function = True
self.lines_in_function = 0
self.current_function = function_name | [
"def",
"Begin",
"(",
"self",
",",
"function_name",
")",
":",
"self",
".",
"in_a_function",
"=",
"True",
"self",
".",
"lines_in_function",
"=",
"0",
"self",
".",
"current_function",
"=",
"function_name"
] | https://github.com/stan-dev/math/blob/5fd79f89933269a4ca4d8dd1fde2a36d53d4768c/lib/cpplint_1.4.5/cpplint.py#L1252-L1260 | ||
wxWidgets/wxPython-Classic | 19571e1ae65f1ac445f5491474121998c97a1bf0 | wx/lib/agw/ultimatelistctrl.py | python | UltimateListMainWindow.CheckItem | (self, item, checked=True, sendEvent=True) | Actually checks/uncheks an item, sending (eventually) the two
events ``EVT_LIST_ITEM_CHECKING`` / ``EVT_LIST_ITEM_CHECKED``.
:param `item`: an instance of :class:`UltimateListItem`;
:param `checked`: ``True`` to check an item, ``False`` to uncheck it;
:param `sendEvent`: ``True`` to sen... | Actually checks/uncheks an item, sending (eventually) the two
events ``EVT_LIST_ITEM_CHECKING`` / ``EVT_LIST_ITEM_CHECKED``. | [
"Actually",
"checks",
"/",
"uncheks",
"an",
"item",
"sending",
"(",
"eventually",
")",
"the",
"two",
"events",
"EVT_LIST_ITEM_CHECKING",
"/",
"EVT_LIST_ITEM_CHECKED",
"."
] | def CheckItem(self, item, checked=True, sendEvent=True):
"""
Actually checks/uncheks an item, sending (eventually) the two
events ``EVT_LIST_ITEM_CHECKING`` / ``EVT_LIST_ITEM_CHECKED``.
:param `item`: an instance of :class:`UltimateListItem`;
:param `checked`: ``True`` to check ... | [
"def",
"CheckItem",
"(",
"self",
",",
"item",
",",
"checked",
"=",
"True",
",",
"sendEvent",
"=",
"True",
")",
":",
"# Should we raise an error here?!? ",
"if",
"item",
".",
"GetKind",
"(",
")",
"==",
"0",
"or",
"not",
"item",
".",
"IsEnabled",
"(",... | https://github.com/wxWidgets/wxPython-Classic/blob/19571e1ae65f1ac445f5491474121998c97a1bf0/wx/lib/agw/ultimatelistctrl.py#L9026-L9065 | ||
wxWidgets/wxPython-Classic | 19571e1ae65f1ac445f5491474121998c97a1bf0 | src/osx_carbon/_gdi.py | python | NativePixelData.__iter__ | (self) | Create and return an iterator object for this pixel data
object. (It's really a generator but I won't tell if you
don't tell.) | Create and return an iterator object for this pixel data
object. (It's really a generator but I won't tell if you
don't tell.) | [
"Create",
"and",
"return",
"an",
"iterator",
"object",
"for",
"this",
"pixel",
"data",
"object",
".",
"(",
"It",
"s",
"really",
"a",
"generator",
"but",
"I",
"won",
"t",
"tell",
"if",
"you",
"don",
"t",
"tell",
".",
")"
] | def __iter__(self):
"""
Create and return an iterator object for this pixel data
object. (It's really a generator but I won't tell if you
don't tell.)
"""
width = self.GetWidth()
height = self.GetHeight()
pixels = self.GetPixels()
cla... | [
"def",
"__iter__",
"(",
"self",
")",
":",
"width",
"=",
"self",
".",
"GetWidth",
"(",
")",
"height",
"=",
"self",
".",
"GetHeight",
"(",
")",
"pixels",
"=",
"self",
".",
"GetPixels",
"(",
")",
"class",
"PixelFacade",
"(",
"object",
")",
":",
"def",
... | https://github.com/wxWidgets/wxPython-Classic/blob/19571e1ae65f1ac445f5491474121998c97a1bf0/src/osx_carbon/_gdi.py#L1037-L1070 | ||
KhronosGroup/SPIRV-Tools | 940127a77d3ad795a4a1422fbeaad50c9f19f2ea | utils/generate_grammar_tables.py | python | generate_instruction_table | (inst_table) | return '{}\n\n{}\n\n{}'.format(caps_arrays, exts_arrays, '\n'.join(insts)) | Returns the info table containing all SPIR-V instructions, sorted by
opcode, and prefixed by capability arrays.
Note:
- the built-in sorted() function is guaranteed to be stable.
https://docs.python.org/3/library/functions.html#sorted
Arguments:
- inst_table: a list containing all SPIR... | Returns the info table containing all SPIR-V instructions, sorted by
opcode, and prefixed by capability arrays. | [
"Returns",
"the",
"info",
"table",
"containing",
"all",
"SPIR",
"-",
"V",
"instructions",
"sorted",
"by",
"opcode",
"and",
"prefixed",
"by",
"capability",
"arrays",
"."
] | def generate_instruction_table(inst_table):
"""Returns the info table containing all SPIR-V instructions, sorted by
opcode, and prefixed by capability arrays.
Note:
- the built-in sorted() function is guaranteed to be stable.
https://docs.python.org/3/library/functions.html#sorted
Argume... | [
"def",
"generate_instruction_table",
"(",
"inst_table",
")",
":",
"inst_table",
"=",
"sorted",
"(",
"inst_table",
",",
"key",
"=",
"lambda",
"k",
":",
"(",
"k",
"[",
"'opcode'",
"]",
",",
"k",
"[",
"'opname'",
"]",
")",
")",
"caps_arrays",
"=",
"generate... | https://github.com/KhronosGroup/SPIRV-Tools/blob/940127a77d3ad795a4a1422fbeaad50c9f19f2ea/utils/generate_grammar_tables.py#L338-L360 | |
wxWidgets/wxPython-Classic | 19571e1ae65f1ac445f5491474121998c97a1bf0 | wx/tools/Editra/src/eclib/ctrlbox.py | python | SegmentBar.GetSelection | (self) | return self._selected | Get the currently selected index | Get the currently selected index | [
"Get",
"the",
"currently",
"selected",
"index"
] | def GetSelection(self):
"""Get the currently selected index"""
return self._selected | [
"def",
"GetSelection",
"(",
"self",
")",
":",
"return",
"self",
".",
"_selected"
] | https://github.com/wxWidgets/wxPython-Classic/blob/19571e1ae65f1ac445f5491474121998c97a1bf0/wx/tools/Editra/src/eclib/ctrlbox.py#L928-L930 | |
weolar/miniblink49 | 1c4678db0594a4abde23d3ebbcc7cd13c3170777 | third_party/WebKit/Tools/Scripts/webkitpy/thirdparty/irc/irclib.py | python | ServerConnection.list | (self, channels=None, server="") | Send a LIST command. | Send a LIST command. | [
"Send",
"a",
"LIST",
"command",
"."
] | def list(self, channels=None, server=""):
"""Send a LIST command."""
command = "LIST"
if channels:
command = command + " " + ",".join(channels)
if server:
command = command + " " + server
self.send_raw(command) | [
"def",
"list",
"(",
"self",
",",
"channels",
"=",
"None",
",",
"server",
"=",
"\"\"",
")",
":",
"command",
"=",
"\"LIST\"",
"if",
"channels",
":",
"command",
"=",
"command",
"+",
"\" \"",
"+",
"\",\"",
".",
"join",
"(",
"channels",
")",
"if",
"server... | https://github.com/weolar/miniblink49/blob/1c4678db0594a4abde23d3ebbcc7cd13c3170777/third_party/WebKit/Tools/Scripts/webkitpy/thirdparty/irc/irclib.py#L706-L713 | ||
baidu-research/tensorflow-allreduce | 66d5b855e90b0949e9fa5cca5599fd729a70e874 | tensorflow/contrib/timeseries/python/timeseries/math_utils.py | python | sign_magnitude_positive_definite | (
raw, off_diagonal_scale=0., overall_scale=0.) | return math_ops.matmul(cholesky_factor, cholesky_factor, transpose_a=True) | Constructs a positive definite matrix from an unconstrained input matrix.
We want to keep the whole matrix on a log scale, but also allow off-diagonal
elements to be negative, so the sign of off-diagonal elements is modeled
separately from their magnitude (using the lower and upper triangles
respectively). Spe... | Constructs a positive definite matrix from an unconstrained input matrix. | [
"Constructs",
"a",
"positive",
"definite",
"matrix",
"from",
"an",
"unconstrained",
"input",
"matrix",
"."
] | def sign_magnitude_positive_definite(
raw, off_diagonal_scale=0., overall_scale=0.):
"""Constructs a positive definite matrix from an unconstrained input matrix.
We want to keep the whole matrix on a log scale, but also allow off-diagonal
elements to be negative, so the sign of off-diagonal elements is model... | [
"def",
"sign_magnitude_positive_definite",
"(",
"raw",
",",
"off_diagonal_scale",
"=",
"0.",
",",
"overall_scale",
"=",
"0.",
")",
":",
"raw",
"=",
"ops",
".",
"convert_to_tensor",
"(",
"raw",
")",
"diagonal",
"=",
"array_ops",
".",
"matrix_diag_part",
"(",
"r... | https://github.com/baidu-research/tensorflow-allreduce/blob/66d5b855e90b0949e9fa5cca5599fd729a70e874/tensorflow/contrib/timeseries/python/timeseries/math_utils.py#L317-L374 | |
deepmind/open_spiel | 4ca53bea32bb2875c7385d215424048ae92f78c8 | open_spiel/python/examples/tic_tac_toe_qlearner.py | python | command_line_action | (time_step) | return action | Gets a valid action from the user on the command line. | Gets a valid action from the user on the command line. | [
"Gets",
"a",
"valid",
"action",
"from",
"the",
"user",
"on",
"the",
"command",
"line",
"."
] | def command_line_action(time_step):
"""Gets a valid action from the user on the command line."""
current_player = time_step.observations["current_player"]
legal_actions = time_step.observations["legal_actions"][current_player]
action = -1
while action not in legal_actions:
print("Choose an action from {}:... | [
"def",
"command_line_action",
"(",
"time_step",
")",
":",
"current_player",
"=",
"time_step",
".",
"observations",
"[",
"\"current_player\"",
"]",
"legal_actions",
"=",
"time_step",
".",
"observations",
"[",
"\"legal_actions\"",
"]",
"[",
"current_player",
"]",
"act... | https://github.com/deepmind/open_spiel/blob/4ca53bea32bb2875c7385d215424048ae92f78c8/open_spiel/python/examples/tic_tac_toe_qlearner.py#L58-L71 | |
google/or-tools | 2cb85b4eead4c38e1c54b48044f92087cf165bce | ortools/constraint_solver/samples/simple_cp_program.py | python | main | () | Entry point of the program. | Entry point of the program. | [
"Entry",
"point",
"of",
"the",
"program",
"."
] | def main():
"""Entry point of the program."""
# Instantiate the solver.
# [START solver]
solver = pywrapcp.Solver('CPSimple')
# [END solver]
# Create the variables.
# [START variables]
num_vals = 3
x = solver.IntVar(0, num_vals - 1, 'x')
y = solver.IntVar(0, num_vals - 1, 'y')
... | [
"def",
"main",
"(",
")",
":",
"# Instantiate the solver.",
"# [START solver]",
"solver",
"=",
"pywrapcp",
".",
"Solver",
"(",
"'CPSimple'",
")",
"# [END solver]",
"# Create the variables.",
"# [START variables]",
"num_vals",
"=",
"3",
"x",
"=",
"solver",
".",
"IntVa... | https://github.com/google/or-tools/blob/2cb85b4eead4c38e1c54b48044f92087cf165bce/ortools/constraint_solver/samples/simple_cp_program.py#L22-L66 | ||
apple/turicreate | cce55aa5311300e3ce6af93cb45ba791fd1bdf49 | deps/src/libxml2-2.9.1/python/libxml2class.py | python | readerForDoc | (cur, URL, encoding, options) | return xmlTextReader(_obj=ret) | Create an xmltextReader for an XML in-memory document. The
parsing flags @options are a combination of xmlParserOption. | Create an xmltextReader for an XML in-memory document. The
parsing flags | [
"Create",
"an",
"xmltextReader",
"for",
"an",
"XML",
"in",
"-",
"memory",
"document",
".",
"The",
"parsing",
"flags"
] | def readerForDoc(cur, URL, encoding, options):
"""Create an xmltextReader for an XML in-memory document. The
parsing flags @options are a combination of xmlParserOption. """
ret = libxml2mod.xmlReaderForDoc(cur, URL, encoding, options)
if ret is None:raise treeError('xmlReaderForDoc() failed')
ret... | [
"def",
"readerForDoc",
"(",
"cur",
",",
"URL",
",",
"encoding",
",",
"options",
")",
":",
"ret",
"=",
"libxml2mod",
".",
"xmlReaderForDoc",
"(",
"cur",
",",
"URL",
",",
"encoding",
",",
"options",
")",
"if",
"ret",
"is",
"None",
":",
"raise",
"treeErro... | https://github.com/apple/turicreate/blob/cce55aa5311300e3ce6af93cb45ba791fd1bdf49/deps/src/libxml2-2.9.1/python/libxml2class.py#L1162-L1167 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.