nwo stringlengths 5 86 | sha stringlengths 40 40 | path stringlengths 4 189 | language stringclasses 1
value | identifier stringlengths 1 94 | parameters stringlengths 2 4.03k | argument_list stringclasses 1
value | return_statement stringlengths 0 11.5k | docstring stringlengths 1 33.2k | docstring_summary stringlengths 0 5.15k | docstring_tokens list | function stringlengths 34 151k | function_tokens list | url stringlengths 90 278 |
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
catboost/catboost | 167f64f237114a4d10b2b4ee42adb4569137debe | contrib/python/scikit-learn/py3/sklearn/feature_extraction/_dict_vectorizer.py | python | DictVectorizer.get_feature_names | (self) | return self.feature_names_ | Returns a list of feature names, ordered by their indices.
If one-of-K coding is applied to categorical features, this will
include the constructed feature names but not the original ones. | Returns a list of feature names, ordered by their indices. | [
"Returns",
"a",
"list",
"of",
"feature",
"names",
"ordered",
"by",
"their",
"indices",
"."
] | def get_feature_names(self):
"""Returns a list of feature names, ordered by their indices.
If one-of-K coding is applied to categorical features, this will
include the constructed feature names but not the original ones.
"""
return self.feature_names_ | [
"def",
"get_feature_names",
"(",
"self",
")",
":",
"return",
"self",
".",
"feature_names_"
] | https://github.com/catboost/catboost/blob/167f64f237114a4d10b2b4ee42adb4569137debe/contrib/python/scikit-learn/py3/sklearn/feature_extraction/_dict_vectorizer.py#L309-L315 | |
aws/lumberyard | f85344403c1c2e77ec8c75deb2c116e97b713217 | dev/Tools/Python/3.7.10/windows/Lib/idlelib/hyperparser.py | python | HyperParser.__init__ | (self, editwin, index) | To initialize, analyze the surroundings of the given index. | To initialize, analyze the surroundings of the given index. | [
"To",
"initialize",
"analyze",
"the",
"surroundings",
"of",
"the",
"given",
"index",
"."
] | def __init__(self, editwin, index):
"To initialize, analyze the surroundings of the given index."
self.editwin = editwin
self.text = text = editwin.text
parser = pyparse.Parser(editwin.indentwidth, editwin.tabwidth)
def index2line(index):
return int(float(index))
... | [
"def",
"__init__",
"(",
"self",
",",
"editwin",
",",
"index",
")",
":",
"self",
".",
"editwin",
"=",
"editwin",
"self",
".",
"text",
"=",
"text",
"=",
"editwin",
".",
"text",
"parser",
"=",
"pyparse",
".",
"Parser",
"(",
"editwin",
".",
"indentwidth",
... | https://github.com/aws/lumberyard/blob/f85344403c1c2e77ec8c75deb2c116e97b713217/dev/Tools/Python/3.7.10/windows/Lib/idlelib/hyperparser.py#L26-L79 | ||
catboost/catboost | 167f64f237114a4d10b2b4ee42adb4569137debe | contrib/tools/python/src/Lib/SocketServer.py | python | BaseServer.process_request | (self, request, client_address) | Call finish_request.
Overridden by ForkingMixIn and ThreadingMixIn. | Call finish_request. | [
"Call",
"finish_request",
"."
] | def process_request(self, request, client_address):
"""Call finish_request.
Overridden by ForkingMixIn and ThreadingMixIn.
"""
self.finish_request(request, client_address)
self.shutdown_request(request) | [
"def",
"process_request",
"(",
"self",
",",
"request",
",",
"client_address",
")",
":",
"self",
".",
"finish_request",
"(",
"request",
",",
"client_address",
")",
"self",
".",
"shutdown_request",
"(",
"request",
")"
] | https://github.com/catboost/catboost/blob/167f64f237114a4d10b2b4ee42adb4569137debe/contrib/tools/python/src/Lib/SocketServer.py#L315-L322 | ||
wlanjie/AndroidFFmpeg | 7baf9122f4b8e1c74e7baf4be5c422c7a5ba5aaf | tools/fdk-aac-build/x86/toolchain/lib/python2.7/telnetlib.py | python | Telnet.fill_rawq | (self) | Fill raw queue from exactly one recv() system call.
Block if no data is immediately available. Set self.eof when
connection is closed. | Fill raw queue from exactly one recv() system call. | [
"Fill",
"raw",
"queue",
"from",
"exactly",
"one",
"recv",
"()",
"system",
"call",
"."
] | def fill_rawq(self):
"""Fill raw queue from exactly one recv() system call.
Block if no data is immediately available. Set self.eof when
connection is closed.
"""
if self.irawq >= len(self.rawq):
self.rawq = ''
self.irawq = 0
# The buffer size s... | [
"def",
"fill_rawq",
"(",
"self",
")",
":",
"if",
"self",
".",
"irawq",
">=",
"len",
"(",
"self",
".",
"rawq",
")",
":",
"self",
".",
"rawq",
"=",
"''",
"self",
".",
"irawq",
"=",
"0",
"# The buffer size should be fairly small so as to avoid quadratic",
"# be... | https://github.com/wlanjie/AndroidFFmpeg/blob/7baf9122f4b8e1c74e7baf4be5c422c7a5ba5aaf/tools/fdk-aac-build/x86/toolchain/lib/python2.7/telnetlib.py#L561-L576 | ||
cinder/Cinder | e83f5bb9c01a63eec20168d02953a0879e5100f7 | docs/libs/markdown/blockparser.py | python | BlockParser.parseDocument | (self, lines) | return util.etree.ElementTree(self.root) | Parse a markdown document into an ElementTree.
Given a list of lines, an ElementTree object (not just a parent
Element) is created and the root element is passed to the parser
as the parent. The ElementTree object is returned.
This should only be called on an entire document, not piece... | Parse a markdown document into an ElementTree. | [
"Parse",
"a",
"markdown",
"document",
"into",
"an",
"ElementTree",
"."
] | def parseDocument(self, lines):
""" Parse a markdown document into an ElementTree.
Given a list of lines, an ElementTree object (not just a parent
Element) is created and the root element is passed to the parser
as the parent. The ElementTree object is returned.
This should onl... | [
"def",
"parseDocument",
"(",
"self",
",",
"lines",
")",
":",
"# Create a ElementTree from the lines",
"self",
".",
"root",
"=",
"util",
".",
"etree",
".",
"Element",
"(",
"self",
".",
"markdown",
".",
"doc_tag",
")",
"self",
".",
"parseChunk",
"(",
"self",
... | https://github.com/cinder/Cinder/blob/e83f5bb9c01a63eec20168d02953a0879e5100f7/docs/libs/markdown/blockparser.py#L53-L66 | |
aws/lumberyard | f85344403c1c2e77ec8c75deb2c116e97b713217 | dev/Tools/AWSPythonSDK/1.5.8/docutils/nodes.py | python | Element.replace_self | (self, new) | Replace `self` node with `new`, where `new` is a node or a
list of nodes. | Replace `self` node with `new`, where `new` is a node or a
list of nodes. | [
"Replace",
"self",
"node",
"with",
"new",
"where",
"new",
"is",
"a",
"node",
"or",
"a",
"list",
"of",
"nodes",
"."
] | def replace_self(self, new):
"""
Replace `self` node with `new`, where `new` is a node or a
list of nodes.
"""
update = new
if not isinstance(new, Node):
# `new` is a list; update first child.
try:
update = new[0]
except... | [
"def",
"replace_self",
"(",
"self",
",",
"new",
")",
":",
"update",
"=",
"new",
"if",
"not",
"isinstance",
"(",
"new",
",",
"Node",
")",
":",
"# `new` is a list; update first child.",
"try",
":",
"update",
"=",
"new",
"[",
"0",
"]",
"except",
"IndexError",... | https://github.com/aws/lumberyard/blob/f85344403c1c2e77ec8c75deb2c116e97b713217/dev/Tools/AWSPythonSDK/1.5.8/docutils/nodes.py#L935-L955 | ||
cmu-db/noisepage | 79276e68fe83322f1249e8a8be96bd63c583ae56 | build-support/cpplint.py | python | FindStartOfExpressionInLine | (line, endpos, stack) | return (-1, stack) | Find position at the matching start of current expression.
This is almost the reverse of FindEndOfExpressionInLine, but note
that the input position and returned position differs by 1.
Args:
line: a CleansedLines line.
endpos: start searching at this position.
stack: nesting stack at endpos.
Retu... | Find position at the matching start of current expression. | [
"Find",
"position",
"at",
"the",
"matching",
"start",
"of",
"current",
"expression",
"."
] | def FindStartOfExpressionInLine(line, endpos, stack):
"""Find position at the matching start of current expression.
This is almost the reverse of FindEndOfExpressionInLine, but note
that the input position and returned position differs by 1.
Args:
line: a CleansedLines line.
endpos: start searching ... | [
"def",
"FindStartOfExpressionInLine",
"(",
"line",
",",
"endpos",
",",
"stack",
")",
":",
"i",
"=",
"endpos",
"while",
"i",
">=",
"0",
":",
"char",
"=",
"line",
"[",
"i",
"]",
"if",
"char",
"in",
"')]}'",
":",
"# Found end of expression, push to expression s... | https://github.com/cmu-db/noisepage/blob/79276e68fe83322f1249e8a8be96bd63c583ae56/build-support/cpplint.py#L1866-L1940 | |
etternagame/etterna | 8775f74ac9c353320128609d4b4150672e9a6d04 | extern/crashpad/buildtools/checkdeps/cpp_checker.py | python | CppChecker.ShouldCheck | (self, file_path) | return self.IsCppFile(file_path) | Check if the new #include file path should be presubmit checked.
Args:
file_path: file path to be checked
Return:
bool: True if the file should be checked; False otherwise. | Check if the new #include file path should be presubmit checked. | [
"Check",
"if",
"the",
"new",
"#include",
"file",
"path",
"should",
"be",
"presubmit",
"checked",
"."
] | def ShouldCheck(self, file_path):
"""Check if the new #include file path should be presubmit checked.
Args:
file_path: file path to be checked
Return:
bool: True if the file should be checked; False otherwise.
"""
return self.IsCppFile(file_path) | [
"def",
"ShouldCheck",
"(",
"self",
",",
"file_path",
")",
":",
"return",
"self",
".",
"IsCppFile",
"(",
"file_path",
")"
] | https://github.com/etternagame/etterna/blob/8775f74ac9c353320128609d4b4150672e9a6d04/extern/crashpad/buildtools/checkdeps/cpp_checker.py#L122-L131 | |
pmq20/node-packer | 12c46c6e44fbc14d9ee645ebd17d5296b324f7e0 | current/tools/gyp/pylib/gyp/xcode_ninja.py | python | IsValidTargetForWrapper | (target_extras, executable_target_pattern, spec) | return False | Limit targets for Xcode wrapper.
Xcode sometimes performs poorly with too many targets, so only include
proper executable targets, with filters to customize.
Arguments:
target_extras: Regular expression to always add, matching any target.
executable_target_pattern: Regular expression limiting executable ... | Limit targets for Xcode wrapper. | [
"Limit",
"targets",
"for",
"Xcode",
"wrapper",
"."
] | def IsValidTargetForWrapper(target_extras, executable_target_pattern, spec):
"""Limit targets for Xcode wrapper.
Xcode sometimes performs poorly with too many targets, so only include
proper executable targets, with filters to customize.
Arguments:
target_extras: Regular expression to always add, matching ... | [
"def",
"IsValidTargetForWrapper",
"(",
"target_extras",
",",
"executable_target_pattern",
",",
"spec",
")",
":",
"target_name",
"=",
"spec",
".",
"get",
"(",
"'target_name'",
")",
"# Always include targets matching target_extras.",
"if",
"target_extras",
"is",
"not",
"N... | https://github.com/pmq20/node-packer/blob/12c46c6e44fbc14d9ee645ebd17d5296b324f7e0/current/tools/gyp/pylib/gyp/xcode_ninja.py#L131-L156 | |
baidu-research/tensorflow-allreduce | 66d5b855e90b0949e9fa5cca5599fd729a70e874 | tensorflow/python/ops/math_grad.py | python | _SegmentSumGrad | (op, grad) | return array_ops.gather(grad, op.inputs[1]), None | Gradient for SegmentSum. | Gradient for SegmentSum. | [
"Gradient",
"for",
"SegmentSum",
"."
] | def _SegmentSumGrad(op, grad):
"""Gradient for SegmentSum."""
return array_ops.gather(grad, op.inputs[1]), None | [
"def",
"_SegmentSumGrad",
"(",
"op",
",",
"grad",
")",
":",
"return",
"array_ops",
".",
"gather",
"(",
"grad",
",",
"op",
".",
"inputs",
"[",
"1",
"]",
")",
",",
"None"
] | https://github.com/baidu-research/tensorflow-allreduce/blob/66d5b855e90b0949e9fa5cca5599fd729a70e874/tensorflow/python/ops/math_grad.py#L149-L151 | |
tensorflow/deepmath | b5b721f54de1d5d6a02d78f5da5995237f9995f9 | deepmath/guidance/wavenet.py | python | wavenet_layer | (inp,
depth,
width=3,
rate=1,
context=None,
scope=None,
reuse=None) | Single wavenet layer.
This assumes that the input is a rank 4 tensor of shape:
[batch, reduced_text_dimension, auxilliary_text_dimension, feature_depth]
If rate is more than one, this will be reshaped to
[B, R//(2**(rate-1)), A*(2**(rate-1)), D]
Then a conv2d will be applied with kernel size [width, 1].
... | Single wavenet layer. | [
"Single",
"wavenet",
"layer",
"."
] | def wavenet_layer(inp,
depth,
width=3,
rate=1,
context=None,
scope=None,
reuse=None):
"""Single wavenet layer.
This assumes that the input is a rank 4 tensor of shape:
[batch, reduced_text_dimension, aux... | [
"def",
"wavenet_layer",
"(",
"inp",
",",
"depth",
",",
"width",
"=",
"3",
",",
"rate",
"=",
"1",
",",
"context",
"=",
"None",
",",
"scope",
"=",
"None",
",",
"reuse",
"=",
"None",
")",
":",
"tf",
".",
"logging",
".",
"info",
"(",
"'Creating wavenet... | https://github.com/tensorflow/deepmath/blob/b5b721f54de1d5d6a02d78f5da5995237f9995f9/deepmath/guidance/wavenet.py#L27-L85 | ||
idaholab/moose | 9eeebc65e098b4c30f8205fb41591fd5b61eb6ff | python/peacock/base/Preferences.py | python | BasePreferenceWidget.setValue | (self, val) | Function that child classes need to inherit that sets the value of the widget | Function that child classes need to inherit that sets the value of the widget | [
"Function",
"that",
"child",
"classes",
"need",
"to",
"inherit",
"that",
"sets",
"the",
"value",
"of",
"the",
"widget"
] | def setValue(self, val):
"""
Function that child classes need to inherit that sets the value of the widget
""" | [
"def",
"setValue",
"(",
"self",
",",
"val",
")",
":"
] | https://github.com/idaholab/moose/blob/9eeebc65e098b4c30f8205fb41591fd5b61eb6ff/python/peacock/base/Preferences.py#L47-L50 | ||
thalium/icebox | 99d147d5b9269222225443ce171b4fd46d8985d4 | third_party/expected-lite/script/update-version.py | python | editFilesToVersionFromCommandLine | () | Update version number given on command line in paths from configuration table. | Update version number given on command line in paths from configuration table. | [
"Update",
"version",
"number",
"given",
"on",
"command",
"line",
"in",
"paths",
"from",
"configuration",
"table",
"."
] | def editFilesToVersionFromCommandLine():
"""Update version number given on command line in paths from configuration table."""
parser = argparse.ArgumentParser(
description='Update version number in files.',
epilog="""""",
formatter_class=argparse.RawTextHelpFormatter)
parser.add_ar... | [
"def",
"editFilesToVersionFromCommandLine",
"(",
")",
":",
"parser",
"=",
"argparse",
".",
"ArgumentParser",
"(",
"description",
"=",
"'Update version number in files.'",
",",
"epilog",
"=",
"\"\"\"\"\"\"",
",",
"formatter_class",
"=",
"argparse",
".",
"RawTextHelpForma... | https://github.com/thalium/icebox/blob/99d147d5b9269222225443ce171b4fd46d8985d4/third_party/expected-lite/script/update-version.py#L101-L123 | ||
catboost/catboost | 167f64f237114a4d10b2b4ee42adb4569137debe | contrib/python/pandas/py2/pandas/core/arrays/datetimes.py | python | DatetimeArray.__iter__ | (self) | Return an iterator over the boxed values
Yields
-------
tstamp : Timestamp | Return an iterator over the boxed values | [
"Return",
"an",
"iterator",
"over",
"the",
"boxed",
"values"
] | def __iter__(self):
"""
Return an iterator over the boxed values
Yields
-------
tstamp : Timestamp
"""
# convert in chunks of 10k for efficiency
data = self.asi8
length = len(self)
chunksize = 10000
chunks = int(length / chunksize... | [
"def",
"__iter__",
"(",
"self",
")",
":",
"# convert in chunks of 10k for efficiency",
"data",
"=",
"self",
".",
"asi8",
"length",
"=",
"len",
"(",
"self",
")",
"chunksize",
"=",
"10000",
"chunks",
"=",
"int",
"(",
"length",
"/",
"chunksize",
")",
"+",
"1"... | https://github.com/catboost/catboost/blob/167f64f237114a4d10b2b4ee42adb4569137debe/contrib/python/pandas/py2/pandas/core/arrays/datetimes.py#L592-L613 | ||
MythTV/mythtv | d282a209cb8be85d036f85a62a8ec971b67d45f4 | mythtv/contrib/imports/mirobridge/mirobridge/metadata.py | python | OutStreamEncoder.__getattr__ | (self, attr) | return getattr(self.out, attr) | Delegate everything but write to the stream | Delegate everything but write to the stream | [
"Delegate",
"everything",
"but",
"write",
"to",
"the",
"stream"
] | def __getattr__(self, attr):
"""Delegate everything but write to the stream"""
return getattr(self.out, attr) | [
"def",
"__getattr__",
"(",
"self",
",",
"attr",
")",
":",
"return",
"getattr",
"(",
"self",
".",
"out",
",",
"attr",
")"
] | https://github.com/MythTV/mythtv/blob/d282a209cb8be85d036f85a62a8ec971b67d45f4/mythtv/contrib/imports/mirobridge/mirobridge/metadata.py#L67-L69 | |
aws/lumberyard | f85344403c1c2e77ec8c75deb2c116e97b713217 | dev/Tools/Python/3.7.10/linux_x64/lib/python3.7/ctypes/_aix.py | python | get_version | (name, members) | return None | Sort list of members and return highest numbered version - if it exists.
This function is called when an unversioned libFOO.a(libFOO.so) has
not been found.
Versioning for the member name is expected to follow
GNU LIBTOOL conventions: the highest version (x, then X.y, then X.Y.z)
* find [libFoo.so... | Sort list of members and return highest numbered version - if it exists.
This function is called when an unversioned libFOO.a(libFOO.so) has
not been found. | [
"Sort",
"list",
"of",
"members",
"and",
"return",
"highest",
"numbered",
"version",
"-",
"if",
"it",
"exists",
".",
"This",
"function",
"is",
"called",
"when",
"an",
"unversioned",
"libFOO",
".",
"a",
"(",
"libFOO",
".",
"so",
")",
"has",
"not",
"been",
... | def get_version(name, members):
"""
Sort list of members and return highest numbered version - if it exists.
This function is called when an unversioned libFOO.a(libFOO.so) has
not been found.
Versioning for the member name is expected to follow
GNU LIBTOOL conventions: the highest version (x, ... | [
"def",
"get_version",
"(",
"name",
",",
"members",
")",
":",
"# the expression ending for versions must start as",
"# '.so.[0-9]', i.e., *.so.[at least one digit]",
"# while multiple, more specific expressions could be specified",
"# to search for .so.X, .so.X.Y and .so.X.Y.Z",
"# after the ... | https://github.com/aws/lumberyard/blob/f85344403c1c2e77ec8c75deb2c116e97b713217/dev/Tools/Python/3.7.10/linux_x64/lib/python3.7/ctypes/_aix.py#L174-L210 | |
aws/lumberyard | f85344403c1c2e77ec8c75deb2c116e97b713217 | dev/Tools/Python/3.7.10/windows/Lib/site-packages/setuptools/monkey.py | python | _patch_distribution_metadata | () | Patch write_pkg_file and read_pkg_file for higher metadata standards | Patch write_pkg_file and read_pkg_file for higher metadata standards | [
"Patch",
"write_pkg_file",
"and",
"read_pkg_file",
"for",
"higher",
"metadata",
"standards"
] | def _patch_distribution_metadata():
"""Patch write_pkg_file and read_pkg_file for higher metadata standards"""
for attr in ('write_pkg_file', 'read_pkg_file', 'get_metadata_version'):
new_val = getattr(setuptools.dist, attr)
setattr(distutils.dist.DistributionMetadata, attr, new_val) | [
"def",
"_patch_distribution_metadata",
"(",
")",
":",
"for",
"attr",
"in",
"(",
"'write_pkg_file'",
",",
"'read_pkg_file'",
",",
"'get_metadata_version'",
")",
":",
"new_val",
"=",
"getattr",
"(",
"setuptools",
".",
"dist",
",",
"attr",
")",
"setattr",
"(",
"d... | https://github.com/aws/lumberyard/blob/f85344403c1c2e77ec8c75deb2c116e97b713217/dev/Tools/Python/3.7.10/windows/Lib/site-packages/setuptools/monkey.py#L104-L108 | ||
wlanjie/AndroidFFmpeg | 7baf9122f4b8e1c74e7baf4be5c422c7a5ba5aaf | tools/fdk-aac-build/armeabi-v7a/toolchain/lib/python2.7/lib-tk/Tkinter.py | python | Wm.wm_colormapwindows | (self, *wlist) | return map(self._nametowidget, self.tk.call(args)) | Store list of window names (WLIST) into WM_COLORMAPWINDOWS property
of this widget. This list contains windows whose colormaps differ from their
parents. Return current list of widgets if WLIST is empty. | Store list of window names (WLIST) into WM_COLORMAPWINDOWS property
of this widget. This list contains windows whose colormaps differ from their
parents. Return current list of widgets if WLIST is empty. | [
"Store",
"list",
"of",
"window",
"names",
"(",
"WLIST",
")",
"into",
"WM_COLORMAPWINDOWS",
"property",
"of",
"this",
"widget",
".",
"This",
"list",
"contains",
"windows",
"whose",
"colormaps",
"differ",
"from",
"their",
"parents",
".",
"Return",
"current",
"li... | def wm_colormapwindows(self, *wlist):
"""Store list of window names (WLIST) into WM_COLORMAPWINDOWS property
of this widget. This list contains windows whose colormaps differ from their
parents. Return current list of widgets if WLIST is empty."""
if len(wlist) > 1:
wlist = (... | [
"def",
"wm_colormapwindows",
"(",
"self",
",",
"*",
"wlist",
")",
":",
"if",
"len",
"(",
"wlist",
")",
">",
"1",
":",
"wlist",
"=",
"(",
"wlist",
",",
")",
"# Tk needs a list of windows here",
"args",
"=",
"(",
"'wm'",
",",
"'colormapwindows'",
",",
"sel... | https://github.com/wlanjie/AndroidFFmpeg/blob/7baf9122f4b8e1c74e7baf4be5c422c7a5ba5aaf/tools/fdk-aac-build/armeabi-v7a/toolchain/lib/python2.7/lib-tk/Tkinter.py#L1561-L1568 | |
tensorflow/tensorflow | 419e3a6b650ea4bd1b0cba23c4348f8a69f3272e | tensorflow/python/ops/ragged/ragged_getitem.py | python | _ragged_getitem_inner_dimensions | (rt_input, key_list) | Retrieve inner dimensions, keeping outermost dimension unchanged.
Args:
rt_input: The `RaggedTensor` or `Tensor` from which a piece should be
extracted.
key_list: The __getitem__ keys for slicing the inner dimensions.
Returns:
A `RaggedTensor`.
Raises:
ValueError: If key_list is not suppo... | Retrieve inner dimensions, keeping outermost dimension unchanged. | [
"Retrieve",
"inner",
"dimensions",
"keeping",
"outermost",
"dimension",
"unchanged",
"."
] | def _ragged_getitem_inner_dimensions(rt_input, key_list):
"""Retrieve inner dimensions, keeping outermost dimension unchanged.
Args:
rt_input: The `RaggedTensor` or `Tensor` from which a piece should be
extracted.
key_list: The __getitem__ keys for slicing the inner dimensions.
Returns:
A `Rag... | [
"def",
"_ragged_getitem_inner_dimensions",
"(",
"rt_input",
",",
"key_list",
")",
":",
"if",
"not",
"key_list",
":",
"return",
"rt_input",
"if",
"isinstance",
"(",
"rt_input",
",",
"ops",
".",
"Tensor",
")",
":",
"return",
"rt_input",
".",
"__getitem__",
"(",
... | https://github.com/tensorflow/tensorflow/blob/419e3a6b650ea4bd1b0cba23c4348f8a69f3272e/tensorflow/python/ops/ragged/ragged_getitem.py#L232-L342 | ||
rsummers11/CADLab | 976ed959a0b5208bb4173127a7ef732ac73a9b6f | MULAN_universal_lesion_analysis/maskrcnn/modeling/rpn/rpn.py | python | RPNModule.forward | (self, images, features, targets=None) | Arguments:
images (ImageList): images for which we want to compute the predictions
features (list[Tensor]): features computed from the images that are
used for computing the predictions. Each tensor in the list
correspond to different feature levels
ta... | Arguments:
images (ImageList): images for which we want to compute the predictions
features (list[Tensor]): features computed from the images that are
used for computing the predictions. Each tensor in the list
correspond to different feature levels
ta... | [
"Arguments",
":",
"images",
"(",
"ImageList",
")",
":",
"images",
"for",
"which",
"we",
"want",
"to",
"compute",
"the",
"predictions",
"features",
"(",
"list",
"[",
"Tensor",
"]",
")",
":",
"features",
"computed",
"from",
"the",
"images",
"that",
"are",
... | def forward(self, images, features, targets=None):
"""
Arguments:
images (ImageList): images for which we want to compute the predictions
features (list[Tensor]): features computed from the images that are
used for computing the predictions. Each tensor in the lis... | [
"def",
"forward",
"(",
"self",
",",
"images",
",",
"features",
",",
"targets",
"=",
"None",
")",
":",
"objectness",
",",
"rpn_box_regression",
"=",
"self",
".",
"head",
"(",
"features",
")",
"anchors",
"=",
"self",
".",
"anchor_generator",
"(",
"images",
... | https://github.com/rsummers11/CADLab/blob/976ed959a0b5208bb4173127a7ef732ac73a9b6f/MULAN_universal_lesion_analysis/maskrcnn/modeling/rpn/rpn.py#L86-L107 | ||
tensorflow/tensorflow | 419e3a6b650ea4bd1b0cba23c4348f8a69f3272e | tensorflow/python/ops/image_ops_impl.py | python | flip_left_right | (image) | return _flip(image, 1, 'flip_left_right') | Flip an image horizontally (left to right).
Outputs the contents of `image` flipped along the width dimension.
See also `tf.reverse`.
Usage Example:
>>> x = [[[1.0, 2.0, 3.0],
... [4.0, 5.0, 6.0]],
... [[7.0, 8.0, 9.0],
... [10.0, 11.0, 12.0]]]
>>> tf.image.flip_left_right(x)
<tf.T... | Flip an image horizontally (left to right). | [
"Flip",
"an",
"image",
"horizontally",
"(",
"left",
"to",
"right",
")",
"."
] | def flip_left_right(image):
"""Flip an image horizontally (left to right).
Outputs the contents of `image` flipped along the width dimension.
See also `tf.reverse`.
Usage Example:
>>> x = [[[1.0, 2.0, 3.0],
... [4.0, 5.0, 6.0]],
... [[7.0, 8.0, 9.0],
... [10.0, 11.0, 12.0]]]
>>> tf... | [
"def",
"flip_left_right",
"(",
"image",
")",
":",
"return",
"_flip",
"(",
"image",
",",
"1",
",",
"'flip_left_right'",
")"
] | https://github.com/tensorflow/tensorflow/blob/419e3a6b650ea4bd1b0cba23c4348f8a69f3272e/tensorflow/python/ops/image_ops_impl.py#L540-L570 | |
thalium/icebox | 99d147d5b9269222225443ce171b4fd46d8985d4 | third_party/virtualbox/src/libs/libxml2-2.9.4/python/libxml2class.py | python | parserCtxt.scanName | (self) | return ret | Trickery: parse an XML name but without consuming the input
flow Needed for rollback cases. Used only when parsing
entities references. TODO: seems deprecated now, only used
in the default part of xmlParserHandleReference [4]
NameChar ::= Letter | Digit | '.' | '-' | '_' | ':' ... | Trickery: parse an XML name but without consuming the input
flow Needed for rollback cases. Used only when parsing
entities references. TODO: seems deprecated now, only used
in the default part of xmlParserHandleReference [4]
NameChar ::= Letter | Digit | '.' | '-' | '_' | ':' ... | [
"Trickery",
":",
"parse",
"an",
"XML",
"name",
"but",
"without",
"consuming",
"the",
"input",
"flow",
"Needed",
"for",
"rollback",
"cases",
".",
"Used",
"only",
"when",
"parsing",
"entities",
"references",
".",
"TODO",
":",
"seems",
"deprecated",
"now",
"onl... | def scanName(self):
"""Trickery: parse an XML name but without consuming the input
flow Needed for rollback cases. Used only when parsing
entities references. TODO: seems deprecated now, only used
in the default part of xmlParserHandleReference [4]
NameChar ::= Letter |... | [
"def",
"scanName",
"(",
"self",
")",
":",
"ret",
"=",
"libxml2mod",
".",
"xmlScanName",
"(",
"self",
".",
"_o",
")",
"return",
"ret"
] | https://github.com/thalium/icebox/blob/99d147d5b9269222225443ce171b4fd46d8985d4/third_party/virtualbox/src/libs/libxml2-2.9.4/python/libxml2class.py#L4744-L4753 | |
wxWidgets/wxPython-Classic | 19571e1ae65f1ac445f5491474121998c97a1bf0 | src/osx_carbon/propgrid.py | python | FileProperty.__init__ | (self, *args, **kwargs) | __init__(self, String label=(*wxPGProperty::sm_wxPG_LABEL), String name=(*wxPGProperty::sm_wxPG_LABEL),
String value=wxEmptyString) -> FileProperty | __init__(self, String label=(*wxPGProperty::sm_wxPG_LABEL), String name=(*wxPGProperty::sm_wxPG_LABEL),
String value=wxEmptyString) -> FileProperty | [
"__init__",
"(",
"self",
"String",
"label",
"=",
"(",
"*",
"wxPGProperty",
"::",
"sm_wxPG_LABEL",
")",
"String",
"name",
"=",
"(",
"*",
"wxPGProperty",
"::",
"sm_wxPG_LABEL",
")",
"String",
"value",
"=",
"wxEmptyString",
")",
"-",
">",
"FileProperty"
] | def __init__(self, *args, **kwargs):
"""
__init__(self, String label=(*wxPGProperty::sm_wxPG_LABEL), String name=(*wxPGProperty::sm_wxPG_LABEL),
String value=wxEmptyString) -> FileProperty
"""
_propgrid.FileProperty_swiginit(self,_propgrid.new_FileProperty(*args, **kwargs)) | [
"def",
"__init__",
"(",
"self",
",",
"*",
"args",
",",
"*",
"*",
"kwargs",
")",
":",
"_propgrid",
".",
"FileProperty_swiginit",
"(",
"self",
",",
"_propgrid",
".",
"new_FileProperty",
"(",
"*",
"args",
",",
"*",
"*",
"kwargs",
")",
")"
] | https://github.com/wxWidgets/wxPython-Classic/blob/19571e1ae65f1ac445f5491474121998c97a1bf0/src/osx_carbon/propgrid.py#L3067-L3072 | ||
FreeCAD/FreeCAD | ba42231b9c6889b89e064d6d563448ed81e376ec | src/Mod/Draft/draftguitools/gui_orthoarray.py | python | OrthoArray.GetResources | (self) | return {"Pixmap": "Draft_Array",
"MenuText": QT_TRANSLATE_NOOP("Draft_OrthoArray", "Array"),
"ToolTip": QT_TRANSLATE_NOOP("Draft_OrthoArray", "Creates copies of the selected object, and places the copies in an orthogonal pattern,\nmeaning the copies follow the specified direction in the ... | Set icon, menu and tooltip. | Set icon, menu and tooltip. | [
"Set",
"icon",
"menu",
"and",
"tooltip",
"."
] | def GetResources(self):
"""Set icon, menu and tooltip."""
return {"Pixmap": "Draft_Array",
"MenuText": QT_TRANSLATE_NOOP("Draft_OrthoArray", "Array"),
"ToolTip": QT_TRANSLATE_NOOP("Draft_OrthoArray", "Creates copies of the selected object, and places the copies in an orth... | [
"def",
"GetResources",
"(",
"self",
")",
":",
"return",
"{",
"\"Pixmap\"",
":",
"\"Draft_Array\"",
",",
"\"MenuText\"",
":",
"QT_TRANSLATE_NOOP",
"(",
"\"Draft_OrthoArray\"",
",",
"\"Array\"",
")",
",",
"\"ToolTip\"",
":",
"QT_TRANSLATE_NOOP",
"(",
"\"Draft_OrthoArr... | https://github.com/FreeCAD/FreeCAD/blob/ba42231b9c6889b89e064d6d563448ed81e376ec/src/Mod/Draft/draftguitools/gui_orthoarray.py#L62-L66 | |
aws/lumberyard | f85344403c1c2e77ec8c75deb2c116e97b713217 | dev/Tools/Python/3.7.10/linux_x64/lib/python3.7/pickletools.py | python | read_uint1 | (f) | r"""
>>> import io
>>> read_uint1(io.BytesIO(b'\xff'))
255 | r"""
>>> import io
>>> read_uint1(io.BytesIO(b'\xff'))
255 | [
"r",
">>>",
"import",
"io",
">>>",
"read_uint1",
"(",
"io",
".",
"BytesIO",
"(",
"b",
"\\",
"xff",
"))",
"255"
] | def read_uint1(f):
r"""
>>> import io
>>> read_uint1(io.BytesIO(b'\xff'))
255
"""
data = f.read(1)
if data:
return data[0]
raise ValueError("not enough data in stream to read uint1") | [
"def",
"read_uint1",
"(",
"f",
")",
":",
"data",
"=",
"f",
".",
"read",
"(",
"1",
")",
"if",
"data",
":",
"return",
"data",
"[",
"0",
"]",
"raise",
"ValueError",
"(",
"\"not enough data in stream to read uint1\"",
")"
] | https://github.com/aws/lumberyard/blob/f85344403c1c2e77ec8c75deb2c116e97b713217/dev/Tools/Python/3.7.10/linux_x64/lib/python3.7/pickletools.py#L212-L222 | ||
FreeCAD/FreeCAD | ba42231b9c6889b89e064d6d563448ed81e376ec | src/Mod/Draft/draftobjects/dimension.py | python | AngularDimension.onChanged | (self, obj, prop) | Execute when a property is changed.
It just sets some properties to be read-only or hidden,
as they aren't used. | Execute when a property is changed. | [
"Execute",
"when",
"a",
"property",
"is",
"changed",
"."
] | def onChanged(self, obj, prop):
"""Execute when a property is changed.
It just sets some properties to be read-only or hidden,
as they aren't used.
"""
if hasattr(obj, "Angle"):
obj.setPropertyStatus('Angle', 'ReadOnly')
if hasattr(obj, "Normal"):
... | [
"def",
"onChanged",
"(",
"self",
",",
"obj",
",",
"prop",
")",
":",
"if",
"hasattr",
"(",
"obj",
",",
"\"Angle\"",
")",
":",
"obj",
".",
"setPropertyStatus",
"(",
"'Angle'",
",",
"'ReadOnly'",
")",
"if",
"hasattr",
"(",
"obj",
",",
"\"Normal\"",
")",
... | https://github.com/FreeCAD/FreeCAD/blob/ba42231b9c6889b89e064d6d563448ed81e376ec/src/Mod/Draft/draftobjects/dimension.py#L587-L601 | ||
aws/lumberyard | f85344403c1c2e77ec8c75deb2c116e97b713217 | dev/Tools/Python/3.7.10/mac/Python.framework/Versions/3.7/lib/python3.7/http/cookiejar.py | python | CookiePolicy.return_ok | (self, cookie, request) | Return true if (and only if) cookie should be returned to server. | Return true if (and only if) cookie should be returned to server. | [
"Return",
"true",
"if",
"(",
"and",
"only",
"if",
")",
"cookie",
"should",
"be",
"returned",
"to",
"server",
"."
] | def return_ok(self, cookie, request):
"""Return true if (and only if) cookie should be returned to server."""
raise NotImplementedError() | [
"def",
"return_ok",
"(",
"self",
",",
"cookie",
",",
"request",
")",
":",
"raise",
"NotImplementedError",
"(",
")"
] | https://github.com/aws/lumberyard/blob/f85344403c1c2e77ec8c75deb2c116e97b713217/dev/Tools/Python/3.7.10/mac/Python.framework/Versions/3.7/lib/python3.7/http/cookiejar.py#L851-L853 | ||
eric612/MobileNet-YOLO | 69b4441cb3ec8d553fbdef788ad033e246f901bd | python/caffe/pycaffe.py | python | _Net_forward_backward_all | (self, blobs=None, diffs=None, **kwargs) | return all_outs, all_diffs | Run net forward + backward in batches.
Parameters
----------
blobs: list of blobs to extract as in forward()
diffs: list of diffs to extract as in backward()
kwargs: Keys are input (for forward) and output (for backward) blob names
and values are ndarrays. Refer to forward() and backwar... | Run net forward + backward in batches. | [
"Run",
"net",
"forward",
"+",
"backward",
"in",
"batches",
"."
] | def _Net_forward_backward_all(self, blobs=None, diffs=None, **kwargs):
"""
Run net forward + backward in batches.
Parameters
----------
blobs: list of blobs to extract as in forward()
diffs: list of diffs to extract as in backward()
kwargs: Keys are input (for forward) and output (for backw... | [
"def",
"_Net_forward_backward_all",
"(",
"self",
",",
"blobs",
"=",
"None",
",",
"diffs",
"=",
"None",
",",
"*",
"*",
"kwargs",
")",
":",
"# Batch blobs and diffs.",
"all_outs",
"=",
"{",
"out",
":",
"[",
"]",
"for",
"out",
"in",
"set",
"(",
"self",
".... | https://github.com/eric612/MobileNet-YOLO/blob/69b4441cb3ec8d553fbdef788ad033e246f901bd/python/caffe/pycaffe.py#L216-L258 | |
abyzovlab/CNVnator | c73786d6160f17b020feae928148533ca036fad2 | pytools/io.py | python | IO.__del__ | (self) | Class destructor
Closes root file | Class destructor
Closes root file | [
"Class",
"destructor",
"Closes",
"root",
"file"
] | def __del__(self):
"""Class destructor
Closes root file"""
self.file.Close() | [
"def",
"__del__",
"(",
"self",
")",
":",
"self",
".",
"file",
".",
"Close",
"(",
")"
] | https://github.com/abyzovlab/CNVnator/blob/c73786d6160f17b020feae928148533ca036fad2/pytools/io.py#L59-L62 | ||
libornovax/master_thesis_code | 6eca474ed3cae673afde010caef338cf7349f839 | scripts/data/shared/bbtxt.py | python | load_bbtxt_to_list | (path_bbtxt) | Loads a BBTXT file into a list of BB2D objects. The information about filename will get
lost - this is a function purely for statistical purposes.
Input:
path_bbtxt: Path to a BBTXT file
Returns:
list of BB2d objects | Loads a BBTXT file into a list of BB2D objects. The information about filename will get
lost - this is a function purely for statistical purposes. | [
"Loads",
"a",
"BBTXT",
"file",
"into",
"a",
"list",
"of",
"BB2D",
"objects",
".",
"The",
"information",
"about",
"filename",
"will",
"get",
"lost",
"-",
"this",
"is",
"a",
"function",
"purely",
"for",
"statistical",
"purposes",
"."
] | def load_bbtxt_to_list(path_bbtxt):
"""
Loads a BBTXT file into a list of BB2D objects. The information about filename will get
lost - this is a function purely for statistical purposes.
Input:
path_bbtxt: Path to a BBTXT file
Returns:
list of BB2d objects
"""
with open(path_bbtxt, 'r') as infile:
# Ok, t... | [
"def",
"load_bbtxt_to_list",
"(",
"path_bbtxt",
")",
":",
"with",
"open",
"(",
"path_bbtxt",
",",
"'r'",
")",
"as",
"infile",
":",
"# Ok, the file is open so we can start reading",
"bb2d_list",
"=",
"[",
"]",
"for",
"line",
"in",
"infile",
":",
"line",
"=",
"l... | https://github.com/libornovax/master_thesis_code/blob/6eca474ed3cae673afde010caef338cf7349f839/scripts/data/shared/bbtxt.py#L57-L83 | ||
mantidproject/mantid | 03deeb89254ec4289edb8771e0188c2090a02f32 | qt/python/mantidqtinterfaces/mantidqtinterfaces/Muon/GUI/Common/contexts/fitting_contexts/model_fitting_context.py | python | ModelFittingContext.x_parameter_errors | (self) | return self._x_parameter_errors | Returns the available x parameter errors for the selected results table. | Returns the available x parameter errors for the selected results table. | [
"Returns",
"the",
"available",
"x",
"parameter",
"errors",
"for",
"the",
"selected",
"results",
"table",
"."
] | def x_parameter_errors(self) -> dict:
"""Returns the available x parameter errors for the selected results table."""
return self._x_parameter_errors | [
"def",
"x_parameter_errors",
"(",
"self",
")",
"->",
"dict",
":",
"return",
"self",
".",
"_x_parameter_errors"
] | https://github.com/mantidproject/mantid/blob/03deeb89254ec4289edb8771e0188c2090a02f32/qt/python/mantidqtinterfaces/mantidqtinterfaces/Muon/GUI/Common/contexts/fitting_contexts/model_fitting_context.py#L77-L79 | |
livecode/livecode | 4606a10ea10b16d5071d0f9f263ccdd7ede8b31d | gyp/pylib/gyp/generator/android.py | python | AndroidMkWriter.WriteSourceFlags | (self, spec, configs) | Write out the flags and include paths used to compile source files for
the current target.
Args:
spec, configs: input from gyp. | Write out the flags and include paths used to compile source files for
the current target. | [
"Write",
"out",
"the",
"flags",
"and",
"include",
"paths",
"used",
"to",
"compile",
"source",
"files",
"for",
"the",
"current",
"target",
"."
] | def WriteSourceFlags(self, spec, configs):
"""Write out the flags and include paths used to compile source files for
the current target.
Args:
spec, configs: input from gyp.
"""
for configname, config in sorted(configs.iteritems()):
extracted_includes = []
self.WriteLn('\n# Flags... | [
"def",
"WriteSourceFlags",
"(",
"self",
",",
"spec",
",",
"configs",
")",
":",
"for",
"configname",
",",
"config",
"in",
"sorted",
"(",
"configs",
".",
"iteritems",
"(",
")",
")",
":",
"extracted_includes",
"=",
"[",
"]",
"self",
".",
"WriteLn",
"(",
"... | https://github.com/livecode/livecode/blob/4606a10ea10b16d5071d0f9f263ccdd7ede8b31d/gyp/pylib/gyp/generator/android.py#L454-L496 | ||
aws/lumberyard | f85344403c1c2e77ec8c75deb2c116e97b713217 | dev/Tools/Python/3.7.10/linux_x64/lib/python3.7/bdb.py | python | effective | (file, line, frame) | return (None, None) | Determine which breakpoint for this file:line is to be acted upon.
Called only if we know there is a breakpoint at this location. Return
the breakpoint that was triggered and a boolean that indicates if it is
ok to delete a temporary breakpoint. Return (None, None) if there is no
matching breakpoint. | Determine which breakpoint for this file:line is to be acted upon. | [
"Determine",
"which",
"breakpoint",
"for",
"this",
"file",
":",
"line",
"is",
"to",
"be",
"acted",
"upon",
"."
] | def effective(file, line, frame):
"""Determine which breakpoint for this file:line is to be acted upon.
Called only if we know there is a breakpoint at this location. Return
the breakpoint that was triggered and a boolean that indicates if it is
ok to delete a temporary breakpoint. Return (None, None... | [
"def",
"effective",
"(",
"file",
",",
"line",
",",
"frame",
")",
":",
"possibles",
"=",
"Breakpoint",
".",
"bplist",
"[",
"file",
",",
"line",
"]",
"for",
"b",
"in",
"possibles",
":",
"if",
"not",
"b",
".",
"enabled",
":",
"continue",
"if",
"not",
... | https://github.com/aws/lumberyard/blob/f85344403c1c2e77ec8c75deb2c116e97b713217/dev/Tools/Python/3.7.10/linux_x64/lib/python3.7/bdb.py#L797-L840 | |
google/or-tools | 2cb85b4eead4c38e1c54b48044f92087cf165bce | examples/python/shift_scheduling_sat.py | python | negated_bounded_span | (works, start, length) | return sequence | Filters an isolated sub-sequence of variables assined to True.
Extract the span of Boolean variables [start, start + length), negate them,
and if there is variables to the left/right of this span, surround the span by
them in non negated form.
Args:
works: a list of variables to extract the span from.
... | Filters an isolated sub-sequence of variables assined to True. | [
"Filters",
"an",
"isolated",
"sub",
"-",
"sequence",
"of",
"variables",
"assined",
"to",
"True",
"."
] | def negated_bounded_span(works, start, length):
"""Filters an isolated sub-sequence of variables assined to True.
Extract the span of Boolean variables [start, start + length), negate them,
and if there is variables to the left/right of this span, surround the span by
them in non negated form.
Args:
w... | [
"def",
"negated_bounded_span",
"(",
"works",
",",
"start",
",",
"length",
")",
":",
"sequence",
"=",
"[",
"]",
"# Left border (start of works, or works[start - 1])",
"if",
"start",
">",
"0",
":",
"sequence",
".",
"append",
"(",
"works",
"[",
"start",
"-",
"1",... | https://github.com/google/or-tools/blob/2cb85b4eead4c38e1c54b48044f92087cf165bce/examples/python/shift_scheduling_sat.py#L30-L56 | |
ideawu/ssdb | f229ba277c7f7d0ca5a441c0c6fb3d1209af68e4 | deps/cpy/antlr3/tokens.py | python | Token.getTokenIndex | (self) | @brief Get the index in the input stream.
An index from 0..n-1 of the token object in the input stream.
This must be valid in order to use the ANTLRWorks debugger.
Using setter/getter methods is deprecated. Use o.index instead. | @brief Get the index in the input stream. | [
"@brief",
"Get",
"the",
"index",
"in",
"the",
"input",
"stream",
"."
] | def getTokenIndex(self):
"""@brief Get the index in the input stream.
An index from 0..n-1 of the token object in the input stream.
This must be valid in order to use the ANTLRWorks debugger.
Using setter/getter methods is deprecated. Use o.index instead."""
raise NotI... | [
"def",
"getTokenIndex",
"(",
"self",
")",
":",
"raise",
"NotImplementedError"
] | https://github.com/ideawu/ssdb/blob/f229ba277c7f7d0ca5a441c0c6fb3d1209af68e4/deps/cpy/antlr3/tokens.py#L123-L131 | ||
Polidea/SiriusObfuscator | b0e590d8130e97856afe578869b83a209e2b19be | SymbolExtractorAndRenamer/lldb/scripts/Python/static-binding/lldb.py | python | SBWatchpoint.GetCondition | (self) | return _lldb.SBWatchpoint_GetCondition(self) | GetCondition(self) -> str
Get the condition expression for the watchpoint. | GetCondition(self) -> str | [
"GetCondition",
"(",
"self",
")",
"-",
">",
"str"
] | def GetCondition(self):
"""
GetCondition(self) -> str
Get the condition expression for the watchpoint.
"""
return _lldb.SBWatchpoint_GetCondition(self) | [
"def",
"GetCondition",
"(",
"self",
")",
":",
"return",
"_lldb",
".",
"SBWatchpoint_GetCondition",
"(",
"self",
")"
] | https://github.com/Polidea/SiriusObfuscator/blob/b0e590d8130e97856afe578869b83a209e2b19be/SymbolExtractorAndRenamer/lldb/scripts/Python/static-binding/lldb.py#L12638-L12644 | |
benoitsteiner/tensorflow-opencl | cb7cb40a57fde5cfd4731bc551e82a1e2fef43a5 | tensorflow/python/training/supervisor.py | python | Supervisor.ready_op | (self) | return self._ready_op | Return the Ready Op used by the supervisor.
Returns:
An Op or `None`. | Return the Ready Op used by the supervisor. | [
"Return",
"the",
"Ready",
"Op",
"used",
"by",
"the",
"supervisor",
"."
] | def ready_op(self):
"""Return the Ready Op used by the supervisor.
Returns:
An Op or `None`.
"""
return self._ready_op | [
"def",
"ready_op",
"(",
"self",
")",
":",
"return",
"self",
".",
"_ready_op"
] | https://github.com/benoitsteiner/tensorflow-opencl/blob/cb7cb40a57fde5cfd4731bc551e82a1e2fef43a5/tensorflow/python/training/supervisor.py#L532-L538 | |
baidu-research/tensorflow-allreduce | 66d5b855e90b0949e9fa5cca5599fd729a70e874 | tensorflow/contrib/cluster_resolver/python/training/cluster_resolver.py | python | SimpleClusterResolver.__init__ | (self, cluster_spec) | Creates a SimpleClusterResolver from a ClusterSpec. | Creates a SimpleClusterResolver from a ClusterSpec. | [
"Creates",
"a",
"SimpleClusterResolver",
"from",
"a",
"ClusterSpec",
"."
] | def __init__(self, cluster_spec):
"""Creates a SimpleClusterResolver from a ClusterSpec."""
super(SimpleClusterResolver, self).__init__()
if not isinstance(cluster_spec, ClusterSpec):
raise TypeError('cluster_spec must be a ClusterSpec.')
self._cluster_spec = cluster_spec | [
"def",
"__init__",
"(",
"self",
",",
"cluster_spec",
")",
":",
"super",
"(",
"SimpleClusterResolver",
",",
"self",
")",
".",
"__init__",
"(",
")",
"if",
"not",
"isinstance",
"(",
"cluster_spec",
",",
"ClusterSpec",
")",
":",
"raise",
"TypeError",
"(",
"'cl... | https://github.com/baidu-research/tensorflow-allreduce/blob/66d5b855e90b0949e9fa5cca5599fd729a70e874/tensorflow/contrib/cluster_resolver/python/training/cluster_resolver.py#L60-L66 | ||
tkn-tub/ns3-gym | 19bfe0a583e641142609939a090a09dfc63a095f | src/visualizer/visualizer/core.py | python | Node._set_highlighted | (self, value) | !
Set highlighted function.
@param self: class object.
@param value: selected value
@return none | !
Set highlighted function. | [
"!",
"Set",
"highlighted",
"function",
"."
] | def _set_highlighted(self, value):
"""!
Set highlighted function.
@param self: class object.
@param value: selected value
@return none
"""
self._highlighted = value
self._update_appearance() | [
"def",
"_set_highlighted",
"(",
"self",
",",
"value",
")",
":",
"self",
".",
"_highlighted",
"=",
"value",
"self",
".",
"_update_appearance",
"(",
")"
] | https://github.com/tkn-tub/ns3-gym/blob/19bfe0a583e641142609939a090a09dfc63a095f/src/visualizer/visualizer/core.py#L324-L333 | ||
apple/swift-lldb | d74be846ef3e62de946df343e8c234bde93a8912 | scripts/Python/static-binding/lldb.py | python | SBTypeCategory.get_filters_array | (self) | return filters | An accessor function that returns a list() that contains all filters in a lldb.SBCategory object. | An accessor function that returns a list() that contains all filters in a lldb.SBCategory object. | [
"An",
"accessor",
"function",
"that",
"returns",
"a",
"list",
"()",
"that",
"contains",
"all",
"filters",
"in",
"a",
"lldb",
".",
"SBCategory",
"object",
"."
] | def get_filters_array(self):
'''An accessor function that returns a list() that contains all filters in a lldb.SBCategory object.'''
filters = []
for idx in range(self.GetNumFilters()):
filters.append(self.GetFilterAtIndex(idx))
return filters | [
"def",
"get_filters_array",
"(",
"self",
")",
":",
"filters",
"=",
"[",
"]",
"for",
"idx",
"in",
"range",
"(",
"self",
".",
"GetNumFilters",
"(",
")",
")",
":",
"filters",
".",
"append",
"(",
"self",
".",
"GetFilterAtIndex",
"(",
"idx",
")",
")",
"re... | https://github.com/apple/swift-lldb/blob/d74be846ef3e62de946df343e8c234bde93a8912/scripts/Python/static-binding/lldb.py#L13273-L13278 | |
qt/qt | 0a2f2382541424726168804be2c90b91381608c6 | src/3rdparty/freetype/src/tools/docmaker/content.py | python | DocBlock.get_markup | ( self, tag_name ) | return None | return the DocMarkup corresponding to a given tag in a block | return the DocMarkup corresponding to a given tag in a block | [
"return",
"the",
"DocMarkup",
"corresponding",
"to",
"a",
"given",
"tag",
"in",
"a",
"block"
] | def get_markup( self, tag_name ):
"""return the DocMarkup corresponding to a given tag in a block"""
for m in self.markups:
if m.tag == string.lower( tag_name ):
return m
return None | [
"def",
"get_markup",
"(",
"self",
",",
"tag_name",
")",
":",
"for",
"m",
"in",
"self",
".",
"markups",
":",
"if",
"m",
".",
"tag",
"==",
"string",
".",
"lower",
"(",
"tag_name",
")",
":",
"return",
"m",
"return",
"None"
] | https://github.com/qt/qt/blob/0a2f2382541424726168804be2c90b91381608c6/src/3rdparty/freetype/src/tools/docmaker/content.py#L551-L556 | |
aws/lumberyard | f85344403c1c2e77ec8c75deb2c116e97b713217 | dev/Tools/Python/3.7.10/mac/Python.framework/Versions/3.7/lib/python3.7/ftplib.py | python | FTP.set_pasv | (self, val) | Use passive or active mode for data transfers.
With a false argument, use the normal PORT mode,
With a true argument, use the PASV command. | Use passive or active mode for data transfers.
With a false argument, use the normal PORT mode,
With a true argument, use the PASV command. | [
"Use",
"passive",
"or",
"active",
"mode",
"for",
"data",
"transfers",
".",
"With",
"a",
"false",
"argument",
"use",
"the",
"normal",
"PORT",
"mode",
"With",
"a",
"true",
"argument",
"use",
"the",
"PASV",
"command",
"."
] | def set_pasv(self, val):
'''Use passive or active mode for data transfers.
With a false argument, use the normal PORT mode,
With a true argument, use the PASV command.'''
self.passiveserver = val | [
"def",
"set_pasv",
"(",
"self",
",",
"val",
")",
":",
"self",
".",
"passiveserver",
"=",
"val"
] | https://github.com/aws/lumberyard/blob/f85344403c1c2e77ec8c75deb2c116e97b713217/dev/Tools/Python/3.7.10/mac/Python.framework/Versions/3.7/lib/python3.7/ftplib.py#L174-L178 | ||
CMU-Perceptual-Computing-Lab/caffe_rtpose | a4778bb1c3eb74d7250402016047216f77b4dba6 | scripts/cpp_lint.py | python | GetHeaderGuardCPPVariable | (filename) | return re.sub(r'[-./\s]', '_', file_path_from_root).upper() + '_' | Returns the CPP variable that should be used as a header guard.
Args:
filename: The name of a C++ header file.
Returns:
The CPP variable that should be used as a header guard in the
named file. | Returns the CPP variable that should be used as a header guard. | [
"Returns",
"the",
"CPP",
"variable",
"that",
"should",
"be",
"used",
"as",
"a",
"header",
"guard",
"."
] | def GetHeaderGuardCPPVariable(filename):
"""Returns the CPP variable that should be used as a header guard.
Args:
filename: The name of a C++ header file.
Returns:
The CPP variable that should be used as a header guard in the
named file.
"""
# Restores original filename in case that cpplint is... | [
"def",
"GetHeaderGuardCPPVariable",
"(",
"filename",
")",
":",
"# Restores original filename in case that cpplint is invoked from Emacs's",
"# flymake.",
"filename",
"=",
"re",
".",
"sub",
"(",
"r'_flymake\\.h$'",
",",
"'.h'",
",",
"filename",
")",
"filename",
"=",
"re",
... | https://github.com/CMU-Perceptual-Computing-Lab/caffe_rtpose/blob/a4778bb1c3eb74d7250402016047216f77b4dba6/scripts/cpp_lint.py#L1384-L1405 | |
wxWidgets/wxPython-Classic | 19571e1ae65f1ac445f5491474121998c97a1bf0 | src/gtk/_core.py | python | Object.Destroy | (*args, **kwargs) | return _core_.Object_Destroy(*args, **kwargs) | Destroy(self)
Deletes the C++ object this Python object is a proxy for. | Destroy(self) | [
"Destroy",
"(",
"self",
")"
] | def Destroy(*args, **kwargs):
"""
Destroy(self)
Deletes the C++ object this Python object is a proxy for.
"""
args[0].this.own(False)
return _core_.Object_Destroy(*args, **kwargs) | [
"def",
"Destroy",
"(",
"*",
"args",
",",
"*",
"*",
"kwargs",
")",
":",
"args",
"[",
"0",
"]",
".",
"this",
".",
"own",
"(",
"False",
")",
"return",
"_core_",
".",
"Object_Destroy",
"(",
"*",
"args",
",",
"*",
"*",
"kwargs",
")"
] | https://github.com/wxWidgets/wxPython-Classic/blob/19571e1ae65f1ac445f5491474121998c97a1bf0/src/gtk/_core.py#L812-L819 | |
aws/lumberyard | f85344403c1c2e77ec8c75deb2c116e97b713217 | dev/Tools/Python/3.7.10/linux_x64/lib/python3.7/heapq.py | python | heappushpop | (heap, item) | return item | Fast version of a heappush followed by a heappop. | Fast version of a heappush followed by a heappop. | [
"Fast",
"version",
"of",
"a",
"heappush",
"followed",
"by",
"a",
"heappop",
"."
] | def heappushpop(heap, item):
"""Fast version of a heappush followed by a heappop."""
if heap and heap[0] < item:
item, heap[0] = heap[0], item
_siftup(heap, 0)
return item | [
"def",
"heappushpop",
"(",
"heap",
",",
"item",
")",
":",
"if",
"heap",
"and",
"heap",
"[",
"0",
"]",
"<",
"item",
":",
"item",
",",
"heap",
"[",
"0",
"]",
"=",
"heap",
"[",
"0",
"]",
",",
"item",
"_siftup",
"(",
"heap",
",",
"0",
")",
"retur... | https://github.com/aws/lumberyard/blob/f85344403c1c2e77ec8c75deb2c116e97b713217/dev/Tools/Python/3.7.10/linux_x64/lib/python3.7/heapq.py#L161-L166 | |
mantidproject/mantid | 03deeb89254ec4289edb8771e0188c2090a02f32 | scripts/CrystalTools/PeakReport.py | python | PeakReport.set_log_scale | (self, log_scale) | Arguments:
log_scale -- True for log scaling | Arguments:
log_scale -- True for log scaling | [
"Arguments",
":",
"log_scale",
"--",
"True",
"for",
"log",
"scaling"
] | def set_log_scale(self, log_scale):
"""
Arguments:
log_scale -- True for log scaling
"""
self.__log_scale = log_scale | [
"def",
"set_log_scale",
"(",
"self",
",",
"log_scale",
")",
":",
"self",
".",
"__log_scale",
"=",
"log_scale"
] | https://github.com/mantidproject/mantid/blob/03deeb89254ec4289edb8771e0188c2090a02f32/scripts/CrystalTools/PeakReport.py#L52-L57 | ||
ApolloAuto/apollo-platform | 86d9dc6743b496ead18d597748ebabd34a513289 | ros/ros_comm/roslaunch/src/roslaunch/xmlloader.py | python | XmlLoader._arg_tag | (self, tag, context, ros_config, verbose=True) | Process an <arg> tag. | Process an <arg> tag. | [
"Process",
"an",
"<arg",
">",
"tag",
"."
] | def _arg_tag(self, tag, context, ros_config, verbose=True):
"""
Process an <arg> tag.
"""
try:
self._check_attrs(tag, context, ros_config, XmlLoader.ARG_ATTRS)
(name,) = self.reqd_attrs(tag, context, ('name',))
value, default, doc = self.opt_attrs(tag,... | [
"def",
"_arg_tag",
"(",
"self",
",",
"tag",
",",
"context",
",",
"ros_config",
",",
"verbose",
"=",
"True",
")",
":",
"try",
":",
"self",
".",
"_check_attrs",
"(",
"tag",
",",
"context",
",",
"ros_config",
",",
"XmlLoader",
".",
"ARG_ATTRS",
")",
"(",
... | https://github.com/ApolloAuto/apollo-platform/blob/86d9dc6743b496ead18d597748ebabd34a513289/ros/ros_comm/roslaunch/src/roslaunch/xmlloader.py#L283-L303 | ||
windystrife/UnrealEngine_NVIDIAGameWorks | b50e6338a7c5b26374d66306ebc7807541ff815e | Engine/Extras/ThirdPartyNotUE/emsdk/Win64/python/2.7.5.3_64bit/Lib/inspect.py | python | isdatadescriptor | (object) | return (hasattr(object, "__set__") and hasattr(object, "__get__")) | Return true if the object is a data descriptor.
Data descriptors have both a __get__ and a __set__ attribute. Examples are
properties (defined in Python) and getsets and members (defined in C).
Typically, data descriptors will also have __name__ and __doc__ attributes
(properties, getsets, and members... | Return true if the object is a data descriptor. | [
"Return",
"true",
"if",
"the",
"object",
"is",
"a",
"data",
"descriptor",
"."
] | def isdatadescriptor(object):
"""Return true if the object is a data descriptor.
Data descriptors have both a __get__ and a __set__ attribute. Examples are
properties (defined in Python) and getsets and members (defined in C).
Typically, data descriptors will also have __name__ and __doc__ attributes
... | [
"def",
"isdatadescriptor",
"(",
"object",
")",
":",
"return",
"(",
"hasattr",
"(",
"object",
",",
"\"__set__\"",
")",
"and",
"hasattr",
"(",
"object",
",",
"\"__get__\"",
")",
")"
] | https://github.com/windystrife/UnrealEngine_NVIDIAGameWorks/blob/b50e6338a7c5b26374d66306ebc7807541ff815e/Engine/Extras/ThirdPartyNotUE/emsdk/Win64/python/2.7.5.3_64bit/Lib/inspect.py#L98-L106 | |
alibaba/AliSQL | 13502c1cde1b82104c2c59f9da6f0a7a460828f4 | libevent/event_rpcgen.py | python | Parse | (file) | return entities | Parses the input file and returns C code and corresponding header file. | Parses the input file and returns C code and corresponding header file. | [
"Parses",
"the",
"input",
"file",
"and",
"returns",
"C",
"code",
"and",
"corresponding",
"header",
"file",
"."
] | def Parse(file):
"""
Parses the input file and returns C code and corresponding header file.
"""
entities = []
while 1:
# Just gets the whole struct nicely formatted
data = GetNextStruct(file)
if not data:
break
entities.extend(ProcessStruct(data))
... | [
"def",
"Parse",
"(",
"file",
")",
":",
"entities",
"=",
"[",
"]",
"while",
"1",
":",
"# Just gets the whole struct nicely formatted",
"data",
"=",
"GetNextStruct",
"(",
"file",
")",
"if",
"not",
"data",
":",
"break",
"entities",
".",
"extend",
"(",
"ProcessS... | https://github.com/alibaba/AliSQL/blob/13502c1cde1b82104c2c59f9da6f0a7a460828f4/libevent/event_rpcgen.py#L1272-L1288 | |
perilouswithadollarsign/cstrike15_src | f82112a2388b841d72cb62ca48ab1846dfcc11c8 | thirdparty/protobuf-2.5.0/python/google/protobuf/internal/cpp_message.py | python | RepeatedCompositeContainer.__eq__ | (self, other) | return messages == other_messages | Compares the current instance with another one. | Compares the current instance with another one. | [
"Compares",
"the",
"current",
"instance",
"with",
"another",
"one",
"."
] | def __eq__(self, other):
"""Compares the current instance with another one."""
if self is other:
return True
if not isinstance(other, self.__class__):
raise TypeError('Can only compare repeated composite fields against '
'other repeated composite fields.')
messages = se... | [
"def",
"__eq__",
"(",
"self",
",",
"other",
")",
":",
"if",
"self",
"is",
"other",
":",
"return",
"True",
"if",
"not",
"isinstance",
"(",
"other",
",",
"self",
".",
"__class__",
")",
":",
"raise",
"TypeError",
"(",
"'Can only compare repeated composite field... | https://github.com/perilouswithadollarsign/cstrike15_src/blob/f82112a2388b841d72cb62ca48ab1846dfcc11c8/thirdparty/protobuf-2.5.0/python/google/protobuf/internal/cpp_message.py#L235-L244 | |
Xilinx/Vitis-AI | fc74d404563d9951b57245443c73bef389f3657f | tools/Vitis-AI-Quantizer/vai_q_tensorflow1.x/tensorflow/contrib/eager/python/examples/revnet/main.py | python | get_datasets | (data_dir, config) | return ds_train, ds_train_one_shot, ds_validation, ds_test | Return dataset. | Return dataset. | [
"Return",
"dataset",
"."
] | def get_datasets(data_dir, config):
"""Return dataset."""
if data_dir is None:
raise ValueError("No supplied data directory")
if not os.path.exists(data_dir):
raise ValueError("Data directory {} does not exist".format(data_dir))
if config.dataset not in ["cifar-10", "cifar-100"]:
raise ValueError("U... | [
"def",
"get_datasets",
"(",
"data_dir",
",",
"config",
")",
":",
"if",
"data_dir",
"is",
"None",
":",
"raise",
"ValueError",
"(",
"\"No supplied data directory\"",
")",
"if",
"not",
"os",
".",
"path",
".",
"exists",
"(",
"data_dir",
")",
":",
"raise",
"Val... | https://github.com/Xilinx/Vitis-AI/blob/fc74d404563d9951b57245443c73bef389f3657f/tools/Vitis-AI-Quantizer/vai_q_tensorflow1.x/tensorflow/contrib/eager/python/examples/revnet/main.py#L130-L202 | |
yun-liu/RCF | 91bfb054ad04187dbbe21e539e165ad9bd3ff00b | tools/extra/extract_seconds.py | python | get_log_created_year | (input_file) | return log_created_year | Get year from log file system timestamp | Get year from log file system timestamp | [
"Get",
"year",
"from",
"log",
"file",
"system",
"timestamp"
] | def get_log_created_year(input_file):
"""Get year from log file system timestamp
"""
log_created_time = os.path.getctime(input_file)
log_created_year = datetime.datetime.fromtimestamp(log_created_time).year
return log_created_year | [
"def",
"get_log_created_year",
"(",
"input_file",
")",
":",
"log_created_time",
"=",
"os",
".",
"path",
".",
"getctime",
"(",
"input_file",
")",
"log_created_year",
"=",
"datetime",
".",
"datetime",
".",
"fromtimestamp",
"(",
"log_created_time",
")",
".",
"year"... | https://github.com/yun-liu/RCF/blob/91bfb054ad04187dbbe21e539e165ad9bd3ff00b/tools/extra/extract_seconds.py#L22-L28 | |
ChromiumWebApps/chromium | c7361d39be8abd1574e6ce8957c8dbddd4c6ccf7 | tools/telemetry/telemetry/core/browser_options.py | python | BrowserOptions.UpdateFromParseResults | (self, finder_options) | Copies our options from finder_options | Copies our options from finder_options | [
"Copies",
"our",
"options",
"from",
"finder_options"
] | def UpdateFromParseResults(self, finder_options):
"""Copies our options from finder_options"""
browser_options_list = [
'extra_browser_args_as_string',
'extra_wpr_args_as_string',
'netsim',
'profile_dir',
'profile_type',
'show_stdout',
'synthetic_gesture_s... | [
"def",
"UpdateFromParseResults",
"(",
"self",
",",
"finder_options",
")",
":",
"browser_options_list",
"=",
"[",
"'extra_browser_args_as_string'",
",",
"'extra_wpr_args_as_string'",
",",
"'netsim'",
",",
"'profile_dir'",
",",
"'profile_type'",
",",
"'show_stdout'",
",",
... | https://github.com/ChromiumWebApps/chromium/blob/c7361d39be8abd1574e6ce8957c8dbddd4c6ccf7/tools/telemetry/telemetry/core/browser_options.py#L286-L333 | ||
google/flatbuffers | b3006913369e0a7550795e477011ac5bebb93497 | python/flatbuffers/table.py | python | Table.Offset | (self, vtableOffset) | return 0 | Offset provides access into the Table's vtable.
Deprecated fields are ignored by checking the vtable's length. | Offset provides access into the Table's vtable. | [
"Offset",
"provides",
"access",
"into",
"the",
"Table",
"s",
"vtable",
"."
] | def Offset(self, vtableOffset):
"""Offset provides access into the Table's vtable.
Deprecated fields are ignored by checking the vtable's length."""
vtable = self.Pos - self.Get(N.SOffsetTFlags, self.Pos)
vtableEnd = self.Get(N.VOffsetTFlags, vtable)
if vtableOffset < vtableEnd... | [
"def",
"Offset",
"(",
"self",
",",
"vtableOffset",
")",
":",
"vtable",
"=",
"self",
".",
"Pos",
"-",
"self",
".",
"Get",
"(",
"N",
".",
"SOffsetTFlags",
",",
"self",
".",
"Pos",
")",
"vtableEnd",
"=",
"self",
".",
"Get",
"(",
"N",
".",
"VOffsetTFla... | https://github.com/google/flatbuffers/blob/b3006913369e0a7550795e477011ac5bebb93497/python/flatbuffers/table.py#L32-L41 | |
luliyucoordinate/Leetcode | 96afcdc54807d1d184e881a075d1dbf3371e31fb | src/0087-Scramble-String/0087.py | python | Solution.isScramble | (self, s1, s2) | return False | :type s1: str
:type s2: str
:rtype: bool | :type s1: str
:type s2: str
:rtype: bool | [
":",
"type",
"s1",
":",
"str",
":",
"type",
"s2",
":",
"str",
":",
"rtype",
":",
"bool"
] | def isScramble(self, s1, s2):
"""
:type s1: str
:type s2: str
:rtype: bool
"""
if len(s1) != len(s2):
return False
if s1 == s2:
return True
l1 = list(s1)
l2 = list(s2)
l1.sort()
l2.sort... | [
"def",
"isScramble",
"(",
"self",
",",
"s1",
",",
"s2",
")",
":",
"if",
"len",
"(",
"s1",
")",
"!=",
"len",
"(",
"s2",
")",
":",
"return",
"False",
"if",
"s1",
"==",
"s2",
":",
"return",
"True",
"l1",
"=",
"list",
"(",
"s1",
")",
"l2",
"=",
... | https://github.com/luliyucoordinate/Leetcode/blob/96afcdc54807d1d184e881a075d1dbf3371e31fb/src/0087-Scramble-String/0087.py#L2-L27 | |
apache/arrow | af33dd1157eb8d7d9bfac25ebf61445b793b7943 | python/pyarrow/jvm.py | python | _from_jvm_float_type | (jvm_type) | Convert a JVM float type to its Python equivalent.
Parameters
----------
jvm_type: org.apache.arrow.vector.types.pojo.ArrowType$FloatingPoint
Returns
-------
typ: pyarrow.DataType | Convert a JVM float type to its Python equivalent. | [
"Convert",
"a",
"JVM",
"float",
"type",
"to",
"its",
"Python",
"equivalent",
"."
] | def _from_jvm_float_type(jvm_type):
"""
Convert a JVM float type to its Python equivalent.
Parameters
----------
jvm_type: org.apache.arrow.vector.types.pojo.ArrowType$FloatingPoint
Returns
-------
typ: pyarrow.DataType
"""
precision = jvm_type.getPrecision().toString()
if ... | [
"def",
"_from_jvm_float_type",
"(",
"jvm_type",
")",
":",
"precision",
"=",
"jvm_type",
".",
"getPrecision",
"(",
")",
".",
"toString",
"(",
")",
"if",
"precision",
"==",
"'HALF'",
":",
"return",
"pa",
".",
"float16",
"(",
")",
"elif",
"precision",
"==",
... | https://github.com/apache/arrow/blob/af33dd1157eb8d7d9bfac25ebf61445b793b7943/python/pyarrow/jvm.py#L106-L124 | ||
epiqc/ScaffCC | 66a79944ee4cd116b27bc1a69137276885461db8 | llvm/bindings/python/llvm/object.py | python | Relocation.expire | (self) | Expire this instance, making future API accesses fail. | Expire this instance, making future API accesses fail. | [
"Expire",
"this",
"instance",
"making",
"future",
"API",
"accesses",
"fail",
"."
] | def expire(self):
"""Expire this instance, making future API accesses fail."""
self.expired = True | [
"def",
"expire",
"(",
"self",
")",
":",
"self",
".",
"expired",
"=",
"True"
] | https://github.com/epiqc/ScaffCC/blob/66a79944ee4cd116b27bc1a69137276885461db8/llvm/bindings/python/llvm/object.py#L413-L415 | ||
microsoft/checkedc-clang | a173fefde5d7877b7750e7ce96dd08cf18baebf2 | compiler-rt/lib/sanitizer_common/scripts/cpplint.py | python | _CppLintState.IncrementErrorCount | (self, category) | Bumps the module's error statistic. | Bumps the module's error statistic. | [
"Bumps",
"the",
"module",
"s",
"error",
"statistic",
"."
] | def IncrementErrorCount(self, category):
"""Bumps the module's error statistic."""
self.error_count += 1
if self.counting in ('toplevel', 'detailed'):
if self.counting != 'detailed':
category = category.split('/')[0]
if category not in self.errors_by_category:
self.errors_by_cate... | [
"def",
"IncrementErrorCount",
"(",
"self",
",",
"category",
")",
":",
"self",
".",
"error_count",
"+=",
"1",
"if",
"self",
".",
"counting",
"in",
"(",
"'toplevel'",
",",
"'detailed'",
")",
":",
"if",
"self",
".",
"counting",
"!=",
"'detailed'",
":",
"cat... | https://github.com/microsoft/checkedc-clang/blob/a173fefde5d7877b7750e7ce96dd08cf18baebf2/compiler-rt/lib/sanitizer_common/scripts/cpplint.py#L943-L951 | ||
LiXizhi/NPLRuntime | a42720e5fe9a6960e0a9ce40bbbcd809192906be | Client/trunk/externals/assimp-4.0.0/port/PyAssimp/scripts/transformations.py | python | quaternion_about_axis | (angle, axis) | return quaternion | Return quaternion for rotation about axis.
>>> q = quaternion_about_axis(0.123, (1, 0, 0))
>>> numpy.allclose(q, [0.06146124, 0, 0, 0.99810947])
True | Return quaternion for rotation about axis. | [
"Return",
"quaternion",
"for",
"rotation",
"about",
"axis",
"."
] | def quaternion_about_axis(angle, axis):
"""Return quaternion for rotation about axis.
>>> q = quaternion_about_axis(0.123, (1, 0, 0))
>>> numpy.allclose(q, [0.06146124, 0, 0, 0.99810947])
True
"""
quaternion = numpy.zeros((4, ), dtype=numpy.float64)
quaternion[:3] = axis[:3]
qlen = vec... | [
"def",
"quaternion_about_axis",
"(",
"angle",
",",
"axis",
")",
":",
"quaternion",
"=",
"numpy",
".",
"zeros",
"(",
"(",
"4",
",",
")",
",",
"dtype",
"=",
"numpy",
".",
"float64",
")",
"quaternion",
"[",
":",
"3",
"]",
"=",
"axis",
"[",
":",
"3",
... | https://github.com/LiXizhi/NPLRuntime/blob/a42720e5fe9a6960e0a9ce40bbbcd809192906be/Client/trunk/externals/assimp-4.0.0/port/PyAssimp/scripts/transformations.py#L1157-L1171 | |
eclipse/sumo | 7132a9b8b6eea734bdec38479026b4d8c4336d03 | tools/traci/main.py | python | init | (port=8813, numRetries=tc.DEFAULT_NUM_RETRIES, host="localhost", label="default", proc=None, doSwitch=True) | return _connections[label].getVersion() | Establish a connection to a TraCI-Server and store it under the given
label. This method is not thread-safe. It accesses the connection
pool concurrently. | Establish a connection to a TraCI-Server and store it under the given
label. This method is not thread-safe. It accesses the connection
pool concurrently. | [
"Establish",
"a",
"connection",
"to",
"a",
"TraCI",
"-",
"Server",
"and",
"store",
"it",
"under",
"the",
"given",
"label",
".",
"This",
"method",
"is",
"not",
"thread",
"-",
"safe",
".",
"It",
"accesses",
"the",
"connection",
"pool",
"concurrently",
"."
] | def init(port=8813, numRetries=tc.DEFAULT_NUM_RETRIES, host="localhost", label="default", proc=None, doSwitch=True):
"""
Establish a connection to a TraCI-Server and store it under the given
label. This method is not thread-safe. It accesses the connection
pool concurrently.
"""
_connections[lab... | [
"def",
"init",
"(",
"port",
"=",
"8813",
",",
"numRetries",
"=",
"tc",
".",
"DEFAULT_NUM_RETRIES",
",",
"host",
"=",
"\"localhost\"",
",",
"label",
"=",
"\"default\"",
",",
"proc",
"=",
"None",
",",
"doSwitch",
"=",
"True",
")",
":",
"_connections",
"[",... | https://github.com/eclipse/sumo/blob/7132a9b8b6eea734bdec38479026b4d8c4336d03/tools/traci/main.py#L131-L140 | |
ApolloAuto/apollo-platform | 86d9dc6743b496ead18d597748ebabd34a513289 | ros/third_party/lib_x86_64/python2.7/dist-packages/rospkg/distro.py | python | DvcsConfig.get_branch | (self, branch, anonymous) | :raises: :exc:`KeyError` Invalid branch parameter | :raises: :exc:`KeyError` Invalid branch parameter | [
":",
"raises",
":",
":",
"exc",
":",
"KeyError",
"Invalid",
"branch",
"parameter"
] | def get_branch(self, branch, anonymous):
"""
:raises: :exc:`KeyError` Invalid branch parameter
"""
if branch == 'release-tar':
return super(DvcsConfig, self).get_branch(branch, anonymous)
elif branch == 'devel':
version_tag = self.dev_branch
... | [
"def",
"get_branch",
"(",
"self",
",",
"branch",
",",
"anonymous",
")",
":",
"if",
"branch",
"==",
"'release-tar'",
":",
"return",
"super",
"(",
"DvcsConfig",
",",
"self",
")",
".",
"get_branch",
"(",
"branch",
",",
"anonymous",
")",
"elif",
"branch",
"=... | https://github.com/ApolloAuto/apollo-platform/blob/86d9dc6743b496ead18d597748ebabd34a513289/ros/third_party/lib_x86_64/python2.7/dist-packages/rospkg/distro.py#L416-L436 | ||
klzgrad/naiveproxy | ed2c513637c77b18721fe428d7ed395b4d284c83 | src/build/win/copy_cdb_to_output.py | python | _CopyCDBToOutput | (output_dir, target_arch) | return 0 | Copies the Windows debugging executable cdb.exe to the output
directory, which is created if it does not exist. The output
directory, and target architecture that should be copied, are
passed. Supported values for the target architecture are the GYP
values "ia32", "x64", "arm64" and the GN values "x86", "x64", ... | Copies the Windows debugging executable cdb.exe to the output
directory, which is created if it does not exist. The output
directory, and target architecture that should be copied, are
passed. Supported values for the target architecture are the GYP
values "ia32", "x64", "arm64" and the GN values "x86", "x64", ... | [
"Copies",
"the",
"Windows",
"debugging",
"executable",
"cdb",
".",
"exe",
"to",
"the",
"output",
"directory",
"which",
"is",
"created",
"if",
"it",
"does",
"not",
"exist",
".",
"The",
"output",
"directory",
"and",
"target",
"architecture",
"that",
"should",
... | def _CopyCDBToOutput(output_dir, target_arch):
"""Copies the Windows debugging executable cdb.exe to the output
directory, which is created if it does not exist. The output
directory, and target architecture that should be copied, are
passed. Supported values for the target architecture are the GYP
values "ia... | [
"def",
"_CopyCDBToOutput",
"(",
"output_dir",
",",
"target_arch",
")",
":",
"_ConditionalMkdir",
"(",
"output_dir",
")",
"vs_toolchain",
".",
"SetEnvironmentAndGetRuntimeDllDirs",
"(",
")",
"# If WINDOWSSDKDIR is not set use the default SDK path. This will be the case",
"# when D... | https://github.com/klzgrad/naiveproxy/blob/ed2c513637c77b18721fe428d7ed395b4d284c83/src/build/win/copy_cdb_to_output.py#L54-L115 | |
aws/lumberyard | f85344403c1c2e77ec8c75deb2c116e97b713217 | dev/Tools/Python/3.7.10/windows/Lib/random.py | python | Random.expovariate | (self, lambd) | return -_log(1.0 - self.random())/lambd | Exponential distribution.
lambd is 1.0 divided by the desired mean. It should be
nonzero. (The parameter would be called "lambda", but that is
a reserved word in Python.) Returned values range from 0 to
positive infinity if lambd is positive, and from negative
infinity to 0 i... | Exponential distribution. | [
"Exponential",
"distribution",
"."
] | def expovariate(self, lambd):
"""Exponential distribution.
lambd is 1.0 divided by the desired mean. It should be
nonzero. (The parameter would be called "lambda", but that is
a reserved word in Python.) Returned values range from 0 to
positive infinity if lambd is positive, ... | [
"def",
"expovariate",
"(",
"self",
",",
"lambd",
")",
":",
"# lambd: rate lambd = 1/mean",
"# ('lambda' is a Python reserved word)",
"# we use 1-random() instead of random() to preclude the",
"# possibility of taking the log of zero.",
"return",
"-",
"_log",
"(",
"1.0",
"-",
"sel... | https://github.com/aws/lumberyard/blob/f85344403c1c2e77ec8c75deb2c116e97b713217/dev/Tools/Python/3.7.10/windows/Lib/random.py#L437-L452 | |
wujian16/Cornell-MOE | df299d1be882d2af9796d7a68b3f9505cac7a53e | moe/optimal_learning/python/base_prior.py | python | TophatPrior.sample_from_prior | (self, n_samples) | return p0[:, np.newaxis] | Returns N samples from the prior.
Parameters
----------
n_samples : int
The number of samples that will be drawn.
Returns
-------
(N, D) np.array
The samples from the prior. | Returns N samples from the prior. | [
"Returns",
"N",
"samples",
"from",
"the",
"prior",
"."
] | def sample_from_prior(self, n_samples):
"""
Returns N samples from the prior.
Parameters
----------
n_samples : int
The number of samples that will be drawn.
Returns
-------
(N, D) np.array
The samples from the prior.
"""
... | [
"def",
"sample_from_prior",
"(",
"self",
",",
"n_samples",
")",
":",
"p0",
"=",
"self",
".",
"min",
"+",
"self",
".",
"rng",
".",
"rand",
"(",
"n_samples",
")",
"*",
"(",
"self",
".",
"max",
"-",
"self",
".",
"min",
")",
"return",
"p0",
"[",
":",... | https://github.com/wujian16/Cornell-MOE/blob/df299d1be882d2af9796d7a68b3f9505cac7a53e/moe/optimal_learning/python/base_prior.py#L125-L141 | |
natanielruiz/android-yolo | 1ebb54f96a67a20ff83ddfc823ed83a13dc3a47f | jni-build/jni/include/tensorflow/python/ops/data_flow_ops.py | python | QueueBase.__init__ | (self, dtypes, shapes, names, queue_ref) | Constructs a queue object from a queue reference.
The two optional lists, `shapes` and `names`, must be of the same length
as `dtypes` if provided. The values at a given index `i` indicate the
shape and name to use for the corresponding queue component in `dtypes`.
Args:
dtypes: A list of type... | Constructs a queue object from a queue reference. | [
"Constructs",
"a",
"queue",
"object",
"from",
"a",
"queue",
"reference",
"."
] | def __init__(self, dtypes, shapes, names, queue_ref):
"""Constructs a queue object from a queue reference.
The two optional lists, `shapes` and `names`, must be of the same length
as `dtypes` if provided. The values at a given index `i` indicate the
shape and name to use for the corresponding queue co... | [
"def",
"__init__",
"(",
"self",
",",
"dtypes",
",",
"shapes",
",",
"names",
",",
"queue_ref",
")",
":",
"self",
".",
"_dtypes",
"=",
"dtypes",
"if",
"shapes",
"is",
"not",
"None",
":",
"if",
"len",
"(",
"shapes",
")",
"!=",
"len",
"(",
"dtypes",
")... | https://github.com/natanielruiz/android-yolo/blob/1ebb54f96a67a20ff83ddfc823ed83a13dc3a47f/jni-build/jni/include/tensorflow/python/ops/data_flow_ops.py#L122-L158 | ||
windystrife/UnrealEngine_NVIDIAGameWorks | b50e6338a7c5b26374d66306ebc7807541ff815e | Engine/Extras/ThirdPartyNotUE/emsdk/Win64/python/2.7.5.3_64bit/Lib/site-packages/winpython/wppm.py | python | Distribution.install | (self, package) | Install package in distribution | Install package in distribution | [
"Install",
"package",
"in",
"distribution"
] | def install(self, package):
"""Install package in distribution"""
assert package.is_compatible_with(self)
tmp_fname = None
self.uninstall_existing(package)
if package.fname.endswith(('.tar.gz', '.zip')):
self._print(package, "Building")
try:
... | [
"def",
"install",
"(",
"self",
",",
"package",
")",
":",
"assert",
"package",
".",
"is_compatible_with",
"(",
"self",
")",
"tmp_fname",
"=",
"None",
"self",
".",
"uninstall_existing",
"(",
"package",
")",
"if",
"package",
".",
"fname",
".",
"endswith",
"("... | https://github.com/windystrife/UnrealEngine_NVIDIAGameWorks/blob/b50e6338a7c5b26374d66306ebc7807541ff815e/Engine/Extras/ThirdPartyNotUE/emsdk/Win64/python/2.7.5.3_64bit/Lib/site-packages/winpython/wppm.py#L317-L346 | ||
wxWidgets/wxPython-Classic | 19571e1ae65f1ac445f5491474121998c97a1bf0 | src/osx_cocoa/_misc.py | python | JoystickEvent.GetJoystick | (*args, **kwargs) | return _misc_.JoystickEvent_GetJoystick(*args, **kwargs) | GetJoystick(self) -> int | GetJoystick(self) -> int | [
"GetJoystick",
"(",
"self",
")",
"-",
">",
"int"
] | def GetJoystick(*args, **kwargs):
"""GetJoystick(self) -> int"""
return _misc_.JoystickEvent_GetJoystick(*args, **kwargs) | [
"def",
"GetJoystick",
"(",
"*",
"args",
",",
"*",
"*",
"kwargs",
")",
":",
"return",
"_misc_",
".",
"JoystickEvent_GetJoystick",
"(",
"*",
"args",
",",
"*",
"*",
"kwargs",
")"
] | https://github.com/wxWidgets/wxPython-Classic/blob/19571e1ae65f1ac445f5491474121998c97a1bf0/src/osx_cocoa/_misc.py#L2358-L2360 | |
hanpfei/chromium-net | 392cc1fa3a8f92f42e4071ab6e674d8e0482f83f | third_party/catapult/third_party/gsutil/third_party/httplib2/upload-diffs.py | python | SubversionVCS._GetInfo | (self, key) | Parses 'svn info' for current dir. Returns value for key or None | Parses 'svn info' for current dir. Returns value for key or None | [
"Parses",
"svn",
"info",
"for",
"current",
"dir",
".",
"Returns",
"value",
"for",
"key",
"or",
"None"
] | def _GetInfo(self, key):
"""Parses 'svn info' for current dir. Returns value for key or None"""
for line in RunShell(["svn", "info"]).splitlines():
if line.startswith(key + ": "):
return line.split(":", 1)[1].strip() | [
"def",
"_GetInfo",
"(",
"self",
",",
"key",
")",
":",
"for",
"line",
"in",
"RunShell",
"(",
"[",
"\"svn\"",
",",
"\"info\"",
"]",
")",
".",
"splitlines",
"(",
")",
":",
"if",
"line",
".",
"startswith",
"(",
"key",
"+",
"\": \"",
")",
":",
"return",... | https://github.com/hanpfei/chromium-net/blob/392cc1fa3a8f92f42e4071ab6e674d8e0482f83f/third_party/catapult/third_party/gsutil/third_party/httplib2/upload-diffs.py#L1009-L1013 | ||
aws/lumberyard | f85344403c1c2e77ec8c75deb2c116e97b713217 | dev/Tools/Python/3.7.10/mac/Python.framework/Versions/3.7/lib/python3.7/asyncio/base_events.py | python | BaseEventLoop.call_later | (self, delay, callback, *args, context=None) | return timer | Arrange for a callback to be called at a given time.
Return a Handle: an opaque object with a cancel() method that
can be used to cancel the call.
The delay can be an int or float, expressed in seconds. It is
always relative to the current time.
Each callback will be called e... | Arrange for a callback to be called at a given time. | [
"Arrange",
"for",
"a",
"callback",
"to",
"be",
"called",
"at",
"a",
"given",
"time",
"."
] | def call_later(self, delay, callback, *args, context=None):
"""Arrange for a callback to be called at a given time.
Return a Handle: an opaque object with a cancel() method that
can be used to cancel the call.
The delay can be an int or float, expressed in seconds. It is
alway... | [
"def",
"call_later",
"(",
"self",
",",
"delay",
",",
"callback",
",",
"*",
"args",
",",
"context",
"=",
"None",
")",
":",
"timer",
"=",
"self",
".",
"call_at",
"(",
"self",
".",
"time",
"(",
")",
"+",
"delay",
",",
"callback",
",",
"*",
"args",
"... | https://github.com/aws/lumberyard/blob/f85344403c1c2e77ec8c75deb2c116e97b713217/dev/Tools/Python/3.7.10/mac/Python.framework/Versions/3.7/lib/python3.7/asyncio/base_events.py#L643-L663 | |
catboost/catboost | 167f64f237114a4d10b2b4ee42adb4569137debe | contrib/python/scikit-learn/py3/sklearn/pipeline.py | python | Pipeline.predict_proba | (self, X) | return self.steps[-1][-1].predict_proba(Xt) | Apply transforms, and predict_proba of the final estimator
Parameters
----------
X : iterable
Data to predict on. Must fulfill input requirements of first step
of the pipeline.
Returns
-------
y_proba : array-like of shape (n_samples, n_classes) | Apply transforms, and predict_proba of the final estimator | [
"Apply",
"transforms",
"and",
"predict_proba",
"of",
"the",
"final",
"estimator"
] | def predict_proba(self, X):
"""Apply transforms, and predict_proba of the final estimator
Parameters
----------
X : iterable
Data to predict on. Must fulfill input requirements of first step
of the pipeline.
Returns
-------
y_proba : arra... | [
"def",
"predict_proba",
"(",
"self",
",",
"X",
")",
":",
"Xt",
"=",
"X",
"for",
"_",
",",
"name",
",",
"transform",
"in",
"self",
".",
"_iter",
"(",
"with_final",
"=",
"False",
")",
":",
"Xt",
"=",
"transform",
".",
"transform",
"(",
"Xt",
")",
"... | https://github.com/catboost/catboost/blob/167f64f237114a4d10b2b4ee42adb4569137debe/contrib/python/scikit-learn/py3/sklearn/pipeline.py#L456-L472 | |
aws/lumberyard | f85344403c1c2e77ec8c75deb2c116e97b713217 | dev/Tools/Python/3.7.10/windows/Lib/plistlib.py | python | _BinaryPlistParser._get_size | (self, tokenL) | return tokenL | return the size of the next object. | return the size of the next object. | [
"return",
"the",
"size",
"of",
"the",
"next",
"object",
"."
] | def _get_size(self, tokenL):
""" return the size of the next object."""
if tokenL == 0xF:
m = self._fp.read(1)[0] & 0x3
s = 1 << m
f = '>' + _BINARY_FORMAT[s]
return struct.unpack(f, self._fp.read(s))[0]
return tokenL | [
"def",
"_get_size",
"(",
"self",
",",
"tokenL",
")",
":",
"if",
"tokenL",
"==",
"0xF",
":",
"m",
"=",
"self",
".",
"_fp",
".",
"read",
"(",
"1",
")",
"[",
"0",
"]",
"&",
"0x3",
"s",
"=",
"1",
"<<",
"m",
"f",
"=",
"'>'",
"+",
"_BINARY_FORMAT",... | https://github.com/aws/lumberyard/blob/f85344403c1c2e77ec8c75deb2c116e97b713217/dev/Tools/Python/3.7.10/windows/Lib/plistlib.py#L574-L582 | |
apache/incubator-mxnet | f03fb23f1d103fec9541b5ae59ee06b1734a51d9 | python/mxnet/symbol/symbol.py | python | Symbol.zeros_like | (self, *args, **kwargs) | return op.zeros_like(self, *args, **kwargs) | Convenience fluent method for :py:func:`zeros_like`.
The arguments are the same as for :py:func:`zeros_like`, with
this array as data. | Convenience fluent method for :py:func:`zeros_like`. | [
"Convenience",
"fluent",
"method",
"for",
":",
"py",
":",
"func",
":",
"zeros_like",
"."
] | def zeros_like(self, *args, **kwargs):
"""Convenience fluent method for :py:func:`zeros_like`.
The arguments are the same as for :py:func:`zeros_like`, with
this array as data.
"""
return op.zeros_like(self, *args, **kwargs) | [
"def",
"zeros_like",
"(",
"self",
",",
"*",
"args",
",",
"*",
"*",
"kwargs",
")",
":",
"return",
"op",
".",
"zeros_like",
"(",
"self",
",",
"*",
"args",
",",
"*",
"*",
"kwargs",
")"
] | https://github.com/apache/incubator-mxnet/blob/f03fb23f1d103fec9541b5ae59ee06b1734a51d9/python/mxnet/symbol/symbol.py#L1973-L1979 | |
rsummers11/CADLab | 976ed959a0b5208bb4173127a7ef732ac73a9b6f | MULAN_universal_lesion_analysis/maskrcnn/data/datasets/DeepLesion.py | python | DeepLesionDataset.loadinfo | (self, path) | load annotations and meta-info from DL_info.csv | load annotations and meta-info from DL_info.csv | [
"load",
"annotations",
"and",
"meta",
"-",
"info",
"from",
"DL_info",
".",
"csv"
] | def loadinfo(self, path):
"""load annotations and meta-info from DL_info.csv"""
info = []
with open(path) as csvfile:
reader = csv.reader(csvfile)
for row in reader:
filename = row[0] # replace the last _ in filename with / or \
idx = file... | [
"def",
"loadinfo",
"(",
"self",
",",
"path",
")",
":",
"info",
"=",
"[",
"]",
"with",
"open",
"(",
"path",
")",
"as",
"csvfile",
":",
"reader",
"=",
"csv",
".",
"reader",
"(",
"csvfile",
")",
"for",
"row",
"in",
"reader",
":",
"filename",
"=",
"r... | https://github.com/rsummers11/CADLab/blob/976ed959a0b5208bb4173127a7ef732ac73a9b6f/MULAN_universal_lesion_analysis/maskrcnn/data/datasets/DeepLesion.py#L241-L275 | ||
ChromiumWebApps/chromium | c7361d39be8abd1574e6ce8957c8dbddd4c6ccf7 | third_party/jinja2/meta.py | python | TrackingCodeGenerator.write | (self, x) | Don't write. | Don't write. | [
"Don",
"t",
"write",
"."
] | def write(self, x):
"""Don't write.""" | [
"def",
"write",
"(",
"self",
",",
"x",
")",
":"
] | https://github.com/ChromiumWebApps/chromium/blob/c7361d39be8abd1574e6ce8957c8dbddd4c6ccf7/third_party/jinja2/meta.py#L25-L26 | ||
Xilinx/Vitis-AI | fc74d404563d9951b57245443c73bef389f3657f | tools/Vitis-AI-Quantizer/vai_q_tensorflow1.x/configure.py | python | create_android_sdk_rule | (environ_cp) | Set Android variables and write Android SDK WORKSPACE rule. | Set Android variables and write Android SDK WORKSPACE rule. | [
"Set",
"Android",
"variables",
"and",
"write",
"Android",
"SDK",
"WORKSPACE",
"rule",
"."
] | def create_android_sdk_rule(environ_cp):
"""Set Android variables and write Android SDK WORKSPACE rule."""
if is_windows() or is_cygwin():
default_sdk_path = cygpath('%s/Android/Sdk' % environ_cp['APPDATA'])
elif is_macos():
default_sdk_path = '%s/library/Android/Sdk' % environ_cp['HOME']
else:
defa... | [
"def",
"create_android_sdk_rule",
"(",
"environ_cp",
")",
":",
"if",
"is_windows",
"(",
")",
"or",
"is_cygwin",
"(",
")",
":",
"default_sdk_path",
"=",
"cygpath",
"(",
"'%s/Android/Sdk'",
"%",
"environ_cp",
"[",
"'APPDATA'",
"]",
")",
"elif",
"is_macos",
"(",
... | https://github.com/Xilinx/Vitis-AI/blob/fc74d404563d9951b57245443c73bef389f3657f/tools/Vitis-AI-Quantizer/vai_q_tensorflow1.x/configure.py#L713-L774 | ||
aws/lumberyard | f85344403c1c2e77ec8c75deb2c116e97b713217 | dev/Tools/Python/3.7.10/linux_x64/lib/python3.7/datetime.py | python | time.dst | (self) | return offset | Return 0 if DST is not in effect, or the DST offset (as timedelta
positive eastward) if DST is in effect.
This is purely informational; the DST offset has already been added to
the UTC offset returned by utcoffset() if applicable, so there's no
need to consult dst() unless you're intere... | Return 0 if DST is not in effect, or the DST offset (as timedelta
positive eastward) if DST is in effect. | [
"Return",
"0",
"if",
"DST",
"is",
"not",
"in",
"effect",
"or",
"the",
"DST",
"offset",
"(",
"as",
"timedelta",
"positive",
"eastward",
")",
"if",
"DST",
"is",
"in",
"effect",
"."
] | def dst(self):
"""Return 0 if DST is not in effect, or the DST offset (as timedelta
positive eastward) if DST is in effect.
This is purely informational; the DST offset has already been added to
the UTC offset returned by utcoffset() if applicable, so there's no
need to consult ... | [
"def",
"dst",
"(",
"self",
")",
":",
"if",
"self",
".",
"_tzinfo",
"is",
"None",
":",
"return",
"None",
"offset",
"=",
"self",
".",
"_tzinfo",
".",
"dst",
"(",
"None",
")",
"_check_utc_offset",
"(",
"\"dst\"",
",",
"offset",
")",
"return",
"offset"
] | https://github.com/aws/lumberyard/blob/f85344403c1c2e77ec8c75deb2c116e97b713217/dev/Tools/Python/3.7.10/linux_x64/lib/python3.7/datetime.py#L1437-L1450 | |
wlanjie/AndroidFFmpeg | 7baf9122f4b8e1c74e7baf4be5c422c7a5ba5aaf | tools/fdk-aac-build/armeabi/toolchain/lib/python2.7/decimal.py | python | Decimal.is_subnormal | (self, context=None) | return self.adjusted() < context.Emin | Return True if self is subnormal; otherwise return False. | Return True if self is subnormal; otherwise return False. | [
"Return",
"True",
"if",
"self",
"is",
"subnormal",
";",
"otherwise",
"return",
"False",
"."
] | def is_subnormal(self, context=None):
"""Return True if self is subnormal; otherwise return False."""
if self._is_special or not self:
return False
if context is None:
context = getcontext()
return self.adjusted() < context.Emin | [
"def",
"is_subnormal",
"(",
"self",
",",
"context",
"=",
"None",
")",
":",
"if",
"self",
".",
"_is_special",
"or",
"not",
"self",
":",
"return",
"False",
"if",
"context",
"is",
"None",
":",
"context",
"=",
"getcontext",
"(",
")",
"return",
"self",
".",... | https://github.com/wlanjie/AndroidFFmpeg/blob/7baf9122f4b8e1c74e7baf4be5c422c7a5ba5aaf/tools/fdk-aac-build/armeabi/toolchain/lib/python2.7/decimal.py#L3051-L3057 | |
zhaoweicai/mscnn | 534bcac5710a579d60827f192035f7eef6d8c585 | scripts/cpp_lint.py | python | CheckForCopyright | (filename, lines, error) | Logs an error if a Copyright message appears at the top of the file. | Logs an error if a Copyright message appears at the top of the file. | [
"Logs",
"an",
"error",
"if",
"a",
"Copyright",
"message",
"appears",
"at",
"the",
"top",
"of",
"the",
"file",
"."
] | def CheckForCopyright(filename, lines, error):
"""Logs an error if a Copyright message appears at the top of the file."""
# We'll check up to line 10. Don't forget there's a
# dummy line at the front.
for line in xrange(1, min(len(lines), 11)):
if _RE_COPYRIGHT.search(lines[line], re.I):
error(filena... | [
"def",
"CheckForCopyright",
"(",
"filename",
",",
"lines",
",",
"error",
")",
":",
"# We'll check up to line 10. Don't forget there's a",
"# dummy line at the front.",
"for",
"line",
"in",
"xrange",
"(",
"1",
",",
"min",
"(",
"len",
"(",
"lines",
")",
",",
"11",
... | https://github.com/zhaoweicai/mscnn/blob/534bcac5710a579d60827f192035f7eef6d8c585/scripts/cpp_lint.py#L1372-L1381 | ||
apple/turicreate | cce55aa5311300e3ce6af93cb45ba791fd1bdf49 | src/external/xgboost/subtree/rabit/tracker/rabit_tracker.py | python | Tracker.get_link_map | (self, nslave) | return tree_map_, parent_map_, ring_map_ | get the link map, this is a bit hacky, call for better algorithm
to place similar nodes together | get the link map, this is a bit hacky, call for better algorithm
to place similar nodes together | [
"get",
"the",
"link",
"map",
"this",
"is",
"a",
"bit",
"hacky",
"call",
"for",
"better",
"algorithm",
"to",
"place",
"similar",
"nodes",
"together"
] | def get_link_map(self, nslave):
"""
get the link map, this is a bit hacky, call for better algorithm
to place similar nodes together
"""
tree_map, parent_map = self.get_tree(nslave)
ring_map = self.get_ring(tree_map, parent_map)
rmap = {0 : 0}
k = 0
... | [
"def",
"get_link_map",
"(",
"self",
",",
"nslave",
")",
":",
"tree_map",
",",
"parent_map",
"=",
"self",
".",
"get_tree",
"(",
"nslave",
")",
"ring_map",
"=",
"self",
".",
"get_ring",
"(",
"tree_map",
",",
"parent_map",
")",
"rmap",
"=",
"{",
"0",
":",... | https://github.com/apple/turicreate/blob/cce55aa5311300e3ce6af93cb45ba791fd1bdf49/src/external/xgboost/subtree/rabit/tracker/rabit_tracker.py#L208-L233 | |
wxWidgets/wxPython-Classic | 19571e1ae65f1ac445f5491474121998c97a1bf0 | src/msw/_controls.py | python | PrePyPickerBase | (*args, **kwargs) | return val | PrePyPickerBase() -> PyPickerBase | PrePyPickerBase() -> PyPickerBase | [
"PrePyPickerBase",
"()",
"-",
">",
"PyPickerBase"
] | def PrePyPickerBase(*args, **kwargs):
"""PrePyPickerBase() -> PyPickerBase"""
val = _controls_.new_PrePyPickerBase(*args, **kwargs)
return val | [
"def",
"PrePyPickerBase",
"(",
"*",
"args",
",",
"*",
"*",
"kwargs",
")",
":",
"val",
"=",
"_controls_",
".",
"new_PrePyPickerBase",
"(",
"*",
"args",
",",
"*",
"*",
"kwargs",
")",
"return",
"val"
] | https://github.com/wxWidgets/wxPython-Classic/blob/19571e1ae65f1ac445f5491474121998c97a1bf0/src/msw/_controls.py#L6905-L6908 | |
eventql/eventql | 7ca0dbb2e683b525620ea30dc40540a22d5eb227 | deps/3rdparty/spidermonkey/mozjs/python/psutil/psutil/_pssunos.py | python | cpu_count_physical | () | return cext.cpu_count_phys() | Return the number of physical CPUs in the system. | Return the number of physical CPUs in the system. | [
"Return",
"the",
"number",
"of",
"physical",
"CPUs",
"in",
"the",
"system",
"."
] | def cpu_count_physical():
"""Return the number of physical CPUs in the system."""
return cext.cpu_count_phys() | [
"def",
"cpu_count_physical",
"(",
")",
":",
"return",
"cext",
".",
"cpu_count_phys",
"(",
")"
] | https://github.com/eventql/eventql/blob/7ca0dbb2e683b525620ea30dc40540a22d5eb227/deps/3rdparty/spidermonkey/mozjs/python/psutil/psutil/_pssunos.py#L149-L151 | |
apple/turicreate | cce55aa5311300e3ce6af93cb45ba791fd1bdf49 | src/external/coremltools_wrap/coremltools/coremltools/converters/keras/_layers.py | python | convert_flatten | (builder, layer, input_names, output_names, keras_layer) | Convert a flatten layer from keras to coreml.
Parameters
keras_layer: layer
----------
A keras layer object.
builder: NeuralNetworkBuilder
A neural network builder object. | Convert a flatten layer from keras to coreml. | [
"Convert",
"a",
"flatten",
"layer",
"from",
"keras",
"to",
"coreml",
"."
] | def convert_flatten(builder, layer, input_names, output_names, keras_layer):
"""Convert a flatten layer from keras to coreml.
Parameters
keras_layer: layer
----------
A keras layer object.
builder: NeuralNetworkBuilder
A neural network builder object.
"""
input_name, output... | [
"def",
"convert_flatten",
"(",
"builder",
",",
"layer",
",",
"input_names",
",",
"output_names",
",",
"keras_layer",
")",
":",
"input_name",
",",
"output_name",
"=",
"(",
"input_names",
"[",
"0",
"]",
",",
"output_names",
"[",
"0",
"]",
")",
"# blob_order ==... | https://github.com/apple/turicreate/blob/cce55aa5311300e3ce6af93cb45ba791fd1bdf49/src/external/coremltools_wrap/coremltools/coremltools/converters/keras/_layers.py#L983-L1007 | ||
aws/lumberyard | f85344403c1c2e77ec8c75deb2c116e97b713217 | dev/Tools/Python/3.7.10/windows/Lib/site-packages/pkg_resources/__init__.py | python | get_default_cache | () | return (
os.environ.get('PYTHON_EGG_CACHE')
or appdirs.user_cache_dir(appname='Python-Eggs')
) | Return the ``PYTHON_EGG_CACHE`` environment variable
or a platform-relevant user cache dir for an app
named "Python-Eggs". | Return the ``PYTHON_EGG_CACHE`` environment variable
or a platform-relevant user cache dir for an app
named "Python-Eggs". | [
"Return",
"the",
"PYTHON_EGG_CACHE",
"environment",
"variable",
"or",
"a",
"platform",
"-",
"relevant",
"user",
"cache",
"dir",
"for",
"an",
"app",
"named",
"Python",
"-",
"Eggs",
"."
] | def get_default_cache():
"""
Return the ``PYTHON_EGG_CACHE`` environment variable
or a platform-relevant user cache dir for an app
named "Python-Eggs".
"""
return (
os.environ.get('PYTHON_EGG_CACHE')
or appdirs.user_cache_dir(appname='Python-Eggs')
) | [
"def",
"get_default_cache",
"(",
")",
":",
"return",
"(",
"os",
".",
"environ",
".",
"get",
"(",
"'PYTHON_EGG_CACHE'",
")",
"or",
"appdirs",
".",
"user_cache_dir",
"(",
"appname",
"=",
"'Python-Eggs'",
")",
")"
] | https://github.com/aws/lumberyard/blob/f85344403c1c2e77ec8c75deb2c116e97b713217/dev/Tools/Python/3.7.10/windows/Lib/site-packages/pkg_resources/__init__.py#L1307-L1316 | |
apple/turicreate | cce55aa5311300e3ce6af93cb45ba791fd1bdf49 | deps/src/libxml2-2.9.1/python/libxml2class.py | python | createInputBuffer | (file, encoding) | return inputBuffer(_obj=ret) | Create a libxml2 input buffer from a Python file | Create a libxml2 input buffer from a Python file | [
"Create",
"a",
"libxml2",
"input",
"buffer",
"from",
"a",
"Python",
"file"
] | def createInputBuffer(file, encoding):
"""Create a libxml2 input buffer from a Python file """
ret = libxml2mod.xmlCreateInputBuffer(file, encoding)
if ret is None:raise treeError('xmlCreateInputBuffer() failed')
return inputBuffer(_obj=ret) | [
"def",
"createInputBuffer",
"(",
"file",
",",
"encoding",
")",
":",
"ret",
"=",
"libxml2mod",
".",
"xmlCreateInputBuffer",
"(",
"file",
",",
"encoding",
")",
"if",
"ret",
"is",
"None",
":",
"raise",
"treeError",
"(",
"'xmlCreateInputBuffer() failed'",
")",
"re... | https://github.com/apple/turicreate/blob/cce55aa5311300e3ce6af93cb45ba791fd1bdf49/deps/src/libxml2-2.9.1/python/libxml2class.py#L771-L775 | |
krishauser/Klampt | 972cc83ea5befac3f653c1ba20f80155768ad519 | Python/python2_version/klampt/model/trajectory.py | python | Trajectory.discretize | (self,dt) | return self.discretize_state(dt) | Returns a trajectory, uniformly discretized at resolution dt, and
with state-space the same as its configuration space. Similar to
discretize, but if the state space is of higher dimension (e.g.,
Hermite trajectories) this projects to a piecewise linear trajectory. | Returns a trajectory, uniformly discretized at resolution dt, and
with state-space the same as its configuration space. Similar to
discretize, but if the state space is of higher dimension (e.g.,
Hermite trajectories) this projects to a piecewise linear trajectory. | [
"Returns",
"a",
"trajectory",
"uniformly",
"discretized",
"at",
"resolution",
"dt",
"and",
"with",
"state",
"-",
"space",
"the",
"same",
"as",
"its",
"configuration",
"space",
".",
"Similar",
"to",
"discretize",
"but",
"if",
"the",
"state",
"space",
"is",
"o... | def discretize(self,dt):
"""Returns a trajectory, uniformly discretized at resolution dt, and
with state-space the same as its configuration space. Similar to
discretize, but if the state space is of higher dimension (e.g.,
Hermite trajectories) this projects to a piecewise linear trajec... | [
"def",
"discretize",
"(",
"self",
",",
"dt",
")",
":",
"return",
"self",
".",
"discretize_state",
"(",
"dt",
")"
] | https://github.com/krishauser/Klampt/blob/972cc83ea5befac3f653c1ba20f80155768ad519/Python/python2_version/klampt/model/trajectory.py#L390-L396 | |
emscripten-core/emscripten | 0d413d3c5af8b28349682496edc14656f5700c2f | third_party/ply/example/ansic/cparse.py | python | p_relational_expression_2 | (t) | relational_expression : relational_expression LT shift_expression | relational_expression : relational_expression LT shift_expression | [
"relational_expression",
":",
"relational_expression",
"LT",
"shift_expression"
] | def p_relational_expression_2(t):
'relational_expression : relational_expression LT shift_expression'
pass | [
"def",
"p_relational_expression_2",
"(",
"t",
")",
":",
"pass"
] | https://github.com/emscripten-core/emscripten/blob/0d413d3c5af8b28349682496edc14656f5700c2f/third_party/ply/example/ansic/cparse.py#L685-L687 | ||
catboost/catboost | 167f64f237114a4d10b2b4ee42adb4569137debe | contrib/python/scikit-learn/py2/sklearn/feature_extraction/image.py | python | img_to_graph | (img, mask=None, return_as=sparse.coo_matrix, dtype=None) | return _to_graph(n_x, n_y, n_z, mask, img, return_as, dtype) | Graph of the pixel-to-pixel gradient connections
Edges are weighted with the gradient values.
Read more in the :ref:`User Guide <image_feature_extraction>`.
Parameters
----------
img : ndarray, 2D or 3D
2D or 3D image
mask : ndarray of booleans, optional
An optional mask of th... | Graph of the pixel-to-pixel gradient connections | [
"Graph",
"of",
"the",
"pixel",
"-",
"to",
"-",
"pixel",
"gradient",
"connections"
] | def img_to_graph(img, mask=None, return_as=sparse.coo_matrix, dtype=None):
"""Graph of the pixel-to-pixel gradient connections
Edges are weighted with the gradient values.
Read more in the :ref:`User Guide <image_feature_extraction>`.
Parameters
----------
img : ndarray, 2D or 3D
2D o... | [
"def",
"img_to_graph",
"(",
"img",
",",
"mask",
"=",
"None",
",",
"return_as",
"=",
"sparse",
".",
"coo_matrix",
",",
"dtype",
"=",
"None",
")",
":",
"img",
"=",
"np",
".",
"atleast_3d",
"(",
"img",
")",
"n_x",
",",
"n_y",
",",
"n_z",
"=",
"img",
... | https://github.com/catboost/catboost/blob/167f64f237114a4d10b2b4ee42adb4569137debe/contrib/python/scikit-learn/py2/sklearn/feature_extraction/image.py#L133-L164 | |
hanpfei/chromium-net | 392cc1fa3a8f92f42e4071ab6e674d8e0482f83f | third_party/catapult/third_party/gsutil/third_party/boto/boto/sqs/queue.py | python | Queue.delete_message_batch | (self, messages) | return self.connection.delete_message_batch(self, messages) | Deletes a list of messages in a single request.
:type messages: List of :class:`boto.sqs.message.Message` objects.
:param messages: A list of message objects. | Deletes a list of messages in a single request. | [
"Deletes",
"a",
"list",
"of",
"messages",
"in",
"a",
"single",
"request",
"."
] | def delete_message_batch(self, messages):
"""
Deletes a list of messages in a single request.
:type messages: List of :class:`boto.sqs.message.Message` objects.
:param messages: A list of message objects.
"""
return self.connection.delete_message_batch(self, messages) | [
"def",
"delete_message_batch",
"(",
"self",
",",
"messages",
")",
":",
"return",
"self",
".",
"connection",
".",
"delete_message_batch",
"(",
"self",
",",
"messages",
")"
] | https://github.com/hanpfei/chromium-net/blob/392cc1fa3a8f92f42e4071ab6e674d8e0482f83f/third_party/catapult/third_party/gsutil/third_party/boto/boto/sqs/queue.py#L316-L323 | |
carla-simulator/carla | 8854804f4d7748e14d937ec763a2912823a7e5f5 | PythonAPI/carla/agents/navigation/behavior_agent.py | python | BehaviorAgent.car_following_manager | (self, vehicle, distance, debug=False) | return control | Module in charge of car-following behaviors when there's
someone in front of us.
:param vehicle: car to follow
:param distance: distance from vehicle
:param debug: boolean for debugging
:return control: carla.VehicleControl | Module in charge of car-following behaviors when there's
someone in front of us. | [
"Module",
"in",
"charge",
"of",
"car",
"-",
"following",
"behaviors",
"when",
"there",
"s",
"someone",
"in",
"front",
"of",
"us",
"."
] | def car_following_manager(self, vehicle, distance, debug=False):
"""
Module in charge of car-following behaviors when there's
someone in front of us.
:param vehicle: car to follow
:param distance: distance from vehicle
:param debug: boolean for debugging
... | [
"def",
"car_following_manager",
"(",
"self",
",",
"vehicle",
",",
"distance",
",",
"debug",
"=",
"False",
")",
":",
"vehicle_speed",
"=",
"get_speed",
"(",
"vehicle",
")",
"delta_v",
"=",
"max",
"(",
"1",
",",
"(",
"self",
".",
"_speed",
"-",
"vehicle_sp... | https://github.com/carla-simulator/carla/blob/8854804f4d7748e14d937ec763a2912823a7e5f5/PythonAPI/carla/agents/navigation/behavior_agent.py#L197-L238 | |
yyzybb537/libgo | 4af17b7c67643c4d54aa354dcc77963ea07847d0 | third_party/boost.context/tools/build/src/build/targets.py | python | AbstractTarget.location | (self) | return self.location_ | Return the location where the target was declared. | Return the location where the target was declared. | [
"Return",
"the",
"location",
"where",
"the",
"target",
"was",
"declared",
"."
] | def location (self):
""" Return the location where the target was declared.
"""
return self.location_ | [
"def",
"location",
"(",
"self",
")",
":",
"return",
"self",
".",
"location_"
] | https://github.com/yyzybb537/libgo/blob/4af17b7c67643c4d54aa354dcc77963ea07847d0/third_party/boost.context/tools/build/src/build/targets.py#L325-L328 | |
aws/lumberyard | f85344403c1c2e77ec8c75deb2c116e97b713217 | dev/Tools/Python/3.7.10/windows/Lib/site-packages/boto3/dynamodb/conditions.py | python | AttributeBase.gte | (self, value) | return GreaterThanEquals(self, value) | Creates a condition where the attribute is greater than or equal to
the value.
:param value: The value that the attribute is greater than or equal to. | Creates a condition where the attribute is greater than or equal to
the value. | [
"Creates",
"a",
"condition",
"where",
"the",
"attribute",
"is",
"greater",
"than",
"or",
"equal",
"to",
"the",
"value",
"."
] | def gte(self, value):
"""Creates a condition where the attribute is greater than or equal to
the value.
:param value: The value that the attribute is greater than or equal to.
"""
return GreaterThanEquals(self, value) | [
"def",
"gte",
"(",
"self",
",",
"value",
")",
":",
"return",
"GreaterThanEquals",
"(",
"self",
",",
"value",
")"
] | https://github.com/aws/lumberyard/blob/f85344403c1c2e77ec8c75deb2c116e97b713217/dev/Tools/Python/3.7.10/windows/Lib/site-packages/boto3/dynamodb/conditions.py#L103-L109 | |
gabyx/ApproxMVBB | 838f3ff7690a938f1e4199a5f41b6feefc32a603 | example/kdTreeFiltering/python/Tools/Transformations/Transformations.py | python | quaternion_from_euler | (ai, aj, ak, axes='sxyz') | return q | Return quaternion from Euler angles and axis sequence.
ai, aj, ak : Euler's roll, pitch and yaw angles
axes : One of 24 axis sequences as string or encoded tuple
>>> q = quaternion_from_euler(1, 2, 3, 'ryxz')
>>> numpy.allclose(q, [0.435953, 0.310622, -0.718287, 0.444435])
True | Return quaternion from Euler angles and axis sequence. | [
"Return",
"quaternion",
"from",
"Euler",
"angles",
"and",
"axis",
"sequence",
"."
] | def quaternion_from_euler(ai, aj, ak, axes='sxyz'):
"""Return quaternion from Euler angles and axis sequence.
ai, aj, ak : Euler's roll, pitch and yaw angles
axes : One of 24 axis sequences as string or encoded tuple
>>> q = quaternion_from_euler(1, 2, 3, 'ryxz')
>>> numpy.allclose(q, [0.435953, 0... | [
"def",
"quaternion_from_euler",
"(",
"ai",
",",
"aj",
",",
"ak",
",",
"axes",
"=",
"'sxyz'",
")",
":",
"try",
":",
"firstaxis",
",",
"parity",
",",
"repetition",
",",
"frame",
"=",
"_AXES2TUPLE",
"[",
"axes",
".",
"lower",
"(",
")",
"]",
"except",
"(... | https://github.com/gabyx/ApproxMVBB/blob/838f3ff7690a938f1e4199a5f41b6feefc32a603/example/kdTreeFiltering/python/Tools/Transformations/Transformations.py#L1176-L1230 | |
wxWidgets/wxPython-Classic | 19571e1ae65f1ac445f5491474121998c97a1bf0 | src/osx_carbon/stc.py | python | StyledTextCtrl.SearchNext | (*args, **kwargs) | return _stc.StyledTextCtrl_SearchNext(*args, **kwargs) | SearchNext(self, int flags, String text) -> int
Find some text starting at the search anchor.
Does not ensure the selection is visible. | SearchNext(self, int flags, String text) -> int | [
"SearchNext",
"(",
"self",
"int",
"flags",
"String",
"text",
")",
"-",
">",
"int"
] | def SearchNext(*args, **kwargs):
"""
SearchNext(self, int flags, String text) -> int
Find some text starting at the search anchor.
Does not ensure the selection is visible.
"""
return _stc.StyledTextCtrl_SearchNext(*args, **kwargs) | [
"def",
"SearchNext",
"(",
"*",
"args",
",",
"*",
"*",
"kwargs",
")",
":",
"return",
"_stc",
".",
"StyledTextCtrl_SearchNext",
"(",
"*",
"args",
",",
"*",
"*",
"kwargs",
")"
] | https://github.com/wxWidgets/wxPython-Classic/blob/19571e1ae65f1ac445f5491474121998c97a1bf0/src/osx_carbon/stc.py#L4929-L4936 | |
wxWidgets/wxPython-Classic | 19571e1ae65f1ac445f5491474121998c97a1bf0 | src/osx_carbon/propgrid.py | python | PropertyGridInterface.EditorValidate | (*args, **kwargs) | return _propgrid.PropertyGridInterface_EditorValidate(*args, **kwargs) | EditorValidate(self) -> bool | EditorValidate(self) -> bool | [
"EditorValidate",
"(",
"self",
")",
"-",
">",
"bool"
] | def EditorValidate(*args, **kwargs):
"""EditorValidate(self) -> bool"""
return _propgrid.PropertyGridInterface_EditorValidate(*args, **kwargs) | [
"def",
"EditorValidate",
"(",
"*",
"args",
",",
"*",
"*",
"kwargs",
")",
":",
"return",
"_propgrid",
".",
"PropertyGridInterface_EditorValidate",
"(",
"*",
"args",
",",
"*",
"*",
"kwargs",
")"
] | https://github.com/wxWidgets/wxPython-Classic/blob/19571e1ae65f1ac445f5491474121998c97a1bf0/src/osx_carbon/propgrid.py#L1143-L1145 | |
MirrorYuChen/ncnn_example | a42608e6e0e51ed68d3bd8ada853595980935220 | ncnn-20210525-full-source/python/ncnn/model_zoo/peleenetssd.py | python | PeleeNet_SSD.__call__ | (self, img) | return objects, resized | #method 2, use ncnn.Mat->numpy.array to get the result, no memory copy too
out = np.array(mat_out)
for i in range(len(out)):
values = out[i]
obj = Detect_Object()
obj.label = values[0]
obj.prob = values[1]
obj.rect.x = values[2] * img_w
... | #method 2, use ncnn.Mat->numpy.array to get the result, no memory copy too
out = np.array(mat_out)
for i in range(len(out)):
values = out[i]
obj = Detect_Object()
obj.label = values[0]
obj.prob = values[1]
obj.rect.x = values[2] * img_w
... | [
"#method",
"2",
"use",
"ncnn",
".",
"Mat",
"-",
">",
"numpy",
".",
"array",
"to",
"get",
"the",
"result",
"no",
"memory",
"copy",
"too",
"out",
"=",
"np",
".",
"array",
"(",
"mat_out",
")",
"for",
"i",
"in",
"range",
"(",
"len",
"(",
"out",
"))",... | def __call__(self, img):
img_h = img.shape[0]
img_w = img.shape[1]
mat_in = ncnn.Mat.from_pixels_resize(
img,
ncnn.Mat.PixelType.PIXEL_BGR,
img.shape[1],
img.shape[0],
self.target_size,
self.target_size,
)
m... | [
"def",
"__call__",
"(",
"self",
",",
"img",
")",
":",
"img_h",
"=",
"img",
".",
"shape",
"[",
"0",
"]",
"img_w",
"=",
"img",
".",
"shape",
"[",
"1",
"]",
"mat_in",
"=",
"ncnn",
".",
"Mat",
".",
"from_pixels_resize",
"(",
"img",
",",
"ncnn",
".",
... | https://github.com/MirrorYuChen/ncnn_example/blob/a42608e6e0e51ed68d3bd8ada853595980935220/ncnn-20210525-full-source/python/ncnn/model_zoo/peleenetssd.py#L55-L114 | |
NicknineTheEagle/TF2-Base | 20459c5a7fbc995b6bf54fa85c2f62a101e9fb64 | src/thirdparty/protobuf-2.3.0/python/google/protobuf/internal/containers.py | python | RepeatedScalarFieldContainer.__eq__ | (self, other) | return other == self._values | Compares the current instance with another one. | Compares the current instance with another one. | [
"Compares",
"the",
"current",
"instance",
"with",
"another",
"one",
"."
] | def __eq__(self, other):
"""Compares the current instance with another one."""
if self is other:
return True
# Special case for the same type which should be common and fast.
if isinstance(other, self.__class__):
return other._values == self._values
# We are presumably comparing against ... | [
"def",
"__eq__",
"(",
"self",
",",
"other",
")",
":",
"if",
"self",
"is",
"other",
":",
"return",
"True",
"# Special case for the same type which should be common and fast.",
"if",
"isinstance",
"(",
"other",
",",
"self",
".",
"__class__",
")",
":",
"return",
"o... | https://github.com/NicknineTheEagle/TF2-Base/blob/20459c5a7fbc995b6bf54fa85c2f62a101e9fb64/src/thirdparty/protobuf-2.3.0/python/google/protobuf/internal/containers.py#L165-L173 | |
aws/lumberyard | f85344403c1c2e77ec8c75deb2c116e97b713217 | dev/Tools/Python/3.7.10/mac/Python.framework/Versions/3.7/lib/python3.7/idlelib/run.py | python | main | (del_exitfunc=False) | Start the Python execution server in a subprocess
In the Python subprocess, RPCServer is instantiated with handlerclass
MyHandler, which inherits register/unregister methods from RPCHandler via
the mix-in class SocketIO.
When the RPCServer 'server' is instantiated, the TCPServer initialization
cre... | Start the Python execution server in a subprocess | [
"Start",
"the",
"Python",
"execution",
"server",
"in",
"a",
"subprocess"
] | def main(del_exitfunc=False):
"""Start the Python execution server in a subprocess
In the Python subprocess, RPCServer is instantiated with handlerclass
MyHandler, which inherits register/unregister methods from RPCHandler via
the mix-in class SocketIO.
When the RPCServer 'server' is instantiated,... | [
"def",
"main",
"(",
"del_exitfunc",
"=",
"False",
")",
":",
"global",
"exit_now",
"global",
"quitting",
"global",
"no_exitfunc",
"no_exitfunc",
"=",
"del_exitfunc",
"#time.sleep(15) # test subprocess not responding",
"try",
":",
"assert",
"(",
"len",
"(",
"sys",
"."... | https://github.com/aws/lumberyard/blob/f85344403c1c2e77ec8c75deb2c116e97b713217/dev/Tools/Python/3.7.10/mac/Python.framework/Versions/3.7/lib/python3.7/idlelib/run.py#L101-L176 | ||
Xilinx/Vitis-AI | fc74d404563d9951b57245443c73bef389f3657f | tools/Vitis-AI-Quantizer/vai_q_tensorflow1.x/tensorflow/tools/docs/doc_generator_visitor.py | python | DocGeneratorVisitor.duplicates | (self) | return self._duplicates | A map from preferred full names to a list of all names for this symbol.
This function returns a map from preferred (master) name for a symbol to a
lexicographically sorted list of all aliases for that name (incl. the master
name). Symbols without duplicate names do not appear in this map.
It is comput... | A map from preferred full names to a list of all names for this symbol. | [
"A",
"map",
"from",
"preferred",
"full",
"names",
"to",
"a",
"list",
"of",
"all",
"names",
"for",
"this",
"symbol",
"."
] | def duplicates(self):
"""A map from preferred full names to a list of all names for this symbol.
This function returns a map from preferred (master) name for a symbol to a
lexicographically sorted list of all aliases for that name (incl. the master
name). Symbols without duplicate names do not appear i... | [
"def",
"duplicates",
"(",
"self",
")",
":",
"self",
".",
"_maybe_find_duplicates",
"(",
")",
"return",
"self",
".",
"_duplicates"
] | https://github.com/Xilinx/Vitis-AI/blob/fc74d404563d9951b57245443c73bef389f3657f/tools/Vitis-AI-Quantizer/vai_q_tensorflow1.x/tensorflow/tools/docs/doc_generator_visitor.py#L106-L120 | |
openvinotoolkit/openvino | dedcbeafa8b84cccdc55ca64b8da516682b381c7 | cmake/developer_package/cpplint/cpplint.py | python | FlagCxx11Features | (filename, clean_lines, linenum, error) | Flag those c++11 features that we only allow in certain places.
Args:
filename: The name of the current file.
clean_lines: A CleansedLines instance containing the file.
linenum: The number of the line to check.
error: The function to call with any errors found. | Flag those c++11 features that we only allow in certain places. | [
"Flag",
"those",
"c",
"++",
"11",
"features",
"that",
"we",
"only",
"allow",
"in",
"certain",
"places",
"."
] | def FlagCxx11Features(filename, clean_lines, linenum, error):
"""Flag those c++11 features that we only allow in certain places.
Args:
filename: The name of the current file.
clean_lines: A CleansedLines instance containing the file.
linenum: The number of the line to check.
error: The function t... | [
"def",
"FlagCxx11Features",
"(",
"filename",
",",
"clean_lines",
",",
"linenum",
",",
"error",
")",
":",
"line",
"=",
"clean_lines",
".",
"elided",
"[",
"linenum",
"]",
"include",
"=",
"Match",
"(",
"r'\\s*#\\s*include\\s+[<\"]([^<\"]+)[\">]'",
",",
"line",
")",... | https://github.com/openvinotoolkit/openvino/blob/dedcbeafa8b84cccdc55ca64b8da516682b381c7/cmake/developer_package/cpplint/cpplint.py#L6110-L6159 | ||
natanielruiz/android-yolo | 1ebb54f96a67a20ff83ddfc823ed83a13dc3a47f | jni-build/jni/include/tensorflow/python/training/saver.py | python | Saver.set_last_checkpoints_with_time | (self, last_checkpoints_with_time) | Sets the list of old checkpoint filenames and timestamps.
Args:
last_checkpoints_with_time: A list of tuples of checkpoint filenames and
timestamps.
Raises:
AssertionError: If last_checkpoints_with_time is not a list. | Sets the list of old checkpoint filenames and timestamps. | [
"Sets",
"the",
"list",
"of",
"old",
"checkpoint",
"filenames",
"and",
"timestamps",
"."
] | def set_last_checkpoints_with_time(self, last_checkpoints_with_time):
"""Sets the list of old checkpoint filenames and timestamps.
Args:
last_checkpoints_with_time: A list of tuples of checkpoint filenames and
timestamps.
Raises:
AssertionError: If last_checkpoints_with_time is not a l... | [
"def",
"set_last_checkpoints_with_time",
"(",
"self",
",",
"last_checkpoints_with_time",
")",
":",
"assert",
"isinstance",
"(",
"last_checkpoints_with_time",
",",
"list",
")",
"self",
".",
"_last_checkpoints",
"=",
"last_checkpoints_with_time"
] | https://github.com/natanielruiz/android-yolo/blob/1ebb54f96a67a20ff83ddfc823ed83a13dc3a47f/jni-build/jni/include/tensorflow/python/training/saver.py#L1000-L1011 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.