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 |
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
facebookincubator/BOLT | 88c70afe9d388ad430cc150cc158641701397f70 | mlir/python/mlir/dialects/_ods_common.py | python | segmented_accessor | (elements, raw_segments, idx) | return elements[start:end] | Returns a slice of elements corresponding to the idx-th segment.
elements: a sliceable container (operands or results).
raw_segments: an mlir.ir.Attribute, of DenseIntElements subclass containing
sizes of the segments.
idx: index of the segment. | Returns a slice of elements corresponding to the idx-th segment. | [
"Returns",
"a",
"slice",
"of",
"elements",
"corresponding",
"to",
"the",
"idx",
"-",
"th",
"segment",
"."
] | def segmented_accessor(elements, raw_segments, idx):
"""
Returns a slice of elements corresponding to the idx-th segment.
elements: a sliceable container (operands or results).
raw_segments: an mlir.ir.Attribute, of DenseIntElements subclass containing
sizes of the segments.
idx: index of the s... | [
"def",
"segmented_accessor",
"(",
"elements",
",",
"raw_segments",
",",
"idx",
")",
":",
"segments",
"=",
"_cext",
".",
"ir",
".",
"DenseIntElementsAttr",
"(",
"raw_segments",
")",
"start",
"=",
"sum",
"(",
"segments",
"[",
"i",
"]",
"for",
"i",
"in",
"r... | https://github.com/facebookincubator/BOLT/blob/88c70afe9d388ad430cc150cc158641701397f70/mlir/python/mlir/dialects/_ods_common.py#L76-L88 | |
mindspore-ai/mindspore | fb8fd3338605bb34fa5cea054e535a8b1d753fab | mindspore/python/mindspore/nn/optim/thor.py | python | ThorAscend._get_second_gradients_one | (self, params_len, gradients, new_grads) | return new_grads | get second gradients one | get second gradients one | [
"get",
"second",
"gradients",
"one"
] | def _get_second_gradients_one(self, params_len, gradients, new_grads):
"""get second gradients one"""
for i in range(params_len):
g = gradients[i]
thor_layer_count = self.weight_fim_idx_map[i]
conv_layer_count = self.weight_conv_idx_map[i]
layer_type = sel... | [
"def",
"_get_second_gradients_one",
"(",
"self",
",",
"params_len",
",",
"gradients",
",",
"new_grads",
")",
":",
"for",
"i",
"in",
"range",
"(",
"params_len",
")",
":",
"g",
"=",
"gradients",
"[",
"i",
"]",
"thor_layer_count",
"=",
"self",
".",
"weight_fi... | https://github.com/mindspore-ai/mindspore/blob/fb8fd3338605bb34fa5cea054e535a8b1d753fab/mindspore/python/mindspore/nn/optim/thor.py#L1107-L1146 | |
microsoft/ivy | 9f3c7ecc0b2383129fdd0953e10890d98d09a82d | ivy/ivy_parser.py | python | p_sequence_lcb_rcb | (p) | sequence : LCB RCB | sequence : LCB RCB | [
"sequence",
":",
"LCB",
"RCB"
] | def p_sequence_lcb_rcb(p):
'sequence : LCB RCB'
p[0] = Sequence()
p[0].lineno = get_lineno(p,1) | [
"def",
"p_sequence_lcb_rcb",
"(",
"p",
")",
":",
"p",
"[",
"0",
"]",
"=",
"Sequence",
"(",
")",
"p",
"[",
"0",
"]",
".",
"lineno",
"=",
"get_lineno",
"(",
"p",
",",
"1",
")"
] | https://github.com/microsoft/ivy/blob/9f3c7ecc0b2383129fdd0953e10890d98d09a82d/ivy/ivy_parser.py#L2050-L2053 | ||
aws/lumberyard | f85344403c1c2e77ec8c75deb2c116e97b713217 | dev/Tools/Python/3.7.10/linux_x64/lib/python3.7/tkinter/__init__.py | python | Text.window_configure | (self, index, cnf=None, **kw) | return self._configure(('window', 'configure', index), cnf, kw) | Configure an embedded window at INDEX. | Configure an embedded window at INDEX. | [
"Configure",
"an",
"embedded",
"window",
"at",
"INDEX",
"."
] | def window_configure(self, index, cnf=None, **kw):
"""Configure an embedded window at INDEX."""
return self._configure(('window', 'configure', index), cnf, kw) | [
"def",
"window_configure",
"(",
"self",
",",
"index",
",",
"cnf",
"=",
"None",
",",
"*",
"*",
"kw",
")",
":",
"return",
"self",
".",
"_configure",
"(",
"(",
"'window'",
",",
"'configure'",
",",
"index",
")",
",",
"cnf",
",",
"kw",
")"
] | https://github.com/aws/lumberyard/blob/f85344403c1c2e77ec8c75deb2c116e97b713217/dev/Tools/Python/3.7.10/linux_x64/lib/python3.7/tkinter/__init__.py#L3415-L3417 | |
idaholab/moose | 9eeebc65e098b4c30f8205fb41591fd5b61eb6ff | python/peacock/Input/BlockInfo.py | python | BlockInfo._orderedNames | (self, first, complete) | return l | Add in elements from the list "complete" to the end
of the "first" if they are not already in "first"
Input:
first[list]: These elements will be first in the returned list
complete[list]: These elements will come after first
Return:
list: The elements in "comp... | Add in elements from the list "complete" to the end
of the "first" if they are not already in "first"
Input:
first[list]: These elements will be first in the returned list
complete[list]: These elements will come after first
Return:
list: The elements in "comp... | [
"Add",
"in",
"elements",
"from",
"the",
"list",
"complete",
"to",
"the",
"end",
"of",
"the",
"first",
"if",
"they",
"are",
"not",
"already",
"in",
"first",
"Input",
":",
"first",
"[",
"list",
"]",
":",
"These",
"elements",
"will",
"be",
"first",
"in",
... | def _orderedNames(self, first, complete):
"""
Add in elements from the list "complete" to the end
of the "first" if they are not already in "first"
Input:
first[list]: These elements will be first in the returned list
complete[list]: These elements will come after... | [
"def",
"_orderedNames",
"(",
"self",
",",
"first",
",",
"complete",
")",
":",
"l",
"=",
"first",
"[",
":",
"]",
"for",
"x",
"in",
"complete",
":",
"if",
"x",
"not",
"in",
"l",
":",
"l",
".",
"append",
"(",
"x",
")",
"return",
"l"
] | https://github.com/idaholab/moose/blob/9eeebc65e098b4c30f8205fb41591fd5b61eb6ff/python/peacock/Input/BlockInfo.py#L420-L434 | |
catboost/catboost | 167f64f237114a4d10b2b4ee42adb4569137debe | contrib/python/pandas/py2/pandas/core/indexes/multi.py | python | MultiIndex.reorder_levels | (self, order) | return MultiIndex(levels=new_levels, codes=new_codes,
names=new_names, verify_integrity=False) | Rearrange levels using input order. May not drop or duplicate levels
Parameters
---------- | Rearrange levels using input order. May not drop or duplicate levels | [
"Rearrange",
"levels",
"using",
"input",
"order",
".",
"May",
"not",
"drop",
"or",
"duplicate",
"levels"
] | def reorder_levels(self, order):
"""
Rearrange levels using input order. May not drop or duplicate levels
Parameters
----------
"""
order = [self._get_level_number(i) for i in order]
if len(order) != self.nlevels:
raise AssertionError('Length of order... | [
"def",
"reorder_levels",
"(",
"self",
",",
"order",
")",
":",
"order",
"=",
"[",
"self",
".",
"_get_level_number",
"(",
"i",
")",
"for",
"i",
"in",
"order",
"]",
"if",
"len",
"(",
"order",
")",
"!=",
"self",
".",
"nlevels",
":",
"raise",
"AssertionEr... | https://github.com/catboost/catboost/blob/167f64f237114a4d10b2b4ee42adb4569137debe/contrib/python/pandas/py2/pandas/core/indexes/multi.py#L1997-L2014 | |
ppwwyyxx/speaker-recognition | 15d7bf32ad4ba2f1543e1287b03f3f2e6791d4dd | src/feature/MFCC.py | python | extract | (fs, signal=None, diff=False, **kwargs) | return ret | accept two argument, or one as a tuple | accept two argument, or one as a tuple | [
"accept",
"two",
"argument",
"or",
"one",
"as",
"a",
"tuple"
] | def extract(fs, signal=None, diff=False, **kwargs):
"""accept two argument, or one as a tuple"""
if signal is None:
assert type(fs) == tuple
fs, signal = fs[0], fs[1]
signal = cast['float'](signal)
ret = get_mfcc_extractor(fs, **kwargs).extract(signal)
if diff:
return diff_fe... | [
"def",
"extract",
"(",
"fs",
",",
"signal",
"=",
"None",
",",
"diff",
"=",
"False",
",",
"*",
"*",
"kwargs",
")",
":",
"if",
"signal",
"is",
"None",
":",
"assert",
"type",
"(",
"fs",
")",
"==",
"tuple",
"fs",
",",
"signal",
"=",
"fs",
"[",
"0",... | https://github.com/ppwwyyxx/speaker-recognition/blob/15d7bf32ad4ba2f1543e1287b03f3f2e6791d4dd/src/feature/MFCC.py#L123-L132 | |
kamyu104/LeetCode-Solutions | 77605708a927ea3b85aee5a479db733938c7c211 | Python/number-of-good-pairs.py | python | Solution.numIdenticalPairs | (self, nums) | return sum(c*(c-1)//2 for c in collections.Counter(nums).itervalues()) | :type nums: List[int]
:rtype: int | :type nums: List[int]
:rtype: int | [
":",
"type",
"nums",
":",
"List",
"[",
"int",
"]",
":",
"rtype",
":",
"int"
] | def numIdenticalPairs(self, nums):
"""
:type nums: List[int]
:rtype: int
"""
return sum(c*(c-1)//2 for c in collections.Counter(nums).itervalues()) | [
"def",
"numIdenticalPairs",
"(",
"self",
",",
"nums",
")",
":",
"return",
"sum",
"(",
"c",
"*",
"(",
"c",
"-",
"1",
")",
"//",
"2",
"for",
"c",
"in",
"collections",
".",
"Counter",
"(",
"nums",
")",
".",
"itervalues",
"(",
")",
")"
] | https://github.com/kamyu104/LeetCode-Solutions/blob/77605708a927ea3b85aee5a479db733938c7c211/Python/number-of-good-pairs.py#L8-L13 | |
wxWidgets/wxPython-Classic | 19571e1ae65f1ac445f5491474121998c97a1bf0 | src/osx_cocoa/dataview.py | python | DataViewListCtrl.SetTextValue | (*args, **kwargs) | return _dataview.DataViewListCtrl_SetTextValue(*args, **kwargs) | SetTextValue(self, String value, unsigned int row, unsigned int col) | SetTextValue(self, String value, unsigned int row, unsigned int col) | [
"SetTextValue",
"(",
"self",
"String",
"value",
"unsigned",
"int",
"row",
"unsigned",
"int",
"col",
")"
] | def SetTextValue(*args, **kwargs):
"""SetTextValue(self, String value, unsigned int row, unsigned int col)"""
return _dataview.DataViewListCtrl_SetTextValue(*args, **kwargs) | [
"def",
"SetTextValue",
"(",
"*",
"args",
",",
"*",
"*",
"kwargs",
")",
":",
"return",
"_dataview",
".",
"DataViewListCtrl_SetTextValue",
"(",
"*",
"args",
",",
"*",
"*",
"kwargs",
")"
] | https://github.com/wxWidgets/wxPython-Classic/blob/19571e1ae65f1ac445f5491474121998c97a1bf0/src/osx_cocoa/dataview.py#L2185-L2187 | |
hfinkel/llvm-project-cxxjit | 91084ef018240bbb8e24235ff5cd8c355a9c1a1e | clang/bindings/python/clang/cindex.py | python | Cursor.get_children | (self) | return iter(children) | Return an iterator for accessing the children of this cursor. | Return an iterator for accessing the children of this cursor. | [
"Return",
"an",
"iterator",
"for",
"accessing",
"the",
"children",
"of",
"this",
"cursor",
"."
] | def get_children(self):
"""Return an iterator for accessing the children of this cursor."""
# FIXME: Expose iteration from CIndex, PR6125.
def visitor(child, parent, children):
# FIXME: Document this assertion in API.
# FIXME: There should just be an isNull method.
... | [
"def",
"get_children",
"(",
"self",
")",
":",
"# FIXME: Expose iteration from CIndex, PR6125.",
"def",
"visitor",
"(",
"child",
",",
"parent",
",",
"children",
")",
":",
"# FIXME: Document this assertion in API.",
"# FIXME: There should just be an isNull method.",
"assert",
"... | https://github.com/hfinkel/llvm-project-cxxjit/blob/91084ef018240bbb8e24235ff5cd8c355a9c1a1e/clang/bindings/python/clang/cindex.py#L1824-L1840 | |
rapidsai/cudf | d5b2448fc69f17509304d594f029d0df56984962 | python/cudf/cudf/core/column_accessor.py | python | ColumnAccessor.select_by_index | (self, index: Any) | return self.__class__(
data, multiindex=self.multiindex, level_names=self.level_names,
) | Return a ColumnAccessor composed of the columns
specified by index.
Parameters
----------
key : integer, integer slice, or list-like of integers
Returns
-------
ColumnAccessor | Return a ColumnAccessor composed of the columns
specified by index. | [
"Return",
"a",
"ColumnAccessor",
"composed",
"of",
"the",
"columns",
"specified",
"by",
"index",
"."
] | def select_by_index(self, index: Any) -> ColumnAccessor:
"""
Return a ColumnAccessor composed of the columns
specified by index.
Parameters
----------
key : integer, integer slice, or list-like of integers
Returns
-------
ColumnAccessor
"... | [
"def",
"select_by_index",
"(",
"self",
",",
"index",
":",
"Any",
")",
"->",
"ColumnAccessor",
":",
"if",
"isinstance",
"(",
"index",
",",
"slice",
")",
":",
"start",
",",
"stop",
",",
"step",
"=",
"index",
".",
"indices",
"(",
"len",
"(",
"self",
"."... | https://github.com/rapidsai/cudf/blob/d5b2448fc69f17509304d594f029d0df56984962/python/cudf/cudf/core/column_accessor.py#L346-L369 | |
aws/lumberyard | f85344403c1c2e77ec8c75deb2c116e97b713217 | dev/Tools/Python/3.7.10/linux_x64/lib/python3.7/dis.py | python | Bytecode.from_traceback | (cls, tb) | return cls(tb.tb_frame.f_code, current_offset=tb.tb_lasti) | Construct a Bytecode from the given traceback | Construct a Bytecode from the given traceback | [
"Construct",
"a",
"Bytecode",
"from",
"the",
"given",
"traceback"
] | def from_traceback(cls, tb):
""" Construct a Bytecode from the given traceback """
while tb.tb_next:
tb = tb.tb_next
return cls(tb.tb_frame.f_code, current_offset=tb.tb_lasti) | [
"def",
"from_traceback",
"(",
"cls",
",",
"tb",
")",
":",
"while",
"tb",
".",
"tb_next",
":",
"tb",
"=",
"tb",
".",
"tb_next",
"return",
"cls",
"(",
"tb",
".",
"tb_frame",
".",
"f_code",
",",
"current_offset",
"=",
"tb",
".",
"tb_lasti",
")"
] | https://github.com/aws/lumberyard/blob/f85344403c1c2e77ec8c75deb2c116e97b713217/dev/Tools/Python/3.7.10/linux_x64/lib/python3.7/dis.py#L494-L498 | |
Xilinx/Vitis-AI | fc74d404563d9951b57245443c73bef389f3657f | tools/Vitis-AI-Quantizer/vai_q_tensorflow1.x/tensorflow/contrib/optimizer_v2/optimizer_v2.py | python | _OptimizerV2State.create_slot | (self, var, val, slot_name, optional_op_name=None) | return named_slots[var_key] | Find or create a slot for a variable.
Args:
var: A `Variable` object.
val: A `Tensor`. The initial value of the slot.
slot_name: Name for the slot.
optional_op_name: Name to use when scoping the Variable that needs to be
created for the slot.
Returns:
A `Variable` object... | Find or create a slot for a variable. | [
"Find",
"or",
"create",
"a",
"slot",
"for",
"a",
"variable",
"."
] | def create_slot(self, var, val, slot_name, optional_op_name=None):
"""Find or create a slot for a variable.
Args:
var: A `Variable` object.
val: A `Tensor`. The initial value of the slot.
slot_name: Name for the slot.
optional_op_name: Name to use when scoping the Variable that needs t... | [
"def",
"create_slot",
"(",
"self",
",",
"var",
",",
"val",
",",
"slot_name",
",",
"optional_op_name",
"=",
"None",
")",
":",
"named_slots",
"=",
"self",
".",
"_slot_dict",
"(",
"slot_name",
")",
"var_key",
"=",
"_var_key_v2",
"(",
"var",
")",
"if",
"var_... | https://github.com/Xilinx/Vitis-AI/blob/fc74d404563d9951b57245443c73bef389f3657f/tools/Vitis-AI-Quantizer/vai_q_tensorflow1.x/tensorflow/contrib/optimizer_v2/optimizer_v2.py#L274-L295 | |
apache/incubator-mxnet | f03fb23f1d103fec9541b5ae59ee06b1734a51d9 | benchmark/opperf/nd_operations/array_manipulation_operators.py | python | run_join_split_operators_benchmarks | (ctx=mx.cpu(), dtype='float32', profiler='native', int64_tensor='off', warmup=25, runs=100) | return mx_join_split_op_results | Runs benchmarks with the given context and precision (dtype) for all the
join & split operators in MXNet.
Parameters
----------
ctx: mx.ctx
Context to run benchmarks
dtype: str, default 'float32'
Precision to use for benchmarks
profiler: str, default 'native'
Type of Pr... | Runs benchmarks with the given context and precision (dtype) for all the
join & split operators in MXNet. | [
"Runs",
"benchmarks",
"with",
"the",
"given",
"context",
"and",
"precision",
"(",
"dtype",
")",
"for",
"all",
"the",
"join",
"&",
"split",
"operators",
"in",
"MXNet",
"."
] | def run_join_split_operators_benchmarks(ctx=mx.cpu(), dtype='float32', profiler='native', int64_tensor='off', warmup=25, runs=100):
"""Runs benchmarks with the given context and precision (dtype) for all the
join & split operators in MXNet.
Parameters
----------
ctx: mx.ctx
Context to run ... | [
"def",
"run_join_split_operators_benchmarks",
"(",
"ctx",
"=",
"mx",
".",
"cpu",
"(",
")",
",",
"dtype",
"=",
"'float32'",
",",
"profiler",
"=",
"'native'",
",",
"int64_tensor",
"=",
"'off'",
",",
"warmup",
"=",
"25",
",",
"runs",
"=",
"100",
")",
":",
... | https://github.com/apache/incubator-mxnet/blob/f03fb23f1d103fec9541b5ae59ee06b1734a51d9/benchmark/opperf/nd_operations/array_manipulation_operators.py#L200-L264 | |
wxWidgets/wxPython-Classic | 19571e1ae65f1ac445f5491474121998c97a1bf0 | src/gtk/xrc.py | python | XmlNode.GetAttributes | (*args, **kwargs) | return _xrc.XmlNode_GetAttributes(*args, **kwargs) | GetAttributes(self) -> XmlProperty | GetAttributes(self) -> XmlProperty | [
"GetAttributes",
"(",
"self",
")",
"-",
">",
"XmlProperty"
] | def GetAttributes(*args, **kwargs):
"""GetAttributes(self) -> XmlProperty"""
return _xrc.XmlNode_GetAttributes(*args, **kwargs) | [
"def",
"GetAttributes",
"(",
"*",
"args",
",",
"*",
"*",
"kwargs",
")",
":",
"return",
"_xrc",
".",
"XmlNode_GetAttributes",
"(",
"*",
"args",
",",
"*",
"*",
"kwargs",
")"
] | https://github.com/wxWidgets/wxPython-Classic/blob/19571e1ae65f1ac445f5491474121998c97a1bf0/src/gtk/xrc.py#L485-L487 | |
google/syzygy | 8164b24ebde9c5649c9a09e88a7fc0b0fcbd1bc5 | third_party/numpy/files/numpy/oldnumeric/ma.py | python | _MaskedPrintOption.set_display | (self, s) | set_display(s) sets what prints for masked values. | set_display(s) sets what prints for masked values. | [
"set_display",
"(",
"s",
")",
"sets",
"what",
"prints",
"for",
"masked",
"values",
"."
] | def set_display (self, s):
"set_display(s) sets what prints for masked values."
self._display = s | [
"def",
"set_display",
"(",
"self",
",",
"s",
")",
":",
"self",
".",
"_display",
"=",
"s"
] | https://github.com/google/syzygy/blob/8164b24ebde9c5649c9a09e88a7fc0b0fcbd1bc5/third_party/numpy/files/numpy/oldnumeric/ma.py#L57-L59 | ||
swift/swift | 12d031cf8177fdec0137f9aa7e2912fa23c4416b | 3rdParty/SCons/scons-3.0.1/engine/SCons/Environment.py | python | OverrideEnvironment._update | (self, dict) | Update an environment's values directly, bypassing the normal
checks that occur when users try to set items. | Update an environment's values directly, bypassing the normal
checks that occur when users try to set items. | [
"Update",
"an",
"environment",
"s",
"values",
"directly",
"bypassing",
"the",
"normal",
"checks",
"that",
"occur",
"when",
"users",
"try",
"to",
"set",
"items",
"."
] | def _update(self, dict):
"""Update an environment's values directly, bypassing the normal
checks that occur when users try to set items.
"""
self.__dict__['overrides'].update(dict) | [
"def",
"_update",
"(",
"self",
",",
"dict",
")",
":",
"self",
".",
"__dict__",
"[",
"'overrides'",
"]",
".",
"update",
"(",
"dict",
")"
] | https://github.com/swift/swift/blob/12d031cf8177fdec0137f9aa7e2912fa23c4416b/3rdParty/SCons/scons-3.0.1/engine/SCons/Environment.py#L2356-L2360 | ||
Ewenwan/MVision | 97b394dfa48cb21c82cd003b1a952745e413a17f | darknect/tensorflow/yolo_v2/decode_output.py | python | decode | (detection_feat, feat_sizes=(13, 13), num_classes=80,
anchors=None) | return bboxes, obj_probs, class_probs | decode from the detection feature | decode from the detection feature | [
"decode",
"from",
"the",
"detection",
"feature"
] | def decode(detection_feat, feat_sizes=(13, 13), num_classes=80,
anchors=None):
"""decode from the detection feature"""
H, W = feat_sizes# 最后 特征图的 尺寸 13*13格子数量
num_anchors = len(anchors)# 每个格子预测的 边框数量
detetion_results = tf.reshape(detection_feat, [-1, H * W, num_anchors,
... | [
"def",
"decode",
"(",
"detection_feat",
",",
"feat_sizes",
"=",
"(",
"13",
",",
"13",
")",
",",
"num_classes",
"=",
"80",
",",
"anchors",
"=",
"None",
")",
":",
"H",
",",
"W",
"=",
"feat_sizes",
"# 最后 特征图的 尺寸 13*13格子数量",
"num_anchors",
"=",
"len",
"(",
... | https://github.com/Ewenwan/MVision/blob/97b394dfa48cb21c82cd003b1a952745e413a17f/darknect/tensorflow/yolo_v2/decode_output.py#L11-L41 | |
yuxng/DA-RNN | 77fbb50b4272514588a10a9f90b7d5f8d46974fb | lib/datasets/factory.py | python | get_imdb | (name) | return __sets[name]() | Get an imdb (image database) by name. | Get an imdb (image database) by name. | [
"Get",
"an",
"imdb",
"(",
"image",
"database",
")",
"by",
"name",
"."
] | def get_imdb(name):
"""Get an imdb (image database) by name."""
if not __sets.has_key(name):
raise KeyError('Unknown dataset: {}'.format(name))
return __sets[name]() | [
"def",
"get_imdb",
"(",
"name",
")",
":",
"if",
"not",
"__sets",
".",
"has_key",
"(",
"name",
")",
":",
"raise",
"KeyError",
"(",
"'Unknown dataset: {}'",
".",
"format",
"(",
"name",
")",
")",
"return",
"__sets",
"[",
"name",
"]",
"(",
")"
] | https://github.com/yuxng/DA-RNN/blob/77fbb50b4272514588a10a9f90b7d5f8d46974fb/lib/datasets/factory.py#L53-L57 | |
mantidproject/mantid | 03deeb89254ec4289edb8771e0188c2090a02f32 | scripts/SANS/sans/algorithm_detail/convert_to_q.py | python | _run_q_2d | (workspace, output_summed_parts, state_convert_to_q,
wavelength_adj_ws, pixel_adj_ws) | This method performs a 2D data reduction on our workspace.
Note that it does not perform any q resolution calculation, nor any wavelength-and-pixel adjustment. The
output workspace contains two numerical axes. | This method performs a 2D data reduction on our workspace. | [
"This",
"method",
"performs",
"a",
"2D",
"data",
"reduction",
"on",
"our",
"workspace",
"."
] | def _run_q_2d(workspace, output_summed_parts, state_convert_to_q,
wavelength_adj_ws, pixel_adj_ws):
"""
This method performs a 2D data reduction on our workspace.
Note that it does not perform any q resolution calculation, nor any wavelength-and-pixel adjustment. The
output workspace cont... | [
"def",
"_run_q_2d",
"(",
"workspace",
",",
"output_summed_parts",
",",
"state_convert_to_q",
",",
"wavelength_adj_ws",
",",
"pixel_adj_ws",
")",
":",
"# Extract relevant settings",
"max_q_xy",
"=",
"state_convert_to_q",
".",
"q_xy_max",
"log_binning",
"=",
"True",
"if",... | https://github.com/mantidproject/mantid/blob/03deeb89254ec4289edb8771e0188c2090a02f32/scripts/SANS/sans/algorithm_detail/convert_to_q.py#L101-L147 | ||
wxWidgets/wxPython-Classic | 19571e1ae65f1ac445f5491474121998c97a1bf0 | src/osx_carbon/stc.py | python | StyledTextCtrl.MarkerDefine | (*args, **kwargs) | return _stc.StyledTextCtrl_MarkerDefine(*args, **kwargs) | MarkerDefine(self, int markerNumber, int markerSymbol, Colour foreground=wxNullColour,
Colour background=wxNullColour)
Set the symbol used for a particular marker number,
and optionally the fore and background colours. | MarkerDefine(self, int markerNumber, int markerSymbol, Colour foreground=wxNullColour,
Colour background=wxNullColour) | [
"MarkerDefine",
"(",
"self",
"int",
"markerNumber",
"int",
"markerSymbol",
"Colour",
"foreground",
"=",
"wxNullColour",
"Colour",
"background",
"=",
"wxNullColour",
")"
] | def MarkerDefine(*args, **kwargs):
"""
MarkerDefine(self, int markerNumber, int markerSymbol, Colour foreground=wxNullColour,
Colour background=wxNullColour)
Set the symbol used for a particular marker number,
and optionally the fore and background colours.
"""
... | [
"def",
"MarkerDefine",
"(",
"*",
"args",
",",
"*",
"*",
"kwargs",
")",
":",
"return",
"_stc",
".",
"StyledTextCtrl_MarkerDefine",
"(",
"*",
"args",
",",
"*",
"*",
"kwargs",
")"
] | https://github.com/wxWidgets/wxPython-Classic/blob/19571e1ae65f1ac445f5491474121998c97a1bf0/src/osx_carbon/stc.py#L2328-L2336 | |
aws/lumberyard | f85344403c1c2e77ec8c75deb2c116e97b713217 | dev/Tools/Python/3.7.10/mac/Python.framework/Versions/3.7/lib/python3.7/tkinter/__init__.py | python | Grid.grid_remove | (self) | Unmap this widget but remember the grid options. | Unmap this widget but remember the grid options. | [
"Unmap",
"this",
"widget",
"but",
"remember",
"the",
"grid",
"options",
"."
] | def grid_remove(self):
"""Unmap this widget but remember the grid options."""
self.tk.call('grid', 'remove', self._w) | [
"def",
"grid_remove",
"(",
"self",
")",
":",
"self",
".",
"tk",
".",
"call",
"(",
"'grid'",
",",
"'remove'",
",",
"self",
".",
"_w",
")"
] | https://github.com/aws/lumberyard/blob/f85344403c1c2e77ec8c75deb2c116e97b713217/dev/Tools/Python/3.7.10/mac/Python.framework/Versions/3.7/lib/python3.7/tkinter/__init__.py#L2234-L2236 | ||
microsoft/CNTK | e9396480025b9ca457d26b6f33dd07c474c6aa04 | bindings/python/cntk/train/distributed.py | python | WorkerDescriptor.global_rank | (self) | return super(WorkerDescriptor, self).m_global_rank | The global rank of the worker. | The global rank of the worker. | [
"The",
"global",
"rank",
"of",
"the",
"worker",
"."
] | def global_rank(self):
'''
The global rank of the worker.
'''
return super(WorkerDescriptor, self).m_global_rank | [
"def",
"global_rank",
"(",
"self",
")",
":",
"return",
"super",
"(",
"WorkerDescriptor",
",",
"self",
")",
".",
"m_global_rank"
] | https://github.com/microsoft/CNTK/blob/e9396480025b9ca457d26b6f33dd07c474c6aa04/bindings/python/cntk/train/distributed.py#L28-L32 | |
mongodb/mongo | d8ff665343ad29cf286ee2cf4a1960d29371937b | buildscripts/resmokelib/run/__init__.py | python | TestRunnerEvg._make_tag_combinations | (cls) | return combinations | Return a list of (tag, enabled) pairs.
These pairs represent all possible combinations of all possible pairings
of whether the tags are enabled or disabled together. | Return a list of (tag, enabled) pairs. | [
"Return",
"a",
"list",
"of",
"(",
"tag",
"enabled",
")",
"pairs",
"."
] | def _make_tag_combinations(cls):
"""Return a list of (tag, enabled) pairs.
These pairs represent all possible combinations of all possible pairings
of whether the tags are enabled or disabled together.
"""
combinations = []
if config.EVERGREEN_PATCH_BUILD:
... | [
"def",
"_make_tag_combinations",
"(",
"cls",
")",
":",
"combinations",
"=",
"[",
"]",
"if",
"config",
".",
"EVERGREEN_PATCH_BUILD",
":",
"combinations",
".",
"append",
"(",
"(",
"\"unreliable and resource intensive\"",
",",
"(",
"(",
"cls",
".",
"UNRELIABLE_TAG",
... | https://github.com/mongodb/mongo/blob/d8ff665343ad29cf286ee2cf4a1960d29371937b/buildscripts/resmokelib/run/__init__.py#L527-L560 | |
aws/lumberyard | f85344403c1c2e77ec8c75deb2c116e97b713217 | dev/Tools/Python/3.7.10/linux_x64/lib/python3.7/site-packages/pip/_internal/vcs/subversion.py | python | Subversion.is_commit_id_equal | (cls, dest, name) | return False | Always assume the versions don't match | Always assume the versions don't match | [
"Always",
"assume",
"the",
"versions",
"don",
"t",
"match"
] | def is_commit_id_equal(cls, dest, name):
"""Always assume the versions don't match"""
return False | [
"def",
"is_commit_id_equal",
"(",
"cls",
",",
"dest",
",",
"name",
")",
":",
"return",
"False"
] | https://github.com/aws/lumberyard/blob/f85344403c1c2e77ec8c75deb2c116e97b713217/dev/Tools/Python/3.7.10/linux_x64/lib/python3.7/site-packages/pip/_internal/vcs/subversion.py#L385-L389 | |
freeorion/freeorion | c266a40eccd3a99a17de8fe57c36ef6ba3771665 | default/python/AI/character/character_module.py | python | Trait.may_dither_focus_to_gain_research | (self) | return True | Return True if permitted to trade production at a loss for research | Return True if permitted to trade production at a loss for research | [
"Return",
"True",
"if",
"permitted",
"to",
"trade",
"production",
"at",
"a",
"loss",
"for",
"research"
] | def may_dither_focus_to_gain_research(self): # pylint: disable=no-self-use,unused-argument
"""Return True if permitted to trade production at a loss for research"""
return True | [
"def",
"may_dither_focus_to_gain_research",
"(",
"self",
")",
":",
"# pylint: disable=no-self-use,unused-argument",
"return",
"True"
] | https://github.com/freeorion/freeorion/blob/c266a40eccd3a99a17de8fe57c36ef6ba3771665/default/python/AI/character/character_module.py#L228-L230 | |
Polidea/SiriusObfuscator | b0e590d8130e97856afe578869b83a209e2b19be | SymbolExtractorAndRenamer/lldb/utils/vim-lldb/python-vim-lldb/vim_panes.py | python | StoppedCommandPane.get_content | (self, target, controller) | return output | Returns the output of a command that relies on the process being stopped.
If the process is not in 'stopped' state, the process status is returned. | Returns the output of a command that relies on the process being stopped.
If the process is not in 'stopped' state, the process status is returned. | [
"Returns",
"the",
"output",
"of",
"a",
"command",
"that",
"relies",
"on",
"the",
"process",
"being",
"stopped",
".",
"If",
"the",
"process",
"is",
"not",
"in",
"stopped",
"state",
"the",
"process",
"status",
"is",
"returned",
"."
] | def get_content(self, target, controller):
""" Returns the output of a command that relies on the process being stopped.
If the process is not in 'stopped' state, the process status is returned.
"""
output = ""
if not target or not target.IsValid():
output = VimPa... | [
"def",
"get_content",
"(",
"self",
",",
"target",
",",
"controller",
")",
":",
"output",
"=",
"\"\"",
"if",
"not",
"target",
"or",
"not",
"target",
".",
"IsValid",
"(",
")",
":",
"output",
"=",
"VimPane",
".",
"MSG_NO_TARGET",
"elif",
"not",
"target",
... | https://github.com/Polidea/SiriusObfuscator/blob/b0e590d8130e97856afe578869b83a209e2b19be/SymbolExtractorAndRenamer/lldb/utils/vim-lldb/python-vim-lldb/vim_panes.py#L571-L585 | |
krishauser/Klampt | 972cc83ea5befac3f653c1ba20f80155768ad519 | Python/klampt/model/workspace.py | python | compute_field_grid | (points : Sequence[Vector3],
values : Sequence[float],
resolution=0.05,
dimensions=None,
bounds=None,
aggregator='max',
initial_value='auto') | return vg | Helper to compute a gridded value field over a set of scattered points.
Args:
points (list of Vector3 or nx3 array): the points
values (list of float): the values at each point
resolution (float, 3-vector, or None): the resolution of the resulting
grid.
dimensions (int o... | Helper to compute a gridded value field over a set of scattered points. | [
"Helper",
"to",
"compute",
"a",
"gridded",
"value",
"field",
"over",
"a",
"set",
"of",
"scattered",
"points",
"."
] | def compute_field_grid(points : Sequence[Vector3],
values : Sequence[float],
resolution=0.05,
dimensions=None,
bounds=None,
aggregator='max',
initial_value='auto') -> VolumeGrid:
... | [
"def",
"compute_field_grid",
"(",
"points",
":",
"Sequence",
"[",
"Vector3",
"]",
",",
"values",
":",
"Sequence",
"[",
"float",
"]",
",",
"resolution",
"=",
"0.05",
",",
"dimensions",
"=",
"None",
",",
"bounds",
"=",
"None",
",",
"aggregator",
"=",
"'max... | https://github.com/krishauser/Klampt/blob/972cc83ea5befac3f653c1ba20f80155768ad519/Python/klampt/model/workspace.py#L109-L249 | |
wxWidgets/wxPython-Classic | 19571e1ae65f1ac445f5491474121998c97a1bf0 | wx/lib/agw/aui/aui_utilities.py | python | MakeGray | (rgbTuple, factor, maskColour) | Make a pixel grayed-out.
If the pixel matches the `maskColour`, it won't be changed.
:param tuple `rgbTuple`: a tuple representing a pixel colour;
:param integer `factor`: a graying-out factor;
:param Colour `maskColour`: a colour mask. | Make a pixel grayed-out. | [
"Make",
"a",
"pixel",
"grayed",
"-",
"out",
"."
] | def MakeGray(rgbTuple, factor, maskColour):
"""
Make a pixel grayed-out.
If the pixel matches the `maskColour`, it won't be changed.
:param tuple `rgbTuple`: a tuple representing a pixel colour;
:param integer `factor`: a graying-out factor;
:param Colour `maskColour`: a colour mask.
"""
... | [
"def",
"MakeGray",
"(",
"rgbTuple",
",",
"factor",
",",
"maskColour",
")",
":",
"if",
"rgbTuple",
"!=",
"maskColour",
":",
"r",
",",
"g",
",",
"b",
"=",
"rgbTuple",
"return",
"map",
"(",
"lambda",
"x",
":",
"int",
"(",
"(",
"230",
"-",
"x",
")",
... | https://github.com/wxWidgets/wxPython-Classic/blob/19571e1ae65f1ac445f5491474121998c97a1bf0/wx/lib/agw/aui/aui_utilities.py#L225-L240 | ||
idaholab/moose | 9eeebc65e098b4c30f8205fb41591fd5b61eb6ff | python/MooseDocs/common/get_content.py | python | get_files | (items, in_ext) | return filenames | Get a list of files to consider given the content configuration. | Get a list of files to consider given the content configuration. | [
"Get",
"a",
"list",
"of",
"files",
"to",
"consider",
"given",
"the",
"content",
"configuration",
"."
] | def get_files(items, in_ext):
"""
Get a list of files to consider given the content configuration.
"""
filenames = []
for value in items:
if 'root_dir' not in value:
LOG.error('The supplied items must be a list of dict items, each with a "root_dir" and '
'o... | [
"def",
"get_files",
"(",
"items",
",",
"in_ext",
")",
":",
"filenames",
"=",
"[",
"]",
"for",
"value",
"in",
"items",
":",
"if",
"'root_dir'",
"not",
"in",
"value",
":",
"LOG",
".",
"error",
"(",
"'The supplied items must be a list of dict items, each with a \"r... | https://github.com/idaholab/moose/blob/9eeebc65e098b4c30f8205fb41591fd5b61eb6ff/python/MooseDocs/common/get_content.py#L132-L150 | |
wxWidgets/wxPython-Classic | 19571e1ae65f1ac445f5491474121998c97a1bf0 | src/osx_carbon/_gdi.py | python | IconLocation.__init__ | (self, *args, **kwargs) | __init__(self, String filename=&wxPyEmptyString, int num=0) -> IconLocation | __init__(self, String filename=&wxPyEmptyString, int num=0) -> IconLocation | [
"__init__",
"(",
"self",
"String",
"filename",
"=",
"&wxPyEmptyString",
"int",
"num",
"=",
"0",
")",
"-",
">",
"IconLocation"
] | def __init__(self, *args, **kwargs):
"""__init__(self, String filename=&wxPyEmptyString, int num=0) -> IconLocation"""
_gdi_.IconLocation_swiginit(self,_gdi_.new_IconLocation(*args, **kwargs)) | [
"def",
"__init__",
"(",
"self",
",",
"*",
"args",
",",
"*",
"*",
"kwargs",
")",
":",
"_gdi_",
".",
"IconLocation_swiginit",
"(",
"self",
",",
"_gdi_",
".",
"new_IconLocation",
"(",
"*",
"args",
",",
"*",
"*",
"kwargs",
")",
")"
] | https://github.com/wxWidgets/wxPython-Classic/blob/19571e1ae65f1ac445f5491474121998c97a1bf0/src/osx_carbon/_gdi.py#L1346-L1348 | ||
apache/incubator-mxnet | f03fb23f1d103fec9541b5ae59ee06b1734a51d9 | python/mxnet/symbol/numpy/_symbol.py | python | pad | (x, pad_width, mode='constant', **kwargs) | return _npi.pad(x, pad_width, mode='constant', constant_values=0) | Pad an array.
Parameters
----------
array : array_like of rank N
The array to pad.
pad_width : {sequence, array_like, int}
Number of values padded to the edges of each axis.
((before_1, after_1), ... (before_N, after_N)) unique pad widths
for each axis.
((before,... | Pad an array. | [
"Pad",
"an",
"array",
"."
] | def pad(x, pad_width, mode='constant', **kwargs): # pylint: disable=too-many-arguments
"""
Pad an array.
Parameters
----------
array : array_like of rank N
The array to pad.
pad_width : {sequence, array_like, int}
Number of values padded to the edges of each axis.
((befo... | [
"def",
"pad",
"(",
"x",
",",
"pad_width",
",",
"mode",
"=",
"'constant'",
",",
"*",
"*",
"kwargs",
")",
":",
"# pylint: disable=too-many-arguments",
"# pylint: disable = too-many-return-statements, inconsistent-return-statements",
"if",
"not",
"_np",
".",
"asarray",
"("... | https://github.com/apache/incubator-mxnet/blob/f03fb23f1d103fec9541b5ae59ee06b1734a51d9/python/mxnet/symbol/numpy/_symbol.py#L7743-L7873 | |
wxWidgets/wxPython-Classic | 19571e1ae65f1ac445f5491474121998c97a1bf0 | src/gtk/_controls.py | python | ListItem.GetData | (*args, **kwargs) | return _controls_.ListItem_GetData(*args, **kwargs) | GetData(self) -> long | GetData(self) -> long | [
"GetData",
"(",
"self",
")",
"-",
">",
"long"
] | def GetData(*args, **kwargs):
"""GetData(self) -> long"""
return _controls_.ListItem_GetData(*args, **kwargs) | [
"def",
"GetData",
"(",
"*",
"args",
",",
"*",
"*",
"kwargs",
")",
":",
"return",
"_controls_",
".",
"ListItem_GetData",
"(",
"*",
"args",
",",
"*",
"*",
"kwargs",
")"
] | https://github.com/wxWidgets/wxPython-Classic/blob/19571e1ae65f1ac445f5491474121998c97a1bf0/src/gtk/_controls.py#L4236-L4238 | |
wxWidgets/wxPython-Classic | 19571e1ae65f1ac445f5491474121998c97a1bf0 | src/osx_carbon/_controls.py | python | ToggleButton.GetValue | (*args, **kwargs) | return _controls_.ToggleButton_GetValue(*args, **kwargs) | GetValue(self) -> bool | GetValue(self) -> bool | [
"GetValue",
"(",
"self",
")",
"-",
">",
"bool"
] | def GetValue(*args, **kwargs):
"""GetValue(self) -> bool"""
return _controls_.ToggleButton_GetValue(*args, **kwargs) | [
"def",
"GetValue",
"(",
"*",
"args",
",",
"*",
"*",
"kwargs",
")",
":",
"return",
"_controls_",
".",
"ToggleButton_GetValue",
"(",
"*",
"args",
",",
"*",
"*",
"kwargs",
")"
] | https://github.com/wxWidgets/wxPython-Classic/blob/19571e1ae65f1ac445f5491474121998c97a1bf0/src/osx_carbon/_controls.py#L3011-L3013 | |
eventql/eventql | 7ca0dbb2e683b525620ea30dc40540a22d5eb227 | deps/3rdparty/spidermonkey/mozjs/python/psutil/psutil/_pslinux.py | python | users | () | return retlist | Return currently connected users as a list of namedtuples. | Return currently connected users as a list of namedtuples. | [
"Return",
"currently",
"connected",
"users",
"as",
"a",
"list",
"of",
"namedtuples",
"."
] | def users():
"""Return currently connected users as a list of namedtuples."""
retlist = []
rawlist = cext.users()
for item in rawlist:
user, tty, hostname, tstamp, user_process = item
# note: the underlying C function includes entries about
# system boot, run level and others. W... | [
"def",
"users",
"(",
")",
":",
"retlist",
"=",
"[",
"]",
"rawlist",
"=",
"cext",
".",
"users",
"(",
")",
"for",
"item",
"in",
"rawlist",
":",
"user",
",",
"tty",
",",
"hostname",
",",
"tstamp",
",",
"user_process",
"=",
"item",
"# note: the underlying ... | https://github.com/eventql/eventql/blob/7ca0dbb2e683b525620ea30dc40540a22d5eb227/deps/3rdparty/spidermonkey/mozjs/python/psutil/psutil/_pslinux.py#L314-L329 | |
wlanjie/AndroidFFmpeg | 7baf9122f4b8e1c74e7baf4be5c422c7a5ba5aaf | tools/fdk-aac-build/armeabi/toolchain/lib/python2.7/webbrowser.py | python | get | (using=None) | Return a browser launcher instance appropriate for the environment. | Return a browser launcher instance appropriate for the environment. | [
"Return",
"a",
"browser",
"launcher",
"instance",
"appropriate",
"for",
"the",
"environment",
"."
] | def get(using=None):
"""Return a browser launcher instance appropriate for the environment."""
if using is not None:
alternatives = [using]
else:
alternatives = _tryorder
for browser in alternatives:
if '%s' in browser:
# User gave us a command line, split it into nam... | [
"def",
"get",
"(",
"using",
"=",
"None",
")",
":",
"if",
"using",
"is",
"not",
"None",
":",
"alternatives",
"=",
"[",
"using",
"]",
"else",
":",
"alternatives",
"=",
"_tryorder",
"for",
"browser",
"in",
"alternatives",
":",
"if",
"'%s'",
"in",
"browser... | https://github.com/wlanjie/AndroidFFmpeg/blob/7baf9122f4b8e1c74e7baf4be5c422c7a5ba5aaf/tools/fdk-aac-build/armeabi/toolchain/lib/python2.7/webbrowser.py#L28-L52 | ||
quantOS-org/DataCore | e2ef9bd2c22ee9e2845675b6435a14fa607f3551 | dataserver/api/py/data_api.py | python | DataApi.unsubscribe | (self, symbol) | Unsubscribe securities.
Unscribe codes and return list of subscribed code. | Unsubscribe securities. | [
"Unsubscribe",
"securities",
"."
] | def unsubscribe(self, symbol):
"""Unsubscribe securities.
Unscribe codes and return list of subscribed code.
"""
assert False, "NOT IMPLEMENTED" | [
"def",
"unsubscribe",
"(",
"self",
",",
"symbol",
")",
":",
"assert",
"False",
",",
"\"NOT IMPLEMENTED\""
] | https://github.com/quantOS-org/DataCore/blob/e2ef9bd2c22ee9e2845675b6435a14fa607f3551/dataserver/api/py/data_api.py#L422-L427 | ||
LiquidPlayer/LiquidCore | 9405979363f2353ac9a71ad8ab59685dd7f919c9 | deps/node-10.15.3/configure.py | python | host_arch_cc | () | return rtn | Host architecture check using the CC command. | Host architecture check using the CC command. | [
"Host",
"architecture",
"check",
"using",
"the",
"CC",
"command",
"."
] | def host_arch_cc():
"""Host architecture check using the CC command."""
if sys.platform.startswith('aix'):
# we only support gcc at this point and the default on AIX
# would be xlc so hard code gcc
k = cc_macros('gcc')
else:
k = cc_macros(os.environ.get('CC_host'))
matchup = {
'__aarch64__... | [
"def",
"host_arch_cc",
"(",
")",
":",
"if",
"sys",
".",
"platform",
".",
"startswith",
"(",
"'aix'",
")",
":",
"# we only support gcc at this point and the default on AIX",
"# would be xlc so hard code gcc",
"k",
"=",
"cc_macros",
"(",
"'gcc'",
")",
"else",
":",
"k"... | https://github.com/LiquidPlayer/LiquidCore/blob/9405979363f2353ac9a71ad8ab59685dd7f919c9/deps/node-10.15.3/configure.py#L834-L868 | |
wxWidgets/wxPython-Classic | 19571e1ae65f1ac445f5491474121998c97a1bf0 | wx/tools/Editra/src/eclib/infodlg.py | python | FileInfoDlg.SetFileTypeLabel | (self, lbl) | Set the file type label
@param lbl: string | Set the file type label
@param lbl: string | [
"Set",
"the",
"file",
"type",
"label",
"@param",
"lbl",
":",
"string"
] | def SetFileTypeLabel(self, lbl):
"""Set the file type label
@param lbl: string
"""
self._ftype = lbl
self._ftxt.SetLabel(lbl)
self.panel.Layout() | [
"def",
"SetFileTypeLabel",
"(",
"self",
",",
"lbl",
")",
":",
"self",
".",
"_ftype",
"=",
"lbl",
"self",
".",
"_ftxt",
".",
"SetLabel",
"(",
"lbl",
")",
"self",
".",
"panel",
".",
"Layout",
"(",
")"
] | https://github.com/wxWidgets/wxPython-Classic/blob/19571e1ae65f1ac445f5491474121998c97a1bf0/wx/tools/Editra/src/eclib/infodlg.py#L254-L261 | ||
NVIDIA/DALI | bf16cc86ba8f091b145f91962f21fe1b6aff243d | docs/examples/frameworks/mxnet/demo/common/fit.py | python | add_fit_args | (parser) | return train | parser : argparse.ArgumentParser
return a parser added with args required by fit | parser : argparse.ArgumentParser
return a parser added with args required by fit | [
"parser",
":",
"argparse",
".",
"ArgumentParser",
"return",
"a",
"parser",
"added",
"with",
"args",
"required",
"by",
"fit"
] | def add_fit_args(parser):
"""
parser : argparse.ArgumentParser
return a parser added with args required by fit
"""
train = parser.add_argument_group('Training', 'model training')
train.add_argument('--network', type=str,
help='the neural network to use')
train.add_argu... | [
"def",
"add_fit_args",
"(",
"parser",
")",
":",
"train",
"=",
"parser",
".",
"add_argument_group",
"(",
"'Training'",
",",
"'model training'",
")",
"train",
".",
"add_argument",
"(",
"'--network'",
",",
"type",
"=",
"str",
",",
"help",
"=",
"'the neural networ... | https://github.com/NVIDIA/DALI/blob/bf16cc86ba8f091b145f91962f21fe1b6aff243d/docs/examples/frameworks/mxnet/demo/common/fit.py#L77-L138 | |
microsoft/TSS.MSR | 0f2516fca2cd9929c31d5450e39301c9bde43688 | TSS.Py/src/TpmTypes.py | python | TPMS_TAGGED_PROPERTY.initFromTpm | (self, buf) | TpmMarshaller method | TpmMarshaller method | [
"TpmMarshaller",
"method"
] | def initFromTpm(self, buf):
""" TpmMarshaller method """
self.property = buf.readInt()
self.value = buf.readInt() | [
"def",
"initFromTpm",
"(",
"self",
",",
"buf",
")",
":",
"self",
".",
"property",
"=",
"buf",
".",
"readInt",
"(",
")",
"self",
".",
"value",
"=",
"buf",
".",
"readInt",
"(",
")"
] | https://github.com/microsoft/TSS.MSR/blob/0f2516fca2cd9929c31d5450e39301c9bde43688/TSS.Py/src/TpmTypes.py#L4310-L4313 | ||
wxWidgets/wxPython-Classic | 19571e1ae65f1ac445f5491474121998c97a1bf0 | src/osx_carbon/_core.py | python | MouseState.SetRightDown | (*args, **kwargs) | return _core_.MouseState_SetRightDown(*args, **kwargs) | SetRightDown(self, bool down) | SetRightDown(self, bool down) | [
"SetRightDown",
"(",
"self",
"bool",
"down",
")"
] | def SetRightDown(*args, **kwargs):
"""SetRightDown(self, bool down)"""
return _core_.MouseState_SetRightDown(*args, **kwargs) | [
"def",
"SetRightDown",
"(",
"*",
"args",
",",
"*",
"*",
"kwargs",
")",
":",
"return",
"_core_",
".",
"MouseState_SetRightDown",
"(",
"*",
"args",
",",
"*",
"*",
"kwargs",
")"
] | https://github.com/wxWidgets/wxPython-Classic/blob/19571e1ae65f1ac445f5491474121998c97a1bf0/src/osx_carbon/_core.py#L4502-L4504 | |
aws/lumberyard | f85344403c1c2e77ec8c75deb2c116e97b713217 | dev/Tools/Python/3.7.10/windows/Lib/distutils/dist.py | python | Distribution.reinitialize_command | (self, command, reinit_subcommands=0) | return command | Reinitializes a command to the state it was in when first
returned by 'get_command_obj()': ie., initialized but not yet
finalized. This provides the opportunity to sneak option
values in programmatically, overriding or supplementing
user-supplied values from the config files and command... | Reinitializes a command to the state it was in when first
returned by 'get_command_obj()': ie., initialized but not yet
finalized. This provides the opportunity to sneak option
values in programmatically, overriding or supplementing
user-supplied values from the config files and command... | [
"Reinitializes",
"a",
"command",
"to",
"the",
"state",
"it",
"was",
"in",
"when",
"first",
"returned",
"by",
"get_command_obj",
"()",
":",
"ie",
".",
"initialized",
"but",
"not",
"yet",
"finalized",
".",
"This",
"provides",
"the",
"opportunity",
"to",
"sneak... | def reinitialize_command(self, command, reinit_subcommands=0):
"""Reinitializes a command to the state it was in when first
returned by 'get_command_obj()': ie., initialized but not yet
finalized. This provides the opportunity to sneak option
values in programmatically, overriding or su... | [
"def",
"reinitialize_command",
"(",
"self",
",",
"command",
",",
"reinit_subcommands",
"=",
"0",
")",
":",
"from",
"distutils",
".",
"cmd",
"import",
"Command",
"if",
"not",
"isinstance",
"(",
"command",
",",
"Command",
")",
":",
"command_name",
"=",
"comman... | https://github.com/aws/lumberyard/blob/f85344403c1c2e77ec8c75deb2c116e97b713217/dev/Tools/Python/3.7.10/windows/Lib/distutils/dist.py#L916-L953 | |
cvmfs/cvmfs | 4637bdb5153178eadf885c1acf37bdc5c685bf8a | cpplint.py | python | NestingState.InAsmBlock | (self) | return self.stack and self.stack[-1].inline_asm != _NO_ASM | Check if we are currently one level inside an inline ASM block.
Returns:
True if the top of the stack is a block containing inline ASM. | Check if we are currently one level inside an inline ASM block. | [
"Check",
"if",
"we",
"are",
"currently",
"one",
"level",
"inside",
"an",
"inline",
"ASM",
"block",
"."
] | def InAsmBlock(self):
"""Check if we are currently one level inside an inline ASM block.
Returns:
True if the top of the stack is a block containing inline ASM.
"""
return self.stack and self.stack[-1].inline_asm != _NO_ASM | [
"def",
"InAsmBlock",
"(",
"self",
")",
":",
"return",
"self",
".",
"stack",
"and",
"self",
".",
"stack",
"[",
"-",
"1",
"]",
".",
"inline_asm",
"!=",
"_NO_ASM"
] | https://github.com/cvmfs/cvmfs/blob/4637bdb5153178eadf885c1acf37bdc5c685bf8a/cpplint.py#L2258-L2264 | |
hanpfei/chromium-net | 392cc1fa3a8f92f42e4071ab6e674d8e0482f83f | third_party/catapult/telemetry/telemetry/internal/image_processing/screen_finder.py | python | ScreenFinder._DeDupCorners | (self, corner_data, corners) | De-duplicate corners based on corner_index.
For each set of points representing a corner: If one point is part of the
rectangle and the other is not, filter the other one. If both or none are
part of the rectangle, filter based on score (highest relative brightness
of a quadrant). The reason we allow f... | De-duplicate corners based on corner_index. | [
"De",
"-",
"duplicate",
"corners",
"based",
"on",
"corner_index",
"."
] | def _DeDupCorners(self, corner_data, corners):
"""De-duplicate corners based on corner_index.
For each set of points representing a corner: If one point is part of the
rectangle and the other is not, filter the other one. If both or none are
part of the rectangle, filter based on score (highest relativ... | [
"def",
"_DeDupCorners",
"(",
"self",
",",
"corner_data",
",",
"corners",
")",
":",
"# TODO(mthiesse): Ensure that the corners form a sensible rectangle. For",
"# example, it is currently possible (but unlikely) to detect a 'screen'",
"# where the bottom-left corner is above the top-left corn... | https://github.com/hanpfei/chromium-net/blob/392cc1fa3a8f92f42e4071ab6e674d8e0482f83f/third_party/catapult/telemetry/telemetry/internal/image_processing/screen_finder.py#L518-L568 | ||
PaddlePaddle/Anakin | 5fd68a6cc4c4620cd1a30794c1bf06eebd3f4730 | tools/external_converter_v2/parser/onnx/onnx_trans_utils.py | python | parse_Lrn | (onnx_node, weights, graph) | parse LRN
:param onnx_node:
:param weights:
:param graph:
:return: | parse LRN
:param onnx_node:
:param weights:
:param graph:
:return: | [
"parse",
"LRN",
":",
"param",
"onnx_node",
":",
":",
"param",
"weights",
":",
":",
"param",
"graph",
":",
":",
"return",
":"
] | def parse_Lrn(onnx_node, weights, graph):
"""
parse LRN
:param onnx_node:
:param weights:
:param graph:
:return:
"""
onnx_node['visited'] = True
onnx_node['ak_type'] = 'LRN'
ak_attr = onnx_node['ak_attr']
onnx_attr = onnx_node['onnx_attr']
local_size = 0
if 'size' in ... | [
"def",
"parse_Lrn",
"(",
"onnx_node",
",",
"weights",
",",
"graph",
")",
":",
"onnx_node",
"[",
"'visited'",
"]",
"=",
"True",
"onnx_node",
"[",
"'ak_type'",
"]",
"=",
"'LRN'",
"ak_attr",
"=",
"onnx_node",
"[",
"'ak_attr'",
"]",
"onnx_attr",
"=",
"onnx_nod... | https://github.com/PaddlePaddle/Anakin/blob/5fd68a6cc4c4620cd1a30794c1bf06eebd3f4730/tools/external_converter_v2/parser/onnx/onnx_trans_utils.py#L1194-L1221 | ||
windystrife/UnrealEngine_NVIDIAGameWorks | b50e6338a7c5b26374d66306ebc7807541ff815e | Engine/Extras/ThirdPartyNotUE/emsdk/Win64/python/2.7.5.3_64bit/Lib/lib2to3/pytree.py | python | LeafPattern.match | (self, node, results=None) | return BasePattern.match(self, node, results) | Override match() to insist on a leaf node. | Override match() to insist on a leaf node. | [
"Override",
"match",
"()",
"to",
"insist",
"on",
"a",
"leaf",
"node",
"."
] | def match(self, node, results=None):
"""Override match() to insist on a leaf node."""
if not isinstance(node, Leaf):
return False
return BasePattern.match(self, node, results) | [
"def",
"match",
"(",
"self",
",",
"node",
",",
"results",
"=",
"None",
")",
":",
"if",
"not",
"isinstance",
"(",
"node",
",",
"Leaf",
")",
":",
"return",
"False",
"return",
"BasePattern",
".",
"match",
"(",
"self",
",",
"node",
",",
"results",
")"
] | https://github.com/windystrife/UnrealEngine_NVIDIAGameWorks/blob/b50e6338a7c5b26374d66306ebc7807541ff815e/Engine/Extras/ThirdPartyNotUE/emsdk/Win64/python/2.7.5.3_64bit/Lib/lib2to3/pytree.py#L556-L560 | |
ricardoquesada/Spidermonkey | 4a75ea2543408bd1b2c515aa95901523eeef7858 | python/psutil/psutil/_psmswindows.py | python | disk_partitions | (all) | return [nt_partition(*x) for x in rawlist] | Return disk partitions. | Return disk partitions. | [
"Return",
"disk",
"partitions",
"."
] | def disk_partitions(all):
"""Return disk partitions."""
rawlist = _psutil_mswindows.get_disk_partitions(all)
return [nt_partition(*x) for x in rawlist] | [
"def",
"disk_partitions",
"(",
"all",
")",
":",
"rawlist",
"=",
"_psutil_mswindows",
".",
"get_disk_partitions",
"(",
"all",
")",
"return",
"[",
"nt_partition",
"(",
"*",
"x",
")",
"for",
"x",
"in",
"rawlist",
"]"
] | https://github.com/ricardoquesada/Spidermonkey/blob/4a75ea2543408bd1b2c515aa95901523eeef7858/python/psutil/psutil/_psmswindows.py#L139-L142 | |
aws/lumberyard | f85344403c1c2e77ec8c75deb2c116e97b713217 | dev/Gems/CloudGemMetric/v1/AWS/python/windows/Lib/pandas/core/arrays/categorical.py | python | Categorical.shift | (self, periods, fill_value=None) | return self.from_codes(codes, dtype=self.dtype) | Shift Categorical by desired number of periods.
Parameters
----------
periods : int
Number of periods to move, can be positive or negative
fill_value : object, optional
The scalar value to use for newly introduced missing values.
.. versionadded:: 0.... | Shift Categorical by desired number of periods. | [
"Shift",
"Categorical",
"by",
"desired",
"number",
"of",
"periods",
"."
] | def shift(self, periods, fill_value=None):
"""
Shift Categorical by desired number of periods.
Parameters
----------
periods : int
Number of periods to move, can be positive or negative
fill_value : object, optional
The scalar value to use for new... | [
"def",
"shift",
"(",
"self",
",",
"periods",
",",
"fill_value",
"=",
"None",
")",
":",
"# since categoricals always have ndim == 1, an axis parameter",
"# doesn't make any sense here.",
"codes",
"=",
"self",
".",
"codes",
"if",
"codes",
".",
"ndim",
">",
"1",
":",
... | https://github.com/aws/lumberyard/blob/f85344403c1c2e77ec8c75deb2c116e97b713217/dev/Gems/CloudGemMetric/v1/AWS/python/windows/Lib/pandas/core/arrays/categorical.py#L1233-L1271 | |
mongodb/mongo | d8ff665343ad29cf286ee2cf4a1960d29371937b | buildscripts/resmokelib/logging/buildlogger.py | python | BuildloggerServer.get_test_handler | (self, build_id, test_id, handler_info) | return BuildloggerTestHandler(self.config, build_id, test_id, **handler_info) | Return the test handler. | Return the test handler. | [
"Return",
"the",
"test",
"handler",
"."
] | def get_test_handler(self, build_id, test_id, handler_info):
"""Return the test handler."""
return BuildloggerTestHandler(self.config, build_id, test_id, **handler_info) | [
"def",
"get_test_handler",
"(",
"self",
",",
"build_id",
",",
"test_id",
",",
"handler_info",
")",
":",
"return",
"BuildloggerTestHandler",
"(",
"self",
".",
"config",
",",
"build_id",
",",
"test_id",
",",
"*",
"*",
"handler_info",
")"
] | https://github.com/mongodb/mongo/blob/d8ff665343ad29cf286ee2cf4a1960d29371937b/buildscripts/resmokelib/logging/buildlogger.py#L324-L326 | |
benoitsteiner/tensorflow-opencl | cb7cb40a57fde5cfd4731bc551e82a1e2fef43a5 | tensorflow/contrib/solvers/python/ops/util.py | python | create_operator | (matrix) | return linear_operator(
shape=shape,
dtype=matrix.dtype,
apply=lambda v: math_ops.matmul(matrix, v, adjoint_a=False),
apply_adjoint=lambda v: math_ops.matmul(matrix, v, adjoint_a=True)) | Creates a linear operator from a rank-2 tensor. | Creates a linear operator from a rank-2 tensor. | [
"Creates",
"a",
"linear",
"operator",
"from",
"a",
"rank",
"-",
"2",
"tensor",
"."
] | def create_operator(matrix):
"""Creates a linear operator from a rank-2 tensor."""
linear_operator = collections.namedtuple(
"LinearOperator", ["shape", "dtype", "apply", "apply_adjoint"])
# TODO(rmlarsen): Handle SparseTensor.
shape = matrix.get_shape()
if shape.is_fully_defined():
shape = shape.... | [
"def",
"create_operator",
"(",
"matrix",
")",
":",
"linear_operator",
"=",
"collections",
".",
"namedtuple",
"(",
"\"LinearOperator\"",
",",
"[",
"\"shape\"",
",",
"\"dtype\"",
",",
"\"apply\"",
",",
"\"apply_adjoint\"",
"]",
")",
"# TODO(rmlarsen): Handle SparseTenso... | https://github.com/benoitsteiner/tensorflow-opencl/blob/cb7cb40a57fde5cfd4731bc551e82a1e2fef43a5/tensorflow/contrib/solvers/python/ops/util.py#L29-L45 | |
catboost/catboost | 167f64f237114a4d10b2b4ee42adb4569137debe | contrib/tools/python/src/Lib/subprocess.py | python | check_call | (*popenargs, **kwargs) | return 0 | Run command with arguments. Wait for command to complete. If
the exit code was zero then return, otherwise raise
CalledProcessError. The CalledProcessError object will have the
return code in the returncode attribute.
The arguments are the same as for the Popen constructor. Example:
check_call... | Run command with arguments. Wait for command to complete. If
the exit code was zero then return, otherwise raise
CalledProcessError. The CalledProcessError object will have the
return code in the returncode attribute. | [
"Run",
"command",
"with",
"arguments",
".",
"Wait",
"for",
"command",
"to",
"complete",
".",
"If",
"the",
"exit",
"code",
"was",
"zero",
"then",
"return",
"otherwise",
"raise",
"CalledProcessError",
".",
"The",
"CalledProcessError",
"object",
"will",
"have",
"... | def check_call(*popenargs, **kwargs):
"""Run command with arguments. Wait for command to complete. If
the exit code was zero then return, otherwise raise
CalledProcessError. The CalledProcessError object will have the
return code in the returncode attribute.
The arguments are the same as for the... | [
"def",
"check_call",
"(",
"*",
"popenargs",
",",
"*",
"*",
"kwargs",
")",
":",
"retcode",
"=",
"call",
"(",
"*",
"popenargs",
",",
"*",
"*",
"kwargs",
")",
"if",
"retcode",
":",
"cmd",
"=",
"kwargs",
".",
"get",
"(",
"\"args\"",
")",
"if",
"cmd",
... | https://github.com/catboost/catboost/blob/167f64f237114a4d10b2b4ee42adb4569137debe/contrib/tools/python/src/Lib/subprocess.py#L175-L191 | |
catboost/catboost | 167f64f237114a4d10b2b4ee42adb4569137debe | contrib/python/scipy/scipy/signal/ltisys.py | python | TransferFunction._zinv_to_z | (num, den) | return num, den | Change a transfer function from the variable `z` to `z**-1`.
Parameters
----------
num, den: 1d array_like
Sequences representing the coefficients of the numerator and
denominator polynomials, in order of ascending degree of 'z**-1'.
That is, ``5 + 3 z**-1 + ... | Change a transfer function from the variable `z` to `z**-1`. | [
"Change",
"a",
"transfer",
"function",
"from",
"the",
"variable",
"z",
"to",
"z",
"**",
"-",
"1",
"."
] | def _zinv_to_z(num, den):
"""Change a transfer function from the variable `z` to `z**-1`.
Parameters
----------
num, den: 1d array_like
Sequences representing the coefficients of the numerator and
denominator polynomials, in order of ascending degree of 'z**-1'.
... | [
"def",
"_zinv_to_z",
"(",
"num",
",",
"den",
")",
":",
"diff",
"=",
"len",
"(",
"num",
")",
"-",
"len",
"(",
"den",
")",
"if",
"diff",
">",
"0",
":",
"den",
"=",
"np",
".",
"hstack",
"(",
"(",
"den",
",",
"np",
".",
"zeros",
"(",
"diff",
")... | https://github.com/catboost/catboost/blob/167f64f237114a4d10b2b4ee42adb4569137debe/contrib/python/scipy/scipy/signal/ltisys.py#L874-L896 | |
wxWidgets/wxPython-Classic | 19571e1ae65f1ac445f5491474121998c97a1bf0 | src/msw/html.py | python | HtmlRenderingStyle.GetSelectedTextBgColour | (*args, **kwargs) | return _html.HtmlRenderingStyle_GetSelectedTextBgColour(*args, **kwargs) | GetSelectedTextBgColour(self, Colour clr) -> Colour | GetSelectedTextBgColour(self, Colour clr) -> Colour | [
"GetSelectedTextBgColour",
"(",
"self",
"Colour",
"clr",
")",
"-",
">",
"Colour"
] | def GetSelectedTextBgColour(*args, **kwargs):
"""GetSelectedTextBgColour(self, Colour clr) -> Colour"""
return _html.HtmlRenderingStyle_GetSelectedTextBgColour(*args, **kwargs) | [
"def",
"GetSelectedTextBgColour",
"(",
"*",
"args",
",",
"*",
"*",
"kwargs",
")",
":",
"return",
"_html",
".",
"HtmlRenderingStyle_GetSelectedTextBgColour",
"(",
"*",
"args",
",",
"*",
"*",
"kwargs",
")"
] | https://github.com/wxWidgets/wxPython-Classic/blob/19571e1ae65f1ac445f5491474121998c97a1bf0/src/msw/html.py#L547-L549 | |
pytorch/pytorch | 7176c92687d3cc847cc046bf002269c6949a21c2 | torch/distributed/optim/zero_redundancy_optimizer.py | python | ZeroRedundancyOptimizer._build_param_buckets | (self) | r"""
Builds parameter buckets if ``parameters_as_bucket_view=True`` so
that for each device that stores this rank's parameters, there is a
bucket (represented as a tensor) containing all of the parameters on
that device that are assigned to a given rank in the parameter update
pa... | r"""
Builds parameter buckets if ``parameters_as_bucket_view=True`` so
that for each device that stores this rank's parameters, there is a
bucket (represented as a tensor) containing all of the parameters on
that device that are assigned to a given rank in the parameter update
pa... | [
"r",
"Builds",
"parameter",
"buckets",
"if",
"parameters_as_bucket_view",
"=",
"True",
"so",
"that",
"for",
"each",
"device",
"that",
"stores",
"this",
"rank",
"s",
"parameters",
"there",
"is",
"a",
"bucket",
"(",
"represented",
"as",
"a",
"tensor",
")",
"co... | def _build_param_buckets(self) -> None:
r"""
Builds parameter buckets if ``parameters_as_bucket_view=True`` so
that for each device that stores this rank's parameters, there is a
bucket (represented as a tensor) containing all of the parameters on
that device that are assigned to... | [
"def",
"_build_param_buckets",
"(",
"self",
")",
"->",
"None",
":",
"if",
"not",
"self",
".",
"parameters_as_bucket_view",
"or",
"self",
".",
"_overlap_with_ddp",
":",
"return",
"# `self._buckets[i][j]` are the parameters stored on device i and",
"# assigned to rank j",
"nu... | https://github.com/pytorch/pytorch/blob/7176c92687d3cc847cc046bf002269c6949a21c2/torch/distributed/optim/zero_redundancy_optimizer.py#L1196-L1252 | ||
aws/lumberyard | f85344403c1c2e77ec8c75deb2c116e97b713217 | dev/Tools/Python/3.7.10/mac/Python.framework/Versions/3.7/lib/python3.7/tarfile.py | python | TarFile.chown | (self, tarinfo, targetpath, numeric_owner) | Set owner of targetpath according to tarinfo. If numeric_owner
is True, use .gid/.uid instead of .gname/.uname. If numeric_owner
is False, fall back to .gid/.uid when the search based on name
fails. | Set owner of targetpath according to tarinfo. If numeric_owner
is True, use .gid/.uid instead of .gname/.uname. If numeric_owner
is False, fall back to .gid/.uid when the search based on name
fails. | [
"Set",
"owner",
"of",
"targetpath",
"according",
"to",
"tarinfo",
".",
"If",
"numeric_owner",
"is",
"True",
"use",
".",
"gid",
"/",
".",
"uid",
"instead",
"of",
".",
"gname",
"/",
".",
"uname",
".",
"If",
"numeric_owner",
"is",
"False",
"fall",
"back",
... | def chown(self, tarinfo, targetpath, numeric_owner):
"""Set owner of targetpath according to tarinfo. If numeric_owner
is True, use .gid/.uid instead of .gname/.uname. If numeric_owner
is False, fall back to .gid/.uid when the search based on name
fails.
"""
if h... | [
"def",
"chown",
"(",
"self",
",",
"tarinfo",
",",
"targetpath",
",",
"numeric_owner",
")",
":",
"if",
"hasattr",
"(",
"os",
",",
"\"geteuid\"",
")",
"and",
"os",
".",
"geteuid",
"(",
")",
"==",
"0",
":",
"# We have to be root to do so.",
"g",
"=",
"tarin... | https://github.com/aws/lumberyard/blob/f85344403c1c2e77ec8c75deb2c116e97b713217/dev/Tools/Python/3.7.10/mac/Python.framework/Versions/3.7/lib/python3.7/tarfile.py#L2219-L2246 | ||
eclipse/sumo | 7132a9b8b6eea734bdec38479026b4d8c4336d03 | tools/traci/_vehicletype.py | python | VehicleTypeDomain.getShapeClass | (self, typeID) | return self._getUniversal(tc.VAR_SHAPECLASS, typeID) | getShapeClass(string) -> string
Returns the shape class of vehicles of this type. | getShapeClass(string) -> string | [
"getShapeClass",
"(",
"string",
")",
"-",
">",
"string"
] | def getShapeClass(self, typeID):
"""getShapeClass(string) -> string
Returns the shape class of vehicles of this type.
"""
return self._getUniversal(tc.VAR_SHAPECLASS, typeID) | [
"def",
"getShapeClass",
"(",
"self",
",",
"typeID",
")",
":",
"return",
"self",
".",
"_getUniversal",
"(",
"tc",
".",
"VAR_SHAPECLASS",
",",
"typeID",
")"
] | https://github.com/eclipse/sumo/blob/7132a9b8b6eea734bdec38479026b4d8c4336d03/tools/traci/_vehicletype.py#L123-L128 | |
catboost/catboost | 167f64f237114a4d10b2b4ee42adb4569137debe | contrib/python/scikit-learn/py3/sklearn/preprocessing/_data.py | python | _handle_zeros_in_scale | (scale, copy=True) | Makes sure that whenever scale is zero, we handle it correctly.
This happens in most scalers when we have constant features. | Makes sure that whenever scale is zero, we handle it correctly. | [
"Makes",
"sure",
"that",
"whenever",
"scale",
"is",
"zero",
"we",
"handle",
"it",
"correctly",
"."
] | def _handle_zeros_in_scale(scale, copy=True):
''' Makes sure that whenever scale is zero, we handle it correctly.
This happens in most scalers when we have constant features.'''
# if we are fitting on 1D arrays, scale might be a scalar
if np.isscalar(scale):
if scale == .0:
scale =... | [
"def",
"_handle_zeros_in_scale",
"(",
"scale",
",",
"copy",
"=",
"True",
")",
":",
"# if we are fitting on 1D arrays, scale might be a scalar",
"if",
"np",
".",
"isscalar",
"(",
"scale",
")",
":",
"if",
"scale",
"==",
".0",
":",
"scale",
"=",
"1.",
"return",
"... | https://github.com/catboost/catboost/blob/167f64f237114a4d10b2b4ee42adb4569137debe/contrib/python/scikit-learn/py3/sklearn/preprocessing/_data.py#L63-L78 | ||
apple/turicreate | cce55aa5311300e3ce6af93cb45ba791fd1bdf49 | src/external/boost/boost_1_68_0/tools/build/src/build/type.py | python | register_suffixes | (suffixes, type) | Specifies that targets with suffix from 'suffixes' have the type 'type'.
If a different type is already specified for any of syffixes, issues an error. | Specifies that targets with suffix from 'suffixes' have the type 'type'.
If a different type is already specified for any of syffixes, issues an error. | [
"Specifies",
"that",
"targets",
"with",
"suffix",
"from",
"suffixes",
"have",
"the",
"type",
"type",
".",
"If",
"a",
"different",
"type",
"is",
"already",
"specified",
"for",
"any",
"of",
"syffixes",
"issues",
"an",
"error",
"."
] | def register_suffixes (suffixes, type):
""" Specifies that targets with suffix from 'suffixes' have the type 'type'.
If a different type is already specified for any of syffixes, issues an error.
"""
assert is_iterable_typed(suffixes, basestring)
assert isinstance(type, basestring)
for s in ... | [
"def",
"register_suffixes",
"(",
"suffixes",
",",
"type",
")",
":",
"assert",
"is_iterable_typed",
"(",
"suffixes",
",",
"basestring",
")",
"assert",
"isinstance",
"(",
"type",
",",
"basestring",
")",
"for",
"s",
"in",
"suffixes",
":",
"if",
"s",
"in",
"__... | https://github.com/apple/turicreate/blob/cce55aa5311300e3ce6af93cb45ba791fd1bdf49/src/external/boost/boost_1_68_0/tools/build/src/build/type.py#L123-L135 | ||
catboost/catboost | 167f64f237114a4d10b2b4ee42adb4569137debe | contrib/tools/python3/src/Lib/turtle.py | python | TNavigator.circle | (self, radius, extent = None, steps = None) | Draw a circle with given radius.
Arguments:
radius -- a number
extent (optional) -- a number
steps (optional) -- an integer
Draw a circle with given radius. The center is radius units left
of the turtle; extent - an angle - determines which part of the
circle is... | Draw a circle with given radius. | [
"Draw",
"a",
"circle",
"with",
"given",
"radius",
"."
] | def circle(self, radius, extent = None, steps = None):
""" Draw a circle with given radius.
Arguments:
radius -- a number
extent (optional) -- a number
steps (optional) -- an integer
Draw a circle with given radius. The center is radius units left
of the turtle;... | [
"def",
"circle",
"(",
"self",
",",
"radius",
",",
"extent",
"=",
"None",
",",
"steps",
"=",
"None",
")",
":",
"if",
"self",
".",
"undobuffer",
":",
"self",
".",
"undobuffer",
".",
"push",
"(",
"[",
"\"seq\"",
"]",
")",
"self",
".",
"undobuffer",
".... | https://github.com/catboost/catboost/blob/167f64f237114a4d10b2b4ee42adb4569137debe/contrib/tools/python3/src/Lib/turtle.py#L1939-L2000 | ||
mapequation/infomap | 5f56b94fe0f956483f61a03ef07e94d8def2205e | interfaces/python/infomap.py | python | Infomap.add_state_nodes | (self, state_nodes) | Add state nodes.
See Also
--------
add_state_node
Examples
--------
With tuples
>>> from infomap import Infomap
>>> im = Infomap()
>>> states = (
... (1, 1),
... (2, 1),
... (3, 2)
... )
>>> im... | Add state nodes. | [
"Add",
"state",
"nodes",
"."
] | def add_state_nodes(self, state_nodes):
"""Add state nodes.
See Also
--------
add_state_node
Examples
--------
With tuples
>>> from infomap import Infomap
>>> im = Infomap()
>>> states = (
... (1, 1),
... (2, 1),
... | [
"def",
"add_state_nodes",
"(",
"self",
",",
"state_nodes",
")",
":",
"try",
":",
"for",
"node",
"in",
"state_nodes",
".",
"items",
"(",
")",
":",
"self",
".",
"add_state_node",
"(",
"*",
"node",
")",
"except",
"AttributeError",
":",
"for",
"node",
"in",
... | https://github.com/mapequation/infomap/blob/5f56b94fe0f956483f61a03ef07e94d8def2205e/interfaces/python/infomap.py#L572-L616 | ||
junhyukoh/caffe-lstm | 598d45456fa2a1b127a644f4aa38daa8fb9fc722 | scripts/cpp_lint.py | python | FindStartOfExpressionInLine | (line, endpos, depth, startchar, endchar) | return (-1, depth) | Find position at the matching startchar.
This is almost the reverse of FindEndOfExpressionInLine, but note
that the input position and returned position differs by 1.
Args:
line: a CleansedLines line.
endpos: start searching at this position.
depth: nesting level at endpos.
startchar: expression... | Find position at the matching startchar. | [
"Find",
"position",
"at",
"the",
"matching",
"startchar",
"."
] | def FindStartOfExpressionInLine(line, endpos, depth, startchar, endchar):
"""Find position at the matching startchar.
This is almost the reverse of FindEndOfExpressionInLine, but note
that the input position and returned position differs by 1.
Args:
line: a CleansedLines line.
endpos: start searching ... | [
"def",
"FindStartOfExpressionInLine",
"(",
"line",
",",
"endpos",
",",
"depth",
",",
"startchar",
",",
"endchar",
")",
":",
"for",
"i",
"in",
"xrange",
"(",
"endpos",
",",
"-",
"1",
",",
"-",
"1",
")",
":",
"if",
"line",
"[",
"i",
"]",
"==",
"endch... | https://github.com/junhyukoh/caffe-lstm/blob/598d45456fa2a1b127a644f4aa38daa8fb9fc722/scripts/cpp_lint.py#L1300-L1324 | |
aws/lumberyard | f85344403c1c2e77ec8c75deb2c116e97b713217 | dev/Gems/CloudGemMetric/v1/AWS/common-code/Lib/pandas/core/groupby/groupby.py | python | GroupBy.var | (self, ddof: int = 1, *args, **kwargs) | Compute variance of groups, excluding missing values.
For multiple groupings, the result index will be a MultiIndex.
Parameters
----------
ddof : int, default 1
Degrees of freedom.
Returns
-------
Series or DataFrame
Variance of values w... | Compute variance of groups, excluding missing values. | [
"Compute",
"variance",
"of",
"groups",
"excluding",
"missing",
"values",
"."
] | def var(self, ddof: int = 1, *args, **kwargs):
"""
Compute variance of groups, excluding missing values.
For multiple groupings, the result index will be a MultiIndex.
Parameters
----------
ddof : int, default 1
Degrees of freedom.
Returns
-... | [
"def",
"var",
"(",
"self",
",",
"ddof",
":",
"int",
"=",
"1",
",",
"*",
"args",
",",
"*",
"*",
"kwargs",
")",
":",
"nv",
".",
"validate_groupby_func",
"(",
"\"var\"",
",",
"args",
",",
"kwargs",
")",
"if",
"ddof",
"==",
"1",
":",
"return",
"self"... | https://github.com/aws/lumberyard/blob/f85344403c1c2e77ec8c75deb2c116e97b713217/dev/Gems/CloudGemMetric/v1/AWS/common-code/Lib/pandas/core/groupby/groupby.py#L1272-L1296 | ||
hanpfei/chromium-net | 392cc1fa3a8f92f42e4071ab6e674d8e0482f83f | third_party/catapult/third_party/gsutil/third_party/boto/boto/gs/resumable_upload_handler.py | python | ResumableUploadHandler._save_tracker_uri_to_file | (self) | Saves URI to tracker file if one was passed to constructor. | Saves URI to tracker file if one was passed to constructor. | [
"Saves",
"URI",
"to",
"tracker",
"file",
"if",
"one",
"was",
"passed",
"to",
"constructor",
"."
] | def _save_tracker_uri_to_file(self):
"""
Saves URI to tracker file if one was passed to constructor.
"""
if not self.tracker_file_name:
return
f = None
try:
with os.fdopen(os.open(self.tracker_file_name,
os.O_WRON... | [
"def",
"_save_tracker_uri_to_file",
"(",
"self",
")",
":",
"if",
"not",
"self",
".",
"tracker_file_name",
":",
"return",
"f",
"=",
"None",
"try",
":",
"with",
"os",
".",
"fdopen",
"(",
"os",
".",
"open",
"(",
"self",
".",
"tracker_file_name",
",",
"os",
... | https://github.com/hanpfei/chromium-net/blob/392cc1fa3a8f92f42e4071ab6e674d8e0482f83f/third_party/catapult/third_party/gsutil/third_party/boto/boto/gs/resumable_upload_handler.py#L115-L133 | ||
aws/lumberyard | f85344403c1c2e77ec8c75deb2c116e97b713217 | dev/Gems/CloudGemDefectReporter/v1/AWS/common-code/Lib/pkg_resources/_vendor/pyparsing.py | python | ParseResults.dump | (self, indent='', depth=0, full=True) | return "".join(out) | Diagnostic method for listing out the contents of a C{ParseResults}.
Accepts an optional C{indent} argument so that this string can be embedded
in a nested display of other data.
Example::
integer = Word(nums)
date_str = integer("year") + '/' + integer("month") + '/' + i... | Diagnostic method for listing out the contents of a C{ParseResults}.
Accepts an optional C{indent} argument so that this string can be embedded
in a nested display of other data. | [
"Diagnostic",
"method",
"for",
"listing",
"out",
"the",
"contents",
"of",
"a",
"C",
"{",
"ParseResults",
"}",
".",
"Accepts",
"an",
"optional",
"C",
"{",
"indent",
"}",
"argument",
"so",
"that",
"this",
"string",
"can",
"be",
"embedded",
"in",
"a",
"nest... | def dump(self, indent='', depth=0, full=True):
"""
Diagnostic method for listing out the contents of a C{ParseResults}.
Accepts an optional C{indent} argument so that this string can be embedded
in a nested display of other data.
Example::
integer = Word(nums)
... | [
"def",
"dump",
"(",
"self",
",",
"indent",
"=",
"''",
",",
"depth",
"=",
"0",
",",
"full",
"=",
"True",
")",
":",
"out",
"=",
"[",
"]",
"NL",
"=",
"'\\n'",
"out",
".",
"append",
"(",
"indent",
"+",
"_ustr",
"(",
"self",
".",
"asList",
"(",
")... | https://github.com/aws/lumberyard/blob/f85344403c1c2e77ec8c75deb2c116e97b713217/dev/Gems/CloudGemDefectReporter/v1/AWS/common-code/Lib/pkg_resources/_vendor/pyparsing.py#L848-L891 | |
apache/incubator-mxnet | f03fb23f1d103fec9541b5ae59ee06b1734a51d9 | python/mxnet/numpy/random.py | python | chisquare | (df, size=None, dtype=None, device=None) | return _mx_nd_np.random.chisquare(df, size=size, dtype=dtype, device=device) | r"""Draw samples from a chi-square distribution.
When `df` independent random variables, each with standard normal
distributions (mean 0, variance 1), are squared and summed, the
resulting distribution is chi-square (see Notes). This distribution
is often used in hypothesis testing.
Parameters
... | r"""Draw samples from a chi-square distribution. | [
"r",
"Draw",
"samples",
"from",
"a",
"chi",
"-",
"square",
"distribution",
"."
] | def chisquare(df, size=None, dtype=None, device=None):
r"""Draw samples from a chi-square distribution.
When `df` independent random variables, each with standard normal
distributions (mean 0, variance 1), are squared and summed, the
resulting distribution is chi-square (see Notes). This distribution
... | [
"def",
"chisquare",
"(",
"df",
",",
"size",
"=",
"None",
",",
"dtype",
"=",
"None",
",",
"device",
"=",
"None",
")",
":",
"return",
"_mx_nd_np",
".",
"random",
".",
"chisquare",
"(",
"df",
",",
"size",
"=",
"size",
",",
"dtype",
"=",
"dtype",
",",
... | https://github.com/apache/incubator-mxnet/blob/f03fb23f1d103fec9541b5ae59ee06b1734a51d9/python/mxnet/numpy/random.py#L950-L1013 | |
cvxpy/cvxpy | 5165b4fb750dfd237de8659383ef24b4b2e33aaf | cvxpy/atoms/gen_lambda_max.py | python | gen_lambda_max._grad | (self, values) | Gives the (sub/super)gradient of the atom w.r.t. each argument.
Matrix expressions are vectorized, so the gradient is a matrix.
Args:
values: A list of numeric values for the arguments.
Returns:
A list of SciPy CSC sparse matrices or None. | Gives the (sub/super)gradient of the atom w.r.t. each argument. | [
"Gives",
"the",
"(",
"sub",
"/",
"super",
")",
"gradient",
"of",
"the",
"atom",
"w",
".",
"r",
".",
"t",
".",
"each",
"argument",
"."
] | def _grad(self, values):
"""Gives the (sub/super)gradient of the atom w.r.t. each argument.
Matrix expressions are vectorized, so the gradient is a matrix.
Args:
values: A list of numeric values for the arguments.
Returns:
A list of SciPy CSC sparse matrices or... | [
"def",
"_grad",
"(",
"self",
",",
"values",
")",
":",
"raise",
"NotImplementedError",
"(",
")"
] | https://github.com/cvxpy/cvxpy/blob/5165b4fb750dfd237de8659383ef24b4b2e33aaf/cvxpy/atoms/gen_lambda_max.py#L48-L59 | ||
tensorflow/io | 92b44e180674a8af0e12e405530f7343e3e693e4 | tensorflow_io/python/ops/audio_ops.py | python | AudioIOTensor.__getitem__ | (self, key) | return item.__getitem__(indices) | Returns the specified piece of this IOTensor. | Returns the specified piece of this IOTensor. | [
"Returns",
"the",
"specified",
"piece",
"of",
"this",
"IOTensor",
"."
] | def __getitem__(self, key):
"""Returns the specified piece of this IOTensor."""
# always convert to tuple to process
if not isinstance(key, tuple):
key = tuple([key])
# get the start and stop of each element
indices = [
(k.start, k.stop) if isinstance(k, s... | [
"def",
"__getitem__",
"(",
"self",
",",
"key",
")",
":",
"# always convert to tuple to process",
"if",
"not",
"isinstance",
"(",
"key",
",",
"tuple",
")",
":",
"key",
"=",
"tuple",
"(",
"[",
"key",
"]",
")",
"# get the start and stop of each element",
"indices",... | https://github.com/tensorflow/io/blob/92b44e180674a8af0e12e405530f7343e3e693e4/tensorflow_io/python/ops/audio_ops.py#L721-L743 | |
google/syzygy | 8164b24ebde9c5649c9a09e88a7fc0b0fcbd1bc5 | third_party/numpy/files/numpy/polynomial/hermite_e.py | python | hermefromroots | (roots) | Generate a Hermite series with the given roots.
Return the array of coefficients for the P-series whose roots (a.k.a.
"zeros") are given by *roots*. The returned array of coefficients is
ordered from lowest order "term" to highest, and zeros of multiplicity
greater than one must be included in *roots*... | Generate a Hermite series with the given roots. | [
"Generate",
"a",
"Hermite",
"series",
"with",
"the",
"given",
"roots",
"."
] | def hermefromroots(roots) :
"""
Generate a Hermite series with the given roots.
Return the array of coefficients for the P-series whose roots (a.k.a.
"zeros") are given by *roots*. The returned array of coefficients is
ordered from lowest order "term" to highest, and zeros of multiplicity
grea... | [
"def",
"hermefromroots",
"(",
"roots",
")",
":",
"if",
"len",
"(",
"roots",
")",
"==",
"0",
":",
"return",
"np",
".",
"ones",
"(",
"1",
")",
"else",
":",
"[",
"roots",
"]",
"=",
"pu",
".",
"as_series",
"(",
"[",
"roots",
"]",
",",
"trim",
"=",
... | https://github.com/google/syzygy/blob/8164b24ebde9c5649c9a09e88a7fc0b0fcbd1bc5/third_party/numpy/files/numpy/polynomial/hermite_e.py#L223-L283 | ||
KratosMultiphysics/Kratos | 0000833054ed0503424eb28205d6508d9ca6cbbc | kratos/mpi/python_scripts/distributed_gid_output_process.py | python | DistributedGiDOutputProcess._SetCurrentTimeParameters | (self, additional_list_files) | doing nothing here in MPI | doing nothing here in MPI | [
"doing",
"nothing",
"here",
"in",
"MPI"
] | def _SetCurrentTimeParameters(self, additional_list_files):
''' doing nothing here in MPI'''
pass | [
"def",
"_SetCurrentTimeParameters",
"(",
"self",
",",
"additional_list_files",
")",
":",
"pass"
] | https://github.com/KratosMultiphysics/Kratos/blob/0000833054ed0503424eb28205d6508d9ca6cbbc/kratos/mpi/python_scripts/distributed_gid_output_process.py#L74-L76 | ||
tensorflow/tensorflow | 419e3a6b650ea4bd1b0cba23c4348f8a69f3272e | tensorflow/python/distribute/multi_worker_util.py | python | id_in_cluster | (cluster_spec, task_type, task_id) | Returns a unique id for the task in the `task_type`'s cluster.
It returns an id ranging from [0, `worker_count(task_type, task_id)`).
Note: this function assumes that "evaluate" job is in its own cluster or its
own partition of a cluster.
Args:
cluster_spec: a dict, `ClusterDef` or `ClusterSpec` object t... | Returns a unique id for the task in the `task_type`'s cluster. | [
"Returns",
"a",
"unique",
"id",
"for",
"the",
"task",
"in",
"the",
"task_type",
"s",
"cluster",
"."
] | def id_in_cluster(cluster_spec, task_type, task_id):
"""Returns a unique id for the task in the `task_type`'s cluster.
It returns an id ranging from [0, `worker_count(task_type, task_id)`).
Note: this function assumes that "evaluate" job is in its own cluster or its
own partition of a cluster.
Args:
cl... | [
"def",
"id_in_cluster",
"(",
"cluster_spec",
",",
"task_type",
",",
"task_id",
")",
":",
"_validate_cluster_spec",
"(",
"cluster_spec",
",",
"task_type",
",",
"task_id",
")",
"cluster_spec",
"=",
"normalize_cluster_spec",
"(",
"cluster_spec",
")",
".",
"as_dict",
... | https://github.com/tensorflow/tensorflow/blob/419e3a6b650ea4bd1b0cba23c4348f8a69f3272e/tensorflow/python/distribute/multi_worker_util.py#L228-L263 | ||
klzgrad/naiveproxy | ed2c513637c77b18721fe428d7ed395b4d284c83 | src/build/android/gyp/util/zipalign.py | python | AddToZipHermetic | (zip_file,
zip_path,
src_path=None,
data=None,
compress=None,
alignment=None) | Same as build_utils.AddToZipHermetic(), but with alignment.
Args:
alignment: If set, align the data of the entry to this many bytes. | Same as build_utils.AddToZipHermetic(), but with alignment. | [
"Same",
"as",
"build_utils",
".",
"AddToZipHermetic",
"()",
"but",
"with",
"alignment",
"."
] | def AddToZipHermetic(zip_file,
zip_path,
src_path=None,
data=None,
compress=None,
alignment=None):
"""Same as build_utils.AddToZipHermetic(), but with alignment.
Args:
alignment: If set, align the data of t... | [
"def",
"AddToZipHermetic",
"(",
"zip_file",
",",
"zip_path",
",",
"src_path",
"=",
"None",
",",
"data",
"=",
"None",
",",
"compress",
"=",
"None",
",",
"alignment",
"=",
"None",
")",
":",
"zipinfo",
"=",
"build_utils",
".",
"HermeticZipInfo",
"(",
"filenam... | https://github.com/klzgrad/naiveproxy/blob/ed2c513637c77b18721fe428d7ed395b4d284c83/src/build/android/gyp/util/zipalign.py#L82-L97 | ||
Xilinx/Vitis-AI | fc74d404563d9951b57245443c73bef389f3657f | tools/Vitis-AI-Quantizer/vai_q_tensorflow1.x/tensorflow/python/data/ops/dataset_ops.py | python | TensorDataset.__init__ | (self, element) | See `Dataset.from_tensors()` for details. | See `Dataset.from_tensors()` for details. | [
"See",
"Dataset",
".",
"from_tensors",
"()",
"for",
"details",
"."
] | def __init__(self, element):
"""See `Dataset.from_tensors()` for details."""
element = structure.normalize_element(element)
self._structure = structure.type_spec_from_value(element)
self._tensors = structure.to_tensor_list(self._structure, element)
variant_tensor = gen_dataset_ops.tensor_dataset(
... | [
"def",
"__init__",
"(",
"self",
",",
"element",
")",
":",
"element",
"=",
"structure",
".",
"normalize_element",
"(",
"element",
")",
"self",
".",
"_structure",
"=",
"structure",
".",
"type_spec_from_value",
"(",
"element",
")",
"self",
".",
"_tensors",
"=",... | https://github.com/Xilinx/Vitis-AI/blob/fc74d404563d9951b57245443c73bef389f3657f/tools/Vitis-AI-Quantizer/vai_q_tensorflow1.x/tensorflow/python/data/ops/dataset_ops.py#L2351-L2360 | ||
catboost/catboost | 167f64f237114a4d10b2b4ee42adb4569137debe | contrib/python/parso/py2/parso/__init__.py | python | parse | (code=None, **kwargs) | return grammar.parse(code, **kwargs) | A utility function to avoid loading grammars.
Params are documented in :py:meth:`parso.Grammar.parse`.
:param str version: The version used by :py:func:`parso.load_grammar`. | A utility function to avoid loading grammars.
Params are documented in :py:meth:`parso.Grammar.parse`. | [
"A",
"utility",
"function",
"to",
"avoid",
"loading",
"grammars",
".",
"Params",
"are",
"documented",
"in",
":",
"py",
":",
"meth",
":",
"parso",
".",
"Grammar",
".",
"parse",
"."
] | def parse(code=None, **kwargs):
"""
A utility function to avoid loading grammars.
Params are documented in :py:meth:`parso.Grammar.parse`.
:param str version: The version used by :py:func:`parso.load_grammar`.
"""
version = kwargs.pop('version', None)
grammar = load_grammar(version=version)... | [
"def",
"parse",
"(",
"code",
"=",
"None",
",",
"*",
"*",
"kwargs",
")",
":",
"version",
"=",
"kwargs",
".",
"pop",
"(",
"'version'",
",",
"None",
")",
"grammar",
"=",
"load_grammar",
"(",
"version",
"=",
"version",
")",
"return",
"grammar",
".",
"par... | https://github.com/catboost/catboost/blob/167f64f237114a4d10b2b4ee42adb4569137debe/contrib/python/parso/py2/parso/__init__.py#L49-L58 | |
wang-bin/QtAV | 3b937991afce248648836ae811324d4051b31def | python/configure.py | python | _TargetConfiguration.update_from_configuration_file | (self, config_file) | Update the configuration with values from a file. config_file
is the name of the configuration file. | Update the configuration with values from a file. config_file
is the name of the configuration file. | [
"Update",
"the",
"configuration",
"with",
"values",
"from",
"a",
"file",
".",
"config_file",
"is",
"the",
"name",
"of",
"the",
"configuration",
"file",
"."
] | def update_from_configuration_file(self, config_file):
""" Update the configuration with values from a file. config_file
is the name of the configuration file.
"""
inform("Reading configuration from %s..." % config_file)
parser = _ConfigurationFileParser(config_file)
... | [
"def",
"update_from_configuration_file",
"(",
"self",
",",
"config_file",
")",
":",
"inform",
"(",
"\"Reading configuration from %s...\"",
"%",
"config_file",
")",
"parser",
"=",
"_ConfigurationFileParser",
"(",
"config_file",
")",
"# Populate some presets from the command li... | https://github.com/wang-bin/QtAV/blob/3b937991afce248648836ae811324d4051b31def/python/configure.py#L783-L877 | ||
NERSC/timemory | 431912b360ff50d1a160d7826e2eea04fbd1037f | timemory/trace/tracer.py | python | Tracer.runcall | (self, func, *args, **kw) | Trace a single function call | Trace a single function call | [
"Trace",
"a",
"single",
"function",
"call"
] | def runcall(self, func, *args, **kw):
"""Trace a single function call"""
try:
self.start()
return func(*args, **kw)
finally:
self.stop() | [
"def",
"runcall",
"(",
"self",
",",
"func",
",",
"*",
"args",
",",
"*",
"*",
"kw",
")",
":",
"try",
":",
"self",
".",
"start",
"(",
")",
"return",
"func",
"(",
"*",
"args",
",",
"*",
"*",
"kw",
")",
"finally",
":",
"self",
".",
"stop",
"(",
... | https://github.com/NERSC/timemory/blob/431912b360ff50d1a160d7826e2eea04fbd1037f/timemory/trace/tracer.py#L302-L309 | ||
rdkit/rdkit | ede860ae316d12d8568daf5ee800921c3389c84e | rdkit/Chem/QED.py | python | properties | (mol) | return qedProperties | Calculates the properties that are required to calculate the QED descriptor. | Calculates the properties that are required to calculate the QED descriptor. | [
"Calculates",
"the",
"properties",
"that",
"are",
"required",
"to",
"calculate",
"the",
"QED",
"descriptor",
"."
] | def properties(mol):
"""
Calculates the properties that are required to calculate the QED descriptor.
"""
if mol is None:
raise ValueError('You need to provide a mol argument.')
mol = Chem.RemoveHs(mol)
qedProperties = QEDproperties(
MW=rdmd._CalcMolWt(mol),
ALOGP=Crippen.MolLogP(mol),
HBA=s... | [
"def",
"properties",
"(",
"mol",
")",
":",
"if",
"mol",
"is",
"None",
":",
"raise",
"ValueError",
"(",
"'You need to provide a mol argument.'",
")",
"mol",
"=",
"Chem",
".",
"RemoveHs",
"(",
"mol",
")",
"qedProperties",
"=",
"QEDproperties",
"(",
"MW",
"=",
... | https://github.com/rdkit/rdkit/blob/ede860ae316d12d8568daf5ee800921c3389c84e/rdkit/Chem/QED.py#L243-L267 | |
catboost/catboost | 167f64f237114a4d10b2b4ee42adb4569137debe | contrib/python/pandas/py3/pandas/core/indexes/base.py | python | Index.get_slice_bound | (self, label, side: str_t, kind=None) | Calculate slice bound that corresponds to given label.
Returns leftmost (one-past-the-rightmost if ``side=='right'``) position
of given label.
Parameters
----------
label : object
side : {'left', 'right'}
kind : {'loc', 'getitem'} or None
Returns
... | Calculate slice bound that corresponds to given label. | [
"Calculate",
"slice",
"bound",
"that",
"corresponds",
"to",
"given",
"label",
"."
] | def get_slice_bound(self, label, side: str_t, kind=None) -> int:
"""
Calculate slice bound that corresponds to given label.
Returns leftmost (one-past-the-rightmost if ``side=='right'``) position
of given label.
Parameters
----------
label : object
side ... | [
"def",
"get_slice_bound",
"(",
"self",
",",
"label",
",",
"side",
":",
"str_t",
",",
"kind",
"=",
"None",
")",
"->",
"int",
":",
"assert",
"kind",
"in",
"[",
"\"loc\"",
",",
"\"getitem\"",
",",
"None",
"]",
"if",
"side",
"not",
"in",
"(",
"\"left\"",... | https://github.com/catboost/catboost/blob/167f64f237114a4d10b2b4ee42adb4569137debe/contrib/python/pandas/py3/pandas/core/indexes/base.py#L5767-L5833 | ||
TGAC/KAT | e8870331de2b4bb0a1b3b91c6afb8fb9d59e9216 | deps/boost/tools/build/src/build/property_set.py | python | create | (raw_properties = []) | return __cache [key] | Creates a new 'PropertySet' instance for the given raw properties,
or returns an already existing one. | Creates a new 'PropertySet' instance for the given raw properties,
or returns an already existing one. | [
"Creates",
"a",
"new",
"PropertySet",
"instance",
"for",
"the",
"given",
"raw",
"properties",
"or",
"returns",
"an",
"already",
"existing",
"one",
"."
] | def create (raw_properties = []):
""" Creates a new 'PropertySet' instance for the given raw properties,
or returns an already existing one.
"""
assert (is_iterable_typed(raw_properties, property.Property)
or is_iterable_typed(raw_properties, basestring))
# FIXME: propagate to caller... | [
"def",
"create",
"(",
"raw_properties",
"=",
"[",
"]",
")",
":",
"assert",
"(",
"is_iterable_typed",
"(",
"raw_properties",
",",
"property",
".",
"Property",
")",
"or",
"is_iterable_typed",
"(",
"raw_properties",
",",
"basestring",
")",
")",
"# FIXME: propagate ... | https://github.com/TGAC/KAT/blob/e8870331de2b4bb0a1b3b91c6afb8fb9d59e9216/deps/boost/tools/build/src/build/property_set.py#L36-L61 | |
mindspore-ai/mindspore | fb8fd3338605bb34fa5cea054e535a8b1d753fab | mindspore/python/mindspore/train/callback/_landscape.py | python | SummaryLandscape._log_message | (self, create_landscape, index=None, interval=None, final_epochs=None) | Generate drawing information using log. | Generate drawing information using log. | [
"Generate",
"drawing",
"information",
"using",
"log",
"."
] | def _log_message(self, create_landscape, index=None, interval=None, final_epochs=None):
"""Generate drawing information using log."""
if final_epochs is None:
if create_landscape['result']:
msg = f"Start to create the {index + 1}/{len(self._epoch_group) + 1} landscapes, " \
... | [
"def",
"_log_message",
"(",
"self",
",",
"create_landscape",
",",
"index",
"=",
"None",
",",
"interval",
"=",
"None",
",",
"final_epochs",
"=",
"None",
")",
":",
"if",
"final_epochs",
"is",
"None",
":",
"if",
"create_landscape",
"[",
"'result'",
"]",
":",
... | https://github.com/mindspore-ai/mindspore/blob/fb8fd3338605bb34fa5cea054e535a8b1d753fab/mindspore/python/mindspore/train/callback/_landscape.py#L379-L395 | ||
pmq20/node-packer | 12c46c6e44fbc14d9ee645ebd17d5296b324f7e0 | current/tools/inspector_protocol/jinja2/nodes.py | python | Node.find | (self, node_type) | Find the first node of a given type. If no such node exists the
return value is `None`. | Find the first node of a given type. If no such node exists the
return value is `None`. | [
"Find",
"the",
"first",
"node",
"of",
"a",
"given",
"type",
".",
"If",
"no",
"such",
"node",
"exists",
"the",
"return",
"value",
"is",
"None",
"."
] | def find(self, node_type):
"""Find the first node of a given type. If no such node exists the
return value is `None`.
"""
for result in self.find_all(node_type):
return result | [
"def",
"find",
"(",
"self",
",",
"node_type",
")",
":",
"for",
"result",
"in",
"self",
".",
"find_all",
"(",
"node_type",
")",
":",
"return",
"result"
] | https://github.com/pmq20/node-packer/blob/12c46c6e44fbc14d9ee645ebd17d5296b324f7e0/current/tools/inspector_protocol/jinja2/nodes.py#L177-L182 | ||
rbgirshick/caffe-fast-rcnn | 28a579eaf0668850705598b3075b8969f22226d9 | scripts/cpp_lint.py | python | _CppLintState.SetCountingStyle | (self, counting_style) | Sets the module's counting options. | Sets the module's counting options. | [
"Sets",
"the",
"module",
"s",
"counting",
"options",
"."
] | def SetCountingStyle(self, counting_style):
"""Sets the module's counting options."""
self.counting = counting_style | [
"def",
"SetCountingStyle",
"(",
"self",
",",
"counting_style",
")",
":",
"self",
".",
"counting",
"=",
"counting_style"
] | https://github.com/rbgirshick/caffe-fast-rcnn/blob/28a579eaf0668850705598b3075b8969f22226d9/scripts/cpp_lint.py#L713-L715 | ||
microsoft/TSS.MSR | 0f2516fca2cd9929c31d5450e39301c9bde43688 | TSS.Py/src/TpmTypes.py | python | TPMS_TDES_SYM_DETAILS.fromTpm | (buf) | return buf.createObj(TPMS_TDES_SYM_DETAILS) | Returns new TPMS_TDES_SYM_DETAILS object constructed from its
marshaled representation in the given TpmBuffer buffer | Returns new TPMS_TDES_SYM_DETAILS object constructed from its
marshaled representation in the given TpmBuffer buffer | [
"Returns",
"new",
"TPMS_TDES_SYM_DETAILS",
"object",
"constructed",
"from",
"its",
"marshaled",
"representation",
"in",
"the",
"given",
"TpmBuffer",
"buffer"
] | def fromTpm(buf):
""" Returns new TPMS_TDES_SYM_DETAILS object constructed from its
marshaled representation in the given TpmBuffer buffer
"""
return buf.createObj(TPMS_TDES_SYM_DETAILS) | [
"def",
"fromTpm",
"(",
"buf",
")",
":",
"return",
"buf",
".",
"createObj",
"(",
"TPMS_TDES_SYM_DETAILS",
")"
] | https://github.com/microsoft/TSS.MSR/blob/0f2516fca2cd9929c31d5450e39301c9bde43688/TSS.Py/src/TpmTypes.py#L5613-L5617 | |
Xilinx/Vitis-AI | fc74d404563d9951b57245443c73bef389f3657f | tools/Vitis-AI-Quantizer/vai_q_tensorflow1.x/tensorflow/contrib/graph_editor/subgraph.py | python | SubGraphView.remap_outputs_make_unique | (self) | return res | Remap the outputs so that all the tensors appears only once. | Remap the outputs so that all the tensors appears only once. | [
"Remap",
"the",
"outputs",
"so",
"that",
"all",
"the",
"tensors",
"appears",
"only",
"once",
"."
] | def remap_outputs_make_unique(self):
"""Remap the outputs so that all the tensors appears only once."""
res = copy.copy(self)
res._remap_outputs_make_unique() # pylint: disable=protected-access
return res | [
"def",
"remap_outputs_make_unique",
"(",
"self",
")",
":",
"res",
"=",
"copy",
".",
"copy",
"(",
"self",
")",
"res",
".",
"_remap_outputs_make_unique",
"(",
")",
"# pylint: disable=protected-access",
"return",
"res"
] | https://github.com/Xilinx/Vitis-AI/blob/fc74d404563d9951b57245443c73bef389f3657f/tools/Vitis-AI-Quantizer/vai_q_tensorflow1.x/tensorflow/contrib/graph_editor/subgraph.py#L324-L328 | |
wxWidgets/wxPython-Classic | 19571e1ae65f1ac445f5491474121998c97a1bf0 | src/msw/_gdi.py | python | GraphicsGradientStops.GetCount | (*args, **kwargs) | return _gdi_.GraphicsGradientStops_GetCount(*args, **kwargs) | GetCount(self) -> unsigned int | GetCount(self) -> unsigned int | [
"GetCount",
"(",
"self",
")",
"-",
">",
"unsigned",
"int"
] | def GetCount(*args, **kwargs):
"""GetCount(self) -> unsigned int"""
return _gdi_.GraphicsGradientStops_GetCount(*args, **kwargs) | [
"def",
"GetCount",
"(",
"*",
"args",
",",
"*",
"*",
"kwargs",
")",
":",
"return",
"_gdi_",
".",
"GraphicsGradientStops_GetCount",
"(",
"*",
"args",
",",
"*",
"*",
"kwargs",
")"
] | https://github.com/wxWidgets/wxPython-Classic/blob/19571e1ae65f1ac445f5491474121998c97a1bf0/src/msw/_gdi.py#L6090-L6092 | |
mantidproject/mantid | 03deeb89254ec4289edb8771e0188c2090a02f32 | Framework/PythonInterface/plugins/algorithms/WorkflowAlgorithms/SANSDarkRunBackgroundCorrection.py | python | DarkRunMonitorAndDetectorRemover.set_pure_detector_dark_run | (self, dark_run) | return dark_run | Sets all monitors on the dark run workspace to 0.
@param dark_run: the dark run workspace | Sets all monitors on the dark run workspace to 0. | [
"Sets",
"all",
"monitors",
"on",
"the",
"dark",
"run",
"workspace",
"to",
"0",
"."
] | def set_pure_detector_dark_run(self, dark_run):
'''
Sets all monitors on the dark run workspace to 0.
@param dark_run: the dark run workspace
'''
# Get the list of monitor workspace indices
monitor_list = self.find_monitor_workspace_indices(dark_run)
# Since we o... | [
"def",
"set_pure_detector_dark_run",
"(",
"self",
",",
"dark_run",
")",
":",
"# Get the list of monitor workspace indices",
"monitor_list",
"=",
"self",
".",
"find_monitor_workspace_indices",
"(",
"dark_run",
")",
"# Since we only have around 10 or so monitors",
"# we set them ma... | https://github.com/mantidproject/mantid/blob/03deeb89254ec4289edb8771e0188c2090a02f32/Framework/PythonInterface/plugins/algorithms/WorkflowAlgorithms/SANSDarkRunBackgroundCorrection.py#L269-L287 | |
arangodb/arangodb | 0d658689c7d1b721b314fa3ca27d38303e1570c8 | 3rdParty/V8/v7.9.317/third_party/jinja2/filters.py | python | do_random | (context, seq) | Return a random item from the sequence. | Return a random item from the sequence. | [
"Return",
"a",
"random",
"item",
"from",
"the",
"sequence",
"."
] | def do_random(context, seq):
"""Return a random item from the sequence."""
try:
return random.choice(seq)
except IndexError:
return context.environment.undefined('No random item, sequence was empty.') | [
"def",
"do_random",
"(",
"context",
",",
"seq",
")",
":",
"try",
":",
"return",
"random",
".",
"choice",
"(",
"seq",
")",
"except",
"IndexError",
":",
"return",
"context",
".",
"environment",
".",
"undefined",
"(",
"'No random item, sequence was empty.'",
")"
... | https://github.com/arangodb/arangodb/blob/0d658689c7d1b721b314fa3ca27d38303e1570c8/3rdParty/V8/v7.9.317/third_party/jinja2/filters.py#L451-L456 | ||
cms-sw/cmssw | fd9de012d503d3405420bcbeec0ec879baa57cf2 | Alignment/MuonAlignment/python/svgfig.py | python | Path.parse_number | (self, index, pathdata) | Part of Path's text-command parsing algorithm; used internally. | Part of Path's text-command parsing algorithm; used internally. | [
"Part",
"of",
"Path",
"s",
"text",
"-",
"command",
"parsing",
"algorithm",
";",
"used",
"internally",
"."
] | def parse_number(self, index, pathdata):
"""Part of Path's text-command parsing algorithm; used internally."""
index, pathdata = self.parse_whitespace(index, pathdata)
if index >= len(pathdata): return None, index, pathdata
first_digit = pathdata[index]
if "0" <= first_digit <= "9" or first_digit ... | [
"def",
"parse_number",
"(",
"self",
",",
"index",
",",
"pathdata",
")",
":",
"index",
",",
"pathdata",
"=",
"self",
".",
"parse_whitespace",
"(",
"index",
",",
"pathdata",
")",
"if",
"index",
">=",
"len",
"(",
"pathdata",
")",
":",
"return",
"None",
",... | https://github.com/cms-sw/cmssw/blob/fd9de012d503d3405420bcbeec0ec879baa57cf2/Alignment/MuonAlignment/python/svgfig.py#L1087-L1103 | ||
Xilinx/Vitis-AI | fc74d404563d9951b57245443c73bef389f3657f | tools/Vitis-AI-Quantizer/vai_q_tensorflow1.x/tensorflow/python/ops/math_ops.py | python | abs | (x, name=None) | r"""Computes the absolute value of a tensor.
Given a tensor of integer or floating-point values, this operation returns a
tensor of the same type, where each element contains the absolute value of the
corresponding element in the input.
Given a tensor `x` of complex numbers, this operation returns a tensor of... | r"""Computes the absolute value of a tensor. | [
"r",
"Computes",
"the",
"absolute",
"value",
"of",
"a",
"tensor",
"."
] | def abs(x, name=None): # pylint: disable=redefined-builtin
r"""Computes the absolute value of a tensor.
Given a tensor of integer or floating-point values, this operation returns a
tensor of the same type, where each element contains the absolute value of the
corresponding element in the input.
Given a ten... | [
"def",
"abs",
"(",
"x",
",",
"name",
"=",
"None",
")",
":",
"# pylint: disable=redefined-builtin",
"with",
"ops",
".",
"name_scope",
"(",
"name",
",",
"\"Abs\"",
",",
"[",
"x",
"]",
")",
"as",
"name",
":",
"x",
"=",
"ops",
".",
"convert_to_tensor",
"("... | https://github.com/Xilinx/Vitis-AI/blob/fc74d404563d9951b57245443c73bef389f3657f/tools/Vitis-AI-Quantizer/vai_q_tensorflow1.x/tensorflow/python/ops/math_ops.py#L247-L278 | ||
shader-slang/slang | b8982fcf43b86c1e39dcc3dd19bff2821633eda6 | external/vulkan/registry/reg.py | python | Registry.getAlias | (self, elem, dict) | return alias | Check for an alias in the same require block.
- elem - Element to check for an alias | Check for an alias in the same require block. | [
"Check",
"for",
"an",
"alias",
"in",
"the",
"same",
"require",
"block",
"."
] | def getAlias(self, elem, dict):
"""Check for an alias in the same require block.
- elem - Element to check for an alias"""
# Try to find an alias
alias = elem.get('alias')
if alias is None:
name = elem.get('name')
typeinfo = self.lookupElementInfo(name, ... | [
"def",
"getAlias",
"(",
"self",
",",
"elem",
",",
"dict",
")",
":",
"# Try to find an alias",
"alias",
"=",
"elem",
".",
"get",
"(",
"'alias'",
")",
"if",
"alias",
"is",
"None",
":",
"name",
"=",
"elem",
".",
"get",
"(",
"'name'",
")",
"typeinfo",
"=... | https://github.com/shader-slang/slang/blob/b8982fcf43b86c1e39dcc3dd19bff2821633eda6/external/vulkan/registry/reg.py#L796-L808 | |
windystrife/UnrealEngine_NVIDIAGameWorks | b50e6338a7c5b26374d66306ebc7807541ff815e | Engine/Source/ThirdParty/CEF3/pristine/cef_source/tools/cef_parser.py | python | obj_analysis.is_result_vector | (self) | return (self.result_type == 'vector') | Returns true if this is a vector type. | Returns true if this is a vector type. | [
"Returns",
"true",
"if",
"this",
"is",
"a",
"vector",
"type",
"."
] | def is_result_vector(self):
""" Returns true if this is a vector type. """
return (self.result_type == 'vector') | [
"def",
"is_result_vector",
"(",
"self",
")",
":",
"return",
"(",
"self",
".",
"result_type",
"==",
"'vector'",
")"
] | https://github.com/windystrife/UnrealEngine_NVIDIAGameWorks/blob/b50e6338a7c5b26374d66306ebc7807541ff815e/Engine/Source/ThirdParty/CEF3/pristine/cef_source/tools/cef_parser.py#L1877-L1879 | |
HackWebRTC/webrtc | 7abfc990c00ab35090fff285fcf635d1d7892433 | PRESUBMIT.py | python | CheckNewlineAtTheEndOfProtoFiles | (input_api, output_api, source_file_filter) | return results | Checks that all .proto files are terminated with a newline. | Checks that all .proto files are terminated with a newline. | [
"Checks",
"that",
"all",
".",
"proto",
"files",
"are",
"terminated",
"with",
"a",
"newline",
"."
] | def CheckNewlineAtTheEndOfProtoFiles(input_api, output_api, source_file_filter):
"""Checks that all .proto files are terminated with a newline."""
error_msg = 'File {} must end with exactly one newline.'
results = []
file_filter = lambda x: input_api.FilterSourceFile(
x, white_list=(r'.+\.proto$',)) and s... | [
"def",
"CheckNewlineAtTheEndOfProtoFiles",
"(",
"input_api",
",",
"output_api",
",",
"source_file_filter",
")",
":",
"error_msg",
"=",
"'File {} must end with exactly one newline.'",
"results",
"=",
"[",
"]",
"file_filter",
"=",
"lambda",
"x",
":",
"input_api",
".",
"... | https://github.com/HackWebRTC/webrtc/blob/7abfc990c00ab35090fff285fcf635d1d7892433/PRESUBMIT.py#L1059-L1071 | |
wlanjie/AndroidFFmpeg | 7baf9122f4b8e1c74e7baf4be5c422c7a5ba5aaf | tools/fdk-aac-build/x86/toolchain/lib/python2.7/nntplib.py | python | NNTP.newgroups | (self, date, time, file=None) | return self.longcmd('NEWGROUPS ' + date + ' ' + time, file) | Process a NEWGROUPS command. Arguments:
- date: string 'yymmdd' indicating the date
- time: string 'hhmmss' indicating the time
Return:
- resp: server response if successful
- list: list of newsgroup names | Process a NEWGROUPS command. Arguments:
- date: string 'yymmdd' indicating the date
- time: string 'hhmmss' indicating the time
Return:
- resp: server response if successful
- list: list of newsgroup names | [
"Process",
"a",
"NEWGROUPS",
"command",
".",
"Arguments",
":",
"-",
"date",
":",
"string",
"yymmdd",
"indicating",
"the",
"date",
"-",
"time",
":",
"string",
"hhmmss",
"indicating",
"the",
"time",
"Return",
":",
"-",
"resp",
":",
"server",
"response",
"if"... | def newgroups(self, date, time, file=None):
"""Process a NEWGROUPS command. Arguments:
- date: string 'yymmdd' indicating the date
- time: string 'hhmmss' indicating the time
Return:
- resp: server response if successful
- list: list of newsgroup names"""
return... | [
"def",
"newgroups",
"(",
"self",
",",
"date",
",",
"time",
",",
"file",
"=",
"None",
")",
":",
"return",
"self",
".",
"longcmd",
"(",
"'NEWGROUPS '",
"+",
"date",
"+",
"' '",
"+",
"time",
",",
"file",
")"
] | https://github.com/wlanjie/AndroidFFmpeg/blob/7baf9122f4b8e1c74e7baf4be5c422c7a5ba5aaf/tools/fdk-aac-build/x86/toolchain/lib/python2.7/nntplib.py#L266-L274 | |
catboost/catboost | 167f64f237114a4d10b2b4ee42adb4569137debe | contrib/python/setuptools/py2/setuptools/_vendor/pyparsing.py | python | ParserElement.transformString | ( self, instring ) | Extension to C{L{scanString}}, to modify matching text with modified tokens that may
be returned from a parse action. To use C{transformString}, define a grammar and
attach a parse action to it that modifies the returned token list.
Invoking C{transformString()} on a target string will then sca... | Extension to C{L{scanString}}, to modify matching text with modified tokens that may
be returned from a parse action. To use C{transformString}, define a grammar and
attach a parse action to it that modifies the returned token list.
Invoking C{transformString()} on a target string will then sca... | [
"Extension",
"to",
"C",
"{",
"L",
"{",
"scanString",
"}}",
"to",
"modify",
"matching",
"text",
"with",
"modified",
"tokens",
"that",
"may",
"be",
"returned",
"from",
"a",
"parse",
"action",
".",
"To",
"use",
"C",
"{",
"transformString",
"}",
"define",
"a... | def transformString( self, instring ):
"""
Extension to C{L{scanString}}, to modify matching text with modified tokens that may
be returned from a parse action. To use C{transformString}, define a grammar and
attach a parse action to it that modifies the returned token list.
Inv... | [
"def",
"transformString",
"(",
"self",
",",
"instring",
")",
":",
"out",
"=",
"[",
"]",
"lastE",
"=",
"0",
"# force preservation of <TAB>s, to minimize unwanted transformation of string, and to",
"# keep string locs straight between transformString and scanString",
"self",
".",
... | https://github.com/catboost/catboost/blob/167f64f237114a4d10b2b4ee42adb4569137debe/contrib/python/setuptools/py2/setuptools/_vendor/pyparsing.py#L1729-L1770 | ||
microsoft/LightGBM | 904b2d5158703c4900b68008617951dd2f9ff21b | python-package/lightgbm/basic.py | python | c_array | (ctype, values) | return (ctype * len(values))(*values) | Convert a Python array to C array. | Convert a Python array to C array. | [
"Convert",
"a",
"Python",
"array",
"to",
"C",
"array",
"."
] | def c_array(ctype, values):
"""Convert a Python array to C array."""
return (ctype * len(values))(*values) | [
"def",
"c_array",
"(",
"ctype",
",",
"values",
")",
":",
"return",
"(",
"ctype",
"*",
"len",
"(",
"values",
")",
")",
"(",
"*",
"values",
")"
] | https://github.com/microsoft/LightGBM/blob/904b2d5158703c4900b68008617951dd2f9ff21b/python-package/lightgbm/basic.py#L265-L267 | |
catboost/catboost | 167f64f237114a4d10b2b4ee42adb4569137debe | contrib/python/ipython/py3/IPython/utils/sysinfo.py | python | get_sys_info | () | return pkg_info(path) | Return useful information about IPython and the system, as a dict. | Return useful information about IPython and the system, as a dict. | [
"Return",
"useful",
"information",
"about",
"IPython",
"and",
"the",
"system",
"as",
"a",
"dict",
"."
] | def get_sys_info():
"""Return useful information about IPython and the system, as a dict."""
p = os.path
path = p.realpath(p.dirname(p.abspath(p.join(__file__, '..'))))
return pkg_info(path) | [
"def",
"get_sys_info",
"(",
")",
":",
"p",
"=",
"os",
".",
"path",
"path",
"=",
"p",
".",
"realpath",
"(",
"p",
".",
"dirname",
"(",
"p",
".",
"abspath",
"(",
"p",
".",
"join",
"(",
"__file__",
",",
"'..'",
")",
")",
")",
")",
"return",
"pkg_in... | https://github.com/catboost/catboost/blob/167f64f237114a4d10b2b4ee42adb4569137debe/contrib/python/ipython/py3/IPython/utils/sysinfo.py#L95-L99 | |
panda3d/panda3d | 833ad89ebad58395d0af0b7ec08538e5e4308265 | direct/src/actor/Actor.py | python | Actor.__bindAnimToPart | (self, animName, partName, lodName,
allowAsyncBind = True) | return animControl | Binds the named animation to the named part/lod and returns
the associated animControl. The animation is loaded and bound
in a sub-thread, if allowAsyncBind is True,
self.allowAsyncBind is True, threading is enabled, and the
animation has a preload table generated for it (e.g. via
... | Binds the named animation to the named part/lod and returns
the associated animControl. The animation is loaded and bound
in a sub-thread, if allowAsyncBind is True,
self.allowAsyncBind is True, threading is enabled, and the
animation has a preload table generated for it (e.g. via
... | [
"Binds",
"the",
"named",
"animation",
"to",
"the",
"named",
"part",
"/",
"lod",
"and",
"returns",
"the",
"associated",
"animControl",
".",
"The",
"animation",
"is",
"loaded",
"and",
"bound",
"in",
"a",
"sub",
"-",
"thread",
"if",
"allowAsyncBind",
"is",
"T... | def __bindAnimToPart(self, animName, partName, lodName,
allowAsyncBind = True):
"""
Binds the named animation to the named part/lod and returns
the associated animControl. The animation is loaded and bound
in a sub-thread, if allowAsyncBind is True,
self... | [
"def",
"__bindAnimToPart",
"(",
"self",
",",
"animName",
",",
"partName",
",",
"lodName",
",",
"allowAsyncBind",
"=",
"True",
")",
":",
"# make sure this anim is in the dict",
"subpartDef",
"=",
"self",
".",
"__subpartDict",
".",
"get",
"(",
"partName",
",",
"Ac... | https://github.com/panda3d/panda3d/blob/833ad89ebad58395d0af0b7ec08538e5e4308265/direct/src/actor/Actor.py#L2328-L2391 | |
notepadqq/notepadqq | d8000f256a516aa958d50bfcc19605dc296fbeb2 | .travis/tools/macdeployqtfix/macdeployqtfix.py | python | normalize_qtlib_name | (filename) | return qtlib, abspath, rpath | input: a path to a qt library, as returned by otool, that can have this form :
- an absolute path /lib/xxx/yyy
- @executable_path/../Frameworks/QtSerialPort.framework/Versions/5/QtSerialPort
output:
a tuple (qtlib, abspath, rpath) where:
- qtlib is the name of the qtlib (... | input: a path to a qt library, as returned by otool, that can have this form :
- an absolute path /lib/xxx/yyy
- | [
"input",
":",
"a",
"path",
"to",
"a",
"qt",
"library",
"as",
"returned",
"by",
"otool",
"that",
"can",
"have",
"this",
"form",
":",
"-",
"an",
"absolute",
"path",
"/",
"lib",
"/",
"xxx",
"/",
"yyy",
"-"
] | def normalize_qtlib_name(filename):
"""
input: a path to a qt library, as returned by otool, that can have this form :
- an absolute path /lib/xxx/yyy
- @executable_path/../Frameworks/QtSerialPort.framework/Versions/5/QtSerialPort
output:
a tuple (qtlib, abspath, rpath) where... | [
"def",
"normalize_qtlib_name",
"(",
"filename",
")",
":",
"GlobalConfig",
".",
"logger",
".",
"debug",
"(",
"'normalize_qtlib_name({0})'",
".",
"format",
"(",
"filename",
")",
")",
"qtlib_name_rgx",
"=",
"re",
".",
"compile",
"(",
"QTLIB_NAME_REGEX",
")",
"rgxre... | https://github.com/notepadqq/notepadqq/blob/d8000f256a516aa958d50bfcc19605dc296fbeb2/.travis/tools/macdeployqtfix/macdeployqtfix.py#L140-L180 | |
wxWidgets/wxPython-Classic | 19571e1ae65f1ac445f5491474121998c97a1bf0 | src/msw/html.py | python | HtmlParser.GetSource | (*args, **kwargs) | return _html.HtmlParser_GetSource(*args, **kwargs) | GetSource(self) -> String | GetSource(self) -> String | [
"GetSource",
"(",
"self",
")",
"-",
">",
"String"
] | def GetSource(*args, **kwargs):
"""GetSource(self) -> String"""
return _html.HtmlParser_GetSource(*args, **kwargs) | [
"def",
"GetSource",
"(",
"*",
"args",
",",
"*",
"*",
"kwargs",
")",
":",
"return",
"_html",
".",
"HtmlParser_GetSource",
"(",
"*",
"args",
",",
"*",
"*",
"kwargs",
")"
] | https://github.com/wxWidgets/wxPython-Classic/blob/19571e1ae65f1ac445f5491474121998c97a1bf0/src/msw/html.py#L225-L227 | |
benoitsteiner/tensorflow-opencl | cb7cb40a57fde5cfd4731bc551e82a1e2fef43a5 | tensorflow/python/ops/distributions/dirichlet.py | python | Dirichlet.__init__ | (self,
concentration,
validate_args=False,
allow_nan_stats=True,
name="Dirichlet") | Initialize a batch of Dirichlet distributions.
Args:
concentration: Positive floating-point `Tensor` indicating mean number
of class occurrences; aka "alpha". Implies `self.dtype`, and
`self.batch_shape`, `self.event_shape`, i.e., if
`concentration.shape = [N1, N2, ..., Nm, k]` then
... | Initialize a batch of Dirichlet distributions. | [
"Initialize",
"a",
"batch",
"of",
"Dirichlet",
"distributions",
"."
] | def __init__(self,
concentration,
validate_args=False,
allow_nan_stats=True,
name="Dirichlet"):
"""Initialize a batch of Dirichlet distributions.
Args:
concentration: Positive floating-point `Tensor` indicating mean number
of class occur... | [
"def",
"__init__",
"(",
"self",
",",
"concentration",
",",
"validate_args",
"=",
"False",
",",
"allow_nan_stats",
"=",
"True",
",",
"name",
"=",
"\"Dirichlet\"",
")",
":",
"parameters",
"=",
"locals",
"(",
")",
"with",
"ops",
".",
"name_scope",
"(",
"name"... | https://github.com/benoitsteiner/tensorflow-opencl/blob/cb7cb40a57fde5cfd4731bc551e82a1e2fef43a5/tensorflow/python/ops/distributions/dirichlet.py#L131-L169 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.