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 |
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
CaoWGG/TensorRT-YOLOv4 | 4d7c2edce99e8794a4cb4ea3540d51ce91158a36 | onnx-tensorrt/third_party/onnx/onnx/__init__.py | python | _serialize | (proto) | Serialize a in-memory proto to bytes
@params
proto is a in-memory proto, such as a ModelProto, TensorProto, etc
@return
Serialized proto in bytes | Serialize a in-memory proto to bytes | [
"Serialize",
"a",
"in",
"-",
"memory",
"proto",
"to",
"bytes"
] | def _serialize(proto): # type: (Union[bytes, google.protobuf.message.Message]) -> bytes
'''
Serialize a in-memory proto to bytes
@params
proto is a in-memory proto, such as a ModelProto, TensorProto, etc
@return
Serialized proto in bytes
'''
if isinstance(proto, bytes):
return... | [
"def",
"_serialize",
"(",
"proto",
")",
":",
"# type: (Union[bytes, google.protobuf.message.Message]) -> bytes",
"if",
"isinstance",
"(",
"proto",
",",
"bytes",
")",
":",
"return",
"proto",
"elif",
"hasattr",
"(",
"proto",
",",
"'SerializeToString'",
")",
"and",
"ca... | https://github.com/CaoWGG/TensorRT-YOLOv4/blob/4d7c2edce99e8794a4cb4ea3540d51ce91158a36/onnx-tensorrt/third_party/onnx/onnx/__init__.py#L40-L57 | ||
BSVino/DoubleAction | c550b168a3e919926c198c30240f506538b92e75 | mp/src/thirdparty/protobuf-2.3.0/python/google/protobuf/internal/containers.py | python | BaseContainer.__getitem__ | (self, key) | return self._values[key] | Retrieves item by the specified key. | Retrieves item by the specified key. | [
"Retrieves",
"item",
"by",
"the",
"specified",
"key",
"."
] | def __getitem__(self, key):
"""Retrieves item by the specified key."""
return self._values[key] | [
"def",
"__getitem__",
"(",
"self",
",",
"key",
")",
":",
"return",
"self",
".",
"_values",
"[",
"key",
"]"
] | https://github.com/BSVino/DoubleAction/blob/c550b168a3e919926c198c30240f506538b92e75/mp/src/thirdparty/protobuf-2.3.0/python/google/protobuf/internal/containers.py#L62-L64 | |
plaidml/plaidml | f3c6681db21460e5fdc11ae651d6d7b6c27f8262 | mlperf/pycoco.py | python | COCO.info | (self) | Print information about the annotation file.
:return: | Print information about the annotation file.
:return: | [
"Print",
"information",
"about",
"the",
"annotation",
"file",
".",
":",
"return",
":"
] | def info(self):
"""
Print information about the annotation file.
:return:
"""
for key, value in self.dataset['info'].items():
print('{}: {}'.format(key, value)) | [
"def",
"info",
"(",
"self",
")",
":",
"for",
"key",
",",
"value",
"in",
"self",
".",
"dataset",
"[",
"'info'",
"]",
".",
"items",
"(",
")",
":",
"print",
"(",
"'{}: {}'",
".",
"format",
"(",
"key",
",",
"value",
")",
")"
] | https://github.com/plaidml/plaidml/blob/f3c6681db21460e5fdc11ae651d6d7b6c27f8262/mlperf/pycoco.py#L123-L129 | ||
aws/lumberyard | f85344403c1c2e77ec8c75deb2c116e97b713217 | dev/Gems/CloudGemMetric/v1/AWS/common-code/Lib/numba/targets/arrayobj.py | python | get_sort_func | (kind, is_float, is_argsort=False) | Get a sort implementation of the given kind. | Get a sort implementation of the given kind. | [
"Get",
"a",
"sort",
"implementation",
"of",
"the",
"given",
"kind",
"."
] | def get_sort_func(kind, is_float, is_argsort=False):
"""
Get a sort implementation of the given kind.
"""
key = kind, is_float, is_argsort
try:
return _sorts[key]
except KeyError:
if kind == 'quicksort':
sort = quicksort.make_jit_quicksort(
lt=lt_float... | [
"def",
"get_sort_func",
"(",
"kind",
",",
"is_float",
",",
"is_argsort",
"=",
"False",
")",
":",
"key",
"=",
"kind",
",",
"is_float",
",",
"is_argsort",
"try",
":",
"return",
"_sorts",
"[",
"key",
"]",
"except",
"KeyError",
":",
"if",
"kind",
"==",
"'q... | https://github.com/aws/lumberyard/blob/f85344403c1c2e77ec8c75deb2c116e97b713217/dev/Gems/CloudGemMetric/v1/AWS/common-code/Lib/numba/targets/arrayobj.py#L4894-L4913 | ||
Tencent/TNN | 7acca99f54c55747b415a4c57677403eebc7b706 | third_party/flatbuffers/python/flatbuffers/table.py | python | Table.Union | (self, t2, off) | Union initializes any Table-derived type to point to the union at
the given offset. | Union initializes any Table-derived type to point to the union at
the given offset. | [
"Union",
"initializes",
"any",
"Table",
"-",
"derived",
"type",
"to",
"point",
"to",
"the",
"union",
"at",
"the",
"given",
"offset",
"."
] | def Union(self, t2, off):
"""Union initializes any Table-derived type to point to the union at
the given offset."""
assert type(t2) is Table
N.enforce_number(off, N.UOffsetTFlags)
off += self.Pos
t2.Pos = off + self.Get(N.UOffsetTFlags, off)
t2.Bytes = self.By... | [
"def",
"Union",
"(",
"self",
",",
"t2",
",",
"off",
")",
":",
"assert",
"type",
"(",
"t2",
")",
"is",
"Table",
"N",
".",
"enforce_number",
"(",
"off",
",",
"N",
".",
"UOffsetTFlags",
")",
"off",
"+=",
"self",
".",
"Pos",
"t2",
".",
"Pos",
"=",
... | https://github.com/Tencent/TNN/blob/7acca99f54c55747b415a4c57677403eebc7b706/third_party/flatbuffers/python/flatbuffers/table.py#L77-L85 | ||
aws/lumberyard | f85344403c1c2e77ec8c75deb2c116e97b713217 | dev/Tools/Python/3.7.10/mac/Python.framework/Versions/3.7/lib/python3.7/stat.py | python | S_ISWHT | (mode) | return False | Return True if mode is from a whiteout. | Return True if mode is from a whiteout. | [
"Return",
"True",
"if",
"mode",
"is",
"from",
"a",
"whiteout",
"."
] | def S_ISWHT(mode):
"""Return True if mode is from a whiteout."""
return False | [
"def",
"S_ISWHT",
"(",
"mode",
")",
":",
"return",
"False"
] | https://github.com/aws/lumberyard/blob/f85344403c1c2e77ec8c75deb2c116e97b713217/dev/Tools/Python/3.7.10/mac/Python.framework/Versions/3.7/lib/python3.7/stat.py#L86-L88 | |
CRYTEK/CRYENGINE | 232227c59a220cbbd311576f0fbeba7bb53b2a8c | Code/Tools/waf-1.7.13/waflib/extras/codelite.py | python | vsnode.get_waf | (self) | return '%s/%s' % (self.ctx.srcnode.abspath(), getattr(self.ctx, 'waf_command', 'waf')) | Override in subclasses... | Override in subclasses... | [
"Override",
"in",
"subclasses",
"..."
] | def get_waf(self):
"""
Override in subclasses...
"""
return '%s/%s' % (self.ctx.srcnode.abspath(), getattr(self.ctx, 'waf_command', 'waf')) | [
"def",
"get_waf",
"(",
"self",
")",
":",
"return",
"'%s/%s'",
"%",
"(",
"self",
".",
"ctx",
".",
"srcnode",
".",
"abspath",
"(",
")",
",",
"getattr",
"(",
"self",
".",
"ctx",
",",
"'waf_command'",
",",
"'waf'",
")",
")"
] | https://github.com/CRYTEK/CRYENGINE/blob/232227c59a220cbbd311576f0fbeba7bb53b2a8c/Code/Tools/waf-1.7.13/waflib/extras/codelite.py#L402-L406 | |
apache/singa | 93fd9da72694e68bfe3fb29d0183a65263d238a1 | python/singa/autograd.py | python | add | (a, b) | return Add()(a, b)[0] | Return `a+b`, where a and b are Tensor. | Return `a+b`, where a and b are Tensor. | [
"Return",
"a",
"+",
"b",
"where",
"a",
"and",
"b",
"are",
"Tensor",
"."
] | def add(a, b):
"""
Return `a+b`, where a and b are Tensor.
"""
return Add()(a, b)[0] | [
"def",
"add",
"(",
"a",
",",
"b",
")",
":",
"return",
"Add",
"(",
")",
"(",
"a",
",",
"b",
")",
"[",
"0",
"]"
] | https://github.com/apache/singa/blob/93fd9da72694e68bfe3fb29d0183a65263d238a1/python/singa/autograd.py#L894-L898 | |
aws/lumberyard | f85344403c1c2e77ec8c75deb2c116e97b713217 | dev/Gems/CloudGemFramework/v1/AWS/resource-manager-code/lib/swagger_spec_validator/validator12.py | python | validate_resource_listing | (resource_listing) | Validate a Resource Listing (§5.1).
:param resource_listing: a dictionary respresentation of a Resource Listing.
Note that you will have to invoke `validate_api_declaration` on each
linked API Declaration.
:returns: `None` in case of success, otherwise raises an exception.
:raises: :py:class:`sw... | Validate a Resource Listing (§5.1). | [
"Validate",
"a",
"Resource",
"Listing",
"(",
"§5",
".",
"1",
")",
"."
] | def validate_resource_listing(resource_listing):
"""Validate a Resource Listing (§5.1).
:param resource_listing: a dictionary respresentation of a Resource Listing.
Note that you will have to invoke `validate_api_declaration` on each
linked API Declaration.
:returns: `None` in case of success, ot... | [
"def",
"validate_resource_listing",
"(",
"resource_listing",
")",
":",
"validate_json",
"(",
"resource_listing",
",",
"'schemas/v1.2/resourceListing.json'",
")"
] | https://github.com/aws/lumberyard/blob/f85344403c1c2e77ec8c75deb2c116e97b713217/dev/Gems/CloudGemFramework/v1/AWS/resource-manager-code/lib/swagger_spec_validator/validator12.py#L236-L249 | ||
mantidproject/mantid | 03deeb89254ec4289edb8771e0188c2090a02f32 | scripts/abins/input/textparser.py | python | TextParser.file_end | (self, file_obj=None) | Checks end of the text file.
:param file_obj: file object which was open in "r" mode
:returns: True if end of file, otherwise False | Checks end of the text file.
:param file_obj: file object which was open in "r" mode
:returns: True if end of file, otherwise False | [
"Checks",
"end",
"of",
"the",
"text",
"file",
".",
":",
"param",
"file_obj",
":",
"file",
"object",
"which",
"was",
"open",
"in",
"r",
"mode",
":",
"returns",
":",
"True",
"if",
"end",
"of",
"file",
"otherwise",
"False"
] | def file_end(self, file_obj=None):
"""
Checks end of the text file.
:param file_obj: file object which was open in "r" mode
:returns: True if end of file, otherwise False
"""
pos = file_obj.tell()
potential_end = file_obj.read(ONE_CHARACTER)
if potential_e... | [
"def",
"file_end",
"(",
"self",
",",
"file_obj",
"=",
"None",
")",
":",
"pos",
"=",
"file_obj",
".",
"tell",
"(",
")",
"potential_end",
"=",
"file_obj",
".",
"read",
"(",
"ONE_CHARACTER",
")",
"if",
"potential_end",
"==",
"EOF",
":",
"return",
"True",
... | https://github.com/mantidproject/mantid/blob/03deeb89254ec4289edb8771e0188c2090a02f32/scripts/abins/input/textparser.py#L76-L88 | ||
benoitsteiner/tensorflow-opencl | cb7cb40a57fde5cfd4731bc551e82a1e2fef43a5 | tensorflow/python/ops/nn_grad.py | python | _SparseSoftmaxCrossEntropyWithLogitsGrad | (op, grad_0, _) | return _BroadcastMul(grad_0, sparse_softmax_grad_without_gradient), None | Gradient function for SparseSoftmaxCrossEntropyWithLogits. | Gradient function for SparseSoftmaxCrossEntropyWithLogits. | [
"Gradient",
"function",
"for",
"SparseSoftmaxCrossEntropyWithLogits",
"."
] | def _SparseSoftmaxCrossEntropyWithLogitsGrad(op, grad_0, _):
"""Gradient function for SparseSoftmaxCrossEntropyWithLogits."""
# grad_0 is the backprop for cost, and we multiply it with the gradients
# (which is output[1])
# There is no gradient for the labels
#
# Currently there is no way to take the second... | [
"def",
"_SparseSoftmaxCrossEntropyWithLogitsGrad",
"(",
"op",
",",
"grad_0",
",",
"_",
")",
":",
"# grad_0 is the backprop for cost, and we multiply it with the gradients",
"# (which is output[1])",
"# There is no gradient for the labels",
"#",
"# Currently there is no way to take the se... | https://github.com/benoitsteiner/tensorflow-opencl/blob/cb7cb40a57fde5cfd4731bc551e82a1e2fef43a5/tensorflow/python/ops/nn_grad.py#L451-L465 | |
DanielSWolf/rhubarb-lip-sync | 5cface0af3b6e4e58c0b829c51561d784fb9f52f | rhubarb/lib/pocketsphinx-rev13216/src/gst-plugin/livedemo.py | python | DemoApp.init_gui | (self) | Initialize the GUI components | Initialize the GUI components | [
"Initialize",
"the",
"GUI",
"components"
] | def init_gui(self):
"""Initialize the GUI components"""
self.window = gtk.Window()
self.window.connect("delete-event", gtk.main_quit)
self.window.set_default_size(400,200)
self.window.set_border_width(10)
vbox = gtk.VBox()
self.textbuf = gtk.TextBuffer()
s... | [
"def",
"init_gui",
"(",
"self",
")",
":",
"self",
".",
"window",
"=",
"gtk",
".",
"Window",
"(",
")",
"self",
".",
"window",
".",
"connect",
"(",
"\"delete-event\"",
",",
"gtk",
".",
"main_quit",
")",
"self",
".",
"window",
".",
"set_default_size",
"("... | https://github.com/DanielSWolf/rhubarb-lip-sync/blob/5cface0af3b6e4e58c0b829c51561d784fb9f52f/rhubarb/lib/pocketsphinx-rev13216/src/gst-plugin/livedemo.py#L33-L48 | ||
wy1iu/LargeMargin_Softmax_Loss | c3e9f20e4f16e2b4daf7d358a614366b9b39a6ec | scripts/cpp_lint.py | python | _SetOutputFormat | (output_format) | Sets the module's output format. | Sets the module's output format. | [
"Sets",
"the",
"module",
"s",
"output",
"format",
"."
] | def _SetOutputFormat(output_format):
"""Sets the module's output format."""
_cpplint_state.SetOutputFormat(output_format) | [
"def",
"_SetOutputFormat",
"(",
"output_format",
")",
":",
"_cpplint_state",
".",
"SetOutputFormat",
"(",
"output_format",
")"
] | https://github.com/wy1iu/LargeMargin_Softmax_Loss/blob/c3e9f20e4f16e2b4daf7d358a614366b9b39a6ec/scripts/cpp_lint.py#L772-L774 | ||
1989Ryan/Semantic_SLAM | 0284b3f832ca431c494f9c134fe46c40ec86ee38 | Third_Part/PSPNet_Keras_tensorflow/caffe-tensorflow/kaffe/tensorflow/network.py | python | Network.make_var | (self, name, shape) | return tf.get_variable(name, shape, trainable=self.trainable) | Creates a new TensorFlow variable. | Creates a new TensorFlow variable. | [
"Creates",
"a",
"new",
"TensorFlow",
"variable",
"."
] | def make_var(self, name, shape):
'''Creates a new TensorFlow variable.'''
return tf.get_variable(name, shape, trainable=self.trainable) | [
"def",
"make_var",
"(",
"self",
",",
"name",
",",
"shape",
")",
":",
"return",
"tf",
".",
"get_variable",
"(",
"name",
",",
"shape",
",",
"trainable",
"=",
"self",
".",
"trainable",
")"
] | https://github.com/1989Ryan/Semantic_SLAM/blob/0284b3f832ca431c494f9c134fe46c40ec86ee38/Third_Part/PSPNet_Keras_tensorflow/caffe-tensorflow/kaffe/tensorflow/network.py#L96-L98 | |
aws/lumberyard | f85344403c1c2e77ec8c75deb2c116e97b713217 | dev/Tools/Python/3.7.10/linux_x64/lib/python3.7/ipaddress.py | python | _BaseV6._compress_hextets | (cls, hextets) | return hextets | Compresses a list of hextets.
Compresses a list of strings, replacing the longest continuous
sequence of "0" in the list with "" and adding empty strings at
the beginning or at the end of the string such that subsequently
calling ":".join(hextets) will produce the compressed version of
... | Compresses a list of hextets. | [
"Compresses",
"a",
"list",
"of",
"hextets",
"."
] | def _compress_hextets(cls, hextets):
"""Compresses a list of hextets.
Compresses a list of strings, replacing the longest continuous
sequence of "0" in the list with "" and adding empty strings at
the beginning or at the end of the string such that subsequently
calling ":".join(... | [
"def",
"_compress_hextets",
"(",
"cls",
",",
"hextets",
")",
":",
"best_doublecolon_start",
"=",
"-",
"1",
"best_doublecolon_len",
"=",
"0",
"doublecolon_start",
"=",
"-",
"1",
"doublecolon_len",
"=",
"0",
"for",
"index",
",",
"hextet",
"in",
"enumerate",
"(",... | https://github.com/aws/lumberyard/blob/f85344403c1c2e77ec8c75deb2c116e97b713217/dev/Tools/Python/3.7.10/linux_x64/lib/python3.7/ipaddress.py#L1756-L1801 | |
SequoiaDB/SequoiaDB | 2894ed7e5bd6fe57330afc900cf76d0ff0df9f64 | tools/server/php_linux/libxml2/lib/python2.4/site-packages/libxml2.py | python | xmlNode.listGetRawString | (self, doc, inLine) | return ret | Builds the string equivalent to the text contained in the
Node list made of TEXTs and ENTITY_REFs, contrary to
xmlNodeListGetString() this function doesn't do any
character encoding handling. | Builds the string equivalent to the text contained in the
Node list made of TEXTs and ENTITY_REFs, contrary to
xmlNodeListGetString() this function doesn't do any
character encoding handling. | [
"Builds",
"the",
"string",
"equivalent",
"to",
"the",
"text",
"contained",
"in",
"the",
"Node",
"list",
"made",
"of",
"TEXTs",
"and",
"ENTITY_REFs",
"contrary",
"to",
"xmlNodeListGetString",
"()",
"this",
"function",
"doesn",
"t",
"do",
"any",
"character",
"en... | def listGetRawString(self, doc, inLine):
"""Builds the string equivalent to the text contained in the
Node list made of TEXTs and ENTITY_REFs, contrary to
xmlNodeListGetString() this function doesn't do any
character encoding handling. """
if doc is None: doc__o = None
... | [
"def",
"listGetRawString",
"(",
"self",
",",
"doc",
",",
"inLine",
")",
":",
"if",
"doc",
"is",
"None",
":",
"doc__o",
"=",
"None",
"else",
":",
"doc__o",
"=",
"doc",
".",
"_o",
"ret",
"=",
"libxml2mod",
".",
"xmlNodeListGetRawString",
"(",
"doc__o",
"... | https://github.com/SequoiaDB/SequoiaDB/blob/2894ed7e5bd6fe57330afc900cf76d0ff0df9f64/tools/server/php_linux/libxml2/lib/python2.4/site-packages/libxml2.py#L3280-L3288 | |
wxWidgets/wxPython-Classic | 19571e1ae65f1ac445f5491474121998c97a1bf0 | src/osx_carbon/_windows.py | python | PrintData.__init__ | (self, *args) | __init__(self) -> PrintData
__init__(self, PrintData data) -> PrintData | __init__(self) -> PrintData
__init__(self, PrintData data) -> PrintData | [
"__init__",
"(",
"self",
")",
"-",
">",
"PrintData",
"__init__",
"(",
"self",
"PrintData",
"data",
")",
"-",
">",
"PrintData"
] | def __init__(self, *args):
"""
__init__(self) -> PrintData
__init__(self, PrintData data) -> PrintData
"""
_windows_.PrintData_swiginit(self,_windows_.new_PrintData(*args)) | [
"def",
"__init__",
"(",
"self",
",",
"*",
"args",
")",
":",
"_windows_",
".",
"PrintData_swiginit",
"(",
"self",
",",
"_windows_",
".",
"new_PrintData",
"(",
"*",
"args",
")",
")"
] | https://github.com/wxWidgets/wxPython-Classic/blob/19571e1ae65f1ac445f5491474121998c97a1bf0/src/osx_carbon/_windows.py#L4702-L4707 | ||
domino-team/openwrt-cc | 8b181297c34d14d3ca521cc9f31430d561dbc688 | package/gli-pub/openwrt-node-packages-master/node/node-v6.9.1/deps/npm/node_modules/node-gyp/gyp/pylib/gyp/generator/analyzer.py | python | _GenerateTargets | (data, target_list, target_dicts, toplevel_dir, files,
build_files) | return name_to_target, matching_targets, roots & build_file_targets | Returns a tuple of the following:
. A dictionary mapping from fully qualified name to Target.
. A list of the targets that have a source file in |files|.
. Targets that constitute the 'all' target. See description at top of file
for details on the 'all' target.
This sets the |match_status| of the targets th... | Returns a tuple of the following:
. A dictionary mapping from fully qualified name to Target.
. A list of the targets that have a source file in |files|.
. Targets that constitute the 'all' target. See description at top of file
for details on the 'all' target.
This sets the |match_status| of the targets th... | [
"Returns",
"a",
"tuple",
"of",
"the",
"following",
":",
".",
"A",
"dictionary",
"mapping",
"from",
"fully",
"qualified",
"name",
"to",
"Target",
".",
".",
"A",
"list",
"of",
"the",
"targets",
"that",
"have",
"a",
"source",
"file",
"in",
"|files|",
".",
... | def _GenerateTargets(data, target_list, target_dicts, toplevel_dir, files,
build_files):
"""Returns a tuple of the following:
. A dictionary mapping from fully qualified name to Target.
. A list of the targets that have a source file in |files|.
. Targets that constitute the 'all' target. S... | [
"def",
"_GenerateTargets",
"(",
"data",
",",
"target_list",
",",
"target_dicts",
",",
"toplevel_dir",
",",
"files",
",",
"build_files",
")",
":",
"# Maps from target name to Target.",
"name_to_target",
"=",
"{",
"}",
"# Targets that matched.",
"matching_targets",
"=",
... | https://github.com/domino-team/openwrt-cc/blob/8b181297c34d14d3ca521cc9f31430d561dbc688/package/gli-pub/openwrt-node-packages-master/node/node-v6.9.1/deps/npm/node_modules/node-gyp/gyp/pylib/gyp/generator/analyzer.py#L318-L401 | |
aws/lumberyard | f85344403c1c2e77ec8c75deb2c116e97b713217 | dev/Tools/Python/3.7.10/windows/Lib/site-packages/pip/_vendor/ipaddress.py | python | _BaseV6._explode_shorthand_ip_string | (self) | return ':'.join(parts) | Expand a shortened IPv6 address.
Args:
ip_str: A string, the IPv6 address.
Returns:
A string, the expanded IPv6 address. | Expand a shortened IPv6 address. | [
"Expand",
"a",
"shortened",
"IPv6",
"address",
"."
] | def _explode_shorthand_ip_string(self):
"""Expand a shortened IPv6 address.
Args:
ip_str: A string, the IPv6 address.
Returns:
A string, the expanded IPv6 address.
"""
if isinstance(self, IPv6Network):
ip_str = _compat_str(self.network_addre... | [
"def",
"_explode_shorthand_ip_string",
"(",
"self",
")",
":",
"if",
"isinstance",
"(",
"self",
",",
"IPv6Network",
")",
":",
"ip_str",
"=",
"_compat_str",
"(",
"self",
".",
"network_address",
")",
"elif",
"isinstance",
"(",
"self",
",",
"IPv6Interface",
")",
... | https://github.com/aws/lumberyard/blob/f85344403c1c2e77ec8c75deb2c116e97b713217/dev/Tools/Python/3.7.10/windows/Lib/site-packages/pip/_vendor/ipaddress.py#L1955-L1977 | |
aws/lumberyard | f85344403c1c2e77ec8c75deb2c116e97b713217 | dev/Gems/CloudGemMetric/v1/AWS/common-code/Lib/pkg_resources/_vendor/pyparsing.py | python | ParserElement.__sub__ | (self, other) | return self + And._ErrorStop() + other | Implementation of - operator, returns C{L{And}} with error stop | Implementation of - operator, returns C{L{And}} with error stop | [
"Implementation",
"of",
"-",
"operator",
"returns",
"C",
"{",
"L",
"{",
"And",
"}}",
"with",
"error",
"stop"
] | def __sub__(self, other):
"""
Implementation of - operator, returns C{L{And}} with error stop
"""
if isinstance( other, basestring ):
other = ParserElement._literalStringClass( other )
if not isinstance( other, ParserElement ):
warnings.warn("Cannot combin... | [
"def",
"__sub__",
"(",
"self",
",",
"other",
")",
":",
"if",
"isinstance",
"(",
"other",
",",
"basestring",
")",
":",
"other",
"=",
"ParserElement",
".",
"_literalStringClass",
"(",
"other",
")",
"if",
"not",
"isinstance",
"(",
"other",
",",
"ParserElement... | https://github.com/aws/lumberyard/blob/f85344403c1c2e77ec8c75deb2c116e97b713217/dev/Gems/CloudGemMetric/v1/AWS/common-code/Lib/pkg_resources/_vendor/pyparsing.py#L1854-L1864 | |
tensorflow/tensorflow | 419e3a6b650ea4bd1b0cba23c4348f8a69f3272e | tensorflow/python/ops/rnn.py | python | _reverse_seq | (input_seq, lengths) | return results | Reverse a list of Tensors up to specified lengths.
Args:
input_seq: Sequence of seq_len tensors of dimension (batch_size, n_features)
or nested tuples of tensors.
lengths: A `Tensor` of dimension batch_size, containing lengths for each
sequence in the batch. If "None" is specified, simply rever... | Reverse a list of Tensors up to specified lengths. | [
"Reverse",
"a",
"list",
"of",
"Tensors",
"up",
"to",
"specified",
"lengths",
"."
] | def _reverse_seq(input_seq, lengths):
"""Reverse a list of Tensors up to specified lengths.
Args:
input_seq: Sequence of seq_len tensors of dimension (batch_size, n_features)
or nested tuples of tensors.
lengths: A `Tensor` of dimension batch_size, containing lengths for each
sequence in the ... | [
"def",
"_reverse_seq",
"(",
"input_seq",
",",
"lengths",
")",
":",
"if",
"lengths",
"is",
"None",
":",
"return",
"list",
"(",
"reversed",
"(",
"input_seq",
")",
")",
"flat_input_seq",
"=",
"tuple",
"(",
"nest",
".",
"flatten",
"(",
"input_",
")",
"for",
... | https://github.com/tensorflow/tensorflow/blob/419e3a6b650ea4bd1b0cba23c4348f8a69f3272e/tensorflow/python/ops/rnn.py#L299-L338 | |
wxWidgets/wxPython-Classic | 19571e1ae65f1ac445f5491474121998c97a1bf0 | src/gtk/_windows.py | python | StatusBar.GetClassDefaultAttributes | (*args, **kwargs) | return _windows_.StatusBar_GetClassDefaultAttributes(*args, **kwargs) | GetClassDefaultAttributes(int variant=WINDOW_VARIANT_NORMAL) -> VisualAttributes
Get the default attributes for this class. This is useful if you want
to use the same font or colour in your own control as in a standard
control -- which is a much better idea than hard coding specific
co... | GetClassDefaultAttributes(int variant=WINDOW_VARIANT_NORMAL) -> VisualAttributes | [
"GetClassDefaultAttributes",
"(",
"int",
"variant",
"=",
"WINDOW_VARIANT_NORMAL",
")",
"-",
">",
"VisualAttributes"
] | def GetClassDefaultAttributes(*args, **kwargs):
"""
GetClassDefaultAttributes(int variant=WINDOW_VARIANT_NORMAL) -> VisualAttributes
Get the default attributes for this class. This is useful if you want
to use the same font or colour in your own control as in a standard
control... | [
"def",
"GetClassDefaultAttributes",
"(",
"*",
"args",
",",
"*",
"*",
"kwargs",
")",
":",
"return",
"_windows_",
".",
"StatusBar_GetClassDefaultAttributes",
"(",
"*",
"args",
",",
"*",
"*",
"kwargs",
")"
] | https://github.com/wxWidgets/wxPython-Classic/blob/19571e1ae65f1ac445f5491474121998c97a1bf0/src/gtk/_windows.py#L1303-L1318 | |
catboost/catboost | 167f64f237114a4d10b2b4ee42adb4569137debe | contrib/python/pandas/py3/pandas/core/arrays/datetimelike.py | python | DatetimeLikeArrayMixin._sub_nat | (self) | return result.view("timedelta64[ns]") | Subtract pd.NaT from self | Subtract pd.NaT from self | [
"Subtract",
"pd",
".",
"NaT",
"from",
"self"
] | def _sub_nat(self):
"""
Subtract pd.NaT from self
"""
# GH#19124 Timedelta - datetime is not in general well-defined.
# We make an exception for pd.NaT, which in this case quacks
# like a timedelta.
# For datetime64 dtypes by convention we treat NaT as a datetime,... | [
"def",
"_sub_nat",
"(",
"self",
")",
":",
"# GH#19124 Timedelta - datetime is not in general well-defined.",
"# We make an exception for pd.NaT, which in this case quacks",
"# like a timedelta.",
"# For datetime64 dtypes by convention we treat NaT as a datetime, so",
"# this subtraction returns ... | https://github.com/catboost/catboost/blob/167f64f237114a4d10b2b4ee42adb4569137debe/contrib/python/pandas/py3/pandas/core/arrays/datetimelike.py#L1149-L1161 | |
baidu-research/tensorflow-allreduce | 66d5b855e90b0949e9fa5cca5599fd729a70e874 | tensorflow/python/framework/common_shapes.py | python | depthwise_conv2d_native_shape | (op) | return [tensor_shape.TensorShape([batch_size, out_rows, out_cols, depth_out])] | Shape function for a DepthwiseConv2D op.
This op has two inputs:
* input, a 4D tensor with shape = [batch_size, rows, cols, depth_in]
* filter, a 4D tensor with shape = [filter_rows, filter_cols,
depth_in, depthwise_multiplier]
The output is a 4D tensor with shape = [batch_size, out_rows,
out_cols, de... | Shape function for a DepthwiseConv2D op. | [
"Shape",
"function",
"for",
"a",
"DepthwiseConv2D",
"op",
"."
] | def depthwise_conv2d_native_shape(op):
"""Shape function for a DepthwiseConv2D op.
This op has two inputs:
* input, a 4D tensor with shape = [batch_size, rows, cols, depth_in]
* filter, a 4D tensor with shape = [filter_rows, filter_cols,
depth_in, depthwise_multiplier]
The output is a 4D tensor with s... | [
"def",
"depthwise_conv2d_native_shape",
"(",
"op",
")",
":",
"input_shape",
"=",
"op",
".",
"inputs",
"[",
"0",
"]",
".",
"get_shape",
"(",
")",
".",
"with_rank",
"(",
"4",
")",
"filter_shape",
"=",
"op",
".",
"inputs",
"[",
"1",
"]",
".",
"get_shape",... | https://github.com/baidu-research/tensorflow-allreduce/blob/66d5b855e90b0949e9fa5cca5599fd729a70e874/tensorflow/python/framework/common_shapes.py#L225-L278 | |
baidu/bigflow | 449245016c0df7d1252e85581e588bfc60cefad3 | bigflow_python/python/bigflow/base.py | python | Transformer.begin_process | (self, *side_inputs) | return [] | 此方法在开始处理数据之前被调用,以通知用户要开始处理数据了。
用户必须返回一个可迭代的对象,其中值将会被放入结果的PCollection中。 | 此方法在开始处理数据之前被调用,以通知用户要开始处理数据了。 | [
"此方法在开始处理数据之前被调用,以通知用户要开始处理数据了。"
] | def begin_process(self, *side_inputs):
"""
此方法在开始处理数据之前被调用,以通知用户要开始处理数据了。
用户必须返回一个可迭代的对象,其中值将会被放入结果的PCollection中。
"""
return [] | [
"def",
"begin_process",
"(",
"self",
",",
"*",
"side_inputs",
")",
":",
"return",
"[",
"]"
] | https://github.com/baidu/bigflow/blob/449245016c0df7d1252e85581e588bfc60cefad3/bigflow_python/python/bigflow/base.py#L130-L136 | |
hanpfei/chromium-net | 392cc1fa3a8f92f42e4071ab6e674d8e0482f83f | third_party/catapult/telemetry/telemetry/internal/platform/network_controller_backend.py | python | NetworkControllerBackend.StopReplay | (self) | Stop web page replay.
Stops both the replay server and the forwarder if currently active. | Stop web page replay. | [
"Stop",
"web",
"page",
"replay",
"."
] | def StopReplay(self):
"""Stop web page replay.
Stops both the replay server and the forwarder if currently active.
"""
if self._forwarder:
self._forwarder.Close()
self._forwarder = None
self._StopReplayServer() | [
"def",
"StopReplay",
"(",
"self",
")",
":",
"if",
"self",
".",
"_forwarder",
":",
"self",
".",
"_forwarder",
".",
"Close",
"(",
")",
"self",
".",
"_forwarder",
"=",
"None",
"self",
".",
"_StopReplayServer",
"(",
")"
] | https://github.com/hanpfei/chromium-net/blob/392cc1fa3a8f92f42e4071ab6e674d8e0482f83f/third_party/catapult/telemetry/telemetry/internal/platform/network_controller_backend.py#L194-L202 | ||
aws/lumberyard | f85344403c1c2e77ec8c75deb2c116e97b713217 | dev/Tools/Python/3.7.10/mac/Python.framework/Versions/3.7/lib/python3.7/site-packages/pip/_internal/cli/cmdoptions.py | python | _handle_python_version | (option, opt_str, value, parser) | Handle a provided --python-version value. | Handle a provided --python-version value. | [
"Handle",
"a",
"provided",
"--",
"python",
"-",
"version",
"value",
"."
] | def _handle_python_version(option, opt_str, value, parser):
# type: (Option, str, str, OptionParser) -> None
"""
Handle a provided --python-version value.
"""
version_info, error_msg = _convert_python_version(value)
if error_msg is not None:
msg = (
'invalid --python-version ... | [
"def",
"_handle_python_version",
"(",
"option",
",",
"opt_str",
",",
"value",
",",
"parser",
")",
":",
"# type: (Option, str, str, OptionParser) -> None",
"version_info",
",",
"error_msg",
"=",
"_convert_python_version",
"(",
"value",
")",
"if",
"error_msg",
"is",
"no... | https://github.com/aws/lumberyard/blob/f85344403c1c2e77ec8c75deb2c116e97b713217/dev/Tools/Python/3.7.10/mac/Python.framework/Versions/3.7/lib/python3.7/site-packages/pip/_internal/cli/cmdoptions.py#L543-L557 | ||
apple/turicreate | cce55aa5311300e3ce6af93cb45ba791fd1bdf49 | src/external/coremltools_wrap/coremltools/deps/protobuf/python/google/protobuf/text_format.py | python | Parse | (text,
message,
allow_unknown_extension=False,
allow_field_number=False,
descriptor_pool=None) | return ParseLines(text.split('\n'),
message,
allow_unknown_extension,
allow_field_number,
descriptor_pool=descriptor_pool) | Parses a text representation of a protocol message into a message.
Args:
text: Message text representation.
message: A protocol buffer message to merge into.
allow_unknown_extension: if True, skip over missing extensions and keep
parsing
allow_field_number: if True, both field number and field ... | Parses a text representation of a protocol message into a message. | [
"Parses",
"a",
"text",
"representation",
"of",
"a",
"protocol",
"message",
"into",
"a",
"message",
"."
] | def Parse(text,
message,
allow_unknown_extension=False,
allow_field_number=False,
descriptor_pool=None):
"""Parses a text representation of a protocol message into a message.
Args:
text: Message text representation.
message: A protocol buffer message to merge into.
... | [
"def",
"Parse",
"(",
"text",
",",
"message",
",",
"allow_unknown_extension",
"=",
"False",
",",
"allow_field_number",
"=",
"False",
",",
"descriptor_pool",
"=",
"None",
")",
":",
"if",
"not",
"isinstance",
"(",
"text",
",",
"str",
")",
":",
"text",
"=",
... | https://github.com/apple/turicreate/blob/cce55aa5311300e3ce6af93cb45ba791fd1bdf49/src/external/coremltools_wrap/coremltools/deps/protobuf/python/google/protobuf/text_format.py#L422-L449 | |
bumptop/BumpTop | 466d23597a07ae738f4265262fa01087fc6e257c | trunk/win/Source/bin/jinja2/debug.py | python | ProcessedTraceback.standard_exc_info | (self) | return self.exc_type, self.exc_value, self.frames[0].tb | Standard python exc_info for re-raising | Standard python exc_info for re-raising | [
"Standard",
"python",
"exc_info",
"for",
"re",
"-",
"raising"
] | def standard_exc_info(self):
"""Standard python exc_info for re-raising"""
return self.exc_type, self.exc_value, self.frames[0].tb | [
"def",
"standard_exc_info",
"(",
"self",
")",
":",
"return",
"self",
".",
"exc_type",
",",
"self",
".",
"exc_value",
",",
"self",
".",
"frames",
"[",
"0",
"]",
".",
"tb"
] | https://github.com/bumptop/BumpTop/blob/466d23597a07ae738f4265262fa01087fc6e257c/trunk/win/Source/bin/jinja2/debug.py#L96-L98 | |
catboost/catboost | 167f64f237114a4d10b2b4ee42adb4569137debe | contrib/tools/python/src/Lib/plat-mac/lib-scriptpackages/Finder/Standard_Suite.py | python | Standard_Suite_Events.make | (self, _no_object=None, _attributes={}, **_arguments) | make: Make a new element
Keyword argument new: the class of the new element
Keyword argument at: the location at which to insert the element
Keyword argument to: when creating an alias file, the original item to create an alias to or when creating a file viewer window, the target of the window
... | make: Make a new element
Keyword argument new: the class of the new element
Keyword argument at: the location at which to insert the element
Keyword argument to: when creating an alias file, the original item to create an alias to or when creating a file viewer window, the target of the window
... | [
"make",
":",
"Make",
"a",
"new",
"element",
"Keyword",
"argument",
"new",
":",
"the",
"class",
"of",
"the",
"new",
"element",
"Keyword",
"argument",
"at",
":",
"the",
"location",
"at",
"which",
"to",
"insert",
"the",
"element",
"Keyword",
"argument",
"to",... | def make(self, _no_object=None, _attributes={}, **_arguments):
"""make: Make a new element
Keyword argument new: the class of the new element
Keyword argument at: the location at which to insert the element
Keyword argument to: when creating an alias file, the original item to create an ... | [
"def",
"make",
"(",
"self",
",",
"_no_object",
"=",
"None",
",",
"_attributes",
"=",
"{",
"}",
",",
"*",
"*",
"_arguments",
")",
":",
"_code",
"=",
"'core'",
"_subcode",
"=",
"'crel'",
"aetools",
".",
"keysubst",
"(",
"_arguments",
",",
"self",
".",
... | https://github.com/catboost/catboost/blob/167f64f237114a4d10b2b4ee42adb4569137debe/contrib/tools/python/src/Lib/plat-mac/lib-scriptpackages/Finder/Standard_Suite.py#L169-L191 | ||
linyouhappy/kongkongxiyou | 7a69b2913eb29f4be77f9a62fb90cdd72c4160f1 | cocosjs/frameworks/cocos2d-x/plugin/tools/android-build.py | python | select_toolchain_version | () | Because ndk-r8e uses gcc4.6 as default. gcc4.6 doesn't support c++11. So we should select gcc4.7 when
using ndk-r8e. But gcc4.7 is removed in ndk-r9, so we should determine whether gcc4.7 exist.
Conclution:
ndk-r8e -> use gcc4.7
ndk-r9 -> use gcc4.8 | Because ndk-r8e uses gcc4.6 as default. gcc4.6 doesn't support c++11. So we should select gcc4.7 when
using ndk-r8e. But gcc4.7 is removed in ndk-r9, so we should determine whether gcc4.7 exist.
Conclution:
ndk-r8e -> use gcc4.7
ndk-r9 -> use gcc4.8 | [
"Because",
"ndk",
"-",
"r8e",
"uses",
"gcc4",
".",
"6",
"as",
"default",
".",
"gcc4",
".",
"6",
"doesn",
"t",
"support",
"c",
"++",
"11",
".",
"So",
"we",
"should",
"select",
"gcc4",
".",
"7",
"when",
"using",
"ndk",
"-",
"r8e",
".",
"But",
"gcc4... | def select_toolchain_version():
'''Because ndk-r8e uses gcc4.6 as default. gcc4.6 doesn't support c++11. So we should select gcc4.7 when
using ndk-r8e. But gcc4.7 is removed in ndk-r9, so we should determine whether gcc4.7 exist.
Conclution:
ndk-r8e -> use gcc4.7
ndk-r9 -> use gcc4.8
'''
... | [
"def",
"select_toolchain_version",
"(",
")",
":",
"ndk_root",
"=",
"check_environment_variables",
"(",
")",
"if",
"os",
".",
"path",
".",
"isdir",
"(",
"os",
".",
"path",
".",
"join",
"(",
"ndk_root",
",",
"\"toolchains/arm-linux-androideabi-4.8\"",
")",
")",
... | https://github.com/linyouhappy/kongkongxiyou/blob/7a69b2913eb29f4be77f9a62fb90cdd72c4160f1/cocosjs/frameworks/cocos2d-x/plugin/tools/android-build.py#L25-L42 | ||
grpc/grpc | 27bc6fe7797e43298dc931b96dc57322d0852a9f | src/python/grpcio/grpc/_channel.py | python | _MultiThreadedRendezvous.trailing_metadata | (self) | See grpc.Call.trailing_metadata | See grpc.Call.trailing_metadata | [
"See",
"grpc",
".",
"Call",
".",
"trailing_metadata"
] | def trailing_metadata(self):
"""See grpc.Call.trailing_metadata"""
with self._state.condition:
def _done():
return self._state.trailing_metadata is not None
_common.wait(self._state.condition.wait, _done)
return self._state.trailing_metadata | [
"def",
"trailing_metadata",
"(",
"self",
")",
":",
"with",
"self",
".",
"_state",
".",
"condition",
":",
"def",
"_done",
"(",
")",
":",
"return",
"self",
".",
"_state",
".",
"trailing_metadata",
"is",
"not",
"None",
"_common",
".",
"wait",
"(",
"self",
... | https://github.com/grpc/grpc/blob/27bc6fe7797e43298dc931b96dc57322d0852a9f/src/python/grpcio/grpc/_channel.py#L673-L681 | ||
baidu-research/tensorflow-allreduce | 66d5b855e90b0949e9fa5cca5599fd729a70e874 | tensorflow/contrib/keras/python/keras/backend.py | python | repeat_elements | (x, rep, axis) | return concatenate(x_rep, axis) | Repeats the elements of a tensor along an axis, like `np.repeat`.
If `x` has shape `(s1, s2, s3)` and `axis` is `1`, the output
will have shape `(s1, s2 * rep, s3)`.
Arguments:
x: Tensor or variable.
rep: Python integer, number of times to repeat.
axis: Axis along which to repeat.
Raises:
... | Repeats the elements of a tensor along an axis, like `np.repeat`. | [
"Repeats",
"the",
"elements",
"of",
"a",
"tensor",
"along",
"an",
"axis",
"like",
"np",
".",
"repeat",
"."
] | def repeat_elements(x, rep, axis):
"""Repeats the elements of a tensor along an axis, like `np.repeat`.
If `x` has shape `(s1, s2, s3)` and `axis` is `1`, the output
will have shape `(s1, s2 * rep, s3)`.
Arguments:
x: Tensor or variable.
rep: Python integer, number of times to repeat.
axis: ... | [
"def",
"repeat_elements",
"(",
"x",
",",
"rep",
",",
"axis",
")",
":",
"x_shape",
"=",
"x",
".",
"get_shape",
"(",
")",
".",
"as_list",
"(",
")",
"if",
"x_shape",
"[",
"axis",
"]",
"is",
"None",
":",
"raise",
"ValueError",
"(",
"'Axis '",
"+",
"str... | https://github.com/baidu-research/tensorflow-allreduce/blob/66d5b855e90b0949e9fa5cca5599fd729a70e874/tensorflow/contrib/keras/python/keras/backend.py#L1984-L2012 | |
Xilinx/Vitis-AI | fc74d404563d9951b57245443c73bef389f3657f | tools/Vitis-AI-Quantizer/vai_q_tensorflow1.x/tensorflow/lite/tutorials/dataset.py | python | download | (directory, filename) | return filepath | Download (and unzip) a file from the MNIST dataset if not already done. | Download (and unzip) a file from the MNIST dataset if not already done. | [
"Download",
"(",
"and",
"unzip",
")",
"a",
"file",
"from",
"the",
"MNIST",
"dataset",
"if",
"not",
"already",
"done",
"."
] | def download(directory, filename):
"""Download (and unzip) a file from the MNIST dataset if not already done."""
filepath = os.path.join(directory, filename)
if tf.gfile.Exists(filepath):
return filepath
if not tf.gfile.Exists(directory):
tf.gfile.MakeDirs(directory)
# CVDF mirror of http://yann.lecun... | [
"def",
"download",
"(",
"directory",
",",
"filename",
")",
":",
"filepath",
"=",
"os",
".",
"path",
".",
"join",
"(",
"directory",
",",
"filename",
")",
"if",
"tf",
".",
"gfile",
".",
"Exists",
"(",
"filepath",
")",
":",
"return",
"filepath",
"if",
"... | https://github.com/Xilinx/Vitis-AI/blob/fc74d404563d9951b57245443c73bef389f3657f/tools/Vitis-AI-Quantizer/vai_q_tensorflow1.x/tensorflow/lite/tutorials/dataset.py#L67-L83 | |
Polidea/SiriusObfuscator | b0e590d8130e97856afe578869b83a209e2b19be | SymbolExtractorAndRenamer/lldb/scripts/Python/static-binding/lldb.py | python | SBTarget.BreakpointCreateByAddress | (self, *args) | return _lldb.SBTarget_BreakpointCreateByAddress(self, *args) | BreakpointCreateByAddress(self, addr_t address) -> SBBreakpoint | BreakpointCreateByAddress(self, addr_t address) -> SBBreakpoint | [
"BreakpointCreateByAddress",
"(",
"self",
"addr_t",
"address",
")",
"-",
">",
"SBBreakpoint"
] | def BreakpointCreateByAddress(self, *args):
"""BreakpointCreateByAddress(self, addr_t address) -> SBBreakpoint"""
return _lldb.SBTarget_BreakpointCreateByAddress(self, *args) | [
"def",
"BreakpointCreateByAddress",
"(",
"self",
",",
"*",
"args",
")",
":",
"return",
"_lldb",
".",
"SBTarget_BreakpointCreateByAddress",
"(",
"self",
",",
"*",
"args",
")"
] | https://github.com/Polidea/SiriusObfuscator/blob/b0e590d8130e97856afe578869b83a209e2b19be/SymbolExtractorAndRenamer/lldb/scripts/Python/static-binding/lldb.py#L9125-L9127 | |
smilehao/xlua-framework | a03801538be2b0e92d39332d445b22caca1ef61f | ConfigData/trunk/tools/protobuf-2.5.0/protobuf-2.5.0/python/mox.py | python | And.__init__ | (self, *args) | Initialize.
Args:
*args: One or more Comparator | Initialize. | [
"Initialize",
"."
] | def __init__(self, *args):
"""Initialize.
Args:
*args: One or more Comparator
"""
self._comparators = args | [
"def",
"__init__",
"(",
"self",
",",
"*",
"args",
")",
":",
"self",
".",
"_comparators",
"=",
"args"
] | https://github.com/smilehao/xlua-framework/blob/a03801538be2b0e92d39332d445b22caca1ef61f/ConfigData/trunk/tools/protobuf-2.5.0/protobuf-2.5.0/python/mox.py#L1050-L1057 | ||
aws/lumberyard | f85344403c1c2e77ec8c75deb2c116e97b713217 | dev/Gems/CloudGemFramework/v1/AWS/resource-manager-code/lib/setuptools/_vendor/pyparsing.py | python | ParserElement.validate | ( self, validateTrace=[] ) | Check defined expressions for valid structure, check for infinite recursive definitions. | Check defined expressions for valid structure, check for infinite recursive definitions. | [
"Check",
"defined",
"expressions",
"for",
"valid",
"structure",
"check",
"for",
"infinite",
"recursive",
"definitions",
"."
] | def validate( self, validateTrace=[] ):
"""
Check defined expressions for valid structure, check for infinite recursive definitions.
"""
self.checkRecursion( [] ) | [
"def",
"validate",
"(",
"self",
",",
"validateTrace",
"=",
"[",
"]",
")",
":",
"self",
".",
"checkRecursion",
"(",
"[",
"]",
")"
] | https://github.com/aws/lumberyard/blob/f85344403c1c2e77ec8c75deb2c116e97b713217/dev/Gems/CloudGemFramework/v1/AWS/resource-manager-code/lib/setuptools/_vendor/pyparsing.py#L2167-L2171 | ||
wlanjie/AndroidFFmpeg | 7baf9122f4b8e1c74e7baf4be5c422c7a5ba5aaf | tools/fdk-aac-build/x86/toolchain/lib/python2.7/timeit.py | python | Timer.__init__ | (self, stmt="pass", setup="pass", timer=default_timer) | Constructor. See class doc string. | Constructor. See class doc string. | [
"Constructor",
".",
"See",
"class",
"doc",
"string",
"."
] | def __init__(self, stmt="pass", setup="pass", timer=default_timer):
"""Constructor. See class doc string."""
self.timer = timer
ns = {}
if isinstance(stmt, basestring):
stmt = reindent(stmt, 8)
if isinstance(setup, basestring):
setup = reindent(se... | [
"def",
"__init__",
"(",
"self",
",",
"stmt",
"=",
"\"pass\"",
",",
"setup",
"=",
"\"pass\"",
",",
"timer",
"=",
"default_timer",
")",
":",
"self",
".",
"timer",
"=",
"timer",
"ns",
"=",
"{",
"}",
"if",
"isinstance",
"(",
"stmt",
",",
"basestring",
")... | https://github.com/wlanjie/AndroidFFmpeg/blob/7baf9122f4b8e1c74e7baf4be5c422c7a5ba5aaf/tools/fdk-aac-build/x86/toolchain/lib/python2.7/timeit.py#L121-L149 | ||
google/mediapipe | e6c19885c6d3c6f410c730952aeed2852790d306 | mediapipe/python/solutions/selfie_segmentation.py | python | SelfieSegmentation.process | (self, image: np.ndarray) | return super().process(input_data={'image': image}) | Processes an RGB image and returns a segmentation mask.
Args:
image: An RGB image represented as a numpy ndarray.
Raises:
RuntimeError: If the underlying graph throws any error.
ValueError: If the input image is not three channel RGB.
Returns:
A NamedTuple object with a "segmentat... | Processes an RGB image and returns a segmentation mask. | [
"Processes",
"an",
"RGB",
"image",
"and",
"returns",
"a",
"segmentation",
"mask",
"."
] | def process(self, image: np.ndarray) -> NamedTuple:
"""Processes an RGB image and returns a segmentation mask.
Args:
image: An RGB image represented as a numpy ndarray.
Raises:
RuntimeError: If the underlying graph throws any error.
ValueError: If the input image is not three channel RGB... | [
"def",
"process",
"(",
"self",
",",
"image",
":",
"np",
".",
"ndarray",
")",
"->",
"NamedTuple",
":",
"return",
"super",
"(",
")",
".",
"process",
"(",
"input_data",
"=",
"{",
"'image'",
":",
"image",
"}",
")"
] | https://github.com/google/mediapipe/blob/e6c19885c6d3c6f410c730952aeed2852790d306/mediapipe/python/solutions/selfie_segmentation.py#L61-L76 | |
root-project/root | fcd3583bb14852bf2e8cd2415717cbaac0e75896 | bindings/pyroot/pythonizations/python/ROOT/_pythonization/_rdataframe.py | python | AsNumpyResult.__init__ | (self, result_ptrs, columns) | Constructs an AsNumpyResult object.
Parameters:
result_ptrs (dict): results of the AsNumpy action. The key is the
column name, the value is the result pointer for that column.
columns (list): list of the names of the columns returned by
AsNumpy. | Constructs an AsNumpyResult object. | [
"Constructs",
"an",
"AsNumpyResult",
"object",
"."
] | def __init__(self, result_ptrs, columns):
"""Constructs an AsNumpyResult object.
Parameters:
result_ptrs (dict): results of the AsNumpy action. The key is the
column name, the value is the result pointer for that column.
columns (list): list of the names of the c... | [
"def",
"__init__",
"(",
"self",
",",
"result_ptrs",
",",
"columns",
")",
":",
"self",
".",
"_result_ptrs",
"=",
"result_ptrs",
"self",
".",
"_columns",
"=",
"columns",
"self",
".",
"_py_arrays",
"=",
"None"
] | https://github.com/root-project/root/blob/fcd3583bb14852bf2e8cd2415717cbaac0e75896/bindings/pyroot/pythonizations/python/ROOT/_pythonization/_rdataframe.py#L268-L280 | ||
aws/lumberyard | f85344403c1c2e77ec8c75deb2c116e97b713217 | dev/Gems/CloudGemMetric/v1/AWS/common-code/Lib/llvmlite/ir/builder.py | python | IRBuilder.and_ | (self, lhs, rhs, name='') | Bitwise integer AND:
name = lhs & rhs | Bitwise integer AND:
name = lhs & rhs | [
"Bitwise",
"integer",
"AND",
":",
"name",
"=",
"lhs",
"&",
"rhs"
] | def and_(self, lhs, rhs, name=''):
"""
Bitwise integer AND:
name = lhs & rhs
""" | [
"def",
"and_",
"(",
"self",
",",
"lhs",
",",
"rhs",
",",
"name",
"=",
"''",
")",
":"
] | https://github.com/aws/lumberyard/blob/f85344403c1c2e77ec8c75deb2c116e97b713217/dev/Gems/CloudGemMetric/v1/AWS/common-code/Lib/llvmlite/ir/builder.py#L451-L455 | ||
devsisters/libquic | 8954789a056d8e7d5fcb6452fd1572ca57eb5c4e | src/third_party/protobuf/python/google/protobuf/internal/well_known_types.py | python | Duration.ToJsonString | (self) | return result + '.%09ds' % nanos | Converts Duration to string format.
Returns:
A string converted from self. The string format will contains
3, 6, or 9 fractional digits depending on the precision required to
represent the exact Duration value. For example: "1s", "1.010s",
"1.000000100s", "-3.100s" | Converts Duration to string format. | [
"Converts",
"Duration",
"to",
"string",
"format",
"."
] | def ToJsonString(self):
"""Converts Duration to string format.
Returns:
A string converted from self. The string format will contains
3, 6, or 9 fractional digits depending on the precision required to
represent the exact Duration value. For example: "1s", "1.010s",
"1.000000100s", "-3.... | [
"def",
"ToJsonString",
"(",
"self",
")",
":",
"if",
"self",
".",
"seconds",
"<",
"0",
"or",
"self",
".",
"nanos",
"<",
"0",
":",
"result",
"=",
"'-'",
"seconds",
"=",
"-",
"self",
".",
"seconds",
"+",
"int",
"(",
"(",
"0",
"-",
"self",
".",
"na... | https://github.com/devsisters/libquic/blob/8954789a056d8e7d5fcb6452fd1572ca57eb5c4e/src/third_party/protobuf/python/google/protobuf/internal/well_known_types.py#L241-L270 | |
aws/lumberyard | f85344403c1c2e77ec8c75deb2c116e97b713217 | dev/Tools/Python/3.7.10/mac/Python.framework/Versions/3.7/lib/python3.7/distutils/command/install.py | python | install.has_scripts | (self) | return self.distribution.has_scripts() | Returns true if the current distribution has any scripts to.
install. | Returns true if the current distribution has any scripts to.
install. | [
"Returns",
"true",
"if",
"the",
"current",
"distribution",
"has",
"any",
"scripts",
"to",
".",
"install",
"."
] | def has_scripts(self):
"""Returns true if the current distribution has any scripts to.
install."""
return self.distribution.has_scripts() | [
"def",
"has_scripts",
"(",
"self",
")",
":",
"return",
"self",
".",
"distribution",
".",
"has_scripts",
"(",
")"
] | https://github.com/aws/lumberyard/blob/f85344403c1c2e77ec8c75deb2c116e97b713217/dev/Tools/Python/3.7.10/mac/Python.framework/Versions/3.7/lib/python3.7/distutils/command/install.py#L639-L642 | |
kushview/Element | 1cc16380caa2ab79461246ba758b9de1f46db2a5 | waflib/extras/sphinx.py | python | configure | (cnf) | Check if sphinx-build program is available and loads gnu_dirs tool. | Check if sphinx-build program is available and loads gnu_dirs tool. | [
"Check",
"if",
"sphinx",
"-",
"build",
"program",
"is",
"available",
"and",
"loads",
"gnu_dirs",
"tool",
"."
] | def configure(cnf):
"""Check if sphinx-build program is available and loads gnu_dirs tool."""
cnf.find_program('sphinx-build', var='SPHINX_BUILD', mandatory=False)
cnf.load('gnu_dirs') | [
"def",
"configure",
"(",
"cnf",
")",
":",
"cnf",
".",
"find_program",
"(",
"'sphinx-build'",
",",
"var",
"=",
"'SPHINX_BUILD'",
",",
"mandatory",
"=",
"False",
")",
"cnf",
".",
"load",
"(",
"'gnu_dirs'",
")"
] | https://github.com/kushview/Element/blob/1cc16380caa2ab79461246ba758b9de1f46db2a5/waflib/extras/sphinx.py#L27-L30 | ||
wxWidgets/wxPython-Classic | 19571e1ae65f1ac445f5491474121998c97a1bf0 | src/msw/_gdi.py | python | DC.DrawRoundedRectangle | (*args, **kwargs) | return _gdi_.DC_DrawRoundedRectangle(*args, **kwargs) | DrawRoundedRectangle(self, int x, int y, int width, int height, double radius)
Draws a rectangle with the given top left corner, and with the given
size. The corners are quarter-circles using the given radius. The
current pen is used for the outline and the current brush for filling
the... | DrawRoundedRectangle(self, int x, int y, int width, int height, double radius) | [
"DrawRoundedRectangle",
"(",
"self",
"int",
"x",
"int",
"y",
"int",
"width",
"int",
"height",
"double",
"radius",
")"
] | def DrawRoundedRectangle(*args, **kwargs):
"""
DrawRoundedRectangle(self, int x, int y, int width, int height, double radius)
Draws a rectangle with the given top left corner, and with the given
size. The corners are quarter-circles using the given radius. The
current pen is use... | [
"def",
"DrawRoundedRectangle",
"(",
"*",
"args",
",",
"*",
"*",
"kwargs",
")",
":",
"return",
"_gdi_",
".",
"DC_DrawRoundedRectangle",
"(",
"*",
"args",
",",
"*",
"*",
"kwargs",
")"
] | https://github.com/wxWidgets/wxPython-Classic/blob/19571e1ae65f1ac445f5491474121998c97a1bf0/src/msw/_gdi.py#L3665-L3681 | |
ApolloAuto/apollo-platform | 86d9dc6743b496ead18d597748ebabd34a513289 | ros/ros_comm/roslaunch/src/roslaunch/config.py | python | ROSLaunchConfig.add_machine | (self, m, verbose=True) | Declare a machine and associated parameters so that it can be used for
running nodes.
@param m: machine instance
@type m: L{Machine}
@return: True if new machine added, False if machine already specified.
@rtype: bool
@raises RLException: if cannot add machine as specifi... | Declare a machine and associated parameters so that it can be used for
running nodes. | [
"Declare",
"a",
"machine",
"and",
"associated",
"parameters",
"so",
"that",
"it",
"can",
"be",
"used",
"for",
"running",
"nodes",
"."
] | def add_machine(self, m, verbose=True):
"""
Declare a machine and associated parameters so that it can be used for
running nodes.
@param m: machine instance
@type m: L{Machine}
@return: True if new machine added, False if machine already specified.
@rtype: bool
... | [
"def",
"add_machine",
"(",
"self",
",",
"m",
",",
"verbose",
"=",
"True",
")",
":",
"name",
"=",
"m",
".",
"name",
"# Fuerte: all machines must have an env loader. We can guess",
"# it from the distro name for easier migration.",
"if",
"not",
"m",
".",
"env_loader",
"... | https://github.com/ApolloAuto/apollo-platform/blob/86d9dc6743b496ead18d597748ebabd34a513289/ros/ros_comm/roslaunch/src/roslaunch/config.py#L321-L347 | ||
Ewenwan/MVision | 97b394dfa48cb21c82cd003b1a952745e413a17f | CNN/ShuffleNet/layers.py | python | conv2d | (name, x, w=None, num_filters=16, kernel_size=(3, 3), padding='SAME', stride=(1, 1),
initializer=tf.contrib.layers.xavier_initializer(), l2_strength=0.0, bias=0.0,
activation=None, batchnorm_enabled=False, max_pool_enabled=False, dropout_keep_prob=-1,
is_training=True) | return conv_o | This block is responsible for a convolution 2D layer followed by optional (non-linearity, dropout, max-pooling).
Note that: "is_training" should be passed by a correct value based on being in either training or testing.
:param name: (string) The name scope provided by the upper tf.name_scope('name') as scope.
... | This block is responsible for a convolution 2D layer followed by optional (non-linearity, dropout, max-pooling).
Note that: "is_training" should be passed by a correct value based on being in either training or testing.
:param name: (string) The name scope provided by the upper tf.name_scope('name') as scope.
... | [
"This",
"block",
"is",
"responsible",
"for",
"a",
"convolution",
"2D",
"layer",
"followed",
"by",
"optional",
"(",
"non",
"-",
"linearity",
"dropout",
"max",
"-",
"pooling",
")",
".",
"Note",
"that",
":",
"is_training",
"should",
"be",
"passed",
"by",
"a",... | def conv2d(name, x, w=None, num_filters=16, kernel_size=(3, 3), padding='SAME', stride=(1, 1),
initializer=tf.contrib.layers.xavier_initializer(), l2_strength=0.0, bias=0.0,
activation=None, batchnorm_enabled=False, max_pool_enabled=False, dropout_keep_prob=-1,
is_training=True):
""... | [
"def",
"conv2d",
"(",
"name",
",",
"x",
",",
"w",
"=",
"None",
",",
"num_filters",
"=",
"16",
",",
"kernel_size",
"=",
"(",
"3",
",",
"3",
")",
",",
"padding",
"=",
"'SAME'",
",",
"stride",
"=",
"(",
"1",
",",
"1",
")",
",",
"initializer",
"=",... | https://github.com/Ewenwan/MVision/blob/97b394dfa48cb21c82cd003b1a952745e413a17f/CNN/ShuffleNet/layers.py#L60-L118 | |
Polidea/SiriusObfuscator | b0e590d8130e97856afe578869b83a209e2b19be | SymbolExtractorAndRenamer/lldb/scripts/Python/static-binding/lldb.py | python | SBBlock.GetInlinedCallSiteLine | (self) | return _lldb.SBBlock_GetInlinedCallSiteLine(self) | GetInlinedCallSiteLine(self) -> uint32_t
Get the call site line if this block represents an inlined function;
otherwise, return 0. | GetInlinedCallSiteLine(self) -> uint32_t | [
"GetInlinedCallSiteLine",
"(",
"self",
")",
"-",
">",
"uint32_t"
] | def GetInlinedCallSiteLine(self):
"""
GetInlinedCallSiteLine(self) -> uint32_t
Get the call site line if this block represents an inlined function;
otherwise, return 0.
"""
return _lldb.SBBlock_GetInlinedCallSiteLine(self) | [
"def",
"GetInlinedCallSiteLine",
"(",
"self",
")",
":",
"return",
"_lldb",
".",
"SBBlock_GetInlinedCallSiteLine",
"(",
"self",
")"
] | https://github.com/Polidea/SiriusObfuscator/blob/b0e590d8130e97856afe578869b83a209e2b19be/SymbolExtractorAndRenamer/lldb/scripts/Python/static-binding/lldb.py#L1203-L1210 | |
catboost/catboost | 167f64f237114a4d10b2b4ee42adb4569137debe | contrib/tools/python/src/Lib/xml/sax/handler.py | python | ContentHandler.startDocument | (self) | Receive notification of the beginning of a document.
The SAX parser will invoke this method only once, before any
other methods in this interface or in DTDHandler (except for
setDocumentLocator). | Receive notification of the beginning of a document. | [
"Receive",
"notification",
"of",
"the",
"beginning",
"of",
"a",
"document",
"."
] | def startDocument(self):
"""Receive notification of the beginning of a document.
The SAX parser will invoke this method only once, before any
other methods in this interface or in DTDHandler (except for
setDocumentLocator).""" | [
"def",
"startDocument",
"(",
"self",
")",
":"
] | https://github.com/catboost/catboost/blob/167f64f237114a4d10b2b4ee42adb4569137debe/contrib/tools/python/src/Lib/xml/sax/handler.py#L80-L85 | ||
llvm/llvm-project | ffa6262cb4e2a335d26416fad39a581b4f98c5f4 | bolt/utils/llvm-bolt-wrapper.py | python | parse_cmp_offset | (cmp_out) | return int(re.search(r'byte (\d+),', cmp_out).groups()[0]) | Extracts byte number from cmp output:
file1 file2 differ: byte X, line Y | Extracts byte number from cmp output:
file1 file2 differ: byte X, line Y | [
"Extracts",
"byte",
"number",
"from",
"cmp",
"output",
":",
"file1",
"file2",
"differ",
":",
"byte",
"X",
"line",
"Y"
] | def parse_cmp_offset(cmp_out):
'''
Extracts byte number from cmp output:
file1 file2 differ: byte X, line Y
'''
return int(re.search(r'byte (\d+),', cmp_out).groups()[0]) | [
"def",
"parse_cmp_offset",
"(",
"cmp_out",
")",
":",
"return",
"int",
"(",
"re",
".",
"search",
"(",
"r'byte (\\d+),'",
",",
"cmp_out",
")",
".",
"groups",
"(",
")",
"[",
"0",
"]",
")"
] | https://github.com/llvm/llvm-project/blob/ffa6262cb4e2a335d26416fad39a581b4f98c5f4/bolt/utils/llvm-bolt-wrapper.py#L204-L209 | |
hcdth011/ROS-Hydro-SLAM | 629448eecd2c9a3511158115fa53ea9e4ae41359 | rpg_svo/svo_analysis/src/svo_analysis/tum_benchmark_tools/evaluate_ate.py | python | plot_traj | (ax,stamps,traj,style,color,label) | Plot a trajectory using matplotlib.
Input:
ax -- the plot
stamps -- time stamps (1xn)
traj -- trajectory (3xn)
style -- line style
color -- line color
label -- plot legend | Plot a trajectory using matplotlib.
Input:
ax -- the plot
stamps -- time stamps (1xn)
traj -- trajectory (3xn)
style -- line style
color -- line color
label -- plot legend | [
"Plot",
"a",
"trajectory",
"using",
"matplotlib",
".",
"Input",
":",
"ax",
"--",
"the",
"plot",
"stamps",
"--",
"time",
"stamps",
"(",
"1xn",
")",
"traj",
"--",
"trajectory",
"(",
"3xn",
")",
"style",
"--",
"line",
"style",
"color",
"--",
"line",
"colo... | def plot_traj(ax,stamps,traj,style,color,label):
"""
Plot a trajectory using matplotlib.
Input:
ax -- the plot
stamps -- time stamps (1xn)
traj -- trajectory (3xn)
style -- line style
color -- line color
label -- plot legend
"""
stamps.sort()
interval = numpy.m... | [
"def",
"plot_traj",
"(",
"ax",
",",
"stamps",
",",
"traj",
",",
"style",
",",
"color",
",",
"label",
")",
":",
"stamps",
".",
"sort",
"(",
")",
"interval",
"=",
"numpy",
".",
"median",
"(",
"[",
"s",
"-",
"t",
"for",
"s",
",",
"t",
"in",
"zip",... | https://github.com/hcdth011/ROS-Hydro-SLAM/blob/629448eecd2c9a3511158115fa53ea9e4ae41359/rpg_svo/svo_analysis/src/svo_analysis/tum_benchmark_tools/evaluate_ate.py#L81-L110 | ||
mhammond/pywin32 | 44afd86ba8485194df93234639243252deeb40d5 | win32/Lib/win32timezone.py | python | TimeZoneInfo.getWinInfo | (self, targetYear) | return self.dynamicInfo.get(targetYear, self.dynamicInfo[RangeMap.last_item]) | Return the most relevant "info" for this time zone
in the target year. | Return the most relevant "info" for this time zone
in the target year. | [
"Return",
"the",
"most",
"relevant",
"info",
"for",
"this",
"time",
"zone",
"in",
"the",
"target",
"year",
"."
] | def getWinInfo(self, targetYear):
"""
Return the most relevant "info" for this time zone
in the target year.
"""
if not hasattr(self, "dynamicInfo") or not self.dynamicInfo:
return self.staticInfo
# Find the greatest year entry in self.dynamicInfo which is for... | [
"def",
"getWinInfo",
"(",
"self",
",",
"targetYear",
")",
":",
"if",
"not",
"hasattr",
"(",
"self",
",",
"\"dynamicInfo\"",
")",
"or",
"not",
"self",
".",
"dynamicInfo",
":",
"return",
"self",
".",
"staticInfo",
"# Find the greatest year entry in self.dynamicInfo ... | https://github.com/mhammond/pywin32/blob/44afd86ba8485194df93234639243252deeb40d5/win32/Lib/win32timezone.py#L603-L613 | |
kamyu104/LeetCode-Solutions | 77605708a927ea3b85aee5a479db733938c7c211 | Python/maximum-number-of-events-that-can-be-attended-ii.py | python | Solution.maxValue | (self, events, k) | return dp[-1][-1] | :type events: List[List[int]]
:type k: int
:rtype: int | :type events: List[List[int]]
:type k: int
:rtype: int | [
":",
"type",
"events",
":",
"List",
"[",
"List",
"[",
"int",
"]]",
":",
"type",
"k",
":",
"int",
":",
"rtype",
":",
"int"
] | def maxValue(self, events, k):
"""
:type events: List[List[int]]
:type k: int
:rtype: int
"""
events.sort(key=lambda x: x[1])
sorted_ends = [x[1] for x in events]
dp = [[0]*(k+1) for _ in xrange(len(events)+1)]
for i in xrange(1, len(events)+1):
... | [
"def",
"maxValue",
"(",
"self",
",",
"events",
",",
"k",
")",
":",
"events",
".",
"sort",
"(",
"key",
"=",
"lambda",
"x",
":",
"x",
"[",
"1",
"]",
")",
"sorted_ends",
"=",
"[",
"x",
"[",
"1",
"]",
"for",
"x",
"in",
"events",
"]",
"dp",
"=",
... | https://github.com/kamyu104/LeetCode-Solutions/blob/77605708a927ea3b85aee5a479db733938c7c211/Python/maximum-number-of-events-that-can-be-attended-ii.py#L8-L21 | |
aws/lumberyard | f85344403c1c2e77ec8c75deb2c116e97b713217 | dev/Gems/CloudGemMetric/v1/AWS/python/windows/Lib/psutil/_common.py | python | _WrapNumbers.run | (self, input_dict, name) | return new_dict | Cache dict and sum numbers which overflow and wrap.
Return an updated copy of `input_dict` | Cache dict and sum numbers which overflow and wrap.
Return an updated copy of `input_dict` | [
"Cache",
"dict",
"and",
"sum",
"numbers",
"which",
"overflow",
"and",
"wrap",
".",
"Return",
"an",
"updated",
"copy",
"of",
"input_dict"
] | def run(self, input_dict, name):
"""Cache dict and sum numbers which overflow and wrap.
Return an updated copy of `input_dict`
"""
if name not in self.cache:
# This was the first call.
self._add_dict(input_dict, name)
return input_dict
self._r... | [
"def",
"run",
"(",
"self",
",",
"input_dict",
",",
"name",
")",
":",
"if",
"name",
"not",
"in",
"self",
".",
"cache",
":",
"# This was the first call.",
"self",
".",
"_add_dict",
"(",
"input_dict",
",",
"name",
")",
"return",
"input_dict",
"self",
".",
"... | https://github.com/aws/lumberyard/blob/f85344403c1c2e77ec8c75deb2c116e97b713217/dev/Gems/CloudGemMetric/v1/AWS/python/windows/Lib/psutil/_common.py#L641-L678 | |
aws/lumberyard | f85344403c1c2e77ec8c75deb2c116e97b713217 | dev/Tools/Python/3.7.10/mac/Python.framework/Versions/3.7/lib/python3.7/mailbox.py | python | _singlefileMailbox._post_message_hook | (self, f) | return | Called after writing each message to file f. | Called after writing each message to file f. | [
"Called",
"after",
"writing",
"each",
"message",
"to",
"file",
"f",
"."
] | def _post_message_hook(self, f):
"""Called after writing each message to file f."""
return | [
"def",
"_post_message_hook",
"(",
"self",
",",
"f",
")",
":",
"return"
] | https://github.com/aws/lumberyard/blob/f85344403c1c2e77ec8c75deb2c116e97b713217/dev/Tools/Python/3.7.10/mac/Python.framework/Versions/3.7/lib/python3.7/mailbox.py#L721-L723 | |
catboost/catboost | 167f64f237114a4d10b2b4ee42adb4569137debe | contrib/python/pandas/py2/pandas/core/generic.py | python | NDFrame.describe | (self, percentiles=None, include=None, exclude=None) | return d | Generate descriptive statistics that summarize the central tendency,
dispersion and shape of a dataset's distribution, excluding
``NaN`` values.
Analyzes both numeric and object series, as well
as ``DataFrame`` column sets of mixed data types. The output
will vary depending on w... | Generate descriptive statistics that summarize the central tendency,
dispersion and shape of a dataset's distribution, excluding
``NaN`` values. | [
"Generate",
"descriptive",
"statistics",
"that",
"summarize",
"the",
"central",
"tendency",
"dispersion",
"and",
"shape",
"of",
"a",
"dataset",
"s",
"distribution",
"excluding",
"NaN",
"values",
"."
] | def describe(self, percentiles=None, include=None, exclude=None):
"""
Generate descriptive statistics that summarize the central tendency,
dispersion and shape of a dataset's distribution, excluding
``NaN`` values.
Analyzes both numeric and object series, as well
as ``Da... | [
"def",
"describe",
"(",
"self",
",",
"percentiles",
"=",
"None",
",",
"include",
"=",
"None",
",",
"exclude",
"=",
"None",
")",
":",
"if",
"self",
".",
"ndim",
">=",
"3",
":",
"msg",
"=",
"\"describe is not implemented on Panel objects.\"",
"raise",
"NotImpl... | https://github.com/catboost/catboost/blob/167f64f237114a4d10b2b4ee42adb4569137debe/contrib/python/pandas/py2/pandas/core/generic.py#L9484-L9815 | |
BlzFans/wke | b0fa21158312e40c5fbd84682d643022b6c34a93 | cygwin/lib/python2.6/cgi.py | python | parse_qsl | (qs, keep_blank_values=0, strict_parsing=0) | return urlparse.parse_qsl(qs, keep_blank_values, strict_parsing) | Parse a query given as a string argument. | Parse a query given as a string argument. | [
"Parse",
"a",
"query",
"given",
"as",
"a",
"string",
"argument",
"."
] | def parse_qsl(qs, keep_blank_values=0, strict_parsing=0):
"""Parse a query given as a string argument."""
warn("cgi.parse_qsl is deprecated, use urlparse.parse_qsl instead",
PendingDeprecationWarning, 2)
return urlparse.parse_qsl(qs, keep_blank_values, strict_parsing) | [
"def",
"parse_qsl",
"(",
"qs",
",",
"keep_blank_values",
"=",
"0",
",",
"strict_parsing",
"=",
"0",
")",
":",
"warn",
"(",
"\"cgi.parse_qsl is deprecated, use urlparse.parse_qsl instead\"",
",",
"PendingDeprecationWarning",
",",
"2",
")",
"return",
"urlparse",
".",
... | https://github.com/BlzFans/wke/blob/b0fa21158312e40c5fbd84682d643022b6c34a93/cygwin/lib/python2.6/cgi.py#L188-L192 | |
benoitsteiner/tensorflow-opencl | cb7cb40a57fde5cfd4731bc551e82a1e2fef43a5 | tensorflow/python/ops/variables.py | python | initialize_variables | (var_list, name="init") | return variables_initializer(var_list, name=name) | See `tf.variables_initializer`. | See `tf.variables_initializer`. | [
"See",
"tf",
".",
"variables_initializer",
"."
] | def initialize_variables(var_list, name="init"):
"""See `tf.variables_initializer`."""
return variables_initializer(var_list, name=name) | [
"def",
"initialize_variables",
"(",
"var_list",
",",
"name",
"=",
"\"init\"",
")",
":",
"return",
"variables_initializer",
"(",
"var_list",
",",
"name",
"=",
"name",
")"
] | https://github.com/benoitsteiner/tensorflow-opencl/blob/cb7cb40a57fde5cfd4731bc551e82a1e2fef43a5/tensorflow/python/ops/variables.py#L1391-L1393 | |
ucb-bar/esp-llvm | 8aec2ae754fd66d4e73b9b777a9f20c4583a0f03 | utils/lit/lit/ShUtil.py | python | ShLexer.maybe_eat | (self, c) | return False | maybe_eat(c) - Consume the character c if it is the next character,
returning True if a character was consumed. | maybe_eat(c) - Consume the character c if it is the next character,
returning True if a character was consumed. | [
"maybe_eat",
"(",
"c",
")",
"-",
"Consume",
"the",
"character",
"c",
"if",
"it",
"is",
"the",
"next",
"character",
"returning",
"True",
"if",
"a",
"character",
"was",
"consumed",
"."
] | def maybe_eat(self, c):
"""
maybe_eat(c) - Consume the character c if it is the next character,
returning True if a character was consumed. """
if self.data[self.pos] == c:
self.pos += 1
return True
return False | [
"def",
"maybe_eat",
"(",
"self",
",",
"c",
")",
":",
"if",
"self",
".",
"data",
"[",
"self",
".",
"pos",
"]",
"==",
"c",
":",
"self",
".",
"pos",
"+=",
"1",
"return",
"True",
"return",
"False"
] | https://github.com/ucb-bar/esp-llvm/blob/8aec2ae754fd66d4e73b9b777a9f20c4583a0f03/utils/lit/lit/ShUtil.py#L22-L29 | |
hpi-xnor/BMXNet-v2 | af2b1859eafc5c721b1397cef02f946aaf2ce20d | example/neural-style/nstyle.py | python | get_tv_grad_executor | (img, ctx, tv_weight) | return out.bind(ctx, args={"img": img,
"kernel": kernel}) | create TV gradient executor with input binded on img | create TV gradient executor with input binded on img | [
"create",
"TV",
"gradient",
"executor",
"with",
"input",
"binded",
"on",
"img"
] | def get_tv_grad_executor(img, ctx, tv_weight):
"""create TV gradient executor with input binded on img
"""
if tv_weight <= 0.0:
return None
nchannel = img.shape[1]
simg = mx.sym.Variable("img")
skernel = mx.sym.Variable("kernel")
channels = mx.sym.SliceChannel(simg, num_outputs=nchan... | [
"def",
"get_tv_grad_executor",
"(",
"img",
",",
"ctx",
",",
"tv_weight",
")",
":",
"if",
"tv_weight",
"<=",
"0.0",
":",
"return",
"None",
"nchannel",
"=",
"img",
".",
"shape",
"[",
"1",
"]",
"simg",
"=",
"mx",
".",
"sym",
".",
"Variable",
"(",
"\"img... | https://github.com/hpi-xnor/BMXNet-v2/blob/af2b1859eafc5c721b1397cef02f946aaf2ce20d/example/neural-style/nstyle.py#L143-L165 | |
Constellation/iv | 64c3a9c7c517063f29d90d449180ea8f6f4d946f | tools/cpplint.py | python | CloseExpression | (clean_lines, linenum, pos) | return (line, clean_lines.NumLines(), -1) | If input points to ( or { or [ or <, finds the position that closes it.
If lines[linenum][pos] points to a '(' or '{' or '[' or '<', finds the
linenum/pos that correspond to the closing of the expression.
Args:
clean_lines: A CleansedLines instance containing the file.
linenum: The number of the line to... | If input points to ( or { or [ or <, finds the position that closes it. | [
"If",
"input",
"points",
"to",
"(",
"or",
"{",
"or",
"[",
"or",
"<",
"finds",
"the",
"position",
"that",
"closes",
"it",
"."
] | def CloseExpression(clean_lines, linenum, pos):
"""If input points to ( or { or [ or <, finds the position that closes it.
If lines[linenum][pos] points to a '(' or '{' or '[' or '<', finds the
linenum/pos that correspond to the closing of the expression.
Args:
clean_lines: A CleansedLines instance contai... | [
"def",
"CloseExpression",
"(",
"clean_lines",
",",
"linenum",
",",
"pos",
")",
":",
"line",
"=",
"clean_lines",
".",
"elided",
"[",
"linenum",
"]",
"startchar",
"=",
"line",
"[",
"pos",
"]",
"if",
"startchar",
"not",
"in",
"'({[<'",
":",
"return",
"(",
... | https://github.com/Constellation/iv/blob/64c3a9c7c517063f29d90d449180ea8f6f4d946f/tools/cpplint.py#L1242-L1285 | |
windystrife/UnrealEngine_NVIDIAGameWorks | b50e6338a7c5b26374d66306ebc7807541ff815e | Engine/Extras/ThirdPartyNotUE/emsdk/Win64/python/2.7.5.3_64bit/Lib/site-packages/pythonwin/pywin/framework/scriptutils.py | python | GetActiveView | () | Gets the edit control (eg, EditView) with the focus, or None | Gets the edit control (eg, EditView) with the focus, or None | [
"Gets",
"the",
"edit",
"control",
"(",
"eg",
"EditView",
")",
"with",
"the",
"focus",
"or",
"None"
] | def GetActiveView():
"""Gets the edit control (eg, EditView) with the focus, or None
"""
try:
childFrame, bIsMaximised = win32ui.GetMainFrame().MDIGetActive()
return childFrame.GetActiveView()
except win32ui.error:
return None | [
"def",
"GetActiveView",
"(",
")",
":",
"try",
":",
"childFrame",
",",
"bIsMaximised",
"=",
"win32ui",
".",
"GetMainFrame",
"(",
")",
".",
"MDIGetActive",
"(",
")",
"return",
"childFrame",
".",
"GetActiveView",
"(",
")",
"except",
"win32ui",
".",
"error",
"... | https://github.com/windystrife/UnrealEngine_NVIDIAGameWorks/blob/b50e6338a7c5b26374d66306ebc7807541ff815e/Engine/Extras/ThirdPartyNotUE/emsdk/Win64/python/2.7.5.3_64bit/Lib/site-packages/pythonwin/pywin/framework/scriptutils.py#L116-L123 | ||
baidu-research/tensorflow-allreduce | 66d5b855e90b0949e9fa5cca5599fd729a70e874 | tensorflow/contrib/crf/python/ops/crf.py | python | crf_log_likelihood | (inputs,
tag_indices,
sequence_lengths,
transition_params=None) | return log_likelihood, transition_params | Computes the log-likelihood of tag sequences in a CRF.
Args:
inputs: A [batch_size, max_seq_len, num_tags] tensor of unary potentials
to use as input to the CRF layer.
tag_indices: A [batch_size, max_seq_len] matrix of tag indices for which we
compute the log-likelihood.
sequence_lengths:... | Computes the log-likelihood of tag sequences in a CRF. | [
"Computes",
"the",
"log",
"-",
"likelihood",
"of",
"tag",
"sequences",
"in",
"a",
"CRF",
"."
] | def crf_log_likelihood(inputs,
tag_indices,
sequence_lengths,
transition_params=None):
"""Computes the log-likelihood of tag sequences in a CRF.
Args:
inputs: A [batch_size, max_seq_len, num_tags] tensor of unary potentials
to use as ... | [
"def",
"crf_log_likelihood",
"(",
"inputs",
",",
"tag_indices",
",",
"sequence_lengths",
",",
"transition_params",
"=",
"None",
")",
":",
"# Get shape information.",
"num_tags",
"=",
"inputs",
".",
"get_shape",
"(",
")",
"[",
"2",
"]",
".",
"value",
"# Get the t... | https://github.com/baidu-research/tensorflow-allreduce/blob/66d5b855e90b0949e9fa5cca5599fd729a70e874/tensorflow/contrib/crf/python/ops/crf.py#L128-L160 | |
kamyu104/LeetCode-Solutions | 77605708a927ea3b85aee5a479db733938c7c211 | Python/paint-house.py | python | Solution.minCost | (self, costs) | return min(min_cost[(n - 1) % 2]) | :type costs: List[List[int]]
:rtype: int | :type costs: List[List[int]]
:rtype: int | [
":",
"type",
"costs",
":",
"List",
"[",
"List",
"[",
"int",
"]]",
":",
"rtype",
":",
"int"
] | def minCost(self, costs):
"""
:type costs: List[List[int]]
:rtype: int
"""
if not costs:
return 0
min_cost = [costs[0], [0, 0, 0]]
n = len(costs)
for i in xrange(1, n):
min_cost[i % 2][0] = costs[i][0] + \
... | [
"def",
"minCost",
"(",
"self",
",",
"costs",
")",
":",
"if",
"not",
"costs",
":",
"return",
"0",
"min_cost",
"=",
"[",
"costs",
"[",
"0",
"]",
",",
"[",
"0",
",",
"0",
",",
"0",
"]",
"]",
"n",
"=",
"len",
"(",
"costs",
")",
"for",
"i",
"in"... | https://github.com/kamyu104/LeetCode-Solutions/blob/77605708a927ea3b85aee5a479db733938c7c211/Python/paint-house.py#L5-L24 | |
bristolcrypto/SPDZ-2 | 721abfae849625a02ea49aabc534f9cf41ca643f | Compiler/comparison.py | python | Trunc | (d, a, k, m, kappa, signed) | d = a >> m
k: bit length of a
m: compile-time integer
signed: True/False, describes a | d = a >> m | [
"d",
"=",
"a",
">>",
"m"
] | def Trunc(d, a, k, m, kappa, signed):
"""
d = a >> m
k: bit length of a
m: compile-time integer
signed: True/False, describes a
"""
a_prime = program.curr_block.new_reg('s')
t = program.curr_block.new_reg('s')
c = [program.curr_block.new_reg('c') for i in range(3)]
c2m = program... | [
"def",
"Trunc",
"(",
"d",
",",
"a",
",",
"k",
",",
"m",
",",
"kappa",
",",
"signed",
")",
":",
"a_prime",
"=",
"program",
".",
"curr_block",
".",
"new_reg",
"(",
"'s'",
")",
"t",
"=",
"program",
".",
"curr_block",
".",
"new_reg",
"(",
"'s'",
")",... | https://github.com/bristolcrypto/SPDZ-2/blob/721abfae849625a02ea49aabc534f9cf41ca643f/Compiler/comparison.py#L86-L109 | ||
Xilinx/Vitis-AI | fc74d404563d9951b57245443c73bef389f3657f | tools/Vitis-AI-Quantizer/vai_q_tensorflow1.x/tensorflow/contrib/labeled_tensor/python/ops/core.py | python | Axis.index | (self, value) | return self._index[value] | Returns the integer position of the given tick label. | Returns the integer position of the given tick label. | [
"Returns",
"the",
"integer",
"position",
"of",
"the",
"given",
"tick",
"label",
"."
] | def index(self, value):
"""Returns the integer position of the given tick label."""
if self._index is None:
raise ValueError('Axis does not have tick labels')
return self._index[value] | [
"def",
"index",
"(",
"self",
",",
"value",
")",
":",
"if",
"self",
".",
"_index",
"is",
"None",
":",
"raise",
"ValueError",
"(",
"'Axis does not have tick labels'",
")",
"return",
"self",
".",
"_index",
"[",
"value",
"]"
] | https://github.com/Xilinx/Vitis-AI/blob/fc74d404563d9951b57245443c73bef389f3657f/tools/Vitis-AI-Quantizer/vai_q_tensorflow1.x/tensorflow/contrib/labeled_tensor/python/ops/core.py#L168-L172 | |
google/ion | ef47f3b824050499ce5c6f774b366f6c4dbce0af | ion/build.py | python | _SmartDeleteDirectory | (path) | Delete a directory, or a symlink to a directory.
Deleting a symlink to a directory requires extra effort than usual.
Args:
path: The directory to delete, or a symlink to a directory to delete. In the
latter case, the target of the symlink AND the symlink will be
deleted. | Delete a directory, or a symlink to a directory. | [
"Delete",
"a",
"directory",
"or",
"a",
"symlink",
"to",
"a",
"directory",
"."
] | def _SmartDeleteDirectory(path):
"""Delete a directory, or a symlink to a directory.
Deleting a symlink to a directory requires extra effort than usual.
Args:
path: The directory to delete, or a symlink to a directory to delete. In the
latter case, the target of the symlink AND the symlink will be... | [
"def",
"_SmartDeleteDirectory",
"(",
"path",
")",
":",
"if",
"os",
".",
"path",
".",
"isdir",
"(",
"path",
")",
"and",
"not",
"os",
".",
"path",
".",
"islink",
"(",
"path",
")",
":",
"shutil",
".",
"rmtree",
"(",
"path",
")",
"elif",
"os",
".",
"... | https://github.com/google/ion/blob/ef47f3b824050499ce5c6f774b366f6c4dbce0af/ion/build.py#L254-L271 | ||
natanielruiz/android-yolo | 1ebb54f96a67a20ff83ddfc823ed83a13dc3a47f | jni-build/jni/include/tensorflow/contrib/learn/python/learn/monitors.py | python | ValidationMonitor.best_value | (self) | return self._best_value | Returns the best early stopping metric value found so far. | Returns the best early stopping metric value found so far. | [
"Returns",
"the",
"best",
"early",
"stopping",
"metric",
"value",
"found",
"so",
"far",
"."
] | def best_value(self):
"""Returns the best early stopping metric value found so far."""
return self._best_value | [
"def",
"best_value",
"(",
"self",
")",
":",
"return",
"self",
".",
"_best_value"
] | https://github.com/natanielruiz/android-yolo/blob/1ebb54f96a67a20ff83ddfc823ed83a13dc3a47f/jni-build/jni/include/tensorflow/contrib/learn/python/learn/monitors.py#L669-L671 | |
aws/lumberyard | f85344403c1c2e77ec8c75deb2c116e97b713217 | dev/Gems/CloudGemMetric/v1/AWS/python/windows/Lib/pandas/core/computation/expr.py | python | _node_not_implemented | (node_name, cls) | return f | Return a function that raises a NotImplementedError with a passed node
name. | Return a function that raises a NotImplementedError with a passed node
name. | [
"Return",
"a",
"function",
"that",
"raises",
"a",
"NotImplementedError",
"with",
"a",
"passed",
"node",
"name",
"."
] | def _node_not_implemented(node_name, cls):
"""Return a function that raises a NotImplementedError with a passed node
name.
"""
def f(self, *args, **kwargs):
raise NotImplementedError(f"{repr(node_name)} nodes are not implemented")
return f | [
"def",
"_node_not_implemented",
"(",
"node_name",
",",
"cls",
")",
":",
"def",
"f",
"(",
"self",
",",
"*",
"args",
",",
"*",
"*",
"kwargs",
")",
":",
"raise",
"NotImplementedError",
"(",
"f\"{repr(node_name)} nodes are not implemented\"",
")",
"return",
"f"
] | https://github.com/aws/lumberyard/blob/f85344403c1c2e77ec8c75deb2c116e97b713217/dev/Gems/CloudGemMetric/v1/AWS/python/windows/Lib/pandas/core/computation/expr.py#L230-L238 | |
mindspore-ai/mindspore | fb8fd3338605bb34fa5cea054e535a8b1d753fab | mindspore/python/mindspore/ops/_op_impl/tbe/apply_centered_rms_prop_ds.py | python | _apply_centered_rms_prop_ds_tbe | () | return | ApplyCenteredRMSPropD TBE register | ApplyCenteredRMSPropD TBE register | [
"ApplyCenteredRMSPropD",
"TBE",
"register"
] | def _apply_centered_rms_prop_ds_tbe():
"""ApplyCenteredRMSPropD TBE register"""
return | [
"def",
"_apply_centered_rms_prop_ds_tbe",
"(",
")",
":",
"return"
] | https://github.com/mindspore-ai/mindspore/blob/fb8fd3338605bb34fa5cea054e535a8b1d753fab/mindspore/python/mindspore/ops/_op_impl/tbe/apply_centered_rms_prop_ds.py#L76-L78 | |
catboost/catboost | 167f64f237114a4d10b2b4ee42adb4569137debe | contrib/tools/python3/src/Lib/compileall.py | python | compile_dir | (dir, maxlevels=None, ddir=None, force=False,
rx=None, quiet=0, legacy=False, optimize=-1, workers=1,
invalidation_mode=None, *, stripdir=None,
prependdir=None, limit_sl_dest=None, hardlink_dupes=False) | return success | Byte-compile all modules in the given directory tree.
Arguments (only dir is required):
dir: the directory to byte-compile
maxlevels: maximum recursion level (default `sys.getrecursionlimit()`)
ddir: the directory that will be prepended to the path to the
file as it is compil... | Byte-compile all modules in the given directory tree. | [
"Byte",
"-",
"compile",
"all",
"modules",
"in",
"the",
"given",
"directory",
"tree",
"."
] | def compile_dir(dir, maxlevels=None, ddir=None, force=False,
rx=None, quiet=0, legacy=False, optimize=-1, workers=1,
invalidation_mode=None, *, stripdir=None,
prependdir=None, limit_sl_dest=None, hardlink_dupes=False):
"""Byte-compile all modules in the given director... | [
"def",
"compile_dir",
"(",
"dir",
",",
"maxlevels",
"=",
"None",
",",
"ddir",
"=",
"None",
",",
"force",
"=",
"False",
",",
"rx",
"=",
"None",
",",
"quiet",
"=",
"0",
",",
"legacy",
"=",
"False",
",",
"optimize",
"=",
"-",
"1",
",",
"workers",
"=... | https://github.com/catboost/catboost/blob/167f64f237114a4d10b2b4ee42adb4569137debe/contrib/tools/python3/src/Lib/compileall.py#L48-L121 | |
commaai/openpilot | 4416c21b1e738ab7d04147c5ae52b5135e0cdb40 | tools/lib/kbhit.py | python | KBHit.kbhit | () | return select([sys.stdin], [], [], 0)[0] != [] | Returns True if keyboard character was hit, False otherwise. | Returns True if keyboard character was hit, False otherwise. | [
"Returns",
"True",
"if",
"keyboard",
"character",
"was",
"hit",
"False",
"otherwise",
"."
] | def kbhit():
''' Returns True if keyboard character was hit, False otherwise.
'''
return select([sys.stdin], [], [], 0)[0] != [] | [
"def",
"kbhit",
"(",
")",
":",
"return",
"select",
"(",
"[",
"sys",
".",
"stdin",
"]",
",",
"[",
"]",
",",
"[",
"]",
",",
"0",
")",
"[",
"0",
"]",
"!=",
"[",
"]"
] | https://github.com/commaai/openpilot/blob/4416c21b1e738ab7d04147c5ae52b5135e0cdb40/tools/lib/kbhit.py#L60-L63 | |
wxWidgets/wxPython-Classic | 19571e1ae65f1ac445f5491474121998c97a1bf0 | wx/lib/agw/flatmenu.py | python | FlatMenuBar.ResetToolbarItems | (self) | Used internally. | Used internally. | [
"Used",
"internally",
"."
] | def ResetToolbarItems(self):
""" Used internally. """
for but in self._tbButtons:
but._state = ControlNormal | [
"def",
"ResetToolbarItems",
"(",
"self",
")",
":",
"for",
"but",
"in",
"self",
".",
"_tbButtons",
":",
"but",
".",
"_state",
"=",
"ControlNormal"
] | https://github.com/wxWidgets/wxPython-Classic/blob/19571e1ae65f1ac445f5491474121998c97a1bf0/wx/lib/agw/flatmenu.py#L3100-L3104 | ||
LiquidPlayer/LiquidCore | 9405979363f2353ac9a71ad8ab59685dd7f919c9 | deps/node-10.15.3/deps/npm/node_modules/node-gyp/gyp/pylib/gyp/xcodeproj_file.py | python | XCObject.Children | (self) | return children | Returns a list of all of this object's owned (strong) children. | Returns a list of all of this object's owned (strong) children. | [
"Returns",
"a",
"list",
"of",
"all",
"of",
"this",
"object",
"s",
"owned",
"(",
"strong",
")",
"children",
"."
] | def Children(self):
"""Returns a list of all of this object's owned (strong) children."""
children = []
for property, attributes in self._schema.iteritems():
(is_list, property_type, is_strong) = attributes[0:3]
if is_strong and property in self._properties:
if not is_list:
ch... | [
"def",
"Children",
"(",
"self",
")",
":",
"children",
"=",
"[",
"]",
"for",
"property",
",",
"attributes",
"in",
"self",
".",
"_schema",
".",
"iteritems",
"(",
")",
":",
"(",
"is_list",
",",
"property_type",
",",
"is_strong",
")",
"=",
"attributes",
"[... | https://github.com/LiquidPlayer/LiquidCore/blob/9405979363f2353ac9a71ad8ab59685dd7f919c9/deps/node-10.15.3/deps/npm/node_modules/node-gyp/gyp/pylib/gyp/xcodeproj_file.py#L474-L485 | |
google/earthenterprise | 0fe84e29be470cd857e3a0e52e5d0afd5bb8cee9 | earth_enterprise/src/support/parse_khhttpd_access_log.py | python | KML.closeFolder | (self) | return kml | Closes folder element. | Closes folder element. | [
"Closes",
"folder",
"element",
"."
] | def closeFolder(self):
'''Closes folder element.'''
kml = '</Folder>\n'
return kml | [
"def",
"closeFolder",
"(",
"self",
")",
":",
"kml",
"=",
"'</Folder>\\n'",
"return",
"kml"
] | https://github.com/google/earthenterprise/blob/0fe84e29be470cd857e3a0e52e5d0afd5bb8cee9/earth_enterprise/src/support/parse_khhttpd_access_log.py#L193-L196 | |
carla-simulator/carla | 8854804f4d7748e14d937ec763a2912823a7e5f5 | PythonAPI/examples/rss/rss_visualization.py | python | RssBoundingBoxVisualizer._create_bb_points | (vehicle) | return cords | Returns 3D bounding box for a vehicle. | Returns 3D bounding box for a vehicle. | [
"Returns",
"3D",
"bounding",
"box",
"for",
"a",
"vehicle",
"."
] | def _create_bb_points(vehicle):
"""
Returns 3D bounding box for a vehicle.
"""
cords = np.zeros((8, 4))
extent = vehicle.bounding_box.extent
cords[0, :] = np.array([extent.x, extent.y, -extent.z, 1])
cords[1, :] = np.array([-extent.x, extent.y, -extent.z, 1])
... | [
"def",
"_create_bb_points",
"(",
"vehicle",
")",
":",
"cords",
"=",
"np",
".",
"zeros",
"(",
"(",
"8",
",",
"4",
")",
")",
"extent",
"=",
"vehicle",
".",
"bounding_box",
".",
"extent",
"cords",
"[",
"0",
",",
":",
"]",
"=",
"np",
".",
"array",
"(... | https://github.com/carla-simulator/carla/blob/8854804f4d7748e14d937ec763a2912823a7e5f5/PythonAPI/examples/rss/rss_visualization.py#L533-L548 | |
SoarGroup/Soar | a1c5e249499137a27da60533c72969eef3b8ab6b | scons/scons-local-4.1.0/SCons/SConf.py | python | CheckProg | (context, prog_name) | return res | Simple check if a program exists in the path. Returns the path
for the application, or None if not found. | Simple check if a program exists in the path. Returns the path
for the application, or None if not found. | [
"Simple",
"check",
"if",
"a",
"program",
"exists",
"in",
"the",
"path",
".",
"Returns",
"the",
"path",
"for",
"the",
"application",
"or",
"None",
"if",
"not",
"found",
"."
] | def CheckProg(context, prog_name):
"""Simple check if a program exists in the path. Returns the path
for the application, or None if not found.
"""
res = SCons.Conftest.CheckProg(context, prog_name)
context.did_show_result = 1
return res | [
"def",
"CheckProg",
"(",
"context",
",",
"prog_name",
")",
":",
"res",
"=",
"SCons",
".",
"Conftest",
".",
"CheckProg",
"(",
"context",
",",
"prog_name",
")",
"context",
".",
"did_show_result",
"=",
"1",
"return",
"res"
] | https://github.com/SoarGroup/Soar/blob/a1c5e249499137a27da60533c72969eef3b8ab6b/scons/scons-local-4.1.0/SCons/SConf.py#L1104-L1110 | |
catboost/catboost | 167f64f237114a4d10b2b4ee42adb4569137debe | contrib/python/pandas/py3/pandas/core/base.py | python | IndexOpsMixin._memory_usage | (self, deep: bool = False) | return v | Memory usage of the values.
Parameters
----------
deep : bool, default False
Introspect the data deeply, interrogate
`object` dtypes for system-level memory consumption.
Returns
-------
bytes used
See Also
--------
numpy.... | Memory usage of the values. | [
"Memory",
"usage",
"of",
"the",
"values",
"."
] | def _memory_usage(self, deep: bool = False) -> int:
"""
Memory usage of the values.
Parameters
----------
deep : bool, default False
Introspect the data deeply, interrogate
`object` dtypes for system-level memory consumption.
Returns
----... | [
"def",
"_memory_usage",
"(",
"self",
",",
"deep",
":",
"bool",
"=",
"False",
")",
"->",
"int",
":",
"if",
"hasattr",
"(",
"self",
".",
"array",
",",
"\"memory_usage\"",
")",
":",
"# error: \"ExtensionArray\" has no attribute \"memory_usage\"",
"return",
"self",
... | https://github.com/catboost/catboost/blob/167f64f237114a4d10b2b4ee42adb4569137debe/contrib/python/pandas/py3/pandas/core/base.py#L1069-L1101 | |
panda3d/panda3d | 833ad89ebad58395d0af0b7ec08538e5e4308265 | direct/src/gui/OnscreenText.py | python | OnscreenText.__init__ | (self, text = '',
style = Plain,
pos = (0, 0),
roll = 0,
scale = None,
fg = None,
bg = None,
shadow = None,
shadowOffset = (0.04, 0.04),
frame = None,
... | Make a text node from string, put it into the 2d sg and set it
up with all the indicated parameters.
Parameters:
text: the actual text to display. This may be omitted and
specified later via setText() if you don't have it
available, but it is better to specify it... | Make a text node from string, put it into the 2d sg and set it
up with all the indicated parameters. | [
"Make",
"a",
"text",
"node",
"from",
"string",
"put",
"it",
"into",
"the",
"2d",
"sg",
"and",
"set",
"it",
"up",
"with",
"all",
"the",
"indicated",
"parameters",
"."
] | def __init__(self, text = '',
style = Plain,
pos = (0, 0),
roll = 0,
scale = None,
fg = None,
bg = None,
shadow = None,
shadowOffset = (0.04, 0.04),
frame = None,
... | [
"def",
"__init__",
"(",
"self",
",",
"text",
"=",
"''",
",",
"style",
"=",
"Plain",
",",
"pos",
"=",
"(",
"0",
",",
"0",
")",
",",
"roll",
"=",
"0",
",",
"scale",
"=",
"None",
",",
"fg",
"=",
"None",
",",
"bg",
"=",
"None",
",",
"shadow",
"... | https://github.com/panda3d/panda3d/blob/833ad89ebad58395d0af0b7ec08538e5e4308265/direct/src/gui/OnscreenText.py#L25-L241 | ||
tensorflow/tensorflow | 419e3a6b650ea4bd1b0cba23c4348f8a69f3272e | tensorflow/python/eager/function.py | python | _ForwardBackwardCall.record | (self, flat_outputs) | Given outputs from the execution of `forward`, records the operation. | Given outputs from the execution of `forward`, records the operation. | [
"Given",
"outputs",
"from",
"the",
"execution",
"of",
"forward",
"records",
"the",
"operation",
"."
] | def record(self, flat_outputs):
"""Given outputs from the execution of `forward`, records the operation."""
if (self._tape_watching
and not isinstance(flat_outputs, ops.Operation)
and flat_outputs is not None):
# We only record function calls which have outputs, and then only when a
... | [
"def",
"record",
"(",
"self",
",",
"flat_outputs",
")",
":",
"if",
"(",
"self",
".",
"_tape_watching",
"and",
"not",
"isinstance",
"(",
"flat_outputs",
",",
"ops",
".",
"Operation",
")",
"and",
"flat_outputs",
"is",
"not",
"None",
")",
":",
"# We only reco... | https://github.com/tensorflow/tensorflow/blob/419e3a6b650ea4bd1b0cba23c4348f8a69f3272e/tensorflow/python/eager/function.py#L1402-L1410 | ||
metashell/metashell | f4177e4854ea00c8dbc722cadab26ef413d798ea | 3rd/templight/clang/bindings/python/clang/cindex.py | python | TokenGroup.get_tokens | (tu, extent) | Helper method to return all tokens in an extent.
This functionality is needed multiple places in this module. We define
it here because it seems like a logical place. | Helper method to return all tokens in an extent. | [
"Helper",
"method",
"to",
"return",
"all",
"tokens",
"in",
"an",
"extent",
"."
] | def get_tokens(tu, extent):
"""Helper method to return all tokens in an extent.
This functionality is needed multiple places in this module. We define
it here because it seems like a logical place.
"""
tokens_memory = POINTER(Token)()
tokens_count = c_uint()
con... | [
"def",
"get_tokens",
"(",
"tu",
",",
"extent",
")",
":",
"tokens_memory",
"=",
"POINTER",
"(",
"Token",
")",
"(",
")",
"tokens_count",
"=",
"c_uint",
"(",
")",
"conf",
".",
"lib",
".",
"clang_tokenize",
"(",
"tu",
",",
"extent",
",",
"byref",
"(",
"t... | https://github.com/metashell/metashell/blob/f4177e4854ea00c8dbc722cadab26ef413d798ea/3rd/templight/clang/bindings/python/clang/cindex.py#L541-L571 | ||
catboost/catboost | 167f64f237114a4d10b2b4ee42adb4569137debe | contrib/tools/python3/src/Lib/statistics.py | python | fmean | (data) | Convert data to floats and compute the arithmetic mean.
This runs faster than the mean() function and it always returns a float.
If the input dataset is empty, it raises a StatisticsError.
>>> fmean([3.5, 4.0, 5.25])
4.25 | Convert data to floats and compute the arithmetic mean. | [
"Convert",
"data",
"to",
"floats",
"and",
"compute",
"the",
"arithmetic",
"mean",
"."
] | def fmean(data):
"""Convert data to floats and compute the arithmetic mean.
This runs faster than the mean() function and it always returns a float.
If the input dataset is empty, it raises a StatisticsError.
>>> fmean([3.5, 4.0, 5.25])
4.25
"""
try:
n = len(data)
except TypeEr... | [
"def",
"fmean",
"(",
"data",
")",
":",
"try",
":",
"n",
"=",
"len",
"(",
"data",
")",
"except",
"TypeError",
":",
"# Handle iterators that do not define __len__().",
"n",
"=",
"0",
"def",
"count",
"(",
"iterable",
")",
":",
"nonlocal",
"n",
"for",
"n",
"... | https://github.com/catboost/catboost/blob/167f64f237114a4d10b2b4ee42adb4569137debe/contrib/tools/python3/src/Lib/statistics.py#L321-L345 | ||
cloudendpoints/esp | 2c4f1df4b9cc82e0682ce4713d470b61b8f970de | start_esp/fetch_service_config.py | python | fetch_service_name | (metadata) | return name | Fetch service name from metadata URL. | Fetch service name from metadata URL. | [
"Fetch",
"service",
"name",
"from",
"metadata",
"URL",
"."
] | def fetch_service_name(metadata):
"""Fetch service name from metadata URL."""
name = fetch_metadata(
metadata, _INSTANCE_ATTRIBUTES + _METADATA_SERVICE_NAME, True)
logging.info("Service name: " + name)
return name | [
"def",
"fetch_service_name",
"(",
"metadata",
")",
":",
"name",
"=",
"fetch_metadata",
"(",
"metadata",
",",
"_INSTANCE_ATTRIBUTES",
"+",
"_METADATA_SERVICE_NAME",
",",
"True",
")",
"logging",
".",
"info",
"(",
"\"Service name: \"",
"+",
"name",
")",
"return",
"... | https://github.com/cloudendpoints/esp/blob/2c4f1df4b9cc82e0682ce4713d470b61b8f970de/start_esp/fetch_service_config.py#L94-L99 | |
synfig/synfig | a5ec91db5b751dc12e4400ccfb5c063fd6d2d928 | synfig-studio/plugins/lottie-exporter/export_without_variable_width.py | python | init_logs | () | Initializes the logger, sets the level of the logging(DEBUG | INFO : depending on what is
specified) | Initializes the logger, sets the level of the logging(DEBUG | INFO : depending on what is
specified) | [
"Initializes",
"the",
"logger",
"sets",
"the",
"level",
"of",
"the",
"logging",
"(",
"DEBUG",
"|",
"INFO",
":",
"depending",
"on",
"what",
"is",
"specified",
")"
] | def init_logs():
"""
Initializes the logger, sets the level of the logging(DEBUG | INFO : depending on what is
specified)
"""
logging.basicConfig(stream=sys.stdout, format='%(name)s - %(levelname)s - %(message)s')
logging.getLogger().setLevel(logging.DEBUG) | [
"def",
"init_logs",
"(",
")",
":",
"logging",
".",
"basicConfig",
"(",
"stream",
"=",
"sys",
".",
"stdout",
",",
"format",
"=",
"'%(name)s - %(levelname)s - %(message)s'",
")",
"logging",
".",
"getLogger",
"(",
")",
".",
"setLevel",
"(",
"logging",
".",
"DEB... | https://github.com/synfig/synfig/blob/a5ec91db5b751dc12e4400ccfb5c063fd6d2d928/synfig-studio/plugins/lottie-exporter/export_without_variable_width.py#L124-L130 | ||
catboost/catboost | 167f64f237114a4d10b2b4ee42adb4569137debe | contrib/python/scikit-learn/py3/sklearn/cluster/_optics.py | python | compute_optics_graph | (X, min_samples, max_eps, metric, p, metric_params,
algorithm, leaf_size, n_jobs) | return ordering, core_distances_, reachability_, predecessor_ | Computes the OPTICS reachability graph.
Read more in the :ref:`User Guide <optics>`.
Parameters
----------
X : array, shape (n_samples, n_features), or (n_samples, n_samples) \
if metric=’precomputed’.
A feature array, or array of distances between samples if
metric='precomputed'
... | Computes the OPTICS reachability graph. | [
"Computes",
"the",
"OPTICS",
"reachability",
"graph",
"."
] | def compute_optics_graph(X, min_samples, max_eps, metric, p, metric_params,
algorithm, leaf_size, n_jobs):
"""Computes the OPTICS reachability graph.
Read more in the :ref:`User Guide <optics>`.
Parameters
----------
X : array, shape (n_samples, n_features), or (n_samples,... | [
"def",
"compute_optics_graph",
"(",
"X",
",",
"min_samples",
",",
"max_eps",
",",
"metric",
",",
"p",
",",
"metric_params",
",",
"algorithm",
",",
"leaf_size",
",",
"n_jobs",
")",
":",
"n_samples",
"=",
"X",
".",
"shape",
"[",
"0",
"]",
"_validate_size",
... | https://github.com/catboost/catboost/blob/167f64f237114a4d10b2b4ee42adb4569137debe/contrib/python/scikit-learn/py3/sklearn/cluster/_optics.py#L342-L503 | |
hanpfei/chromium-net | 392cc1fa3a8f92f42e4071ab6e674d8e0482f83f | build/android/pylib/utils/emulator.py | python | LaunchTempEmulators | (emulator_count, abi, api_level, enable_kvm=False,
kill_and_launch=True, sdcard_size=DEFAULT_SDCARD_SIZE,
storage_size=DEFAULT_STORAGE_SIZE, wait_for_boot=True,
headless=False) | return emulators | Create and launch temporary emulators and wait for them to boot.
Args:
emulator_count: number of emulators to launch.
abi: the emulator target platform
api_level: the api level (e.g., 19 for Android v4.4 - KitKat release)
wait_for_boot: whether or not to wait for emulators to boot up
headless: ru... | Create and launch temporary emulators and wait for them to boot. | [
"Create",
"and",
"launch",
"temporary",
"emulators",
"and",
"wait",
"for",
"them",
"to",
"boot",
"."
] | def LaunchTempEmulators(emulator_count, abi, api_level, enable_kvm=False,
kill_and_launch=True, sdcard_size=DEFAULT_SDCARD_SIZE,
storage_size=DEFAULT_STORAGE_SIZE, wait_for_boot=True,
headless=False):
"""Create and launch temporary emulators and ... | [
"def",
"LaunchTempEmulators",
"(",
"emulator_count",
",",
"abi",
",",
"api_level",
",",
"enable_kvm",
"=",
"False",
",",
"kill_and_launch",
"=",
"True",
",",
"sdcard_size",
"=",
"DEFAULT_SDCARD_SIZE",
",",
"storage_size",
"=",
"DEFAULT_STORAGE_SIZE",
",",
"wait_for_... | https://github.com/hanpfei/chromium-net/blob/392cc1fa3a8f92f42e4071ab6e674d8e0482f83f/build/android/pylib/utils/emulator.py#L189-L224 | |
ChromiumWebApps/chromium | c7361d39be8abd1574e6ce8957c8dbddd4c6ccf7 | build/config/win/get_msvc_config_real.py | python | VisualStudioVersion.ToolPath | (self, tool) | return os.path.normpath(os.path.join(self.path, "VC/bin", tool)) | Returns the path to a given compiler tool. | Returns the path to a given compiler tool. | [
"Returns",
"the",
"path",
"to",
"a",
"given",
"compiler",
"tool",
"."
] | def ToolPath(self, tool):
"""Returns the path to a given compiler tool. """
return os.path.normpath(os.path.join(self.path, "VC/bin", tool)) | [
"def",
"ToolPath",
"(",
"self",
",",
"tool",
")",
":",
"return",
"os",
".",
"path",
".",
"normpath",
"(",
"os",
".",
"path",
".",
"join",
"(",
"self",
".",
"path",
",",
"\"VC/bin\"",
",",
"tool",
")",
")"
] | https://github.com/ChromiumWebApps/chromium/blob/c7361d39be8abd1574e6ce8957c8dbddd4c6ccf7/build/config/win/get_msvc_config_real.py#L63-L65 | |
catboost/catboost | 167f64f237114a4d10b2b4ee42adb4569137debe | contrib/python/scipy/py2/scipy/optimize/_constraints.py | python | new_constraint_to_old | (con, x0) | return old_constraints | Converts new-style constraint objects to old-style constraint dictionaries. | Converts new-style constraint objects to old-style constraint dictionaries. | [
"Converts",
"new",
"-",
"style",
"constraint",
"objects",
"to",
"old",
"-",
"style",
"constraint",
"dictionaries",
"."
] | def new_constraint_to_old(con, x0):
"""
Converts new-style constraint objects to old-style constraint dictionaries.
"""
if isinstance(con, NonlinearConstraint):
if (con.finite_diff_jac_sparsity is not None or
con.finite_diff_rel_step is not None or
not isinstance(... | [
"def",
"new_constraint_to_old",
"(",
"con",
",",
"x0",
")",
":",
"if",
"isinstance",
"(",
"con",
",",
"NonlinearConstraint",
")",
":",
"if",
"(",
"con",
".",
"finite_diff_jac_sparsity",
"is",
"not",
"None",
"or",
"con",
".",
"finite_diff_rel_step",
"is",
"no... | https://github.com/catboost/catboost/blob/167f64f237114a4d10b2b4ee42adb4569137debe/contrib/python/scipy/py2/scipy/optimize/_constraints.py#L290-L381 | |
mindspore-ai/mindspore | fb8fd3338605bb34fa5cea054e535a8b1d753fab | mindspore/python/mindspore/train/callback/_landscape.py | python | _PCA._random_svd | (self, m, n_components, n_oversamples=10, random_state="warn") | return u[:, :n_components], s[:n_components], vt[:n_components, :] | Compute a truncated randomized SVD. | Compute a truncated randomized SVD. | [
"Compute",
"a",
"truncated",
"randomized",
"SVD",
"."
] | def _random_svd(self, m, n_components, n_oversamples=10, random_state="warn"):
"""Compute a truncated randomized SVD."""
n_random = n_components + n_oversamples
n_samples, n_features = m.shape
# Adjust 7 or 4 was found a good compromise for randomized SVD.
n_iter = 7 if n_compone... | [
"def",
"_random_svd",
"(",
"self",
",",
"m",
",",
"n_components",
",",
"n_oversamples",
"=",
"10",
",",
"random_state",
"=",
"\"warn\"",
")",
":",
"n_random",
"=",
"n_components",
"+",
"n_oversamples",
"n_samples",
",",
"n_features",
"=",
"m",
".",
"shape",
... | https://github.com/mindspore-ai/mindspore/blob/fb8fd3338605bb34fa5cea054e535a8b1d753fab/mindspore/python/mindspore/train/callback/_landscape.py#L938-L965 | |
papyrussolution/OpenPapyrus | bbfb5ec2ea2109b8e2f125edd838e12eaf7b8b91 | Src/OSF/protobuf-3.19.1/python/google/protobuf/internal/decoder.py | python | _SkipGroup | (buffer, pos, end) | Skip sub-group. Returns the new position. | Skip sub-group. Returns the new position. | [
"Skip",
"sub",
"-",
"group",
".",
"Returns",
"the",
"new",
"position",
"."
] | def _SkipGroup(buffer, pos, end):
"""Skip sub-group. Returns the new position."""
while 1:
(tag_bytes, pos) = ReadTag(buffer, pos)
new_pos = SkipField(buffer, pos, end, tag_bytes)
if new_pos == -1:
return pos
pos = new_pos | [
"def",
"_SkipGroup",
"(",
"buffer",
",",
"pos",
",",
"end",
")",
":",
"while",
"1",
":",
"(",
"tag_bytes",
",",
"pos",
")",
"=",
"ReadTag",
"(",
"buffer",
",",
"pos",
")",
"new_pos",
"=",
"SkipField",
"(",
"buffer",
",",
"pos",
",",
"end",
",",
"... | https://github.com/papyrussolution/OpenPapyrus/blob/bbfb5ec2ea2109b8e2f125edd838e12eaf7b8b91/Src/OSF/protobuf-3.19.1/python/google/protobuf/internal/decoder.py#L919-L927 | ||
wxWidgets/wxPython-Classic | 19571e1ae65f1ac445f5491474121998c97a1bf0 | wx/lib/agw/floatspin.py | python | FloatSpin.IsFinite | (self, value) | return finite, snap_value | Tries to determine if a value is finite or infinite/NaN.
:param `value`: the value to test. | Tries to determine if a value is finite or infinite/NaN. | [
"Tries",
"to",
"determine",
"if",
"a",
"value",
"is",
"finite",
"or",
"infinite",
"/",
"NaN",
"."
] | def IsFinite(self, value):
"""
Tries to determine if a value is finite or infinite/NaN.
:param `value`: the value to test.
"""
try:
snap_value = (value - self._defaultvalue)/self._increment
finite = True
except:
finite = False
... | [
"def",
"IsFinite",
"(",
"self",
",",
"value",
")",
":",
"try",
":",
"snap_value",
"=",
"(",
"value",
"-",
"self",
".",
"_defaultvalue",
")",
"/",
"self",
".",
"_increment",
"finite",
"=",
"True",
"except",
":",
"finite",
"=",
"False",
"snap_value",
"="... | https://github.com/wxWidgets/wxPython-Classic/blob/19571e1ae65f1ac445f5491474121998c97a1bf0/wx/lib/agw/floatspin.py#L1184-L1198 | |
qt/qt | 0a2f2382541424726168804be2c90b91381608c6 | src/3rdparty/webkit/Source/ThirdParty/gyp/pylib/gyp/MSVSSettings.py | python | _Renamed | (tool, msvs_name, msbuild_name, type) | Defines a setting for which the name has changed.
Args:
tool: a dictionary that gives the names of the tool for MSVS and MSBuild.
msvs_name: the name of the MSVS setting.
msbuild_name: the name of the MSBuild setting.
type: the type of this setting. | Defines a setting for which the name has changed. | [
"Defines",
"a",
"setting",
"for",
"which",
"the",
"name",
"has",
"changed",
"."
] | def _Renamed(tool, msvs_name, msbuild_name, type):
""" Defines a setting for which the name has changed.
Args:
tool: a dictionary that gives the names of the tool for MSVS and MSBuild.
msvs_name: the name of the MSVS setting.
msbuild_name: the name of the MSBuild setting.
type: the type of this set... | [
"def",
"_Renamed",
"(",
"tool",
",",
"msvs_name",
",",
"msbuild_name",
",",
"type",
")",
":",
"def",
"_Translate",
"(",
"value",
",",
"msbuild_settings",
")",
":",
"msbuild_tool_settings",
"=",
"_GetMsBuildToolSettings",
"(",
"msbuild_settings",
",",
"tool",
")"... | https://github.com/qt/qt/blob/0a2f2382541424726168804be2c90b91381608c6/src/3rdparty/webkit/Source/ThirdParty/gyp/pylib/gyp/MSVSSettings.py#L202-L218 | ||
tum-vision/fusenet | a1451be2971b348a01b0f525c2a3a7a0e215a591 | python/caffe/net_spec.py | python | assign_proto | (proto, name, val) | Assign a Python object to a protobuf message, based on the Python
type (in recursive fashion). Lists become repeated fields/messages, dicts
become messages, and other types are assigned directly. For convenience,
repeated fields whose values are not lists are converted to single-element
lists; e.g., `my... | Assign a Python object to a protobuf message, based on the Python
type (in recursive fashion). Lists become repeated fields/messages, dicts
become messages, and other types are assigned directly. For convenience,
repeated fields whose values are not lists are converted to single-element
lists; e.g., `my... | [
"Assign",
"a",
"Python",
"object",
"to",
"a",
"protobuf",
"message",
"based",
"on",
"the",
"Python",
"type",
"(",
"in",
"recursive",
"fashion",
")",
".",
"Lists",
"become",
"repeated",
"fields",
"/",
"messages",
"dicts",
"become",
"messages",
"and",
"other",... | def assign_proto(proto, name, val):
"""Assign a Python object to a protobuf message, based on the Python
type (in recursive fashion). Lists become repeated fields/messages, dicts
become messages, and other types are assigned directly. For convenience,
repeated fields whose values are not lists are conve... | [
"def",
"assign_proto",
"(",
"proto",
",",
"name",
",",
"val",
")",
":",
"is_repeated_field",
"=",
"hasattr",
"(",
"getattr",
"(",
"proto",
",",
"name",
")",
",",
"'extend'",
")",
"if",
"is_repeated_field",
"and",
"not",
"isinstance",
"(",
"val",
",",
"li... | https://github.com/tum-vision/fusenet/blob/a1451be2971b348a01b0f525c2a3a7a0e215a591/python/caffe/net_spec.py#L56-L79 | ||
wlanjie/AndroidFFmpeg | 7baf9122f4b8e1c74e7baf4be5c422c7a5ba5aaf | tools/fdk-aac-build/x86/toolchain/lib/python2.7/sysconfig.py | python | _init_non_posix | (vars) | Initialize the module as appropriate for NT | Initialize the module as appropriate for NT | [
"Initialize",
"the",
"module",
"as",
"appropriate",
"for",
"NT"
] | def _init_non_posix(vars):
"""Initialize the module as appropriate for NT"""
# set basic install directories
vars['LIBDEST'] = get_path('stdlib')
vars['BINLIBDEST'] = get_path('platstdlib')
vars['INCLUDEPY'] = get_path('include')
vars['SO'] = '.pyd'
vars['EXE'] = '.exe'
vars['VERSION'] =... | [
"def",
"_init_non_posix",
"(",
"vars",
")",
":",
"# set basic install directories",
"vars",
"[",
"'LIBDEST'",
"]",
"=",
"get_path",
"(",
"'stdlib'",
")",
"vars",
"[",
"'BINLIBDEST'",
"]",
"=",
"get_path",
"(",
"'platstdlib'",
")",
"vars",
"[",
"'INCLUDEPY'",
"... | https://github.com/wlanjie/AndroidFFmpeg/blob/7baf9122f4b8e1c74e7baf4be5c422c7a5ba5aaf/tools/fdk-aac-build/x86/toolchain/lib/python2.7/sysconfig.py#L360-L369 | ||
miyosuda/TensorFlowAndroidMNIST | 7b5a4603d2780a8a2834575706e9001977524007 | jni-build/jni/include/tensorflow/contrib/graph_editor/subgraph.py | python | SubGraphView._remap_outputs_to_consumers | (self) | Remap the outputs in place to match the number of consumers. | Remap the outputs in place to match the number of consumers. | [
"Remap",
"the",
"outputs",
"in",
"place",
"to",
"match",
"the",
"number",
"of",
"consumers",
"."
] | def _remap_outputs_to_consumers(self):
"""Remap the outputs in place to match the number of consumers."""
self._remap_outputs_make_unique()
output_ts = list(self._output_ts)
self._output_ts = []
for t in output_ts:
self._output_ts += [t]*len(t.consumers()) | [
"def",
"_remap_outputs_to_consumers",
"(",
"self",
")",
":",
"self",
".",
"_remap_outputs_make_unique",
"(",
")",
"output_ts",
"=",
"list",
"(",
"self",
".",
"_output_ts",
")",
"self",
".",
"_output_ts",
"=",
"[",
"]",
"for",
"t",
"in",
"output_ts",
":",
"... | https://github.com/miyosuda/TensorFlowAndroidMNIST/blob/7b5a4603d2780a8a2834575706e9001977524007/jni-build/jni/include/tensorflow/contrib/graph_editor/subgraph.py#L285-L291 | ||
krishauser/Klampt | 972cc83ea5befac3f653c1ba20f80155768ad519 | Python/python2_version/klampt/robotsim.py | python | IKSolver.lastSolveIters | (self) | return _robotsim.IKSolver_lastSolveIters(self) | lastSolveIters(IKSolver self) -> int
Returns the number of Newton-Raphson iterations used in the last solve() call. | lastSolveIters(IKSolver self) -> int | [
"lastSolveIters",
"(",
"IKSolver",
"self",
")",
"-",
">",
"int"
] | def lastSolveIters(self):
"""
lastSolveIters(IKSolver self) -> int
Returns the number of Newton-Raphson iterations used in the last solve() call.
"""
return _robotsim.IKSolver_lastSolveIters(self) | [
"def",
"lastSolveIters",
"(",
"self",
")",
":",
"return",
"_robotsim",
".",
"IKSolver_lastSolveIters",
"(",
"self",
")"
] | https://github.com/krishauser/Klampt/blob/972cc83ea5befac3f653c1ba20f80155768ad519/Python/python2_version/klampt/robotsim.py#L6806-L6815 | |
naver/sling | 5671cd445a2caae0b4dd0332299e4cfede05062c | webkit/Tools/Scripts/webkitpy/port/base.py | python | Port.test_exists | (self, test_name) | return self.test_isfile(test_name) or self.test_isdir(test_name) | Return True if the test name refers to an existing test or baseline. | Return True if the test name refers to an existing test or baseline. | [
"Return",
"True",
"if",
"the",
"test",
"name",
"refers",
"to",
"an",
"existing",
"test",
"or",
"baseline",
"."
] | def test_exists(self, test_name):
"""Return True if the test name refers to an existing test or baseline."""
# Used by test_expectations.py to determine if an entry refers to a
# valid test and by printing.py to determine if baselines exist.
return self.test_isfile(test_name) or self.tes... | [
"def",
"test_exists",
"(",
"self",
",",
"test_name",
")",
":",
"# Used by test_expectations.py to determine if an entry refers to a",
"# valid test and by printing.py to determine if baselines exist.",
"return",
"self",
".",
"test_isfile",
"(",
"test_name",
")",
"or",
"self",
"... | https://github.com/naver/sling/blob/5671cd445a2caae0b4dd0332299e4cfede05062c/webkit/Tools/Scripts/webkitpy/port/base.py#L638-L642 | |
gnuradio/gnuradio | 09c3c4fa4bfb1a02caac74cb5334dfe065391e3b | grc/core/FlowGraph.py | python | _update_old_message_port_keys | (source_key, sink_key, source_block, sink_block) | return source_key, sink_key | Backward compatibility for message port keys
Message ports use their names as key (like in the 'connect' method).
Flowgraph files from former versions still have numeric keys stored for
message connections. These have to be replaced by the name of the
respective port. The correct message port is deduce... | Backward compatibility for message port keys | [
"Backward",
"compatibility",
"for",
"message",
"port",
"keys"
] | def _update_old_message_port_keys(source_key, sink_key, source_block, sink_block):
"""
Backward compatibility for message port keys
Message ports use their names as key (like in the 'connect' method).
Flowgraph files from former versions still have numeric keys stored for
message connections. These... | [
"def",
"_update_old_message_port_keys",
"(",
"source_key",
",",
"sink_key",
",",
"source_block",
",",
"sink_block",
")",
":",
"try",
":",
"# get ports using the \"old way\" (assuming linear indexed keys)",
"source_port",
"=",
"source_block",
".",
"sources",
"[",
"int",
"(... | https://github.com/gnuradio/gnuradio/blob/09c3c4fa4bfb1a02caac74cb5334dfe065391e3b/grc/core/FlowGraph.py#L504-L525 | |
ApolloAuto/apollo-platform | 86d9dc6743b496ead18d597748ebabd34a513289 | ros/third_party/lib_aarch64/python2.7/dist-packages/catkin_pkg/packages.py | python | find_packages_allowing_duplicates | (basepath, exclude_paths=None, exclude_subspaces=False, warnings=None) | return packages | Crawls the filesystem to find package manifest files and parses them.
:param basepath: The path to search in, ``str``
:param exclude_paths: A list of paths which should not be searched, ``list``
:param exclude_subspaces: The flag is subfolders containing a .catkin file should not be
searched, ``boo... | Crawls the filesystem to find package manifest files and parses them. | [
"Crawls",
"the",
"filesystem",
"to",
"find",
"package",
"manifest",
"files",
"and",
"parses",
"them",
"."
] | def find_packages_allowing_duplicates(basepath, exclude_paths=None, exclude_subspaces=False, warnings=None):
"""
Crawls the filesystem to find package manifest files and parses them.
:param basepath: The path to search in, ``str``
:param exclude_paths: A list of paths which should not be searched, ``li... | [
"def",
"find_packages_allowing_duplicates",
"(",
"basepath",
",",
"exclude_paths",
"=",
"None",
",",
"exclude_subspaces",
"=",
"False",
",",
"warnings",
"=",
"None",
")",
":",
"packages",
"=",
"{",
"}",
"package_paths",
"=",
"find_package_paths",
"(",
"basepath",
... | https://github.com/ApolloAuto/apollo-platform/blob/86d9dc6743b496ead18d597748ebabd34a513289/ros/third_party/lib_aarch64/python2.7/dist-packages/catkin_pkg/packages.py#L96-L111 | |
BitMEX/api-connectors | 37a3a5b806ad5d0e0fc975ab86d9ed43c3bcd812 | official-ws/python/bitmex_websocket.py | python | BitMEXWebsocket.__get_auth | (self) | Return auth headers. Will use API Keys if present in settings. | Return auth headers. Will use API Keys if present in settings. | [
"Return",
"auth",
"headers",
".",
"Will",
"use",
"API",
"Keys",
"if",
"present",
"in",
"settings",
"."
] | def __get_auth(self):
'''Return auth headers. Will use API Keys if present in settings.'''
if self.api_key:
self.logger.info("Authenticating with API Key.")
# To auth to the WS using an API key, we generate a signature of a nonce and
# the WS API endpoint.
... | [
"def",
"__get_auth",
"(",
"self",
")",
":",
"if",
"self",
".",
"api_key",
":",
"self",
".",
"logger",
".",
"info",
"(",
"\"Authenticating with API Key.\"",
")",
"# To auth to the WS using an API key, we generate a signature of a nonce and",
"# the WS API endpoint.",
"expire... | https://github.com/BitMEX/api-connectors/blob/37a3a5b806ad5d0e0fc975ab86d9ed43c3bcd812/official-ws/python/bitmex_websocket.py#L137-L151 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.