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 |
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
kamyu104/LeetCode-Solutions | 77605708a927ea3b85aee5a479db733938c7c211 | Python/maximum-frequency-stack.py | python | FreqStack.pop | (self) | return x | :rtype: int | :rtype: int | [
":",
"rtype",
":",
"int"
] | def pop(self):
"""
:rtype: int
"""
x = self.__group[self.__maxfreq].pop()
if not self.__group[self.__maxfreq]:
self.__group.pop(self.__maxfreq)
self.__maxfreq -= 1
self.__freq[x] -= 1
if not self.__freq[x]:
self.__freq.pop(x)
... | [
"def",
"pop",
"(",
"self",
")",
":",
"x",
"=",
"self",
".",
"__group",
"[",
"self",
".",
"__maxfreq",
"]",
".",
"pop",
"(",
")",
"if",
"not",
"self",
".",
"__group",
"[",
"self",
".",
"__maxfreq",
"]",
":",
"self",
".",
"__group",
".",
"pop",
"... | https://github.com/kamyu104/LeetCode-Solutions/blob/77605708a927ea3b85aee5a479db733938c7c211/Python/maximum-frequency-stack.py#L24-L35 | |
glotzerlab/hoomd-blue | f7f97abfa3fcc2522fa8d458d65d0aeca7ba781a | hoomd/operations.py | python | _triggered_op_conversion | (value) | return (value._cpp_obj, value.trigger) | Convert _TriggeredOperation to a operation, trigger pair.
Necessary since in C++ operations do not own their trigger. | Convert _TriggeredOperation to a operation, trigger pair. | [
"Convert",
"_TriggeredOperation",
"to",
"a",
"operation",
"trigger",
"pair",
"."
] | def _triggered_op_conversion(value):
"""Convert _TriggeredOperation to a operation, trigger pair.
Necessary since in C++ operations do not own their trigger.
"""
return (value._cpp_obj, value.trigger) | [
"def",
"_triggered_op_conversion",
"(",
"value",
")",
":",
"return",
"(",
"value",
".",
"_cpp_obj",
",",
"value",
".",
"trigger",
")"
] | https://github.com/glotzerlab/hoomd-blue/blob/f7f97abfa3fcc2522fa8d458d65d0aeca7ba781a/hoomd/operations.py#L23-L28 | |
tensorflow/tensorflow | 419e3a6b650ea4bd1b0cba23c4348f8a69f3272e | tensorflow/python/autograph/pyct/static_analysis/activity.py | python | Scope.__init__ | (self, parent, isolated=True, function_name=None) | Create a new scope.
Args:
parent: A Scope or None.
isolated: Whether the scope is isolated, that is, whether variables
modified in this scope should be considered modified in the parent
scope.
function_name: Name of the function owning this scope. | Create a new scope. | [
"Create",
"a",
"new",
"scope",
"."
] | def __init__(self, parent, isolated=True, function_name=None):
"""Create a new scope.
Args:
parent: A Scope or None.
isolated: Whether the scope is isolated, that is, whether variables
modified in this scope should be considered modified in the parent
scope.
function_name: Nam... | [
"def",
"__init__",
"(",
"self",
",",
"parent",
",",
"isolated",
"=",
"True",
",",
"function_name",
"=",
"None",
")",
":",
"self",
".",
"parent",
"=",
"parent",
"self",
".",
"isolated",
"=",
"isolated",
"self",
".",
"function_name",
"=",
"function_name",
... | https://github.com/tensorflow/tensorflow/blob/419e3a6b650ea4bd1b0cba23c4348f8a69f3272e/tensorflow/python/autograph/pyct/static_analysis/activity.py#L93-L122 | ||
adobe/chromium | cfe5bf0b51b1f6b9fe239c2a3c2f2364da9967d7 | native_client_sdk/src/build_tools/installer_contents.py | python | GetFilesFromPathList | (path_list) | return ConvertToOSPaths(
[dir for dir in path_list if not dir.endswith('/')]) | Return a list of all the content files.
The paths in the returned list are formatted to be OS-specific, and are
ready to be used in file IO operations.
Args:
path_list: A list of paths that use '/' as the path separator.
Returns:
A list of paths to be included in the SDK installer. The paths all hav... | Return a list of all the content files. | [
"Return",
"a",
"list",
"of",
"all",
"the",
"content",
"files",
"."
] | def GetFilesFromPathList(path_list):
'''Return a list of all the content files.
The paths in the returned list are formatted to be OS-specific, and are
ready to be used in file IO operations.
Args:
path_list: A list of paths that use '/' as the path separator.
Returns:
A list of paths to be include... | [
"def",
"GetFilesFromPathList",
"(",
"path_list",
")",
":",
"return",
"ConvertToOSPaths",
"(",
"[",
"dir",
"for",
"dir",
"in",
"path_list",
"if",
"not",
"dir",
".",
"endswith",
"(",
"'/'",
")",
"]",
")"
] | https://github.com/adobe/chromium/blob/cfe5bf0b51b1f6b9fe239c2a3c2f2364da9967d7/native_client_sdk/src/build_tools/installer_contents.py#L167-L181 | |
llvm/llvm-project | ffa6262cb4e2a335d26416fad39a581b4f98c5f4 | llvm/utils/lit/lit/worker.py | python | initialize | (lit_config, parallelism_semaphores) | Copy data shared by all test executions into worker processes | Copy data shared by all test executions into worker processes | [
"Copy",
"data",
"shared",
"by",
"all",
"test",
"executions",
"into",
"worker",
"processes"
] | def initialize(lit_config, parallelism_semaphores):
"""Copy data shared by all test executions into worker processes"""
global _lit_config
global _parallelism_semaphores
_lit_config = lit_config
_parallelism_semaphores = parallelism_semaphores
# We use the following strategy for dealing with Ct... | [
"def",
"initialize",
"(",
"lit_config",
",",
"parallelism_semaphores",
")",
":",
"global",
"_lit_config",
"global",
"_parallelism_semaphores",
"_lit_config",
"=",
"lit_config",
"_parallelism_semaphores",
"=",
"parallelism_semaphores",
"# We use the following strategy for dealing ... | https://github.com/llvm/llvm-project/blob/ffa6262cb4e2a335d26416fad39a581b4f98c5f4/llvm/utils/lit/lit/worker.py#L22-L32 | ||
catboost/catboost | 167f64f237114a4d10b2b4ee42adb4569137debe | contrib/python/scipy/py3/scipy/signal/signaltools.py | python | filtfilt | (b, a, x, axis=-1, padtype='odd', padlen=None, method='pad',
irlen=None) | return y | Apply a digital filter forward and backward to a signal.
This function applies a linear digital filter twice, once forward and
once backwards. The combined filter has zero phase and a filter order
twice that of the original.
The function provides options for handling the edges of the signal.
Par... | Apply a digital filter forward and backward to a signal. | [
"Apply",
"a",
"digital",
"filter",
"forward",
"and",
"backward",
"to",
"a",
"signal",
"."
] | def filtfilt(b, a, x, axis=-1, padtype='odd', padlen=None, method='pad',
irlen=None):
"""
Apply a digital filter forward and backward to a signal.
This function applies a linear digital filter twice, once forward and
once backwards. The combined filter has zero phase and a filter order
... | [
"def",
"filtfilt",
"(",
"b",
",",
"a",
",",
"x",
",",
"axis",
"=",
"-",
"1",
",",
"padtype",
"=",
"'odd'",
",",
"padlen",
"=",
"None",
",",
"method",
"=",
"'pad'",
",",
"irlen",
"=",
"None",
")",
":",
"b",
"=",
"np",
".",
"atleast_1d",
"(",
"... | https://github.com/catboost/catboost/blob/167f64f237114a4d10b2b4ee42adb4569137debe/contrib/python/scipy/py3/scipy/signal/signaltools.py#L2971-L3165 | |
aws/lumberyard | f85344403c1c2e77ec8c75deb2c116e97b713217 | dev/Tools/Python/3.7.10/mac/Python.framework/Versions/3.7/lib/python3.7/pathlib.py | python | Path.is_char_device | (self) | Whether this path is a character device. | Whether this path is a character device. | [
"Whether",
"this",
"path",
"is",
"a",
"character",
"device",
"."
] | def is_char_device(self):
"""
Whether this path is a character device.
"""
try:
return S_ISCHR(self.stat().st_mode)
except OSError as e:
if not _ignore_error(e):
raise
# Path doesn't exist or is a broken symlink
# (s... | [
"def",
"is_char_device",
"(",
"self",
")",
":",
"try",
":",
"return",
"S_ISCHR",
"(",
"self",
".",
"stat",
"(",
")",
".",
"st_mode",
")",
"except",
"OSError",
"as",
"e",
":",
"if",
"not",
"_ignore_error",
"(",
"e",
")",
":",
"raise",
"# Path doesn't ex... | https://github.com/aws/lumberyard/blob/f85344403c1c2e77ec8c75deb2c116e97b713217/dev/Tools/Python/3.7.10/mac/Python.framework/Versions/3.7/lib/python3.7/pathlib.py#L1441-L1452 | ||
neoml-lib/neoml | a0d370fba05269a1b2258cef126f77bbd2054a3e | NeoML/Python/neoml/Dnn/Crf.py | python | CrfLoss.max_gradient | (self, max_gradient) | Sets the gradient clipping threshold. | Sets the gradient clipping threshold. | [
"Sets",
"the",
"gradient",
"clipping",
"threshold",
"."
] | def max_gradient(self, max_gradient):
"""Sets the gradient clipping threshold.
"""
self._internal.set_max_gradient(float(max_gradient)) | [
"def",
"max_gradient",
"(",
"self",
",",
"max_gradient",
")",
":",
"self",
".",
"_internal",
".",
"set_max_gradient",
"(",
"float",
"(",
"max_gradient",
")",
")"
] | https://github.com/neoml-lib/neoml/blob/a0d370fba05269a1b2258cef126f77bbd2054a3e/NeoML/Python/neoml/Dnn/Crf.py#L281-L284 | ||
LiquidPlayer/LiquidCore | 9405979363f2353ac9a71ad8ab59685dd7f919c9 | deps/node-10.15.3/deps/npm/node_modules/node-gyp/gyp/pylib/gyp/generator/msvs.py | python | _GetOutputFilePathAndTool | (spec, msbuild) | return out_file, vc_tool, msbuild_tool | Returns the path and tool to use for this target.
Figures out the path of the file this spec will create and the name of
the VC tool that will create it.
Arguments:
spec: The target dictionary containing the properties of the target.
Returns:
A triple of (file path, name of the vc tool, name of the ms... | Returns the path and tool to use for this target. | [
"Returns",
"the",
"path",
"and",
"tool",
"to",
"use",
"for",
"this",
"target",
"."
] | def _GetOutputFilePathAndTool(spec, msbuild):
"""Returns the path and tool to use for this target.
Figures out the path of the file this spec will create and the name of
the VC tool that will create it.
Arguments:
spec: The target dictionary containing the properties of the target.
Returns:
A triple... | [
"def",
"_GetOutputFilePathAndTool",
"(",
"spec",
",",
"msbuild",
")",
":",
"# Select a name for the output file.",
"out_file",
"=",
"''",
"vc_tool",
"=",
"''",
"msbuild_tool",
"=",
"''",
"output_file_map",
"=",
"{",
"'executable'",
":",
"(",
"'VCLinkerTool'",
",",
... | https://github.com/LiquidPlayer/LiquidCore/blob/9405979363f2353ac9a71ad8ab59685dd7f919c9/deps/node-10.15.3/deps/npm/node_modules/node-gyp/gyp/pylib/gyp/generator/msvs.py#L1268-L1303 | |
hanpfei/chromium-net | 392cc1fa3a8f92f42e4071ab6e674d8e0482f83f | third_party/protobuf/python/google/protobuf/internal/python_message.py | python | _AddReprMethod | (message_descriptor, cls) | Helper for _AddMessageMethods(). | Helper for _AddMessageMethods(). | [
"Helper",
"for",
"_AddMessageMethods",
"()",
"."
] | def _AddReprMethod(message_descriptor, cls):
"""Helper for _AddMessageMethods()."""
def __repr__(self):
return text_format.MessageToString(self)
cls.__repr__ = __repr__ | [
"def",
"_AddReprMethod",
"(",
"message_descriptor",
",",
"cls",
")",
":",
"def",
"__repr__",
"(",
"self",
")",
":",
"return",
"text_format",
".",
"MessageToString",
"(",
"self",
")",
"cls",
".",
"__repr__",
"=",
"__repr__"
] | https://github.com/hanpfei/chromium-net/blob/392cc1fa3a8f92f42e4071ab6e674d8e0482f83f/third_party/protobuf/python/google/protobuf/internal/python_message.py#L986-L990 | ||
wlanjie/AndroidFFmpeg | 7baf9122f4b8e1c74e7baf4be5c422c7a5ba5aaf | tools/fdk-aac-build/armeabi-v7a/toolchain/lib/python2.7/mailbox.py | python | Maildir.lock | (self) | return | Lock the mailbox. | Lock the mailbox. | [
"Lock",
"the",
"mailbox",
"."
] | def lock(self):
"""Lock the mailbox."""
return | [
"def",
"lock",
"(",
"self",
")",
":",
"return"
] | https://github.com/wlanjie/AndroidFFmpeg/blob/7baf9122f4b8e1c74e7baf4be5c422c7a5ba5aaf/tools/fdk-aac-build/armeabi-v7a/toolchain/lib/python2.7/mailbox.py#L401-L403 | |
hydro-project/anna | 53956c9c7bc5a5e966872d36a45fc8f002480678 | client/python/anna/lattices.py | python | Lattice.reveal | (self) | The reveal method returns an unwrapped version of the data underlying
data structure stored by the lattice. | The reveal method returns an unwrapped version of the data underlying
data structure stored by the lattice. | [
"The",
"reveal",
"method",
"returns",
"an",
"unwrapped",
"version",
"of",
"the",
"data",
"underlying",
"data",
"structure",
"stored",
"by",
"the",
"lattice",
"."
] | def reveal(self):
'''
The reveal method returns an unwrapped version of the data underlying
data structure stored by the lattice.
'''
raise NotImplementedError | [
"def",
"reveal",
"(",
"self",
")",
":",
"raise",
"NotImplementedError"
] | https://github.com/hydro-project/anna/blob/53956c9c7bc5a5e966872d36a45fc8f002480678/client/python/anna/lattices.py#L39-L44 | ||
eric612/MobileNet-YOLO | 69b4441cb3ec8d553fbdef788ad033e246f901bd | scripts/cpp_lint.py | python | _IsTestFilename | (filename) | Determines if the given filename has a suffix that identifies it as a test.
Args:
filename: The input filename.
Returns:
True if 'filename' looks like a test, False otherwise. | Determines if the given filename has a suffix that identifies it as a test. | [
"Determines",
"if",
"the",
"given",
"filename",
"has",
"a",
"suffix",
"that",
"identifies",
"it",
"as",
"a",
"test",
"."
] | def _IsTestFilename(filename):
"""Determines if the given filename has a suffix that identifies it as a test.
Args:
filename: The input filename.
Returns:
True if 'filename' looks like a test, False otherwise.
"""
if (filename.endswith('_test.cc') or
filename.endswith('_unittest.cc') or
... | [
"def",
"_IsTestFilename",
"(",
"filename",
")",
":",
"if",
"(",
"filename",
".",
"endswith",
"(",
"'_test.cc'",
")",
"or",
"filename",
".",
"endswith",
"(",
"'_unittest.cc'",
")",
"or",
"filename",
".",
"endswith",
"(",
"'_regtest.cc'",
")",
")",
":",
"ret... | https://github.com/eric612/MobileNet-YOLO/blob/69b4441cb3ec8d553fbdef788ad033e246f901bd/scripts/cpp_lint.py#L3607-L3621 | ||
scummvm/scummvm | 9c039d027e7ffb9d83ae2e274147e2daf8d57ce2 | backends/platform/symbian/symbian_builder/common_names.py | python | SafeWriteFile | (path, data, mode = 'w') | Save list elements as strings. Save strings as is | Save list elements as strings. Save strings as is | [
"Save",
"list",
"elements",
"as",
"strings",
".",
"Save",
"strings",
"as",
"is"
] | def SafeWriteFile(path, data, mode = 'w'):
"""Save list elements as strings. Save strings as is"""
with open(path, mode) as f:
if type(data) is list:
for s in data:
f.write(s + '\n')
else:
f.write(data) | [
"def",
"SafeWriteFile",
"(",
"path",
",",
"data",
",",
"mode",
"=",
"'w'",
")",
":",
"with",
"open",
"(",
"path",
",",
"mode",
")",
"as",
"f",
":",
"if",
"type",
"(",
"data",
")",
"is",
"list",
":",
"for",
"s",
"in",
"data",
":",
"f",
".",
"w... | https://github.com/scummvm/scummvm/blob/9c039d027e7ffb9d83ae2e274147e2daf8d57ce2/backends/platform/symbian/symbian_builder/common_names.py#L50-L57 | ||
llvm/llvm-project | ffa6262cb4e2a335d26416fad39a581b4f98c5f4 | mlir/python/mlir/dialects/linalg/opdsl/lang/comprehension.py | python | TensorExpression.collect_scalar_uses | (self, uses: Set["ScalarDef"]) | Collects all ScalarDefs reachable through this expression. | Collects all ScalarDefs reachable through this expression. | [
"Collects",
"all",
"ScalarDefs",
"reachable",
"through",
"this",
"expression",
"."
] | def collect_scalar_uses(self, uses: Set["ScalarDef"]):
"""Collects all ScalarDefs reachable through this expression."""
def visit_scalar_def(expr):
if isinstance(expr, ScalarDef):
uses.add(expr)
self.visit_tensor_exprs(visit_scalar_def) | [
"def",
"collect_scalar_uses",
"(",
"self",
",",
"uses",
":",
"Set",
"[",
"\"ScalarDef\"",
"]",
")",
":",
"def",
"visit_scalar_def",
"(",
"expr",
")",
":",
"if",
"isinstance",
"(",
"expr",
",",
"ScalarDef",
")",
":",
"uses",
".",
"add",
"(",
"expr",
")"... | https://github.com/llvm/llvm-project/blob/ffa6262cb4e2a335d26416fad39a581b4f98c5f4/mlir/python/mlir/dialects/linalg/opdsl/lang/comprehension.py#L70-L77 | ||
google/earthenterprise | 0fe84e29be470cd857e3a0e52e5d0afd5bb8cee9 | earth_enterprise/src/server/wsgi/serve/basic_types.py | python | SnippetSet.DumpJson | (self) | return json.dumps(self, cls=SnippetSetJsonEncoder) | Dumps object to json string. | Dumps object to json string. | [
"Dumps",
"object",
"to",
"json",
"string",
"."
] | def DumpJson(self):
"""Dumps object to json string."""
return json.dumps(self, cls=SnippetSetJsonEncoder) | [
"def",
"DumpJson",
"(",
"self",
")",
":",
"return",
"json",
".",
"dumps",
"(",
"self",
",",
"cls",
"=",
"SnippetSetJsonEncoder",
")"
] | https://github.com/google/earthenterprise/blob/0fe84e29be470cd857e3a0e52e5d0afd5bb8cee9/earth_enterprise/src/server/wsgi/serve/basic_types.py#L283-L285 | |
PaddlePaddle/PaddleOCR | b756bf5f8c90142e0d89d3db0163965c686b6ffe | ppocr/data/imaug/sast_process.py | python | SASTProcessTrain.quad_area | (self, poly) | return np.sum(edge) / 2. | compute area of a polygon
:param poly:
:return: | compute area of a polygon
:param poly:
:return: | [
"compute",
"area",
"of",
"a",
"polygon",
":",
"param",
"poly",
":",
":",
"return",
":"
] | def quad_area(self, poly):
"""
compute area of a polygon
:param poly:
:return:
"""
edge = [(poly[1][0] - poly[0][0]) * (poly[1][1] + poly[0][1]),
(poly[2][0] - poly[1][0]) * (poly[2][1] + poly[1][1]),
(poly[3][0] - poly[2][0]) * (poly[3][1]... | [
"def",
"quad_area",
"(",
"self",
",",
"poly",
")",
":",
"edge",
"=",
"[",
"(",
"poly",
"[",
"1",
"]",
"[",
"0",
"]",
"-",
"poly",
"[",
"0",
"]",
"[",
"0",
"]",
")",
"*",
"(",
"poly",
"[",
"1",
"]",
"[",
"1",
"]",
"+",
"poly",
"[",
"0",
... | https://github.com/PaddlePaddle/PaddleOCR/blob/b756bf5f8c90142e0d89d3db0163965c686b6ffe/ppocr/data/imaug/sast_process.py#L42-L52 | |
mantidproject/mantid | 03deeb89254ec4289edb8771e0188c2090a02f32 | qt/python/mantidqtinterfaces/mantidqtinterfaces/HFIR_4Circle_Reduction/hfctables.py | python | PeakIntegrationTableWidget.set_q | (self, row_index, vec_q) | return | Set Q to rows
:param row_index:
:param vec_q: a list or array with size 3
:return: | Set Q to rows
:param row_index:
:param vec_q: a list or array with size 3
:return: | [
"Set",
"Q",
"to",
"rows",
":",
"param",
"row_index",
":",
":",
"param",
"vec_q",
":",
"a",
"list",
"or",
"array",
"with",
"size",
"3",
":",
"return",
":"
] | def set_q(self, row_index, vec_q):
"""
Set Q to rows
:param row_index:
:param vec_q: a list or array with size 3
:return:
"""
assert len(vec_q) == 3
# locate
index_q_x = self.Table_Setup.index(('Q_x', 'float'))
for j in range(3):
... | [
"def",
"set_q",
"(",
"self",
",",
"row_index",
",",
"vec_q",
")",
":",
"assert",
"len",
"(",
"vec_q",
")",
"==",
"3",
"# locate",
"index_q_x",
"=",
"self",
".",
"Table_Setup",
".",
"index",
"(",
"(",
"'Q_x'",
",",
"'float'",
")",
")",
"for",
"j",
"... | https://github.com/mantidproject/mantid/blob/03deeb89254ec4289edb8771e0188c2090a02f32/qt/python/mantidqtinterfaces/mantidqtinterfaces/HFIR_4Circle_Reduction/hfctables.py#L434-L450 | |
baidu-research/tensorflow-allreduce | 66d5b855e90b0949e9fa5cca5599fd729a70e874 | tensorflow/contrib/learn/python/learn/estimators/head.py | python | _centered_bias | (logits_dimension, head_name=None) | return centered_bias | Returns centered_bias `Variable`.
Args:
logits_dimension: Last dimension of `logits`. Must be >= 1.
head_name: Optional name of the head.
Returns:
`Variable` with shape `[logits_dimension]`.
Raises:
ValueError: if `logits_dimension` is invalid. | Returns centered_bias `Variable`. | [
"Returns",
"centered_bias",
"Variable",
"."
] | def _centered_bias(logits_dimension, head_name=None):
"""Returns centered_bias `Variable`.
Args:
logits_dimension: Last dimension of `logits`. Must be >= 1.
head_name: Optional name of the head.
Returns:
`Variable` with shape `[logits_dimension]`.
Raises:
ValueError: if `logits_dimension` is ... | [
"def",
"_centered_bias",
"(",
"logits_dimension",
",",
"head_name",
"=",
"None",
")",
":",
"if",
"(",
"logits_dimension",
"is",
"None",
")",
"or",
"(",
"logits_dimension",
"<",
"1",
")",
":",
"raise",
"ValueError",
"(",
"\"Invalid logits_dimension %s.\"",
"%",
... | https://github.com/baidu-research/tensorflow-allreduce/blob/66d5b855e90b0949e9fa5cca5599fd729a70e874/tensorflow/contrib/learn/python/learn/estimators/head.py#L1847-L1875 | |
catboost/catboost | 167f64f237114a4d10b2b4ee42adb4569137debe | contrib/python/Pygments/py3/pygments/lexers/rebol.py | python | RebolLexer.analyse_text | (text) | Check if code contains REBOL header and so it probably not R code | Check if code contains REBOL header and so it probably not R code | [
"Check",
"if",
"code",
"contains",
"REBOL",
"header",
"and",
"so",
"it",
"probably",
"not",
"R",
"code"
] | def analyse_text(text):
"""
Check if code contains REBOL header and so it probably not R code
"""
if re.match(r'^\s*REBOL\s*\[', text, re.IGNORECASE):
# The code starts with REBOL header
return 1.0
elif re.search(r'\s*REBOL\s*\[', text, re.IGNORECASE):
... | [
"def",
"analyse_text",
"(",
"text",
")",
":",
"if",
"re",
".",
"match",
"(",
"r'^\\s*REBOL\\s*\\['",
",",
"text",
",",
"re",
".",
"IGNORECASE",
")",
":",
"# The code starts with REBOL header",
"return",
"1.0",
"elif",
"re",
".",
"search",
"(",
"r'\\s*REBOL\\s*... | https://github.com/catboost/catboost/blob/167f64f237114a4d10b2b4ee42adb4569137debe/contrib/python/Pygments/py3/pygments/lexers/rebol.py#L234-L243 | ||
facebook/fbthrift | fb9c8562aba04c4fd9b17716eb5d970cc88a75bb | thrift/lib/py/util/Decorators.py | python | process_method | (argtype, oneway=False, asyncio=False) | return _decorator | Decorator for process_xxx methods. | Decorator for process_xxx methods. | [
"Decorator",
"for",
"process_xxx",
"methods",
"."
] | def process_method(argtype, oneway=False, asyncio=False):
"""Decorator for process_xxx methods."""
def _decorator(func):
def nested(self, seqid, iprot, oprot, server_ctx):
_mem_before = _process_method_mem_usage()
fn_name = get_function_name(func)
# self is a TProcess... | [
"def",
"process_method",
"(",
"argtype",
",",
"oneway",
"=",
"False",
",",
"asyncio",
"=",
"False",
")",
":",
"def",
"_decorator",
"(",
"func",
")",
":",
"def",
"nested",
"(",
"self",
",",
"seqid",
",",
"iprot",
",",
"oprot",
",",
"server_ctx",
")",
... | https://github.com/facebook/fbthrift/blob/fb9c8562aba04c4fd9b17716eb5d970cc88a75bb/thrift/lib/py/util/Decorators.py#L138-L184 | |
wxWidgets/wxPython-Classic | 19571e1ae65f1ac445f5491474121998c97a1bf0 | src/gtk/richtext.py | python | RichTextBuffer.Init | (*args, **kwargs) | return _richtext.RichTextBuffer_Init(*args, **kwargs) | Init(self) | Init(self) | [
"Init",
"(",
"self",
")"
] | def Init(*args, **kwargs):
"""Init(self)"""
return _richtext.RichTextBuffer_Init(*args, **kwargs) | [
"def",
"Init",
"(",
"*",
"args",
",",
"*",
"*",
"kwargs",
")",
":",
"return",
"_richtext",
".",
"RichTextBuffer_Init",
"(",
"*",
"args",
",",
"*",
"*",
"kwargs",
")"
] | https://github.com/wxWidgets/wxPython-Classic/blob/19571e1ae65f1ac445f5491474121998c97a1bf0/src/gtk/richtext.py#L2237-L2239 | |
manutdzou/KITTI_SSD | 5b620c2f291d36a0fe14489214f22a992f173f44 | scripts/cpp_lint.py | python | _NestingState.InNamespaceBody | (self) | return self.stack and isinstance(self.stack[-1], _NamespaceInfo) | Check if we are currently one level inside a namespace body.
Returns:
True if top of the stack is a namespace block, False otherwise. | Check if we are currently one level inside a namespace body. | [
"Check",
"if",
"we",
"are",
"currently",
"one",
"level",
"inside",
"a",
"namespace",
"body",
"."
] | def InNamespaceBody(self):
"""Check if we are currently one level inside a namespace body.
Returns:
True if top of the stack is a namespace block, False otherwise.
"""
return self.stack and isinstance(self.stack[-1], _NamespaceInfo) | [
"def",
"InNamespaceBody",
"(",
"self",
")",
":",
"return",
"self",
".",
"stack",
"and",
"isinstance",
"(",
"self",
".",
"stack",
"[",
"-",
"1",
"]",
",",
"_NamespaceInfo",
")"
] | https://github.com/manutdzou/KITTI_SSD/blob/5b620c2f291d36a0fe14489214f22a992f173f44/scripts/cpp_lint.py#L1944-L1950 | |
priyankchheda/algorithms | c361aa9071573fa9966d5b02d05e524815abcf2b | linked_list/library/linked_list.py | python | LinkedList.delete_tail | (self) | return current.get_data() | removes last linked list node and returns data. raise exception,
if linkedlist is empty | removes last linked list node and returns data. raise exception,
if linkedlist is empty | [
"removes",
"last",
"linked",
"list",
"node",
"and",
"returns",
"data",
".",
"raise",
"exception",
"if",
"linkedlist",
"is",
"empty"
] | def delete_tail(self):
""" removes last linked list node and returns data. raise exception,
if linkedlist is empty
"""
if self.head is None:
raise IndexError("linkedlist is empty")
current = self.head
if current.get_next() is None:
self.head = ... | [
"def",
"delete_tail",
"(",
"self",
")",
":",
"if",
"self",
".",
"head",
"is",
"None",
":",
"raise",
"IndexError",
"(",
"\"linkedlist is empty\"",
")",
"current",
"=",
"self",
".",
"head",
"if",
"current",
".",
"get_next",
"(",
")",
"is",
"None",
":",
"... | https://github.com/priyankchheda/algorithms/blob/c361aa9071573fa9966d5b02d05e524815abcf2b/linked_list/library/linked_list.py#L112-L127 | |
benoitsteiner/tensorflow-opencl | cb7cb40a57fde5cfd4731bc551e82a1e2fef43a5 | tensorflow/python/framework/errors_impl.py | python | UnauthenticatedError.__init__ | (self, node_def, op, message) | Creates an `UnauthenticatedError`. | Creates an `UnauthenticatedError`. | [
"Creates",
"an",
"UnauthenticatedError",
"."
] | def __init__(self, node_def, op, message):
"""Creates an `UnauthenticatedError`."""
super(UnauthenticatedError, self).__init__(node_def, op, message,
UNAUTHENTICATED) | [
"def",
"__init__",
"(",
"self",
",",
"node_def",
",",
"op",
",",
"message",
")",
":",
"super",
"(",
"UnauthenticatedError",
",",
"self",
")",
".",
"__init__",
"(",
"node_def",
",",
"op",
",",
"message",
",",
"UNAUTHENTICATED",
")"
] | https://github.com/benoitsteiner/tensorflow-opencl/blob/cb7cb40a57fde5cfd4731bc551e82a1e2fef43a5/tensorflow/python/framework/errors_impl.py#L284-L287 | ||
natanielruiz/android-yolo | 1ebb54f96a67a20ff83ddfc823ed83a13dc3a47f | jni-build/jni/include/tensorflow/python/ops/array_ops.py | python | _BatchMatrixDiagShape | (op) | return [diag_shape.concatenate(diag_shape[-1])] | Shape function for array_ops.batch_matrix_diag. | Shape function for array_ops.batch_matrix_diag. | [
"Shape",
"function",
"for",
"array_ops",
".",
"batch_matrix_diag",
"."
] | def _BatchMatrixDiagShape(op):
"""Shape function for array_ops.batch_matrix_diag."""
diag_shape = op.inputs[0].get_shape().with_rank_at_least(1)
return [diag_shape.concatenate(diag_shape[-1])] | [
"def",
"_BatchMatrixDiagShape",
"(",
"op",
")",
":",
"diag_shape",
"=",
"op",
".",
"inputs",
"[",
"0",
"]",
".",
"get_shape",
"(",
")",
".",
"with_rank_at_least",
"(",
"1",
")",
"return",
"[",
"diag_shape",
".",
"concatenate",
"(",
"diag_shape",
"[",
"-"... | https://github.com/natanielruiz/android-yolo/blob/1ebb54f96a67a20ff83ddfc823ed83a13dc3a47f/jni-build/jni/include/tensorflow/python/ops/array_ops.py#L1656-L1659 | |
aws/lumberyard | f85344403c1c2e77ec8c75deb2c116e97b713217 | dev/Gems/CloudGemDefectReporter/v1/AWS/common-code/Lib/jira/client.py | python | JIRA.issue_types | (self) | return issue_types | Get a list of issue type Resources from the server. | Get a list of issue type Resources from the server. | [
"Get",
"a",
"list",
"of",
"issue",
"type",
"Resources",
"from",
"the",
"server",
"."
] | def issue_types(self):
"""Get a list of issue type Resources from the server."""
r_json = self._get_json('issuetype')
issue_types = [IssueType(
self._options, self._session, raw_type_json) for raw_type_json in r_json]
return issue_types | [
"def",
"issue_types",
"(",
"self",
")",
":",
"r_json",
"=",
"self",
".",
"_get_json",
"(",
"'issuetype'",
")",
"issue_types",
"=",
"[",
"IssueType",
"(",
"self",
".",
"_options",
",",
"self",
".",
"_session",
",",
"raw_type_json",
")",
"for",
"raw_type_jso... | https://github.com/aws/lumberyard/blob/f85344403c1c2e77ec8c75deb2c116e97b713217/dev/Gems/CloudGemDefectReporter/v1/AWS/common-code/Lib/jira/client.py#L1768-L1773 | |
scribusproject/scribus | 41ec7c775a060912cf251682a8b1437f753f80f4 | codegen/cheetah/Cheetah/Templates/_SkeletonPage.py | python | _SkeletonPage.javascriptTags | (self) | return ''.join(javascriptTagsTxt) | Return a formatted version of the javascriptTags and
javascriptLibs dictionaries. Each value in javascriptTags
should be a either a code string to include, or a list containing the
JavaScript version number and the code string. The keys can be anything.
The same applies for javascriptLi... | Return a formatted version of the javascriptTags and
javascriptLibs dictionaries. Each value in javascriptTags
should be a either a code string to include, or a list containing the
JavaScript version number and the code string. The keys can be anything.
The same applies for javascriptLi... | [
"Return",
"a",
"formatted",
"version",
"of",
"the",
"javascriptTags",
"and",
"javascriptLibs",
"dictionaries",
".",
"Each",
"value",
"in",
"javascriptTags",
"should",
"be",
"a",
"either",
"a",
"code",
"string",
"to",
"include",
"or",
"a",
"list",
"containing",
... | def javascriptTags(self):
"""Return a formatted version of the javascriptTags and
javascriptLibs dictionaries. Each value in javascriptTags
should be a either a code string to include, or a list containing the
JavaScript version number and the code string. The keys can be anything.
... | [
"def",
"javascriptTags",
"(",
"self",
")",
":",
"javascriptTagsTxt",
"=",
"[",
"]",
"for",
"key",
",",
"details",
"in",
"self",
".",
"_javascriptTags",
".",
"iteritems",
"(",
")",
":",
"if",
"not",
"isinstance",
"(",
"details",
",",
"(",
"list",
",",
"... | https://github.com/scribusproject/scribus/blob/41ec7c775a060912cf251682a8b1437f753f80f4/codegen/cheetah/Cheetah/Templates/_SkeletonPage.py#L109-L134 | |
FreeCAD/FreeCAD | ba42231b9c6889b89e064d6d563448ed81e376ec | src/Mod/Draft/draftguitools/gui_planeproxy.py | python | Draft_WorkingPlaneProxy.Activated | (self) | Execute when the command is called. | Execute when the command is called. | [
"Execute",
"when",
"the",
"command",
"is",
"called",
"."
] | def Activated(self):
"""Execute when the command is called."""
if hasattr(App, "DraftWorkingPlane"):
App.ActiveDocument.openTransaction("Create WP proxy")
Gui.addModule("Draft")
_cmd = "Draft.makeWorkingPlaneProxy("
_cmd += "FreeCAD.DraftWorkingPlane.getPl... | [
"def",
"Activated",
"(",
"self",
")",
":",
"if",
"hasattr",
"(",
"App",
",",
"\"DraftWorkingPlane\"",
")",
":",
"App",
".",
"ActiveDocument",
".",
"openTransaction",
"(",
"\"Create WP proxy\"",
")",
"Gui",
".",
"addModule",
"(",
"\"Draft\"",
")",
"_cmd",
"="... | https://github.com/FreeCAD/FreeCAD/blob/ba42231b9c6889b89e064d6d563448ed81e376ec/src/Mod/Draft/draftguitools/gui_planeproxy.py#L61-L71 | ||
wxWidgets/wxPython-Classic | 19571e1ae65f1ac445f5491474121998c97a1bf0 | src/msw/richtext.py | python | RichTextBuffer.SetScale | (*args, **kwargs) | return _richtext.RichTextBuffer_SetScale(*args, **kwargs) | SetScale(self, double scale) | SetScale(self, double scale) | [
"SetScale",
"(",
"self",
"double",
"scale",
")"
] | def SetScale(*args, **kwargs):
"""SetScale(self, double scale)"""
return _richtext.RichTextBuffer_SetScale(*args, **kwargs) | [
"def",
"SetScale",
"(",
"*",
"args",
",",
"*",
"*",
"kwargs",
")",
":",
"return",
"_richtext",
".",
"RichTextBuffer_SetScale",
"(",
"*",
"args",
",",
"*",
"*",
"kwargs",
")"
] | https://github.com/wxWidgets/wxPython-Classic/blob/19571e1ae65f1ac445f5491474121998c97a1bf0/src/msw/richtext.py#L2639-L2641 | |
natanielruiz/android-yolo | 1ebb54f96a67a20ff83ddfc823ed83a13dc3a47f | jni-build/jni/include/tensorflow/contrib/lookup/lookup_ops.py | python | KeyValueTensorInitializer.__init__ | (self, keys, values, key_dtype=None, value_dtype=None, name=None) | Constructs a table initializer object based on keys and values tensors.
Args:
keys: The tensor for the keys.
values: The tensor for the values.
key_dtype: The `keys` data type. Used when `keys` is a python array.
value_dtype: The `values` data type. Used when `values` is a python array.
... | Constructs a table initializer object based on keys and values tensors. | [
"Constructs",
"a",
"table",
"initializer",
"object",
"based",
"on",
"keys",
"and",
"values",
"tensors",
"."
] | def __init__(self, keys, values, key_dtype=None, value_dtype=None, name=None):
"""Constructs a table initializer object based on keys and values tensors.
Args:
keys: The tensor for the keys.
values: The tensor for the values.
key_dtype: The `keys` data type. Used when `keys` is a python array... | [
"def",
"__init__",
"(",
"self",
",",
"keys",
",",
"values",
",",
"key_dtype",
"=",
"None",
",",
"value_dtype",
"=",
"None",
",",
"name",
"=",
"None",
")",
":",
"with",
"ops",
".",
"op_scope",
"(",
"[",
"keys",
",",
"values",
"]",
",",
"name",
",",
... | https://github.com/natanielruiz/android-yolo/blob/1ebb54f96a67a20ff83ddfc823ed83a13dc3a47f/jni-build/jni/include/tensorflow/contrib/lookup/lookup_ops.py#L264-L282 | ||
wxWidgets/wxPython-Classic | 19571e1ae65f1ac445f5491474121998c97a1bf0 | src/osx_cocoa/_controls.py | python | TreeCtrl.GetItemText | (*args, **kwargs) | return _controls_.TreeCtrl_GetItemText(*args, **kwargs) | GetItemText(self, TreeItemId item) -> String | GetItemText(self, TreeItemId item) -> String | [
"GetItemText",
"(",
"self",
"TreeItemId",
"item",
")",
"-",
">",
"String"
] | def GetItemText(*args, **kwargs):
"""GetItemText(self, TreeItemId item) -> String"""
return _controls_.TreeCtrl_GetItemText(*args, **kwargs) | [
"def",
"GetItemText",
"(",
"*",
"args",
",",
"*",
"*",
"kwargs",
")",
":",
"return",
"_controls_",
".",
"TreeCtrl_GetItemText",
"(",
"*",
"args",
",",
"*",
"*",
"kwargs",
")"
] | https://github.com/wxWidgets/wxPython-Classic/blob/19571e1ae65f1ac445f5491474121998c97a1bf0/src/osx_cocoa/_controls.py#L5253-L5255 | |
infinit/elle | a8154593c42743f45b9df09daf62b44630c24a02 | drake/src/drake/go/__init__.py | python | Toolkit.run | (self, cmd, host = False) | return subprocess.check_output([self.go] + cmd,
env = env).decode('utf-8').strip() | Run the given command in the toolkit environment.
:param cmd: Same as __run.
:type cmd: Same as __run.
:return: Same as __run
:rtype: Same as __run | Run the given command in the toolkit environment. | [
"Run",
"the",
"given",
"command",
"in",
"the",
"toolkit",
"environment",
"."
] | def run(self, cmd, host = False):
"""
Run the given command in the toolkit environment.
:param cmd: Same as __run.
:type cmd: Same as __run.
:return: Same as __run
:rtype: Same as __run
"""
env = self.host_env if host else self.env
return subprocess.check_output([self.go] + cmd,
... | [
"def",
"run",
"(",
"self",
",",
"cmd",
",",
"host",
"=",
"False",
")",
":",
"env",
"=",
"self",
".",
"host_env",
"if",
"host",
"else",
"self",
".",
"env",
"return",
"subprocess",
".",
"check_output",
"(",
"[",
"self",
".",
"go",
"]",
"+",
"cmd",
... | https://github.com/infinit/elle/blob/a8154593c42743f45b9df09daf62b44630c24a02/drake/src/drake/go/__init__.py#L282-L294 | |
wxWidgets/wxPython-Classic | 19571e1ae65f1ac445f5491474121998c97a1bf0 | wx/tools/Editra/src/updater.py | python | UpdateProgress.Abort | (self) | Overides the UpdateService abort function
@postcondition: any download actions in the L{UpdateService} are aborted | Overides the UpdateService abort function
@postcondition: any download actions in the L{UpdateService} are aborted | [
"Overides",
"the",
"UpdateService",
"abort",
"function",
"@postcondition",
":",
"any",
"download",
"actions",
"in",
"the",
"L",
"{",
"UpdateService",
"}",
"are",
"aborted"
] | def Abort(self):
"""Overides the UpdateService abort function
@postcondition: any download actions in the L{UpdateService} are aborted
"""
self.LOG("[updater][info] UpdateProgress: Download aborted")
UpdateService.Abort(self)
if self._timer.IsRunning():
self.... | [
"def",
"Abort",
"(",
"self",
")",
":",
"self",
".",
"LOG",
"(",
"\"[updater][info] UpdateProgress: Download aborted\"",
")",
"UpdateService",
".",
"Abort",
"(",
"self",
")",
"if",
"self",
".",
"_timer",
".",
"IsRunning",
"(",
")",
":",
"self",
".",
"_timer",... | https://github.com/wxWidgets/wxPython-Classic/blob/19571e1ae65f1ac445f5491474121998c97a1bf0/wx/tools/Editra/src/updater.py#L316-L325 | ||
ChromiumWebApps/chromium | c7361d39be8abd1574e6ce8957c8dbddd4c6ccf7 | build/android/pylib/android_commands.py | python | AndroidCommands.RunUIAutomatorTest | (self, test, test_package, timeout) | return test_results[0] | Runs a single uiautomator test.
Args:
test: Test class/method.
test_package: Name of the test jar.
timeout: Timeout time in seconds.
Returns:
An instance of am_instrument_parser.TestResult object. | Runs a single uiautomator test. | [
"Runs",
"a",
"single",
"uiautomator",
"test",
"."
] | def RunUIAutomatorTest(self, test, test_package, timeout):
"""Runs a single uiautomator test.
Args:
test: Test class/method.
test_package: Name of the test jar.
timeout: Timeout time in seconds.
Returns:
An instance of am_instrument_parser.TestResult object.
"""
cmd = 'uiau... | [
"def",
"RunUIAutomatorTest",
"(",
"self",
",",
"test",
",",
"test_package",
",",
"timeout",
")",
":",
"cmd",
"=",
"'uiautomator runtest %s -e class %s'",
"%",
"(",
"test_package",
",",
"test",
")",
"self",
".",
"_LogShell",
"(",
"cmd",
")",
"output",
"=",
"s... | https://github.com/ChromiumWebApps/chromium/blob/c7361d39be8abd1574e6ce8957c8dbddd4c6ccf7/build/android/pylib/android_commands.py#L1725-L1746 | |
redpony/cdec | f7c4899b174d86bc70b40b1cae68dcad364615cb | python/cdec/configobj.py | python | Section.restore_default | (self, key) | return default | Restore (and return) default value for the specified key.
This method will only work for a ConfigObj that was created
with a configspec and has been validated.
If there is no default value for this key, ``KeyError`` is raised. | Restore (and return) default value for the specified key.
This method will only work for a ConfigObj that was created
with a configspec and has been validated.
If there is no default value for this key, ``KeyError`` is raised. | [
"Restore",
"(",
"and",
"return",
")",
"default",
"value",
"for",
"the",
"specified",
"key",
".",
"This",
"method",
"will",
"only",
"work",
"for",
"a",
"ConfigObj",
"that",
"was",
"created",
"with",
"a",
"configspec",
"and",
"has",
"been",
"validated",
".",... | def restore_default(self, key):
"""
Restore (and return) default value for the specified key.
This method will only work for a ConfigObj that was created
with a configspec and has been validated.
If there is no default value for this key, ``KeyError`` is raised.... | [
"def",
"restore_default",
"(",
"self",
",",
"key",
")",
":",
"default",
"=",
"self",
".",
"default_values",
"[",
"key",
"]",
"dict",
".",
"__setitem__",
"(",
"self",
",",
"key",
",",
"default",
")",
"if",
"key",
"not",
"in",
"self",
".",
"defaults",
... | https://github.com/redpony/cdec/blob/f7c4899b174d86bc70b40b1cae68dcad364615cb/python/cdec/configobj.py#L1051-L1064 | |
fluffos/fluffos | bf54d5d4acef4de49dbed7d184849a7b7b354156 | src/thirdparty/widecharwidth/generate.py | python | merged_codepoints | (cps) | return ranges | return a list of codepoints (start, end) for inclusive ranges | return a list of codepoints (start, end) for inclusive ranges | [
"return",
"a",
"list",
"of",
"codepoints",
"(",
"start",
"end",
")",
"for",
"inclusive",
"ranges"
] | def merged_codepoints(cps):
""" return a list of codepoints (start, end) for inclusive ranges """
if not cps:
return []
cps = sorted(cps, key=lambda cp: cp.codepoint)
ranges = [(cps[0], cps[0])]
for cp in cps[1:]:
last_range = ranges[-1]
if cp.codepoint == last_range[1].codep... | [
"def",
"merged_codepoints",
"(",
"cps",
")",
":",
"if",
"not",
"cps",
":",
"return",
"[",
"]",
"cps",
"=",
"sorted",
"(",
"cps",
",",
"key",
"=",
"lambda",
"cp",
":",
"cp",
".",
"codepoint",
")",
"ranges",
"=",
"[",
"(",
"cps",
"[",
"0",
"]",
"... | https://github.com/fluffos/fluffos/blob/bf54d5d4acef4de49dbed7d184849a7b7b354156/src/thirdparty/widecharwidth/generate.py#L340-L352 | |
benoitsteiner/tensorflow-opencl | cb7cb40a57fde5cfd4731bc551e82a1e2fef43a5 | tensorflow/contrib/seq2seq/python/ops/helper.py | python | SampleEmbeddingHelper.sample | (self, time, outputs, state, name=None) | return sample_ids | sample for SampleEmbeddingHelper. | sample for SampleEmbeddingHelper. | [
"sample",
"for",
"SampleEmbeddingHelper",
"."
] | def sample(self, time, outputs, state, name=None):
"""sample for SampleEmbeddingHelper."""
del time, state # unused by sample_fn
# Outputs are logits, we sample instead of argmax (greedy).
if not isinstance(outputs, ops.Tensor):
raise TypeError("Expected outputs to be a single Tensor, got: %s" %
... | [
"def",
"sample",
"(",
"self",
",",
"time",
",",
"outputs",
",",
"state",
",",
"name",
"=",
"None",
")",
":",
"del",
"time",
",",
"state",
"# unused by sample_fn",
"# Outputs are logits, we sample instead of argmax (greedy).",
"if",
"not",
"isinstance",
"(",
"outpu... | https://github.com/benoitsteiner/tensorflow-opencl/blob/cb7cb40a57fde5cfd4731bc551e82a1e2fef43a5/tensorflow/contrib/seq2seq/python/ops/helper.py#L593-L608 | |
psi4/psi4 | be533f7f426b6ccc263904e55122899b16663395 | psi4/driver/qcdb/subsetgenerator.py | python | genset_HBn5min | (dbinstance) | return ssA.intersection(ssB) | HB-5min
near-equilibrium systems also in hb | HB-5min
near-equilibrium systems also in hb | [
"HB",
"-",
"5min",
"near",
"-",
"equilibrium",
"systems",
"also",
"in",
"hb"
] | def genset_HBn5min(dbinstance):
"""HB-5min
near-equilibrium systems also in hb
"""
try:
ssA = set(dbinstance.sset['hb'].keys())
except KeyError:
ssA = set()
try:
ssB = set(dbinstance.sset['5min'].keys())
except KeyError:
ssB = set()
return ssA.intersectio... | [
"def",
"genset_HBn5min",
"(",
"dbinstance",
")",
":",
"try",
":",
"ssA",
"=",
"set",
"(",
"dbinstance",
".",
"sset",
"[",
"'hb'",
"]",
".",
"keys",
"(",
")",
")",
"except",
"KeyError",
":",
"ssA",
"=",
"set",
"(",
")",
"try",
":",
"ssB",
"=",
"se... | https://github.com/psi4/psi4/blob/be533f7f426b6ccc263904e55122899b16663395/psi4/driver/qcdb/subsetgenerator.py#L55-L68 | |
aws/lumberyard | f85344403c1c2e77ec8c75deb2c116e97b713217 | dev/Tools/Python/3.7.10/windows/Lib/traceback.py | python | print_exc | (limit=None, file=None, chain=True) | Shorthand for 'print_exception(*sys.exc_info(), limit, file)'. | Shorthand for 'print_exception(*sys.exc_info(), limit, file)'. | [
"Shorthand",
"for",
"print_exception",
"(",
"*",
"sys",
".",
"exc_info",
"()",
"limit",
"file",
")",
"."
] | def print_exc(limit=None, file=None, chain=True):
"""Shorthand for 'print_exception(*sys.exc_info(), limit, file)'."""
print_exception(*sys.exc_info(), limit=limit, file=file, chain=chain) | [
"def",
"print_exc",
"(",
"limit",
"=",
"None",
",",
"file",
"=",
"None",
",",
"chain",
"=",
"True",
")",
":",
"print_exception",
"(",
"*",
"sys",
".",
"exc_info",
"(",
")",
",",
"limit",
"=",
"limit",
",",
"file",
"=",
"file",
",",
"chain",
"=",
... | https://github.com/aws/lumberyard/blob/f85344403c1c2e77ec8c75deb2c116e97b713217/dev/Tools/Python/3.7.10/windows/Lib/traceback.py#L161-L163 | ||
CRYTEK/CRYENGINE | 232227c59a220cbbd311576f0fbeba7bb53b2a8c | Code/Tools/waf-1.7.13/waflib/Configure.py | python | check_waf_version | (self, mini='1.6.99', maxi='1.8.0') | Raise a Configuration error if the Waf version does not strictly match the given bounds::
conf.check_waf_version(mini='1.7.0', maxi='1.8.0')
:type mini: number, tuple or string
:param mini: Minimum required version
:type maxi: number, tuple or string
:param maxi: Maximum allowed version | Raise a Configuration error if the Waf version does not strictly match the given bounds:: | [
"Raise",
"a",
"Configuration",
"error",
"if",
"the",
"Waf",
"version",
"does",
"not",
"strictly",
"match",
"the",
"given",
"bounds",
"::"
] | def check_waf_version(self, mini='1.6.99', maxi='1.8.0'):
"""
Raise a Configuration error if the Waf version does not strictly match the given bounds::
conf.check_waf_version(mini='1.7.0', maxi='1.8.0')
:type mini: number, tuple or string
:param mini: Minimum required version
:type maxi: number, tuple or str... | [
"def",
"check_waf_version",
"(",
"self",
",",
"mini",
"=",
"'1.6.99'",
",",
"maxi",
"=",
"'1.8.0'",
")",
":",
"self",
".",
"start_msg",
"(",
"'Checking for waf version in %s-%s'",
"%",
"(",
"str",
"(",
"mini",
")",
",",
"str",
"(",
"maxi",
")",
")",
")",... | https://github.com/CRYTEK/CRYENGINE/blob/232227c59a220cbbd311576f0fbeba7bb53b2a8c/Code/Tools/waf-1.7.13/waflib/Configure.py#L454-L472 | ||
eric612/Caffe-YOLOv3-Windows | 6736ca6e16781789b828cc64218ff77cc3454e5d | scripts/cpp_lint.py | python | _FunctionState.Begin | (self, function_name) | Start analyzing function body.
Args:
function_name: The name of the function being tracked. | Start analyzing function body. | [
"Start",
"analyzing",
"function",
"body",
"."
] | def Begin(self, function_name):
"""Start analyzing function body.
Args:
function_name: The name of the function being tracked.
"""
self.in_a_function = True
self.lines_in_function = 0
self.current_function = function_name | [
"def",
"Begin",
"(",
"self",
",",
"function_name",
")",
":",
"self",
".",
"in_a_function",
"=",
"True",
"self",
".",
"lines_in_function",
"=",
"0",
"self",
".",
"current_function",
"=",
"function_name"
] | https://github.com/eric612/Caffe-YOLOv3-Windows/blob/6736ca6e16781789b828cc64218ff77cc3454e5d/scripts/cpp_lint.py#L825-L833 | ||
hughperkins/tf-coriander | 970d3df6c11400ad68405f22b0c42a52374e94ca | tensorflow/python/ops/array_grad.py | python | _SliceGrad | (op, grad) | return array_ops.pad(grad, paddings), None, None | Gradient for Slice op. | Gradient for Slice op. | [
"Gradient",
"for",
"Slice",
"op",
"."
] | def _SliceGrad(op, grad):
"""Gradient for Slice op."""
# Create an Nx2 padding where the first column represents how many
# zeros are to be prepended for each dimension, and the second
# column indicates how many zeros are appended.
#
# The number of zeros to append is the shape of the input
# elementwise... | [
"def",
"_SliceGrad",
"(",
"op",
",",
"grad",
")",
":",
"# Create an Nx2 padding where the first column represents how many",
"# zeros are to be prepended for each dimension, and the second",
"# column indicates how many zeros are appended.",
"#",
"# The number of zeros to append is the shape... | https://github.com/hughperkins/tf-coriander/blob/970d3df6c11400ad68405f22b0c42a52374e94ca/tensorflow/python/ops/array_grad.py#L149-L170 | |
freesurfer/freesurfer | 6dbe527d43ffa611acb2cd112e9469f9bfec8e36 | cnn_sphere_register/ext/pynd-lib/pynd/ndutils.py | python | bw2sdtrf | (bwvol) | return posdst * notbwvol - negdst * bwvol | computes the signed distance transform from the surface between the
binary True/False elements of logical bwvol
Note: the distance transform on either side of the surface will be +1/-1
- i.e. there are no voxels for which the dst should be 0.
Runtime: currently the function uses bwdist twice. If there... | computes the signed distance transform from the surface between the
binary True/False elements of logical bwvol | [
"computes",
"the",
"signed",
"distance",
"transform",
"from",
"the",
"surface",
"between",
"the",
"binary",
"True",
"/",
"False",
"elements",
"of",
"logical",
"bwvol"
] | def bw2sdtrf(bwvol):
"""
computes the signed distance transform from the surface between the
binary True/False elements of logical bwvol
Note: the distance transform on either side of the surface will be +1/-1
- i.e. there are no voxels for which the dst should be 0.
Runtime: currently the fun... | [
"def",
"bw2sdtrf",
"(",
"bwvol",
")",
":",
"# get the positive transform (outside the positive island)",
"posdst",
"=",
"bwdist",
"(",
"bwvol",
")",
"# get the negative transform (distance inside the island)",
"notbwvol",
"=",
"np",
".",
"logical_not",
"(",
"bwvol",
")",
... | https://github.com/freesurfer/freesurfer/blob/6dbe527d43ffa611acb2cd112e9469f9bfec8e36/cnn_sphere_register/ext/pynd-lib/pynd/ndutils.py#L71-L105 | |
idaholab/moose | 9eeebc65e098b4c30f8205fb41591fd5b61eb6ff | python/MooseDocs/base/components.py | python | Component.setExtension | (self, extension) | Attach the extension the component, this is done by the Translator. | Attach the extension the component, this is done by the Translator. | [
"Attach",
"the",
"extension",
"the",
"component",
"this",
"is",
"done",
"by",
"the",
"Translator",
"."
] | def setExtension(self, extension):
"""
Attach the extension the component, this is done by the Translator.
"""
self.__extension = extension | [
"def",
"setExtension",
"(",
"self",
",",
"extension",
")",
":",
"self",
".",
"__extension",
"=",
"extension"
] | https://github.com/idaholab/moose/blob/9eeebc65e098b4c30f8205fb41591fd5b61eb6ff/python/MooseDocs/base/components.py#L32-L36 | ||
aws/lumberyard | f85344403c1c2e77ec8c75deb2c116e97b713217 | dev/Tools/Python/3.7.10/linux_x64/lib/python3.7/site-packages/botocore/handlers.py | python | copy_source_sse_md5 | (params, **kwargs) | S3 server-side encryption requires the encryption key to be sent to the
server base64 encoded, as well as a base64-encoded MD5 hash of the
encryption key. This handler does both if the MD5 has not been set by
the caller specifically if the parameter is for the copy-source sse-c key. | S3 server-side encryption requires the encryption key to be sent to the
server base64 encoded, as well as a base64-encoded MD5 hash of the
encryption key. This handler does both if the MD5 has not been set by
the caller specifically if the parameter is for the copy-source sse-c key. | [
"S3",
"server",
"-",
"side",
"encryption",
"requires",
"the",
"encryption",
"key",
"to",
"be",
"sent",
"to",
"the",
"server",
"base64",
"encoded",
"as",
"well",
"as",
"a",
"base64",
"-",
"encoded",
"MD5",
"hash",
"of",
"the",
"encryption",
"key",
".",
"T... | def copy_source_sse_md5(params, **kwargs):
"""
S3 server-side encryption requires the encryption key to be sent to the
server base64 encoded, as well as a base64-encoded MD5 hash of the
encryption key. This handler does both if the MD5 has not been set by
the caller specifically if the parameter is ... | [
"def",
"copy_source_sse_md5",
"(",
"params",
",",
"*",
"*",
"kwargs",
")",
":",
"_sse_md5",
"(",
"params",
",",
"'CopySourceSSECustomer'",
")"
] | https://github.com/aws/lumberyard/blob/f85344403c1c2e77ec8c75deb2c116e97b713217/dev/Tools/Python/3.7.10/linux_x64/lib/python3.7/site-packages/botocore/handlers.py#L241-L248 | ||
ApolloAuto/apollo | 463fb82f9e979d02dcb25044e60931293ab2dba0 | cyber/python/cyber_py3/cyber.py | python | Node.register_message | (self, file_desc) | register proto message desc file. | register proto message desc file. | [
"register",
"proto",
"message",
"desc",
"file",
"."
] | def register_message(self, file_desc):
"""
register proto message desc file.
"""
for dep in file_desc.dependencies:
self.register_message(dep)
proto = FileDescriptorProto()
file_desc.CopyToProto(proto)
proto.name = file_desc.name
desc_str = pro... | [
"def",
"register_message",
"(",
"self",
",",
"file_desc",
")",
":",
"for",
"dep",
"in",
"file_desc",
".",
"dependencies",
":",
"self",
".",
"register_message",
"(",
"dep",
")",
"proto",
"=",
"FileDescriptorProto",
"(",
")",
"file_desc",
".",
"CopyToProto",
"... | https://github.com/ApolloAuto/apollo/blob/463fb82f9e979d02dcb25044e60931293ab2dba0/cyber/python/cyber_py3/cyber.py#L184-L194 | ||
wlanjie/AndroidFFmpeg | 7baf9122f4b8e1c74e7baf4be5c422c7a5ba5aaf | tools/fdk-aac-build/x86/toolchain/lib/python2.7/plat-mac/lib-scriptpackages/StdSuites/AppleScript_Suite.py | python | AppleScript_Suite_Events.stop_log | (self, _no_object=None, _attributes={}, **_arguments) | stop log: Stop event logging in the script editor
Keyword argument _attributes: AppleEvent attribute dictionary | stop log: Stop event logging in the script editor
Keyword argument _attributes: AppleEvent attribute dictionary | [
"stop",
"log",
":",
"Stop",
"event",
"logging",
"in",
"the",
"script",
"editor",
"Keyword",
"argument",
"_attributes",
":",
"AppleEvent",
"attribute",
"dictionary"
] | def stop_log(self, _no_object=None, _attributes={}, **_arguments):
"""stop log: Stop event logging in the script editor
Keyword argument _attributes: AppleEvent attribute dictionary
"""
_code = 'ToyS'
_subcode = 'log0'
if _arguments: raise TypeError, 'No optional args ex... | [
"def",
"stop_log",
"(",
"self",
",",
"_no_object",
"=",
"None",
",",
"_attributes",
"=",
"{",
"}",
",",
"*",
"*",
"_arguments",
")",
":",
"_code",
"=",
"'ToyS'",
"_subcode",
"=",
"'log0'",
"if",
"_arguments",
":",
"raise",
"TypeError",
",",
"'No optional... | https://github.com/wlanjie/AndroidFFmpeg/blob/7baf9122f4b8e1c74e7baf4be5c422c7a5ba5aaf/tools/fdk-aac-build/x86/toolchain/lib/python2.7/plat-mac/lib-scriptpackages/StdSuites/AppleScript_Suite.py#L620-L637 | ||
wxWidgets/wxPython-Classic | 19571e1ae65f1ac445f5491474121998c97a1bf0 | src/osx_carbon/_gdi.py | python | ImageList.AddIcon | (*args, **kwargs) | return _gdi_.ImageList_AddIcon(*args, **kwargs) | AddIcon(self, Icon icon) -> int | AddIcon(self, Icon icon) -> int | [
"AddIcon",
"(",
"self",
"Icon",
"icon",
")",
"-",
">",
"int"
] | def AddIcon(*args, **kwargs):
"""AddIcon(self, Icon icon) -> int"""
return _gdi_.ImageList_AddIcon(*args, **kwargs) | [
"def",
"AddIcon",
"(",
"*",
"args",
",",
"*",
"*",
"kwargs",
")",
":",
"return",
"_gdi_",
".",
"ImageList_AddIcon",
"(",
"*",
"args",
",",
"*",
"*",
"kwargs",
")"
] | https://github.com/wxWidgets/wxPython-Classic/blob/19571e1ae65f1ac445f5491474121998c97a1bf0/src/osx_carbon/_gdi.py#L6764-L6766 | |
wlanjie/AndroidFFmpeg | 7baf9122f4b8e1c74e7baf4be5c422c7a5ba5aaf | tools/fdk-aac-build/x86/toolchain/share/gdb/python/gdb/prompt.py | python | _prompt_noprint_end | (attr) | return '\002' | Ends a sequence of non-printing characters. | Ends a sequence of non-printing characters. | [
"Ends",
"a",
"sequence",
"of",
"non",
"-",
"printing",
"characters",
"."
] | def _prompt_noprint_end(attr):
"Ends a sequence of non-printing characters."
return '\002' | [
"def",
"_prompt_noprint_end",
"(",
"attr",
")",
":",
"return",
"'\\002'"
] | https://github.com/wlanjie/AndroidFFmpeg/blob/7baf9122f4b8e1c74e7baf4be5c422c7a5ba5aaf/tools/fdk-aac-build/x86/toolchain/share/gdb/python/gdb/prompt.py#L78-L80 | |
SoarGroup/Soar | a1c5e249499137a27da60533c72969eef3b8ab6b | scons/scons-local-4.1.0/SCons/Tool/msgfmt.py | python | generate | (env,**kw) | Generate `msgfmt` tool | Generate `msgfmt` tool | [
"Generate",
"msgfmt",
"tool"
] | def generate(env,**kw):
""" Generate `msgfmt` tool """
import sys
import os
import SCons.Util
import SCons.Tool
from SCons.Tool.GettextCommon import _detect_msgfmt
from SCons.Platform.mingw import MINGW_DEFAULT_PATHS
from SCons.Platform.cygwin import CYGWIN_DEFAULT_PATHS
if sys.platform == 'win32':
... | [
"def",
"generate",
"(",
"env",
",",
"*",
"*",
"kw",
")",
":",
"import",
"sys",
"import",
"os",
"import",
"SCons",
".",
"Util",
"import",
"SCons",
".",
"Tool",
"from",
"SCons",
".",
"Tool",
".",
"GettextCommon",
"import",
"_detect_msgfmt",
"from",
"SCons"... | https://github.com/SoarGroup/Soar/blob/a1c5e249499137a27da60533c72969eef3b8ab6b/scons/scons-local-4.1.0/SCons/Tool/msgfmt.py#L76-L105 | ||
ricardoquesada/Spidermonkey | 4a75ea2543408bd1b2c515aa95901523eeef7858 | xpcom/typelib/xpt/tools/xpt.py | python | Typelib._sanityCheck | (self) | Check certain assumptions about data contained in this typelib.
Sort the interfaces array by IID, check that all interfaces
referenced by methods exist in the array. | Check certain assumptions about data contained in this typelib.
Sort the interfaces array by IID, check that all interfaces
referenced by methods exist in the array. | [
"Check",
"certain",
"assumptions",
"about",
"data",
"contained",
"in",
"this",
"typelib",
".",
"Sort",
"the",
"interfaces",
"array",
"by",
"IID",
"check",
"that",
"all",
"interfaces",
"referenced",
"by",
"methods",
"exist",
"in",
"the",
"array",
"."
] | def _sanityCheck(self):
"""
Check certain assumptions about data contained in this typelib.
Sort the interfaces array by IID, check that all interfaces
referenced by methods exist in the array.
"""
self.interfaces.sort()
for i in self.interfaces:
if i... | [
"def",
"_sanityCheck",
"(",
"self",
")",
":",
"self",
".",
"interfaces",
".",
"sort",
"(",
")",
"for",
"i",
"in",
"self",
".",
"interfaces",
":",
"if",
"i",
".",
"parent",
"and",
"i",
".",
"parent",
"not",
"in",
"self",
".",
"interfaces",
":",
"rai... | https://github.com/ricardoquesada/Spidermonkey/blob/4a75ea2543408bd1b2c515aa95901523eeef7858/xpcom/typelib/xpt/tools/xpt.py#L1125-L1142 | ||
ApolloAuto/apollo-platform | 86d9dc6743b496ead18d597748ebabd34a513289 | ros/third_party/lib_x86_64/python2.7/dist-packages/numpy/ma/core.py | python | _recursive_filled | (a, mask, fill_value) | Recursively fill `a` with `fill_value`.
Private function | Recursively fill `a` with `fill_value`.
Private function | [
"Recursively",
"fill",
"a",
"with",
"fill_value",
".",
"Private",
"function"
] | def _recursive_filled(a, mask, fill_value):
"""
Recursively fill `a` with `fill_value`.
Private function
"""
names = a.dtype.names
for name in names:
current = a[name]
if current.dtype.names:
_recursive_filled(current, mask[name], fill_value[name])
else:
... | [
"def",
"_recursive_filled",
"(",
"a",
",",
"mask",
",",
"fill_value",
")",
":",
"names",
"=",
"a",
".",
"dtype",
".",
"names",
"for",
"name",
"in",
"names",
":",
"current",
"=",
"a",
"[",
"name",
"]",
"if",
"current",
".",
"dtype",
".",
"names",
":... | https://github.com/ApolloAuto/apollo-platform/blob/86d9dc6743b496ead18d597748ebabd34a513289/ros/third_party/lib_x86_64/python2.7/dist-packages/numpy/ma/core.py#L2330-L2341 | ||
wxWidgets/wxPython-Classic | 19571e1ae65f1ac445f5491474121998c97a1bf0 | src/gtk/_misc.py | python | TimeSpan.IsNegative | (*args, **kwargs) | return _misc_.TimeSpan_IsNegative(*args, **kwargs) | IsNegative(self) -> bool | IsNegative(self) -> bool | [
"IsNegative",
"(",
"self",
")",
"-",
">",
"bool"
] | def IsNegative(*args, **kwargs):
"""IsNegative(self) -> bool"""
return _misc_.TimeSpan_IsNegative(*args, **kwargs) | [
"def",
"IsNegative",
"(",
"*",
"args",
",",
"*",
"*",
"kwargs",
")",
":",
"return",
"_misc_",
".",
"TimeSpan_IsNegative",
"(",
"*",
"args",
",",
"*",
"*",
"kwargs",
")"
] | https://github.com/wxWidgets/wxPython-Classic/blob/19571e1ae65f1ac445f5491474121998c97a1bf0/src/gtk/_misc.py#L4498-L4500 | |
ApolloAuto/apollo-platform | 86d9dc6743b496ead18d597748ebabd34a513289 | ros/ros_comm/rospy/src/rospy/rostime.py | python | get_rostime_cond | () | return _rostime_cond | internal API for helper routines that need to wait on time updates
@return: rostime conditional var
@rtype: threading.Cond | internal API for helper routines that need to wait on time updates | [
"internal",
"API",
"for",
"helper",
"routines",
"that",
"need",
"to",
"wait",
"on",
"time",
"updates"
] | def get_rostime_cond():
"""
internal API for helper routines that need to wait on time updates
@return: rostime conditional var
@rtype: threading.Cond
"""
return _rostime_cond | [
"def",
"get_rostime_cond",
"(",
")",
":",
"return",
"_rostime_cond"
] | https://github.com/ApolloAuto/apollo-platform/blob/86d9dc6743b496ead18d597748ebabd34a513289/ros/ros_comm/rospy/src/rospy/rostime.py#L248-L254 | |
SequoiaDB/SequoiaDB | 2894ed7e5bd6fe57330afc900cf76d0ff0df9f64 | tools/server/php_linux/libxml2/lib/python2.4/site-packages/libxml2.py | python | xpathParserContext.xpathNextNamespace | (self, cur) | return __tmp | Traversal function for the "namespace" direction the
namespace axis contains the namespace nodes of the context
node; the order of nodes on this axis is
implementation-defined; the axis will be empty unless the
context node is an element We keep the XML namespace node
... | Traversal function for the "namespace" direction the
namespace axis contains the namespace nodes of the context
node; the order of nodes on this axis is
implementation-defined; the axis will be empty unless the
context node is an element We keep the XML namespace node
... | [
"Traversal",
"function",
"for",
"the",
"namespace",
"direction",
"the",
"namespace",
"axis",
"contains",
"the",
"namespace",
"nodes",
"of",
"the",
"context",
"node",
";",
"the",
"order",
"of",
"nodes",
"on",
"this",
"axis",
"is",
"implementation",
"-",
"define... | def xpathNextNamespace(self, cur):
"""Traversal function for the "namespace" direction the
namespace axis contains the namespace nodes of the context
node; the order of nodes on this axis is
implementation-defined; the axis will be empty unless the
context node is an elem... | [
"def",
"xpathNextNamespace",
"(",
"self",
",",
"cur",
")",
":",
"if",
"cur",
"is",
"None",
":",
"cur__o",
"=",
"None",
"else",
":",
"cur__o",
"=",
"cur",
".",
"_o",
"ret",
"=",
"libxml2mod",
".",
"xmlXPathNextNamespace",
"(",
"self",
".",
"_o",
",",
... | https://github.com/SequoiaDB/SequoiaDB/blob/2894ed7e5bd6fe57330afc900cf76d0ff0df9f64/tools/server/php_linux/libxml2/lib/python2.4/site-packages/libxml2.py#L7639-L7651 | |
baidu-research/tensorflow-allreduce | 66d5b855e90b0949e9fa5cca5599fd729a70e874 | tensorflow/contrib/learn/python/learn/monitors.py | python | CheckpointSaver.__init__ | (self,
checkpoint_dir,
save_secs=None,
save_steps=None,
saver=None,
checkpoint_basename="model.ckpt",
scaffold=None) | Initialize CheckpointSaver monitor.
Args:
checkpoint_dir: `str`, base directory for the checkpoint files.
save_secs: `int`, save every N secs.
save_steps: `int`, save every N steps.
saver: `Saver` object, used for saving.
checkpoint_basename: `str`, base name for the checkpoint files.... | Initialize CheckpointSaver monitor. | [
"Initialize",
"CheckpointSaver",
"monitor",
"."
] | def __init__(self,
checkpoint_dir,
save_secs=None,
save_steps=None,
saver=None,
checkpoint_basename="model.ckpt",
scaffold=None):
"""Initialize CheckpointSaver monitor.
Args:
checkpoint_dir: `str`, base directory fo... | [
"def",
"__init__",
"(",
"self",
",",
"checkpoint_dir",
",",
"save_secs",
"=",
"None",
",",
"save_steps",
"=",
"None",
",",
"saver",
"=",
"None",
",",
"checkpoint_basename",
"=",
"\"model.ckpt\"",
",",
"scaffold",
"=",
"None",
")",
":",
"logging",
".",
"inf... | https://github.com/baidu-research/tensorflow-allreduce/blob/66d5b855e90b0949e9fa5cca5599fd729a70e874/tensorflow/contrib/learn/python/learn/monitors.py#L1008-L1044 | ||
baidu-research/tensorflow-allreduce | 66d5b855e90b0949e9fa5cca5599fd729a70e874 | tensorflow/python/lib/io/file_io.py | python | copy | (oldpath, newpath, overwrite=False) | Copies data from oldpath to newpath.
Args:
oldpath: string, name of the file who's contents need to be copied
newpath: string, name of the file to which to copy to
overwrite: boolean, if false its an error for newpath to be occupied by an
existing file.
Raises:
errors.OpError: If the opera... | Copies data from oldpath to newpath. | [
"Copies",
"data",
"from",
"oldpath",
"to",
"newpath",
"."
] | def copy(oldpath, newpath, overwrite=False):
"""Copies data from oldpath to newpath.
Args:
oldpath: string, name of the file who's contents need to be copied
newpath: string, name of the file to which to copy to
overwrite: boolean, if false its an error for newpath to be occupied by an
existing... | [
"def",
"copy",
"(",
"oldpath",
",",
"newpath",
",",
"overwrite",
"=",
"False",
")",
":",
"with",
"errors",
".",
"raise_exception_on_not_ok_status",
"(",
")",
"as",
"status",
":",
"pywrap_tensorflow",
".",
"CopyFile",
"(",
"compat",
".",
"as_bytes",
"(",
"old... | https://github.com/baidu-research/tensorflow-allreduce/blob/66d5b855e90b0949e9fa5cca5599fd729a70e874/tensorflow/python/lib/io/file_io.py#L370-L384 | ||
hakuna-m/wubiuefi | caec1af0a09c78fd5a345180ada1fe45e0c63493 | src/openpgp/sap/crypto.py | python | crypt_CFB | (instream, outstream, algorithm, key, register, direction) | Crypt a string in cipher-feedback mode.
:Parameters:
- `instream`: StringIO/file incoming
- `outstream`: StringIO/file outgoing
- `algorithm`: integer symmetric cipher constant
- `key`: string encryption/decryption key
- `register`: string initialization vector (IV) to feed ... | Crypt a string in cipher-feedback mode. | [
"Crypt",
"a",
"string",
"in",
"cipher",
"-",
"feedback",
"mode",
"."
] | def crypt_CFB(instream, outstream, algorithm, key, register, direction):
"""'Crypt a string in cipher-feedback mode.
:Parameters:
- `instream`: StringIO/file incoming
- `outstream`: StringIO/file outgoing
- `algorithm`: integer symmetric cipher constant
- `key`: string encryptio... | [
"def",
"crypt_CFB",
"(",
"instream",
",",
"outstream",
",",
"algorithm",
",",
"key",
",",
"register",
",",
"direction",
")",
":",
"ciphermod",
"=",
"_import_cipher",
"(",
"algorithm",
")",
"cipher",
"=",
"ciphermod",
".",
"new",
"(",
"key",
",",
"ciphermod... | https://github.com/hakuna-m/wubiuefi/blob/caec1af0a09c78fd5a345180ada1fe45e0c63493/src/openpgp/sap/crypto.py#L696-L755 | ||
sonyxperiadev/WebGL | 0299b38196f78c6d5f74bcf6fa312a3daee6de60 | Tools/Scripts/webkitpy/thirdparty/BeautifulSoup.py | python | Tag.__eq__ | (self, other) | return True | Returns true iff this tag has the same name, the same attributes,
and the same contents (recursively) as the given tag.
NOTE: right now this will return false if two tags have the
same attributes in a different order. Should this be fixed? | Returns true iff this tag has the same name, the same attributes,
and the same contents (recursively) as the given tag. | [
"Returns",
"true",
"iff",
"this",
"tag",
"has",
"the",
"same",
"name",
"the",
"same",
"attributes",
"and",
"the",
"same",
"contents",
"(",
"recursively",
")",
"as",
"the",
"given",
"tag",
"."
] | def __eq__(self, other):
"""Returns true iff this tag has the same name, the same attributes,
and the same contents (recursively) as the given tag.
NOTE: right now this will return false if two tags have the
same attributes in a different order. Should this be fixed?"""
if not h... | [
"def",
"__eq__",
"(",
"self",
",",
"other",
")",
":",
"if",
"not",
"hasattr",
"(",
"other",
",",
"'name'",
")",
"or",
"not",
"hasattr",
"(",
"other",
",",
"'attrs'",
")",
"or",
"not",
"hasattr",
"(",
"other",
",",
"'contents'",
")",
"or",
"self",
"... | https://github.com/sonyxperiadev/WebGL/blob/0299b38196f78c6d5f74bcf6fa312a3daee6de60/Tools/Scripts/webkitpy/thirdparty/BeautifulSoup.py#L597-L608 | |
rpp0/gr-lora | 90343d45a3c73c84d32d74b8603b6c01de025b08 | python/lorasocket.py | python | LoRaUDPServer.get_payloads | (self, number_of_payloads) | return total_data | Returns array of <number_of_payloads> hexadecimal LoRa payload datagrams received on a socket. | Returns array of <number_of_payloads> hexadecimal LoRa payload datagrams received on a socket. | [
"Returns",
"array",
"of",
"<number_of_payloads",
">",
"hexadecimal",
"LoRa",
"payload",
"datagrams",
"received",
"on",
"a",
"socket",
"."
] | def get_payloads(self, number_of_payloads):
"""
Returns array of <number_of_payloads> hexadecimal LoRa payload datagrams received on a socket.
"""
total_data = []
data = ''
for i in range(number_of_payloads):
try:
data = self.s.recvfrom(65535)... | [
"def",
"get_payloads",
"(",
"self",
",",
"number_of_payloads",
")",
":",
"total_data",
"=",
"[",
"]",
"data",
"=",
"''",
"for",
"i",
"in",
"range",
"(",
"number_of_payloads",
")",
":",
"try",
":",
"data",
"=",
"self",
".",
"s",
".",
"recvfrom",
"(",
... | https://github.com/rpp0/gr-lora/blob/90343d45a3c73c84d32d74b8603b6c01de025b08/python/lorasocket.py#L18-L34 | |
CRYTEK/CRYENGINE | 232227c59a220cbbd311576f0fbeba7bb53b2a8c | Editor/Python/windows/Lib/site-packages/pip/download.py | python | _download_http_url | (link, session, temp_dir) | return file_path, content_type | Download link url into temp_dir using provided session | Download link url into temp_dir using provided session | [
"Download",
"link",
"url",
"into",
"temp_dir",
"using",
"provided",
"session"
] | def _download_http_url(link, session, temp_dir):
"""Download link url into temp_dir using provided session"""
target_url = link.url.split('#', 1)[0]
try:
resp = session.get(
target_url,
# We use Accept-Encoding: identity here because requests
# defaults to accepti... | [
"def",
"_download_http_url",
"(",
"link",
",",
"session",
",",
"temp_dir",
")",
":",
"target_url",
"=",
"link",
".",
"url",
".",
"split",
"(",
"'#'",
",",
"1",
")",
"[",
"0",
"]",
"try",
":",
"resp",
"=",
"session",
".",
"get",
"(",
"target_url",
"... | https://github.com/CRYTEK/CRYENGINE/blob/232227c59a220cbbd311576f0fbeba7bb53b2a8c/Editor/Python/windows/Lib/site-packages/pip/download.py#L831-L887 | |
windystrife/UnrealEngine_NVIDIAGameWorks | b50e6338a7c5b26374d66306ebc7807541ff815e | Engine/Extras/ThirdPartyNotUE/emsdk/Win64/python/2.7.5.3_64bit/Lib/stringold.py | python | count | (s, *args) | return _apply(s.count, args) | count(s, sub[, start[,end]]) -> int
Return the number of occurrences of substring sub in string
s[start:end]. Optional arguments start and end are
interpreted as in slice notation. | count(s, sub[, start[,end]]) -> int | [
"count",
"(",
"s",
"sub",
"[",
"start",
"[",
"end",
"]]",
")",
"-",
">",
"int"
] | def count(s, *args):
"""count(s, sub[, start[,end]]) -> int
Return the number of occurrences of substring sub in string
s[start:end]. Optional arguments start and end are
interpreted as in slice notation.
"""
return _apply(s.count, args) | [
"def",
"count",
"(",
"s",
",",
"*",
"args",
")",
":",
"return",
"_apply",
"(",
"s",
".",
"count",
",",
"args",
")"
] | https://github.com/windystrife/UnrealEngine_NVIDIAGameWorks/blob/b50e6338a7c5b26374d66306ebc7807541ff815e/Engine/Extras/ThirdPartyNotUE/emsdk/Win64/python/2.7.5.3_64bit/Lib/stringold.py#L154-L162 | |
Cisco-Talos/moflow | ed71dfb0540d9e0d7a4c72f0881b58958d573728 | BAP-0.7-moflow/libtracewrap/libtrace/protobuf/python/mox.py | python | Func.__init__ | (self, func) | Initialize.
Args:
func: callable that takes one parameter and returns a bool | Initialize. | [
"Initialize",
"."
] | def __init__(self, func):
"""Initialize.
Args:
func: callable that takes one parameter and returns a bool
"""
self._func = func | [
"def",
"__init__",
"(",
"self",
",",
"func",
")",
":",
"self",
".",
"_func",
"=",
"func"
] | https://github.com/Cisco-Talos/moflow/blob/ed71dfb0540d9e0d7a4c72f0881b58958d573728/BAP-0.7-moflow/libtracewrap/libtrace/protobuf/python/mox.py#L1129-L1136 | ||
GoSSIP-SJTU/TripleDoggy | 03648d6b19c812504b14e8b98c8c7b3f443f4e54 | tools/clang/tools/scan-build-py/libscanbuild/intercept.py | python | format_entry | (exec_trace) | Generate the desired fields for compilation database entries. | Generate the desired fields for compilation database entries. | [
"Generate",
"the",
"desired",
"fields",
"for",
"compilation",
"database",
"entries",
"."
] | def format_entry(exec_trace):
""" Generate the desired fields for compilation database entries. """
def abspath(cwd, name):
""" Create normalized absolute path from input filename. """
fullname = name if os.path.isabs(name) else os.path.join(cwd, name)
return os.path.normpath(fullname)
... | [
"def",
"format_entry",
"(",
"exec_trace",
")",
":",
"def",
"abspath",
"(",
"cwd",
",",
"name",
")",
":",
"\"\"\" Create normalized absolute path from input filename. \"\"\"",
"fullname",
"=",
"name",
"if",
"os",
".",
"path",
".",
"isabs",
"(",
"name",
")",
"else... | https://github.com/GoSSIP-SJTU/TripleDoggy/blob/03648d6b19c812504b14e8b98c8c7b3f443f4e54/tools/clang/tools/scan-build-py/libscanbuild/intercept.py#L205-L224 | ||
abforce/xposed_art_n | ec3fbe417d74d4664cec053d91dd4e3881176374 | tools/checker/file_format/common.py | python | SplitStream | (stream, fnProcessLine, fnLineOutsideChunk) | return allChunks | Reads the given input stream and splits it into chunks based on
information extracted from individual lines.
Arguments:
- fnProcessLine: Called on each line with the text and line number. Must
return a triplet, composed of the name of the chunk started on this line,
the data extracted, and the nam... | Reads the given input stream and splits it into chunks based on
information extracted from individual lines. | [
"Reads",
"the",
"given",
"input",
"stream",
"and",
"splits",
"it",
"into",
"chunks",
"based",
"on",
"information",
"extracted",
"from",
"individual",
"lines",
"."
] | def SplitStream(stream, fnProcessLine, fnLineOutsideChunk):
""" Reads the given input stream and splits it into chunks based on
information extracted from individual lines.
Arguments:
- fnProcessLine: Called on each line with the text and line number. Must
return a triplet, composed of the name of th... | [
"def",
"SplitStream",
"(",
"stream",
",",
"fnProcessLine",
",",
"fnLineOutsideChunk",
")",
":",
"lineNo",
"=",
"0",
"allChunks",
"=",
"[",
"]",
"currentChunk",
"=",
"None",
"for",
"line",
"in",
"stream",
":",
"lineNo",
"+=",
"1",
"line",
"=",
"line",
"."... | https://github.com/abforce/xposed_art_n/blob/ec3fbe417d74d4664cec053d91dd4e3881176374/tools/checker/file_format/common.py#L15-L51 | |
qgis/QGIS | 15a77662d4bb712184f6aa60d0bd663010a76a75 | python/plugins/processing/modeler/ModelerDialog.py | python | ModelerDialog.create | (model=None) | return dlg | Workaround crappy sip handling of QMainWindow. It doesn't know that we are using the deleteonclose
flag, so happily just deletes dialogs as soon as they go out of scope. The only workaround possible
while we still have to drag around this Python code is to store a reference to the sip wrapper so that
... | Workaround crappy sip handling of QMainWindow. It doesn't know that we are using the deleteonclose
flag, so happily just deletes dialogs as soon as they go out of scope. The only workaround possible
while we still have to drag around this Python code is to store a reference to the sip wrapper so that
... | [
"Workaround",
"crappy",
"sip",
"handling",
"of",
"QMainWindow",
".",
"It",
"doesn",
"t",
"know",
"that",
"we",
"are",
"using",
"the",
"deleteonclose",
"flag",
"so",
"happily",
"just",
"deletes",
"dialogs",
"as",
"soon",
"as",
"they",
"go",
"out",
"of",
"sc... | def create(model=None):
"""
Workaround crappy sip handling of QMainWindow. It doesn't know that we are using the deleteonclose
flag, so happily just deletes dialogs as soon as they go out of scope. The only workaround possible
while we still have to drag around this Python code is to sto... | [
"def",
"create",
"(",
"model",
"=",
"None",
")",
":",
"dlg",
"=",
"ModelerDialog",
"(",
"model",
")",
"ModelerDialog",
".",
"dlgs",
".",
"append",
"(",
"dlg",
")",
"return",
"dlg"
] | https://github.com/qgis/QGIS/blob/15a77662d4bb712184f6aa60d0bd663010a76a75/python/plugins/processing/modeler/ModelerDialog.py#L78-L87 | |
BlzFans/wke | b0fa21158312e40c5fbd84682d643022b6c34a93 | cygwin/lib/python2.6/os2emxpath.py | python | splitunc | (p) | return '', p | Split a pathname into UNC mount point and relative path specifiers.
Return a 2-tuple (unc, rest); either part may be empty.
If unc is not empty, it has the form '//host/mount' (or similar
using backslashes). unc+rest is always the input path.
Paths containing drive letters never have an UNC part. | Split a pathname into UNC mount point and relative path specifiers. | [
"Split",
"a",
"pathname",
"into",
"UNC",
"mount",
"point",
"and",
"relative",
"path",
"specifiers",
"."
] | def splitunc(p):
"""Split a pathname into UNC mount point and relative path specifiers.
Return a 2-tuple (unc, rest); either part may be empty.
If unc is not empty, it has the form '//host/mount' (or similar
using backslashes). unc+rest is always the input path.
Paths containing drive letters neve... | [
"def",
"splitunc",
"(",
"p",
")",
":",
"if",
"p",
"[",
"1",
":",
"2",
"]",
"==",
"':'",
":",
"return",
"''",
",",
"p",
"# Drive letter present",
"firstTwo",
"=",
"p",
"[",
"0",
":",
"2",
"]",
"if",
"firstTwo",
"==",
"'/'",
"*",
"2",
"or",
"firs... | https://github.com/BlzFans/wke/blob/b0fa21158312e40c5fbd84682d643022b6c34a93/cygwin/lib/python2.6/os2emxpath.py#L58-L83 | |
MVIG-SJTU/RMPE | 5188c230ec800c12be7369c3619615bc9b020aa4 | scripts/cpp_lint.py | python | _CppLintState.SetCountingStyle | (self, counting_style) | Sets the module's counting options. | Sets the module's counting options. | [
"Sets",
"the",
"module",
"s",
"counting",
"options",
"."
] | def SetCountingStyle(self, counting_style):
"""Sets the module's counting options."""
self.counting = counting_style | [
"def",
"SetCountingStyle",
"(",
"self",
",",
"counting_style",
")",
":",
"self",
".",
"counting",
"=",
"counting_style"
] | https://github.com/MVIG-SJTU/RMPE/blob/5188c230ec800c12be7369c3619615bc9b020aa4/scripts/cpp_lint.py#L713-L715 | ||
tangzhenyu/Scene-Text-Understanding | 0f7ffc7aea5971a50cdc03d33d0a41075285948b | ctpn_crnn_ocr/CTPN/caffe/python/caffe/draw.py | python | get_edge_label | (layer) | return edge_label | Define edge label based on layer type. | Define edge label based on layer type. | [
"Define",
"edge",
"label",
"based",
"on",
"layer",
"type",
"."
] | def get_edge_label(layer):
"""Define edge label based on layer type.
"""
if layer.type == 'Data':
edge_label = 'Batch ' + str(layer.data_param.batch_size)
elif layer.type == 'Convolution':
edge_label = str(layer.convolution_param.num_output)
elif layer.type == 'InnerProduct':
... | [
"def",
"get_edge_label",
"(",
"layer",
")",
":",
"if",
"layer",
".",
"type",
"==",
"'Data'",
":",
"edge_label",
"=",
"'Batch '",
"+",
"str",
"(",
"layer",
".",
"data_param",
".",
"batch_size",
")",
"elif",
"layer",
".",
"type",
"==",
"'Convolution'",
":"... | https://github.com/tangzhenyu/Scene-Text-Understanding/blob/0f7ffc7aea5971a50cdc03d33d0a41075285948b/ctpn_crnn_ocr/CTPN/caffe/python/caffe/draw.py#L37-L50 | |
hpi-xnor/BMXNet-v2 | af2b1859eafc5c721b1397cef02f946aaf2ce20d | python/mxnet/image/detection.py | python | DetHorizontalFlipAug.__call__ | (self, src, label) | return (src, label) | Augmenter implementation | Augmenter implementation | [
"Augmenter",
"implementation"
] | def __call__(self, src, label):
"""Augmenter implementation"""
if random.random() < self.p:
src = nd.flip(src, axis=1)
self._flip_label(label)
return (src, label) | [
"def",
"__call__",
"(",
"self",
",",
"src",
",",
"label",
")",
":",
"if",
"random",
".",
"random",
"(",
")",
"<",
"self",
".",
"p",
":",
"src",
"=",
"nd",
".",
"flip",
"(",
"src",
",",
"axis",
"=",
"1",
")",
"self",
".",
"_flip_label",
"(",
"... | https://github.com/hpi-xnor/BMXNet-v2/blob/af2b1859eafc5c721b1397cef02f946aaf2ce20d/python/mxnet/image/detection.py#L138-L143 | |
Tencent/CMONGO | c40380caa14e05509f46993aa8b8da966b09b0b5 | src/third_party/scons-2.5.0/scons-local-2.5.0/SCons/Tool/docbook/__init__.py | python | __select_builder | (lxml_builder, libxml2_builder, cmdline_builder) | return libxml2_builder | Selects a builder, based on which Python modules are present. | Selects a builder, based on which Python modules are present. | [
"Selects",
"a",
"builder",
"based",
"on",
"which",
"Python",
"modules",
"are",
"present",
"."
] | def __select_builder(lxml_builder, libxml2_builder, cmdline_builder):
""" Selects a builder, based on which Python modules are present. """
if prefer_xsltproc:
return cmdline_builder
if not has_libxml2:
# At the moment we prefer libxml2 over lxml, the latter can lead
# to confli... | [
"def",
"__select_builder",
"(",
"lxml_builder",
",",
"libxml2_builder",
",",
"cmdline_builder",
")",
":",
"if",
"prefer_xsltproc",
":",
"return",
"cmdline_builder",
"if",
"not",
"has_libxml2",
":",
"# At the moment we prefer libxml2 over lxml, the latter can lead",
"# to conf... | https://github.com/Tencent/CMONGO/blob/c40380caa14e05509f46993aa8b8da966b09b0b5/src/third_party/scons-2.5.0/scons-local-2.5.0/SCons/Tool/docbook/__init__.py#L96-L109 | |
OpenGenus/quark | 225ad96efdfcc66cb6584a756c17eb3871e6eb62 | code/code/artificial_intelligence/src/principal_component_analysis/pca.py | python | principal_subspace_transformation | (data, matrix_w) | return transformed | Transform data into a new subspace through the equation: transformed = matrix_w' * data | Transform data into a new subspace through the equation: transformed = matrix_w' * data | [
"Transform",
"data",
"into",
"a",
"new",
"subspace",
"through",
"the",
"equation",
":",
"transformed",
"=",
"matrix_w",
"*",
"data"
] | def principal_subspace_transformation(data, matrix_w):
''' Transform data into a new subspace through the equation: transformed = matrix_w' * data '''
transformed = matrix_w.T.dot(data)
assert transformed.shape == (2,40), "The matrix is not 2x40 dimensional."
return transformed | [
"def",
"principal_subspace_transformation",
"(",
"data",
",",
"matrix_w",
")",
":",
"transformed",
"=",
"matrix_w",
".",
"T",
".",
"dot",
"(",
"data",
")",
"assert",
"transformed",
".",
"shape",
"==",
"(",
"2",
",",
"40",
")",
",",
"\"The matrix is not 2x40 ... | https://github.com/OpenGenus/quark/blob/225ad96efdfcc66cb6584a756c17eb3871e6eb62/code/code/artificial_intelligence/src/principal_component_analysis/pca.py#L211-L215 | |
NVIDIA/TensorRT | 42805f078052daad1a98bc5965974fcffaad0960 | demo/BERT/helpers/tokenization.py | python | _is_whitespace | (char) | return False | Checks whether `chars` is a whitespace character. | Checks whether `chars` is a whitespace character. | [
"Checks",
"whether",
"chars",
"is",
"a",
"whitespace",
"character",
"."
] | def _is_whitespace(char):
"""Checks whether `chars` is a whitespace character."""
# \t, \n, and \r are technically contorl characters but we treat them
# as whitespace since they are generally considered as such.
if char == " " or char == "\t" or char == "\n" or char == "\r":
return True
cat = unicodedata... | [
"def",
"_is_whitespace",
"(",
"char",
")",
":",
"# \\t, \\n, and \\r are technically contorl characters but we treat them",
"# as whitespace since they are generally considered as such.",
"if",
"char",
"==",
"\" \"",
"or",
"char",
"==",
"\"\\t\"",
"or",
"char",
"==",
"\"\\n\"",... | https://github.com/NVIDIA/TensorRT/blob/42805f078052daad1a98bc5965974fcffaad0960/demo/BERT/helpers/tokenization.py#L392-L401 | |
macchina-io/macchina.io | ef24ba0e18379c3dd48fb84e6dbf991101cb8db0 | platform/JS/V8/v8/tools/gyp_flag_compare.py | python | GetFlags | (lines, build_dir) | return flags_by_output | Turn a list of command lines into a semi-structured dict. | Turn a list of command lines into a semi-structured dict. | [
"Turn",
"a",
"list",
"of",
"command",
"lines",
"into",
"a",
"semi",
"-",
"structured",
"dict",
"."
] | def GetFlags(lines, build_dir):
"""Turn a list of command lines into a semi-structured dict."""
is_win = sys.platform == 'win32'
flags_by_output = {}
for line in lines:
command_line = shlex.split(line.strip(), posix=not is_win)[1:]
output_name = FindAndRemoveArgWithValue(command_line, '-o')
dep_nam... | [
"def",
"GetFlags",
"(",
"lines",
",",
"build_dir",
")",
":",
"is_win",
"=",
"sys",
".",
"platform",
"==",
"'win32'",
"flags_by_output",
"=",
"{",
"}",
"for",
"line",
"in",
"lines",
":",
"command_line",
"=",
"shlex",
".",
"split",
"(",
"line",
".",
"str... | https://github.com/macchina-io/macchina.io/blob/ef24ba0e18379c3dd48fb84e6dbf991101cb8db0/platform/JS/V8/v8/tools/gyp_flag_compare.py#L74-L156 | |
wxWidgets/wxPython-Classic | 19571e1ae65f1ac445f5491474121998c97a1bf0 | src/gtk/propgrid.py | python | PGProperty.OnValidationFailure | (*args, **kwargs) | return _propgrid.PGProperty_OnValidationFailure(*args, **kwargs) | OnValidationFailure(self, wxVariant pendingValue) | OnValidationFailure(self, wxVariant pendingValue) | [
"OnValidationFailure",
"(",
"self",
"wxVariant",
"pendingValue",
")"
] | def OnValidationFailure(*args, **kwargs):
"""OnValidationFailure(self, wxVariant pendingValue)"""
return _propgrid.PGProperty_OnValidationFailure(*args, **kwargs) | [
"def",
"OnValidationFailure",
"(",
"*",
"args",
",",
"*",
"*",
"kwargs",
")",
":",
"return",
"_propgrid",
".",
"PGProperty_OnValidationFailure",
"(",
"*",
"args",
",",
"*",
"*",
"kwargs",
")"
] | https://github.com/wxWidgets/wxPython-Classic/blob/19571e1ae65f1ac445f5491474121998c97a1bf0/src/gtk/propgrid.py#L428-L430 | |
krishauser/Klampt | 972cc83ea5befac3f653c1ba20f80155768ad519 | Python/python2_version/klampt/math/optimize.py | python | OptimizationProblemBuilder.satisfiesEqualities | (self,tol=1e-3) | return all(abs(r) <= tol for r in res) | Returns True if every entry of the (hard) equality + IK residual equals 0 (to the tolerance tol). | Returns True if every entry of the (hard) equality + IK residual equals 0 (to the tolerance tol). | [
"Returns",
"True",
"if",
"every",
"entry",
"of",
"the",
"(",
"hard",
")",
"equality",
"+",
"IK",
"residual",
"equals",
"0",
"(",
"to",
"the",
"tolerance",
"tol",
")",
"."
] | def satisfiesEqualities(self,tol=1e-3):
"""Returns True if every entry of the (hard) equality + IK residual equals 0 (to the tolerance tol)."""
res = self.equalityResidual()
if len(res) == 0: return True
return all(abs(r) <= tol for r in res) | [
"def",
"satisfiesEqualities",
"(",
"self",
",",
"tol",
"=",
"1e-3",
")",
":",
"res",
"=",
"self",
".",
"equalityResidual",
"(",
")",
"if",
"len",
"(",
"res",
")",
"==",
"0",
":",
"return",
"True",
"return",
"all",
"(",
"abs",
"(",
"r",
")",
"<=",
... | https://github.com/krishauser/Klampt/blob/972cc83ea5befac3f653c1ba20f80155768ad519/Python/python2_version/klampt/math/optimize.py#L947-L951 | |
mantidproject/mantid | 03deeb89254ec4289edb8771e0188c2090a02f32 | qt/python/mantidqt/mantidqt/plotting/functions.py | python | _validate_pcolormesh_inputs | (workspaces) | Raises a ValueError if any arguments have the incorrect types | Raises a ValueError if any arguments have the incorrect types | [
"Raises",
"a",
"ValueError",
"if",
"any",
"arguments",
"have",
"the",
"incorrect",
"types"
] | def _validate_pcolormesh_inputs(workspaces):
"""Raises a ValueError if any arguments have the incorrect types"""
raise_if_not_sequence(workspaces, 'workspaces', MatrixWorkspace) | [
"def",
"_validate_pcolormesh_inputs",
"(",
"workspaces",
")",
":",
"raise_if_not_sequence",
"(",
"workspaces",
",",
"'workspaces'",
",",
"MatrixWorkspace",
")"
] | https://github.com/mantidproject/mantid/blob/03deeb89254ec4289edb8771e0188c2090a02f32/qt/python/mantidqt/mantidqt/plotting/functions.py#L322-L324 | ||
rdiankov/openrave | d1a23023fd4b58f077d2ca949ceaf1b91f3f13d7 | python/ikfast_sympy0_6.py | python | IKFastSolver.solveLiWoernleHiller | (self,rawpolyeqs,solvejointvars,endbranchtree) | return solutiontree+endbranchtree,usedvars | Li-Woernle-Hiller procedure covered in
Jorge Angeles, "Fundamentals of Robotics Mechanical Systems", Springer, 2007. | Li-Woernle-Hiller procedure covered in
Jorge Angeles, "Fundamentals of Robotics Mechanical Systems", Springer, 2007. | [
"Li",
"-",
"Woernle",
"-",
"Hiller",
"procedure",
"covered",
"in",
"Jorge",
"Angeles",
"Fundamentals",
"of",
"Robotics",
"Mechanical",
"Systems",
"Springer",
"2007",
"."
] | def solveLiWoernleHiller(self,rawpolyeqs,solvejointvars,endbranchtree):
"""Li-Woernle-Hiller procedure covered in
Jorge Angeles, "Fundamentals of Robotics Mechanical Systems", Springer, 2007.
"""
log.info('attempting li/woernle/hiller general ik method')
if len(rawpolyeqs[0][0].... | [
"def",
"solveLiWoernleHiller",
"(",
"self",
",",
"rawpolyeqs",
",",
"solvejointvars",
",",
"endbranchtree",
")",
":",
"log",
".",
"info",
"(",
"'attempting li/woernle/hiller general ik method'",
")",
"if",
"len",
"(",
"rawpolyeqs",
"[",
"0",
"]",
"[",
"0",
"]",
... | https://github.com/rdiankov/openrave/blob/d1a23023fd4b58f077d2ca949ceaf1b91f3f13d7/python/ikfast_sympy0_6.py#L3144-L3510 | |
GJDuck/LowFat | ecf6a0f0fa1b73a27a626cf493cc39e477b6faea | llvm-4.0.0.src/tools/clang/bindings/python/clang/cindex.py | python | Type.get_pointee | (self) | return conf.lib.clang_getPointeeType(self) | For pointer types, returns the type of the pointee. | For pointer types, returns the type of the pointee. | [
"For",
"pointer",
"types",
"returns",
"the",
"type",
"of",
"the",
"pointee",
"."
] | def get_pointee(self):
"""
For pointer types, returns the type of the pointee.
"""
return conf.lib.clang_getPointeeType(self) | [
"def",
"get_pointee",
"(",
"self",
")",
":",
"return",
"conf",
".",
"lib",
".",
"clang_getPointeeType",
"(",
"self",
")"
] | https://github.com/GJDuck/LowFat/blob/ecf6a0f0fa1b73a27a626cf493cc39e477b6faea/llvm-4.0.0.src/tools/clang/bindings/python/clang/cindex.py#L2072-L2076 | |
llvm-mirror/lldb | d01083a850f577b85501a0902b52fd0930de72c7 | third_party/Python/module/pexpect-4.6/pexpect/spawnbase.py | python | SpawnBase.expect_list | (self, pattern_list, timeout=-1, searchwindowsize=-1,
async_=False, **kw) | This takes a list of compiled regular expressions and returns the
index into the pattern_list that matched the child output. The list may
also contain EOF or TIMEOUT(which are not compiled regular
expressions). This method is similar to the expect() method except that
expect_list() does ... | This takes a list of compiled regular expressions and returns the
index into the pattern_list that matched the child output. The list may
also contain EOF or TIMEOUT(which are not compiled regular
expressions). This method is similar to the expect() method except that
expect_list() does ... | [
"This",
"takes",
"a",
"list",
"of",
"compiled",
"regular",
"expressions",
"and",
"returns",
"the",
"index",
"into",
"the",
"pattern_list",
"that",
"matched",
"the",
"child",
"output",
".",
"The",
"list",
"may",
"also",
"contain",
"EOF",
"or",
"TIMEOUT",
"(",... | def expect_list(self, pattern_list, timeout=-1, searchwindowsize=-1,
async_=False, **kw):
'''This takes a list of compiled regular expressions and returns the
index into the pattern_list that matched the child output. The list may
also contain EOF or TIMEOUT(which are not com... | [
"def",
"expect_list",
"(",
"self",
",",
"pattern_list",
",",
"timeout",
"=",
"-",
"1",
",",
"searchwindowsize",
"=",
"-",
"1",
",",
"async_",
"=",
"False",
",",
"*",
"*",
"kw",
")",
":",
"if",
"timeout",
"==",
"-",
"1",
":",
"timeout",
"=",
"self",... | https://github.com/llvm-mirror/lldb/blob/d01083a850f577b85501a0902b52fd0930de72c7/third_party/Python/module/pexpect-4.6/pexpect/spawnbase.py#L343-L369 | ||
wxWidgets/wxPython-Classic | 19571e1ae65f1ac445f5491474121998c97a1bf0 | src/osx_cocoa/_core.py | python | PyEvtHandler.__init__ | (self, *args, **kwargs) | __init__(self) -> PyEvtHandler
The wx.PyEvtHandler class can be used to intercept calls to the
`ProcessEvent` method. Simply derive a new class from this one,
override ProcessEvent, and then push an instance of the class onto the
event handler chain for a window using `wx.Window.PushEv... | __init__(self) -> PyEvtHandler | [
"__init__",
"(",
"self",
")",
"-",
">",
"PyEvtHandler"
] | def __init__(self, *args, **kwargs):
"""
__init__(self) -> PyEvtHandler
The wx.PyEvtHandler class can be used to intercept calls to the
`ProcessEvent` method. Simply derive a new class from this one,
override ProcessEvent, and then push an instance of the class onto the
... | [
"def",
"__init__",
"(",
"self",
",",
"*",
"args",
",",
"*",
"*",
"kwargs",
")",
":",
"_core_",
".",
"PyEvtHandler_swiginit",
"(",
"self",
",",
"_core_",
".",
"new_PyEvtHandler",
"(",
"*",
"args",
",",
"*",
"*",
"kwargs",
")",
")",
"self",
".",
"_setO... | https://github.com/wxWidgets/wxPython-Classic/blob/19571e1ae65f1ac445f5491474121998c97a1bf0/src/osx_cocoa/_core.py#L4253-L4263 | ||
wxWidgets/wxPython-Classic | 19571e1ae65f1ac445f5491474121998c97a1bf0 | wx/lib/agw/aui/framemanager.py | python | AuiManager.GetSnapPosition | (self) | return pos | Returns the main frame snapping position. | Returns the main frame snapping position. | [
"Returns",
"the",
"main",
"frame",
"snapping",
"position",
"."
] | def GetSnapPosition(self):
""" Returns the main frame snapping position. """
snap, hAlign, vAlign, monitor = self._is_docked
display = wx.Display(monitor)
area = display.GetClientArea()
size = self.GetManagedWindow().GetSize()
pos = wx.Point()
if hAlign == wx.L... | [
"def",
"GetSnapPosition",
"(",
"self",
")",
":",
"snap",
",",
"hAlign",
",",
"vAlign",
",",
"monitor",
"=",
"self",
".",
"_is_docked",
"display",
"=",
"wx",
".",
"Display",
"(",
"monitor",
")",
"area",
"=",
"display",
".",
"GetClientArea",
"(",
")",
"s... | https://github.com/wxWidgets/wxPython-Classic/blob/19571e1ae65f1ac445f5491474121998c97a1bf0/wx/lib/agw/aui/framemanager.py#L10455-L10479 | |
KhronosGroup/OpenCOLLADA | 6031fa956e1da4bbdd910af3a8f9e924ef0fca7a | Externals/LibXML/python/libxml.py | python | SAXCallback.processingInstruction | (self, target, data) | called when a PI has been found, target contains the PI name and
data is the associated data in the PI | called when a PI has been found, target contains the PI name and
data is the associated data in the PI | [
"called",
"when",
"a",
"PI",
"has",
"been",
"found",
"target",
"contains",
"the",
"PI",
"name",
"and",
"data",
"is",
"the",
"associated",
"data",
"in",
"the",
"PI"
] | def processingInstruction(self, target, data):
"""called when a PI has been found, target contains the PI name and
data is the associated data in the PI"""
pass | [
"def",
"processingInstruction",
"(",
"self",
",",
"target",
",",
"data",
")",
":",
"pass"
] | https://github.com/KhronosGroup/OpenCOLLADA/blob/6031fa956e1da4bbdd910af3a8f9e924ef0fca7a/Externals/LibXML/python/libxml.py#L174-L177 | ||
pmq20/node-packer | 12c46c6e44fbc14d9ee645ebd17d5296b324f7e0 | lts/tools/gyp/pylib/gyp/xcodeproj_file.py | python | XCObject.Descendants | (self) | return descendants | Returns a list of all of this object's descendants, including this
object. | Returns a list of all of this object's descendants, including this
object. | [
"Returns",
"a",
"list",
"of",
"all",
"of",
"this",
"object",
"s",
"descendants",
"including",
"this",
"object",
"."
] | def Descendants(self):
"""Returns a list of all of this object's descendants, including this
object.
"""
children = self.Children()
descendants = [self]
for child in children:
descendants.extend(child.Descendants())
return descendants | [
"def",
"Descendants",
"(",
"self",
")",
":",
"children",
"=",
"self",
".",
"Children",
"(",
")",
"descendants",
"=",
"[",
"self",
"]",
"for",
"child",
"in",
"children",
":",
"descendants",
".",
"extend",
"(",
"child",
".",
"Descendants",
"(",
")",
")",... | https://github.com/pmq20/node-packer/blob/12c46c6e44fbc14d9ee645ebd17d5296b324f7e0/lts/tools/gyp/pylib/gyp/xcodeproj_file.py#L483-L492 | |
aws/lumberyard | f85344403c1c2e77ec8c75deb2c116e97b713217 | dev/Tools/AWSPythonSDK/1.5.8/docutils/utils/math/math2html.py | python | Globable.skipcurrent | (self) | return '' | Return the current character and skip it. | Return the current character and skip it. | [
"Return",
"the",
"current",
"character",
"and",
"skip",
"it",
"."
] | def skipcurrent(self):
"Return the current character and skip it."
Trace.error('Unimplemented skipcurrent()')
return '' | [
"def",
"skipcurrent",
"(",
"self",
")",
":",
"Trace",
".",
"error",
"(",
"'Unimplemented skipcurrent()'",
")",
"return",
"''"
] | https://github.com/aws/lumberyard/blob/f85344403c1c2e77ec8c75deb2c116e97b713217/dev/Tools/AWSPythonSDK/1.5.8/docutils/utils/math/math2html.py#L1859-L1862 | |
openvinotoolkit/openvino | dedcbeafa8b84cccdc55ca64b8da516682b381c7 | tools/mo/openvino/tools/mo/back/insert_compatibility_l2normalization.py | python | CompatibilityL2NormalizationPattern.replace_pattern | (self, graph: Graph, match: dict) | Adds Normalize layer weights, which are required by Inference Engine,
but do not always exist in MXNet model.
L2Normalization is mapped to Normalize layer
so we need to generate Normalize weights filled with ones.
Parameters
----------
graph : Graph
... | Adds Normalize layer weights, which are required by Inference Engine,
but do not always exist in MXNet model.
L2Normalization is mapped to Normalize layer
so we need to generate Normalize weights filled with ones.
Parameters
----------
graph : Graph
... | [
"Adds",
"Normalize",
"layer",
"weights",
"which",
"are",
"required",
"by",
"Inference",
"Engine",
"but",
"do",
"not",
"always",
"exist",
"in",
"MXNet",
"model",
".",
"L2Normalization",
"is",
"mapped",
"to",
"Normalize",
"layer",
"so",
"we",
"need",
"to",
"ge... | def replace_pattern(self, graph: Graph, match: dict):
"""
Adds Normalize layer weights, which are required by Inference Engine,
but do not always exist in MXNet model.
L2Normalization is mapped to Normalize layer
so we need to generate Normalize weights filled with one... | [
"def",
"replace_pattern",
"(",
"self",
",",
"graph",
":",
"Graph",
",",
"match",
":",
"dict",
")",
":",
"l2_normalization_node",
"=",
"match",
"[",
"'l2_normalization'",
"]",
"if",
"len",
"(",
"l2_normalization_node",
".",
"in_nodes",
"(",
")",
")",
"<",
"... | https://github.com/openvinotoolkit/openvino/blob/dedcbeafa8b84cccdc55ca64b8da516682b381c7/tools/mo/openvino/tools/mo/back/insert_compatibility_l2normalization.py#L22-L43 | ||
catboost/catboost | 167f64f237114a4d10b2b4ee42adb4569137debe | contrib/python/setuptools/py3/setuptools/_vendor/more_itertools/more.py | python | divide | (n, iterable) | return ret | Divide the elements from *iterable* into *n* parts, maintaining
order.
>>> group_1, group_2 = divide(2, [1, 2, 3, 4, 5, 6])
>>> list(group_1)
[1, 2, 3]
>>> list(group_2)
[4, 5, 6]
If the length of *iterable* is not evenly divisible by *n*, then the
length of the ret... | Divide the elements from *iterable* into *n* parts, maintaining
order. | [
"Divide",
"the",
"elements",
"from",
"*",
"iterable",
"*",
"into",
"*",
"n",
"*",
"parts",
"maintaining",
"order",
"."
] | def divide(n, iterable):
"""Divide the elements from *iterable* into *n* parts, maintaining
order.
>>> group_1, group_2 = divide(2, [1, 2, 3, 4, 5, 6])
>>> list(group_1)
[1, 2, 3]
>>> list(group_2)
[4, 5, 6]
If the length of *iterable* is not evenly divisible by *n*... | [
"def",
"divide",
"(",
"n",
",",
"iterable",
")",
":",
"if",
"n",
"<",
"1",
":",
"raise",
"ValueError",
"(",
"'n must be at least 1'",
")",
"try",
":",
"iterable",
"[",
":",
"0",
"]",
"except",
"TypeError",
":",
"seq",
"=",
"tuple",
"(",
"iterable",
"... | https://github.com/catboost/catboost/blob/167f64f237114a4d10b2b4ee42adb4569137debe/contrib/python/setuptools/py3/setuptools/_vendor/more_itertools/more.py#L1701-L1749 | |
nsnam/ns-3-dev-git | efdb2e21f45c0a87a60b47c547b68fa140a7b686 | waf-tools/cflags.py | python | CompilerTraits.get_optimization_flags | (self, level) | get_optimization_flags(level) -> list of cflags | get_optimization_flags(level) -> list of cflags | [
"get_optimization_flags",
"(",
"level",
")",
"-",
">",
"list",
"of",
"cflags"
] | def get_optimization_flags(self, level):
"""get_optimization_flags(level) -> list of cflags"""
raise NotImplementedError | [
"def",
"get_optimization_flags",
"(",
"self",
",",
"level",
")",
":",
"raise",
"NotImplementedError"
] | https://github.com/nsnam/ns-3-dev-git/blob/efdb2e21f45c0a87a60b47c547b68fa140a7b686/waf-tools/cflags.py#L9-L11 | ||
CRYTEK/CRYENGINE | 232227c59a220cbbd311576f0fbeba7bb53b2a8c | Editor/Python/windows/Lib/site-packages/pip/req/req_set.py | python | make_abstract_dist | (req_to_install) | Factory to make an abstract dist object.
Preconditions: Either an editable req with a source_dir, or satisfied_by or
a wheel link, or a non-editable req with a source_dir.
:return: A concrete DistAbstraction. | Factory to make an abstract dist object. | [
"Factory",
"to",
"make",
"an",
"abstract",
"dist",
"object",
"."
] | def make_abstract_dist(req_to_install):
"""Factory to make an abstract dist object.
Preconditions: Either an editable req with a source_dir, or satisfied_by or
a wheel link, or a non-editable req with a source_dir.
:return: A concrete DistAbstraction.
"""
if req_to_install.editable:
re... | [
"def",
"make_abstract_dist",
"(",
"req_to_install",
")",
":",
"if",
"req_to_install",
".",
"editable",
":",
"return",
"IsSDist",
"(",
"req_to_install",
")",
"elif",
"req_to_install",
".",
"link",
"and",
"req_to_install",
".",
"link",
".",
"is_wheel",
":",
"retur... | https://github.com/CRYTEK/CRYENGINE/blob/232227c59a220cbbd311576f0fbeba7bb53b2a8c/Editor/Python/windows/Lib/site-packages/pip/req/req_set.py#L84-L97 | ||
swift/swift | 12d031cf8177fdec0137f9aa7e2912fa23c4416b | 3rdParty/SCons/scons-3.0.1/engine/SCons/Tool/__init__.py | python | CreateLibSymlinks | (env, symlinks) | return 0 | Physically creates symlinks. The symlinks argument must be a list in
form [ (link, linktarget), ... ], where link and linktarget are SCons
nodes. | Physically creates symlinks. The symlinks argument must be a list in
form [ (link, linktarget), ... ], where link and linktarget are SCons
nodes. | [
"Physically",
"creates",
"symlinks",
".",
"The",
"symlinks",
"argument",
"must",
"be",
"a",
"list",
"in",
"form",
"[",
"(",
"link",
"linktarget",
")",
"...",
"]",
"where",
"link",
"and",
"linktarget",
"are",
"SCons",
"nodes",
"."
] | def CreateLibSymlinks(env, symlinks):
"""Physically creates symlinks. The symlinks argument must be a list in
form [ (link, linktarget), ... ], where link and linktarget are SCons
nodes.
"""
Verbose = False
for link, linktgt in symlinks:
linktgt = link.get_dir().rel_path(linktgt)
... | [
"def",
"CreateLibSymlinks",
"(",
"env",
",",
"symlinks",
")",
":",
"Verbose",
"=",
"False",
"for",
"link",
",",
"linktgt",
"in",
"symlinks",
":",
"linktgt",
"=",
"link",
".",
"get_dir",
"(",
")",
".",
"rel_path",
"(",
"linktgt",
")",
"link",
"=",
"link... | https://github.com/swift/swift/blob/12d031cf8177fdec0137f9aa7e2912fa23c4416b/3rdParty/SCons/scons-3.0.1/engine/SCons/Tool/__init__.py#L735-L758 | |
NREL/EnergyPlus | fadc5973b85c70e8cc923efb69c144e808a26078 | src/EnergyPlus/api/runtime.py | python | Runtime.callback_end_zone_sizing | (self, state: c_void_p, f: FunctionType) | This function allows a client to register a function to be called back by EnergyPlus at the end of the zone
sizing process.
:param state: An active EnergyPlus "state" that is returned from a call to `api.state_manager.new_state()`.
:param f: A python function which takes one argument, the curre... | This function allows a client to register a function to be called back by EnergyPlus at the end of the zone
sizing process. | [
"This",
"function",
"allows",
"a",
"client",
"to",
"register",
"a",
"function",
"to",
"be",
"called",
"back",
"by",
"EnergyPlus",
"at",
"the",
"end",
"of",
"the",
"zone",
"sizing",
"process",
"."
] | def callback_end_zone_sizing(self, state: c_void_p, f: FunctionType) -> None:
"""
This function allows a client to register a function to be called back by EnergyPlus at the end of the zone
sizing process.
:param state: An active EnergyPlus "state" that is returned from a call to `api.s... | [
"def",
"callback_end_zone_sizing",
"(",
"self",
",",
"state",
":",
"c_void_p",
",",
"f",
":",
"FunctionType",
")",
"->",
"None",
":",
"self",
".",
"_check_callback_args",
"(",
"f",
",",
"1",
",",
"'callback_end_zone_sizing'",
")",
"cb_ptr",
"=",
"self",
".",... | https://github.com/NREL/EnergyPlus/blob/fadc5973b85c70e8cc923efb69c144e808a26078/src/EnergyPlus/api/runtime.py#L512-L524 | ||
kamyu104/LeetCode-Solutions | 77605708a927ea3b85aee5a479db733938c7c211 | Python/add-to-array-form-of-integer.py | python | Solution.addToArrayForm | (self, A, K) | return A | :type A: List[int]
:type K: int
:rtype: List[int] | :type A: List[int]
:type K: int
:rtype: List[int] | [
":",
"type",
"A",
":",
"List",
"[",
"int",
"]",
":",
"type",
"K",
":",
"int",
":",
"rtype",
":",
"List",
"[",
"int",
"]"
] | def addToArrayForm(self, A, K):
"""
:type A: List[int]
:type K: int
:rtype: List[int]
"""
A.reverse()
carry, i = K, 0
A[i] += carry
carry, A[i] = divmod(A[i], 10)
while carry:
i += 1
if i < len(A):
A[... | [
"def",
"addToArrayForm",
"(",
"self",
",",
"A",
",",
"K",
")",
":",
"A",
".",
"reverse",
"(",
")",
"carry",
",",
"i",
"=",
"K",
",",
"0",
"A",
"[",
"i",
"]",
"+=",
"carry",
"carry",
",",
"A",
"[",
"i",
"]",
"=",
"divmod",
"(",
"A",
"[",
"... | https://github.com/kamyu104/LeetCode-Solutions/blob/77605708a927ea3b85aee5a479db733938c7c211/Python/add-to-array-form-of-integer.py#L5-L23 | |
hanpfei/chromium-net | 392cc1fa3a8f92f42e4071ab6e674d8e0482f83f | third_party/catapult/telemetry/third_party/pyfakefs/pyfakefs/fake_filesystem.py | python | FakeOsModule.read | (self, file_des, num_bytes) | return fh.read(num_bytes) | Reads number of bytes from a file descriptor, returns bytes read.
Args:
file_des: An integer file descriptor for the file object requested.
num_bytes: Number of bytes to read from file.
Returns:
Bytes read from file.
Raises:
OSError: bad file descriptor.
TypeError: if file d... | Reads number of bytes from a file descriptor, returns bytes read. | [
"Reads",
"number",
"of",
"bytes",
"from",
"a",
"file",
"descriptor",
"returns",
"bytes",
"read",
"."
] | def read(self, file_des, num_bytes):
"""Reads number of bytes from a file descriptor, returns bytes read.
Args:
file_des: An integer file descriptor for the file object requested.
num_bytes: Number of bytes to read from file.
Returns:
Bytes read from file.
Raises:
OSError: bad... | [
"def",
"read",
"(",
"self",
",",
"file_des",
",",
"num_bytes",
")",
":",
"fh",
"=",
"self",
".",
"filesystem",
".",
"GetOpenFile",
"(",
"file_des",
")",
"return",
"fh",
".",
"read",
"(",
"num_bytes",
")"
] | https://github.com/hanpfei/chromium-net/blob/392cc1fa3a8f92f42e4071ab6e674d8e0482f83f/third_party/catapult/telemetry/third_party/pyfakefs/pyfakefs/fake_filesystem.py#L1254-L1269 | |
tangzhenyu/Scene-Text-Understanding | 0f7ffc7aea5971a50cdc03d33d0a41075285948b | ctpn_crnn_ocr/CTPN/caffe/scripts/cpp_lint.py | python | ReverseCloseExpression | (clean_lines, linenum, pos) | return (line, 0, -1) | If input points to ) or } or ] or >, finds the position that opens it.
If lines[linenum][pos] points to a ')' or '}' or ']' or '>', finds the
linenum/pos that correspond to the opening of the expression.
Args:
clean_lines: A CleansedLines instance containing the file.
linenum: The number of the line to ... | If input points to ) or } or ] or >, finds the position that opens it. | [
"If",
"input",
"points",
"to",
")",
"or",
"}",
"or",
"]",
"or",
">",
"finds",
"the",
"position",
"that",
"opens",
"it",
"."
] | def ReverseCloseExpression(clean_lines, linenum, pos):
"""If input points to ) or } or ] or >, finds the position that opens it.
If lines[linenum][pos] points to a ')' or '}' or ']' or '>', finds the
linenum/pos that correspond to the opening of the expression.
Args:
clean_lines: A CleansedLines instance ... | [
"def",
"ReverseCloseExpression",
"(",
"clean_lines",
",",
"linenum",
",",
"pos",
")",
":",
"line",
"=",
"clean_lines",
".",
"elided",
"[",
"linenum",
"]",
"endchar",
"=",
"line",
"[",
"pos",
"]",
"if",
"endchar",
"not",
"in",
"')}]>'",
":",
"return",
"("... | https://github.com/tangzhenyu/Scene-Text-Understanding/blob/0f7ffc7aea5971a50cdc03d33d0a41075285948b/ctpn_crnn_ocr/CTPN/caffe/scripts/cpp_lint.py#L1327-L1369 | |
facebook/fboss | 60063db1df37c2ec0e7dcd0955c54885ea9bf7f0 | build/fbcode_builder/getdeps/builder.py | python | BuilderBase.run_tests | (
self, install_dirs, schedule_type, owner, test_filter, retry, no_testpilot
) | Execute any tests that we know how to run. If they fail,
raise an exception. | Execute any tests that we know how to run. If they fail,
raise an exception. | [
"Execute",
"any",
"tests",
"that",
"we",
"know",
"how",
"to",
"run",
".",
"If",
"they",
"fail",
"raise",
"an",
"exception",
"."
] | def run_tests(
self, install_dirs, schedule_type, owner, test_filter, retry, no_testpilot
):
"""Execute any tests that we know how to run. If they fail,
raise an exception."""
pass | [
"def",
"run_tests",
"(",
"self",
",",
"install_dirs",
",",
"schedule_type",
",",
"owner",
",",
"test_filter",
",",
"retry",
",",
"no_testpilot",
")",
":",
"pass"
] | https://github.com/facebook/fboss/blob/60063db1df37c2ec0e7dcd0955c54885ea9bf7f0/build/fbcode_builder/getdeps/builder.py#L109-L114 | ||
benoitsteiner/tensorflow-opencl | cb7cb40a57fde5cfd4731bc551e82a1e2fef43a5 | tensorflow/python/ops/linalg/linear_operator_util.py | python | shape_tensor | (shape, name=None) | return ops.convert_to_tensor(shape, dtype=dtype, name=name) | Convert Tensor using default type, unless empty list or tuple. | Convert Tensor using default type, unless empty list or tuple. | [
"Convert",
"Tensor",
"using",
"default",
"type",
"unless",
"empty",
"list",
"or",
"tuple",
"."
] | def shape_tensor(shape, name=None):
"""Convert Tensor using default type, unless empty list or tuple."""
# Works just like random_ops._ShapeTensor.
if isinstance(shape, (tuple, list)) and not shape:
dtype = dtypes.int32
else:
dtype = None
return ops.convert_to_tensor(shape, dtype=dtype, name=name) | [
"def",
"shape_tensor",
"(",
"shape",
",",
"name",
"=",
"None",
")",
":",
"# Works just like random_ops._ShapeTensor.",
"if",
"isinstance",
"(",
"shape",
",",
"(",
"tuple",
",",
"list",
")",
")",
"and",
"not",
"shape",
":",
"dtype",
"=",
"dtypes",
".",
"int... | https://github.com/benoitsteiner/tensorflow-opencl/blob/cb7cb40a57fde5cfd4731bc551e82a1e2fef43a5/tensorflow/python/ops/linalg/linear_operator_util.py#L292-L299 | |
mindspore-ai/mindspore | fb8fd3338605bb34fa5cea054e535a8b1d753fab | mindspore/python/mindspore/ops/operations/nn_ops.py | python | _check_shape | (arg_name, arg_value, prim_name) | return arg_value | Checks whether an shape dims is a positive int elements. | Checks whether an shape dims is a positive int elements. | [
"Checks",
"whether",
"an",
"shape",
"dims",
"is",
"a",
"positive",
"int",
"elements",
"."
] | def _check_shape(arg_name, arg_value, prim_name):
"""
Checks whether an shape dims is a positive int elements.
"""
def _raise_message():
raise ValueError(f"For '{prim_name}' attr '{arg_name}' dims elements should be positive int numbers, "
f"but got {arg_value}")
v... | [
"def",
"_check_shape",
"(",
"arg_name",
",",
"arg_value",
",",
"prim_name",
")",
":",
"def",
"_raise_message",
"(",
")",
":",
"raise",
"ValueError",
"(",
"f\"For '{prim_name}' attr '{arg_name}' dims elements should be positive int numbers, \"",
"f\"but got {arg_value}\"",
")"... | https://github.com/mindspore-ai/mindspore/blob/fb8fd3338605bb34fa5cea054e535a8b1d753fab/mindspore/python/mindspore/ops/operations/nn_ops.py#L63-L77 | |
benoitsteiner/tensorflow-opencl | cb7cb40a57fde5cfd4731bc551e82a1e2fef43a5 | tensorflow/examples/learn/mnist.py | python | conv_model | (features, labels, mode) | return tf.estimator.EstimatorSpec(
mode, loss=loss, eval_metric_ops=eval_metric_ops) | 2-layer convolution model. | 2-layer convolution model. | [
"2",
"-",
"layer",
"convolution",
"model",
"."
] | def conv_model(features, labels, mode):
"""2-layer convolution model."""
# Reshape feature to 4d tensor with 2nd and 3rd dimensions being
# image width and height final dimension being the number of color channels.
feature = tf.reshape(features[X_FEATURE], [-1, 28, 28, 1])
# First conv layer will compute 32 ... | [
"def",
"conv_model",
"(",
"features",
",",
"labels",
",",
"mode",
")",
":",
"# Reshape feature to 4d tensor with 2nd and 3rd dimensions being",
"# image width and height final dimension being the number of color channels.",
"feature",
"=",
"tf",
".",
"reshape",
"(",
"features",
... | https://github.com/benoitsteiner/tensorflow-opencl/blob/cb7cb40a57fde5cfd4731bc551e82a1e2fef43a5/tensorflow/examples/learn/mnist.py#L32-L96 | |
snyball/Hawck | 625d840a9ac6f15d067d8307e2bd1a6930693a8b | hawck-ui/hawck_ui/window.py | python | HawckMainWindow.initSettings | (self) | Set settings | Set settings | [
"Set",
"settings"
] | def initSettings(self):
"""
Set settings
"""
autostart_path = os.path.join(os.getenv("HOME"), ".config", "autostart", "hawck-macrod.desktop")
auto_enabled = os.path.exists(autostart_path)
auto_sw = self.builder.get_object("autostart_switch")
auto_sw.handler_block_... | [
"def",
"initSettings",
"(",
"self",
")",
":",
"autostart_path",
"=",
"os",
".",
"path",
".",
"join",
"(",
"os",
".",
"getenv",
"(",
"\"HOME\"",
")",
",",
"\".config\"",
",",
"\"autostart\"",
",",
"\"hawck-macrod.desktop\"",
")",
"auto_enabled",
"=",
"os",
... | https://github.com/snyball/Hawck/blob/625d840a9ac6f15d067d8307e2bd1a6930693a8b/hawck-ui/hawck_ui/window.py#L377-L387 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.