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 |
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
hughperkins/tf-coriander | 970d3df6c11400ad68405f22b0c42a52374e94ca | tensorflow/python/ops/sparse_ops.py | python | sparse_split | (split_dim, num_split, sp_input, name=None) | return sparse_tensors | Split a `SparseTensor` into `num_split` tensors along `split_dim`.
If the `sp_input.shape[split_dim]` is not an integer multiple of `num_split`
each slice starting from 0:`shape[split_dim] % num_split` gets extra one
dimension. For example, if `split_dim = 1` and `num_split = 2` and the
input is:
input_... | Split a `SparseTensor` into `num_split` tensors along `split_dim`. | [
"Split",
"a",
"SparseTensor",
"into",
"num_split",
"tensors",
"along",
"split_dim",
"."
] | def sparse_split(split_dim, num_split, sp_input, name=None):
"""Split a `SparseTensor` into `num_split` tensors along `split_dim`.
If the `sp_input.shape[split_dim]` is not an integer multiple of `num_split`
each slice starting from 0:`shape[split_dim] % num_split` gets extra one
dimension. For example, if `sp... | [
"def",
"sparse_split",
"(",
"split_dim",
",",
"num_split",
",",
"sp_input",
",",
"name",
"=",
"None",
")",
":",
"sp_input",
"=",
"_convert_to_sparse_tensor",
"(",
"sp_input",
")",
"output_inds",
",",
"output_vals",
",",
"output_shapes",
"=",
"(",
"gen_sparse_ops... | https://github.com/hughperkins/tf-coriander/blob/970d3df6c11400ad68405f22b0c42a52374e94ca/tensorflow/python/ops/sparse_ops.py#L445-L492 | |
catboost/catboost | 167f64f237114a4d10b2b4ee42adb4569137debe | contrib/python/scipy/scipy/stats/_multivariate.py | python | wishart_gen.mode | (self, df, scale) | return _squeeze_output(out) if out is not None else out | Mode of the Wishart distribution
Only valid if the degrees of freedom are greater than the dimension of
the scale matrix.
Parameters
----------
%(_doc_default_callparams)s
Returns
-------
mode : float or None
The Mode of the distribution | Mode of the Wishart distribution | [
"Mode",
"of",
"the",
"Wishart",
"distribution"
] | def mode(self, df, scale):
"""
Mode of the Wishart distribution
Only valid if the degrees of freedom are greater than the dimension of
the scale matrix.
Parameters
----------
%(_doc_default_callparams)s
Returns
-------
mode : float or No... | [
"def",
"mode",
"(",
"self",
",",
"df",
",",
"scale",
")",
":",
"dim",
",",
"df",
",",
"scale",
"=",
"self",
".",
"_process_parameters",
"(",
"df",
",",
"scale",
")",
"out",
"=",
"self",
".",
"_mode",
"(",
"dim",
",",
"df",
",",
"scale",
")",
"r... | https://github.com/catboost/catboost/blob/167f64f237114a4d10b2b4ee42adb4569137debe/contrib/python/scipy/scipy/stats/_multivariate.py#L1768-L1786 | |
llvm/llvm-project | ffa6262cb4e2a335d26416fad39a581b4f98c5f4 | mlir/python/mlir/dialects/_arith_ops_ext.py | python | ConstantOp.create_index | (cls, value: int, *, loc=None, ip=None) | return cls(
IndexType.get(context=_get_default_loc_context(loc)),
value,
loc=loc,
ip=ip) | Create an index-typed constant. | Create an index-typed constant. | [
"Create",
"an",
"index",
"-",
"typed",
"constant",
"."
] | def create_index(cls, value: int, *, loc=None, ip=None):
"""Create an index-typed constant."""
return cls(
IndexType.get(context=_get_default_loc_context(loc)),
value,
loc=loc,
ip=ip) | [
"def",
"create_index",
"(",
"cls",
",",
"value",
":",
"int",
",",
"*",
",",
"loc",
"=",
"None",
",",
"ip",
"=",
"None",
")",
":",
"return",
"cls",
"(",
"IndexType",
".",
"get",
"(",
"context",
"=",
"_get_default_loc_context",
"(",
"loc",
")",
")",
... | https://github.com/llvm/llvm-project/blob/ffa6262cb4e2a335d26416fad39a581b4f98c5f4/mlir/python/mlir/dialects/_arith_ops_ext.py#L51-L57 | |
SequoiaDB/SequoiaDB | 2894ed7e5bd6fe57330afc900cf76d0ff0df9f64 | tools/server/php_linux/libxml2/lib/python2.4/site-packages/libxml2.py | python | xpathParserContext.xpathCompareValues | (self, inf, strict) | return ret | Implement the compare operation on XPath objects: @arg1 <
@arg2 (1, 1, ... @arg1 <= @arg2 (1, 0, ... @arg1 >
@arg2 (0, 1, ... @arg1 >= @arg2 (0, 0, ... When
neither object to be compared is a node-set and the
operator is <=, <, >=, >, then the objects are compared by
... | Implement the compare operation on XPath objects: | [
"Implement",
"the",
"compare",
"operation",
"on",
"XPath",
"objects",
":"
] | def xpathCompareValues(self, inf, strict):
"""Implement the compare operation on XPath objects: @arg1 <
@arg2 (1, 1, ... @arg1 <= @arg2 (1, 0, ... @arg1 >
@arg2 (0, 1, ... @arg1 >= @arg2 (0, 0, ... When
neither object to be compared is a node-set and the
operat... | [
"def",
"xpathCompareValues",
"(",
"self",
",",
"inf",
",",
"strict",
")",
":",
"ret",
"=",
"libxml2mod",
".",
"xmlXPathCompareValues",
"(",
"self",
".",
"_o",
",",
"inf",
",",
"strict",
")",
"return",
"ret"
] | https://github.com/SequoiaDB/SequoiaDB/blob/2894ed7e5bd6fe57330afc900cf76d0ff0df9f64/tools/server/php_linux/libxml2/lib/python2.4/site-packages/libxml2.py#L7399-L7415 | |
MythTV/mythtv | d282a209cb8be85d036f85a62a8ec971b67d45f4 | mythtv/contrib/imports/mirobridge/mirobridge/mirobridge_interpreter_2_5_2.py | python | MiroInterpreter.do_download | (self, line) | download <name> -- Downloads an item by name in the feed/playlist selected. | download <name> -- Downloads an item by name in the feed/playlist selected. | [
"download",
"<name",
">",
"--",
"Downloads",
"an",
"item",
"by",
"name",
"in",
"the",
"feed",
"/",
"playlist",
"selected",
"."
] | def do_download(self, line):
"""download <name> -- Downloads an item by name in the feed/playlist selected."""
if self.selection_type is None:
print "Error: No feed/playlist selected"
return
item = self._find_item(line)
if item is None:
print "No item ... | [
"def",
"do_download",
"(",
"self",
",",
"line",
")",
":",
"if",
"self",
".",
"selection_type",
"is",
"None",
":",
"print",
"\"Error: No feed/playlist selected\"",
"return",
"item",
"=",
"self",
".",
"_find_item",
"(",
"line",
")",
"if",
"item",
"is",
"None",... | https://github.com/MythTV/mythtv/blob/d282a209cb8be85d036f85a62a8ec971b67d45f4/mythtv/contrib/imports/mirobridge/mirobridge/mirobridge_interpreter_2_5_2.py#L616-L630 | ||
wxWidgets/wxPython-Classic | 19571e1ae65f1ac445f5491474121998c97a1bf0 | src/osx_cocoa/html.py | python | HtmlSelection.Set | (*args, **kwargs) | return _html.HtmlSelection_Set(*args, **kwargs) | Set(self, Point fromPos, HtmlCell fromCell, Point toPos, HtmlCell toCell) | Set(self, Point fromPos, HtmlCell fromCell, Point toPos, HtmlCell toCell) | [
"Set",
"(",
"self",
"Point",
"fromPos",
"HtmlCell",
"fromCell",
"Point",
"toPos",
"HtmlCell",
"toCell",
")"
] | def Set(*args, **kwargs):
"""Set(self, Point fromPos, HtmlCell fromCell, Point toPos, HtmlCell toCell)"""
return _html.HtmlSelection_Set(*args, **kwargs) | [
"def",
"Set",
"(",
"*",
"args",
",",
"*",
"*",
"kwargs",
")",
":",
"return",
"_html",
".",
"HtmlSelection_Set",
"(",
"*",
"args",
",",
"*",
"*",
"kwargs",
")"
] | https://github.com/wxWidgets/wxPython-Classic/blob/19571e1ae65f1ac445f5491474121998c97a1bf0/src/osx_cocoa/html.py#L463-L465 | |
mindspore-ai/mindspore | fb8fd3338605bb34fa5cea054e535a8b1d753fab | mindspore/python/mindspore/ops/composite/random_ops.py | python | uniform | (shape, minval, maxval, seed=None, dtype=mstype.float32) | return value | Generates random numbers according to the Uniform random number distribution.
Note:
The number in tensor minval should be strictly less than maxval at any position after broadcasting.
Args:
shape (tuple): The shape of random tensor to be generated.
The format is :math:`(N,*)` where :... | Generates random numbers according to the Uniform random number distribution. | [
"Generates",
"random",
"numbers",
"according",
"to",
"the",
"Uniform",
"random",
"number",
"distribution",
"."
] | def uniform(shape, minval, maxval, seed=None, dtype=mstype.float32):
"""
Generates random numbers according to the Uniform random number distribution.
Note:
The number in tensor minval should be strictly less than maxval at any position after broadcasting.
Args:
shape (tuple): The shap... | [
"def",
"uniform",
"(",
"shape",
",",
"minval",
",",
"maxval",
",",
"seed",
"=",
"None",
",",
"dtype",
"=",
"mstype",
".",
"float32",
")",
":",
"minval_dtype",
"=",
"F",
".",
"dtype",
"(",
"minval",
")",
"maxval_dtype",
"=",
"F",
".",
"dtype",
"(",
... | https://github.com/mindspore-ai/mindspore/blob/fb8fd3338605bb34fa5cea054e535a8b1d753fab/mindspore/python/mindspore/ops/composite/random_ops.py#L135-L205 | |
funnyzhou/Adaptive_Feeding | 9c78182331d8c0ea28de47226e805776c638d46f | lib/fast_rcnn/bbox_transform.py | python | clip_boxes | (boxes, im_shape) | return boxes | Clip boxes to image boundaries. | Clip boxes to image boundaries. | [
"Clip",
"boxes",
"to",
"image",
"boundaries",
"."
] | def clip_boxes(boxes, im_shape):
"""
Clip boxes to image boundaries.
"""
# x1 >= 0
boxes[:, 0::4] = np.maximum(np.minimum(boxes[:, 0::4], im_shape[1] - 1), 0)
# y1 >= 0
boxes[:, 1::4] = np.maximum(np.minimum(boxes[:, 1::4], im_shape[0] - 1), 0)
# x2 < im_shape[1]
boxes[:, 2::4] = np... | [
"def",
"clip_boxes",
"(",
"boxes",
",",
"im_shape",
")",
":",
"# x1 >= 0",
"boxes",
"[",
":",
",",
"0",
":",
":",
"4",
"]",
"=",
"np",
".",
"maximum",
"(",
"np",
".",
"minimum",
"(",
"boxes",
"[",
":",
",",
"0",
":",
":",
"4",
"]",
",",
"im_s... | https://github.com/funnyzhou/Adaptive_Feeding/blob/9c78182331d8c0ea28de47226e805776c638d46f/lib/fast_rcnn/bbox_transform.py#L62-L75 | |
facebook/openr | ed38bdfd6bf290084bfab4821b59f83e7b59315d | openr/py/openr/cli/commands/kvstore.py | python | KvStoreCmdBase.get_node_ip | (self, prefix_db: openr_types.PrefixDatabase) | return None | get routable IP address of node from it's prefix database | get routable IP address of node from it's prefix database | [
"get",
"routable",
"IP",
"address",
"of",
"node",
"from",
"it",
"s",
"prefix",
"database"
] | def get_node_ip(self, prefix_db: openr_types.PrefixDatabase) -> Any:
"""get routable IP address of node from it's prefix database"""
# First look for LOOPBACK prefix
for prefix_entry in prefix_db.prefixEntries:
if prefix_entry.type == network_types.PrefixType.LOOPBACK:
... | [
"def",
"get_node_ip",
"(",
"self",
",",
"prefix_db",
":",
"openr_types",
".",
"PrefixDatabase",
")",
"->",
"Any",
":",
"# First look for LOOPBACK prefix",
"for",
"prefix_entry",
"in",
"prefix_db",
".",
"prefixEntries",
":",
"if",
"prefix_entry",
".",
"type",
"==",... | https://github.com/facebook/openr/blob/ed38bdfd6bf290084bfab4821b59f83e7b59315d/openr/py/openr/cli/commands/kvstore.py#L142-L156 | |
Tencent/Pebble | 68315f176d9e328a233ace29b7579a829f89879f | tools/blade/src/blade/gen_rule_target.py | python | GenRuleTarget.__init__ | (self,
name,
srcs,
deps,
outs,
cmd,
blade,
kwargs) | Init method.
Init the gen rule target. | Init method. | [
"Init",
"method",
"."
] | def __init__(self,
name,
srcs,
deps,
outs,
cmd,
blade,
kwargs):
"""Init method.
Init the gen rule target.
"""
srcs = var_to_list(srcs)
deps = var_to_list(deps)... | [
"def",
"__init__",
"(",
"self",
",",
"name",
",",
"srcs",
",",
"deps",
",",
"outs",
",",
"cmd",
",",
"blade",
",",
"kwargs",
")",
":",
"srcs",
"=",
"var_to_list",
"(",
"srcs",
")",
"deps",
"=",
"var_to_list",
"(",
"deps",
")",
"outs",
"=",
"var_to_... | https://github.com/Tencent/Pebble/blob/68315f176d9e328a233ace29b7579a829f89879f/tools/blade/src/blade/gen_rule_target.py#L23-L49 | ||
ricardoquesada/Spidermonkey | 4a75ea2543408bd1b2c515aa95901523eeef7858 | media/webrtc/trunk/build/android/pylib/android_commands.py | python | AndroidCommands.GetBuildId | (self) | return build_id | Returns the build ID of the system (e.g. JRM79C). | Returns the build ID of the system (e.g. JRM79C). | [
"Returns",
"the",
"build",
"ID",
"of",
"the",
"system",
"(",
"e",
".",
"g",
".",
"JRM79C",
")",
"."
] | def GetBuildId(self):
"""Returns the build ID of the system (e.g. JRM79C)."""
build_id = self.RunShellCommand('getprop ro.build.id')[0]
assert build_id
return build_id | [
"def",
"GetBuildId",
"(",
"self",
")",
":",
"build_id",
"=",
"self",
".",
"RunShellCommand",
"(",
"'getprop ro.build.id'",
")",
"[",
"0",
"]",
"assert",
"build_id",
"return",
"build_id"
] | https://github.com/ricardoquesada/Spidermonkey/blob/4a75ea2543408bd1b2c515aa95901523eeef7858/media/webrtc/trunk/build/android/pylib/android_commands.py#L697-L701 | |
SpenceKonde/megaTinyCore | 1c4a70b18a149fe6bcb551dfa6db11ca50b8997b | megaavr/tools/libs/serial/serialcli.py | python | Serial._update_rts_state | (self) | Set terminal status line: Request To Send | Set terminal status line: Request To Send | [
"Set",
"terminal",
"status",
"line",
":",
"Request",
"To",
"Send"
] | def _update_rts_state(self):
"""Set terminal status line: Request To Send"""
if not self.is_open:
raise portNotOpenError
self._port_handle.RtsEnable = bool(self._rts_state) | [
"def",
"_update_rts_state",
"(",
"self",
")",
":",
"if",
"not",
"self",
".",
"is_open",
":",
"raise",
"portNotOpenError",
"self",
".",
"_port_handle",
".",
"RtsEnable",
"=",
"bool",
"(",
"self",
".",
"_rts_state",
")"
] | https://github.com/SpenceKonde/megaTinyCore/blob/1c4a70b18a149fe6bcb551dfa6db11ca50b8997b/megaavr/tools/libs/serial/serialcli.py#L209-L213 | ||
krishauser/Klampt | 972cc83ea5befac3f653c1ba20f80155768ad519 | Python/python2_version/klampt/plan/motionplanning.py | python | destroy | () | return _motionplanning.destroy() | destroys internal data structures | destroys internal data structures | [
"destroys",
"internal",
"data",
"structures"
] | def destroy():
"""
destroys internal data structures
"""
return _motionplanning.destroy() | [
"def",
"destroy",
"(",
")",
":",
"return",
"_motionplanning",
".",
"destroy",
"(",
")"
] | https://github.com/krishauser/Klampt/blob/972cc83ea5befac3f653c1ba20f80155768ad519/Python/python2_version/klampt/plan/motionplanning.py#L260-L265 | |
wxWidgets/wxPython-Classic | 19571e1ae65f1ac445f5491474121998c97a1bf0 | src/gtk/_misc.py | python | DateTime.Today | (*args, **kwargs) | return _misc_.DateTime_Today(*args, **kwargs) | Today() -> DateTime | Today() -> DateTime | [
"Today",
"()",
"-",
">",
"DateTime"
] | def Today(*args, **kwargs):
"""Today() -> DateTime"""
return _misc_.DateTime_Today(*args, **kwargs) | [
"def",
"Today",
"(",
"*",
"args",
",",
"*",
"*",
"kwargs",
")",
":",
"return",
"_misc_",
".",
"DateTime_Today",
"(",
"*",
"args",
",",
"*",
"*",
"kwargs",
")"
] | https://github.com/wxWidgets/wxPython-Classic/blob/19571e1ae65f1ac445f5491474121998c97a1bf0/src/gtk/_misc.py#L3776-L3778 | |
pyne/pyne | 0c2714d7c0d1b5e20be6ae6527da2c660dd6b1b3 | pyne/ensdf.py | python | _parse_gamma_continuation_record | (g, inten, tti) | return conversions | This parses an ENSDF gamma continuation record | This parses an ENSDF gamma continuation record | [
"This",
"parses",
"an",
"ENSDF",
"gamma",
"continuation",
"record"
] | def _parse_gamma_continuation_record(g, inten, tti):
"""
This parses an ENSDF gamma continuation record
"""
conversions = {}
entries = g.group(2).split('$')
for entry in entries:
entry = entry.replace('AP', '=')
entry = entry.replace('EL1C+EL2C', 'LC')
if '+=' in entry o... | [
"def",
"_parse_gamma_continuation_record",
"(",
"g",
",",
"inten",
",",
"tti",
")",
":",
"conversions",
"=",
"{",
"}",
"entries",
"=",
"g",
".",
"group",
"(",
"2",
")",
".",
"split",
"(",
"'$'",
")",
"for",
"entry",
"in",
"entries",
":",
"entry",
"="... | https://github.com/pyne/pyne/blob/0c2714d7c0d1b5e20be6ae6527da2c660dd6b1b3/pyne/ensdf.py#L297-L335 | |
natanielruiz/android-yolo | 1ebb54f96a67a20ff83ddfc823ed83a13dc3a47f | jni-build/jni/include/tensorflow/contrib/distributions/python/ops/shape.py | python | _ShapeUtil.get_dims | (self, x, sample=True, batch=True, event=True) | return sample_shape + batch_shape + event_shape | Returns subset of tensor's dimension indexes (indexes into shape).
Args:
x: `Tensor`.
sample: `Boolean`. Include sample dimensions or not.
batch: `Boolean`. Include batch dimensions or not.
event: `Boolean`. Include event dimensions or not.
Raises:
ValueError: if `x.get_shape().n... | Returns subset of tensor's dimension indexes (indexes into shape). | [
"Returns",
"subset",
"of",
"tensor",
"s",
"dimension",
"indexes",
"(",
"indexes",
"into",
"shape",
")",
"."
] | def get_dims(self, x, sample=True, batch=True, event=True):
"""Returns subset of tensor's dimension indexes (indexes into shape).
Args:
x: `Tensor`.
sample: `Boolean`. Include sample dimensions or not.
batch: `Boolean`. Include batch dimensions or not.
event: `Boolean`. Include event di... | [
"def",
"get_dims",
"(",
"self",
",",
"x",
",",
"sample",
"=",
"True",
",",
"batch",
"=",
"True",
",",
"event",
"=",
"True",
")",
":",
"ndims",
"=",
"self",
".",
"get_ndims",
"(",
"x",
")",
"if",
"sample",
"and",
"batch",
"and",
"event",
":",
"ret... | https://github.com/natanielruiz/android-yolo/blob/1ebb54f96a67a20ff83ddfc823ed83a13dc3a47f/jni-build/jni/include/tensorflow/contrib/distributions/python/ops/shape.py#L209-L237 | |
Xilinx/Vitis-AI | fc74d404563d9951b57245443c73bef389f3657f | tools/Vitis-AI-Quantizer/vai_q_tensorflow1.x/tensorflow/python/tpu/tensor_tracer_report.py | python | TTReportHandle._write_op_list_section | (self, graph_order) | Writes the Op-list section of the report. | Writes the Op-list section of the report. | [
"Writes",
"the",
"Op",
"-",
"list",
"section",
"of",
"the",
"report",
"."
] | def _write_op_list_section(self, graph_order):
"""Writes the Op-list section of the report."""
self._write_report('%s %s\n'%(_MARKER_SECTION_BEGIN, _SECTION_NAME_OP_LIST))
self._write_report('%s %d\n'%(_FIELD_NAME_NUM_OPS,
len(graph_order.operations)))
for i in range(0... | [
"def",
"_write_op_list_section",
"(",
"self",
",",
"graph_order",
")",
":",
"self",
".",
"_write_report",
"(",
"'%s %s\\n'",
"%",
"(",
"_MARKER_SECTION_BEGIN",
",",
"_SECTION_NAME_OP_LIST",
")",
")",
"self",
".",
"_write_report",
"(",
"'%s %d\\n'",
"%",
"(",
"_F... | https://github.com/Xilinx/Vitis-AI/blob/fc74d404563d9951b57245443c73bef389f3657f/tools/Vitis-AI-Quantizer/vai_q_tensorflow1.x/tensorflow/python/tpu/tensor_tracer_report.py#L345-L361 | ||
aws/lumberyard | f85344403c1c2e77ec8c75deb2c116e97b713217 | dev/Gems/CloudGemMetric/v1/AWS/python/windows/Lib/numba/targets/rangeobj.py | python | range_iter_len | (typingctx, val) | An implementation of len(range_iter) for internal use. | An implementation of len(range_iter) for internal use. | [
"An",
"implementation",
"of",
"len",
"(",
"range_iter",
")",
"for",
"internal",
"use",
"."
] | def range_iter_len(typingctx, val):
"""
An implementation of len(range_iter) for internal use.
"""
if isinstance(val, types.RangeIteratorType):
val_type = val.yield_type
def codegen(context, builder, sig, args):
(value,) = args
iter_type = range_impl_map[val_type]... | [
"def",
"range_iter_len",
"(",
"typingctx",
",",
"val",
")",
":",
"if",
"isinstance",
"(",
"val",
",",
"types",
".",
"RangeIteratorType",
")",
":",
"val_type",
"=",
"val",
".",
"yield_type",
"def",
"codegen",
"(",
"context",
",",
"builder",
",",
"sig",
",... | https://github.com/aws/lumberyard/blob/f85344403c1c2e77ec8c75deb2c116e97b713217/dev/Gems/CloudGemMetric/v1/AWS/python/windows/Lib/numba/targets/rangeobj.py#L183-L214 | ||
aws/lumberyard | f85344403c1c2e77ec8c75deb2c116e97b713217 | dev/Gems/CloudGemMetric/v1/AWS/python/windows/Lib/llvmlite/binding/initfini.py | python | initialize_native_asmprinter | () | Initialize the native ASM printer. | Initialize the native ASM printer. | [
"Initialize",
"the",
"native",
"ASM",
"printer",
"."
] | def initialize_native_asmprinter():
"""
Initialize the native ASM printer.
"""
ffi.lib.LLVMPY_InitializeNativeAsmPrinter() | [
"def",
"initialize_native_asmprinter",
"(",
")",
":",
"ffi",
".",
"lib",
".",
"LLVMPY_InitializeNativeAsmPrinter",
"(",
")"
] | https://github.com/aws/lumberyard/blob/f85344403c1c2e77ec8c75deb2c116e97b713217/dev/Gems/CloudGemMetric/v1/AWS/python/windows/Lib/llvmlite/binding/initfini.py#L39-L43 | ||
catboost/catboost | 167f64f237114a4d10b2b4ee42adb4569137debe | contrib/python/scikit-learn/py2/sklearn/mixture/gaussian_mixture.py | python | _check_precisions | (precisions, covariance_type, n_components, n_features) | return precisions | Validate user provided precisions.
Parameters
----------
precisions : array-like,
'full' : shape of (n_components, n_features, n_features)
'tied' : shape of (n_features, n_features)
'diag' : shape of (n_components, n_features)
'spherical' : shape of (n_components,)
cova... | Validate user provided precisions. | [
"Validate",
"user",
"provided",
"precisions",
"."
] | def _check_precisions(precisions, covariance_type, n_components, n_features):
"""Validate user provided precisions.
Parameters
----------
precisions : array-like,
'full' : shape of (n_components, n_features, n_features)
'tied' : shape of (n_features, n_features)
'diag' : shape o... | [
"def",
"_check_precisions",
"(",
"precisions",
",",
"covariance_type",
",",
"n_components",
",",
"n_features",
")",
":",
"precisions",
"=",
"check_array",
"(",
"precisions",
",",
"dtype",
"=",
"[",
"np",
".",
"float64",
",",
"np",
".",
"float32",
"]",
",",
... | https://github.com/catboost/catboost/blob/167f64f237114a4d10b2b4ee42adb4569137debe/contrib/python/scikit-learn/py2/sklearn/mixture/gaussian_mixture.py#L98-L137 | |
hpi-xnor/BMXNet-v2 | af2b1859eafc5c721b1397cef02f946aaf2ce20d | python/mxnet/module/executor_group.py | python | DataParallelExecutorGroup.forward | (self, data_batch, is_train=None) | Split `data_batch` according to workload and run forward on each devices.
Parameters
----------
data_batch : DataBatch
Or could be any object implementing similar interface.
is_train : bool
The hint for the backend, indicating whether we are during training phase... | Split `data_batch` according to workload and run forward on each devices. | [
"Split",
"data_batch",
"according",
"to",
"workload",
"and",
"run",
"forward",
"on",
"each",
"devices",
"."
] | def forward(self, data_batch, is_train=None):
"""Split `data_batch` according to workload and run forward on each devices.
Parameters
----------
data_batch : DataBatch
Or could be any object implementing similar interface.
is_train : bool
The hint for the... | [
"def",
"forward",
"(",
"self",
",",
"data_batch",
",",
"is_train",
"=",
"None",
")",
":",
"_load_data",
"(",
"data_batch",
",",
"self",
".",
"data_arrays",
",",
"self",
".",
"data_layouts",
")",
"if",
"is_train",
"is",
"None",
":",
"is_train",
"=",
"self... | https://github.com/hpi-xnor/BMXNet-v2/blob/af2b1859eafc5c721b1397cef02f946aaf2ce20d/python/mxnet/module/executor_group.py#L436-L462 | ||
aws/lumberyard | f85344403c1c2e77ec8c75deb2c116e97b713217 | dev/Gems/CloudGemMetric/v1/AWS/python/windows/Lib/numba/ir.py | python | Scope.get | (self, name) | return self.get_exact(name) | Refer to a variable. Returns the latest version. | Refer to a variable. Returns the latest version. | [
"Refer",
"to",
"a",
"variable",
".",
"Returns",
"the",
"latest",
"version",
"."
] | def get(self, name):
"""
Refer to a variable. Returns the latest version.
"""
if name in self.redefined:
name = "%s.%d" % (name, self.redefined[name])
return self.get_exact(name) | [
"def",
"get",
"(",
"self",
",",
"name",
")",
":",
"if",
"name",
"in",
"self",
".",
"redefined",
":",
"name",
"=",
"\"%s.%d\"",
"%",
"(",
"name",
",",
"self",
".",
"redefined",
"[",
"name",
"]",
")",
"return",
"self",
".",
"get_exact",
"(",
"name",
... | https://github.com/aws/lumberyard/blob/f85344403c1c2e77ec8c75deb2c116e97b713217/dev/Gems/CloudGemMetric/v1/AWS/python/windows/Lib/numba/ir.py#L1051-L1057 | |
catboost/catboost | 167f64f237114a4d10b2b4ee42adb4569137debe | contrib/tools/python/src/Lib/cookielib.py | python | CookieJar.make_cookies | (self, response, request) | return cookies | Return sequence of Cookie objects extracted from response object. | Return sequence of Cookie objects extracted from response object. | [
"Return",
"sequence",
"of",
"Cookie",
"objects",
"extracted",
"from",
"response",
"object",
"."
] | def make_cookies(self, response, request):
"""Return sequence of Cookie objects extracted from response object."""
# get cookie-attributes for RFC 2965 and Netscape protocols
headers = response.info()
rfc2965_hdrs = headers.getheaders("Set-Cookie2")
ns_hdrs = headers.getheaders("... | [
"def",
"make_cookies",
"(",
"self",
",",
"response",
",",
"request",
")",
":",
"# get cookie-attributes for RFC 2965 and Netscape protocols",
"headers",
"=",
"response",
".",
"info",
"(",
")",
"rfc2965_hdrs",
"=",
"headers",
".",
"getheaders",
"(",
"\"Set-Cookie2\"",
... | https://github.com/catboost/catboost/blob/167f64f237114a4d10b2b4ee42adb4569137debe/contrib/tools/python/src/Lib/cookielib.py#L1571-L1623 | |
hanpfei/chromium-net | 392cc1fa3a8f92f42e4071ab6e674d8e0482f83f | tools/symsrc/pefile.py | python | PE.set_bytes_at_rva | (self, rva, data) | return self.set_bytes_at_offset(offset, data) | Overwrite, with the given string, the bytes at the file offset corresponding to the given RVA.
Return True if successful, False otherwise. It can fail if the
offset is outside the file's boundaries. | Overwrite, with the given string, the bytes at the file offset corresponding to the given RVA.
Return True if successful, False otherwise. It can fail if the
offset is outside the file's boundaries. | [
"Overwrite",
"with",
"the",
"given",
"string",
"the",
"bytes",
"at",
"the",
"file",
"offset",
"corresponding",
"to",
"the",
"given",
"RVA",
".",
"Return",
"True",
"if",
"successful",
"False",
"otherwise",
".",
"It",
"can",
"fail",
"if",
"the",
"offset",
"i... | def set_bytes_at_rva(self, rva, data):
"""Overwrite, with the given string, the bytes at the file offset corresponding to the given RVA.
Return True if successful, False otherwise. It can fail if the
offset is outside the file's boundaries.
"""
offset = self.get_physica... | [
"def",
"set_bytes_at_rva",
"(",
"self",
",",
"rva",
",",
"data",
")",
":",
"offset",
"=",
"self",
".",
"get_physical_by_rva",
"(",
"rva",
")",
"if",
"not",
"offset",
":",
"raise",
"False",
"return",
"self",
".",
"set_bytes_at_offset",
"(",
"offset",
",",
... | https://github.com/hanpfei/chromium-net/blob/392cc1fa3a8f92f42e4071ab6e674d8e0482f83f/tools/symsrc/pefile.py#L3564-L3575 | |
aws/lumberyard | f85344403c1c2e77ec8c75deb2c116e97b713217 | dev/Tools/Python/3.7.10/windows/Lib/_pydecimal.py | python | Context.Etiny | (self) | return int(self.Emin - self.prec + 1) | Returns Etiny (= Emin - prec + 1) | Returns Etiny (= Emin - prec + 1) | [
"Returns",
"Etiny",
"(",
"=",
"Emin",
"-",
"prec",
"+",
"1",
")"
] | def Etiny(self):
"""Returns Etiny (= Emin - prec + 1)"""
return int(self.Emin - self.prec + 1) | [
"def",
"Etiny",
"(",
"self",
")",
":",
"return",
"int",
"(",
"self",
".",
"Emin",
"-",
"self",
".",
"prec",
"+",
"1",
")"
] | https://github.com/aws/lumberyard/blob/f85344403c1c2e77ec8c75deb2c116e97b713217/dev/Tools/Python/3.7.10/windows/Lib/_pydecimal.py#L4067-L4069 | |
wxWidgets/wxPython-Classic | 19571e1ae65f1ac445f5491474121998c97a1bf0 | src/osx_cocoa/_controls.py | python | ToolBarBase.AddStretchableSpace | (*args, **kwargs) | return _controls_.ToolBarBase_AddStretchableSpace(*args, **kwargs) | AddStretchableSpace(self) -> ToolBarToolBase | AddStretchableSpace(self) -> ToolBarToolBase | [
"AddStretchableSpace",
"(",
"self",
")",
"-",
">",
"ToolBarToolBase"
] | def AddStretchableSpace(*args, **kwargs):
"""AddStretchableSpace(self) -> ToolBarToolBase"""
return _controls_.ToolBarBase_AddStretchableSpace(*args, **kwargs) | [
"def",
"AddStretchableSpace",
"(",
"*",
"args",
",",
"*",
"*",
"kwargs",
")",
":",
"return",
"_controls_",
".",
"ToolBarBase_AddStretchableSpace",
"(",
"*",
"args",
",",
"*",
"*",
"kwargs",
")"
] | https://github.com/wxWidgets/wxPython-Classic/blob/19571e1ae65f1ac445f5491474121998c97a1bf0/src/osx_cocoa/_controls.py#L3763-L3765 | |
catboost/catboost | 167f64f237114a4d10b2b4ee42adb4569137debe | contrib/tools/python/src/Lib/fractions.py | python | Fraction.__rfloordiv__ | (b, a) | a // b | a // b | [
"a",
"//",
"b"
] | def __rfloordiv__(b, a):
"""a // b"""
# Will be math.floor(a / b) in 3.0.
div = a / b
if isinstance(div, Rational):
# trunc(math.floor(div)) doesn't work if the rational is
# more precise than a float because the intermediate
# rounding may cross an in... | [
"def",
"__rfloordiv__",
"(",
"b",
",",
"a",
")",
":",
"# Will be math.floor(a / b) in 3.0.",
"div",
"=",
"a",
"/",
"b",
"if",
"isinstance",
"(",
"div",
",",
"Rational",
")",
":",
"# trunc(math.floor(div)) doesn't work if the rational is",
"# more precise than a float be... | https://github.com/catboost/catboost/blob/167f64f237114a4d10b2b4ee42adb4569137debe/contrib/tools/python/src/Lib/fractions.py#L429-L439 | ||
INK-USC/USC-DS-RelationExtraction | eebcfa7fd2eda5bba92f3ef8158797cdf91e6981 | code/Model/baselines/sentence-level-models/vocab.py | python | Vocab.unmap | (self, idx_list) | return [self.id2word[idx] for idx in idx_list] | Unmap ids back to tokens. | Unmap ids back to tokens. | [
"Unmap",
"ids",
"back",
"to",
"tokens",
"."
] | def unmap(self, idx_list):
"""
Unmap ids back to tokens.
"""
return [self.id2word[idx] for idx in idx_list] | [
"def",
"unmap",
"(",
"self",
",",
"idx_list",
")",
":",
"return",
"[",
"self",
".",
"id2word",
"[",
"idx",
"]",
"for",
"idx",
"in",
"idx_list",
"]"
] | https://github.com/INK-USC/USC-DS-RelationExtraction/blob/eebcfa7fd2eda5bba92f3ef8158797cdf91e6981/code/Model/baselines/sentence-level-models/vocab.py#L93-L97 | |
Xilinx/Vitis-AI | fc74d404563d9951b57245443c73bef389f3657f | tools/Vitis-AI-Quantizer/vai_q_tensorflow1.x/tensorflow/contrib/distributions/python/ops/bijectors/reshape.py | python | Reshape._maybe_check_valid_shape | (self, shape, validate_args) | return assertions | Check that a shape Tensor is int-type and otherwise sane. | Check that a shape Tensor is int-type and otherwise sane. | [
"Check",
"that",
"a",
"shape",
"Tensor",
"is",
"int",
"-",
"type",
"and",
"otherwise",
"sane",
"."
] | def _maybe_check_valid_shape(self, shape, validate_args):
"""Check that a shape Tensor is int-type and otherwise sane."""
if not shape.dtype.is_integer:
raise TypeError("{} dtype ({}) should be `int`-like.".format(
shape, shape.dtype.name))
assertions = []
ndims = array_ops.rank(shape)... | [
"def",
"_maybe_check_valid_shape",
"(",
"self",
",",
"shape",
",",
"validate_args",
")",
":",
"if",
"not",
"shape",
".",
"dtype",
".",
"is_integer",
":",
"raise",
"TypeError",
"(",
"\"{} dtype ({}) should be `int`-like.\"",
".",
"format",
"(",
"shape",
",",
"sha... | https://github.com/Xilinx/Vitis-AI/blob/fc74d404563d9951b57245443c73bef389f3657f/tools/Vitis-AI-Quantizer/vai_q_tensorflow1.x/tensorflow/contrib/distributions/python/ops/bijectors/reshape.py#L164-L206 | |
PX4/PX4-Autopilot | 0b9f60a0370be53d683352c63fd92db3d6586e18 | msg/tools/px_generate_uorb_topic_files.py | python | generate_output_from_file | (format_idx, filename, outputdir, package, templatedir, includepath) | return generate_by_template(output_file, template_file, em_globals) | Converts a single .msg file to an uorb header/source file | Converts a single .msg file to an uorb header/source file | [
"Converts",
"a",
"single",
".",
"msg",
"file",
"to",
"an",
"uorb",
"header",
"/",
"source",
"file"
] | def generate_output_from_file(format_idx, filename, outputdir, package, templatedir, includepath):
"""
Converts a single .msg file to an uorb header/source file
"""
msg_context = genmsg.msg_loader.MsgContext.create_default()
full_type_name = genmsg.gentools.compute_full_type_name(
package, o... | [
"def",
"generate_output_from_file",
"(",
"format_idx",
",",
"filename",
",",
"outputdir",
",",
"package",
",",
"templatedir",
",",
"includepath",
")",
":",
"msg_context",
"=",
"genmsg",
".",
"msg_loader",
".",
"MsgContext",
".",
"create_default",
"(",
")",
"full... | https://github.com/PX4/PX4-Autopilot/blob/0b9f60a0370be53d683352c63fd92db3d6586e18/msg/tools/px_generate_uorb_topic_files.py#L124-L177 | |
miyosuda/TensorFlowAndroidDemo | 35903e0221aa5f109ea2dbef27f20b52e317f42d | jni-build/jni/include/tensorflow/tensorboard/backend/handler.py | python | TensorboardHandler._serve_audio | (self, query_params) | Given a tag and list of runs, serve a list of audio.
Note that the audio clips themselves are not sent; instead, we respond with
URLs to the audio. The frontend should treat these URLs as opaque and should
not try to parse information about them or generate them itself, as the
format may change.
A... | Given a tag and list of runs, serve a list of audio. | [
"Given",
"a",
"tag",
"and",
"list",
"of",
"runs",
"serve",
"a",
"list",
"of",
"audio",
"."
] | def _serve_audio(self, query_params):
"""Given a tag and list of runs, serve a list of audio.
Note that the audio clips themselves are not sent; instead, we respond with
URLs to the audio. The frontend should treat these URLs as opaque and should
not try to parse information about them or generate them... | [
"def",
"_serve_audio",
"(",
"self",
",",
"query_params",
")",
":",
"tag",
"=",
"query_params",
".",
"get",
"(",
"'tag'",
")",
"run",
"=",
"query_params",
".",
"get",
"(",
"'run'",
")",
"audio_list",
"=",
"self",
".",
"_multiplexer",
".",
"Audio",
"(",
... | https://github.com/miyosuda/TensorFlowAndroidDemo/blob/35903e0221aa5f109ea2dbef27f20b52e317f42d/jni-build/jni/include/tensorflow/tensorboard/backend/handler.py#L429-L446 | ||
BitcoinUnlimited/BitcoinUnlimited | 05de381c02eb4bfca94957733acadfa217527f25 | contrib/devtools/benchmark_diff.py | python | BenchmarkFileComparator._common_benches | (self) | return list(self.after_benchmark_names & self.before_benchmark_names) | Returns a list of benchmarks in both files. | Returns a list of benchmarks in both files. | [
"Returns",
"a",
"list",
"of",
"benchmarks",
"in",
"both",
"files",
"."
] | def _common_benches(self):
"""Returns a list of benchmarks in both files."""
return list(self.after_benchmark_names & self.before_benchmark_names) | [
"def",
"_common_benches",
"(",
"self",
")",
":",
"return",
"list",
"(",
"self",
".",
"after_benchmark_names",
"&",
"self",
".",
"before_benchmark_names",
")"
] | https://github.com/BitcoinUnlimited/BitcoinUnlimited/blob/05de381c02eb4bfca94957733acadfa217527f25/contrib/devtools/benchmark_diff.py#L163-L165 | |
Illumina/hap.py | 84011695b2ff2406c16a335106db6831fb67fdfe | src/python/Tools/vcfextract.py | python | field | (val) | return val | extract field into result, guess type | extract field into result, guess type | [
"extract",
"field",
"into",
"result",
"guess",
"type"
] | def field(val):
""" extract field into result, guess type """
if "," in val:
val = map(field, val.split(","))
else:
done = False
try:
val = int(val)
done = True
except:
pass
if done:
return val
try:
... | [
"def",
"field",
"(",
"val",
")",
":",
"if",
"\",\"",
"in",
"val",
":",
"val",
"=",
"map",
"(",
"field",
",",
"val",
".",
"split",
"(",
"\",\"",
")",
")",
"else",
":",
"done",
"=",
"False",
"try",
":",
"val",
"=",
"int",
"(",
"val",
")",
"done... | https://github.com/Illumina/hap.py/blob/84011695b2ff2406c16a335106db6831fb67fdfe/src/python/Tools/vcfextract.py#L22-L40 | |
ApolloAuto/apollo-platform | 86d9dc6743b496ead18d597748ebabd34a513289 | ros/third_party/lib_x86_64/python2.7/dist-packages/numpy/oldnumeric/ma.py | python | MaskedArray._get_imaginary | (self) | Get the imaginary part of a complex array. | Get the imaginary part of a complex array. | [
"Get",
"the",
"imaginary",
"part",
"of",
"a",
"complex",
"array",
"."
] | def _get_imaginary(self):
"Get the imaginary part of a complex array."
if self._mask is nomask:
return masked_array(self._data.imag, mask=nomask,
fill_value = self.fill_value())
else:
return masked_array(self._data.imag, mask=self._mask,
... | [
"def",
"_get_imaginary",
"(",
"self",
")",
":",
"if",
"self",
".",
"_mask",
"is",
"nomask",
":",
"return",
"masked_array",
"(",
"self",
".",
"_data",
".",
"imag",
",",
"mask",
"=",
"nomask",
",",
"fill_value",
"=",
"self",
".",
"fill_value",
"(",
")",
... | https://github.com/ApolloAuto/apollo-platform/blob/86d9dc6743b496ead18d597748ebabd34a513289/ros/third_party/lib_x86_64/python2.7/dist-packages/numpy/oldnumeric/ma.py#L714-L721 | ||
tensorflow/tensorflow | 419e3a6b650ea4bd1b0cba23c4348f8a69f3272e | tensorflow/python/framework/config.py | python | get_memory_info | (device) | return context.context().get_memory_info(device) | Get memory info for the chosen device, as a dict.
This function returns a dict containing information about the device's memory
usage. For example:
>>> if tf.config.list_physical_devices('GPU'):
... # Returns a dict in the form {'current': <current mem usage>,
... # 'peak': <... | Get memory info for the chosen device, as a dict. | [
"Get",
"memory",
"info",
"for",
"the",
"chosen",
"device",
"as",
"a",
"dict",
"."
] | def get_memory_info(device):
"""Get memory info for the chosen device, as a dict.
This function returns a dict containing information about the device's memory
usage. For example:
>>> if tf.config.list_physical_devices('GPU'):
... # Returns a dict in the form {'current': <current mem usage>,
... # ... | [
"def",
"get_memory_info",
"(",
"device",
")",
":",
"return",
"context",
".",
"context",
"(",
")",
".",
"get_memory_info",
"(",
"device",
")"
] | https://github.com/tensorflow/tensorflow/blob/419e3a6b650ea4bd1b0cba23c4348f8a69f3272e/tensorflow/python/framework/config.py#L531-L573 | |
Tencent/TNN | 7acca99f54c55747b415a4c57677403eebc7b706 | third_party/flatbuffers/python/flatbuffers/builder.py | python | Builder.assertNested | (self) | Check that we are in the process of building an object. | Check that we are in the process of building an object. | [
"Check",
"that",
"we",
"are",
"in",
"the",
"process",
"of",
"building",
"an",
"object",
"."
] | def assertNested(self):
"""
Check that we are in the process of building an object.
"""
if not self.nested:
raise IsNotNestedError() | [
"def",
"assertNested",
"(",
"self",
")",
":",
"if",
"not",
"self",
".",
"nested",
":",
"raise",
"IsNotNestedError",
"(",
")"
] | https://github.com/Tencent/TNN/blob/7acca99f54c55747b415a4c57677403eebc7b706/third_party/flatbuffers/python/flatbuffers/builder.py#L478-L484 | ||
wxWidgets/wxPython-Classic | 19571e1ae65f1ac445f5491474121998c97a1bf0 | wx/lib/colourutils.py | python | BestLabelColour | (color, bw=False) | return txt_color | Get the best color to use for the label that will be drawn on
top of the given color.
:param Colour `color`: background color that text will be drawn on
:keyword `bw`: If True, only return black or white | Get the best color to use for the label that will be drawn on
top of the given color.
:param Colour `color`: background color that text will be drawn on
:keyword `bw`: If True, only return black or white | [
"Get",
"the",
"best",
"color",
"to",
"use",
"for",
"the",
"label",
"that",
"will",
"be",
"drawn",
"on",
"top",
"of",
"the",
"given",
"color",
".",
":",
"param",
"Colour",
"color",
":",
"background",
"color",
"that",
"text",
"will",
"be",
"drawn",
"on",... | def BestLabelColour(color, bw=False):
"""
Get the best color to use for the label that will be drawn on
top of the given color.
:param Colour `color`: background color that text will be drawn on
:keyword `bw`: If True, only return black or white
"""
avg = sum(color.Get()) / 3
i... | [
"def",
"BestLabelColour",
"(",
"color",
",",
"bw",
"=",
"False",
")",
":",
"avg",
"=",
"sum",
"(",
"color",
".",
"Get",
"(",
")",
")",
"/",
"3",
"if",
"avg",
">",
"192",
":",
"txt_color",
"=",
"wx",
".",
"BLACK",
"elif",
"avg",
">",
"128",
":",... | https://github.com/wxWidgets/wxPython-Classic/blob/19571e1ae65f1ac445f5491474121998c97a1bf0/wx/lib/colourutils.py#L52-L72 | |
mantidproject/mantid | 03deeb89254ec4289edb8771e0188c2090a02f32 | qt/python/mantidqtinterfaces/mantidqtinterfaces/HFIR_4Circle_Reduction/reduce4circleGUI.py | python | MainWindow.update_peak_added_info | (self, int_msg, int_msg2) | Update the peak-being-added information
:param int_msg:
:param int_msg2:
:return: | Update the peak-being-added information
:param int_msg:
:param int_msg2:
:return: | [
"Update",
"the",
"peak",
"-",
"being",
"-",
"added",
"information",
":",
"param",
"int_msg",
":",
":",
"param",
"int_msg2",
":",
":",
"return",
":"
] | def update_peak_added_info(self, int_msg, int_msg2):
"""
Update the peak-being-added information
:param int_msg:
:param int_msg2:
:return:
"""
# get parameters passed
exp_number = int_msg
scan_number = int_msg2
# get PeakInfo
peak_... | [
"def",
"update_peak_added_info",
"(",
"self",
",",
"int_msg",
",",
"int_msg2",
")",
":",
"# get parameters passed",
"exp_number",
"=",
"int_msg",
"scan_number",
"=",
"int_msg2",
"# get PeakInfo",
"peak_info",
"=",
"self",
".",
"_myControl",
".",
"get_peak_info",
"("... | https://github.com/mantidproject/mantid/blob/03deeb89254ec4289edb8771e0188c2090a02f32/qt/python/mantidqtinterfaces/mantidqtinterfaces/HFIR_4Circle_Reduction/reduce4circleGUI.py#L4164-L4180 | ||
wxWidgets/wxPython-Classic | 19571e1ae65f1ac445f5491474121998c97a1bf0 | src/osx_carbon/propgrid.py | python | PropertyGridInterface_InitAllTypeHandlers | (*args) | return _propgrid.PropertyGridInterface_InitAllTypeHandlers(*args) | PropertyGridInterface_InitAllTypeHandlers() | PropertyGridInterface_InitAllTypeHandlers() | [
"PropertyGridInterface_InitAllTypeHandlers",
"()"
] | def PropertyGridInterface_InitAllTypeHandlers(*args):
"""PropertyGridInterface_InitAllTypeHandlers()"""
return _propgrid.PropertyGridInterface_InitAllTypeHandlers(*args) | [
"def",
"PropertyGridInterface_InitAllTypeHandlers",
"(",
"*",
"args",
")",
":",
"return",
"_propgrid",
".",
"PropertyGridInterface_InitAllTypeHandlers",
"(",
"*",
"args",
")"
] | https://github.com/wxWidgets/wxPython-Classic/blob/19571e1ae65f1ac445f5491474121998c97a1bf0/src/osx_carbon/propgrid.py#L1803-L1805 | |
Caffe-MPI/Caffe-MPI.github.io | df5992af571a2a19981b69635115c393f18d1c76 | python/caffe/io.py | python | array_to_blobproto | (arr, diff=None) | return blob | Converts a N-dimensional array to blob proto. If diff is given, also
convert the diff. You need to make sure that arr and diff have the same
shape, and this function does not do sanity check. | Converts a N-dimensional array to blob proto. If diff is given, also
convert the diff. You need to make sure that arr and diff have the same
shape, and this function does not do sanity check. | [
"Converts",
"a",
"N",
"-",
"dimensional",
"array",
"to",
"blob",
"proto",
".",
"If",
"diff",
"is",
"given",
"also",
"convert",
"the",
"diff",
".",
"You",
"need",
"to",
"make",
"sure",
"that",
"arr",
"and",
"diff",
"have",
"the",
"same",
"shape",
"and",... | def array_to_blobproto(arr, diff=None):
"""Converts a N-dimensional array to blob proto. If diff is given, also
convert the diff. You need to make sure that arr and diff have the same
shape, and this function does not do sanity check.
"""
blob = caffe_pb2.BlobProto()
blob.shape.dim.extend(arr.sh... | [
"def",
"array_to_blobproto",
"(",
"arr",
",",
"diff",
"=",
"None",
")",
":",
"blob",
"=",
"caffe_pb2",
".",
"BlobProto",
"(",
")",
"blob",
".",
"shape",
".",
"dim",
".",
"extend",
"(",
"arr",
".",
"shape",
")",
"blob",
".",
"data",
".",
"extend",
"... | https://github.com/Caffe-MPI/Caffe-MPI.github.io/blob/df5992af571a2a19981b69635115c393f18d1c76/python/caffe/io.py#L36-L46 | |
potassco/clingo | e0c91d8f95cc28de1c480a871f9c97c30de83d40 | libpyclingo/clingo/solving.py | python | SolveControl.symbolic_atoms | (self) | return SymbolicAtoms(atoms) | `clingo.symbolic_atoms.SymbolicAtoms` object to inspect the symbolic atoms. | `clingo.symbolic_atoms.SymbolicAtoms` object to inspect the symbolic atoms. | [
"clingo",
".",
"symbolic_atoms",
".",
"SymbolicAtoms",
"object",
"to",
"inspect",
"the",
"symbolic",
"atoms",
"."
] | def symbolic_atoms(self) -> SymbolicAtoms:
'''
`clingo.symbolic_atoms.SymbolicAtoms` object to inspect the symbolic atoms.
'''
atoms = _c_call('clingo_symbolic_atoms_t*', _lib.clingo_solve_control_symbolic_atoms, self._rep)
return SymbolicAtoms(atoms) | [
"def",
"symbolic_atoms",
"(",
"self",
")",
"->",
"SymbolicAtoms",
":",
"atoms",
"=",
"_c_call",
"(",
"'clingo_symbolic_atoms_t*'",
",",
"_lib",
".",
"clingo_solve_control_symbolic_atoms",
",",
"self",
".",
"_rep",
")",
"return",
"SymbolicAtoms",
"(",
"atoms",
")"
... | https://github.com/potassco/clingo/blob/e0c91d8f95cc28de1c480a871f9c97c30de83d40/libpyclingo/clingo/solving.py#L199-L204 | |
windystrife/UnrealEngine_NVIDIAGameWorks | b50e6338a7c5b26374d66306ebc7807541ff815e | Engine/Extras/ThirdPartyNotUE/emsdk/Win64/python/2.7.5.3_64bit/Lib/distutils/dep_util.py | python | newer_pairwise | (sources, targets) | return n_sources, n_targets | Walk two filename lists in parallel, testing if each source is newer
than its corresponding target. Return a pair of lists (sources,
targets) where source is newer than target, according to the semantics
of 'newer()'. | Walk two filename lists in parallel, testing if each source is newer
than its corresponding target. Return a pair of lists (sources,
targets) where source is newer than target, according to the semantics
of 'newer()'. | [
"Walk",
"two",
"filename",
"lists",
"in",
"parallel",
"testing",
"if",
"each",
"source",
"is",
"newer",
"than",
"its",
"corresponding",
"target",
".",
"Return",
"a",
"pair",
"of",
"lists",
"(",
"sources",
"targets",
")",
"where",
"source",
"is",
"newer",
"... | def newer_pairwise(sources, targets):
"""Walk two filename lists in parallel, testing if each source is newer
than its corresponding target. Return a pair of lists (sources,
targets) where source is newer than target, according to the semantics
of 'newer()'.
"""
if len(sources) != len(targets):... | [
"def",
"newer_pairwise",
"(",
"sources",
",",
"targets",
")",
":",
"if",
"len",
"(",
"sources",
")",
"!=",
"len",
"(",
"targets",
")",
":",
"raise",
"ValueError",
",",
"\"'sources' and 'targets' must be same length\"",
"# build a pair of lists (sources, targets) where ... | https://github.com/windystrife/UnrealEngine_NVIDIAGameWorks/blob/b50e6338a7c5b26374d66306ebc7807541ff815e/Engine/Extras/ThirdPartyNotUE/emsdk/Win64/python/2.7.5.3_64bit/Lib/distutils/dep_util.py#L33-L50 | |
flexflow/FlexFlow | 581fad8ba8d10a16a3102ee2b406b0319586df24 | examples/python/keras/candle_uno/default_utils.py | python | Benchmark.set_locals | (self) | Functionality to set variables specific for the benchmark
- required: set of required parameters for the benchmark.
- additional_definitions: list of dictionaries describing \
the additional parameters for the benchmark. | Functionality to set variables specific for the benchmark
- required: set of required parameters for the benchmark.
- additional_definitions: list of dictionaries describing \
the additional parameters for the benchmark. | [
"Functionality",
"to",
"set",
"variables",
"specific",
"for",
"the",
"benchmark",
"-",
"required",
":",
"set",
"of",
"required",
"parameters",
"for",
"the",
"benchmark",
".",
"-",
"additional_definitions",
":",
"list",
"of",
"dictionaries",
"describing",
"\\",
"... | def set_locals(self):
""" Functionality to set variables specific for the benchmark
- required: set of required parameters for the benchmark.
- additional_definitions: list of dictionaries describing \
the additional parameters for the benchmark.
"""
pass | [
"def",
"set_locals",
"(",
"self",
")",
":",
"pass"
] | https://github.com/flexflow/FlexFlow/blob/581fad8ba8d10a16a3102ee2b406b0319586df24/examples/python/keras/candle_uno/default_utils.py#L962-L969 | ||
glinscott/leela-chess | 481f1de6c0d2ad7f4e27df551ac5fc754e684f69 | scripts/stats/netstats.py | python | plot_stats | (stats, name, cfg) | Plots various chess statistics | Plots various chess statistics | [
"Plots",
"various",
"chess",
"statistics"
] | def plot_stats(stats, name, cfg):
"""
Plots various chess statistics
"""
types = ['o', '.', '^', 'v', '+', 'x']
colors = ['w', 'k', 'b', 'g', 'm', 'r']
edges = ['k', 'k', 'b', 'g', 'm', 'r']
w = np.sum(stats['white'])
b = np.sum(stats['black'])
d = np.sum(stats['draw'])
t = w +... | [
"def",
"plot_stats",
"(",
"stats",
",",
"name",
",",
"cfg",
")",
":",
"types",
"=",
"[",
"'o'",
",",
"'.'",
",",
"'^'",
",",
"'v'",
",",
"'+'",
",",
"'x'",
"]",
"colors",
"=",
"[",
"'w'",
",",
"'k'",
",",
"'b'",
",",
"'g'",
",",
"'m'",
",",
... | https://github.com/glinscott/leela-chess/blob/481f1de6c0d2ad7f4e27df551ac5fc754e684f69/scripts/stats/netstats.py#L47-L77 | ||
apple/swift-lldb | d74be846ef3e62de946df343e8c234bde93a8912 | third_party/Python/module/pexpect-4.6/pexpect/screen.py | python | screen.erase_up | (self) | Erases the screen from the current line up to the top of the
screen. | Erases the screen from the current line up to the top of the
screen. | [
"Erases",
"the",
"screen",
"from",
"the",
"current",
"line",
"up",
"to",
"the",
"top",
"of",
"the",
"screen",
"."
] | def erase_up (self): # <ESC>[1J
'''Erases the screen from the current line up to the top of the
screen.'''
self.erase_start_of_line ()
self.fill_region (self.cur_r-1, 1, 1, self.cols) | [
"def",
"erase_up",
"(",
"self",
")",
":",
"# <ESC>[1J",
"self",
".",
"erase_start_of_line",
"(",
")",
"self",
".",
"fill_region",
"(",
"self",
".",
"cur_r",
"-",
"1",
",",
"1",
",",
"1",
",",
"self",
".",
"cols",
")"
] | https://github.com/apple/swift-lldb/blob/d74be846ef3e62de946df343e8c234bde93a8912/third_party/Python/module/pexpect-4.6/pexpect/screen.py#L400-L405 | ||
wlanjie/AndroidFFmpeg | 7baf9122f4b8e1c74e7baf4be5c422c7a5ba5aaf | tools/fdk-aac-build/x86/toolchain/lib/python2.7/lib-tk/Tkinter.py | python | Image.configure | (self, **kw) | Configure the image. | Configure the image. | [
"Configure",
"the",
"image",
"."
] | def configure(self, **kw):
"""Configure the image."""
res = ()
for k, v in _cnfmerge(kw).items():
if v is not None:
if k[-1] == '_': k = k[:-1]
if hasattr(v, '__call__'):
v = self._register(v)
res = res + ('-'+k, v)
... | [
"def",
"configure",
"(",
"self",
",",
"*",
"*",
"kw",
")",
":",
"res",
"=",
"(",
")",
"for",
"k",
",",
"v",
"in",
"_cnfmerge",
"(",
"kw",
")",
".",
"items",
"(",
")",
":",
"if",
"v",
"is",
"not",
"None",
":",
"if",
"k",
"[",
"-",
"1",
"]"... | https://github.com/wlanjie/AndroidFFmpeg/blob/7baf9122f4b8e1c74e7baf4be5c422c7a5ba5aaf/tools/fdk-aac-build/x86/toolchain/lib/python2.7/lib-tk/Tkinter.py#L3276-L3285 | ||
windystrife/UnrealEngine_NVIDIAGameWorks | b50e6338a7c5b26374d66306ebc7807541ff815e | Engine/Extras/ThirdPartyNotUE/emsdk/Win64/python/2.7.5.3_64bit/Lib/mailcap.py | python | findmatch | (caps, MIMEtype, key='view', filename="/dev/null", plist=[]) | return None, None | Find a match for a mailcap entry.
Return a tuple containing the command line, and the mailcap entry
used; (None, None) if no match is found. This may invoke the
'test' command of several matching entries before deciding which
entry to use. | Find a match for a mailcap entry. | [
"Find",
"a",
"match",
"for",
"a",
"mailcap",
"entry",
"."
] | def findmatch(caps, MIMEtype, key='view', filename="/dev/null", plist=[]):
"""Find a match for a mailcap entry.
Return a tuple containing the command line, and the mailcap entry
used; (None, None) if no match is found. This may invoke the
'test' command of several matching entries before deciding whic... | [
"def",
"findmatch",
"(",
"caps",
",",
"MIMEtype",
",",
"key",
"=",
"'view'",
",",
"filename",
"=",
"\"/dev/null\"",
",",
"plist",
"=",
"[",
"]",
")",
":",
"entries",
"=",
"lookup",
"(",
"caps",
",",
"MIMEtype",
",",
"key",
")",
"# XXX This code should so... | https://github.com/windystrife/UnrealEngine_NVIDIAGameWorks/blob/b50e6338a7c5b26374d66306ebc7807541ff815e/Engine/Extras/ThirdPartyNotUE/emsdk/Win64/python/2.7.5.3_64bit/Lib/mailcap.py#L138-L156 | |
apiaryio/drafter | 4634ebd07f6c6f257cc656598ccd535492fdfb55 | tools/gyp/pylib/gyp/generator/make.py | python | MakefileWriter.WriteAndroidNdkModuleRule | (self, module_name, all_sources, link_deps) | Write a set of LOCAL_XXX definitions for Android NDK.
These variable definitions will be used by Android NDK but do nothing for
non-Android applications.
Arguments:
module_name: Android NDK module name, which must be unique among all
module names.
all_sources: A list of source files ... | Write a set of LOCAL_XXX definitions for Android NDK. | [
"Write",
"a",
"set",
"of",
"LOCAL_XXX",
"definitions",
"for",
"Android",
"NDK",
"."
] | def WriteAndroidNdkModuleRule(self, module_name, all_sources, link_deps):
"""Write a set of LOCAL_XXX definitions for Android NDK.
These variable definitions will be used by Android NDK but do nothing for
non-Android applications.
Arguments:
module_name: Android NDK module name, which must be un... | [
"def",
"WriteAndroidNdkModuleRule",
"(",
"self",
",",
"module_name",
",",
"all_sources",
",",
"link_deps",
")",
":",
"if",
"self",
".",
"type",
"not",
"in",
"(",
"'executable'",
",",
"'shared_library'",
",",
"'static_library'",
")",
":",
"return",
"self",
".",... | https://github.com/apiaryio/drafter/blob/4634ebd07f6c6f257cc656598ccd535492fdfb55/tools/gyp/pylib/gyp/generator/make.py#L1760-L1840 | ||
hpi-xnor/BMXNet-v2 | af2b1859eafc5c721b1397cef02f946aaf2ce20d | python/mxnet/ndarray/ndarray.py | python | NDArray._set_nd_advanced_indexing | (self, key, value) | This function is called by __setitem__ when key is an advanced index. | This function is called by __setitem__ when key is an advanced index. | [
"This",
"function",
"is",
"called",
"by",
"__setitem__",
"when",
"key",
"is",
"an",
"advanced",
"index",
"."
] | def _set_nd_advanced_indexing(self, key, value):
"""This function is called by __setitem__ when key is an advanced index."""
indices = self._get_index_nd(key)
vshape = _get_oshape_of_gather_nd_op(self.shape, indices.shape)
value_nd = self._prepare_value_nd(value, vshape)
_interna... | [
"def",
"_set_nd_advanced_indexing",
"(",
"self",
",",
"key",
",",
"value",
")",
":",
"indices",
"=",
"self",
".",
"_get_index_nd",
"(",
"key",
")",
"vshape",
"=",
"_get_oshape_of_gather_nd_op",
"(",
"self",
".",
"shape",
",",
"indices",
".",
"shape",
")",
... | https://github.com/hpi-xnor/BMXNet-v2/blob/af2b1859eafc5c721b1397cef02f946aaf2ce20d/python/mxnet/ndarray/ndarray.py#L768-L774 | ||
rdkit/rdkit | ede860ae316d12d8568daf5ee800921c3389c84e | rdkit/utils/chemdraw.py | python | OptimizeSDFile | (inFileName, outFileName, problemFileName='problems.sdf', restartEvery=20) | optimizes the structure of every molecule in the input SD file
**Arguments**
- inFileName: name of the input SD file
- outFileName: name of the output SD file
- problemFileName: (optional) name of the SD file used to store molecules which
fail during the optimization process
- r... | optimizes the structure of every molecule in the input SD file | [
"optimizes",
"the",
"structure",
"of",
"every",
"molecule",
"in",
"the",
"input",
"SD",
"file"
] | def OptimizeSDFile(inFileName, outFileName, problemFileName='problems.sdf', restartEvery=20):
""" optimizes the structure of every molecule in the input SD file
**Arguments**
- inFileName: name of the input SD file
- outFileName: name of the output SD file
- problemFileName: (optional) name... | [
"def",
"OptimizeSDFile",
"(",
"inFileName",
",",
"outFileName",
",",
"problemFileName",
"=",
"'problems.sdf'",
",",
"restartEvery",
"=",
"20",
")",
":",
"inFile",
"=",
"open",
"(",
"inFileName",
",",
"'r'",
")",
"outFile",
"=",
"open",
"(",
"outFileName",
",... | https://github.com/rdkit/rdkit/blob/ede860ae316d12d8568daf5ee800921c3389c84e/rdkit/utils/chemdraw.py#L360-L428 | ||
SFTtech/openage | d6a08c53c48dc1e157807471df92197f6ca9e04d | openage/convert/processor/conversion/aoc/upgrade_ability_subprocessor.py | python | AoCUpgradeAbilitySubprocessor.turn_ability | (converter_group, line, container_obj_ref, diff=None) | return patches | Creates a patch for the Turn ability of a line.
:param converter_group: Group that gets the patch.
:type converter_group: ...dataformat.converter_object.ConverterObjectGroup
:param line: Unit/Building line that has the ability.
:type line: ...dataformat.converter_object.ConverterObjectG... | Creates a patch for the Turn ability of a line. | [
"Creates",
"a",
"patch",
"for",
"the",
"Turn",
"ability",
"of",
"a",
"line",
"."
] | def turn_ability(converter_group, line, container_obj_ref, diff=None):
"""
Creates a patch for the Turn ability of a line.
:param converter_group: Group that gets the patch.
:type converter_group: ...dataformat.converter_object.ConverterObjectGroup
:param line: Unit/Building lin... | [
"def",
"turn_ability",
"(",
"converter_group",
",",
"line",
",",
"container_obj_ref",
",",
"diff",
"=",
"None",
")",
":",
"head_unit_id",
"=",
"line",
".",
"get_head_unit_id",
"(",
")",
"tech_id",
"=",
"converter_group",
".",
"get_id",
"(",
")",
"dataset",
"... | https://github.com/SFTtech/openage/blob/d6a08c53c48dc1e157807471df92197f6ca9e04d/openage/convert/processor/conversion/aoc/upgrade_ability_subprocessor.py#L1682-L1774 | |
Xilinx/Vitis-AI | fc74d404563d9951b57245443c73bef389f3657f | tools/Vitis-AI-Quantizer/vai_q_tensorflow1.x/tensorflow/python/ops/array_ops.py | python | matrix_diag | (diagonal,
name="diag",
k=0,
num_rows=-1,
num_cols=-1,
padding_value=0) | return gen_array_ops.matrix_diag(diagonal=diagonal, name=name) | Returns a batched diagonal tensor with given batched diagonal values.
Returns a tensor with the contents in `diagonal` as `k[0]`-th to `k[1]`-th
diagonals of a matrix, with everything else padded with `padding`. `num_rows`
and `num_cols` specify the dimension of the innermost matrix of the output. If
both are ... | Returns a batched diagonal tensor with given batched diagonal values. | [
"Returns",
"a",
"batched",
"diagonal",
"tensor",
"with",
"given",
"batched",
"diagonal",
"values",
"."
] | def matrix_diag(diagonal,
name="diag",
k=0,
num_rows=-1,
num_cols=-1,
padding_value=0):
"""Returns a batched diagonal tensor with given batched diagonal values.
Returns a tensor with the contents in `diagonal` as `k[0]`-th to `k[1]`-th... | [
"def",
"matrix_diag",
"(",
"diagonal",
",",
"name",
"=",
"\"diag\"",
",",
"k",
"=",
"0",
",",
"num_rows",
"=",
"-",
"1",
",",
"num_cols",
"=",
"-",
"1",
",",
"padding_value",
"=",
"0",
")",
":",
"# LINT.IfChange",
"if",
"compat",
".",
"forward_compatib... | https://github.com/Xilinx/Vitis-AI/blob/fc74d404563d9951b57245443c73bef389f3657f/tools/Vitis-AI-Quantizer/vai_q_tensorflow1.x/tensorflow/python/ops/array_ops.py#L1946-L2078 | |
catboost/catboost | 167f64f237114a4d10b2b4ee42adb4569137debe | contrib/python/joblib/joblib/externals/cloudpickle/cloudpickle_fast.py | python | _class_reduce | (obj) | return NotImplemented | Select the reducer depending on the dynamic nature of the class obj | Select the reducer depending on the dynamic nature of the class obj | [
"Select",
"the",
"reducer",
"depending",
"on",
"the",
"dynamic",
"nature",
"of",
"the",
"class",
"obj"
] | def _class_reduce(obj):
"""Select the reducer depending on the dynamic nature of the class obj"""
if obj is type(None): # noqa
return type, (None,)
elif obj is type(Ellipsis):
return type, (Ellipsis,)
elif obj is type(NotImplemented):
return type, (NotImplemented,)
elif obj ... | [
"def",
"_class_reduce",
"(",
"obj",
")",
":",
"if",
"obj",
"is",
"type",
"(",
"None",
")",
":",
"# noqa",
"return",
"type",
",",
"(",
"None",
",",
")",
"elif",
"obj",
"is",
"type",
"(",
"Ellipsis",
")",
":",
"return",
"type",
",",
"(",
"Ellipsis",
... | https://github.com/catboost/catboost/blob/167f64f237114a4d10b2b4ee42adb4569137debe/contrib/python/joblib/joblib/externals/cloudpickle/cloudpickle_fast.py#L407-L419 | |
aws/lumberyard | f85344403c1c2e77ec8c75deb2c116e97b713217 | dev/Tools/Python/3.7.10/linux_x64/lib/python3.7/logging/handlers.py | python | SysLogHandler.mapPriority | (self, levelName) | return self.priority_map.get(levelName, "warning") | Map a logging level name to a key in the priority_names map.
This is useful in two scenarios: when custom levels are being
used, and in the case where you can't do a straightforward
mapping by lowercasing the logging level name because of locale-
specific issues (see SF #1524081). | Map a logging level name to a key in the priority_names map.
This is useful in two scenarios: when custom levels are being
used, and in the case where you can't do a straightforward
mapping by lowercasing the logging level name because of locale-
specific issues (see SF #1524081). | [
"Map",
"a",
"logging",
"level",
"name",
"to",
"a",
"key",
"in",
"the",
"priority_names",
"map",
".",
"This",
"is",
"useful",
"in",
"two",
"scenarios",
":",
"when",
"custom",
"levels",
"are",
"being",
"used",
"and",
"in",
"the",
"case",
"where",
"you",
... | def mapPriority(self, levelName):
"""
Map a logging level name to a key in the priority_names map.
This is useful in two scenarios: when custom levels are being
used, and in the case where you can't do a straightforward
mapping by lowercasing the logging level name because of loc... | [
"def",
"mapPriority",
"(",
"self",
",",
"levelName",
")",
":",
"return",
"self",
".",
"priority_map",
".",
"get",
"(",
"levelName",
",",
"\"warning\"",
")"
] | https://github.com/aws/lumberyard/blob/f85344403c1c2e77ec8c75deb2c116e97b713217/dev/Tools/Python/3.7.10/linux_x64/lib/python3.7/logging/handlers.py#L897-L905 | |
PlatformLab/Arachne | e67391471007174dd4002dc2c160628e19c284e8 | scripts/cpplint.py | python | NestingState.InClassDeclaration | (self) | return self.stack and isinstance(self.stack[-1], _ClassInfo) | Check if we are currently one level inside a class or struct declaration.
Returns:
True if top of the stack is a class/struct, False otherwise. | Check if we are currently one level inside a class or struct declaration. | [
"Check",
"if",
"we",
"are",
"currently",
"one",
"level",
"inside",
"a",
"class",
"or",
"struct",
"declaration",
"."
] | def InClassDeclaration(self):
"""Check if we are currently one level inside a class or struct declaration.
Returns:
True if top of the stack is a class/struct, False otherwise.
"""
return self.stack and isinstance(self.stack[-1], _ClassInfo) | [
"def",
"InClassDeclaration",
"(",
"self",
")",
":",
"return",
"self",
".",
"stack",
"and",
"isinstance",
"(",
"self",
".",
"stack",
"[",
"-",
"1",
"]",
",",
"_ClassInfo",
")"
] | https://github.com/PlatformLab/Arachne/blob/e67391471007174dd4002dc2c160628e19c284e8/scripts/cpplint.py#L2320-L2326 | |
wxWidgets/wxPython-Classic | 19571e1ae65f1ac445f5491474121998c97a1bf0 | src/gtk/stc.py | python | StyledTextCtrl.BraceHighlight | (*args, **kwargs) | return _stc.StyledTextCtrl_BraceHighlight(*args, **kwargs) | BraceHighlight(self, int pos1, int pos2)
Highlight the characters at two positions. | BraceHighlight(self, int pos1, int pos2) | [
"BraceHighlight",
"(",
"self",
"int",
"pos1",
"int",
"pos2",
")"
] | def BraceHighlight(*args, **kwargs):
"""
BraceHighlight(self, int pos1, int pos2)
Highlight the characters at two positions.
"""
return _stc.StyledTextCtrl_BraceHighlight(*args, **kwargs) | [
"def",
"BraceHighlight",
"(",
"*",
"args",
",",
"*",
"*",
"kwargs",
")",
":",
"return",
"_stc",
".",
"StyledTextCtrl_BraceHighlight",
"(",
"*",
"args",
",",
"*",
"*",
"kwargs",
")"
] | https://github.com/wxWidgets/wxPython-Classic/blob/19571e1ae65f1ac445f5491474121998c97a1bf0/src/gtk/stc.py#L4799-L4805 | |
krishauser/Klampt | 972cc83ea5befac3f653c1ba20f80155768ad519 | Python/python2_version/klampt/vis/editors.py | python | VisualEditorBase.updateValueFromGui | (self) | return | Called the value is requested (from Save... and OK) | Called the value is requested (from Save... and OK) | [
"Called",
"the",
"value",
"is",
"requested",
"(",
"from",
"Save",
"...",
"and",
"OK",
")"
] | def updateValueFromGui(self):
"""Called the value is requested (from Save... and OK)"""
return | [
"def",
"updateValueFromGui",
"(",
"self",
")",
":",
"return"
] | https://github.com/krishauser/Klampt/blob/972cc83ea5befac3f653c1ba20f80155768ad519/Python/python2_version/klampt/vis/editors.py#L47-L49 | |
wxWidgets/wxPython-Classic | 19571e1ae65f1ac445f5491474121998c97a1bf0 | src/osx_carbon/propgrid.py | python | PyFileDialogAdapter.__init__ | (self, *args, **kwargs) | __init__(self) -> PyFileDialogAdapter | __init__(self) -> PyFileDialogAdapter | [
"__init__",
"(",
"self",
")",
"-",
">",
"PyFileDialogAdapter"
] | def __init__(self, *args, **kwargs):
"""__init__(self) -> PyFileDialogAdapter"""
_propgrid.PyFileDialogAdapter_swiginit(self,_propgrid.new_PyFileDialogAdapter(*args, **kwargs))
self._SetSelf(self); self._RegisterMethods() | [
"def",
"__init__",
"(",
"self",
",",
"*",
"args",
",",
"*",
"*",
"kwargs",
")",
":",
"_propgrid",
".",
"PyFileDialogAdapter_swiginit",
"(",
"self",
",",
"_propgrid",
".",
"new_PyFileDialogAdapter",
"(",
"*",
"args",
",",
"*",
"*",
"kwargs",
")",
")",
"se... | https://github.com/wxWidgets/wxPython-Classic/blob/19571e1ae65f1ac445f5491474121998c97a1bf0/src/osx_carbon/propgrid.py#L3987-L3990 | ||
aws/lumberyard | f85344403c1c2e77ec8c75deb2c116e97b713217 | dev/Tools/Python/3.7.10/mac/Python.framework/Versions/3.7/lib/python3.7/collections/__init__.py | python | _count_elements | (mapping, iterable) | Tally elements from the iterable. | Tally elements from the iterable. | [
"Tally",
"elements",
"from",
"the",
"iterable",
"."
] | def _count_elements(mapping, iterable):
'Tally elements from the iterable.'
mapping_get = mapping.get
for elem in iterable:
mapping[elem] = mapping_get(elem, 0) + 1 | [
"def",
"_count_elements",
"(",
"mapping",
",",
"iterable",
")",
":",
"mapping_get",
"=",
"mapping",
".",
"get",
"for",
"elem",
"in",
"iterable",
":",
"mapping",
"[",
"elem",
"]",
"=",
"mapping_get",
"(",
"elem",
",",
"0",
")",
"+",
"1"
] | https://github.com/aws/lumberyard/blob/f85344403c1c2e77ec8c75deb2c116e97b713217/dev/Tools/Python/3.7.10/mac/Python.framework/Versions/3.7/lib/python3.7/collections/__init__.py#L488-L492 | ||
envoyproxy/envoy | 65541accdafe255e72310b4298d646e091da2d80 | tools/api_proto_plugin/annotations.py | python | xform_annotation | (s, annotation_xforms) | return xformed | Return transformed string with annotation transformers.
The annotation will be replaced with the new value returned by the transformer.
If the transformer returns None, then the annotation will be removed.
If the annotation presented in transformers doesn't exist in the original string,
a new annotatio... | Return transformed string with annotation transformers. | [
"Return",
"transformed",
"string",
"with",
"annotation",
"transformers",
"."
] | def xform_annotation(s, annotation_xforms):
"""Return transformed string with annotation transformers.
The annotation will be replaced with the new value returned by the transformer.
If the transformer returns None, then the annotation will be removed.
If the annotation presented in transformers doesn'... | [
"def",
"xform_annotation",
"(",
"s",
",",
"annotation_xforms",
")",
":",
"present_annotations",
"=",
"set",
"(",
")",
"def",
"xform",
"(",
"match",
")",
":",
"annotation",
",",
"content",
",",
"trailing",
"=",
"match",
".",
"groups",
"(",
")",
"present_ann... | https://github.com/envoyproxy/envoy/blob/65541accdafe255e72310b4298d646e091da2d80/tools/api_proto_plugin/annotations.py#L80-L115 | |
ricardoquesada/Spidermonkey | 4a75ea2543408bd1b2c515aa95901523eeef7858 | dom/bindings/parser/WebIDL.py | python | Parser.p_UnionMemberType | (self, p) | UnionMemberType : UnionType TypeSuffix
| UnionMemberTypeArrayOfAny TypeSuffix | UnionMemberType : UnionType TypeSuffix
| UnionMemberTypeArrayOfAny TypeSuffix | [
"UnionMemberType",
":",
"UnionType",
"TypeSuffix",
"|",
"UnionMemberTypeArrayOfAny",
"TypeSuffix"
] | def p_UnionMemberType(self, p):
"""
UnionMemberType : UnionType TypeSuffix
| UnionMemberTypeArrayOfAny TypeSuffix
"""
p[0] = self.handleModifiers(p[1], p[2]) | [
"def",
"p_UnionMemberType",
"(",
"self",
",",
"p",
")",
":",
"p",
"[",
"0",
"]",
"=",
"self",
".",
"handleModifiers",
"(",
"p",
"[",
"1",
"]",
",",
"p",
"[",
"2",
"]",
")"
] | https://github.com/ricardoquesada/Spidermonkey/blob/4a75ea2543408bd1b2c515aa95901523eeef7858/dom/bindings/parser/WebIDL.py#L5191-L5196 | ||
rst-tu-dortmund/teb_local_planner | f737130fa6a9024fef9fcdca6eadacaa69bf30a4 | scripts/export_to_svg.py | python | sign | (number) | return cmp(number,0) | Signum function: get sign of a number
@param number: get sign of this number
@type number: numeric type (eg. integer)
@return: sign of number
@rtype: integer {1, -1, 0} | Signum function: get sign of a number | [
"Signum",
"function",
":",
"get",
"sign",
"of",
"a",
"number"
] | def sign(number):
"""
Signum function: get sign of a number
@param number: get sign of this number
@type number: numeric type (eg. integer)
@return: sign of number
@rtype: integer {1, -1, 0}
"""
return cmp(number,0) | [
"def",
"sign",
"(",
"number",
")",
":",
"return",
"cmp",
"(",
"number",
",",
"0",
")"
] | https://github.com/rst-tu-dortmund/teb_local_planner/blob/f737130fa6a9024fef9fcdca6eadacaa69bf30a4/scripts/export_to_svg.py#L45-L54 | |
NervanaSystems/ngraph | f677a119765ca30636cf407009dabd118664951f | python/src/ngraph/ops.py | python | broadcast | (
data: NodeInput,
target_shape: NodeInput,
axes_mapping: Optional[NodeInput] = None,
broadcast_spec: str = "NUMPY",
name: Optional[str] = None,
) | return _get_node_factory().create(
"Broadcast", inputs, {"broadcast_spec": broadcast_spec.upper()}
) | Create a node which broadcasts the input node's values along specified axes to a desired shape.
:param data: The node with input tensor data.
:param target_shape: The node with a new shape we want to broadcast tensor to.
:param axes_mapping: The node with a axis positions (0-based) in the result
... | Create a node which broadcasts the input node's values along specified axes to a desired shape. | [
"Create",
"a",
"node",
"which",
"broadcasts",
"the",
"input",
"node",
"s",
"values",
"along",
"specified",
"axes",
"to",
"a",
"desired",
"shape",
"."
] | def broadcast(
data: NodeInput,
target_shape: NodeInput,
axes_mapping: Optional[NodeInput] = None,
broadcast_spec: str = "NUMPY",
name: Optional[str] = None,
) -> Node:
"""Create a node which broadcasts the input node's values along specified axes to a desired shape.
:param data: The node w... | [
"def",
"broadcast",
"(",
"data",
":",
"NodeInput",
",",
"target_shape",
":",
"NodeInput",
",",
"axes_mapping",
":",
"Optional",
"[",
"NodeInput",
"]",
"=",
"None",
",",
"broadcast_spec",
":",
"str",
"=",
"\"NUMPY\"",
",",
"name",
":",
"Optional",
"[",
"str... | https://github.com/NervanaSystems/ngraph/blob/f677a119765ca30636cf407009dabd118664951f/python/src/ngraph/ops.py#L1390-L1413 | |
microsoft/onnxruntime | f92e47e95b13a240e37caf7b36577983544f98fc | orttraining/orttraining/python/training/_checkpoint_storage.py | python | save | (save_obj: dict, path) | Persists the input dictionary to a file specified by path.
Saves an hdf5 representation of the save_obj dictionary to a file or a file-like object specified by path.
Values are saved in a format supported by h5py. For example, a PyTorch tensor is saved and loaded as a
numpy object. So, user types may be co... | Persists the input dictionary to a file specified by path. | [
"Persists",
"the",
"input",
"dictionary",
"to",
"a",
"file",
"specified",
"by",
"path",
"."
] | def save(save_obj: dict, path):
"""Persists the input dictionary to a file specified by path.
Saves an hdf5 representation of the save_obj dictionary to a file or a file-like object specified by path.
Values are saved in a format supported by h5py. For example, a PyTorch tensor is saved and loaded as a
... | [
"def",
"save",
"(",
"save_obj",
":",
"dict",
",",
"path",
")",
":",
"if",
"not",
"isinstance",
"(",
"save_obj",
",",
"Mapping",
")",
":",
"raise",
"ValueError",
"(",
"\"Object to be saved must be a dictionary\"",
")",
"with",
"h5py",
".",
"File",
"(",
"path"... | https://github.com/microsoft/onnxruntime/blob/f92e47e95b13a240e37caf7b36577983544f98fc/orttraining/orttraining/python/training/_checkpoint_storage.py#L20-L39 | ||
FreeCAD/FreeCAD | ba42231b9c6889b89e064d6d563448ed81e376ec | src/Mod/Draft/draftfunctions/scale.py | python | scale_edge | (obj, edge_index, scale, center) | Needed for SubObjects modifiers.
Implemented by Dion Moult during 0.19 dev cycle (works only with Draft Wire). | Needed for SubObjects modifiers.
Implemented by Dion Moult during 0.19 dev cycle (works only with Draft Wire). | [
"Needed",
"for",
"SubObjects",
"modifiers",
".",
"Implemented",
"by",
"Dion",
"Moult",
"during",
"0",
".",
"19",
"dev",
"cycle",
"(",
"works",
"only",
"with",
"Draft",
"Wire",
")",
"."
] | def scale_edge(obj, edge_index, scale, center):
"""
Needed for SubObjects modifiers.
Implemented by Dion Moult during 0.19 dev cycle (works only with Draft Wire).
"""
scale_vertex(obj, edge_index, scale, center)
if utils.is_closed_edge(edge_index, obj):
scale_vertex(obj, 0, scale, center... | [
"def",
"scale_edge",
"(",
"obj",
",",
"edge_index",
",",
"scale",
",",
"center",
")",
":",
"scale_vertex",
"(",
"obj",
",",
"edge_index",
",",
"scale",
",",
"center",
")",
"if",
"utils",
".",
"is_closed_edge",
"(",
"edge_index",
",",
"obj",
")",
":",
"... | https://github.com/FreeCAD/FreeCAD/blob/ba42231b9c6889b89e064d6d563448ed81e376ec/src/Mod/Draft/draftfunctions/scale.py#L171-L180 | ||
catboost/catboost | 167f64f237114a4d10b2b4ee42adb4569137debe | contrib/python/scikit-learn/py2/sklearn/grid_search.py | python | ParameterGrid.__getitem__ | (self, ind) | Get the parameters that would be ``ind``th in iteration
Parameters
----------
ind : int
The iteration index
Returns
-------
params : dict of string to any
Equal to list(self)[ind] | Get the parameters that would be ``ind``th in iteration | [
"Get",
"the",
"parameters",
"that",
"would",
"be",
"ind",
"th",
"in",
"iteration"
] | def __getitem__(self, ind):
"""Get the parameters that would be ``ind``th in iteration
Parameters
----------
ind : int
The iteration index
Returns
-------
params : dict of string to any
Equal to list(self)[ind]
"""
# This ... | [
"def",
"__getitem__",
"(",
"self",
",",
"ind",
")",
":",
"# This is used to make discrete sampling without replacement memory",
"# efficient.",
"for",
"sub_grid",
"in",
"self",
".",
"param_grid",
":",
"# XXX: could memoize information used here",
"if",
"not",
"sub_grid",
":... | https://github.com/catboost/catboost/blob/167f64f237114a4d10b2b4ee42adb4569137debe/contrib/python/scikit-learn/py2/sklearn/grid_search.py#L127-L166 | ||
Genius-x/genius-x | 9fc9f194e6d1fb92dd0e33d43db19ddb67cda7b0 | cocos2d/tools/bindings-generator/clang/cindex.py | python | Cursor.underlying_typedef_type | (self) | return self._underlying_type | Return the underlying type of a typedef declaration.
Returns a Type for the typedef this cursor is a declaration for. If
the current cursor is not a typedef, this raises. | Return the underlying type of a typedef declaration. | [
"Return",
"the",
"underlying",
"type",
"of",
"a",
"typedef",
"declaration",
"."
] | def underlying_typedef_type(self):
"""Return the underlying type of a typedef declaration.
Returns a Type for the typedef this cursor is a declaration for. If
the current cursor is not a typedef, this raises.
"""
if not hasattr(self, '_underlying_type'):
assert self.... | [
"def",
"underlying_typedef_type",
"(",
"self",
")",
":",
"if",
"not",
"hasattr",
"(",
"self",
",",
"'_underlying_type'",
")",
":",
"assert",
"self",
".",
"kind",
".",
"is_declaration",
"(",
")",
"self",
".",
"_underlying_type",
"=",
"conf",
".",
"lib",
"."... | https://github.com/Genius-x/genius-x/blob/9fc9f194e6d1fb92dd0e33d43db19ddb67cda7b0/cocos2d/tools/bindings-generator/clang/cindex.py#L1331-L1342 | |
HKUST-Aerial-Robotics/Fast-Planner | 2ddd7793eecd573dbb5b47e2c985aa06606df3cf | uav_simulator/Utils/multi_map_server/quadrotor_msgs/build/catkin_generated/installspace/_setup_util.py | python | _rollback_env_variable | (environ, name, subfolder) | return new_value if value_modified else None | For each catkin workspace in CMAKE_PREFIX_PATH remove the first entry from env[NAME] matching workspace + subfolder.
:param subfolder: str '' or subfoldername that may start with '/'
:returns: the updated value of the environment variable. | For each catkin workspace in CMAKE_PREFIX_PATH remove the first entry from env[NAME] matching workspace + subfolder. | [
"For",
"each",
"catkin",
"workspace",
"in",
"CMAKE_PREFIX_PATH",
"remove",
"the",
"first",
"entry",
"from",
"env",
"[",
"NAME",
"]",
"matching",
"workspace",
"+",
"subfolder",
"."
] | def _rollback_env_variable(environ, name, subfolder):
'''
For each catkin workspace in CMAKE_PREFIX_PATH remove the first entry from env[NAME] matching workspace + subfolder.
:param subfolder: str '' or subfoldername that may start with '/'
:returns: the updated value of the environment variable.
'... | [
"def",
"_rollback_env_variable",
"(",
"environ",
",",
"name",
",",
"subfolder",
")",
":",
"value",
"=",
"environ",
"[",
"name",
"]",
"if",
"name",
"in",
"environ",
"else",
"''",
"env_paths",
"=",
"[",
"path",
"for",
"path",
"in",
"value",
".",
"split",
... | https://github.com/HKUST-Aerial-Robotics/Fast-Planner/blob/2ddd7793eecd573dbb5b47e2c985aa06606df3cf/uav_simulator/Utils/multi_map_server/quadrotor_msgs/build/catkin_generated/installspace/_setup_util.py#L84-L111 | |
natanielruiz/android-yolo | 1ebb54f96a67a20ff83ddfc823ed83a13dc3a47f | jni-build/jni/include/tensorflow/contrib/distributions/python/ops/binomial.py | python | Binomial.name | (self) | return self._name | Name to prepend to all ops. | Name to prepend to all ops. | [
"Name",
"to",
"prepend",
"to",
"all",
"ops",
"."
] | def name(self):
"""Name to prepend to all ops."""
return self._name | [
"def",
"name",
"(",
"self",
")",
":",
"return",
"self",
".",
"_name"
] | https://github.com/natanielruiz/android-yolo/blob/1ebb54f96a67a20ff83ddfc823ed83a13dc3a47f/jni-build/jni/include/tensorflow/contrib/distributions/python/ops/binomial.py#L153-L155 | |
wxWidgets/wxPython-Classic | 19571e1ae65f1ac445f5491474121998c97a1bf0 | src/osx_carbon/propgrid.py | python | PyTextCtrlEditor._SetSelf | (*args, **kwargs) | return _propgrid.PyTextCtrlEditor__SetSelf(*args, **kwargs) | _SetSelf(self, PyObject self) | _SetSelf(self, PyObject self) | [
"_SetSelf",
"(",
"self",
"PyObject",
"self",
")"
] | def _SetSelf(*args, **kwargs):
"""_SetSelf(self, PyObject self)"""
return _propgrid.PyTextCtrlEditor__SetSelf(*args, **kwargs) | [
"def",
"_SetSelf",
"(",
"*",
"args",
",",
"*",
"*",
"kwargs",
")",
":",
"return",
"_propgrid",
".",
"PyTextCtrlEditor__SetSelf",
"(",
"*",
"args",
",",
"*",
"*",
"kwargs",
")"
] | https://github.com/wxWidgets/wxPython-Classic/blob/19571e1ae65f1ac445f5491474121998c97a1bf0/src/osx_carbon/propgrid.py#L4165-L4167 | |
seqan/seqan | f5f658343c366c9c3d44ba358ffc9317e78a09ed | util/py_lib/seqan/dddoc/main.py | python | main | (argv) | return res | Program entry point. | Program entry point. | [
"Program",
"entry",
"point",
"."
] | def main(argv):
"""Program entry point."""
print '%s\n' % HEADER
start_time = datetime.datetime.now()
# Parse arguments.
parser = optparse.OptionParser()
parser.add_option('-d', '--doc-dir', dest='doc_dirs', action='append',
default=[],
help=('Re... | [
"def",
"main",
"(",
"argv",
")",
":",
"print",
"'%s\\n'",
"%",
"HEADER",
"start_time",
"=",
"datetime",
".",
"datetime",
".",
"now",
"(",
")",
"# Parse arguments.",
"parser",
"=",
"optparse",
".",
"OptionParser",
"(",
")",
"parser",
".",
"add_option",
"(",... | https://github.com/seqan/seqan/blob/f5f658343c366c9c3d44ba358ffc9317e78a09ed/util/py_lib/seqan/dddoc/main.py#L84-L127 | |
wxWidgets/wxPython-Classic | 19571e1ae65f1ac445f5491474121998c97a1bf0 | src/msw/media.py | python | MediaCtrl.GetState | (*args, **kwargs) | return _media.MediaCtrl_GetState(*args, **kwargs) | GetState(self) -> int | GetState(self) -> int | [
"GetState",
"(",
"self",
")",
"-",
">",
"int"
] | def GetState(*args, **kwargs):
"""GetState(self) -> int"""
return _media.MediaCtrl_GetState(*args, **kwargs) | [
"def",
"GetState",
"(",
"*",
"args",
",",
"*",
"*",
"kwargs",
")",
":",
"return",
"_media",
".",
"MediaCtrl_GetState",
"(",
"*",
"args",
",",
"*",
"*",
"kwargs",
")"
] | https://github.com/wxWidgets/wxPython-Classic/blob/19571e1ae65f1ac445f5491474121998c97a1bf0/src/msw/media.py#L121-L123 | |
miyosuda/TensorFlowAndroidMNIST | 7b5a4603d2780a8a2834575706e9001977524007 | jni-build/jni/include/tensorflow/python/platform/gfile.py | python | _GFileBase.flush | (self) | return self._fp.flush() | Flush the underlying file handle. | Flush the underlying file handle. | [
"Flush",
"the",
"underlying",
"file",
"handle",
"."
] | def flush(self):
"""Flush the underlying file handle."""
return self._fp.flush() | [
"def",
"flush",
"(",
"self",
")",
":",
"return",
"self",
".",
"_fp",
".",
"flush",
"(",
")"
] | https://github.com/miyosuda/TensorFlowAndroidMNIST/blob/7b5a4603d2780a8a2834575706e9001977524007/jni-build/jni/include/tensorflow/python/platform/gfile.py#L81-L83 | |
tensorflow/tensorflow | 419e3a6b650ea4bd1b0cba23c4348f8a69f3272e | tensorflow/python/ops/tensor_array_ops.py | python | _GraphTensorArrayV2.size | (self, name=None) | See TensorArray. | See TensorArray. | [
"See",
"TensorArray",
"."
] | def size(self, name=None):
"""See TensorArray."""
if not self._dynamic_size and self._size is not None:
return ops.convert_to_tensor(self._size, dtype=dtypes.int32)
else:
return list_ops.tensor_list_length(input_handle=self._flow, name=name) | [
"def",
"size",
"(",
"self",
",",
"name",
"=",
"None",
")",
":",
"if",
"not",
"self",
".",
"_dynamic_size",
"and",
"self",
".",
"_size",
"is",
"not",
"None",
":",
"return",
"ops",
".",
"convert_to_tensor",
"(",
"self",
".",
"_size",
",",
"dtype",
"=",... | https://github.com/tensorflow/tensorflow/blob/419e3a6b650ea4bd1b0cba23c4348f8a69f3272e/tensorflow/python/ops/tensor_array_ops.py#L645-L650 | ||
yue/yue | 619d62c191b13c51c01be451dc48917c34a5aefc | building/tools/cpplint.py | python | IsErrorSuppressedByNolint | (category, linenum) | return (_global_error_suppressions.get(category, False) or
linenum in _error_suppressions.get(category, set()) or
linenum in _error_suppressions.get(None, set())) | Returns true if the specified error category is suppressed on this line.
Consults the global error_suppressions map populated by
ParseNolintSuppressions/ProcessGlobalSuppresions/ResetNolintSuppressions.
Args:
category: str, the category of the error.
linenum: int, the current line number.
Returns:
... | Returns true if the specified error category is suppressed on this line. | [
"Returns",
"true",
"if",
"the",
"specified",
"error",
"category",
"is",
"suppressed",
"on",
"this",
"line",
"."
] | def IsErrorSuppressedByNolint(category, linenum):
"""Returns true if the specified error category is suppressed on this line.
Consults the global error_suppressions map populated by
ParseNolintSuppressions/ProcessGlobalSuppresions/ResetNolintSuppressions.
Args:
category: str, the category of the error.
... | [
"def",
"IsErrorSuppressedByNolint",
"(",
"category",
",",
"linenum",
")",
":",
"return",
"(",
"_global_error_suppressions",
".",
"get",
"(",
"category",
",",
"False",
")",
"or",
"linenum",
"in",
"_error_suppressions",
".",
"get",
"(",
"category",
",",
"set",
"... | https://github.com/yue/yue/blob/619d62c191b13c51c01be451dc48917c34a5aefc/building/tools/cpplint.py#L633-L648 | |
microsoft/TSS.MSR | 0f2516fca2cd9929c31d5450e39301c9bde43688 | TSS.Py/src/TpmTypes.py | python | NV_ReadResponse.fromBytes | (buffer) | return TpmBuffer(buffer).createObj(NV_ReadResponse) | Returns new NV_ReadResponse object constructed from its marshaled
representation in the given byte buffer | Returns new NV_ReadResponse object constructed from its marshaled
representation in the given byte buffer | [
"Returns",
"new",
"NV_ReadResponse",
"object",
"constructed",
"from",
"its",
"marshaled",
"representation",
"in",
"the",
"given",
"byte",
"buffer"
] | def fromBytes(buffer):
""" Returns new NV_ReadResponse object constructed from its marshaled
representation in the given byte buffer
"""
return TpmBuffer(buffer).createObj(NV_ReadResponse) | [
"def",
"fromBytes",
"(",
"buffer",
")",
":",
"return",
"TpmBuffer",
"(",
"buffer",
")",
".",
"createObj",
"(",
"NV_ReadResponse",
")"
] | https://github.com/microsoft/TSS.MSR/blob/0f2516fca2cd9929c31d5450e39301c9bde43688/TSS.Py/src/TpmTypes.py#L17095-L17099 | |
benoitsteiner/tensorflow-opencl | cb7cb40a57fde5cfd4731bc551e82a1e2fef43a5 | tensorflow/contrib/learn/python/learn/estimators/estimator.py | python | BaseEstimator._extract_metric_update_ops | (self, eval_dict) | return update_ops, value_ops | Separate update operations from metric value operations. | Separate update operations from metric value operations. | [
"Separate",
"update",
"operations",
"from",
"metric",
"value",
"operations",
"."
] | def _extract_metric_update_ops(self, eval_dict):
"""Separate update operations from metric value operations."""
update_ops = []
value_ops = {}
for name, metric_ops in six.iteritems(eval_dict):
if isinstance(metric_ops, (list, tuple)):
if len(metric_ops) == 2:
value_ops[name] = me... | [
"def",
"_extract_metric_update_ops",
"(",
"self",
",",
"eval_dict",
")",
":",
"update_ops",
"=",
"[",
"]",
"value_ops",
"=",
"{",
"}",
"for",
"name",
",",
"metric_ops",
"in",
"six",
".",
"iteritems",
"(",
"eval_dict",
")",
":",
"if",
"isinstance",
"(",
"... | https://github.com/benoitsteiner/tensorflow-opencl/blob/cb7cb40a57fde5cfd4731bc551e82a1e2fef43a5/tensorflow/contrib/learn/python/learn/estimators/estimator.py#L798-L820 | |
adobe/chromium | cfe5bf0b51b1f6b9fe239c2a3c2f2364da9967d7 | third_party/closure_linter/closure_linter/javascripttokens.py | python | JavaScriptToken.IsAssignment | (self) | return (self.type == JavaScriptTokenType.OPERATOR and
self.string.endswith('=') and
self.string not in ('==', '!=', '>=', '<=', '===', '!==')) | Tests if this token is an assignment operator.
Returns:
True if this token is an assignment operator. | Tests if this token is an assignment operator. | [
"Tests",
"if",
"this",
"token",
"is",
"an",
"assignment",
"operator",
"."
] | def IsAssignment(self):
"""Tests if this token is an assignment operator.
Returns:
True if this token is an assignment operator.
"""
return (self.type == JavaScriptTokenType.OPERATOR and
self.string.endswith('=') and
self.string not in ('==', '!=', '>=', '<=', '===', '!=='... | [
"def",
"IsAssignment",
"(",
"self",
")",
":",
"return",
"(",
"self",
".",
"type",
"==",
"JavaScriptTokenType",
".",
"OPERATOR",
"and",
"self",
".",
"string",
".",
"endswith",
"(",
"'='",
")",
"and",
"self",
".",
"string",
"not",
"in",
"(",
"'=='",
",",... | https://github.com/adobe/chromium/blob/cfe5bf0b51b1f6b9fe239c2a3c2f2364da9967d7/third_party/closure_linter/closure_linter/javascripttokens.py#L121-L129 | |
facebookarchive/LogDevice | ce7726050edc49a1e15d9160e81c890736b779e2 | build/fbcode_builder/getdeps/fetcher.py | python | ChangeStatus.record_change | (self, file_name) | Used by the shipit fetcher to record changes as it updates
files in the destination. If the file name might be one used
in the cmake build system that we use for 1st party code, then
record that as a "make file" change. We could broaden this
to match any file used by various build syst... | Used by the shipit fetcher to record changes as it updates
files in the destination. If the file name might be one used
in the cmake build system that we use for 1st party code, then
record that as a "make file" change. We could broaden this
to match any file used by various build syst... | [
"Used",
"by",
"the",
"shipit",
"fetcher",
"to",
"record",
"changes",
"as",
"it",
"updates",
"files",
"in",
"the",
"destination",
".",
"If",
"the",
"file",
"name",
"might",
"be",
"one",
"used",
"in",
"the",
"cmake",
"build",
"system",
"that",
"we",
"use",... | def record_change(self, file_name):
"""Used by the shipit fetcher to record changes as it updates
files in the destination. If the file name might be one used
in the cmake build system that we use for 1st party code, then
record that as a "make file" change. We could broaden this
... | [
"def",
"record_change",
"(",
"self",
",",
"file_name",
")",
":",
"file_name",
"=",
"file_name",
".",
"lower",
"(",
")",
"if",
"file_name_is_cmake_file",
"(",
"file_name",
")",
":",
"self",
".",
"make_files",
"+=",
"1",
"elif",
"\"/fbcode_builder/cmake\"",
"in"... | https://github.com/facebookarchive/LogDevice/blob/ce7726050edc49a1e15d9160e81c890736b779e2/build/fbcode_builder/getdeps/fetcher.py#L72-L90 | ||
wxWidgets/wxPython-Classic | 19571e1ae65f1ac445f5491474121998c97a1bf0 | wx/lib/agw/hyperlink.py | python | HyperLinkCtrl.GetColours | (self) | return self._LinkColour, self._VisitedColour, self._LinkRolloverColour | Gets the colours for the link, the visited link and the mouse
rollover. | Gets the colours for the link, the visited link and the mouse
rollover. | [
"Gets",
"the",
"colours",
"for",
"the",
"link",
"the",
"visited",
"link",
"and",
"the",
"mouse",
"rollover",
"."
] | def GetColours(self):
"""
Gets the colours for the link, the visited link and the mouse
rollover.
"""
return self._LinkColour, self._VisitedColour, self._LinkRolloverColour | [
"def",
"GetColours",
"(",
"self",
")",
":",
"return",
"self",
".",
"_LinkColour",
",",
"self",
".",
"_VisitedColour",
",",
"self",
".",
"_LinkRolloverColour"
] | https://github.com/wxWidgets/wxPython-Classic/blob/19571e1ae65f1ac445f5491474121998c97a1bf0/wx/lib/agw/hyperlink.py#L466-L472 | |
windystrife/UnrealEngine_NVIDIAGameWorks | b50e6338a7c5b26374d66306ebc7807541ff815e | Engine/Extras/ThirdPartyNotUE/emsdk/Win64/python/2.7.5.3_64bit/Lib/site-packages/sipconfig.py | python | Makefile.generate_target_clean | (self, mfile) | The default implementation of the clean target.
mfile is the file object. | The default implementation of the clean target. | [
"The",
"default",
"implementation",
"of",
"the",
"clean",
"target",
"."
] | def generate_target_clean(self, mfile):
"""The default implementation of the clean target.
mfile is the file object.
"""
mfile.write("\nclean:\n") | [
"def",
"generate_target_clean",
"(",
"self",
",",
"mfile",
")",
":",
"mfile",
".",
"write",
"(",
"\"\\nclean:\\n\"",
")"
] | https://github.com/windystrife/UnrealEngine_NVIDIAGameWorks/blob/b50e6338a7c5b26374d66306ebc7807541ff815e/Engine/Extras/ThirdPartyNotUE/emsdk/Win64/python/2.7.5.3_64bit/Lib/site-packages/sipconfig.py#L1347-L1352 | ||
PixarAnimationStudios/USD | faed18ce62c8736b02413635b584a2f637156bad | pxr/usdImaging/usdviewq/appController.py | python | AppController._refreshPrimViewSelection | (self, expandedPrims) | Refresh the selected prim view items to match the selection data
model. | Refresh the selected prim view items to match the selection data
model. | [
"Refresh",
"the",
"selected",
"prim",
"view",
"items",
"to",
"match",
"the",
"selection",
"data",
"model",
"."
] | def _refreshPrimViewSelection(self, expandedPrims):
"""Refresh the selected prim view items to match the selection data
model.
"""
self._ui.primView.clearSelection()
selectedItems = [
self._getItemAtPath(prim.GetPath())
for prim in self._dataModel.selectio... | [
"def",
"_refreshPrimViewSelection",
"(",
"self",
",",
"expandedPrims",
")",
":",
"self",
".",
"_ui",
".",
"primView",
".",
"clearSelection",
"(",
")",
"selectedItems",
"=",
"[",
"self",
".",
"_getItemAtPath",
"(",
"prim",
".",
"GetPath",
"(",
")",
")",
"fo... | https://github.com/PixarAnimationStudios/USD/blob/faed18ce62c8736b02413635b584a2f637156bad/pxr/usdImaging/usdviewq/appController.py#L3334-L3353 | ||
google/mozc | 7329757e1ad30e327c1ae823a8302c79482d6b9c | src/build_mozc.py | python | RunTests | (target_platform, configuration, parallel_num) | Run built tests actually.
Args:
target_platform: The build target ('Linux', 'Windows', etc.)
configuration: build configuration ('Release' or 'Debug')
parallel_num: allows specified jobs at once.
Raises:
RunOrDieError: One or more tests have failed. | Run built tests actually. | [
"Run",
"built",
"tests",
"actually",
"."
] | def RunTests(target_platform, configuration, parallel_num):
"""Run built tests actually.
Args:
target_platform: The build target ('Linux', 'Windows', etc.)
configuration: build configuration ('Release' or 'Debug')
parallel_num: allows specified jobs at once.
Raises:
RunOrDieError: One or more te... | [
"def",
"RunTests",
"(",
"target_platform",
",",
"configuration",
",",
"parallel_num",
")",
":",
"# TODO(nona): move this function to build_tools/test_tools",
"base_path",
"=",
"os",
".",
"path",
".",
"join",
"(",
"GetBuildBaseName",
"(",
"target_platform",
")",
",",
"... | https://github.com/google/mozc/blob/7329757e1ad30e327c1ae823a8302c79482d6b9c/src/build_mozc.py#L660-L739 | ||
tinyobjloader/tinyobjloader | 8322e00ae685ea623ab6ac5a6cebcfa2d22fbf93 | deps/cpplint.py | python | CheckForNonConstReference | (filename, clean_lines, linenum,
nesting_state, error) | Check for non-const references.
Separate from CheckLanguage since it scans backwards from current
line, instead of scanning forward.
Args:
filename: The name of the current file.
clean_lines: A CleansedLines instance containing the file.
linenum: The number of the line to check.
nesting_state: A... | Check for non-const references. | [
"Check",
"for",
"non",
"-",
"const",
"references",
"."
] | def CheckForNonConstReference(filename, clean_lines, linenum,
nesting_state, error):
"""Check for non-const references.
Separate from CheckLanguage since it scans backwards from current
line, instead of scanning forward.
Args:
filename: The name of the current file.
clean... | [
"def",
"CheckForNonConstReference",
"(",
"filename",
",",
"clean_lines",
",",
"linenum",
",",
"nesting_state",
",",
"error",
")",
":",
"# Do nothing if there is no '&' on current line.",
"line",
"=",
"clean_lines",
".",
"elided",
"[",
"linenum",
"]",
"if",
"'&'",
"n... | https://github.com/tinyobjloader/tinyobjloader/blob/8322e00ae685ea623ab6ac5a6cebcfa2d22fbf93/deps/cpplint.py#L5080-L5215 | ||
tensorflow/tensorflow | 419e3a6b650ea4bd1b0cba23c4348f8a69f3272e | tensorflow/python/keras/distribute/distributed_training_utils_v1.py | python | _make_replica_execution_function | (model, mode) | return func | A single step of the distributed execution on a replica. | A single step of the distributed execution on a replica. | [
"A",
"single",
"step",
"of",
"the",
"distributed",
"execution",
"on",
"a",
"replica",
"."
] | def _make_replica_execution_function(model, mode):
"""A single step of the distributed execution on a replica."""
if mode == ModeKeys.TRAIN:
func = model.train_on_batch
elif mode == ModeKeys.TEST:
func = model.test_on_batch
else:
def predict_on_batch(x, y=None, sample_weights=None):
del y, sa... | [
"def",
"_make_replica_execution_function",
"(",
"model",
",",
"mode",
")",
":",
"if",
"mode",
"==",
"ModeKeys",
".",
"TRAIN",
":",
"func",
"=",
"model",
".",
"train_on_batch",
"elif",
"mode",
"==",
"ModeKeys",
".",
"TEST",
":",
"func",
"=",
"model",
".",
... | https://github.com/tensorflow/tensorflow/blob/419e3a6b650ea4bd1b0cba23c4348f8a69f3272e/tensorflow/python/keras/distribute/distributed_training_utils_v1.py#L861-L880 | |
FreeCAD/FreeCAD | ba42231b9c6889b89e064d6d563448ed81e376ec | src/Mod/Draft/draftguitools/gui_mirror.py | python | Mirror.action | (self, arg) | Handle the 3D scene events.
This is installed as an EventCallback in the Inventor view.
Parameters
----------
arg: dict
Dictionary with strings that indicates the type of event received
from the 3D view. | Handle the 3D scene events. | [
"Handle",
"the",
"3D",
"scene",
"events",
"."
] | def action(self, arg):
"""Handle the 3D scene events.
This is installed as an EventCallback in the Inventor view.
Parameters
----------
arg: dict
Dictionary with strings that indicates the type of event received
from the 3D view.
"""
if a... | [
"def",
"action",
"(",
"self",
",",
"arg",
")",
":",
"if",
"arg",
"[",
"\"Type\"",
"]",
"==",
"\"SoKeyboardEvent\"",
":",
"if",
"arg",
"[",
"\"Key\"",
"]",
"==",
"\"ESCAPE\"",
":",
"self",
".",
"finish",
"(",
")",
"elif",
"arg",
"[",
"\"Type\"",
"]",
... | https://github.com/FreeCAD/FreeCAD/blob/ba42231b9c6889b89e064d6d563448ed81e376ec/src/Mod/Draft/draftguitools/gui_mirror.py#L125-L190 | ||
hfinkel/llvm-project-cxxjit | 91084ef018240bbb8e24235ff5cd8c355a9c1a1e | clang/tools/scan-build-py/libscanbuild/analyze.py | python | require | (required) | return decorator | Decorator for checking the required values in state.
It checks the required attributes in the passed state and stop when
any of those is missing. | Decorator for checking the required values in state. | [
"Decorator",
"for",
"checking",
"the",
"required",
"values",
"in",
"state",
"."
] | def require(required):
""" Decorator for checking the required values in state.
It checks the required attributes in the passed state and stop when
any of those is missing. """
def decorator(function):
@functools.wraps(function)
def wrapper(*args, **kwargs):
for key in requ... | [
"def",
"require",
"(",
"required",
")",
":",
"def",
"decorator",
"(",
"function",
")",
":",
"@",
"functools",
".",
"wraps",
"(",
"function",
")",
"def",
"wrapper",
"(",
"*",
"args",
",",
"*",
"*",
"kwargs",
")",
":",
"for",
"key",
"in",
"required",
... | https://github.com/hfinkel/llvm-project-cxxjit/blob/91084ef018240bbb8e24235ff5cd8c355a9c1a1e/clang/tools/scan-build-py/libscanbuild/analyze.py#L402-L420 | |
mindspore-ai/mindspore | fb8fd3338605bb34fa5cea054e535a8b1d753fab | mindspore/python/mindspore/profiler/parser/integrator.py | python | Integrator._aicore_detail_data_load | (self) | Load data according to the parsed AICORE operator file. | Load data according to the parsed AICORE operator file. | [
"Load",
"data",
"according",
"to",
"the",
"parsed",
"AICORE",
"operator",
"file",
"."
] | def _aicore_detail_data_load(self):
"""Load data according to the parsed AICORE operator file."""
op_detail_file_path = os.path.join(
self._profiling_dir,
self._file_name_aicore_detail_info.format(self._device_id)
)
framework_file_path = os.path.join(
... | [
"def",
"_aicore_detail_data_load",
"(",
"self",
")",
":",
"op_detail_file_path",
"=",
"os",
".",
"path",
".",
"join",
"(",
"self",
".",
"_profiling_dir",
",",
"self",
".",
"_file_name_aicore_detail_info",
".",
"format",
"(",
"self",
".",
"_device_id",
")",
")"... | https://github.com/mindspore-ai/mindspore/blob/fb8fd3338605bb34fa5cea054e535a8b1d753fab/mindspore/python/mindspore/profiler/parser/integrator.py#L220-L258 | ||
aws/lumberyard | f85344403c1c2e77ec8c75deb2c116e97b713217 | dev/Tools/AWSPythonSDK/1.5.8/botocore/vendored/requests/packages/urllib3/connectionpool.py | python | HTTPConnectionPool._make_request | (self, conn, method, url, timeout=_Default,
**httplib_request_kw) | return httplib_response | Perform a request on a given urllib connection object taken from our
pool.
:param conn:
a connection from one of our connection pools
:param timeout:
Socket timeout in seconds for the request. This can be a
float or integer, which will set the same timeout v... | Perform a request on a given urllib connection object taken from our
pool. | [
"Perform",
"a",
"request",
"on",
"a",
"given",
"urllib",
"connection",
"object",
"taken",
"from",
"our",
"pool",
"."
] | def _make_request(self, conn, method, url, timeout=_Default,
**httplib_request_kw):
"""
Perform a request on a given urllib connection object taken from our
pool.
:param conn:
a connection from one of our connection pools
:param timeout:
... | [
"def",
"_make_request",
"(",
"self",
",",
"conn",
",",
"method",
",",
"url",
",",
"timeout",
"=",
"_Default",
",",
"*",
"*",
"httplib_request_kw",
")",
":",
"self",
".",
"num_requests",
"+=",
"1",
"timeout_obj",
"=",
"self",
".",
"_get_timeout",
"(",
"ti... | https://github.com/aws/lumberyard/blob/f85344403c1c2e77ec8c75deb2c116e97b713217/dev/Tools/AWSPythonSDK/1.5.8/botocore/vendored/requests/packages/urllib3/connectionpool.py#L317-L384 | |
catboost/catboost | 167f64f237114a4d10b2b4ee42adb4569137debe | contrib/python/scikit-learn/py2/sklearn/linear_model/stochastic_gradient.py | python | BaseSGDRegressor.fit | (self, X, y, coef_init=None, intercept_init=None,
sample_weight=None) | return self._fit(X, y, alpha=self.alpha, C=1.0,
loss=self.loss, learning_rate=self.learning_rate,
coef_init=coef_init,
intercept_init=intercept_init,
sample_weight=sample_weight) | Fit linear model with Stochastic Gradient Descent.
Parameters
----------
X : {array-like, sparse matrix}, shape (n_samples, n_features)
Training data
y : numpy array, shape (n_samples,)
Target values
coef_init : array, shape (n_features,)
Th... | Fit linear model with Stochastic Gradient Descent. | [
"Fit",
"linear",
"model",
"with",
"Stochastic",
"Gradient",
"Descent",
"."
] | def fit(self, X, y, coef_init=None, intercept_init=None,
sample_weight=None):
"""Fit linear model with Stochastic Gradient Descent.
Parameters
----------
X : {array-like, sparse matrix}, shape (n_samples, n_features)
Training data
y : numpy array, shape ... | [
"def",
"fit",
"(",
"self",
",",
"X",
",",
"y",
",",
"coef_init",
"=",
"None",
",",
"intercept_init",
"=",
"None",
",",
"sample_weight",
"=",
"None",
")",
":",
"return",
"self",
".",
"_fit",
"(",
"X",
",",
"y",
",",
"alpha",
"=",
"self",
".",
"alp... | https://github.com/catboost/catboost/blob/167f64f237114a4d10b2b4ee42adb4569137debe/contrib/python/scikit-learn/py2/sklearn/linear_model/stochastic_gradient.py#L944-L973 | |
y123456yz/reading-and-annotate-mongodb-3.6 | 93280293672ca7586dc24af18132aa61e4ed7fcf | mongo/src/third_party/scons-2.5.0/scons-local-2.5.0/SCons/Tool/xgettext.py | python | _POTUpdateBuilder | (env, **kw) | return _POTBuilder(**kw) | Creates `POTUpdate` builder object | Creates `POTUpdate` builder object | [
"Creates",
"POTUpdate",
"builder",
"object"
] | def _POTUpdateBuilder(env, **kw):
""" Creates `POTUpdate` builder object """
import SCons.Action
from SCons.Tool.GettextCommon import _POTargetFactory
kw['action'] = SCons.Action.Action(_update_pot_file, None)
kw['suffix'] = '$POTSUFFIX'
kw['target_factory'] = _POTargetFactory(env, alias='$POTUPDATE_ALIAS')... | [
"def",
"_POTUpdateBuilder",
"(",
"env",
",",
"*",
"*",
"kw",
")",
":",
"import",
"SCons",
".",
"Action",
"from",
"SCons",
".",
"Tool",
".",
"GettextCommon",
"import",
"_POTargetFactory",
"kw",
"[",
"'action'",
"]",
"=",
"SCons",
".",
"Action",
".",
"Acti... | https://github.com/y123456yz/reading-and-annotate-mongodb-3.6/blob/93280293672ca7586dc24af18132aa61e4ed7fcf/mongo/src/third_party/scons-2.5.0/scons-local-2.5.0/SCons/Tool/xgettext.py#L257-L265 | |
natanielruiz/android-yolo | 1ebb54f96a67a20ff83ddfc823ed83a13dc3a47f | jni-build/jni/include/tensorflow/contrib/graph_editor/match.py | python | OpMatcher.control_input_ops | (self, *args) | return self | Add input matches. | Add input matches. | [
"Add",
"input",
"matches",
"."
] | def control_input_ops(self, *args):
"""Add input matches."""
if self.control_input_op_matches is not None:
raise ValueError("control_input_op_matches is already set.")
self.control_input_op_matches = []
for input_match in args:
self.control_input_op_matches.append(_make_graph_match(input_mat... | [
"def",
"control_input_ops",
"(",
"self",
",",
"*",
"args",
")",
":",
"if",
"self",
".",
"control_input_op_matches",
"is",
"not",
"None",
":",
"raise",
"ValueError",
"(",
"\"control_input_op_matches is already set.\"",
")",
"self",
".",
"control_input_op_matches",
"=... | https://github.com/natanielruiz/android-yolo/blob/1ebb54f96a67a20ff83ddfc823ed83a13dc3a47f/jni-build/jni/include/tensorflow/contrib/graph_editor/match.py#L131-L138 | |
Tencent/TNN | 7acca99f54c55747b415a4c57677403eebc7b706 | third_party/flatbuffers/python/flatbuffers/flexbuffers.py | python | Builder.String | (self, value) | return loc | Encodes string value. | Encodes string value. | [
"Encodes",
"string",
"value",
"."
] | def String(self, value):
"""Encodes string value."""
reset_to = len(self._buf)
encoded = value.encode('utf-8')
loc = self._WriteBlob(encoded, append_zero=True, type_=Type.STRING)
if self._share_strings:
prev_loc = self._string_pool.FindOrInsert(encoded, loc)
if prev_loc is not None:
... | [
"def",
"String",
"(",
"self",
",",
"value",
")",
":",
"reset_to",
"=",
"len",
"(",
"self",
".",
"_buf",
")",
"encoded",
"=",
"value",
".",
"encode",
"(",
"'utf-8'",
")",
"loc",
"=",
"self",
".",
"_WriteBlob",
"(",
"encoded",
",",
"append_zero",
"=",
... | https://github.com/Tencent/TNN/blob/7acca99f54c55747b415a4c57677403eebc7b706/third_party/flatbuffers/python/flatbuffers/flexbuffers.py#L1160-L1171 | |
aws/lumberyard | f85344403c1c2e77ec8c75deb2c116e97b713217 | dev/Tools/Python/3.7.10/windows/Lib/site-packages/pip/_vendor/urllib3/packages/backports/makefile.py | python | backport_makefile | (
self, mode="r", buffering=None, encoding=None, errors=None, newline=None
) | return text | Backport of ``socket.makefile`` from Python 3.5. | Backport of ``socket.makefile`` from Python 3.5. | [
"Backport",
"of",
"socket",
".",
"makefile",
"from",
"Python",
"3",
".",
"5",
"."
] | def backport_makefile(
self, mode="r", buffering=None, encoding=None, errors=None, newline=None
):
"""
Backport of ``socket.makefile`` from Python 3.5.
"""
if not set(mode) <= {"r", "w", "b"}:
raise ValueError("invalid mode %r (only r, w, b allowed)" % (mode,))
writing = "w" in mode
... | [
"def",
"backport_makefile",
"(",
"self",
",",
"mode",
"=",
"\"r\"",
",",
"buffering",
"=",
"None",
",",
"encoding",
"=",
"None",
",",
"errors",
"=",
"None",
",",
"newline",
"=",
"None",
")",
":",
"if",
"not",
"set",
"(",
"mode",
")",
"<=",
"{",
"\"... | https://github.com/aws/lumberyard/blob/f85344403c1c2e77ec8c75deb2c116e97b713217/dev/Tools/Python/3.7.10/windows/Lib/site-packages/pip/_vendor/urllib3/packages/backports/makefile.py#L13-L51 | |
aws/lumberyard | f85344403c1c2e77ec8c75deb2c116e97b713217 | dev/Gems/CloudGemMetric/v1/AWS/common-code/Lib/pkg_resources/__init__.py | python | Distribution.get_entry_info | (self, group, name) | return self.get_entry_map(group).get(name) | Return the EntryPoint object for `group`+`name`, or ``None`` | Return the EntryPoint object for `group`+`name`, or ``None`` | [
"Return",
"the",
"EntryPoint",
"object",
"for",
"group",
"+",
"name",
"or",
"None"
] | def get_entry_info(self, group, name):
"""Return the EntryPoint object for `group`+`name`, or ``None``"""
return self.get_entry_map(group).get(name) | [
"def",
"get_entry_info",
"(",
"self",
",",
"group",
",",
"name",
")",
":",
"return",
"self",
".",
"get_entry_map",
"(",
"group",
")",
".",
"get",
"(",
"name",
")"
] | https://github.com/aws/lumberyard/blob/f85344403c1c2e77ec8c75deb2c116e97b713217/dev/Gems/CloudGemMetric/v1/AWS/common-code/Lib/pkg_resources/__init__.py#L2873-L2875 | |
wxWidgets/wxPython-Classic | 19571e1ae65f1ac445f5491474121998c97a1bf0 | src/msw/_windows.py | python | PageSetupDialogData.SetPaperId | (*args, **kwargs) | return _windows_.PageSetupDialogData_SetPaperId(*args, **kwargs) | SetPaperId(self, int id) | SetPaperId(self, int id) | [
"SetPaperId",
"(",
"self",
"int",
"id",
")"
] | def SetPaperId(*args, **kwargs):
"""SetPaperId(self, int id)"""
return _windows_.PageSetupDialogData_SetPaperId(*args, **kwargs) | [
"def",
"SetPaperId",
"(",
"*",
"args",
",",
"*",
"*",
"kwargs",
")",
":",
"return",
"_windows_",
".",
"PageSetupDialogData_SetPaperId",
"(",
"*",
"args",
",",
"*",
"*",
"kwargs",
")"
] | https://github.com/wxWidgets/wxPython-Classic/blob/19571e1ae65f1ac445f5491474121998c97a1bf0/src/msw/_windows.py#L4979-L4981 | |
taichi-dev/taichi | 973c04d6ba40f34e9e3bd5a28ae0ee0802f136a6 | python/taichi/lang/matrix.py | python | Matrix.inverse | (self) | The inverse of a matrix.
Note:
The matrix dimension should be less than or equal to 4.
Returns:
The inverse of a matrix.
Raises:
Exception: Inversions of matrices with sizes >= 5 are not supported. | The inverse of a matrix. | [
"The",
"inverse",
"of",
"a",
"matrix",
"."
] | def inverse(self):
"""The inverse of a matrix.
Note:
The matrix dimension should be less than or equal to 4.
Returns:
The inverse of a matrix.
Raises:
Exception: Inversions of matrices with sizes >= 5 are not supported.
"""
assert s... | [
"def",
"inverse",
"(",
"self",
")",
":",
"assert",
"self",
".",
"n",
"==",
"self",
".",
"m",
",",
"'Only square matrices are invertible'",
"if",
"self",
".",
"n",
"==",
"1",
":",
"return",
"Matrix",
"(",
"[",
"1",
"/",
"self",
"(",
"0",
",",
"0",
"... | https://github.com/taichi-dev/taichi/blob/973c04d6ba40f34e9e3bd5a28ae0ee0802f136a6/python/taichi/lang/matrix.py#L424-L478 | ||
aws/lumberyard | f85344403c1c2e77ec8c75deb2c116e97b713217 | dev/Gems/CloudGemMetric/v1/AWS/common-code/Lib/numpy/core/numeric.py | python | count_nonzero | (a, axis=None) | return a_bool.sum(axis=axis, dtype=np.intp) | Counts the number of non-zero values in the array ``a``.
The word "non-zero" is in reference to the Python 2.x
built-in method ``__nonzero__()`` (renamed ``__bool__()``
in Python 3.x) of Python objects that tests an object's
"truthfulness". For example, any number is considered
truthful if it is no... | Counts the number of non-zero values in the array ``a``. | [
"Counts",
"the",
"number",
"of",
"non",
"-",
"zero",
"values",
"in",
"the",
"array",
"a",
"."
] | def count_nonzero(a, axis=None):
"""
Counts the number of non-zero values in the array ``a``.
The word "non-zero" is in reference to the Python 2.x
built-in method ``__nonzero__()`` (renamed ``__bool__()``
in Python 3.x) of Python objects that tests an object's
"truthfulness". For example, any ... | [
"def",
"count_nonzero",
"(",
"a",
",",
"axis",
"=",
"None",
")",
":",
"if",
"axis",
"is",
"None",
":",
"return",
"multiarray",
".",
"count_nonzero",
"(",
"a",
")",
"a",
"=",
"asanyarray",
"(",
"a",
")",
"# TODO: this works around .astype(bool) not working prop... | https://github.com/aws/lumberyard/blob/f85344403c1c2e77ec8c75deb2c116e97b713217/dev/Gems/CloudGemMetric/v1/AWS/common-code/Lib/numpy/core/numeric.py#L403-L462 | |
catboost/catboost | 167f64f237114a4d10b2b4ee42adb4569137debe | contrib/python/attrs/attr/_make.py | python | _setattr | (attr_name, value_var, has_on_setattr) | return "_setattr('%s', %s)" % (attr_name, value_var) | Use the cached object.setattr to set *attr_name* to *value_var*. | Use the cached object.setattr to set *attr_name* to *value_var*. | [
"Use",
"the",
"cached",
"object",
".",
"setattr",
"to",
"set",
"*",
"attr_name",
"*",
"to",
"*",
"value_var",
"*",
"."
] | def _setattr(attr_name, value_var, has_on_setattr):
"""
Use the cached object.setattr to set *attr_name* to *value_var*.
"""
return "_setattr('%s', %s)" % (attr_name, value_var) | [
"def",
"_setattr",
"(",
"attr_name",
",",
"value_var",
",",
"has_on_setattr",
")",
":",
"return",
"\"_setattr('%s', %s)\"",
"%",
"(",
"attr_name",
",",
"value_var",
")"
] | https://github.com/catboost/catboost/blob/167f64f237114a4d10b2b4ee42adb4569137debe/contrib/python/attrs/attr/_make.py#L2074-L2078 | |
tensorflow/tensorflow | 419e3a6b650ea4bd1b0cba23c4348f8a69f3272e | tensorflow/python/ops/metrics_impl.py | python | _num_relevant | (labels, k) | Computes number of relevant values for each row in labels.
For labels with shape [D1, ... DN, num_labels], this is the minimum of
`num_labels` and `k`.
Args:
labels: `int64` `Tensor` or `SparseTensor` with shape
[D1, ... DN, num_labels], where N >= 1 and num_labels is the number of
target classe... | Computes number of relevant values for each row in labels. | [
"Computes",
"number",
"of",
"relevant",
"values",
"for",
"each",
"row",
"in",
"labels",
"."
] | def _num_relevant(labels, k):
"""Computes number of relevant values for each row in labels.
For labels with shape [D1, ... DN, num_labels], this is the minimum of
`num_labels` and `k`.
Args:
labels: `int64` `Tensor` or `SparseTensor` with shape
[D1, ... DN, num_labels], where N >= 1 and num_labels i... | [
"def",
"_num_relevant",
"(",
"labels",
",",
"k",
")",
":",
"if",
"k",
"<",
"1",
":",
"raise",
"ValueError",
"(",
"f'Invalid k={k}'",
")",
"with",
"ops",
".",
"name_scope",
"(",
"None",
",",
"'num_relevant'",
",",
"(",
"labels",
",",
")",
")",
"as",
"... | https://github.com/tensorflow/tensorflow/blob/419e3a6b650ea4bd1b0cba23c4348f8a69f3272e/tensorflow/python/ops/metrics_impl.py#L3144-L3179 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.