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
underlying estimator. | 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
Must fulfill the input assumptions of the
underlying estimator.
"""
return self.best_estimator_.predict_log_proba(X) | [
"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 + '"']
argv.extend(sip_flags())
if opts.no_timestamp:
argv.append("-T")
if not opts.no_docstrings:
argv.append("-o");
if opts.prot_is_public:
argv.append("-P");
if opts.concat:
argv.append("-j")
argv.append(str(opts.split))
if opts.tracing:
argv.append("-r")
argv.append("-c")
argv.append(".")
buildfile = os.path.join("qsci.sbf")
argv.append("-b")
argv.append(buildfile)
if pyqt.pyqt_version >= 0x040000:
argv.append("sip/qscimod4.sip")
else:
argv.append("sip/qscimod3.sip")
os.system(" ".join(argv))
# Check the result.
if not os.access(buildfile, os.F_OK):
sipconfig.error("Unable to create the C++ code.")
# Generate the Makefile.
sipconfig.inform("Creating the Makefile for the %s module..." % mname)
def fix_install(mfile):
if sys.platform != "darwin" or opts.static:
return
mfile.write("\tinstall_name_tool -change libqscintilla2.%u.dylib %s/libqscintilla2.%u.dylib $(DESTDIR)%s/$(TARGET)\n" % (QSCI_API_MAJOR, opts.qscilibdir, QSCI_API_MAJOR, opts.qscimoddir))
if pyqt.pyqt_version >= 0x040000:
class Makefile(pyqt4.QtGuiModuleMakefile):
def generate_target_install(self, mfile):
pyqt4.QtGuiModuleMakefile.generate_target_install(self, mfile)
fix_install(mfile)
else:
class Makefile(pyqt3.QtModuleMakefile):
def generate_target_install(self, mfile):
pyqt3.QtModuleMakefile.generate_target_install(self, mfile)
fix_install(mfile)
installs = []
sipfiles = []
for s in glob.glob("sip/*.sip"):
sipfiles.append(os.path.join("sip", os.path.basename(s)))
installs.append([sipfiles, os.path.join(opts.qscisipdir, mname)])
installs.append(("QScintilla2.api", os.path.join(opts.qscidir, "api", "python")))
# PyQt v4.2 and later can handle MacOS/X universal binaries.
if pyqt.pyqt_version >= 0x040200:
makefile = Makefile(
configuration=pyqt,
build_file="qsci.sbf",
install_dir=opts.qscimoddir,
installs=installs,
static=opts.static,
debug=opts.debug,
universal=pyqt.universal,
arch=pyqt.arch,
prot_is_public=opts.prot_is_public,
deployment_target=pyqt.deployment_target
)
else:
makefile = Makefile(
configuration=pyqt,
build_file="qsci.sbf",
install_dir=opts.qscimoddir,
installs=installs,
static=opts.static,
debug=opts.debug
)
if qsci_define:
makefile.extra_defines.append(qsci_define)
makefile.extra_include_dirs.append(opts.qsciincdir)
makefile.extra_lib_dirs.append(opts.qscilibdir)
makefile.extra_libs.append("qscintilla2")
makefile.generate() | [
"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 params:
for k, v in ps.values().items():
if k in all_params:
raise ValueError('Hyperparameter %r occurs twice with values %r and %r'
% (k, all_params[k], v))
all_params[k] = v
return tf.contrib.training.HParams(**all_params) | [
"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 just accepts the arguments and does nothing.
if frame.identifiers.declared:
self.writeline('if 0: dummy(%s)' % ', '.join(
'l_' + name for name in frame.identifiers.declared)) | [
"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 attribute: ONNX currently requires axis to "
"be specified for squeeze operator")
axis = convert_string_to_list(axis)
node = onnx.helper.make_node(
"Squeeze",
input_nodes,
[name],
axes=axis,
name=name,
)
return [node] | [
"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()
parser.add_argument('--output', '-o', default=None,
help="The name of the output archive. "
"Required if SOURCE is an archive.")
parser.add_argument('--python', '-p', default=None,
help="The name of the Python interpreter to use "
"(default: no shebang line).")
parser.add_argument('--main', '-m', default=None,
help="The main function of the application "
"(default: use an existing __main__.py).")
parser.add_argument('--compress', '-c', action='store_true',
help="Compress files with the deflate method. "
"Files are stored uncompressed by default.")
parser.add_argument('--info', default=False, action='store_true',
help="Display the interpreter from the archive.")
parser.add_argument('source',
help="Source directory (or existing archive).")
args = parser.parse_args(args)
# Handle `python -m zipapp archive.pyz --info`.
if args.info:
if not os.path.isfile(args.source):
raise SystemExit("Can only get info for an archive file")
interpreter = get_interpreter(args.source)
print("Interpreter: {}".format(interpreter or "<none>"))
sys.exit(0)
if os.path.isfile(args.source):
if args.output is None or (os.path.exists(args.output) and
os.path.samefile(args.source, args.output)):
raise SystemExit("In-place editing of archives is not supported")
if args.main:
raise SystemExit("Cannot change the main function when copying")
create_archive(args.source, args.output,
interpreter=args.python, main=args.main,
compressed=args.compress) | [
"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[cdescriptor.name] = container
return container
def Setter(self, new_value):
raise AttributeError('Assignment not allowed to repeated field '
'"%s" in protocol message object.' % cdescriptor.name)
doc = 'Magic attribute generated for "%s" proto field.' % cdescriptor.name
return property(Getter, Setter, doc=doc) | [
"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 = {
'Den_ex': self.growth_curve_i_e,
'Den_in': self.growth_curve_i_i,
'Axon_in': self.growth_curve_i_i,
}
####################################################################################
# Then it is time to create a population with 80% of the total network
# size excitatory neurons and another one with 20% of the total network
# size of inhibitory neurons.
self.nodes_e = nest.Create('iaf_psc_alpha',
self.number_excitatory_neurons,
{'synaptic_elements': synaptic_elements})
self.nodes_i = nest.Create('iaf_psc_alpha',
self.number_inhibitory_neurons,
{'synaptic_elements': synaptic_elements_i})
self.nodes_e.synaptic_elements = synaptic_elements
self.nodes_i.synaptic_elements = 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):
converted = converted.t
control_inputs.append(converted)
if control_inputs:
with ops.control_dependencies(control_inputs):
inp = array_ops.identity(inp)
return inp, stacked | [
"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 ImportError(str(exc)) | [
"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(builder, node, err, builder.add_min_broadcastable) | [
"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)
return refactor_ifs(right, ifs)
return stmnt | [
"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.
if self.frame_returning:
caller_frame = self.frame_returning.f_back
if caller_frame and not caller_frame.f_trace:
caller_frame.f_trace = self.trace_dispatch
self._set_stopinfo(None, None) | [
"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['drawstyle'] = ConfigService.getString("plots.line.DrawStyle")
kwargs['linewidth'] = float(ConfigService.getString("plots.line.Width"))
kwargs['marker'] = MARKER_MAP[ConfigService.getString("plots.marker.Style")]
if self._error_bars:
kwargs['capsize'] = float(ConfigService.getString("plots.errorbar.Capsize"))
kwargs['capthick'] = float(ConfigService.getString("plots.errorbar.CapThickness"))
kwargs['errorevery'] = int(ConfigService.getString("plots.errorbar.errorEvery"))
kwargs['elinewidth'] = float(ConfigService.getString("plots.errorbar.Width"))
return kwargs | [
"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
Changed the default from ``True`` to ``False``, to match
behaviour from before 0.24.0
Returns
-------
Index | 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
.. versionadded:: 0.24.0
.. versionchanged:: 0.24.1
Changed the default from ``True`` to ``False``, to match
behaviour from before 0.24.0
Returns
-------
Index
"""
self._validate_sort_keyword(sort)
self._assert_can_do_setop(other)
other, result_names = self._convert_can_do_setop(other)
if self.equals(other):
return self
self_tuples = self._ndarray_values
other_tuples = other._ndarray_values
uniq_tuples = set(self_tuples) & set(other_tuples)
if sort is None:
uniq_tuples = sorted(uniq_tuples)
if len(uniq_tuples) == 0:
return MultiIndex(levels=self.levels,
codes=[[]] * self.nlevels,
names=result_names, verify_integrity=False)
else:
return MultiIndex.from_arrays(lzip(*uniq_tuples), sortorder=0,
names=result_names) | [
"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 ndarray as well for internal correctness.
Parameters
----------
ndarray: numpy.ndarray
input data
zero_copy: bool
Whether we use DLPack's zero-copy conversion to convert to MXNet's NDArray.
This is only available for c-contiguous arrays, i.e. array.flags[C_CONTIGUOUS] == True.
Returns
-------
NDArray
a NDArray backed by a dlpack tensor | 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 ndarray as well for internal correctness. | [
"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, and it is suggested
not to read the numpy ndarray as well for internal correctness.
Parameters
----------
ndarray: numpy.ndarray
input data
zero_copy: bool
Whether we use DLPack's zero-copy conversion to convert to MXNet's NDArray.
This is only available for c-contiguous arrays, i.e. array.flags[C_CONTIGUOUS] == True.
Returns
-------
NDArray
a NDArray backed by a dlpack tensor
"""
def _make_manager_ctx(obj):
pyobj = ctypes.py_object(obj)
void_p = ctypes.c_void_p.from_buffer(pyobj)
ctypes.pythonapi.Py_IncRef(pyobj)
return void_p
def _make_dl_tensor(array):
if str(array.dtype) not in DLDataType.TYPE_MAP:
raise ValueError(str(array.dtype) + " is not supported.")
dl_tensor = DLTensor()
dl_tensor.data = array.ctypes.data_as(ctypes.c_void_p)
dl_tensor.ctx = DLContext(1, 0)
dl_tensor.ndim = array.ndim
dl_tensor.dtype = DLDataType.TYPE_MAP[str(array.dtype)]
dl_tensor.shape = array.ctypes.shape_as(ctypes.c_int64)
dl_tensor.strides = None
dl_tensor.byte_offset = 0
return dl_tensor
def _make_dl_managed_tensor(array):
c_obj = DLManagedTensor()
c_obj.dl_tensor = _make_dl_tensor(array)
c_obj.manager_ctx = _make_manager_ctx(array)
c_obj.deleter = dl_managed_tensor_deleter
return c_obj
if not zero_copy:
return array(ndarray, dtype=ndarray.dtype)
if not ndarray.flags['C_CONTIGUOUS']:
raise ValueError("Only c-contiguous arrays are supported for zero-copy")
ndarray.flags['WRITEABLE'] = False
c_obj = _make_dl_managed_tensor(ndarray)
handle = NDArrayHandle()
check_call(_LIB.MXNDArrayFromDLPackEx(ctypes.byref(c_obj), True, ctypes.byref(handle)))
return NDArray(handle=handle) | [
"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.20798075e-6, 1.15895083e-5,
1.63778560e-5, 2.31228459e-5, 3.26800649e-5, 4.61329334e-5,
6.52101085e-5, 9.20390575e-5, 1.30122935e-4, 1.83620431e-4,
2.59656626e-4, 3.66311982e-4, 5.18141184e-4, 7.30717340e-4,
1.03392184e-3, 1.45742714e-3, 2.06292302e-3, 2.90599911e-3,
4.11471902e-3, 5.79042763e-3, 8.20004722e-3, 1.15192930e-2,
1.63039133e-2, 2.28257757e-2, 3.22249222e-2, 4.47864328e-2,
6.27329625e-2, 8.57059100e-2, 1.17418314e-1, 1.53632655e-1,
1.97717964e-1, 2.28849849e-1, 2.40311038e-1, 1.65409220e-1,
2.84701476e-3, -2.88016057e-1, -3.69097406e-1, -2.50107514e-2,
5.71811256e-1, -3.92261572e-1, 7.63280044e-2, 5.16233994e-2,
-6.48012082e-2, 4.89047141e-2, -3.26936331e-2, 2.10539842e-2,
-1.33862549e-2, 8.47124695e-3, -5.35123972e-3, 3.37796651e-3,
-2.13174466e-3, 1.34513833e-3, -8.48749612e-4, 5.35531006e-4,
-3.37898780e-4, 2.13200109e-4, -1.34520273e-4, 8.48765787e-5,
-5.35535069e-5, 3.37899801e-5, -2.13200365e-5, 1.34520337e-5,
-8.48765949e-6, 5.35535110e-6, -3.37899811e-6, 2.13200368e-6,
-1.34520338e-6, 8.48765951e-7, -5.35535110e-7, 3.37899811e-7],
np.float)
nc = np.int(80)
nc0 = np.int(40)
elif order == 2: # cos
fc = np.array([
1.63740363e-7, 1.83719709e-7, 2.06136904e-7, 2.31289411e-7,
2.59510987e-7, 2.91176117e-7, 3.26704977e-7, 3.66569013e-7,
4.11297197e-7, 4.61483045e-7, 5.17792493e-7, 5.80972733e-7,
6.51862128e-7, 7.31401337e-7, 8.20645798e-7, 9.20779729e-7,
1.03313185e-6, 1.15919300e-6, 1.30063594e-6, 1.45933752e-6,
1.63740363e-6, 1.83719709e-6, 2.06136904e-6, 2.31289411e-6,
2.59510987e-6, 2.91176117e-6, 3.26704977e-6, 3.66569013e-6,
4.11297197e-6, 4.61483045e-6, 5.17792493e-6, 5.80972733e-6,
6.51862128e-6, 7.31401337e-6, 8.20645798e-6, 9.20779729e-6,
1.03313185e-5, 1.15919300e-5, 1.30063594e-5, 1.45933752e-5,
1.63740363e-5, 1.83719709e-5, 2.06136904e-5, 2.31289411e-5,
2.59510987e-5, 2.91176117e-5, 3.26704977e-5, 3.66569013e-5,
4.11297197e-5, 4.61483045e-5, 5.17792493e-5, 5.80972733e-5,
6.51862128e-5, 7.31401337e-5, 8.20645798e-5, 9.20779729e-5,
1.03313185e-4, 1.15919300e-4, 1.30063594e-4, 1.45933752e-4,
1.63740363e-4, 1.83719709e-4, 2.06136904e-4, 2.31289411e-4,
2.59510987e-4, 2.91176117e-4, 3.26704976e-4, 3.66569013e-4,
4.11297197e-4, 4.61483045e-4, 5.17792493e-4, 5.80972733e-4,
6.51862127e-4, 7.31401337e-4, 8.20645797e-4, 9.20779730e-4,
1.03313185e-3, 1.15919300e-3, 1.30063593e-3, 1.45933753e-3,
1.63740362e-3, 1.83719710e-3, 2.06136901e-3, 2.31289411e-3,
2.59510977e-3, 2.91176115e-3, 3.26704948e-3, 3.66569003e-3,
4.11297114e-3, 4.61483003e-3, 5.17792252e-3, 5.80972566e-3,
6.51861416e-3, 7.31400728e-3, 8.20643673e-3, 9.20777603e-3,
1.03312545e-2, 1.15918577e-2, 1.30061650e-2, 1.45931339e-2,
1.63734419e-2, 1.83711757e-2, 2.06118614e-2, 2.31263461e-2,
2.59454421e-2, 2.91092045e-2, 3.26529302e-2, 3.66298115e-2,
4.10749753e-2, 4.60613861e-2, 5.16081994e-2, 5.78193646e-2,
6.46507780e-2, 7.22544422e-2, 8.03873578e-2, 8.92661837e-2,
9.80670729e-2, 1.07049506e-1, 1.13757572e-1, 1.18327217e-1,
1.13965041e-1, 1.00497783e-1, 6.12958082e-2, -1.61234222e-4,
-1.11788551e-1, -2.27536948e-1, -3.39004453e-1, -2.25128800e-1,
8.98279919e-2, 5.12510388e-1, -1.31991937e-1, -3.35136479e-1,
3.64868100e-1, -2.34039961e-1, 1.32085237e-1, -7.56739672e-2,
4.52296662e-2, -2.78297002e-2, 1.73727753e-2, -1.09136894e-2,
6.87397283e-3, -4.33413470e-3, 2.73388730e-3, -1.72477355e-3,
1.08821012e-3, -6.86602007e-4, 4.33213523e-4, -2.73338487e-4,
1.72464733e-4, -1.08817842e-4, 6.86594042e-5, -4.33211523e-5,
2.73337984e-5, -1.72464607e-5, 1.08817810e-5, -6.86593962e-6,
4.33211503e-6, -2.73337979e-6, 1.72464606e-6, -1.08817810e-6,
6.86593961e-7, -4.33211503e-7, 2.73337979e-7, -1.72464606e-7],
np.float)
nc = np.int(164)
nc0 = np.int(122)
elif order == 3: # J0
fc = np.array([
2.89878288e-7, 3.64935144e-7, 4.59426126e-7, 5.78383226e-7,
7.28141338e-7, 9.16675639e-7, 1.15402625e-6, 1.45283298e-6,
1.82900834e-6, 2.30258511e-6, 2.89878286e-6, 3.64935148e-6,
4.59426119e-6, 5.78383236e-6, 7.28141322e-6, 9.16675664e-6,
1.15402621e-5, 1.45283305e-5, 1.82900824e-5, 2.30258527e-5,
2.89878259e-5, 3.64935186e-5, 4.59426051e-5, 5.78383329e-5,
7.28141144e-5, 9.16675882e-5, 1.15402573e-4, 1.45283354e-4,
1.82900694e-4, 2.30258630e-4, 2.89877891e-4, 3.64935362e-4,
4.59424960e-4, 5.78383437e-4, 7.28137738e-4, 9.16674828e-4,
1.15401453e-3, 1.45282561e-3, 1.82896826e-3, 2.30254535e-3,
2.89863979e-3, 3.64916703e-3, 4.59373308e-3, 5.78303238e-3,
7.27941497e-3, 9.16340705e-3, 1.15325691e-2, 1.45145832e-2,
1.82601199e-2, 2.29701042e-2, 2.88702619e-2, 3.62691810e-2,
4.54794031e-2, 5.69408192e-2, 7.09873072e-2, 8.80995426e-2,
1.08223889e-1, 1.31250483e-1, 1.55055715e-1, 1.76371506e-1,
1.85627738e-1, 1.69778044e-1, 1.03405245e-1, -3.02583233e-2,
-2.27574393e-1, -3.62173217e-1, -2.05500446e-1, 3.37394873e-1,
3.17689897e-1, -5.13762160e-1, 3.09130264e-1, -1.26757592e-1,
4.61967890e-2, -1.80968674e-2, 8.35426050e-3, -4.47368304e-3,
2.61974783e-3, -1.60171357e-3, 9.97717882e-4, -6.26275815e-4,
3.94338818e-4, -2.48606354e-4, 1.56808604e-4, -9.89266288e-5,
6.24152398e-5, -3.93805393e-5, 2.48472358e-5, -1.56774945e-5,
9.89181741e-6, -6.24131160e-6, 3.93800058e-6, -2.48471018e-6,
1.56774609e-6, -9.89180896e-7, 6.24130948e-7, -3.93800005e-7,
2.48471005e-7, -1.56774605e-7, 9.89180888e-8, -6.24130946e-8],
np.float)
nc = np.int(100)
nc0 = np.int(60)
elif order == 4: # J1
fc = np.array([
1.84909557e-13, 2.85321327e-13, 4.64471808e-13, 7.16694771e-13,
1.16670043e-12, 1.80025587e-12, 2.93061898e-12, 4.52203829e-12,
7.36138206e-12, 1.13588466e-11, 1.84909557e-11, 2.85321327e-11,
4.64471808e-11, 7.16694771e-11, 1.16670043e-10, 1.80025587e-10,
2.93061898e-10, 4.52203829e-10, 7.36138206e-10, 1.13588466e-9,
1.84909557e-9, 2.85321326e-9, 4.64471806e-9, 7.16694765e-9,
1.16670042e-8, 1.80025583e-8, 2.93061889e-8, 4.52203807e-8,
7.36138149e-8, 1.13588452e-7, 1.84909521e-7, 2.85321237e-7,
4.64471580e-7, 7.16694198e-7, 1.16669899e-6, 1.80025226e-6,
2.93060990e-6, 4.52201549e-6, 7.36132477e-6, 1.13587027e-5,
1.84905942e-5, 2.85312247e-5, 4.64449000e-5, 7.16637480e-5,
1.16655653e-4, 1.79989440e-4, 2.92971106e-4, 4.51975783e-4,
7.35565435e-4, 1.13444615e-3, 1.84548306e-3, 2.84414257e-3,
4.62194743e-3, 7.10980590e-3, 1.15236911e-2, 1.76434485e-2,
2.84076233e-2, 4.29770596e-2, 6.80332569e-2, 9.97845929e-2,
1.51070544e-1, 2.03540581e-1, 2.71235377e-1, 2.76073871e-1,
2.16691977e-1, -7.83723737e-2, -3.40675627e-1, -3.60693673e-1,
5.13024526e-1, -5.94724729e-2, -1.95117123e-1, 1.99235600e-1,
-1.38521553e-1, 8.79320859e-2, -5.50697146e-2, 3.45637848e-2,
-2.17527180e-2, 1.37100291e-2, -8.64656417e-3, 5.45462758e-3,
-3.44138864e-3, 2.17130686e-3, -1.36998628e-3, 8.64398952e-4,
-5.45397874e-4, 3.44122545e-4, -2.17126585e-4, 1.36997597e-4,
-8.64396364e-5, 5.45397224e-5, -3.44122382e-5, 2.17126544e-5,
-1.36997587e-5, 8.64396338e-6, -5.45397218e-6, 3.44122380e-6,
-2.17126543e-6, 1.36997587e-6, -8.64396337e-7, 5.45397218e-7],
np.float)
nc = np.int(100)
nc0 = np.int(60)
return (np.reshape(fc, (-1, 1)), nc, nc0) | [
"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 checks if there is already an end of
# namespace comment and it's incorrect.
#
# TODO(unknown): We always want to check end of namespace comments
# if a namespace is large, but sometimes we also want to apply the
# check if a short namespace contained nontrivial things (something
# other than forward declarations). There is currently no logic on
# deciding what these nontrivial things are, so this check is
# triggered by namespace size only, which works most of the time.
if (linenum - self.starting_linenum < 10
and not Match(r'};*\s*(//|/\*).*\bnamespace\b', line)):
return
# Look for matching comment at end of namespace.
#
# Note that we accept C style "/* */" comments for terminating
# namespaces, so that code that terminate namespaces inside
# preprocessor macros can be cpplint clean.
#
# We also accept stuff like "// end of namespace <name>." with the
# period at the end.
#
# Besides these, we don't accept anything else, otherwise we might
# get false negatives when existing comment is a substring of the
# expected namespace.
if self.name:
# Named namespace
if not Match((r'};*\s*(//|/\*).*\bnamespace\s+' + re.escape(self.name) +
r'[\*/\.\\\s]*$'),
line):
error(filename, linenum, 'readability/namespace', 5,
'Namespace should be terminated with "// namespace %s"' %
self.name)
else:
# Anonymous namespace
if not Match(r'};*\s*(//|/\*).*\bnamespace[\*/\.\\\s]*$', line):
error(filename, linenum, 'readability/namespace', 5,
'Namespace should be terminated with "// namespace"') | [
"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.class_like``.
However, if a class or struct is reparented to a different class or struct (it
is a nested class / struct), it *will* be removed from so that the class view
hierarchy is generated correctly. | 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.class_like``.
However, if a class or struct is reparented to a different class or struct (it
is a nested class / struct), it *will* be removed from so that the class view
hierarchy is generated correctly. | [
"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 to a namespace node, these will remain in ``self.class_like``.
However, if a class or struct is reparented to a different class or struct (it
is a nested class / struct), it *will* be removed from so that the class view
hierarchy is generated correctly.
'''
removals = []
for cl in self.class_like:
parts = cl.name.split("::")
if len(parts) > 1:
# first try and reparent to namespaces
namespace_name = "::".join(parts[:-1])
parent_found = False
for n in self.namespaces:
if n.name == namespace_name:
n.children.append(cl)
cl.parent = n
parent_found = True
break
# if a namespace parent wasn not found, try and reparent to a class
if not parent_found:
# parent class name would be namespace_name
for p_cls in self.class_like:
if p_cls.name == namespace_name:
p_cls.children.append(cl)
cl.parent = p_cls
removals.append(cl)
break
for rm in removals:
if rm in self.class_like:
self.class_like.remove(rm) | [
"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_major = int(version[0])
v_minor = int(re.match('\d+', version[1]).group())
if len(version) >= 3:
v_revision = int(re.match('\d+', version[2]).group())
else:
v_revision = 0
return v_major, v_minor, v_revision | [
"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
obj.rect.y = values[3] * img_h
obj.rect.w = values[4] * img_w - obj.rect.x
obj.rect.h = values[5] * img_h - obj.rect.y
objects.append(obj) | #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
obj.rect.y = values[3] * img_h
obj.rect.w = values[4] * img_w - obj.rect.x
obj.rect.h = values[5] * img_h - obj.rect.y
objects.append(obj) | [
"#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.substract_mean_normalize(self.mean_vals, self.norm_vals)
ex = self.net.create_extractor()
ex.set_light_mode(True)
ex.set_num_threads(self.num_threads)
ex.input("data", mat_in)
ret, mat_out = ex.extract("detection_out")
objects = []
# printf("%d %d %d\n", mat_out.w, mat_out.h, mat_out.c)
# method 1, use ncnn.Mat.row to get the result, no memory copy
for i in range(mat_out.h):
values = mat_out.row(i)
obj = Detect_Object()
obj.label = values[0]
obj.prob = values[1]
obj.rect.x = values[2] * img_w
obj.rect.y = values[3] * img_h
obj.rect.w = values[4] * img_w - obj.rect.x
obj.rect.h = values[5] * img_h - obj.rect.y
objects.append(obj)
"""
#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
obj.rect.y = values[3] * img_h
obj.rect.w = values[4] * img_w - obj.rect.x
obj.rect.h = values[5] * img_h - obj.rect.y
objects.append(obj)
"""
return objects | [
"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(delta, points==0, baselen+points+1)
return bytes(result) | [
"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_pattern, name)] | [
"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_logits has
# inconsistent behavior for logits = inf/-inf.
with ops.name_scope(self.name):
with ops.op_scope([self.logits, event], name):
event = ops.convert_to_tensor(event, name="event")
event = math_ops.cast(event, self.logits.dtype)
logits = self.logits
# sigmoid_cross_entropy_with_logits doesn't broadcast shape,
# so we do this here.
# TODO(b/30637701): Check dynamic shape, and don't broadcast if the
# dynamic shapes are the same.
if (not event.get_shape().is_fully_defined() or
not logits.get_shape().is_fully_defined() or
event.get_shape() != logits.get_shape()):
logits = array_ops.ones_like(event) * logits
event = array_ops.ones_like(logits) * event
return -nn.sigmoid_cross_entropy_with_logits(logits, event) | [
"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 integer.
Returns
-------
r : complex
The value r = a^(1 / (2^k)) - 1 computed with less cancellation.
Notes
-----
The algorithm as formulated in the reference does not handle k=0 or k=1
correctly, so these are special-cased in this implementation.
This function is intended to not allow `a` to belong to the closed
negative real axis, but this constraint is relaxed.
References
----------
.. [1] Awad H. Al-Mohy (2012)
"A more accurate Briggs method for the logarithm",
Numerical Algorithms, 59 : 393--402. | 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 number.
k : integer
A nonnegative integer.
Returns
-------
r : complex
The value r = a^(1 / (2^k)) - 1 computed with less cancellation.
Notes
-----
The algorithm as formulated in the reference does not handle k=0 or k=1
correctly, so these are special-cased in this implementation.
This function is intended to not allow `a` to belong to the closed
negative real axis, but this constraint is relaxed.
References
----------
.. [1] Awad H. Al-Mohy (2012)
"A more accurate Briggs method for the logarithm",
Numerical Algorithms, 59 : 393--402.
"""
if k < 0 or int(k) != k:
raise ValueError('expected a nonnegative integer k')
if k == 0:
return a - 1
elif k == 1:
return np.sqrt(a) - 1
else:
k_hat = k
if np.angle(a) >= np.pi / 2:
a = np.sqrt(a)
k_hat = k - 1
z0 = a - 1
a = np.sqrt(a)
r = 1 + a
for j in range(1, k_hat):
a = np.sqrt(a)
r = r * (1 + a)
r = z0 / r
return r | [
"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 not a zip file" % (self._filename))
print("==> Extracting files, please wait ...")
z = zipfile.ZipFile(self._filename)
try:
for info in z.infolist():
name = info.filename
# don't extract absolute paths or ones with .. in them
if name.startswith('/') or '..' in name:
continue
target = os.path.join(extract_dir, *name.split('/'))
if not target:
continue
if name.endswith('/'):
# directory
self.ensure_directory(target)
else:
# file
data = z.read(info.filename)
f = open(target,'wb')
try:
f.write(data)
finally:
f.close()
del data
unix_attributes = info.external_attr >> 16
if unix_attributes:
os.chmod(target, unix_attributes)
finally:
z.close()
print("==> Extraction done!") | [
"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(target)
cmd = [os.path.abspath(self._executable(target))] + self.options.args
console.info("'%s' will be ran" % cmd)
sys.stdout.flush()
run_env = dict(os.environ)
environ_add_path(run_env, 'LD_LIBRARY_PATH',
self._runfiles_dir(target))
p = subprocess.Popen(cmd, env=run_env, close_fds=True)
p.wait()
self._clean_env()
return p.returncode | [
"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")
if falloff_node is None:
raise MissingXMLNode("SRI reaction requires 'falloff' node", rate_coeff)
SRI_names = list("ABCDE")
SRI_data = FlowMap({})
for name, param in zip(SRI_names, clean_node_text(falloff_node).split()):
SRI_data[name] = float(param)
reaction_attribs["SRI"] = SRI_data
return reaction_attribs | [
"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):
raise OSError("a file with the same name as the desired " \
"dir, '%s', already exists." % newdir)
else:
head, tail = os.path.split(newdir)
if head and not os.path.isdir(head):
_mkdir(head)
#print "_mkdir %s" % repr(newdir)
if tail:
os.mkdir(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 line number, 0 matches all warnings
'append' -- if true, append to the list of filters | 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 class that the warning must be a subclass of
'lineno' -- an integer line number, 0 matches all warnings
'append' -- if true, append to the list of filters
"""
assert action in ("error", "ignore", "always", "default", "module",
"once"), "invalid action: %r" % (action,)
assert isinstance(lineno, int) and lineno >= 0, \
"lineno must be an int >= 0"
item = (action, None, category, None, lineno)
if append:
filters.append(item)
else:
filters.insert(0, item) | [
"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 _NestingState instance which maintains information about
the current stack of nested blocks being parsed.
error: The function to call with any errors found. | 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_lines: A CleansedLines instance containing the file.
linenum: The number of the line to check.
nesting_state: A _NestingState instance which maintains information about
the current stack of nested blocks being parsed.
error: The function to call with any errors found.
"""
# Do nothing if there is no '&' on current line.
line = clean_lines.elided[linenum]
if '&' not in line:
return
# Long type names may be broken across multiple lines, usually in one
# of these forms:
# LongType
# ::LongTypeContinued &identifier
# LongType::
# LongTypeContinued &identifier
# LongType<
# ...>::LongTypeContinued &identifier
#
# If we detected a type split across two lines, join the previous
# line to current line so that we can match const references
# accordingly.
#
# Note that this only scans back one line, since scanning back
# arbitrary number of lines would be expensive. If you have a type
# that spans more than 2 lines, please use a typedef.
if linenum > 1:
previous = None
if Match(r'\s*::(?:[\w<>]|::)+\s*&\s*\S', line):
# previous_line\n + ::current_line
previous = Search(r'\b((?:const\s*)?(?:[\w<>]|::)+[\w<>])\s*$',
clean_lines.elided[linenum - 1])
elif Match(r'\s*[a-zA-Z_]([\w<>]|::)+\s*&\s*\S', line):
# previous_line::\n + current_line
previous = Search(r'\b((?:const\s*)?(?:[\w<>]|::)+::)\s*$',
clean_lines.elided[linenum - 1])
if previous:
line = previous.group(1) + line.lstrip()
else:
# Check for templated parameter that is split across multiple lines
endpos = line.rfind('>')
if endpos > -1:
(_, startline, startpos) = ReverseCloseExpression(
clean_lines, linenum, endpos)
if startpos > -1 and startline < linenum:
# Found the matching < on an earlier line, collect all
# pieces up to current line.
line = ''
for i in xrange(startline, linenum + 1):
line += clean_lines.elided[i].strip()
# Check for non-const references in function parameters. A single '&' may
# found in the following places:
# inside expression: binary & for bitwise AND
# inside expression: unary & for taking the address of something
# inside declarators: reference parameter
# We will exclude the first two cases by checking that we are not inside a
# function body, including one that was just introduced by a trailing '{'.
# TODO(unknwon): Doesn't account for preprocessor directives.
# TODO(unknown): Doesn't account for 'catch(Exception& e)' [rare].
check_params = False
if not nesting_state.stack:
check_params = True # top level
elif (isinstance(nesting_state.stack[-1], _ClassInfo) or
isinstance(nesting_state.stack[-1], _NamespaceInfo)):
check_params = True # within class or namespace
elif Match(r'.*{\s*$', line):
if (len(nesting_state.stack) == 1 or
isinstance(nesting_state.stack[-2], _ClassInfo) or
isinstance(nesting_state.stack[-2], _NamespaceInfo)):
check_params = True # just opened global/class/namespace block
# We allow non-const references in a few standard places, like functions
# called "swap()" or iostream operators like "<<" or ">>". Do not check
# those function parameters.
#
# We also accept & in static_assert, which looks like a function but
# it's actually a declaration expression.
whitelisted_functions = (r'(?:[sS]wap(?:<\w:+>)?|'
r'operator\s*[<>][<>]|'
r'static_assert|COMPILE_ASSERT'
r')\s*\(')
if Search(whitelisted_functions, line):
check_params = False
elif not Search(r'\S+\([^)]*$', line):
# Don't see a whitelisted function on this line. Actually we
# didn't see any function name on this line, so this is likely a
# multi-line parameter list. Try a bit harder to catch this case.
for i in xrange(2):
if (linenum > i and
Search(whitelisted_functions, clean_lines.elided[linenum - i - 1])):
check_params = False
break
if check_params:
decls = ReplaceAll(r'{[^}]*}', ' ', line) # exclude function body
for parameter in re.findall(_RE_PATTERN_REF_PARAM, decls):
if not Match(_RE_PATTERN_CONST_REF_PARAM, parameter):
error(filename, linenum, 'runtime/references', 2,
'Is this a non-const reference? '
'If so, make const or use a pointer: ' +
ReplaceAll(' *<', '<', parameter)) | [
"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) == 0:
return False
return True | [
"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.finditer(page.data):
result.add(match.group(1))
return result | [
"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(category)" comments on the offending line. These are
parsed into _error_suppressions.
Args:
filename: The name of the file containing the error.
linenum: The number of the line containing the error.
category: A string used to describe the "category" this bug
falls under: "whitespace", say, or "runtime". Categories
may have a hierarchy separated by slashes: "whitespace/indent".
confidence: A number from 1-5 representing a confidence score for
the error, with 5 meaning that we are certain of the problem,
and 1 meaning that it could be a legitimate construct.
message: The error message. | 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.
False positives can be suppressed by the use of
"cpplint(category)" comments on the offending line. These are
parsed into _error_suppressions.
Args:
filename: The name of the file containing the error.
linenum: The number of the line containing the error.
category: A string used to describe the "category" this bug
falls under: "whitespace", say, or "runtime". Categories
may have a hierarchy separated by slashes: "whitespace/indent".
confidence: A number from 1-5 representing a confidence score for
the error, with 5 meaning that we are certain of the problem,
and 1 meaning that it could be a legitimate construct.
message: The error message.
"""
if _ShouldPrintError(category, confidence, linenum):
_cpplint_state.IncrementErrorCount(category)
if _cpplint_state.output_format == 'vs7':
sys.stderr.write('%s(%s): %s [%s] [%d]\n' % (
filename, linenum, message, category, confidence))
elif _cpplint_state.output_format == 'eclipse':
sys.stderr.write('%s:%s: warning: %s [%s] [%d]\n' % (
filename, linenum, message, category, confidence))
else:
sys.stderr.write('%s:%s: %s [%s] [%d]\n' % (
filename, linenum, message, category, confidence)) | [
"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/meminfo', 'rb') as f:
for line in f:
if line.startswith(b'Buffers:'):
buffers = int(line.split()[1]) * 1024
elif line.startswith(b'MemShared:'):
shared = int(line.split()[1]) * 1024
avail = inactive + cached + free
used = active + wired + cached
percent = usage_percent((total - avail), total, round_=1)
return svmem(total, avail, percent, used, free,
active, inactive, buffers, cached, shared, wired) | [
"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{int} or C{float} or C{bool} or C{list} or C{dict}
"""
if self._serializer:
if module is "FIFE":
# check whether getAllSettings has been called already
if self._readSettingsCompleted[module] is not True:
value = self._serializer.get(module, name, defaultValue)
if value is not None:
return value
else:
if name in self._defaultSetting[module]:
return self._defaultSetting[module][name]
else:
raise Exception(str(name) + ' is neither in settings.xml nor it has a default value set')
else:
if name in self._settingsFromFile[module]:
return self._settingsFromFile[module][name]
else:
raise Exception(str(name) + ' is neither in settings.xml nor it has a default value set')
else:
return self._serializer.get(module, name, defaultValue)
else:
"""
serializer not set, reading from default value
"""
if name in self._defaultSetting:
return self._defaultSetting[module][name]
else:
raise Exception(str(name) + ' is neither in settings.xml nor it has a default value set') | [
"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
runnumber = int(filename)
if runnumber <= 0:
error_msg = 'Run number cannot be less or equal to zero. User gives {}.'.format(filename)
Logger("Filter_Events").error(error_msg)
return None
else:
ishort = config.getInstrument(self._instrument).shortName()
filename = '{}_{}'.format(ishort, filename)
wsname = filename + "_event"
elif filename.count(".") > 0:
# A proper file name
wsname = os.path.splitext(os.path.split(filename)[1])[0]
elif filename.count("_") == 1:
# A short one as instrument_runnumber
iname = filename.split("_")[0]
str_runnumber = filename.split("_")[1]
if str_runnumber.isdigit() is True and int(str_runnumber) > 0:
# Accepted format
ishort = config.getInstrument(iname).shortName()
wsname = '{}_{}_event'.format(ishort, str_runnumber)
else:
# Non-supported
error_msg = 'File name / run number in such format {} is not supported.'.format(filename)
Logger("Filter_Events").error(error_msg)
return None
else:
# Unsupported format
error_msg = 'File name / run number in such format {} is not supported.'.format(filename)
Logger("Filter_Events").error(error_msg)
return None
# Load
try:
ws = api.Load(Filename=filename, OutputWorkspace=wsname)
except RuntimeError as e:
return str(e)
return ws | [
"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))
val = self._tc.GetValue()
grid.GetTable().SetValue(row, col, val) # update the table
self.startValue = ''
self._tc.SetValue('') | [
"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), output_file)
# Next, append fused gmock-all.cc to gmock-gtest-all.cc.
FuseGMockAllCcToFile(gmock_root, output_file)
output_file.close() | [
"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 ``torch.autograd.profiler``).
This, in turn, results in including CUDA time in the profiler table output,
but not in the JSON trace. | 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
profiling code (same as in the legacy ``torch.autograd.profiler``).
This, in turn, results in including CUDA time in the profiler table output,
but not in the JSON trace.
"""
return torch.autograd._supported_activities() | [
"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.num_players() != 2:
sys.exit("AlphaZero can only handle 2-player games.")
game_type = game.get_type()
if game_type.reward_model != pyspiel.GameType.RewardModel.TERMINAL:
raise ValueError("Game must have terminal rewards.")
if game_type.dynamics != pyspiel.GameType.Dynamics.SEQUENTIAL:
raise ValueError("Game must have sequential turns.")
if game_type.chance_mode != pyspiel.GameType.ChanceMode.DETERMINISTIC:
raise ValueError("Game must be deterministic.")
path = config.path
if not path:
path = tempfile.mkdtemp(prefix="az-{}-{}-".format(
datetime.datetime.now().strftime("%Y-%m-%d-%H-%M"), config.game))
config = config._replace(path=path)
if not os.path.exists(path):
os.makedirs(path)
if not os.path.isdir(path):
sys.exit("{} isn't a directory".format(path))
print("Writing logs and checkpoints to:", path)
print("Model type: %s(%s, %s)" % (config.nn_model, config.nn_width,
config.nn_depth))
with open(os.path.join(config.path, "config.json"), "w") as fp:
fp.write(json.dumps(config._asdict(), indent=2, sort_keys=True) + "\n")
actors = [spawn.Process(actor, kwargs={"game": game, "config": config,
"num": i})
for i in range(config.actors)]
evaluators = [spawn.Process(evaluator, kwargs={"game": game, "config": config,
"num": i})
for i in range(config.evaluators)]
def broadcast(msg):
for proc in actors + evaluators:
proc.queue.put(msg)
try:
learner(game=game, config=config, actors=actors, # pylint: disable=missing-kwoa
evaluators=evaluators, broadcast_fn=broadcast)
except (KeyboardInterrupt, EOFError):
print("Caught a KeyboardInterrupt, stopping early.")
finally:
broadcast("")
# for actor processes to join we have to make sure that their q_in is empty,
# including backed up items
for proc in actors:
while proc.exitcode is None:
while not proc.queue.empty():
proc.queue.get_nowait()
proc.join(JOIN_WAIT_DELAY)
for proc in evaluators:
proc.join() | [
"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(*args, **kwargs) | [
"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
is over any other part of the panedwindow, the result is
an empty list. | 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} or {2 handle}. If the point
is over any other part of the panedwindow, the result is
an empty list.
"""
return self.tk.call(self._w, 'identify', x, y) | [
"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':
return
# The format of PkgInfo is eight characters, representing the bundle type
# and bundle signature, each four characters. If that is missing, four
# '?' characters are used instead.
signature_code = plist.get('CFBundleSignature', '????')
if len(signature_code) != 4: # Wrong length resets everything, too.
signature_code = '?' * 4
dest = os.path.join(os.path.dirname(info_plist), 'PkgInfo')
with open(dest, 'w') as fp:
fp.write('%s%s' % (package_type, signature_code)) | [
"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 send a {UltimateListEvent}, ``False`` otherwise.
:note: This method is meaningful only for checkbox-like and radiobutton-like items. | 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 an item, ``False`` to uncheck it;
:param `sendEvent`: ``True`` to send a {UltimateListEvent}, ``False`` otherwise.
:note: This method is meaningful only for checkbox-like and radiobutton-like items.
"""
# Should we raise an error here?!?
if item.GetKind() == 0 or not item.IsEnabled():
return
if sendEvent:
parent = self.GetParent()
le = UltimateListEvent(wxEVT_COMMAND_LIST_ITEM_CHECKING, parent.GetId())
le.m_itemIndex = item._itemId
le.m_item = item
le.SetEventObject(parent)
if parent.GetEventHandler().ProcessEvent(le):
# Blocked by user
return
item.Check(checked)
self.SetItem(item)
self.RefreshLine(item._itemId)
if not sendEvent:
return
le = UltimateListEvent(wxEVT_COMMAND_LIST_ITEM_CHECKED, parent.GetId())
le.m_itemIndex = item._itemId
le.m_item = item
le.SetEventObject(parent)
parent.GetEventHandler().ProcessEvent(le) | [
"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()
class PixelFacade(object):
def Get(self):
return pixels.Get()
def Set(self, *args, **kw):
return pixels.Set(*args, **kw)
def __str__(self):
return str(self.Get())
def __repr__(self):
return 'pixel(%d,%d): %s' % (x,y,self.Get())
X = property(lambda self: x)
Y = property(lambda self: y)
pf = PixelFacade()
for y in xrange(height):
pixels.MoveTo(self, 0, y)
for x in xrange(width):
yield pf
pixels.nextPixel() | [
"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-V instructions. | 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
Arguments:
- inst_table: a list containing all SPIR-V instructions.
"""
inst_table = sorted(inst_table, key=lambda k: (k['opcode'], k['opname']))
caps_arrays = generate_capability_arrays(
[inst.get('capabilities', []) for inst in inst_table])
exts_arrays = generate_extension_arrays(
[inst.get('extensions', []) for inst in inst_table])
insts = [generate_instruction(inst, False) for inst in inst_table]
insts = ['static const spv_opcode_desc_t kOpcodeTableEntries[] = {{\n'
' {}\n}};'.format(',\n '.join(insts))]
return '{}\n\n{}\n\n{}'.format(caps_arrays, exts_arrays, '\n'.join(insts)) | [
"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). Specifically:
for i < j, we have:
output_cholesky[i, j] = raw[j, i] / (abs(raw[j, i]) + 1) *
exp((off_diagonal_scale + overall_scale + raw[i, j]) / 2)
output_cholesky[i, i] = exp((raw[i, i] + overall_scale) / 2)
output = output_cholesky^T * output_cholesky
where raw, off_diagonal_scale, and overall_scale are
un-constrained real-valued variables. The resulting values are stable
around zero due to the exponential (and the softsign keeps the function
smooth).
Args:
raw: A [..., M, M] Tensor.
off_diagonal_scale: A scalar or [...] shaped Tensor controlling the relative
scale of off-diagonal values in the output matrix.
overall_scale: A scalar or [...] shaped Tensor controlling the overall scale
of the output matrix.
Returns:
The `output` matrix described above, a [..., M, M] positive definite matrix. | 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 modeled
separately from their magnitude (using the lower and upper triangles
respectively). Specifically:
for i < j, we have:
output_cholesky[i, j] = raw[j, i] / (abs(raw[j, i]) + 1) *
exp((off_diagonal_scale + overall_scale + raw[i, j]) / 2)
output_cholesky[i, i] = exp((raw[i, i] + overall_scale) / 2)
output = output_cholesky^T * output_cholesky
where raw, off_diagonal_scale, and overall_scale are
un-constrained real-valued variables. The resulting values are stable
around zero due to the exponential (and the softsign keeps the function
smooth).
Args:
raw: A [..., M, M] Tensor.
off_diagonal_scale: A scalar or [...] shaped Tensor controlling the relative
scale of off-diagonal values in the output matrix.
overall_scale: A scalar or [...] shaped Tensor controlling the overall scale
of the output matrix.
Returns:
The `output` matrix described above, a [..., M, M] positive definite matrix.
"""
raw = ops.convert_to_tensor(raw)
diagonal = array_ops.matrix_diag_part(raw)
def _right_pad_with_ones(tensor, target_rank):
# Allow broadcasting even if overall_scale and off_diagonal_scale have batch
# dimensions
tensor = ops.convert_to_tensor(tensor, dtype=raw.dtype.base_dtype)
return array_ops.reshape(tensor,
array_ops.concat(
[
array_ops.shape(tensor), array_ops.ones(
[target_rank - array_ops.rank(tensor)],
dtype=target_rank.dtype)
],
axis=0))
# We divide the log values by 2 to compensate for the squaring that happens
# when transforming Cholesky factors into positive definite matrices.
sign_magnitude = (gen_math_ops.exp(
(raw + _right_pad_with_ones(off_diagonal_scale, array_ops.rank(raw)) +
_right_pad_with_ones(overall_scale, array_ops.rank(raw))) / 2.) *
nn.softsign(array_ops.matrix_transpose(raw)))
sign_magnitude.set_shape(raw.get_shape())
cholesky_factor = array_ops.matrix_set_diag(
input=array_ops.matrix_band_part(sign_magnitude, 0, -1),
diagonal=gen_math_ops.exp((diagonal + _right_pad_with_ones(
overall_scale, array_ops.rank(diagonal))) / 2.))
return math_ops.matmul(cholesky_factor, cholesky_factor, transpose_a=True) | [
"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 {}:".format(legal_actions))
sys.stdout.flush()
action_str = input()
try:
action = int(action_str)
except ValueError:
continue
return action | [
"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')
z = solver.IntVar(0, num_vals - 1, 'z')
# [END variables]
# Constraint 0: x != y.
# [START constraints]
solver.Add(x != y)
print('Number of constraints: ', solver.Constraints())
# [END constraints]
# Solve the problem.
# [START solve]
decision_builder = solver.Phase([x, y, z], solver.CHOOSE_FIRST_UNBOUND,
solver.ASSIGN_MIN_VALUE)
# [END solve]
# Print solution on console.
# [START print_solution]
count = 0
solver.NewSearch(decision_builder)
while solver.NextSolution():
count += 1
solution = 'Solution {}:\n'.format(count)
for var in [x, y, z]:
solution += ' {} = {}'.format(var.Name(), var.Value())
print(solution)
solver.EndSearch()
print('Number of solutions found: ', count)
# [END print_solution]
# [START advanced]
print('Advanced usage:')
print('Problem solved in ', solver.WallTime(), 'ms')
print('Memory usage: ', pywrapcp.Solver.MemoryUsage(), 'bytes') | [
"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')
return xmlTextReader(_obj=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.