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 |
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
wxWidgets/wxPython-Classic | 19571e1ae65f1ac445f5491474121998c97a1bf0 | src/msw/propgrid.py | python | PGProperty.InsertChild | (*args, **kwargs) | return _propgrid.PGProperty_InsertChild(*args, **kwargs) | InsertChild(self, int index, PGProperty childProperty) -> PGProperty | InsertChild(self, int index, PGProperty childProperty) -> PGProperty | [
"InsertChild",
"(",
"self",
"int",
"index",
"PGProperty",
"childProperty",
")",
"-",
">",
"PGProperty"
] | def InsertChild(*args, **kwargs):
"""InsertChild(self, int index, PGProperty childProperty) -> PGProperty"""
return _propgrid.PGProperty_InsertChild(*args, **kwargs) | [
"def",
"InsertChild",
"(",
"*",
"args",
",",
"*",
"*",
"kwargs",
")",
":",
"return",
"_propgrid",
".",
"PGProperty_InsertChild",
"(",
"*",
"args",
",",
"*",
"*",
"kwargs",
")"
] | https://github.com/wxWidgets/wxPython-Classic/blob/19571e1ae65f1ac445f5491474121998c97a1bf0/src/msw/propgrid.py#L575-L577 | |
facebookincubator/BOLT | 88c70afe9d388ad430cc150cc158641701397f70 | clang/bindings/python/clang/cindex.py | python | SourceRange.__contains__ | (self, other) | return False | Useful to detect the Token/Lexer bug | Useful to detect the Token/Lexer bug | [
"Useful",
"to",
"detect",
"the",
"Token",
"/",
"Lexer",
"bug"
] | def __contains__(self, other):
"""Useful to detect the Token/Lexer bug"""
if not isinstance(other, SourceLocation):
return False
if other.file is None and self.start.file is None:
pass
elif ( self.start.file.name != other.file.name or
other.file.nam... | [
"def",
"__contains__",
"(",
"self",
",",
"other",
")",
":",
"if",
"not",
"isinstance",
"(",
"other",
",",
"SourceLocation",
")",
":",
"return",
"False",
"if",
"other",
".",
"file",
"is",
"None",
"and",
"self",
".",
"start",
".",
"file",
"is",
"None",
... | https://github.com/facebookincubator/BOLT/blob/88c70afe9d388ad430cc150cc158641701397f70/clang/bindings/python/clang/cindex.py#L341-L362 | |
wlanjie/AndroidFFmpeg | 7baf9122f4b8e1c74e7baf4be5c422c7a5ba5aaf | tools/fdk-aac-build/x86/toolchain/lib/python2.7/decimal.py | python | Decimal.__pos__ | (self, context=None) | return ans._fix(context) | Returns a copy, unless it is a sNaN.
Rounds the number (if more then precision digits) | Returns a copy, unless it is a sNaN. | [
"Returns",
"a",
"copy",
"unless",
"it",
"is",
"a",
"sNaN",
"."
] | def __pos__(self, context=None):
"""Returns a copy, unless it is a sNaN.
Rounds the number (if more then precision digits)
"""
if self._is_special:
ans = self._check_nans(context=context)
if ans:
return ans
if context is None:
... | [
"def",
"__pos__",
"(",
"self",
",",
"context",
"=",
"None",
")",
":",
"if",
"self",
".",
"_is_special",
":",
"ans",
"=",
"self",
".",
"_check_nans",
"(",
"context",
"=",
"context",
")",
"if",
"ans",
":",
"return",
"ans",
"if",
"context",
"is",
"None"... | https://github.com/wlanjie/AndroidFFmpeg/blob/7baf9122f4b8e1c74e7baf4be5c422c7a5ba5aaf/tools/fdk-aac-build/x86/toolchain/lib/python2.7/decimal.py#L1083-L1102 | |
catboost/catboost | 167f64f237114a4d10b2b4ee42adb4569137debe | contrib/python/ipython/py2/IPython/core/ultratb.py | python | VerboseTB.debugger | (self, force=False) | Call up the pdb debugger if desired, always clean up the tb
reference.
Keywords:
- force(False): by default, this routine checks the instance call_pdb
flag and does not actually invoke the debugger if the flag is false.
The 'force' option forces the debugger to activa... | Call up the pdb debugger if desired, always clean up the tb
reference. | [
"Call",
"up",
"the",
"pdb",
"debugger",
"if",
"desired",
"always",
"clean",
"up",
"the",
"tb",
"reference",
"."
] | def debugger(self, force=False):
"""Call up the pdb debugger if desired, always clean up the tb
reference.
Keywords:
- force(False): by default, this routine checks the instance call_pdb
flag and does not actually invoke the debugger if the flag is false.
The ... | [
"def",
"debugger",
"(",
"self",
",",
"force",
"=",
"False",
")",
":",
"if",
"force",
"or",
"self",
".",
"call_pdb",
":",
"if",
"self",
".",
"pdb",
"is",
"None",
":",
"self",
".",
"pdb",
"=",
"self",
".",
"debugger_cls",
"(",
")",
"# the system displa... | https://github.com/catboost/catboost/blob/167f64f237114a4d10b2b4ee42adb4569137debe/contrib/python/ipython/py2/IPython/core/ultratb.py#L1208-L1249 | ||
Xilinx/Vitis-AI | fc74d404563d9951b57245443c73bef389f3657f | tools/Vitis-AI-Quantizer/vai_q_tensorflow1.x/tensorflow/contrib/bayesflow/python/ops/monte_carlo_impl.py | python | expectation | (f, samples, log_prob=None, use_reparametrization=True,
axis=0, keep_dims=False, name=None) | r"""Computes the Monte-Carlo approximation of \\(E_p[f(X)]\\).
This function computes the Monte-Carlo approximation of an expectation, i.e.,
\\(E_p[f(X)] \approx= m^{-1} sum_i^m f(x_j), x_j\ ~iid\ p(X)\\)
where:
- `x_j = samples[j, ...]`,
- `log(p(samples)) = log_prob(samples)` and
- `m = prod(shape(s... | r"""Computes the Monte-Carlo approximation of \\(E_p[f(X)]\\). | [
"r",
"Computes",
"the",
"Monte",
"-",
"Carlo",
"approximation",
"of",
"\\\\",
"(",
"E_p",
"[",
"f",
"(",
"X",
")",
"]",
"\\\\",
")",
"."
] | def expectation(f, samples, log_prob=None, use_reparametrization=True,
axis=0, keep_dims=False, name=None):
r"""Computes the Monte-Carlo approximation of \\(E_p[f(X)]\\).
This function computes the Monte-Carlo approximation of an expectation, i.e.,
\\(E_p[f(X)] \approx= m^{-1} sum_i^m f(x_j), x... | [
"def",
"expectation",
"(",
"f",
",",
"samples",
",",
"log_prob",
"=",
"None",
",",
"use_reparametrization",
"=",
"True",
",",
"axis",
"=",
"0",
",",
"keep_dims",
"=",
"False",
",",
"name",
"=",
"None",
")",
":",
"with",
"ops",
".",
"name_scope",
"(",
... | https://github.com/Xilinx/Vitis-AI/blob/fc74d404563d9951b57245443c73bef389f3657f/tools/Vitis-AI-Quantizer/vai_q_tensorflow1.x/tensorflow/contrib/bayesflow/python/ops/monte_carlo_impl.py#L198-L351 | ||
troldal/OpenXLSX | 3eb9c748e3ecd865203fb9946ea86d3c02b3f7d9 | Benchmarks/gbench/tools/gbench/util.py | python | classify_input_file | (filename) | return ftype, err_msg | Return a tuple (type, msg) where 'type' specifies the classified type
of 'filename'. If 'type' is 'IT_Invalid' then 'msg' is a human readable
string represeting the error. | Return a tuple (type, msg) where 'type' specifies the classified type
of 'filename'. If 'type' is 'IT_Invalid' then 'msg' is a human readable
string represeting the error. | [
"Return",
"a",
"tuple",
"(",
"type",
"msg",
")",
"where",
"type",
"specifies",
"the",
"classified",
"type",
"of",
"filename",
".",
"If",
"type",
"is",
"IT_Invalid",
"then",
"msg",
"is",
"a",
"human",
"readable",
"string",
"represeting",
"the",
"error",
"."... | def classify_input_file(filename):
"""
Return a tuple (type, msg) where 'type' specifies the classified type
of 'filename'. If 'type' is 'IT_Invalid' then 'msg' is a human readable
string represeting the error.
"""
ftype = IT_Invalid
err_msg = None
if not os.path.exists(filename):
... | [
"def",
"classify_input_file",
"(",
"filename",
")",
":",
"ftype",
"=",
"IT_Invalid",
"err_msg",
"=",
"None",
"if",
"not",
"os",
".",
"path",
".",
"exists",
"(",
"filename",
")",
":",
"err_msg",
"=",
"\"'%s' does not exist\"",
"%",
"filename",
"elif",
"not",
... | https://github.com/troldal/OpenXLSX/blob/3eb9c748e3ecd865203fb9946ea86d3c02b3f7d9/Benchmarks/gbench/tools/gbench/util.py#L57-L75 | |
apple/turicreate | cce55aa5311300e3ce6af93cb45ba791fd1bdf49 | src/external/coremltools_wrap/coremltools/deps/protobuf/python/google/protobuf/internal/well_known_types.py | python | Any.Pack | (self, msg, type_url_prefix='type.googleapis.com/') | Packs the specified message into current Any message. | Packs the specified message into current Any message. | [
"Packs",
"the",
"specified",
"message",
"into",
"current",
"Any",
"message",
"."
] | def Pack(self, msg, type_url_prefix='type.googleapis.com/'):
"""Packs the specified message into current Any message."""
if len(type_url_prefix) < 1 or type_url_prefix[-1] != '/':
self.type_url = '%s/%s' % (type_url_prefix, msg.DESCRIPTOR.full_name)
else:
self.type_url = '%s%s' % (type_url_prefi... | [
"def",
"Pack",
"(",
"self",
",",
"msg",
",",
"type_url_prefix",
"=",
"'type.googleapis.com/'",
")",
":",
"if",
"len",
"(",
"type_url_prefix",
")",
"<",
"1",
"or",
"type_url_prefix",
"[",
"-",
"1",
"]",
"!=",
"'/'",
":",
"self",
".",
"type_url",
"=",
"'... | https://github.com/apple/turicreate/blob/cce55aa5311300e3ce6af93cb45ba791fd1bdf49/src/external/coremltools_wrap/coremltools/deps/protobuf/python/google/protobuf/internal/well_known_types.py#L70-L76 | ||
root-project/root | fcd3583bb14852bf2e8cd2415717cbaac0e75896 | interpreter/llvm/src/tools/clang/bindings/python/clang/cindex.py | python | Cursor.is_mutable_field | (self) | return conf.lib.clang_CXXField_isMutable(self) | Returns True if the cursor refers to a C++ field that is declared
'mutable'. | Returns True if the cursor refers to a C++ field that is declared
'mutable'. | [
"Returns",
"True",
"if",
"the",
"cursor",
"refers",
"to",
"a",
"C",
"++",
"field",
"that",
"is",
"declared",
"mutable",
"."
] | def is_mutable_field(self):
"""Returns True if the cursor refers to a C++ field that is declared
'mutable'.
"""
return conf.lib.clang_CXXField_isMutable(self) | [
"def",
"is_mutable_field",
"(",
"self",
")",
":",
"return",
"conf",
".",
"lib",
".",
"clang_CXXField_isMutable",
"(",
"self",
")"
] | https://github.com/root-project/root/blob/fcd3583bb14852bf2e8cd2415717cbaac0e75896/interpreter/llvm/src/tools/clang/bindings/python/clang/cindex.py#L1476-L1480 | |
Kitware/ParaView | f760af9124ff4634b23ebbeab95a4f56e0261955 | Wrapping/Python/paraview/simple.py | python | SetActiveConnection | (connection=None, ns=None) | Set the active connection. If the process was run without multi-server
enabled and this method is called with a non-None argument while an
ActiveConnection is present, it will raise a RuntimeError. | Set the active connection. If the process was run without multi-server
enabled and this method is called with a non-None argument while an
ActiveConnection is present, it will raise a RuntimeError. | [
"Set",
"the",
"active",
"connection",
".",
"If",
"the",
"process",
"was",
"run",
"without",
"multi",
"-",
"server",
"enabled",
"and",
"this",
"method",
"is",
"called",
"with",
"a",
"non",
"-",
"None",
"argument",
"while",
"an",
"ActiveConnection",
"is",
"p... | def SetActiveConnection(connection=None, ns=None):
"""Set the active connection. If the process was run without multi-server
enabled and this method is called with a non-None argument while an
ActiveConnection is present, it will raise a RuntimeError."""
if not ns:
ns = globals()
if se... | [
"def",
"SetActiveConnection",
"(",
"connection",
"=",
"None",
",",
"ns",
"=",
"None",
")",
":",
"if",
"not",
"ns",
":",
"ns",
"=",
"globals",
"(",
")",
"if",
"servermanager",
".",
"ActiveConnection",
"!=",
"connection",
":",
"_remove_functions",
"(",
"ns",... | https://github.com/Kitware/ParaView/blob/f760af9124ff4634b23ebbeab95a4f56e0261955/Wrapping/Python/paraview/simple.py#L128-L137 | ||
funnyzhou/Adaptive_Feeding | 9c78182331d8c0ea28de47226e805776c638d46f | lib/fast_rcnn/train_multi_gpu.py | python | get_training_roidb | (imdb) | return imdb.roidb | Returns a roidb (Region of Interest database) for use in training. | Returns a roidb (Region of Interest database) for use in training. | [
"Returns",
"a",
"roidb",
"(",
"Region",
"of",
"Interest",
"database",
")",
"for",
"use",
"in",
"training",
"."
] | def get_training_roidb(imdb):
"""Returns a roidb (Region of Interest database) for use in training."""
if cfg.TRAIN.USE_FLIPPED:
print 'Appending horizontally-flipped training examples...'
imdb.append_flipped_images()
print 'done'
print 'Preparing training data...'
rdl_roidb.pre... | [
"def",
"get_training_roidb",
"(",
"imdb",
")",
":",
"if",
"cfg",
".",
"TRAIN",
".",
"USE_FLIPPED",
":",
"print",
"'Appending horizontally-flipped training examples...'",
"imdb",
".",
"append_flipped_images",
"(",
")",
"print",
"'done'",
"print",
"'Preparing training dat... | https://github.com/funnyzhou/Adaptive_Feeding/blob/9c78182331d8c0ea28de47226e805776c638d46f/lib/fast_rcnn/train_multi_gpu.py#L165-L176 | |
miyosuda/TensorFlowAndroidMNIST | 7b5a4603d2780a8a2834575706e9001977524007 | jni-build/jni/include/tensorflow/python/tools/freeze_graph.py | python | freeze_graph | (input_graph, input_saver, input_binary, input_checkpoint,
output_node_names, restore_op_name, filename_tensor_name,
output_graph, clear_devices, initializer_nodes) | Converts all variables in a graph and checkpoint into constants. | Converts all variables in a graph and checkpoint into constants. | [
"Converts",
"all",
"variables",
"in",
"a",
"graph",
"and",
"checkpoint",
"into",
"constants",
"."
] | def freeze_graph(input_graph, input_saver, input_binary, input_checkpoint,
output_node_names, restore_op_name, filename_tensor_name,
output_graph, clear_devices, initializer_nodes):
"""Converts all variables in a graph and checkpoint into constants."""
if not tf.gfile.Exists(input... | [
"def",
"freeze_graph",
"(",
"input_graph",
",",
"input_saver",
",",
"input_binary",
",",
"input_checkpoint",
",",
"output_node_names",
",",
"restore_op_name",
",",
"filename_tensor_name",
",",
"output_graph",
",",
"clear_devices",
",",
"initializer_nodes",
")",
":",
"... | https://github.com/miyosuda/TensorFlowAndroidMNIST/blob/7b5a4603d2780a8a2834575706e9001977524007/jni-build/jni/include/tensorflow/python/tools/freeze_graph.py#L70-L124 | ||
rbgirshick/caffe-fast-rcnn | 28a579eaf0668850705598b3075b8969f22226d9 | scripts/cpp_lint.py | python | _CppLintState.PrintErrorCounts | (self) | Print a summary of errors by category, and the total. | Print a summary of errors by category, and the total. | [
"Print",
"a",
"summary",
"of",
"errors",
"by",
"category",
"and",
"the",
"total",
"."
] | def PrintErrorCounts(self):
"""Print a summary of errors by category, and the total."""
for category, count in self.errors_by_category.iteritems():
sys.stderr.write('Category \'%s\' errors found: %d\n' %
(category, count))
sys.stderr.write('Total errors found: %d\n' % self.error... | [
"def",
"PrintErrorCounts",
"(",
"self",
")",
":",
"for",
"category",
",",
"count",
"in",
"self",
".",
"errors_by_category",
".",
"iteritems",
"(",
")",
":",
"sys",
".",
"stderr",
".",
"write",
"(",
"'Category \\'%s\\' errors found: %d\\n'",
"%",
"(",
"category... | https://github.com/rbgirshick/caffe-fast-rcnn/blob/28a579eaf0668850705598b3075b8969f22226d9/scripts/cpp_lint.py#L757-L762 | ||
wlanjie/AndroidFFmpeg | 7baf9122f4b8e1c74e7baf4be5c422c7a5ba5aaf | tools/fdk-aac-build/x86/toolchain/lib/python2.7/decimal.py | python | _group_lengths | (grouping) | Convert a localeconv-style grouping into a (possibly infinite)
iterable of integers representing group lengths. | Convert a localeconv-style grouping into a (possibly infinite)
iterable of integers representing group lengths. | [
"Convert",
"a",
"localeconv",
"-",
"style",
"grouping",
"into",
"a",
"(",
"possibly",
"infinite",
")",
"iterable",
"of",
"integers",
"representing",
"group",
"lengths",
"."
] | def _group_lengths(grouping):
"""Convert a localeconv-style grouping into a (possibly infinite)
iterable of integers representing group lengths.
"""
# The result from localeconv()['grouping'], and the input to this
# function, should be a list of integers in one of the
# following three forms:
... | [
"def",
"_group_lengths",
"(",
"grouping",
")",
":",
"# The result from localeconv()['grouping'], and the input to this",
"# function, should be a list of integers in one of the",
"# following three forms:",
"#",
"# (1) an empty list, or",
"# (2) nonempty list of positive integers + [0]",
... | https://github.com/wlanjie/AndroidFFmpeg/blob/7baf9122f4b8e1c74e7baf4be5c422c7a5ba5aaf/tools/fdk-aac-build/x86/toolchain/lib/python2.7/decimal.py#L6073-L6094 | ||
CNugteren/CLBlast | 4500a03440e2cc54998c0edab366babf5e504d67 | scripts/generator/generator/routine.py | python | Routine.buffer_def_wrapper_cl | (self, name, flavour) | return [] | As above but for OpenCL | As above but for OpenCL | [
"As",
"above",
"but",
"for",
"OpenCL"
] | def buffer_def_wrapper_cl(self, name, flavour):
"""As above but for OpenCL"""
prefix = "const " if name in self.inputs else ""
if name in self.inputs or name in self.outputs:
a = [prefix + "Buffer<" + flavour.buffer_type + ">& " + name + "_buffer"]
b = ["const size_t " + ... | [
"def",
"buffer_def_wrapper_cl",
"(",
"self",
",",
"name",
",",
"flavour",
")",
":",
"prefix",
"=",
"\"const \"",
"if",
"name",
"in",
"self",
".",
"inputs",
"else",
"\"\"",
"if",
"name",
"in",
"self",
".",
"inputs",
"or",
"name",
"in",
"self",
".",
"out... | https://github.com/CNugteren/CLBlast/blob/4500a03440e2cc54998c0edab366babf5e504d67/scripts/generator/generator/routine.py#L281-L289 | |
mindspore-ai/mindspore | fb8fd3338605bb34fa5cea054e535a8b1d753fab | mindspore/python/mindspore/ops/composite/multitype_ops/pow_impl.py | python | _tensor_pow_list | (x, y) | return F.tensor_pow(x, y) | Returns x ** y where x is a tensor and y is a list. | Returns x ** y where x is a tensor and y is a list. | [
"Returns",
"x",
"**",
"y",
"where",
"x",
"is",
"a",
"tensor",
"and",
"y",
"is",
"a",
"list",
"."
] | def _tensor_pow_list(x, y):
"""Returns x ** y where x is a tensor and y is a list. """
y = utils.sequence_to_tensor(y, x.dtype)
return F.tensor_pow(x, y) | [
"def",
"_tensor_pow_list",
"(",
"x",
",",
"y",
")",
":",
"y",
"=",
"utils",
".",
"sequence_to_tensor",
"(",
"y",
",",
"x",
".",
"dtype",
")",
"return",
"F",
".",
"tensor_pow",
"(",
"x",
",",
"y",
")"
] | https://github.com/mindspore-ai/mindspore/blob/fb8fd3338605bb34fa5cea054e535a8b1d753fab/mindspore/python/mindspore/ops/composite/multitype_ops/pow_impl.py#L76-L79 | |
mindspore-ai/mindspore | fb8fd3338605bb34fa5cea054e535a8b1d753fab | mindspore/python/mindspore/train/model.py | python | _transfer_tensor_to_tuple | (inputs) | return inputs | If the input is a tensor, convert it to a tuple. If not, the output is unchanged. | If the input is a tensor, convert it to a tuple. If not, the output is unchanged. | [
"If",
"the",
"input",
"is",
"a",
"tensor",
"convert",
"it",
"to",
"a",
"tuple",
".",
"If",
"not",
"the",
"output",
"is",
"unchanged",
"."
] | def _transfer_tensor_to_tuple(inputs):
"""
If the input is a tensor, convert it to a tuple. If not, the output is unchanged.
"""
if isinstance(inputs, Tensor):
return (inputs,)
return inputs | [
"def",
"_transfer_tensor_to_tuple",
"(",
"inputs",
")",
":",
"if",
"isinstance",
"(",
"inputs",
",",
"Tensor",
")",
":",
"return",
"(",
"inputs",
",",
")",
"return",
"inputs"
] | https://github.com/mindspore-ai/mindspore/blob/fb8fd3338605bb34fa5cea054e535a8b1d753fab/mindspore/python/mindspore/train/model.py#L47-L54 | |
wxWidgets/wxPython-Classic | 19571e1ae65f1ac445f5491474121998c97a1bf0 | src/osx_carbon/_core.py | python | Sizer.InsertSizer | (self, *args, **kw) | return self.Insert(*args, **kw) | Compatibility alias for `Insert`. | Compatibility alias for `Insert`. | [
"Compatibility",
"alias",
"for",
"Insert",
"."
] | def InsertSizer(self, *args, **kw):
"""Compatibility alias for `Insert`."""
return self.Insert(*args, **kw) | [
"def",
"InsertSizer",
"(",
"self",
",",
"*",
"args",
",",
"*",
"*",
"kw",
")",
":",
"return",
"self",
".",
"Insert",
"(",
"*",
"args",
",",
"*",
"*",
"kw",
")"
] | https://github.com/wxWidgets/wxPython-Classic/blob/19571e1ae65f1ac445f5491474121998c97a1bf0/src/osx_carbon/_core.py#L14734-L14736 | |
nodejs/nan | 8db8c8f544f2b6ce1b0859ef6ecdd0a3873a9e62 | cpplint.py | python | CheckSectionSpacing | (filename, clean_lines, class_info, linenum, error) | Checks for additional blank line issues related to sections.
Currently the only thing checked here is blank line before protected/private.
Args:
filename: The name of the current file.
clean_lines: A CleansedLines instance containing the file.
class_info: A _ClassInfo objects.
linenum: The number ... | Checks for additional blank line issues related to sections. | [
"Checks",
"for",
"additional",
"blank",
"line",
"issues",
"related",
"to",
"sections",
"."
] | def CheckSectionSpacing(filename, clean_lines, class_info, linenum, error):
"""Checks for additional blank line issues related to sections.
Currently the only thing checked here is blank line before protected/private.
Args:
filename: The name of the current file.
clean_lines: A CleansedLines instance co... | [
"def",
"CheckSectionSpacing",
"(",
"filename",
",",
"clean_lines",
",",
"class_info",
",",
"linenum",
",",
"error",
")",
":",
"# Skip checks if the class is small, where small means 25 lines or less.",
"# 25 lines seems like a good cutoff since that's the usual height of",
"# termina... | https://github.com/nodejs/nan/blob/8db8c8f544f2b6ce1b0859ef6ecdd0a3873a9e62/cpplint.py#L3894-L3946 | ||
catboost/catboost | 167f64f237114a4d10b2b4ee42adb4569137debe | contrib/python/scipy/py2/scipy/io/harwell_boeing/hb.py | python | hb_read | (path_or_open_file) | Read HB-format file.
Parameters
----------
path_or_open_file : path-like or file-like
If a file-like object, it is used as-is. Otherwise it is opened
before reading.
Returns
-------
data : scipy.sparse.csc_matrix instance
The data read from the HB file as a sparse matri... | Read HB-format file. | [
"Read",
"HB",
"-",
"format",
"file",
"."
] | def hb_read(path_or_open_file):
"""Read HB-format file.
Parameters
----------
path_or_open_file : path-like or file-like
If a file-like object, it is used as-is. Otherwise it is opened
before reading.
Returns
-------
data : scipy.sparse.csc_matrix instance
The data ... | [
"def",
"hb_read",
"(",
"path_or_open_file",
")",
":",
"def",
"_get_matrix",
"(",
"fid",
")",
":",
"hb",
"=",
"HBFile",
"(",
"fid",
")",
"return",
"hb",
".",
"read_matrix",
"(",
")",
"if",
"hasattr",
"(",
"path_or_open_file",
",",
"'read'",
")",
":",
"r... | https://github.com/catboost/catboost/blob/167f64f237114a4d10b2b4ee42adb4569137debe/contrib/python/scipy/py2/scipy/io/harwell_boeing/hb.py#L472-L504 | ||
ChromiumWebApps/chromium | c7361d39be8abd1574e6ce8957c8dbddd4c6ccf7 | third_party/markdown/blockprocessors.py | python | BlockQuoteProcessor.clean | (self, line) | Remove ``>`` from beginning of a line. | Remove ``>`` from beginning of a line. | [
"Remove",
">",
"from",
"beginning",
"of",
"a",
"line",
"."
] | def clean(self, line):
""" Remove ``>`` from beginning of a line. """
m = self.RE.match(line)
if line.strip() == ">":
return ""
elif m:
return m.group(2)
else:
return line | [
"def",
"clean",
"(",
"self",
",",
"line",
")",
":",
"m",
"=",
"self",
".",
"RE",
".",
"match",
"(",
"line",
")",
"if",
"line",
".",
"strip",
"(",
")",
"==",
"\">\"",
":",
"return",
"\"\"",
"elif",
"m",
":",
"return",
"m",
".",
"group",
"(",
"... | https://github.com/ChromiumWebApps/chromium/blob/c7361d39be8abd1574e6ce8957c8dbddd4c6ccf7/third_party/markdown/blockprocessors.py#L318-L326 | ||
catboost/catboost | 167f64f237114a4d10b2b4ee42adb4569137debe | contrib/tools/python3/src/Lib/xml/sax/_exceptions.py | python | SAXParseException.__init__ | (self, msg, exception, locator) | Creates the exception. The exception parameter is allowed to be None. | Creates the exception. The exception parameter is allowed to be None. | [
"Creates",
"the",
"exception",
".",
"The",
"exception",
"parameter",
"is",
"allowed",
"to",
"be",
"None",
"."
] | def __init__(self, msg, exception, locator):
"Creates the exception. The exception parameter is allowed to be None."
SAXException.__init__(self, msg, exception)
self._locator = locator
# We need to cache this stuff at construction time.
# If this exception is raised, the objects... | [
"def",
"__init__",
"(",
"self",
",",
"msg",
",",
"exception",
",",
"locator",
")",
":",
"SAXException",
".",
"__init__",
"(",
"self",
",",
"msg",
",",
"exception",
")",
"self",
".",
"_locator",
"=",
"locator",
"# We need to cache this stuff at construction time.... | https://github.com/catboost/catboost/blob/167f64f237114a4d10b2b4ee42adb4569137debe/contrib/tools/python3/src/Lib/xml/sax/_exceptions.py#L59-L70 | ||
aws/lumberyard | f85344403c1c2e77ec8c75deb2c116e97b713217 | dev/Gems/CloudGemMetric/v1/AWS/python/windows/Lib/numba/npyufunc/array_exprs.py | python | _lower_array_expr | (lowerer, expr) | return npyimpl.numpy_ufunc_kernel(
context, builder, outer_sig, args, ExprKernel, explicit_output=False) | Lower an array expression built by RewriteArrayExprs. | Lower an array expression built by RewriteArrayExprs. | [
"Lower",
"an",
"array",
"expression",
"built",
"by",
"RewriteArrayExprs",
"."
] | def _lower_array_expr(lowerer, expr):
'''Lower an array expression built by RewriteArrayExprs.
'''
expr_name = "__numba_array_expr_%s" % (hex(hash(expr)).replace("-", "_"))
expr_filename = expr.loc.filename
expr_var_list = expr.list_vars()
# The expression may use a given variable several times,... | [
"def",
"_lower_array_expr",
"(",
"lowerer",
",",
"expr",
")",
":",
"expr_name",
"=",
"\"__numba_array_expr_%s\"",
"%",
"(",
"hex",
"(",
"hash",
"(",
"expr",
")",
")",
".",
"replace",
"(",
"\"-\"",
",",
"\"_\"",
")",
")",
"expr_filename",
"=",
"expr",
"."... | https://github.com/aws/lumberyard/blob/f85344403c1c2e77ec8c75deb2c116e97b713217/dev/Gems/CloudGemMetric/v1/AWS/python/windows/Lib/numba/npyufunc/array_exprs.py#L334-L411 | |
adobe/chromium | cfe5bf0b51b1f6b9fe239c2a3c2f2364da9967d7 | third_party/protobuf/python/google/protobuf/internal/python_message.py | python | _AddHasExtensionMethod | (cls) | Helper for _AddMessageMethods(). | Helper for _AddMessageMethods(). | [
"Helper",
"for",
"_AddMessageMethods",
"()",
"."
] | def _AddHasExtensionMethod(cls):
"""Helper for _AddMessageMethods()."""
def HasExtension(self, extension_handle):
_VerifyExtensionHandle(self, extension_handle)
if extension_handle.label == _FieldDescriptor.LABEL_REPEATED:
raise KeyError('"%s" is repeated.' % extension_handle.full_name)
if extens... | [
"def",
"_AddHasExtensionMethod",
"(",
"cls",
")",
":",
"def",
"HasExtension",
"(",
"self",
",",
"extension_handle",
")",
":",
"_VerifyExtensionHandle",
"(",
"self",
",",
"extension_handle",
")",
"if",
"extension_handle",
".",
"label",
"==",
"_FieldDescriptor",
"."... | https://github.com/adobe/chromium/blob/cfe5bf0b51b1f6b9fe239c2a3c2f2364da9967d7/third_party/protobuf/python/google/protobuf/internal/python_message.py#L627-L639 | ||
H-uru/Plasma | c2140ea046e82e9c199e257a7f2e7edb42602871 | Scripts/Python/xDialogClothingBB.py | python | xDialogClothingBB.OnClothingUpdate | (self) | Avatars clothing has changed | Avatars clothing has changed | [
"Avatars",
"clothing",
"has",
"changed"
] | def OnClothingUpdate(self):
"Avatars clothing has changed"
#PtDebugPrint("xDialogClothingBB: Clothing Update, update clothing dialog")
avatar = PtGetLocalAvatar()
self.IUpdateClothingButtons(avatar) | [
"def",
"OnClothingUpdate",
"(",
"self",
")",
":",
"#PtDebugPrint(\"xDialogClothingBB: Clothing Update, update clothing dialog\")",
"avatar",
"=",
"PtGetLocalAvatar",
"(",
")",
"self",
".",
"IUpdateClothingButtons",
"(",
"avatar",
")"
] | https://github.com/H-uru/Plasma/blob/c2140ea046e82e9c199e257a7f2e7edb42602871/Scripts/Python/xDialogClothingBB.py#L125-L129 | ||
aws/lumberyard | f85344403c1c2e77ec8c75deb2c116e97b713217 | dev/Tools/Python/3.7.10/mac/Python.framework/Versions/3.7/lib/python3.7/logging/handlers.py | python | SysLogHandler.encodePriority | (self, facility, priority) | return (facility << 3) | priority | Encode the facility and priority. You can pass in strings or
integers - if strings are passed, the facility_names and
priority_names mapping dictionaries are used to convert them to
integers. | Encode the facility and priority. You can pass in strings or
integers - if strings are passed, the facility_names and
priority_names mapping dictionaries are used to convert them to
integers. | [
"Encode",
"the",
"facility",
"and",
"priority",
".",
"You",
"can",
"pass",
"in",
"strings",
"or",
"integers",
"-",
"if",
"strings",
"are",
"passed",
"the",
"facility_names",
"and",
"priority_names",
"mapping",
"dictionaries",
"are",
"used",
"to",
"convert",
"t... | def encodePriority(self, facility, priority):
"""
Encode the facility and priority. You can pass in strings or
integers - if strings are passed, the facility_names and
priority_names mapping dictionaries are used to convert them to
integers.
"""
if isinstance(faci... | [
"def",
"encodePriority",
"(",
"self",
",",
"facility",
",",
"priority",
")",
":",
"if",
"isinstance",
"(",
"facility",
",",
"str",
")",
":",
"facility",
"=",
"self",
".",
"facility_names",
"[",
"facility",
"]",
"if",
"isinstance",
"(",
"priority",
",",
"... | https://github.com/aws/lumberyard/blob/f85344403c1c2e77ec8c75deb2c116e97b713217/dev/Tools/Python/3.7.10/mac/Python.framework/Versions/3.7/lib/python3.7/logging/handlers.py#L873-L884 | |
Cisco-Talos/moflow | ed71dfb0540d9e0d7a4c72f0881b58958d573728 | BAP-0.7-moflow/libtracewrap/libtrace/protobuf/python/mox.py | python | Or.__init__ | (self, *args) | Initialize.
Args:
*args: One or more Mox comparators | Initialize. | [
"Initialize",
"."
] | def __init__(self, *args):
"""Initialize.
Args:
*args: One or more Mox comparators
"""
self._comparators = args | [
"def",
"__init__",
"(",
"self",
",",
"*",
"args",
")",
":",
"self",
".",
"_comparators",
"=",
"args"
] | https://github.com/Cisco-Talos/moflow/blob/ed71dfb0540d9e0d7a4c72f0881b58958d573728/BAP-0.7-moflow/libtracewrap/libtrace/protobuf/python/mox.py#L1083-L1090 | ||
hfinkel/llvm-project-cxxjit | 91084ef018240bbb8e24235ff5cd8c355a9c1a1e | lldb/utils/vim-lldb/python-vim-lldb/import_lldb.py | python | import_lldb | () | return False | Find and import the lldb modules. This function tries to find the lldb module by:
1. Simply by doing "import lldb" in case the system python installation is aware of lldb. If that fails,
2. Executes the lldb executable pointed to by the LLDB environment variable (or if unset, the first lldb
o... | Find and import the lldb modules. This function tries to find the lldb module by:
1. Simply by doing "import lldb" in case the system python installation is aware of lldb. If that fails,
2. Executes the lldb executable pointed to by the LLDB environment variable (or if unset, the first lldb
o... | [
"Find",
"and",
"import",
"the",
"lldb",
"modules",
".",
"This",
"function",
"tries",
"to",
"find",
"the",
"lldb",
"module",
"by",
":",
"1",
".",
"Simply",
"by",
"doing",
"import",
"lldb",
"in",
"case",
"the",
"system",
"python",
"installation",
"is",
"aw... | def import_lldb():
""" Find and import the lldb modules. This function tries to find the lldb module by:
1. Simply by doing "import lldb" in case the system python installation is aware of lldb. If that fails,
2. Executes the lldb executable pointed to by the LLDB environment variable (or if unset, ... | [
"def",
"import_lldb",
"(",
")",
":",
"# Try simple 'import lldb', in case of a system-wide install or a",
"# pre-configured PYTHONPATH",
"try",
":",
"import",
"lldb",
"return",
"True",
"except",
"ImportError",
":",
"pass",
"# Allow overriding default path to lldb executable with th... | https://github.com/hfinkel/llvm-project-cxxjit/blob/91084ef018240bbb8e24235ff5cd8c355a9c1a1e/lldb/utils/vim-lldb/python-vim-lldb/import_lldb.py#L8-L65 | |
giuspen/cherrytree | 84712f206478fcf9acf30174009ad28c648c6344 | pygtk2/modules/core.py | python | CherryTree.objects_buffer_refresh | (self) | Buffer Refresh (Needed for Objects) | Buffer Refresh (Needed for Objects) | [
"Buffer",
"Refresh",
"(",
"Needed",
"for",
"Objects",
")"
] | def objects_buffer_refresh(self):
"""Buffer Refresh (Needed for Objects)"""
if not self.curr_tree_iter: return
if self.user_active and self.curr_buffer.get_modified():
self.file_update = True
self.curr_buffer.set_modified(False)
self.state_machine.update_state... | [
"def",
"objects_buffer_refresh",
"(",
"self",
")",
":",
"if",
"not",
"self",
".",
"curr_tree_iter",
":",
"return",
"if",
"self",
".",
"user_active",
"and",
"self",
".",
"curr_buffer",
".",
"get_modified",
"(",
")",
":",
"self",
".",
"file_update",
"=",
"Tr... | https://github.com/giuspen/cherrytree/blob/84712f206478fcf9acf30174009ad28c648c6344/pygtk2/modules/core.py#L3501-L3530 | ||
wxWidgets/wxPython-Classic | 19571e1ae65f1ac445f5491474121998c97a1bf0 | src/msw/richtext.py | python | RichTextParagraphLayoutBox.SetRichTextCtrl | (*args, **kwargs) | return _richtext.RichTextParagraphLayoutBox_SetRichTextCtrl(*args, **kwargs) | SetRichTextCtrl(self, RichTextCtrl ctrl) | SetRichTextCtrl(self, RichTextCtrl ctrl) | [
"SetRichTextCtrl",
"(",
"self",
"RichTextCtrl",
"ctrl",
")"
] | def SetRichTextCtrl(*args, **kwargs):
"""SetRichTextCtrl(self, RichTextCtrl ctrl)"""
return _richtext.RichTextParagraphLayoutBox_SetRichTextCtrl(*args, **kwargs) | [
"def",
"SetRichTextCtrl",
"(",
"*",
"args",
",",
"*",
"*",
"kwargs",
")",
":",
"return",
"_richtext",
".",
"RichTextParagraphLayoutBox_SetRichTextCtrl",
"(",
"*",
"args",
",",
"*",
"*",
"kwargs",
")"
] | https://github.com/wxWidgets/wxPython-Classic/blob/19571e1ae65f1ac445f5491474121998c97a1bf0/src/msw/richtext.py#L1612-L1614 | |
catboost/catboost | 167f64f237114a4d10b2b4ee42adb4569137debe | contrib/python/scikit-learn/py3/sklearn/covariance/_shrunk_covariance.py | python | LedoitWolf.fit | (self, X, y=None) | return self | Fits the Ledoit-Wolf shrunk covariance model
according to the given training data and parameters.
Parameters
----------
X : array-like of shape (n_samples, n_features)
Training data, where n_samples is the number of samples
and n_features is the number of feature... | Fits the Ledoit-Wolf shrunk covariance model
according to the given training data and parameters. | [
"Fits",
"the",
"Ledoit",
"-",
"Wolf",
"shrunk",
"covariance",
"model",
"according",
"to",
"the",
"given",
"training",
"data",
"and",
"parameters",
"."
] | def fit(self, X, y=None):
""" Fits the Ledoit-Wolf shrunk covariance model
according to the given training data and parameters.
Parameters
----------
X : array-like of shape (n_samples, n_features)
Training data, where n_samples is the number of samples
a... | [
"def",
"fit",
"(",
"self",
",",
"X",
",",
"y",
"=",
"None",
")",
":",
"# Not calling the parent object to fit, to avoid computing the",
"# covariance matrix (and potentially the precision)",
"X",
"=",
"check_array",
"(",
"X",
")",
"if",
"self",
".",
"assume_centered",
... | https://github.com/catboost/catboost/blob/167f64f237114a4d10b2b4ee42adb4569137debe/contrib/python/scikit-learn/py3/sklearn/covariance/_shrunk_covariance.py#L403-L433 | |
benoitsteiner/tensorflow-opencl | cb7cb40a57fde5cfd4731bc551e82a1e2fef43a5 | tensorflow/contrib/metrics/python/ops/histogram_ops.py | python | _auc_convert_hist_to_auc | (hist_true_acc, hist_false_acc, nbins) | return math_ops.add(first_trap, math_ops.reduce_sum(other_traps), name='auc') | Convert histograms to auc.
Args:
hist_true_acc: `Tensor` holding accumulated histogram of scores for records
that were `True`.
hist_false_acc: `Tensor` holding accumulated histogram of scores for
records that were `False`.
nbins: Integer number of bins in the histograms.
Returns:
Sc... | Convert histograms to auc. | [
"Convert",
"histograms",
"to",
"auc",
"."
] | def _auc_convert_hist_to_auc(hist_true_acc, hist_false_acc, nbins):
"""Convert histograms to auc.
Args:
hist_true_acc: `Tensor` holding accumulated histogram of scores for records
that were `True`.
hist_false_acc: `Tensor` holding accumulated histogram of scores for
records that were `False`.... | [
"def",
"_auc_convert_hist_to_auc",
"(",
"hist_true_acc",
",",
"hist_false_acc",
",",
"nbins",
")",
":",
"# Note that this follows the \"Approximating AUC\" section in:",
"# Efficient AUC learning curve calculation, R. R. Bouckaert,",
"# AI'06 Proceedings of the 19th Australian joint conferen... | https://github.com/benoitsteiner/tensorflow-opencl/blob/cb7cb40a57fde5cfd4731bc551e82a1e2fef43a5/tensorflow/contrib/metrics/python/ops/histogram_ops.py#L178-L217 | |
hughperkins/tf-coriander | 970d3df6c11400ad68405f22b0c42a52374e94ca | tensorflow/python/framework/op_def_library.py | python | _Flatten | (l) | return [item for sublist in l_of_l for item in sublist] | Converts [1, 2, [3, 4], [5]] to [1, 2, 3, 4, 5]. | Converts [1, 2, [3, 4], [5]] to [1, 2, 3, 4, 5]. | [
"Converts",
"[",
"1",
"2",
"[",
"3",
"4",
"]",
"[",
"5",
"]]",
"to",
"[",
"1",
"2",
"3",
"4",
"5",
"]",
"."
] | def _Flatten(l):
"""Converts [1, 2, [3, 4], [5]] to [1, 2, 3, 4, 5]."""
# [1, 2, [3, 4], [5]] -> [[1], [2], [3, 4], [5]]
l_of_l = [x if _IsListValue(x) else [x] for x in l]
# [[1], [2], [3, 4], [5]] -> [1, 2, 3, 4, 5]
return [item for sublist in l_of_l for item in sublist] | [
"def",
"_Flatten",
"(",
"l",
")",
":",
"# [1, 2, [3, 4], [5]] -> [[1], [2], [3, 4], [5]]",
"l_of_l",
"=",
"[",
"x",
"if",
"_IsListValue",
"(",
"x",
")",
"else",
"[",
"x",
"]",
"for",
"x",
"in",
"l",
"]",
"# [[1], [2], [3, 4], [5]] -> [1, 2, 3, 4, 5]",
"return",
... | https://github.com/hughperkins/tf-coriander/blob/970d3df6c11400ad68405f22b0c42a52374e94ca/tensorflow/python/framework/op_def_library.py#L83-L88 | |
apache/incubator-mxnet | f03fb23f1d103fec9541b5ae59ee06b1734a51d9 | python/mxnet/gluon/contrib/data/vision/transforms/bbox/utils.py | python | bbox_iou | (bbox_a, bbox_b, offset=0) | return area_i / (area_a[:, None] + area_b - area_i) | Calculate Intersection-Over-Union(IOU) of two bounding boxes.
Parameters
----------
bbox_a : numpy.ndarray
An ndarray with shape :math:`(N, 4)`.
bbox_b : numpy.ndarray
An ndarray with shape :math:`(M, 4)`.
offset : float or int, default is 0
The ``offset`` is used to control... | Calculate Intersection-Over-Union(IOU) of two bounding boxes. | [
"Calculate",
"Intersection",
"-",
"Over",
"-",
"Union",
"(",
"IOU",
")",
"of",
"two",
"bounding",
"boxes",
"."
] | def bbox_iou(bbox_a, bbox_b, offset=0):
"""Calculate Intersection-Over-Union(IOU) of two bounding boxes.
Parameters
----------
bbox_a : numpy.ndarray
An ndarray with shape :math:`(N, 4)`.
bbox_b : numpy.ndarray
An ndarray with shape :math:`(M, 4)`.
offset : float or int, default... | [
"def",
"bbox_iou",
"(",
"bbox_a",
",",
"bbox_b",
",",
"offset",
"=",
"0",
")",
":",
"if",
"bbox_a",
".",
"shape",
"[",
"1",
"]",
"<",
"4",
"or",
"bbox_b",
".",
"shape",
"[",
"1",
"]",
"<",
"4",
":",
"raise",
"IndexError",
"(",
"\"Bounding boxes axi... | https://github.com/apache/incubator-mxnet/blob/f03fb23f1d103fec9541b5ae59ee06b1734a51d9/python/mxnet/gluon/contrib/data/vision/transforms/bbox/utils.py#L185-L215 | |
wxWidgets/wxPython-Classic | 19571e1ae65f1ac445f5491474121998c97a1bf0 | src/msw/_controls.py | python | ListCtrl.SetItemCount | (*args, **kwargs) | return _controls_.ListCtrl_SetItemCount(*args, **kwargs) | SetItemCount(self, long count) | SetItemCount(self, long count) | [
"SetItemCount",
"(",
"self",
"long",
"count",
")"
] | def SetItemCount(*args, **kwargs):
"""SetItemCount(self, long count)"""
return _controls_.ListCtrl_SetItemCount(*args, **kwargs) | [
"def",
"SetItemCount",
"(",
"*",
"args",
",",
"*",
"*",
"kwargs",
")",
":",
"return",
"_controls_",
".",
"ListCtrl_SetItemCount",
"(",
"*",
"args",
",",
"*",
"*",
"kwargs",
")"
] | https://github.com/wxWidgets/wxPython-Classic/blob/19571e1ae65f1ac445f5491474121998c97a1bf0/src/msw/_controls.py#L4735-L4737 | |
idaholab/moose | 9eeebc65e098b4c30f8205fb41591fd5b61eb6ff | python/peacock/Input/InputFileEditorPlugin.py | python | InputFileEditorPlugin._checkInputFile | (self) | Show the input file check window. | Show the input file check window. | [
"Show",
"the",
"input",
"file",
"check",
"window",
"."
] | def _checkInputFile(self):
"""
Show the input file check window.
"""
self.check_widget.show()
self.check_widget.check(self.tree.app_info.path) | [
"def",
"_checkInputFile",
"(",
"self",
")",
":",
"self",
".",
"check_widget",
".",
"show",
"(",
")",
"self",
".",
"check_widget",
".",
"check",
"(",
"self",
".",
"tree",
".",
"app_info",
".",
"path",
")"
] | https://github.com/idaholab/moose/blob/9eeebc65e098b4c30f8205fb41591fd5b61eb6ff/python/peacock/Input/InputFileEditorPlugin.py#L120-L125 | ||
miyosuda/TensorFlowAndroidDemo | 35903e0221aa5f109ea2dbef27f20b52e317f42d | jni-build/jni/include/tensorflow/python/util/nest.py | python | pack_sequence_as | (structure, flat_sequence) | return _sequence_like(structure, packed) | Returns a given flattened sequence packed into a nest.
If `structure` is a scalar, `flat_sequence` must be a single-element list;
in this case the return value is `flat_sequence[0]`.
Args:
structure: tuple or list constructed of scalars and/or other tuples/lists,
or a scalar. Note: numpy arrays are c... | Returns a given flattened sequence packed into a nest. | [
"Returns",
"a",
"given",
"flattened",
"sequence",
"packed",
"into",
"a",
"nest",
"."
] | def pack_sequence_as(structure, flat_sequence):
"""Returns a given flattened sequence packed into a nest.
If `structure` is a scalar, `flat_sequence` must be a single-element list;
in this case the return value is `flat_sequence[0]`.
Args:
structure: tuple or list constructed of scalars and/or other tuple... | [
"def",
"pack_sequence_as",
"(",
"structure",
",",
"flat_sequence",
")",
":",
"if",
"not",
"is_sequence",
"(",
"flat_sequence",
")",
":",
"raise",
"TypeError",
"(",
"\"flat_sequence must be a sequence\"",
")",
"if",
"not",
"is_sequence",
"(",
"structure",
")",
":",... | https://github.com/miyosuda/TensorFlowAndroidDemo/blob/35903e0221aa5f109ea2dbef27f20b52e317f42d/jni-build/jni/include/tensorflow/python/util/nest.py#L227-L262 | |
glotzerlab/hoomd-blue | f7f97abfa3fcc2522fa8d458d65d0aeca7ba781a | hoomd/update/box_resize.py | python | BoxResize.update | (state, box, filter=All()) | Immediately scale the particle in the system state to the given box.
Args:
state (State): System state to scale.
box (Box): New box.
filter (hoomd.filter.ParticleFilter): The subset of particles to
update. | Immediately scale the particle in the system state to the given box. | [
"Immediately",
"scale",
"the",
"particle",
"in",
"the",
"system",
"state",
"to",
"the",
"given",
"box",
"."
] | def update(state, box, filter=All()):
"""Immediately scale the particle in the system state to the given box.
Args:
state (State): System state to scale.
box (Box): New box.
filter (hoomd.filter.ParticleFilter): The subset of particles to
update.
... | [
"def",
"update",
"(",
"state",
",",
"box",
",",
"filter",
"=",
"All",
"(",
")",
")",
":",
"group",
"=",
"state",
".",
"_get_group",
"(",
"filter",
")",
"updater",
"=",
"_hoomd",
".",
"BoxResizeUpdater",
"(",
"state",
".",
"_cpp_sys_def",
",",
"state",
... | https://github.com/glotzerlab/hoomd-blue/blob/f7f97abfa3fcc2522fa8d458d65d0aeca7ba781a/hoomd/update/box_resize.py#L106-L118 | ||
PlatformLab/Arachne | e67391471007174dd4002dc2c160628e19c284e8 | scripts/cpplint.py | python | CheckComment | (line, filename, linenum, next_line_start, error) | Checks for common mistakes in comments.
Args:
line: The line in question.
filename: The name of the current file.
linenum: The number of the line to check.
next_line_start: The first non-whitespace column of the next line.
error: The function to call with any errors found. | Checks for common mistakes in comments. | [
"Checks",
"for",
"common",
"mistakes",
"in",
"comments",
"."
] | def CheckComment(line, filename, linenum, next_line_start, error):
"""Checks for common mistakes in comments.
Args:
line: The line in question.
filename: The name of the current file.
linenum: The number of the line to check.
next_line_start: The first non-whitespace column of the next line.
er... | [
"def",
"CheckComment",
"(",
"line",
",",
"filename",
",",
"linenum",
",",
"next_line_start",
",",
"error",
")",
":",
"commentpos",
"=",
"line",
".",
"find",
"(",
"'//'",
")",
"if",
"commentpos",
"!=",
"-",
"1",
":",
"# Check if the // may be in quotes. If so,... | https://github.com/PlatformLab/Arachne/blob/e67391471007174dd4002dc2c160628e19c284e8/scripts/cpplint.py#L2975-L3026 | ||
Xilinx/Vitis-AI | fc74d404563d9951b57245443c73bef389f3657f | tools/Vitis-AI-Quantizer/vai_q_tensorflow1.x/tensorflow/python/framework/common_shapes.py | python | unchanged_shape_with_rank | (rank) | return _ShapeFunction | Returns a shape function for ops that constrain the rank of their input.
Args:
rank: The exact rank of the input and output.
Returns:
A shape function for ops that output a tensor of the same size as their
input, with a particular rank. | Returns a shape function for ops that constrain the rank of their input. | [
"Returns",
"a",
"shape",
"function",
"for",
"ops",
"that",
"constrain",
"the",
"rank",
"of",
"their",
"input",
"."
] | def unchanged_shape_with_rank(rank):
"""Returns a shape function for ops that constrain the rank of their input.
Args:
rank: The exact rank of the input and output.
Returns:
A shape function for ops that output a tensor of the same size as their
input, with a particular rank.
"""
def _ShapeFunc... | [
"def",
"unchanged_shape_with_rank",
"(",
"rank",
")",
":",
"def",
"_ShapeFunction",
"(",
"op",
")",
":",
"return",
"[",
"op",
".",
"inputs",
"[",
"0",
"]",
".",
"get_shape",
"(",
")",
".",
"with_rank",
"(",
"rank",
")",
"]",
"return",
"_ShapeFunction"
] | https://github.com/Xilinx/Vitis-AI/blob/fc74d404563d9951b57245443c73bef389f3657f/tools/Vitis-AI-Quantizer/vai_q_tensorflow1.x/tensorflow/python/framework/common_shapes.py#L53-L67 | |
facebook/watchman | 0917460c71b000b96be9b9575d77f06f2f6053bb | build/fbcode_builder/parse_args.py | python | parse_args_to_fbcode_builder_opts | (add_args_fn, top_level_opts, opts, help) | return new_opts | Provides some standard arguments: --debug, --option, --shell-quoted-option
Then, calls `add_args_fn(parser)` to add application-specific arguments.
`opts` are first used as defaults for the various command-line
arguments. Then, the parsed arguments are mapped back into `opts`,
which then become the v... | [] | def parse_args_to_fbcode_builder_opts(add_args_fn, top_level_opts, opts, help):
"""
Provides some standard arguments: --debug, --option, --shell-quoted-option
Then, calls `add_args_fn(parser)` to add application-specific arguments.
`opts` are first used as defaults for the various command-line
ar... | [
"def",
"parse_args_to_fbcode_builder_opts",
"(",
"add_args_fn",
",",
"top_level_opts",
",",
"opts",
",",
"help",
")",
":",
"top_level_opts",
"=",
"set",
"(",
"top_level_opts",
")",
"parser",
"=",
"argparse",
".",
"ArgumentParser",
"(",
"description",
"=",
"help",
... | https://github.com/facebook/watchman/blob/0917460c71b000b96be9b9575d77f06f2f6053bb/build/fbcode_builder/parse_args.py#L12-L86 | ||
ChromiumWebApps/chromium | c7361d39be8abd1574e6ce8957c8dbddd4c6ccf7 | build/android/pylib/android_commands.py | python | AndroidCommands.GetBatteryInfo | (self) | return '\n'.join(battery) | Returns the device battery info (e.g. status, level, etc) as string. | Returns the device battery info (e.g. status, level, etc) as string. | [
"Returns",
"the",
"device",
"battery",
"info",
"(",
"e",
".",
"g",
".",
"status",
"level",
"etc",
")",
"as",
"string",
"."
] | def GetBatteryInfo(self):
"""Returns the device battery info (e.g. status, level, etc) as string."""
battery = self.RunShellCommand('dumpsys battery')
assert battery
return '\n'.join(battery) | [
"def",
"GetBatteryInfo",
"(",
"self",
")",
":",
"battery",
"=",
"self",
".",
"RunShellCommand",
"(",
"'dumpsys battery'",
")",
"assert",
"battery",
"return",
"'\\n'",
".",
"join",
"(",
"battery",
")"
] | https://github.com/ChromiumWebApps/chromium/blob/c7361d39be8abd1574e6ce8957c8dbddd4c6ccf7/build/android/pylib/android_commands.py#L1229-L1233 | |
catboost/catboost | 167f64f237114a4d10b2b4ee42adb4569137debe | contrib/python/scipy/py2/scipy/misc/pilutil.py | python | imshow | (arr) | Simple showing of an image through an external viewer.
This function is only available if Python Imaging Library (PIL) is installed.
Uses the image viewer specified by the environment variable
SCIPY_PIL_IMAGE_VIEWER, or if that is not defined then `see`,
to view a temporary file generated from array d... | Simple showing of an image through an external viewer. | [
"Simple",
"showing",
"of",
"an",
"image",
"through",
"an",
"external",
"viewer",
"."
] | def imshow(arr):
"""
Simple showing of an image through an external viewer.
This function is only available if Python Imaging Library (PIL) is installed.
Uses the image viewer specified by the environment variable
SCIPY_PIL_IMAGE_VIEWER, or if that is not defined then `see`,
to view a temporar... | [
"def",
"imshow",
"(",
"arr",
")",
":",
"im",
"=",
"toimage",
"(",
"arr",
")",
"fnum",
",",
"fname",
"=",
"tempfile",
".",
"mkstemp",
"(",
"'.png'",
")",
"try",
":",
"im",
".",
"save",
"(",
"fname",
")",
"except",
"Exception",
":",
"raise",
"Runtime... | https://github.com/catboost/catboost/blob/167f64f237114a4d10b2b4ee42adb4569137debe/contrib/python/scipy/py2/scipy/misc/pilutil.py#L459-L507 | ||
psi4/psi4 | be533f7f426b6ccc263904e55122899b16663395 | psi4/driver/wrapper_autofrag.py | python | auto_fragments | (molecule: core.Molecule = None, seed_atoms: List = None) | return bmol | r"""Detects fragments in unfragmented molecule using BFS algorithm.
Currently only used for the WebMO implementation of SAPT.
Parameters
----------
molecule : :ref:`molecule <op_py_molecule>`, optional
The target molecule, if not the last molecule defined.
seed_atoms
List of lists o... | r"""Detects fragments in unfragmented molecule using BFS algorithm.
Currently only used for the WebMO implementation of SAPT. | [
"r",
"Detects",
"fragments",
"in",
"unfragmented",
"molecule",
"using",
"BFS",
"algorithm",
".",
"Currently",
"only",
"used",
"for",
"the",
"WebMO",
"implementation",
"of",
"SAPT",
"."
] | def auto_fragments(molecule: core.Molecule = None, seed_atoms: List = None) -> core.Molecule:
r"""Detects fragments in unfragmented molecule using BFS algorithm.
Currently only used for the WebMO implementation of SAPT.
Parameters
----------
molecule : :ref:`molecule <op_py_molecule>`, optional
... | [
"def",
"auto_fragments",
"(",
"molecule",
":",
"core",
".",
"Molecule",
"=",
"None",
",",
"seed_atoms",
":",
"List",
"=",
"None",
")",
"->",
"core",
".",
"Molecule",
":",
"# Make sure the molecule the user provided is the active one",
"if",
"molecule",
"is",
"None... | https://github.com/psi4/psi4/blob/be533f7f426b6ccc263904e55122899b16663395/psi4/driver/wrapper_autofrag.py#L34-L73 | |
natanielruiz/android-yolo | 1ebb54f96a67a20ff83ddfc823ed83a13dc3a47f | jni-build/jni/include/external/bazel_tools/tools/build_defs/pkg/archive.py | python | SimpleArFile.next | (self) | return self.SimpleArFileEntry(self.f) | Read the next file. Returns None when reaching the end of file. | Read the next file. Returns None when reaching the end of file. | [
"Read",
"the",
"next",
"file",
".",
"Returns",
"None",
"when",
"reaching",
"the",
"end",
"of",
"file",
"."
] | def next(self):
"""Read the next file. Returns None when reaching the end of file."""
# AR sections are two bit aligned using new lines.
if self.f.tell() % 2 != 0:
self.f.read(1)
# An AR sections is at least 60 bytes. Some file might contains garbage
# bytes at the end of the archive, ignore t... | [
"def",
"next",
"(",
"self",
")",
":",
"# AR sections are two bit aligned using new lines.",
"if",
"self",
".",
"f",
".",
"tell",
"(",
")",
"%",
"2",
"!=",
"0",
":",
"self",
".",
"f",
".",
"read",
"(",
"1",
")",
"# An AR sections is at least 60 bytes. Some file... | https://github.com/natanielruiz/android-yolo/blob/1ebb54f96a67a20ff83ddfc823ed83a13dc3a47f/jni-build/jni/include/external/bazel_tools/tools/build_defs/pkg/archive.py#L85-L94 | |
BlzFans/wke | b0fa21158312e40c5fbd84682d643022b6c34a93 | cygwin/lib/python2.6/lib2to3/pytree.py | python | Base.set_prefix | (self, prefix) | Set the prefix for the node (see Leaf class).
DEPRECATED; use the prefix property directly. | Set the prefix for the node (see Leaf class). | [
"Set",
"the",
"prefix",
"for",
"the",
"node",
"(",
"see",
"Leaf",
"class",
")",
"."
] | def set_prefix(self, prefix):
"""
Set the prefix for the node (see Leaf class).
DEPRECATED; use the prefix property directly.
"""
warnings.warn("set_prefix() is deprecated; use the prefix property",
DeprecationWarning, stacklevel=2)
self.prefix = pr... | [
"def",
"set_prefix",
"(",
"self",
",",
"prefix",
")",
":",
"warnings",
".",
"warn",
"(",
"\"set_prefix() is deprecated; use the prefix property\"",
",",
"DeprecationWarning",
",",
"stacklevel",
"=",
"2",
")",
"self",
".",
"prefix",
"=",
"prefix"
] | https://github.com/BlzFans/wke/blob/b0fa21158312e40c5fbd84682d643022b6c34a93/cygwin/lib/python2.6/lib2to3/pytree.py#L113-L121 | ||
intel/caffe | 3f494b442ee3f9d17a07b09ecbd5fa2bbda00836 | scripts/cpp_lint.py | python | CheckForNewlineAtEOF | (filename, lines, error) | Logs an error if there is no newline char at the end of the file.
Args:
filename: The name of the current file.
lines: An array of strings, each representing a line of the file.
error: The function to call with any errors found. | Logs an error if there is no newline char at the end of the file. | [
"Logs",
"an",
"error",
"if",
"there",
"is",
"no",
"newline",
"char",
"at",
"the",
"end",
"of",
"the",
"file",
"."
] | def CheckForNewlineAtEOF(filename, lines, error):
"""Logs an error if there is no newline char at the end of the file.
Args:
filename: The name of the current file.
lines: An array of strings, each representing a line of the file.
error: The function to call with any errors found.
"""
# The array ... | [
"def",
"CheckForNewlineAtEOF",
"(",
"filename",
",",
"lines",
",",
"error",
")",
":",
"# The array lines() was created by adding two newlines to the",
"# original file (go figure), then splitting on \\n.",
"# To verify that the file ends in \\n, we just have to make sure the",
"# last-but-... | https://github.com/intel/caffe/blob/3f494b442ee3f9d17a07b09ecbd5fa2bbda00836/scripts/cpp_lint.py#L1508-L1523 | ||
google/syzygy | 8164b24ebde9c5649c9a09e88a7fc0b0fcbd1bc5 | third_party/numpy/files/numpy/core/numeric.py | python | asfortranarray | (a, dtype=None) | return array(a, dtype, copy=False, order='F', ndmin=1) | Return an array laid out in Fortran order in memory.
Parameters
----------
a : array_like
Input array.
dtype : str or dtype object, optional
By default, the data-type is inferred from the input data.
Returns
-------
out : ndarray
The input `a` in Fortran, or column-... | Return an array laid out in Fortran order in memory. | [
"Return",
"an",
"array",
"laid",
"out",
"in",
"Fortran",
"order",
"in",
"memory",
"."
] | def asfortranarray(a, dtype=None):
"""
Return an array laid out in Fortran order in memory.
Parameters
----------
a : array_like
Input array.
dtype : str or dtype object, optional
By default, the data-type is inferred from the input data.
Returns
-------
out : ndarr... | [
"def",
"asfortranarray",
"(",
"a",
",",
"dtype",
"=",
"None",
")",
":",
"return",
"array",
"(",
"a",
",",
"dtype",
",",
"copy",
"=",
"False",
",",
"order",
"=",
"'F'",
",",
"ndmin",
"=",
"1",
")"
] | https://github.com/google/syzygy/blob/8164b24ebde9c5649c9a09e88a7fc0b0fcbd1bc5/third_party/numpy/files/numpy/core/numeric.py#L325-L359 | |
libfive/libfive | ab5e354cf6fd992f80aaa9432c52683219515c8a | libfive/bind/python/libfive/stdlib/csg.py | python | blend_expt | (a, b, m) | return Shape(stdlib.blend_expt(
args[0].ptr,
args[1].ptr,
args[2].ptr)) | Blends two shapes by the given amount using exponents | Blends two shapes by the given amount using exponents | [
"Blends",
"two",
"shapes",
"by",
"the",
"given",
"amount",
"using",
"exponents"
] | def blend_expt(a, b, m):
""" Blends two shapes by the given amount using exponents
"""
args = [Shape.wrap(a), Shape.wrap(b), Shape.wrap(m)]
return Shape(stdlib.blend_expt(
args[0].ptr,
args[1].ptr,
args[2].ptr)) | [
"def",
"blend_expt",
"(",
"a",
",",
"b",
",",
"m",
")",
":",
"args",
"=",
"[",
"Shape",
".",
"wrap",
"(",
"a",
")",
",",
"Shape",
".",
"wrap",
"(",
"b",
")",
",",
"Shape",
".",
"wrap",
"(",
"m",
")",
"]",
"return",
"Shape",
"(",
"stdlib",
"... | https://github.com/libfive/libfive/blob/ab5e354cf6fd992f80aaa9432c52683219515c8a/libfive/bind/python/libfive/stdlib/csg.py#L90-L97 | |
benoitsteiner/tensorflow-opencl | cb7cb40a57fde5cfd4731bc551e82a1e2fef43a5 | tensorflow/python/ops/data_flow_ops.py | python | BaseStagingArea.capacity | (self) | return self._capacity | The maximum number of elements of this staging area. | The maximum number of elements of this staging area. | [
"The",
"maximum",
"number",
"of",
"elements",
"of",
"this",
"staging",
"area",
"."
] | def capacity(self):
"""The maximum number of elements of this staging area."""
return self._capacity | [
"def",
"capacity",
"(",
"self",
")",
":",
"return",
"self",
".",
"_capacity"
] | https://github.com/benoitsteiner/tensorflow-opencl/blob/cb7cb40a57fde5cfd4731bc551e82a1e2fef43a5/tensorflow/python/ops/data_flow_ops.py#L1453-L1455 | |
chromiumembedded/cef | 80caf947f3fe2210e5344713c5281d8af9bdc295 | tools/cef_parser.py | python | obj_analysis.is_result_refptr | (self) | return (self.result_type == 'refptr') | Returns true if this is a RefPtr type. | Returns true if this is a RefPtr type. | [
"Returns",
"true",
"if",
"this",
"is",
"a",
"RefPtr",
"type",
"."
] | def is_result_refptr(self):
""" Returns true if this is a RefPtr type. """
return (self.result_type == 'refptr') | [
"def",
"is_result_refptr",
"(",
"self",
")",
":",
"return",
"(",
"self",
".",
"result_type",
"==",
"'refptr'",
")"
] | https://github.com/chromiumembedded/cef/blob/80caf947f3fe2210e5344713c5281d8af9bdc295/tools/cef_parser.py#L1875-L1877 | |
microsoft/checkedc-clang | a173fefde5d7877b7750e7ce96dd08cf18baebf2 | libcxx/utils/google-benchmark/tools/gbench/util.py | python | run_or_load_benchmark | (filename, benchmark_flags) | Get the results for a specified benchmark. If 'filename' specifies
an executable benchmark then the results are generated by running the
benchmark. Otherwise 'filename' must name a valid JSON output file,
which is loaded and the result returned. | Get the results for a specified benchmark. If 'filename' specifies
an executable benchmark then the results are generated by running the
benchmark. Otherwise 'filename' must name a valid JSON output file,
which is loaded and the result returned. | [
"Get",
"the",
"results",
"for",
"a",
"specified",
"benchmark",
".",
"If",
"filename",
"specifies",
"an",
"executable",
"benchmark",
"then",
"the",
"results",
"are",
"generated",
"by",
"running",
"the",
"benchmark",
".",
"Otherwise",
"filename",
"must",
"name",
... | def run_or_load_benchmark(filename, benchmark_flags):
"""
Get the results for a specified benchmark. If 'filename' specifies
an executable benchmark then the results are generated by running the
benchmark. Otherwise 'filename' must name a valid JSON output file,
which is loaded and the result return... | [
"def",
"run_or_load_benchmark",
"(",
"filename",
",",
"benchmark_flags",
")",
":",
"ftype",
"=",
"check_input_file",
"(",
"filename",
")",
"if",
"ftype",
"==",
"IT_JSON",
":",
"return",
"load_benchmark_results",
"(",
"filename",
")",
"elif",
"ftype",
"==",
"IT_E... | https://github.com/microsoft/checkedc-clang/blob/a173fefde5d7877b7750e7ce96dd08cf18baebf2/libcxx/utils/google-benchmark/tools/gbench/util.py#L151-L164 | ||
hanpfei/chromium-net | 392cc1fa3a8f92f42e4071ab6e674d8e0482f83f | tools/auto_bisect/fetch_build.py | python | AndroidChromeBuildArchive._ZipFileName | (self, revision, deps_patch_sha=None) | return 'build_product_%s.zip' % revision | Gets the file name of a zip archive on android-chrome.
This returns a file name of the form build_product_<revision>.zip,
which is a format used by android-chrome.
Args:
revision: A git commit hash or other revision string.
deps_patch_sha: SHA1 hash of a DEPS file patch.
Returns:
Th... | Gets the file name of a zip archive on android-chrome. | [
"Gets",
"the",
"file",
"name",
"of",
"a",
"zip",
"archive",
"on",
"android",
"-",
"chrome",
"."
] | def _ZipFileName(self, revision, deps_patch_sha=None):
"""Gets the file name of a zip archive on android-chrome.
This returns a file name of the form build_product_<revision>.zip,
which is a format used by android-chrome.
Args:
revision: A git commit hash or other revision string.
deps_pat... | [
"def",
"_ZipFileName",
"(",
"self",
",",
"revision",
",",
"deps_patch_sha",
"=",
"None",
")",
":",
"if",
"deps_patch_sha",
":",
"revision",
"=",
"'%s_%s'",
"%",
"(",
"revision",
",",
"deps_patch_sha",
")",
"return",
"'build_product_%s.zip'",
"%",
"revision"
] | https://github.com/hanpfei/chromium-net/blob/392cc1fa3a8f92f42e4071ab6e674d8e0482f83f/tools/auto_bisect/fetch_build.py#L307-L322 | |
yrnkrn/zapcc | c6a8aa30006d997eff0d60fd37b0e62b8aa0ea50 | tools/sancov/coverage-report-server.py | python | SymcovData.compute_filecoverage | (self) | return result | Build a filename->pct coverage. | Build a filename->pct coverage. | [
"Build",
"a",
"filename",
"-",
">",
"pct",
"coverage",
"."
] | def compute_filecoverage(self):
"""Build a filename->pct coverage."""
result = dict()
for filename, fns in self.point_symbol_info.items():
file_points = []
for fn, points in fns.items():
file_points.extend(points.keys())
covered_points = self.c... | [
"def",
"compute_filecoverage",
"(",
"self",
")",
":",
"result",
"=",
"dict",
"(",
")",
"for",
"filename",
",",
"fns",
"in",
"self",
".",
"point_symbol_info",
".",
"items",
"(",
")",
":",
"file_points",
"=",
"[",
"]",
"for",
"fn",
",",
"points",
"in",
... | https://github.com/yrnkrn/zapcc/blob/c6a8aa30006d997eff0d60fd37b0e62b8aa0ea50/tools/sancov/coverage-report-server.py#L105-L115 | |
wxWidgets/wxPython-Classic | 19571e1ae65f1ac445f5491474121998c97a1bf0 | wx/lib/agw/ribbon/page.py | python | RibbonPage.GetMinSize | (self) | return minSize | Returns the minimum size of the window, an indication to the sizer layout mechanism
that this is the minimum required size.
This method normally just returns the value set by `SetMinSize`, but it can be overridden
to do the calculation on demand. | Returns the minimum size of the window, an indication to the sizer layout mechanism
that this is the minimum required size. | [
"Returns",
"the",
"minimum",
"size",
"of",
"the",
"window",
"an",
"indication",
"to",
"the",
"sizer",
"layout",
"mechanism",
"that",
"this",
"is",
"the",
"minimum",
"required",
"size",
"."
] | def GetMinSize(self):
"""
Returns the minimum size of the window, an indication to the sizer layout mechanism
that this is the minimum required size.
This method normally just returns the value set by `SetMinSize`, but it can be overridden
to do the calculation on demand.
... | [
"def",
"GetMinSize",
"(",
"self",
")",
":",
"minSize",
"=",
"wx",
".",
"Size",
"(",
"-",
"1",
",",
"-",
"1",
")",
"for",
"child",
"in",
"self",
".",
"GetChildren",
"(",
")",
":",
"child_min",
"=",
"child",
".",
"GetMinSize",
"(",
")",
"minSize",
... | https://github.com/wxWidgets/wxPython-Classic/blob/19571e1ae65f1ac445f5491474121998c97a1bf0/wx/lib/agw/ribbon/page.py#L845-L872 | |
MythTV/mythtv | d282a209cb8be85d036f85a62a8ec971b67d45f4 | mythtv/programs/scripts/internetcontent/nv_python_libs/vimeo/oauth/oauth_api.py | python | generate_nonce | (length=8) | return ''.join([str(random.randint(0, 9)) for i in range(length)]) | Generate pseudorandom number. | Generate pseudorandom number. | [
"Generate",
"pseudorandom",
"number",
"."
] | def generate_nonce(length=8):
"""Generate pseudorandom number."""
return ''.join([str(random.randint(0, 9)) for i in range(length)]) | [
"def",
"generate_nonce",
"(",
"length",
"=",
"8",
")",
":",
"return",
"''",
".",
"join",
"(",
"[",
"str",
"(",
"random",
".",
"randint",
"(",
"0",
",",
"9",
")",
")",
"for",
"i",
"in",
"range",
"(",
"length",
")",
"]",
")"
] | https://github.com/MythTV/mythtv/blob/d282a209cb8be85d036f85a62a8ec971b67d45f4/mythtv/programs/scripts/internetcontent/nv_python_libs/vimeo/oauth/oauth_api.py#L62-L64 | |
aws/lumberyard | f85344403c1c2e77ec8c75deb2c116e97b713217 | dev/Tools/Python/3.7.10/mac/Python.framework/Versions/3.7/lib/python3.7/site-packages/pkg_resources/__init__.py | python | IResourceProvider.resource_isdir | (resource_name) | Is the named resource a directory? (like ``os.path.isdir()``) | Is the named resource a directory? (like ``os.path.isdir()``) | [
"Is",
"the",
"named",
"resource",
"a",
"directory?",
"(",
"like",
"os",
".",
"path",
".",
"isdir",
"()",
")"
] | def resource_isdir(resource_name):
"""Is the named resource a directory? (like ``os.path.isdir()``)""" | [
"def",
"resource_isdir",
"(",
"resource_name",
")",
":"
] | https://github.com/aws/lumberyard/blob/f85344403c1c2e77ec8c75deb2c116e97b713217/dev/Tools/Python/3.7.10/mac/Python.framework/Versions/3.7/lib/python3.7/site-packages/pkg_resources/__init__.py#L547-L548 | ||
apple/turicreate | cce55aa5311300e3ce6af93cb45ba791fd1bdf49 | src/python/turicreate/data_structures/sarray.py | python | SArray.rolling_mean | (self, window_start, window_end, min_observations=None) | return SArray(
_proxy=self.__proxy__.builtin_rolling_apply(
agg_op, window_start, window_end, min_observations
)
) | Calculate a new SArray of the mean of different subsets over this
SArray.
Also known as a "moving average" or "running average". The subset that
the mean is calculated over is defined as an inclusive range relative
to the position to each value in the SArray, using `window_start` and
... | Calculate a new SArray of the mean of different subsets over this
SArray. | [
"Calculate",
"a",
"new",
"SArray",
"of",
"the",
"mean",
"of",
"different",
"subsets",
"over",
"this",
"SArray",
"."
] | def rolling_mean(self, window_start, window_end, min_observations=None):
"""
Calculate a new SArray of the mean of different subsets over this
SArray.
Also known as a "moving average" or "running average". The subset that
the mean is calculated over is defined as an inclusive ra... | [
"def",
"rolling_mean",
"(",
"self",
",",
"window_start",
",",
"window_end",
",",
"min_observations",
"=",
"None",
")",
":",
"min_observations",
"=",
"self",
".",
"__check_min_observations",
"(",
"min_observations",
")",
"agg_op",
"=",
"None",
"if",
"self",
".",
... | https://github.com/apple/turicreate/blob/cce55aa5311300e3ce6af93cb45ba791fd1bdf49/src/python/turicreate/data_structures/sarray.py#L3676-L3783 | |
hanpfei/chromium-net | 392cc1fa3a8f92f42e4071ab6e674d8e0482f83f | third_party/catapult/telemetry/telemetry/internal/browser/web_contents.py | python | WebContents.ExecuteJavaScript | (self, statement, timeout=DEFAULT_WEB_CONTENTS_TIMEOUT) | return self.ExecuteJavaScriptInContext(
statement, context_id=None, timeout=timeout) | Executes statement in JavaScript. Does not return the result.
If the statement failed to evaluate, EvaluateException will be raised.
Raises:
exceptions.Error: See ExecuteJavaScriptInContext() for a detailed list of
possible exceptions. | Executes statement in JavaScript. Does not return the result. | [
"Executes",
"statement",
"in",
"JavaScript",
".",
"Does",
"not",
"return",
"the",
"result",
"."
] | def ExecuteJavaScript(self, statement, timeout=DEFAULT_WEB_CONTENTS_TIMEOUT):
"""Executes statement in JavaScript. Does not return the result.
If the statement failed to evaluate, EvaluateException will be raised.
Raises:
exceptions.Error: See ExecuteJavaScriptInContext() for a detailed list of
... | [
"def",
"ExecuteJavaScript",
"(",
"self",
",",
"statement",
",",
"timeout",
"=",
"DEFAULT_WEB_CONTENTS_TIMEOUT",
")",
":",
"return",
"self",
".",
"ExecuteJavaScriptInContext",
"(",
"statement",
",",
"context_id",
"=",
"None",
",",
"timeout",
"=",
"timeout",
")"
] | https://github.com/hanpfei/chromium-net/blob/392cc1fa3a8f92f42e4071ab6e674d8e0482f83f/third_party/catapult/telemetry/telemetry/internal/browser/web_contents.py#L158-L168 | |
wxWidgets/wxPython-Classic | 19571e1ae65f1ac445f5491474121998c97a1bf0 | src/msw/richtext.py | python | RichTextCtrl.MoveToParagraphEnd | (*args, **kwargs) | return _richtext.RichTextCtrl_MoveToParagraphEnd(*args, **kwargs) | MoveToParagraphEnd(self, int flags=0) -> bool
Move to the end of the paragraph | MoveToParagraphEnd(self, int flags=0) -> bool | [
"MoveToParagraphEnd",
"(",
"self",
"int",
"flags",
"=",
"0",
")",
"-",
">",
"bool"
] | def MoveToParagraphEnd(*args, **kwargs):
"""
MoveToParagraphEnd(self, int flags=0) -> bool
Move to the end of the paragraph
"""
return _richtext.RichTextCtrl_MoveToParagraphEnd(*args, **kwargs) | [
"def",
"MoveToParagraphEnd",
"(",
"*",
"args",
",",
"*",
"*",
"kwargs",
")",
":",
"return",
"_richtext",
".",
"RichTextCtrl_MoveToParagraphEnd",
"(",
"*",
"args",
",",
"*",
"*",
"kwargs",
")"
] | https://github.com/wxWidgets/wxPython-Classic/blob/19571e1ae65f1ac445f5491474121998c97a1bf0/src/msw/richtext.py#L3772-L3778 | |
natanielruiz/android-yolo | 1ebb54f96a67a20ff83ddfc823ed83a13dc3a47f | jni-build/jni/include/tensorflow/contrib/framework/python/ops/variables.py | python | get_variables_by_suffix | (suffix, scope=None) | return get_variables(scope=scope, suffix=suffix) | Gets the list of variables that end with the given suffix.
Args:
suffix: suffix for filtering the variables to return.
scope: an optional scope for filtering the variables to return.
Returns:
a copied list of variables with the given name and prefix. | Gets the list of variables that end with the given suffix. | [
"Gets",
"the",
"list",
"of",
"variables",
"that",
"end",
"with",
"the",
"given",
"suffix",
"."
] | def get_variables_by_suffix(suffix, scope=None):
"""Gets the list of variables that end with the given suffix.
Args:
suffix: suffix for filtering the variables to return.
scope: an optional scope for filtering the variables to return.
Returns:
a copied list of variables with the given name and prefi... | [
"def",
"get_variables_by_suffix",
"(",
"suffix",
",",
"scope",
"=",
"None",
")",
":",
"return",
"get_variables",
"(",
"scope",
"=",
"scope",
",",
"suffix",
"=",
"suffix",
")"
] | https://github.com/natanielruiz/android-yolo/blob/1ebb54f96a67a20ff83ddfc823ed83a13dc3a47f/jni-build/jni/include/tensorflow/contrib/framework/python/ops/variables.py#L359-L369 | |
wxWidgets/wxPython-Classic | 19571e1ae65f1ac445f5491474121998c97a1bf0 | src/osx_cocoa/_gdi.py | python | Palette.IsOk | (*args, **kwargs) | return _gdi_.Palette_IsOk(*args, **kwargs) | IsOk(self) -> bool | IsOk(self) -> bool | [
"IsOk",
"(",
"self",
")",
"-",
">",
"bool"
] | def IsOk(*args, **kwargs):
"""IsOk(self) -> bool"""
return _gdi_.Palette_IsOk(*args, **kwargs) | [
"def",
"IsOk",
"(",
"*",
"args",
",",
"*",
"*",
"kwargs",
")",
":",
"return",
"_gdi_",
".",
"Palette_IsOk",
"(",
"*",
"args",
",",
"*",
"*",
"kwargs",
")"
] | https://github.com/wxWidgets/wxPython-Classic/blob/19571e1ae65f1ac445f5491474121998c97a1bf0/src/osx_cocoa/_gdi.py#L353-L355 | |
Xilinx/Vitis-AI | fc74d404563d9951b57245443c73bef389f3657f | tools/Vitis-AI-Quantizer/vai_q_tensorflow1.x/tensorflow/python/lib/io/file_io.py | python | FileIO.size | (self) | return stat(self.__name).length | Returns the size of the file. | Returns the size of the file. | [
"Returns",
"the",
"size",
"of",
"the",
"file",
"."
] | def size(self):
"""Returns the size of the file."""
return stat(self.__name).length | [
"def",
"size",
"(",
"self",
")",
":",
"return",
"stat",
"(",
"self",
".",
"__name",
")",
".",
"length"
] | https://github.com/Xilinx/Vitis-AI/blob/fc74d404563d9951b57245443c73bef389f3657f/tools/Vitis-AI-Quantizer/vai_q_tensorflow1.x/tensorflow/python/lib/io/file_io.py#L100-L102 | |
aws/lumberyard | f85344403c1c2e77ec8c75deb2c116e97b713217 | dev/Gems/CloudGemMetric/v1/AWS/python/windows/Lib/pandas/core/arrays/categorical.py | python | Categorical._set_dtype | (self, dtype: CategoricalDtype) | return type(self)(codes, dtype=dtype, fastpath=True) | Internal method for directly updating the CategoricalDtype
Parameters
----------
dtype : CategoricalDtype
Notes
-----
We don't do any validation here. It's assumed that the dtype is
a (valid) instance of `CategoricalDtype`. | Internal method for directly updating the CategoricalDtype | [
"Internal",
"method",
"for",
"directly",
"updating",
"the",
"CategoricalDtype"
] | def _set_dtype(self, dtype: CategoricalDtype) -> "Categorical":
"""
Internal method for directly updating the CategoricalDtype
Parameters
----------
dtype : CategoricalDtype
Notes
-----
We don't do any validation here. It's assumed that the dtype is
... | [
"def",
"_set_dtype",
"(",
"self",
",",
"dtype",
":",
"CategoricalDtype",
")",
"->",
"\"Categorical\"",
":",
"codes",
"=",
"_recode_for_categories",
"(",
"self",
".",
"codes",
",",
"self",
".",
"categories",
",",
"dtype",
".",
"categories",
")",
"return",
"ty... | https://github.com/aws/lumberyard/blob/f85344403c1c2e77ec8c75deb2c116e97b713217/dev/Gems/CloudGemMetric/v1/AWS/python/windows/Lib/pandas/core/arrays/categorical.py#L721-L735 | |
apple/turicreate | cce55aa5311300e3ce6af93cb45ba791fd1bdf49 | src/external/coremltools_wrap/coremltools/coremltools/models/neural_network/builder.py | python | NeuralNetworkBuilder.add_gru | (
self,
name,
W_h,
W_x,
b,
hidden_size,
input_size,
input_names,
output_names,
activation="TANH",
inner_activation="SIGMOID_HARD",
output_all=False,
reverse_input=False,
) | return spec_layer | Add a Gated-Recurrent Unit (GRU) layer to the model.
Refer to the **GRULayerParams** message in specification (NeuralNetwork.proto) for more details.
Parameters
----------
name: str
The name of this layer.
W_h: [numpy.array]
List of recursion weight matri... | Add a Gated-Recurrent Unit (GRU) layer to the model.
Refer to the **GRULayerParams** message in specification (NeuralNetwork.proto) for more details. | [
"Add",
"a",
"Gated",
"-",
"Recurrent",
"Unit",
"(",
"GRU",
")",
"layer",
"to",
"the",
"model",
".",
"Refer",
"to",
"the",
"**",
"GRULayerParams",
"**",
"message",
"in",
"specification",
"(",
"NeuralNetwork",
".",
"proto",
")",
"for",
"more",
"details",
"... | def add_gru(
self,
name,
W_h,
W_x,
b,
hidden_size,
input_size,
input_names,
output_names,
activation="TANH",
inner_activation="SIGMOID_HARD",
output_all=False,
reverse_input=False,
):
"""
Add a Ga... | [
"def",
"add_gru",
"(",
"self",
",",
"name",
",",
"W_h",
",",
"W_x",
",",
"b",
",",
"hidden_size",
",",
"input_size",
",",
"input_names",
",",
"output_names",
",",
"activation",
"=",
"\"TANH\"",
",",
"inner_activation",
"=",
"\"SIGMOID_HARD\"",
",",
"output_a... | https://github.com/apple/turicreate/blob/cce55aa5311300e3ce6af93cb45ba791fd1bdf49/src/external/coremltools_wrap/coremltools/coremltools/models/neural_network/builder.py#L2931-L3032 | |
potassco/clingo | e0c91d8f95cc28de1c480a871f9c97c30de83d40 | libpyclingo/clingo/propagator.py | python | Trail.end | (self, level: int) | return _c_call('uint32_t', _lib.clingo_assignment_trail_end, self._rep, level) | Returns the offset following the last literal with the given decision
literal in the trail.
Parameters
----------
level
The decision level. | Returns the offset following the last literal with the given decision
literal in the trail. | [
"Returns",
"the",
"offset",
"following",
"the",
"last",
"literal",
"with",
"the",
"given",
"decision",
"literal",
"in",
"the",
"trail",
"."
] | def end(self, level: int) -> int:
'''
Returns the offset following the last literal with the given decision
literal in the trail.
Parameters
----------
level
The decision level.
'''
return _c_call('uint32_t', _lib.clingo_assignment_trail_end, ... | [
"def",
"end",
"(",
"self",
",",
"level",
":",
"int",
")",
"->",
"int",
":",
"return",
"_c_call",
"(",
"'uint32_t'",
",",
"_lib",
".",
"clingo_assignment_trail_end",
",",
"self",
".",
"_rep",
",",
"level",
")"
] | https://github.com/potassco/clingo/blob/e0c91d8f95cc28de1c480a871f9c97c30de83d40/libpyclingo/clingo/propagator.py#L93-L103 | |
wxWidgets/wxPython-Classic | 19571e1ae65f1ac445f5491474121998c97a1bf0 | wx/tools/Editra/src/extern/aui/auibar.py | python | AuiToolBarItem.GetDisabledBitmap | (self) | return self.GetRotatedBitmap(True) | Returns the toolbar item disabled bitmap. | Returns the toolbar item disabled bitmap. | [
"Returns",
"the",
"toolbar",
"item",
"disabled",
"bitmap",
"."
] | def GetDisabledBitmap(self):
""" Returns the toolbar item disabled bitmap. """
return self.GetRotatedBitmap(True) | [
"def",
"GetDisabledBitmap",
"(",
"self",
")",
":",
"return",
"self",
".",
"GetRotatedBitmap",
"(",
"True",
")"
] | https://github.com/wxWidgets/wxPython-Classic/blob/19571e1ae65f1ac445f5491474121998c97a1bf0/wx/tools/Editra/src/extern/aui/auibar.py#L492-L495 | |
Xilinx/Vitis-AI | fc74d404563d9951b57245443c73bef389f3657f | tools/Vitis-AI-Quantizer/vai_q_tensorflow1.x/tensorflow/python/ops/gradients_util.py | python | _DefaultGradYs | (grad_ys,
ys,
colocate_gradients_with_ops,
gradient_uid="__unsupported__") | return new_grad_ys | Fill in default values for grad_ys.
Args:
grad_ys: List of gradients, can contain None.
ys: List of tensors.
colocate_gradients_with_ops: If True, try colocating gradients with
the corresponding op.
gradient_uid: A unique identifier within the graph indicating
which invocation of gradient... | Fill in default values for grad_ys. | [
"Fill",
"in",
"default",
"values",
"for",
"grad_ys",
"."
] | def _DefaultGradYs(grad_ys,
ys,
colocate_gradients_with_ops,
gradient_uid="__unsupported__"):
"""Fill in default values for grad_ys.
Args:
grad_ys: List of gradients, can contain None.
ys: List of tensors.
colocate_gradients_with_ops: If True, tr... | [
"def",
"_DefaultGradYs",
"(",
"grad_ys",
",",
"ys",
",",
"colocate_gradients_with_ops",
",",
"gradient_uid",
"=",
"\"__unsupported__\"",
")",
":",
"if",
"len",
"(",
"grad_ys",
")",
"!=",
"len",
"(",
"ys",
")",
":",
"raise",
"ValueError",
"(",
"\"Passed %d grad... | https://github.com/Xilinx/Vitis-AI/blob/fc74d404563d9951b57245443c73bef389f3657f/tools/Vitis-AI-Quantizer/vai_q_tensorflow1.x/tensorflow/python/ops/gradients_util.py#L139-L226 | |
aws/lumberyard | f85344403c1c2e77ec8c75deb2c116e97b713217 | dev/Tools/Python/3.7.10/linux_x64/lib/python3.7/tkinter/__init__.py | python | Tk.__init__ | (self, screenName=None, baseName=None, className='Tk',
useTk=1, sync=0, use=None) | Return a new Toplevel widget on screen SCREENNAME. A new Tcl interpreter will
be created. BASENAME will be used for the identification of the profile file (see
readprofile).
It is constructed from sys.argv[0] without extensions if None is given. CLASSNAME
is the name of the widget class. | Return a new Toplevel widget on screen SCREENNAME. A new Tcl interpreter will
be created. BASENAME will be used for the identification of the profile file (see
readprofile).
It is constructed from sys.argv[0] without extensions if None is given. CLASSNAME
is the name of the widget class. | [
"Return",
"a",
"new",
"Toplevel",
"widget",
"on",
"screen",
"SCREENNAME",
".",
"A",
"new",
"Tcl",
"interpreter",
"will",
"be",
"created",
".",
"BASENAME",
"will",
"be",
"used",
"for",
"the",
"identification",
"of",
"the",
"profile",
"file",
"(",
"see",
"re... | def __init__(self, screenName=None, baseName=None, className='Tk',
useTk=1, sync=0, use=None):
"""Return a new Toplevel widget on screen SCREENNAME. A new Tcl interpreter will
be created. BASENAME will be used for the identification of the profile file (see
readprofile).
... | [
"def",
"__init__",
"(",
"self",
",",
"screenName",
"=",
"None",
",",
"baseName",
"=",
"None",
",",
"className",
"=",
"'Tk'",
",",
"useTk",
"=",
"1",
",",
"sync",
"=",
"0",
",",
"use",
"=",
"None",
")",
":",
"self",
".",
"master",
"=",
"None",
"se... | https://github.com/aws/lumberyard/blob/f85344403c1c2e77ec8c75deb2c116e97b713217/dev/Tools/Python/3.7.10/linux_x64/lib/python3.7/tkinter/__init__.py#L2003-L2028 | ||
catboost/catboost | 167f64f237114a4d10b2b4ee42adb4569137debe | contrib/python/scipy/scipy/stats/_multivariate.py | python | matrix_normal_gen.rvs | (self, mean=None, rowcov=1, colcov=1, size=1, random_state=None) | return out | Draw random samples from a matrix normal distribution.
Parameters
----------
%(_matnorm_doc_default_callparams)s
size : integer, optional
Number of samples to draw (default 1).
%(_doc_random_state)s
Returns
-------
rvs : ndarray or scalar
... | Draw random samples from a matrix normal distribution. | [
"Draw",
"random",
"samples",
"from",
"a",
"matrix",
"normal",
"distribution",
"."
] | def rvs(self, mean=None, rowcov=1, colcov=1, size=1, random_state=None):
"""
Draw random samples from a matrix normal distribution.
Parameters
----------
%(_matnorm_doc_default_callparams)s
size : integer, optional
Number of samples to draw (default 1).
... | [
"def",
"rvs",
"(",
"self",
",",
"mean",
"=",
"None",
",",
"rowcov",
"=",
"1",
",",
"colcov",
"=",
"1",
",",
"size",
"=",
"1",
",",
"random_state",
"=",
"None",
")",
":",
"size",
"=",
"int",
"(",
"size",
")",
"dims",
",",
"mean",
",",
"rowcov",
... | https://github.com/catboost/catboost/blob/167f64f237114a4d10b2b4ee42adb4569137debe/contrib/python/scipy/scipy/stats/_multivariate.py#L954-L988 | |
miyosuda/TensorFlowAndroidMNIST | 7b5a4603d2780a8a2834575706e9001977524007 | jni-build/jni/include/tensorflow/python/ops/histogram_ops.py | python | histogram_fixed_width | (values,
value_range,
nbins=100,
dtype=dtypes.int32,
name=None) | Return histogram of values.
Given the tensor `values`, this operation returns a rank 1 histogram counting
the number of entries in `values` that fell into every bin. The bins are
equal width and determined by the arguments `value_range` and `nbins`.
Args:
values: Numeric `Tensor`.
value_range: Shap... | Return histogram of values. | [
"Return",
"histogram",
"of",
"values",
"."
] | def histogram_fixed_width(values,
value_range,
nbins=100,
dtype=dtypes.int32,
name=None):
"""Return histogram of values.
Given the tensor `values`, this operation returns a rank 1 histogram counting
the number... | [
"def",
"histogram_fixed_width",
"(",
"values",
",",
"value_range",
",",
"nbins",
"=",
"100",
",",
"dtype",
"=",
"dtypes",
".",
"int32",
",",
"name",
"=",
"None",
")",
":",
"with",
"ops",
".",
"op_scope",
"(",
"[",
"values",
",",
"value_range",
",",
"nb... | https://github.com/miyosuda/TensorFlowAndroidMNIST/blob/7b5a4603d2780a8a2834575706e9001977524007/jni-build/jni/include/tensorflow/python/ops/histogram_ops.py#L32-L96 | ||
GJDuck/LowFat | ecf6a0f0fa1b73a27a626cf493cc39e477b6faea | llvm-4.0.0.src/tools/clang/utils/check_cfc/check_cfc.py | python | add_output_file | (args, output_file) | return args + ['-o', output_file] | Append an output file to args, presuming not already specified. | Append an output file to args, presuming not already specified. | [
"Append",
"an",
"output",
"file",
"to",
"args",
"presuming",
"not",
"already",
"specified",
"."
] | def add_output_file(args, output_file):
"""Append an output file to args, presuming not already specified."""
return args + ['-o', output_file] | [
"def",
"add_output_file",
"(",
"args",
",",
"output_file",
")",
":",
"return",
"args",
"+",
"[",
"'-o'",
",",
"output_file",
"]"
] | https://github.com/GJDuck/LowFat/blob/ecf6a0f0fa1b73a27a626cf493cc39e477b6faea/llvm-4.0.0.src/tools/clang/utils/check_cfc/check_cfc.py#L169-L171 | |
pytorch/pytorch | 7176c92687d3cc847cc046bf002269c6949a21c2 | torch/utils/benchmark/utils/common.py | python | trim_sigfig | (x: float, n: int) | return float(torch.tensor(x / scale).round() * scale) | Trim `x` to `n` significant figures. (e.g. 3.14159, 2 -> 3.10000) | Trim `x` to `n` significant figures. (e.g. 3.14159, 2 -> 3.10000) | [
"Trim",
"x",
"to",
"n",
"significant",
"figures",
".",
"(",
"e",
".",
"g",
".",
"3",
".",
"14159",
"2",
"-",
">",
"3",
".",
"10000",
")"
] | def trim_sigfig(x: float, n: int) -> float:
"""Trim `x` to `n` significant figures. (e.g. 3.14159, 2 -> 3.10000)"""
assert n == int(n)
magnitude = int(torch.tensor(x).abs().log10().ceil().item())
scale = 10 ** (magnitude - n)
return float(torch.tensor(x / scale).round() * scale) | [
"def",
"trim_sigfig",
"(",
"x",
":",
"float",
",",
"n",
":",
"int",
")",
"->",
"float",
":",
"assert",
"n",
"==",
"int",
"(",
"n",
")",
"magnitude",
"=",
"int",
"(",
"torch",
".",
"tensor",
"(",
"x",
")",
".",
"abs",
"(",
")",
".",
"log10",
"... | https://github.com/pytorch/pytorch/blob/7176c92687d3cc847cc046bf002269c6949a21c2/torch/utils/benchmark/utils/common.py#L276-L281 | |
ChromiumWebApps/chromium | c7361d39be8abd1574e6ce8957c8dbddd4c6ccf7 | tools/json_schema_compiler/cpp_bundle_generator.py | python | _FormatNameAsConstant | (name) | return 'k%s' % re.sub('_[a-z]',
lambda m: m.group(0)[1].upper(),
name.replace('.', '_')) | Formats a name to be a C++ constant of the form kConstantName | Formats a name to be a C++ constant of the form kConstantName | [
"Formats",
"a",
"name",
"to",
"be",
"a",
"C",
"++",
"constant",
"of",
"the",
"form",
"kConstantName"
] | def _FormatNameAsConstant(name):
"""Formats a name to be a C++ constant of the form kConstantName"""
name = '%s%s' % (name[0].upper(), name[1:])
return 'k%s' % re.sub('_[a-z]',
lambda m: m.group(0)[1].upper(),
name.replace('.', '_')) | [
"def",
"_FormatNameAsConstant",
"(",
"name",
")",
":",
"name",
"=",
"'%s%s'",
"%",
"(",
"name",
"[",
"0",
"]",
".",
"upper",
"(",
")",
",",
"name",
"[",
"1",
":",
"]",
")",
"return",
"'k%s'",
"%",
"re",
".",
"sub",
"(",
"'_[a-z]'",
",",
"lambda",... | https://github.com/ChromiumWebApps/chromium/blob/c7361d39be8abd1574e6ce8957c8dbddd4c6ccf7/tools/json_schema_compiler/cpp_bundle_generator.py#L244-L249 | |
wxWidgets/wxPython-Classic | 19571e1ae65f1ac445f5491474121998c97a1bf0 | src/osx_carbon/_controls.py | python | TextAttr.SplitParaCharStyles | (*args, **kwargs) | return _controls_.TextAttr_SplitParaCharStyles(*args, **kwargs) | SplitParaCharStyles(TextAttr style, TextAttr parStyle, TextAttr charStyle) -> bool | SplitParaCharStyles(TextAttr style, TextAttr parStyle, TextAttr charStyle) -> bool | [
"SplitParaCharStyles",
"(",
"TextAttr",
"style",
"TextAttr",
"parStyle",
"TextAttr",
"charStyle",
")",
"-",
">",
"bool"
] | def SplitParaCharStyles(*args, **kwargs):
"""SplitParaCharStyles(TextAttr style, TextAttr parStyle, TextAttr charStyle) -> bool"""
return _controls_.TextAttr_SplitParaCharStyles(*args, **kwargs) | [
"def",
"SplitParaCharStyles",
"(",
"*",
"args",
",",
"*",
"*",
"kwargs",
")",
":",
"return",
"_controls_",
".",
"TextAttr_SplitParaCharStyles",
"(",
"*",
"args",
",",
"*",
"*",
"kwargs",
")"
] | https://github.com/wxWidgets/wxPython-Classic/blob/19571e1ae65f1ac445f5491474121998c97a1bf0/src/osx_carbon/_controls.py#L1945-L1947 | |
windystrife/UnrealEngine_NVIDIAGameWorks | b50e6338a7c5b26374d66306ebc7807541ff815e | Engine/Extras/ThirdPartyNotUE/emsdk/Win64/python/2.7.5.3_64bit/Lib/decimal.py | python | Decimal.next_toward | (self, other, context=None) | return ans | Returns the number closest to self, in the direction towards other.
The result is the closest representable number to self
(excluding self) that is in the direction towards other,
unless both have the same value. If the two operands are
numerically equal, then the result is a copy of s... | Returns the number closest to self, in the direction towards other. | [
"Returns",
"the",
"number",
"closest",
"to",
"self",
"in",
"the",
"direction",
"towards",
"other",
"."
] | def next_toward(self, other, context=None):
"""Returns the number closest to self, in the direction towards other.
The result is the closest representable number to self
(excluding self) that is in the direction towards other,
unless both have the same value. If the two operands are
... | [
"def",
"next_toward",
"(",
"self",
",",
"other",
",",
"context",
"=",
"None",
")",
":",
"other",
"=",
"_convert_other",
"(",
"other",
",",
"raiseit",
"=",
"True",
")",
"if",
"context",
"is",
"None",
":",
"context",
"=",
"getcontext",
"(",
")",
"ans",
... | https://github.com/windystrife/UnrealEngine_NVIDIAGameWorks/blob/b50e6338a7c5b26374d66306ebc7807541ff815e/Engine/Extras/ThirdPartyNotUE/emsdk/Win64/python/2.7.5.3_64bit/Lib/decimal.py#L3440-L3484 | |
OSGeo/gdal | 3748fc4ba4fba727492774b2b908a2130c864a83 | swig/python/osgeo/osr.py | python | OSRCRSInfo_type_get | (*args) | return _osr.OSRCRSInfo_type_get(*args) | r"""OSRCRSInfo_type_get(CRSInfo crsInfo) -> OSRCRSType | r"""OSRCRSInfo_type_get(CRSInfo crsInfo) -> OSRCRSType | [
"r",
"OSRCRSInfo_type_get",
"(",
"CRSInfo",
"crsInfo",
")",
"-",
">",
"OSRCRSType"
] | def OSRCRSInfo_type_get(*args):
r"""OSRCRSInfo_type_get(CRSInfo crsInfo) -> OSRCRSType"""
return _osr.OSRCRSInfo_type_get(*args) | [
"def",
"OSRCRSInfo_type_get",
"(",
"*",
"args",
")",
":",
"return",
"_osr",
".",
"OSRCRSInfo_type_get",
"(",
"*",
"args",
")"
] | https://github.com/OSGeo/gdal/blob/3748fc4ba4fba727492774b2b908a2130c864a83/swig/python/osgeo/osr.py#L1012-L1014 | |
wxWidgets/wxPython-Classic | 19571e1ae65f1ac445f5491474121998c97a1bf0 | wx/lib/ogl/_lines.py | python | LineShape.FindLineEndPoints | (self) | return end_x, end_y, other_end_x, other_end_y | Finds the x, y points at the two ends of the line.
This function can be used by e.g. line-routing routines to
get the actual points on the two node images where the lines will be
drawn to / from. | Finds the x, y points at the two ends of the line. | [
"Finds",
"the",
"x",
"y",
"points",
"at",
"the",
"two",
"ends",
"of",
"the",
"line",
"."
] | def FindLineEndPoints(self):
"""Finds the x, y points at the two ends of the line.
This function can be used by e.g. line-routing routines to
get the actual points on the two node images where the lines will be
drawn to / from.
"""
if not self._from or not self._to:
... | [
"def",
"FindLineEndPoints",
"(",
"self",
")",
":",
"if",
"not",
"self",
".",
"_from",
"or",
"not",
"self",
".",
"_to",
":",
"return",
"# Do each end - nothing in the middle. User has to move other points",
"# manually if necessary.",
"second_point",
"=",
"self",
".",
... | https://github.com/wxWidgets/wxPython-Classic/blob/19571e1ae65f1ac445f5491474121998c97a1bf0/wx/lib/ogl/_lines.py#L948-L1001 | |
miyosuda/TensorFlowAndroidMNIST | 7b5a4603d2780a8a2834575706e9001977524007 | jni-build/jni/include/tensorflow/contrib/framework/python/framework/tensor_util.py | python | with_same_shape | (expected_tensor, tensor) | Assert tensors are the same shape, from the same graph.
Args:
expected_tensor: Tensor with expected shape.
tensor: Tensor of actual values.
Returns:
Tuple of (actual_tensor, label_tensor), possibly with assert ops added. | Assert tensors are the same shape, from the same graph. | [
"Assert",
"tensors",
"are",
"the",
"same",
"shape",
"from",
"the",
"same",
"graph",
"."
] | def with_same_shape(expected_tensor, tensor):
"""Assert tensors are the same shape, from the same graph.
Args:
expected_tensor: Tensor with expected shape.
tensor: Tensor of actual values.
Returns:
Tuple of (actual_tensor, label_tensor), possibly with assert ops added.
"""
with ops.op_scope([expe... | [
"def",
"with_same_shape",
"(",
"expected_tensor",
",",
"tensor",
")",
":",
"with",
"ops",
".",
"op_scope",
"(",
"[",
"expected_tensor",
",",
"tensor",
"]",
",",
"'%s/'",
"%",
"tensor",
".",
"op",
".",
"name",
")",
":",
"tensor_shape",
"=",
"expected_tensor... | https://github.com/miyosuda/TensorFlowAndroidMNIST/blob/7b5a4603d2780a8a2834575706e9001977524007/jni-build/jni/include/tensorflow/contrib/framework/python/framework/tensor_util.py#L202-L216 | ||
BitMEX/api-connectors | 37a3a5b806ad5d0e0fc975ab86d9ed43c3bcd812 | auto-generated/python/swagger_client/api/user_api.py | python | UserApi.user_check_referral_code_with_http_info | (self, **kwargs) | return self.api_client.call_api(
'/user/checkReferralCode', 'GET',
path_params,
query_params,
header_params,
body=body_params,
post_params=form_params,
files=local_var_files,
response_type='float', # noqa: E501
... | Check if a referral code is valid. # noqa: E501
If the code is valid, responds with the referral code's discount (e.g. `0.1` for 10%). Otherwise, will return a 404 or 451 if invalid. # noqa: E501
This method makes a synchronous HTTP request by default. To make an
asynchronous HTTP request, pl... | Check if a referral code is valid. # noqa: E501 | [
"Check",
"if",
"a",
"referral",
"code",
"is",
"valid",
".",
"#",
"noqa",
":",
"E501"
] | def user_check_referral_code_with_http_info(self, **kwargs): # noqa: E501
"""Check if a referral code is valid. # noqa: E501
If the code is valid, responds with the referral code's discount (e.g. `0.1` for 10%). Otherwise, will return a 404 or 451 if invalid. # noqa: E501
This method makes a... | [
"def",
"user_check_referral_code_with_http_info",
"(",
"self",
",",
"*",
"*",
"kwargs",
")",
":",
"# noqa: E501",
"all_params",
"=",
"[",
"'referral_code'",
"]",
"# noqa: E501",
"all_params",
".",
"append",
"(",
"'async_req'",
")",
"all_params",
".",
"append",
"("... | https://github.com/BitMEX/api-connectors/blob/37a3a5b806ad5d0e0fc975ab86d9ed43c3bcd812/auto-generated/python/swagger_client/api/user_api.py#L155-L226 | |
eventql/eventql | 7ca0dbb2e683b525620ea30dc40540a22d5eb227 | deps/3rdparty/spidermonkey/mozjs/build/pymake/pymake/parser.py | python | itercommandchars | (d, offset, tokenlist, it) | Iterate over command syntax. # comment markers are not special, and escaped newlines are included
in the output text. | Iterate over command syntax. # comment markers are not special, and escaped newlines are included
in the output text. | [
"Iterate",
"over",
"command",
"syntax",
".",
"#",
"comment",
"markers",
"are",
"not",
"special",
"and",
"escaped",
"newlines",
"are",
"included",
"in",
"the",
"output",
"text",
"."
] | def itercommandchars(d, offset, tokenlist, it):
"""
Iterate over command syntax. # comment markers are not special, and escaped newlines are included
in the output text.
"""
assert offset >= d.lstart and offset <= d.lend, "offset %i should be between %i and %i" % (offset, d.lstart, d.lend)
if ... | [
"def",
"itercommandchars",
"(",
"d",
",",
"offset",
",",
"tokenlist",
",",
"it",
")",
":",
"assert",
"offset",
">=",
"d",
".",
"lstart",
"and",
"offset",
"<=",
"d",
".",
"lend",
",",
"\"offset %i should be between %i and %i\"",
"%",
"(",
"offset",
",",
"d"... | https://github.com/eventql/eventql/blob/7ca0dbb2e683b525620ea30dc40540a22d5eb227/deps/3rdparty/spidermonkey/mozjs/build/pymake/pymake/parser.py#L211-L234 | ||
tensorflow/tensorflow | 419e3a6b650ea4bd1b0cba23c4348f8a69f3272e | tensorflow/python/framework/graph_to_function_def.py | python | _tensor_to_argdef | (t, name=None, used_names=None) | return arg | Convert tensor t to an argdef, with a specified name or a unique name. | Convert tensor t to an argdef, with a specified name or a unique name. | [
"Convert",
"tensor",
"t",
"to",
"an",
"argdef",
"with",
"a",
"specified",
"name",
"or",
"a",
"unique",
"name",
"."
] | def _tensor_to_argdef(t, name=None, used_names=None):
"""Convert tensor t to an argdef, with a specified name or a unique name."""
arg = op_def_pb2.OpDef.ArgDef()
if name is None:
arg.name = _make_argname_from_tensor_name(t.name)
if used_names is not None:
if arg.name in used_names:
i = 0
... | [
"def",
"_tensor_to_argdef",
"(",
"t",
",",
"name",
"=",
"None",
",",
"used_names",
"=",
"None",
")",
":",
"arg",
"=",
"op_def_pb2",
".",
"OpDef",
".",
"ArgDef",
"(",
")",
"if",
"name",
"is",
"None",
":",
"arg",
".",
"name",
"=",
"_make_argname_from_ten... | https://github.com/tensorflow/tensorflow/blob/419e3a6b650ea4bd1b0cba23c4348f8a69f3272e/tensorflow/python/framework/graph_to_function_def.py#L28-L46 | |
PaddlePaddle/Paddle | 1252f4bb3e574df80aa6d18c7ddae1b3a90bd81c | python/paddle/fluid/layers/nn.py | python | crop_tensor | (x, shape=None, offsets=None, name=None) | return out | Crop input into output, as specified by offsets and shape.
.. code-block:: text
* Case 1 (input is a 2-D Tensor):
Input:
X.shape = [3, 5]
X.data = [[0, 1, 2, 0, 0],
[0, 3, 4, 0, 0],
[0, 0, 0, 0, 0]]
... | Crop input into output, as specified by offsets and shape. | [
"Crop",
"input",
"into",
"output",
"as",
"specified",
"by",
"offsets",
"and",
"shape",
"."
] | def crop_tensor(x, shape=None, offsets=None, name=None):
"""
Crop input into output, as specified by offsets and shape.
.. code-block:: text
* Case 1 (input is a 2-D Tensor):
Input:
X.shape = [3, 5]
X.data = [[0, 1, 2, 0, 0],
[0... | [
"def",
"crop_tensor",
"(",
"x",
",",
"shape",
"=",
"None",
",",
"offsets",
"=",
"None",
",",
"name",
"=",
"None",
")",
":",
"helper",
"=",
"LayerHelper",
"(",
"'crop_tensor'",
",",
"*",
"*",
"locals",
"(",
")",
")",
"check_variable_and_dtype",
"(",
"x"... | https://github.com/PaddlePaddle/Paddle/blob/1252f4bb3e574df80aa6d18c7ddae1b3a90bd81c/python/paddle/fluid/layers/nn.py#L9160-L9341 | |
larroy/clearskies_core | 3574ddf0edc8555454c7044126e786a6c29444dc | tools/gyp/pylib/gyp/win_tool.py | python | WinTool.ExecRecursiveMirror | (self, source, dest) | Emulation of rm -rf out && cp -af in out. | Emulation of rm -rf out && cp -af in out. | [
"Emulation",
"of",
"rm",
"-",
"rf",
"out",
"&&",
"cp",
"-",
"af",
"in",
"out",
"."
] | def ExecRecursiveMirror(self, source, dest):
"""Emulation of rm -rf out && cp -af in out."""
if os.path.exists(dest):
if os.path.isdir(dest):
shutil.rmtree(dest)
else:
os.unlink(dest)
if os.path.isdir(source):
shutil.copytree(source, dest)
else:
shutil.copy2(sourc... | [
"def",
"ExecRecursiveMirror",
"(",
"self",
",",
"source",
",",
"dest",
")",
":",
"if",
"os",
".",
"path",
".",
"exists",
"(",
"dest",
")",
":",
"if",
"os",
".",
"path",
".",
"isdir",
"(",
"dest",
")",
":",
"shutil",
".",
"rmtree",
"(",
"dest",
")... | https://github.com/larroy/clearskies_core/blob/3574ddf0edc8555454c7044126e786a6c29444dc/tools/gyp/pylib/gyp/win_tool.py#L88-L98 | ||
clementine-player/Clementine | 111379dfd027802b59125829fcf87e3e1d0ad73b | dist/cpplint.py | python | ExpectingFunctionArgs | (clean_lines, linenum) | return (Match(r'^\s*MOCK_(CONST_)?METHOD\d+(_T)?\(', line) or
(linenum >= 2 and
(Match(r'^\s*MOCK_(?:CONST_)?METHOD\d+(?:_T)?\((?:\S+,)?\s*$',
clean_lines.elided[linenum - 1]) or
Match(r'^\s*MOCK_(?:CONST_)?METHOD\d+(?:_T)?\(\s*$',
clean_lines.elided[... | Checks whether where function type arguments are expected.
Args:
clean_lines: A CleansedLines instance containing the file.
linenum: The number of the line to check.
Returns:
True if the line at 'linenum' is inside something that expects arguments
of function types. | Checks whether where function type arguments are expected. | [
"Checks",
"whether",
"where",
"function",
"type",
"arguments",
"are",
"expected",
"."
] | def ExpectingFunctionArgs(clean_lines, linenum):
"""Checks whether where function type arguments are expected.
Args:
clean_lines: A CleansedLines instance containing the file.
linenum: The number of the line to check.
Returns:
True if the line at 'linenum' is inside something that expects arguments
... | [
"def",
"ExpectingFunctionArgs",
"(",
"clean_lines",
",",
"linenum",
")",
":",
"line",
"=",
"clean_lines",
".",
"elided",
"[",
"linenum",
"]",
"return",
"(",
"Match",
"(",
"r'^\\s*MOCK_(CONST_)?METHOD\\d+(_T)?\\('",
",",
"line",
")",
"or",
"(",
"linenum",
">=",
... | https://github.com/clementine-player/Clementine/blob/111379dfd027802b59125829fcf87e3e1d0ad73b/dist/cpplint.py#L5290-L5309 | |
gimli-org/gimli | 17aa2160de9b15ababd9ef99e89b1bc3277bbb23 | pygimli/physics/ert/ertManager.py | python | ERTManager.simulate | (self, mesh, scheme, res, **kwargs) | return ret | Simulate an ERT measurement.
Perform the forward task for a given mesh, resistivity distribution &
measuring scheme and return data (apparent resistivity) or potentials.
For complex resistivity, the apparent resistivities is complex as well.
The forward operator itself only calculates... | Simulate an ERT measurement. | [
"Simulate",
"an",
"ERT",
"measurement",
"."
] | def simulate(self, mesh, scheme, res, **kwargs):
"""Simulate an ERT measurement.
Perform the forward task for a given mesh, resistivity distribution &
measuring scheme and return data (apparent resistivity) or potentials.
For complex resistivity, the apparent resistivities is complex a... | [
"def",
"simulate",
"(",
"self",
",",
"mesh",
",",
"scheme",
",",
"res",
",",
"*",
"*",
"kwargs",
")",
":",
"verbose",
"=",
"kwargs",
".",
"pop",
"(",
"'verbose'",
",",
"self",
".",
"verbose",
")",
"calcOnly",
"=",
"kwargs",
".",
"pop",
"(",
"'calcO... | https://github.com/gimli-org/gimli/blob/17aa2160de9b15ababd9ef99e89b1bc3277bbb23/pygimli/physics/ert/ertManager.py#L111-L357 | |
wxWidgets/wxPython-Classic | 19571e1ae65f1ac445f5491474121998c97a1bf0 | src/osx_cocoa/_misc.py | python | DateTime_GetAmPmStrings | (*args) | return _misc_.DateTime_GetAmPmStrings(*args) | GetAmPmStrings() -> (am, pm)
Get the AM and PM strings in the current locale (may be empty) | GetAmPmStrings() -> (am, pm) | [
"GetAmPmStrings",
"()",
"-",
">",
"(",
"am",
"pm",
")"
] | def DateTime_GetAmPmStrings(*args):
"""
GetAmPmStrings() -> (am, pm)
Get the AM and PM strings in the current locale (may be empty)
"""
return _misc_.DateTime_GetAmPmStrings(*args) | [
"def",
"DateTime_GetAmPmStrings",
"(",
"*",
"args",
")",
":",
"return",
"_misc_",
".",
"DateTime_GetAmPmStrings",
"(",
"*",
"args",
")"
] | https://github.com/wxWidgets/wxPython-Classic/blob/19571e1ae65f1ac445f5491474121998c97a1bf0/src/osx_cocoa/_misc.py#L4281-L4287 | |
aws/lumberyard | f85344403c1c2e77ec8c75deb2c116e97b713217 | dev/Tools/Python/3.7.10/mac/Python.framework/Versions/3.7/lib/python3.7/_pydecimal.py | python | Decimal.copy_sign | (self, other, context=None) | return _dec_from_triple(other._sign, self._int,
self._exp, self._is_special) | Returns self with the sign of other. | Returns self with the sign of other. | [
"Returns",
"self",
"with",
"the",
"sign",
"of",
"other",
"."
] | def copy_sign(self, other, context=None):
"""Returns self with the sign of other."""
other = _convert_other(other, raiseit=True)
return _dec_from_triple(other._sign, self._int,
self._exp, self._is_special) | [
"def",
"copy_sign",
"(",
"self",
",",
"other",
",",
"context",
"=",
"None",
")",
":",
"other",
"=",
"_convert_other",
"(",
"other",
",",
"raiseit",
"=",
"True",
")",
"return",
"_dec_from_triple",
"(",
"other",
".",
"_sign",
",",
"self",
".",
"_int",
",... | https://github.com/aws/lumberyard/blob/f85344403c1c2e77ec8c75deb2c116e97b713217/dev/Tools/Python/3.7.10/mac/Python.framework/Versions/3.7/lib/python3.7/_pydecimal.py#L3030-L3034 | |
gem5/gem5 | 141cc37c2d4b93959d4c249b8f7e6a8b2ef75338 | src/mem/slicc/parser.py | python | SLICC.p_exprs__one | (self, p) | exprs : expr | exprs : expr | [
"exprs",
":",
"expr"
] | def p_exprs__one(self, p):
"exprs : expr"
p[0] = [ p[1] ] | [
"def",
"p_exprs__one",
"(",
"self",
",",
"p",
")",
":",
"p",
"[",
"0",
"]",
"=",
"[",
"p",
"[",
"1",
"]",
"]"
] | https://github.com/gem5/gem5/blob/141cc37c2d4b93959d4c249b8f7e6a8b2ef75338/src/mem/slicc/parser.py#L588-L590 | ||
giuspen/cherrytree | 84712f206478fcf9acf30174009ad28c648c6344 | pygtk2/modules/support.py | python | dialog_color_pick | (dad, curr_color=None) | return ret_color | Dialog to select a color, featuring a palette | Dialog to select a color, featuring a palette | [
"Dialog",
"to",
"select",
"a",
"color",
"featuring",
"a",
"palette"
] | def dialog_color_pick(dad, curr_color=None):
"""Dialog to select a color, featuring a palette"""
dialog = gtk.ColorSelectionDialog(_("Pick a Color"))
dialog.set_transient_for(dad.window)
dialog.set_property("modal", True)
dialog.set_property("destroy-with-parent", True)
dialog.set_position(gtk.W... | [
"def",
"dialog_color_pick",
"(",
"dad",
",",
"curr_color",
"=",
"None",
")",
":",
"dialog",
"=",
"gtk",
".",
"ColorSelectionDialog",
"(",
"_",
"(",
"\"Pick a Color\"",
")",
")",
"dialog",
".",
"set_transient_for",
"(",
"dad",
".",
"window",
")",
"dialog",
... | https://github.com/giuspen/cherrytree/blob/84712f206478fcf9acf30174009ad28c648c6344/pygtk2/modules/support.py#L1811-L1846 | |
hszhao/PSPNet | cf7e5a99ba37e46118026e96be5821a9bc63bde0 | scripts/cpp_lint.py | python | FileInfo.FullName | (self) | return os.path.abspath(self._filename).replace('\\', '/') | Make Windows paths like Unix. | Make Windows paths like Unix. | [
"Make",
"Windows",
"paths",
"like",
"Unix",
"."
] | def FullName(self):
"""Make Windows paths like Unix."""
return os.path.abspath(self._filename).replace('\\', '/') | [
"def",
"FullName",
"(",
"self",
")",
":",
"return",
"os",
".",
"path",
".",
"abspath",
"(",
"self",
".",
"_filename",
")",
".",
"replace",
"(",
"'\\\\'",
",",
"'/'",
")"
] | https://github.com/hszhao/PSPNet/blob/cf7e5a99ba37e46118026e96be5821a9bc63bde0/scripts/cpp_lint.py#L881-L883 | |
wlanjie/AndroidFFmpeg | 7baf9122f4b8e1c74e7baf4be5c422c7a5ba5aaf | tools/fdk-aac-build/x86/toolchain/lib/python2.7/pydoc.py | python | render_doc | (thing, title='Python Library Documentation: %s', forceload=0) | return title % desc + '\n\n' + text.document(object, name) | Render text documentation, given an object or a path to an object. | Render text documentation, given an object or a path to an object. | [
"Render",
"text",
"documentation",
"given",
"an",
"object",
"or",
"a",
"path",
"to",
"an",
"object",
"."
] | def render_doc(thing, title='Python Library Documentation: %s', forceload=0):
"""Render text documentation, given an object or a path to an object."""
object, name = resolve(thing, forceload)
desc = describe(object)
module = inspect.getmodule(object)
if name and '.' in name:
desc += ' in ' +... | [
"def",
"render_doc",
"(",
"thing",
",",
"title",
"=",
"'Python Library Documentation: %s'",
",",
"forceload",
"=",
"0",
")",
":",
"object",
",",
"name",
"=",
"resolve",
"(",
"thing",
",",
"forceload",
")",
"desc",
"=",
"describe",
"(",
"object",
")",
"modu... | https://github.com/wlanjie/AndroidFFmpeg/blob/7baf9122f4b8e1c74e7baf4be5c422c7a5ba5aaf/tools/fdk-aac-build/x86/toolchain/lib/python2.7/pydoc.py#L1504-L1527 | |
hanpfei/chromium-net | 392cc1fa3a8f92f42e4071ab6e674d8e0482f83f | third_party/catapult/third_party/gsutil/third_party/oauth2client/oauth2client/client.py | python | AccessTokenCredentials.__init__ | (self, access_token, user_agent, revoke_uri=None) | Create an instance of OAuth2Credentials
This is one of the few types if Credentials that you should contrust,
Credentials objects are usually instantiated by a Flow.
Args:
access_token: string, access token.
user_agent: string, The HTTP User-Agent to provide for this application.
revoke_... | Create an instance of OAuth2Credentials | [
"Create",
"an",
"instance",
"of",
"OAuth2Credentials"
] | def __init__(self, access_token, user_agent, revoke_uri=None):
"""Create an instance of OAuth2Credentials
This is one of the few types if Credentials that you should contrust,
Credentials objects are usually instantiated by a Flow.
Args:
access_token: string, access token.
user_agent: stri... | [
"def",
"__init__",
"(",
"self",
",",
"access_token",
",",
"user_agent",
",",
"revoke_uri",
"=",
"None",
")",
":",
"super",
"(",
"AccessTokenCredentials",
",",
"self",
")",
".",
"__init__",
"(",
"access_token",
",",
"None",
",",
"None",
",",
"None",
",",
... | https://github.com/hanpfei/chromium-net/blob/392cc1fa3a8f92f42e4071ab6e674d8e0482f83f/third_party/catapult/third_party/gsutil/third_party/oauth2client/oauth2client/client.py#L903-L923 | ||
funnyzhou/Adaptive_Feeding | 9c78182331d8c0ea28de47226e805776c638d46f | python/caffe/pycaffe.py | python | _Net_blob_loss_weights | (self) | return self._blob_loss_weights_dict | An OrderedDict (bottom to top, i.e., input to output) of network
blob loss weights indexed by name | An OrderedDict (bottom to top, i.e., input to output) of network
blob loss weights indexed by name | [
"An",
"OrderedDict",
"(",
"bottom",
"to",
"top",
"i",
".",
"e",
".",
"input",
"to",
"output",
")",
"of",
"network",
"blob",
"loss",
"weights",
"indexed",
"by",
"name"
] | def _Net_blob_loss_weights(self):
"""
An OrderedDict (bottom to top, i.e., input to output) of network
blob loss weights indexed by name
"""
if not hasattr(self, '_blobs_loss_weights_dict'):
self._blob_loss_weights_dict = OrderedDict(zip(self._blob_names,
... | [
"def",
"_Net_blob_loss_weights",
"(",
"self",
")",
":",
"if",
"not",
"hasattr",
"(",
"self",
",",
"'_blobs_loss_weights_dict'",
")",
":",
"self",
".",
"_blob_loss_weights_dict",
"=",
"OrderedDict",
"(",
"zip",
"(",
"self",
".",
"_blob_names",
",",
"self",
".",... | https://github.com/funnyzhou/Adaptive_Feeding/blob/9c78182331d8c0ea28de47226e805776c638d46f/python/caffe/pycaffe.py#L36-L44 | |
benoitsteiner/tensorflow-opencl | cb7cb40a57fde5cfd4731bc551e82a1e2fef43a5 | tensorflow/python/client/timeline.py | python | Timeline._is_gputrace_device | (self, device_name) | return '/stream:' in device_name or '/memcpy' in device_name | Returns true if this device is part of the GPUTracer logging. | Returns true if this device is part of the GPUTracer logging. | [
"Returns",
"true",
"if",
"this",
"device",
"is",
"part",
"of",
"the",
"GPUTracer",
"logging",
"."
] | def _is_gputrace_device(self, device_name):
"""Returns true if this device is part of the GPUTracer logging."""
return '/stream:' in device_name or '/memcpy' in device_name | [
"def",
"_is_gputrace_device",
"(",
"self",
",",
"device_name",
")",
":",
"return",
"'/stream:'",
"in",
"device_name",
"or",
"'/memcpy'",
"in",
"device_name"
] | https://github.com/benoitsteiner/tensorflow-opencl/blob/cb7cb40a57fde5cfd4731bc551e82a1e2fef43a5/tensorflow/python/client/timeline.py#L465-L467 | |
wxWidgets/wxPython-Classic | 19571e1ae65f1ac445f5491474121998c97a1bf0 | wx/tools/Editra/src/syntax/synxml.py | python | SyntaxSpecList.GetSubElements | (self) | return xml | Get the xml for all the syntax spec elements | Get the xml for all the syntax spec elements | [
"Get",
"the",
"xml",
"for",
"all",
"the",
"syntax",
"spec",
"elements"
] | def GetSubElements(self):
"""Get the xml for all the syntax spec elements"""
xml = u""
tag = u"<%s %s=" % (EXML_SYNTAXSPEC, EXML_VALUE)
tag += ("\"%s\" " + EXML_TAG + "=\"%s\"/>")
ident = self.GetIndentationStr() + (self.Indentation * u" ")
for spec in self._specs:
... | [
"def",
"GetSubElements",
"(",
"self",
")",
":",
"xml",
"=",
"u\"\"",
"tag",
"=",
"u\"<%s %s=\"",
"%",
"(",
"EXML_SYNTAXSPEC",
",",
"EXML_VALUE",
")",
"tag",
"+=",
"(",
"\"\\\"%s\\\" \"",
"+",
"EXML_TAG",
"+",
"\"=\\\"%s\\\"/>\"",
")",
"ident",
"=",
"self",
... | https://github.com/wxWidgets/wxPython-Classic/blob/19571e1ae65f1ac445f5491474121998c97a1bf0/wx/tools/Editra/src/syntax/synxml.py#L700-L709 | |
aws/lumberyard | f85344403c1c2e77ec8c75deb2c116e97b713217 | dev/Tools/Python/3.7.10/windows/Lib/tkinter/__init__.py | python | Canvas.find_overlapping | (self, x1, y1, x2, y2) | return self.find('overlapping', x1, y1, x2, y2) | Return all items which overlap the rectangle
defined by X1,Y1,X2,Y2. | Return all items which overlap the rectangle
defined by X1,Y1,X2,Y2. | [
"Return",
"all",
"items",
"which",
"overlap",
"the",
"rectangle",
"defined",
"by",
"X1",
"Y1",
"X2",
"Y2",
"."
] | def find_overlapping(self, x1, y1, x2, y2):
"""Return all items which overlap the rectangle
defined by X1,Y1,X2,Y2."""
return self.find('overlapping', x1, y1, x2, y2) | [
"def",
"find_overlapping",
"(",
"self",
",",
"x1",
",",
"y1",
",",
"x2",
",",
"y2",
")",
":",
"return",
"self",
".",
"find",
"(",
"'overlapping'",
",",
"x1",
",",
"y1",
",",
"x2",
",",
"y2",
")"
] | https://github.com/aws/lumberyard/blob/f85344403c1c2e77ec8c75deb2c116e97b713217/dev/Tools/Python/3.7.10/windows/Lib/tkinter/__init__.py#L2542-L2545 | |
liulei01/DRBox | b5c76e033c555c9009590ab384e1f7bd3c66c237 | scripts/cpp_lint.py | python | CheckVlogArguments | (filename, clean_lines, linenum, error) | Checks that VLOG() is only used for defining a logging level.
For example, VLOG(2) is correct. VLOG(INFO), VLOG(WARNING), VLOG(ERROR), and
VLOG(FATAL) are not.
Args:
filename: The name of the current file.
clean_lines: A CleansedLines instance containing the file.
linenum: The number of the line to ... | Checks that VLOG() is only used for defining a logging level. | [
"Checks",
"that",
"VLOG",
"()",
"is",
"only",
"used",
"for",
"defining",
"a",
"logging",
"level",
"."
] | def CheckVlogArguments(filename, clean_lines, linenum, error):
"""Checks that VLOG() is only used for defining a logging level.
For example, VLOG(2) is correct. VLOG(INFO), VLOG(WARNING), VLOG(ERROR), and
VLOG(FATAL) are not.
Args:
filename: The name of the current file.
clean_lines: A CleansedLines i... | [
"def",
"CheckVlogArguments",
"(",
"filename",
",",
"clean_lines",
",",
"linenum",
",",
"error",
")",
":",
"line",
"=",
"clean_lines",
".",
"elided",
"[",
"linenum",
"]",
"if",
"Search",
"(",
"r'\\bVLOG\\((INFO|ERROR|WARNING|DFATAL|FATAL)\\)'",
",",
"line",
")",
... | https://github.com/liulei01/DRBox/blob/b5c76e033c555c9009590ab384e1f7bd3c66c237/scripts/cpp_lint.py#L1712-L1728 | ||
wxWidgets/wxPython-Classic | 19571e1ae65f1ac445f5491474121998c97a1bf0 | src/msw/_windows.py | python | VarVScrollHelper.RefreshRows | (*args, **kwargs) | return _windows_.VarVScrollHelper_RefreshRows(*args, **kwargs) | RefreshRows(self, size_t from, size_t to) | RefreshRows(self, size_t from, size_t to) | [
"RefreshRows",
"(",
"self",
"size_t",
"from",
"size_t",
"to",
")"
] | def RefreshRows(*args, **kwargs):
"""RefreshRows(self, size_t from, size_t to)"""
return _windows_.VarVScrollHelper_RefreshRows(*args, **kwargs) | [
"def",
"RefreshRows",
"(",
"*",
"args",
",",
"*",
"*",
"kwargs",
")",
":",
"return",
"_windows_",
".",
"VarVScrollHelper_RefreshRows",
"(",
"*",
"args",
",",
"*",
"*",
"kwargs",
")"
] | https://github.com/wxWidgets/wxPython-Classic/blob/19571e1ae65f1ac445f5491474121998c97a1bf0/src/msw/_windows.py#L2293-L2295 | |
carla-simulator/carla | 8854804f4d7748e14d937ec763a2912823a7e5f5 | PythonAPI/carla/agents/navigation/basic_agent.py | python | BasicAgent.set_destination | (self, end_location, start_location=None) | This method creates a list of waypoints between a starting and ending location,
based on the route returned by the global router, and adds it to the local planner.
If no starting location is passed, the vehicle local planner's target location is chosen,
which corresponds (by default), to a locat... | This method creates a list of waypoints between a starting and ending location,
based on the route returned by the global router, and adds it to the local planner.
If no starting location is passed, the vehicle local planner's target location is chosen,
which corresponds (by default), to a locat... | [
"This",
"method",
"creates",
"a",
"list",
"of",
"waypoints",
"between",
"a",
"starting",
"and",
"ending",
"location",
"based",
"on",
"the",
"route",
"returned",
"by",
"the",
"global",
"router",
"and",
"adds",
"it",
"to",
"the",
"local",
"planner",
".",
"If... | def set_destination(self, end_location, start_location=None):
"""
This method creates a list of waypoints between a starting and ending location,
based on the route returned by the global router, and adds it to the local planner.
If no starting location is passed, the vehicle local plann... | [
"def",
"set_destination",
"(",
"self",
",",
"end_location",
",",
"start_location",
"=",
"None",
")",
":",
"if",
"not",
"start_location",
":",
"start_location",
"=",
"self",
".",
"_local_planner",
".",
"target_waypoint",
".",
"transform",
".",
"location",
"clean_... | https://github.com/carla-simulator/carla/blob/8854804f4d7748e14d937ec763a2912823a7e5f5/PythonAPI/carla/agents/navigation/basic_agent.py#L109-L130 | ||
baidu/AnyQ | d94d450d2aaa5f7ed73424b10aa4539835b97527 | tools/common/nlp_algo.py | python | forward_maximum_matching | (
wordlist,
candidates,
wd_len=10,
loc=False,
ignore_unknown_word=True) | return results | Maximum Forward Matching Algorithm
Args:
wordlist: List of words or lists of chars
candidates: Maximum forward matching candidate entity
wd_len: Matching maximum window
loc: Location information, True/False, if True return location
ignore_unknown_word: Whether to ignore unknown words
... | Maximum Forward Matching Algorithm
Args:
wordlist: List of words or lists of chars
candidates: Maximum forward matching candidate entity
wd_len: Matching maximum window
loc: Location information, True/False, if True return location
ignore_unknown_word: Whether to ignore unknown words
... | [
"Maximum",
"Forward",
"Matching",
"Algorithm",
"Args",
":",
"wordlist",
":",
"List",
"of",
"words",
"or",
"lists",
"of",
"chars",
"candidates",
":",
"Maximum",
"forward",
"matching",
"candidate",
"entity",
"wd_len",
":",
"Matching",
"maximum",
"window",
"loc",
... | def forward_maximum_matching(
wordlist,
candidates,
wd_len=10,
loc=False,
ignore_unknown_word=True):
"""
Maximum Forward Matching Algorithm
Args:
wordlist: List ... | [
"def",
"forward_maximum_matching",
"(",
"wordlist",
",",
"candidates",
",",
"wd_len",
"=",
"10",
",",
"loc",
"=",
"False",
",",
"ignore_unknown_word",
"=",
"True",
")",
":",
"idx",
"=",
"0",
"results",
"=",
"[",
"]",
"while",
"idx",
"<",
"len",
"(",
"w... | https://github.com/baidu/AnyQ/blob/d94d450d2aaa5f7ed73424b10aa4539835b97527/tools/common/nlp_algo.py#L17-L59 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.