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 |
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
hcdth011/ROS-Hydro-SLAM | 629448eecd2c9a3511158115fa53ea9e4ae41359 | rpg_vikit/vikit_py/src/vikit_py/transformations.py | python | euler_matrix | (ai, aj, ak, axes='sxyz') | return M | Return homogeneous rotation matrix from Euler angles and axis sequence.
ai, aj, ak : Euler's roll, pitch and yaw angles
axes : One of 24 axis sequences as string or encoded tuple
>>> R = euler_matrix(1, 2, 3, 'syxz')
>>> numpy.allclose(numpy.sum(R[0]), -1.34786452)
True
>>> R = euler_matrix(1,... | Return homogeneous rotation matrix from Euler angles and axis sequence. | [
"Return",
"homogeneous",
"rotation",
"matrix",
"from",
"Euler",
"angles",
"and",
"axis",
"sequence",
"."
] | def euler_matrix(ai, aj, ak, axes='sxyz'):
"""Return homogeneous rotation matrix from Euler angles and axis sequence.
ai, aj, ak : Euler's roll, pitch and yaw angles
axes : One of 24 axis sequences as string or encoded tuple
>>> R = euler_matrix(1, 2, 3, 'syxz')
>>> numpy.allclose(numpy.sum(R[0]),... | [
"def",
"euler_matrix",
"(",
"ai",
",",
"aj",
",",
"ak",
",",
"axes",
"=",
"'sxyz'",
")",
":",
"try",
":",
"firstaxis",
",",
"parity",
",",
"repetition",
",",
"frame",
"=",
"_AXES2TUPLE",
"[",
"axes",
"]",
"except",
"(",
"AttributeError",
",",
"KeyError... | https://github.com/hcdth011/ROS-Hydro-SLAM/blob/629448eecd2c9a3511158115fa53ea9e4ae41359/rpg_vikit/vikit_py/src/vikit_py/transformations.py#L972-L1032 | |
asLody/whale | 6a661b27cc4cf83b7b5a3b02451597ee1ac7f264 | whale/cpplint.py | python | CheckStyle | (filename, clean_lines, linenum, file_extension, nesting_state,
error) | Checks rules from the 'C++ style rules' section of cppguide.html.
Most of these rules are hard to test (naming, comment style), but we
do what we can. In particular we check for 2-space indents, line lengths,
tab usage, spaces inside code, etc.
Args:
filename: The name of the current file.
clean_line... | Checks rules from the 'C++ style rules' section of cppguide.html. | [
"Checks",
"rules",
"from",
"the",
"C",
"++",
"style",
"rules",
"section",
"of",
"cppguide",
".",
"html",
"."
] | def CheckStyle(filename, clean_lines, linenum, file_extension, nesting_state,
error):
"""Checks rules from the 'C++ style rules' section of cppguide.html.
Most of these rules are hard to test (naming, comment style), but we
do what we can. In particular we check for 2-space indents, line lengths,... | [
"def",
"CheckStyle",
"(",
"filename",
",",
"clean_lines",
",",
"linenum",
",",
"file_extension",
",",
"nesting_state",
",",
"error",
")",
":",
"# Don't use \"elided\" lines here, otherwise we can't check commented lines.",
"# Don't want to use \"raw\" either, because we don't want ... | https://github.com/asLody/whale/blob/6a661b27cc4cf83b7b5a3b02451597ee1ac7f264/whale/cpplint.py#L4311-L4427 | ||
papyrussolution/OpenPapyrus | bbfb5ec2ea2109b8e2f125edd838e12eaf7b8b91 | Src/OSF/protobuf-3.19.1/python/google/protobuf/descriptor_pool.py | python | DescriptorPool.FindExtensionByNumber | (self, message_descriptor, number) | Gets the extension of the specified message with the specified number.
Extensions have to be registered to this pool by calling :func:`Add` or
:func:`AddExtensionDescriptor`.
Args:
message_descriptor (Descriptor): descriptor of the extended message.
number (int): Number of the extension field.... | Gets the extension of the specified message with the specified number. | [
"Gets",
"the",
"extension",
"of",
"the",
"specified",
"message",
"with",
"the",
"specified",
"number",
"."
] | def FindExtensionByNumber(self, message_descriptor, number):
"""Gets the extension of the specified message with the specified number.
Extensions have to be registered to this pool by calling :func:`Add` or
:func:`AddExtensionDescriptor`.
Args:
message_descriptor (Descriptor): descriptor of the ... | [
"def",
"FindExtensionByNumber",
"(",
"self",
",",
"message_descriptor",
",",
"number",
")",
":",
"try",
":",
"return",
"self",
".",
"_extensions_by_number",
"[",
"message_descriptor",
"]",
"[",
"number",
"]",
"except",
"KeyError",
":",
"self",
".",
"_TryLoadExte... | https://github.com/papyrussolution/OpenPapyrus/blob/bbfb5ec2ea2109b8e2f125edd838e12eaf7b8b91/Src/OSF/protobuf-3.19.1/python/google/protobuf/descriptor_pool.py#L601-L622 | ||
gem5/gem5 | 141cc37c2d4b93959d4c249b8f7e6a8b2ef75338 | src/arch/isa_parser/isa_parser.py | python | ISAParser.p_decode_stmt_format | (self, t) | decode_stmt : FORMAT push_format_id LBRACE decode_stmt_list RBRACE | decode_stmt : FORMAT push_format_id LBRACE decode_stmt_list RBRACE | [
"decode_stmt",
":",
"FORMAT",
"push_format_id",
"LBRACE",
"decode_stmt_list",
"RBRACE"
] | def p_decode_stmt_format(self, t):
'decode_stmt : FORMAT push_format_id LBRACE decode_stmt_list RBRACE'
# The format will be pushed on the stack when 'push_format_id'
# is processed (see below). Once the parser has recognized
# the full production (though the right brace), we're done
... | [
"def",
"p_decode_stmt_format",
"(",
"self",
",",
"t",
")",
":",
"# The format will be pushed on the stack when 'push_format_id'",
"# is processed (see below). Once the parser has recognized",
"# the full production (though the right brace), we're done",
"# with the format, so now we can pop i... | https://github.com/gem5/gem5/blob/141cc37c2d4b93959d4c249b8f7e6a8b2ef75338/src/arch/isa_parser/isa_parser.py#L1238-L1245 | ||
mantidproject/mantid | 03deeb89254ec4289edb8771e0188c2090a02f32 | qt/applications/workbench/workbench/app/mainwindow.py | python | MainWindow.post_mantid_init | (self) | Run any setup that requires mantid
to have been initialized | Run any setup that requires mantid
to have been initialized | [
"Run",
"any",
"setup",
"that",
"requires",
"mantid",
"to",
"have",
"been",
"initialized"
] | def post_mantid_init(self):
"""Run any setup that requires mantid
to have been initialized
"""
self.redirect_python_warnings()
self.populate_menus()
self.algorithm_selector.refresh()
# turn on algorithm factory notifications
from mantid.api import Algorit... | [
"def",
"post_mantid_init",
"(",
"self",
")",
":",
"self",
".",
"redirect_python_warnings",
"(",
")",
"self",
".",
"populate_menus",
"(",
")",
"self",
".",
"algorithm_selector",
".",
"refresh",
"(",
")",
"# turn on algorithm factory notifications",
"from",
"mantid",
... | https://github.com/mantidproject/mantid/blob/03deeb89254ec4289edb8771e0188c2090a02f32/qt/applications/workbench/workbench/app/mainwindow.py#L230-L241 | ||
cvxpy/cvxpy | 5165b4fb750dfd237de8659383ef24b4b2e33aaf | cvxpy/transforms/indicator.py | python | indicator.is_constant | (self) | return all([arg.is_constant() for arg in all_args]) | The Indicator is constant if all constraints have constant args. | The Indicator is constant if all constraints have constant args. | [
"The",
"Indicator",
"is",
"constant",
"if",
"all",
"constraints",
"have",
"constant",
"args",
"."
] | def is_constant(self) -> bool:
"""The Indicator is constant if all constraints have constant args.
"""
all_args = sum([c.args for c in self.args], [])
return all([arg.is_constant() for arg in all_args]) | [
"def",
"is_constant",
"(",
"self",
")",
"->",
"bool",
":",
"all_args",
"=",
"sum",
"(",
"[",
"c",
".",
"args",
"for",
"c",
"in",
"self",
".",
"args",
"]",
",",
"[",
"]",
")",
"return",
"all",
"(",
"[",
"arg",
".",
"is_constant",
"(",
")",
"for"... | https://github.com/cvxpy/cvxpy/blob/5165b4fb750dfd237de8659383ef24b4b2e33aaf/cvxpy/transforms/indicator.py#L44-L48 | |
mantidproject/mantid | 03deeb89254ec4289edb8771e0188c2090a02f32 | qt/python/mantidqtinterfaces/mantidqtinterfaces/Muon/GUI/Common/results_tab_widget/results_tab_widget.py | python | ResultsTabWidget.__init__ | (self, fit_context, context, parent) | Initialize the widget.
:param fit_context: A reference to the a FitContext object used to store fit results
:param parent: A parent widget for the view | Initialize the widget.
:param fit_context: A reference to the a FitContext object used to store fit results
:param parent: A parent widget for the view | [
"Initialize",
"the",
"widget",
".",
":",
"param",
"fit_context",
":",
"A",
"reference",
"to",
"the",
"a",
"FitContext",
"object",
"used",
"to",
"store",
"fit",
"results",
":",
"param",
"parent",
":",
"A",
"parent",
"widget",
"for",
"the",
"view"
] | def __init__(self, fit_context, context, parent):
"""
Initialize the widget.
:param fit_context: A reference to the a FitContext object used to store fit results
:param parent: A parent widget for the view
"""
self.results_tab_view = ResultsTabView(parent=parent)
... | [
"def",
"__init__",
"(",
"self",
",",
"fit_context",
",",
"context",
",",
"parent",
")",
":",
"self",
".",
"results_tab_view",
"=",
"ResultsTabView",
"(",
"parent",
"=",
"parent",
")",
"self",
".",
"results_tab_presenter",
"=",
"ResultsTabPresenter",
"(",
"self... | https://github.com/mantidproject/mantid/blob/03deeb89254ec4289edb8771e0188c2090a02f32/qt/python/mantidqtinterfaces/mantidqtinterfaces/Muon/GUI/Common/results_tab_widget/results_tab_widget.py#L15-L26 | ||
cinder/Cinder | e83f5bb9c01a63eec20168d02953a0879e5100f7 | docs/libs/markdown/extensions/abbr.py | python | AbbrPreprocessor._generate_pattern | (self, text) | return r'(?P<abbr>\b%s\b)' % (r''.join(chars)) | Given a string, returns an regex pattern to match that string.
'HTML' -> r'(?P<abbr>[H][T][M][L])'
Note: we force each char as a literal match (in brackets) as we don't
know what they will be beforehand. | Given a string, returns an regex pattern to match that string. | [
"Given",
"a",
"string",
"returns",
"an",
"regex",
"pattern",
"to",
"match",
"that",
"string",
"."
] | def _generate_pattern(self, text):
'''
Given a string, returns an regex pattern to match that string.
'HTML' -> r'(?P<abbr>[H][T][M][L])'
Note: we force each char as a literal match (in brackets) as we don't
know what they will be beforehand.
'''
chars = list(t... | [
"def",
"_generate_pattern",
"(",
"self",
",",
"text",
")",
":",
"chars",
"=",
"list",
"(",
"text",
")",
"for",
"i",
"in",
"range",
"(",
"len",
"(",
"chars",
")",
")",
":",
"chars",
"[",
"i",
"]",
"=",
"r'[%s]'",
"%",
"chars",
"[",
"i",
"]",
"re... | https://github.com/cinder/Cinder/blob/e83f5bb9c01a63eec20168d02953a0879e5100f7/docs/libs/markdown/extensions/abbr.py#L60-L73 | |
snap-stanford/snap-python | d53c51b0a26aa7e3e7400b014cdf728948fde80a | setup/snap.py | python | TCs.GetCsFromBf | (*args) | return _snap.TCs_GetCsFromBf(*args) | GetCsFromBf(char * Bf, int const & BfL) -> TCs
Parameters:
Bf: char *
BfL: int const & | GetCsFromBf(char * Bf, int const & BfL) -> TCs | [
"GetCsFromBf",
"(",
"char",
"*",
"Bf",
"int",
"const",
"&",
"BfL",
")",
"-",
">",
"TCs"
] | def GetCsFromBf(*args):
"""
GetCsFromBf(char * Bf, int const & BfL) -> TCs
Parameters:
Bf: char *
BfL: int const &
"""
return _snap.TCs_GetCsFromBf(*args) | [
"def",
"GetCsFromBf",
"(",
"*",
"args",
")",
":",
"return",
"_snap",
".",
"TCs_GetCsFromBf",
"(",
"*",
"args",
")"
] | https://github.com/snap-stanford/snap-python/blob/d53c51b0a26aa7e3e7400b014cdf728948fde80a/setup/snap.py#L1704-L1713 | |
weolar/miniblink49 | 1c4678db0594a4abde23d3ebbcc7cd13c3170777 | third_party/jinja2/lexer.py | python | Lexer.tokenize | (self, source, name=None, filename=None, state=None) | return TokenStream(self.wrap(stream, name, filename), name, filename) | Calls tokeniter + tokenize and wraps it in a token stream. | Calls tokeniter + tokenize and wraps it in a token stream. | [
"Calls",
"tokeniter",
"+",
"tokenize",
"and",
"wraps",
"it",
"in",
"a",
"token",
"stream",
"."
] | def tokenize(self, source, name=None, filename=None, state=None):
"""Calls tokeniter + tokenize and wraps it in a token stream.
"""
stream = self.tokeniter(source, name, filename, state)
return TokenStream(self.wrap(stream, name, filename), name, filename) | [
"def",
"tokenize",
"(",
"self",
",",
"source",
",",
"name",
"=",
"None",
",",
"filename",
"=",
"None",
",",
"state",
"=",
"None",
")",
":",
"stream",
"=",
"self",
".",
"tokeniter",
"(",
"source",
",",
"name",
",",
"filename",
",",
"state",
")",
"re... | https://github.com/weolar/miniblink49/blob/1c4678db0594a4abde23d3ebbcc7cd13c3170777/third_party/jinja2/lexer.py#L542-L546 | |
mindspore-ai/mindspore | fb8fd3338605bb34fa5cea054e535a8b1d753fab | mindspore/python/mindspore/nn/probability/distribution/log_normal.py | python | LogNormal._cdf | (self, value, loc=None, scale=None) | return self.select(self.greater(value, 0.), cdf, zeros) | r"""
Compute the cdf via the below formula,
where g is the exp bijector,
and P is the cdf of the underlying normal dist
.. math::
Y = g(X)
P(Y <= a) = P(X <= g^{-1}(a)) | r"""
Compute the cdf via the below formula,
where g is the exp bijector,
and P is the cdf of the underlying normal dist
.. math::
Y = g(X)
P(Y <= a) = P(X <= g^{-1}(a)) | [
"r",
"Compute",
"the",
"cdf",
"via",
"the",
"below",
"formula",
"where",
"g",
"is",
"the",
"exp",
"bijector",
"and",
"P",
"is",
"the",
"cdf",
"of",
"the",
"underlying",
"normal",
"dist",
"..",
"math",
"::",
"Y",
"=",
"g",
"(",
"X",
")",
"P",
"(",
... | def _cdf(self, value, loc=None, scale=None):
r"""
Compute the cdf via the below formula,
where g is the exp bijector,
and P is the cdf of the underlying normal dist
.. math::
Y = g(X)
P(Y <= a) = P(X <= g^{-1}(a))
"""
mean, sd = self._check... | [
"def",
"_cdf",
"(",
"self",
",",
"value",
",",
"loc",
"=",
"None",
",",
"scale",
"=",
"None",
")",
":",
"mean",
",",
"sd",
"=",
"self",
".",
"_check_param_type",
"(",
"loc",
",",
"scale",
")",
"inverse_value",
"=",
"self",
".",
"bijector",
"(",
"\"... | https://github.com/mindspore-ai/mindspore/blob/fb8fd3338605bb34fa5cea054e535a8b1d753fab/mindspore/python/mindspore/nn/probability/distribution/log_normal.py#L204-L220 | |
intel/llvm | e6d0547e9d99b5a56430c4749f6c7e328bf221ab | clang/tools/scan-build-py/lib/libscanbuild/__init__.py | python | command_entry_point | (function) | return wrapper | Decorator for command entry methods.
The decorator initialize/shutdown logging and guard on programming
errors (catch exceptions).
The decorated method can have arbitrary parameters, the return value will
be the exit code of the process. | Decorator for command entry methods. | [
"Decorator",
"for",
"command",
"entry",
"methods",
"."
] | def command_entry_point(function):
""" Decorator for command entry methods.
The decorator initialize/shutdown logging and guard on programming
errors (catch exceptions).
The decorated method can have arbitrary parameters, the return value will
be the exit code of the process. """
@functools.w... | [
"def",
"command_entry_point",
"(",
"function",
")",
":",
"@",
"functools",
".",
"wraps",
"(",
"function",
")",
"def",
"wrapper",
"(",
"*",
"args",
",",
"*",
"*",
"kwargs",
")",
":",
"\"\"\" Do housekeeping tasks and execute the wrapped method. \"\"\"",
"try",
":",... | https://github.com/intel/llvm/blob/e6d0547e9d99b5a56430c4749f6c7e328bf221ab/clang/tools/scan-build-py/lib/libscanbuild/__init__.py#L106-L141 | |
eventql/eventql | 7ca0dbb2e683b525620ea30dc40540a22d5eb227 | deps/3rdparty/spidermonkey/mozjs/media/webrtc/trunk/tools/gyp/pylib/gyp/xcodeproj_file.py | python | SourceTreeAndPathFromPath | (input_path) | return (source_tree, output_path) | Given input_path, returns a tuple with sourceTree and path values.
Examples:
input_path (source_tree, output_path)
'$(VAR)/path' ('VAR', 'path')
'$(VAR)' ('VAR', None)
'path' (None, 'path') | Given input_path, returns a tuple with sourceTree and path values. | [
"Given",
"input_path",
"returns",
"a",
"tuple",
"with",
"sourceTree",
"and",
"path",
"values",
"."
] | def SourceTreeAndPathFromPath(input_path):
"""Given input_path, returns a tuple with sourceTree and path values.
Examples:
input_path (source_tree, output_path)
'$(VAR)/path' ('VAR', 'path')
'$(VAR)' ('VAR', None)
'path' (None, 'path')
"""
source_group_match = _path_leading_... | [
"def",
"SourceTreeAndPathFromPath",
"(",
"input_path",
")",
":",
"source_group_match",
"=",
"_path_leading_variable",
".",
"match",
"(",
"input_path",
")",
"if",
"source_group_match",
":",
"source_tree",
"=",
"source_group_match",
".",
"group",
"(",
"1",
")",
"outpu... | https://github.com/eventql/eventql/blob/7ca0dbb2e683b525620ea30dc40540a22d5eb227/deps/3rdparty/spidermonkey/mozjs/media/webrtc/trunk/tools/gyp/pylib/gyp/xcodeproj_file.py#L178-L196 | |
mickem/nscp | 79f89fdbb6da63f91bc9dedb7aea202fe938f237 | scripts/python/lib/google/protobuf/internal/containers.py | python | RepeatedScalarFieldContainer.insert | (self, key, value) | Inserts the item at the specified position. Similar to list.insert(). | Inserts the item at the specified position. Similar to list.insert(). | [
"Inserts",
"the",
"item",
"at",
"the",
"specified",
"position",
".",
"Similar",
"to",
"list",
".",
"insert",
"()",
"."
] | def insert(self, key, value):
"""Inserts the item at the specified position. Similar to list.insert()."""
self._type_checker.CheckValue(value)
self._values.insert(key, value)
if not self._message_listener.dirty:
self._message_listener.Modified() | [
"def",
"insert",
"(",
"self",
",",
"key",
",",
"value",
")",
":",
"self",
".",
"_type_checker",
".",
"CheckValue",
"(",
"value",
")",
"self",
".",
"_values",
".",
"insert",
"(",
"key",
",",
"value",
")",
"if",
"not",
"self",
".",
"_message_listener",
... | https://github.com/mickem/nscp/blob/79f89fdbb6da63f91bc9dedb7aea202fe938f237/scripts/python/lib/google/protobuf/internal/containers.py#L111-L116 | ||
timi-liuliang/echo | 40a5a24d430eee4118314459ab7e03afcb3b8719 | thirdparty/protobuf/python/google/protobuf/internal/cpp_message.py | python | RepeatedCompositeProperty | (cdescriptor, message_type) | return property(Getter, Setter, doc=doc) | Returns a Python property for the given repeated composite field. | Returns a Python property for the given repeated composite field. | [
"Returns",
"a",
"Python",
"property",
"for",
"the",
"given",
"repeated",
"composite",
"field",
"."
] | def RepeatedCompositeProperty(cdescriptor, message_type):
"""Returns a Python property for the given repeated composite field."""
def Getter(self):
container = self._composite_fields.get(cdescriptor.name, None)
if container is None:
container = RepeatedCompositeContainer(
self, cdescriptor,... | [
"def",
"RepeatedCompositeProperty",
"(",
"cdescriptor",
",",
"message_type",
")",
":",
"def",
"Getter",
"(",
"self",
")",
":",
"container",
"=",
"self",
".",
"_composite_fields",
".",
"get",
"(",
"cdescriptor",
".",
"name",
",",
"None",
")",
"if",
"container... | https://github.com/timi-liuliang/echo/blob/40a5a24d430eee4118314459ab7e03afcb3b8719/thirdparty/protobuf/python/google/protobuf/internal/cpp_message.py#L274-L290 | |
wxWidgets/wxPython-Classic | 19571e1ae65f1ac445f5491474121998c97a1bf0 | src/gtk/wizard.py | python | PyWizardPage.Create | (*args, **kwargs) | return _wizard.PyWizardPage_Create(*args, **kwargs) | Create(self, Wizard parent, Bitmap bitmap=wxNullBitmap) -> bool | Create(self, Wizard parent, Bitmap bitmap=wxNullBitmap) -> bool | [
"Create",
"(",
"self",
"Wizard",
"parent",
"Bitmap",
"bitmap",
"=",
"wxNullBitmap",
")",
"-",
">",
"bool"
] | def Create(*args, **kwargs):
"""Create(self, Wizard parent, Bitmap bitmap=wxNullBitmap) -> bool"""
return _wizard.PyWizardPage_Create(*args, **kwargs) | [
"def",
"Create",
"(",
"*",
"args",
",",
"*",
"*",
"kwargs",
")",
":",
"return",
"_wizard",
".",
"PyWizardPage_Create",
"(",
"*",
"args",
",",
"*",
"*",
"kwargs",
")"
] | https://github.com/wxWidgets/wxPython-Classic/blob/19571e1ae65f1ac445f5491474121998c97a1bf0/src/gtk/wizard.py#L143-L145 | |
tfwu/FaceDetection-ConvNet-3D | f9251c48eb40c5aec8fba7455115c355466555be | example/multi-task/data.py | python | mnist_iterator | (batch_size, input_shape) | return (train_dataiter, val_dataiter) | return train and val iterators for mnist | return train and val iterators for mnist | [
"return",
"train",
"and",
"val",
"iterators",
"for",
"mnist"
] | def mnist_iterator(batch_size, input_shape):
"""return train and val iterators for mnist"""
# download data
get_data.GetMNIST_ubyte()
flat = False if len(input_shape) == 3 else True
train_dataiter = mx.io.MNISTIter(
image="data/train-images-idx3-ubyte",
label="data/train-labels-idx1... | [
"def",
"mnist_iterator",
"(",
"batch_size",
",",
"input_shape",
")",
":",
"# download data",
"get_data",
".",
"GetMNIST_ubyte",
"(",
")",
"flat",
"=",
"False",
"if",
"len",
"(",
"input_shape",
")",
"==",
"3",
"else",
"True",
"train_dataiter",
"=",
"mx",
".",... | https://github.com/tfwu/FaceDetection-ConvNet-3D/blob/f9251c48eb40c5aec8fba7455115c355466555be/example/multi-task/data.py#L11-L32 | |
openvinotoolkit/openvino | dedcbeafa8b84cccdc55ca64b8da516682b381c7 | docs/nbdoc/utils.py | python | verify_notebook_name | (notebook_name: str) | return notebook_name[:3].isdigit() and notebook_name[-4:] == ".rst" | Verification based on notebook name
:param notebook_name: Notebook name by default keeps convention:
[3 digit]-name-with-dashes-with-output.rst,
example: 001-hello-world-with-output.rst
:type notebook_name: str
:returns: Return if notebook meets requirements
:rtype: bool | Verification based on notebook name | [
"Verification",
"based",
"on",
"notebook",
"name"
] | def verify_notebook_name(notebook_name: str) -> bool:
"""Verification based on notebook name
:param notebook_name: Notebook name by default keeps convention:
[3 digit]-name-with-dashes-with-output.rst,
example: 001-hello-world-with-output.rst
:type notebook_name: str
:returns: Return if... | [
"def",
"verify_notebook_name",
"(",
"notebook_name",
":",
"str",
")",
"->",
"bool",
":",
"return",
"notebook_name",
"[",
":",
"3",
"]",
".",
"isdigit",
"(",
")",
"and",
"notebook_name",
"[",
"-",
"4",
":",
"]",
"==",
"\".rst\""
] | https://github.com/openvinotoolkit/openvino/blob/dedcbeafa8b84cccdc55ca64b8da516682b381c7/docs/nbdoc/utils.py#L67-L78 | |
mozilla/DeepSpeech | aa1d28530d531d0d92289bf5f11a49fe516fdc86 | native_client/ctcdecode/__init__.py | python | UTF8Alphabet.Encode | (self, input) | return [el for el in res] | Encode a sequence of character/output classes into a sequence of labels.
Characters are assumed to always take a single Unicode codepoint.
Characters must be in the alphabet, this method will assert that. Use
`CanEncode` and `CanEncodeSingle` to test. | Encode a sequence of character/output classes into a sequence of labels.
Characters are assumed to always take a single Unicode codepoint.
Characters must be in the alphabet, this method will assert that. Use
`CanEncode` and `CanEncodeSingle` to test. | [
"Encode",
"a",
"sequence",
"of",
"character",
"/",
"output",
"classes",
"into",
"a",
"sequence",
"of",
"labels",
".",
"Characters",
"are",
"assumed",
"to",
"always",
"take",
"a",
"single",
"Unicode",
"codepoint",
".",
"Characters",
"must",
"be",
"in",
"the",... | def Encode(self, input):
'''
Encode a sequence of character/output classes into a sequence of labels.
Characters are assumed to always take a single Unicode codepoint.
Characters must be in the alphabet, this method will assert that. Use
`CanEncode` and `CanEncodeSingle` to test.... | [
"def",
"Encode",
"(",
"self",
",",
"input",
")",
":",
"# Convert SWIG's UnsignedIntVec to a Python list",
"res",
"=",
"super",
"(",
"UTF8Alphabet",
",",
"self",
")",
".",
"Encode",
"(",
"input",
".",
"encode",
"(",
"'utf-8'",
")",
")",
"return",
"[",
"el",
... | https://github.com/mozilla/DeepSpeech/blob/aa1d28530d531d0d92289bf5f11a49fe516fdc86/native_client/ctcdecode/__init__.py#L120-L129 | |
snap-stanford/snap-python | d53c51b0a26aa7e3e7400b014cdf728948fde80a | setup/snap.py | python | TStr.CmpI | (self, *args) | return _snap.TStr_CmpI(self, *args) | CmpI(TStr self, TStr Str) -> int
Parameters:
Str: TStr const & | CmpI(TStr self, TStr Str) -> int | [
"CmpI",
"(",
"TStr",
"self",
"TStr",
"Str",
")",
"-",
">",
"int"
] | def CmpI(self, *args):
"""
CmpI(TStr self, TStr Str) -> int
Parameters:
Str: TStr const &
"""
return _snap.TStr_CmpI(self, *args) | [
"def",
"CmpI",
"(",
"self",
",",
"*",
"args",
")",
":",
"return",
"_snap",
".",
"TStr_CmpI",
"(",
"self",
",",
"*",
"args",
")"
] | https://github.com/snap-stanford/snap-python/blob/d53c51b0a26aa7e3e7400b014cdf728948fde80a/setup/snap.py#L9733-L9741 | |
openvinotoolkit/openvino | dedcbeafa8b84cccdc55ca64b8da516682b381c7 | tools/mo/openvino/tools/mo/ops/assert_op.py | python | Assert.assert_control_flow_infer | (node: Node, is_executable: bool, mark_executability: callable) | Infers control flow through assert operation node. It marks output data nodes executability according to
executability of current node and assert data value
:param node: Node instance to infer control flow through
:param is_executable: if current node is executable
:param mark_executabil... | Infers control flow through assert operation node. It marks output data nodes executability according to
executability of current node and assert data value
:param node: Node instance to infer control flow through
:param is_executable: if current node is executable
:param mark_executabil... | [
"Infers",
"control",
"flow",
"through",
"assert",
"operation",
"node",
".",
"It",
"marks",
"output",
"data",
"nodes",
"executability",
"according",
"to",
"executability",
"of",
"current",
"node",
"and",
"assert",
"data",
"value",
":",
"param",
"node",
":",
"No... | def assert_control_flow_infer(node: Node, is_executable: bool, mark_executability: callable):
"""
Infers control flow through assert operation node. It marks output data nodes executability according to
executability of current node and assert data value
:param node: Node instance to in... | [
"def",
"assert_control_flow_infer",
"(",
"node",
":",
"Node",
",",
"is_executable",
":",
"bool",
",",
"mark_executability",
":",
"callable",
")",
":",
"graph",
"=",
"node",
".",
"graph",
"assert_value",
"=",
"node",
".",
"out_node",
"(",
")",
".",
"value",
... | https://github.com/openvinotoolkit/openvino/blob/dedcbeafa8b84cccdc55ca64b8da516682b381c7/tools/mo/openvino/tools/mo/ops/assert_op.py#L26-L37 | ||
tensorflow/tensorflow | 419e3a6b650ea4bd1b0cba23c4348f8a69f3272e | tensorflow/python/ops/math_ops.py | python | matmul | (a,
b,
transpose_a=False,
transpose_b=False,
adjoint_a=False,
adjoint_b=False,
a_is_sparse=False,
b_is_sparse=False,
output_type=None,
name=None) | Multiplies matrix `a` by matrix `b`, producing `a` * `b`.
The inputs must, following any transpositions, be tensors of rank >= 2
where the inner 2 dimensions specify valid matrix multiplication dimensions,
and any further outer dimensions specify matching batch size.
Both matrices must be of the same type. Th... | Multiplies matrix `a` by matrix `b`, producing `a` * `b`. | [
"Multiplies",
"matrix",
"a",
"by",
"matrix",
"b",
"producing",
"a",
"*",
"b",
"."
] | def matmul(a,
b,
transpose_a=False,
transpose_b=False,
adjoint_a=False,
adjoint_b=False,
a_is_sparse=False,
b_is_sparse=False,
output_type=None,
name=None):
"""Multiplies matrix `a` by matrix `b`, producing `a` * `b`.
... | [
"def",
"matmul",
"(",
"a",
",",
"b",
",",
"transpose_a",
"=",
"False",
",",
"transpose_b",
"=",
"False",
",",
"adjoint_a",
"=",
"False",
",",
"adjoint_b",
"=",
"False",
",",
"a_is_sparse",
"=",
"False",
",",
"b_is_sparse",
"=",
"False",
",",
"output_type... | https://github.com/tensorflow/tensorflow/blob/419e3a6b650ea4bd1b0cba23c4348f8a69f3272e/tensorflow/python/ops/math_ops.py#L3490-L3714 | ||
microsoft/onnxruntime | f92e47e95b13a240e37caf7b36577983544f98fc | onnxruntime/python/onnxruntime_inference_collection.py | python | OrtValue.as_sparse_tensor | (self) | return SparseTensor(self._ortvalue.as_sparse_tensor()) | The function will return SparseTensor contained in this OrtValue | The function will return SparseTensor contained in this OrtValue | [
"The",
"function",
"will",
"return",
"SparseTensor",
"contained",
"in",
"this",
"OrtValue"
] | def as_sparse_tensor(self):
'''
The function will return SparseTensor contained in this OrtValue
'''
return SparseTensor(self._ortvalue.as_sparse_tensor()) | [
"def",
"as_sparse_tensor",
"(",
"self",
")",
":",
"return",
"SparseTensor",
"(",
"self",
".",
"_ortvalue",
".",
"as_sparse_tensor",
"(",
")",
")"
] | https://github.com/microsoft/onnxruntime/blob/f92e47e95b13a240e37caf7b36577983544f98fc/onnxruntime/python/onnxruntime_inference_collection.py#L577-L581 | |
KhronosGroup/glslang | 90d4bd05cd77ef5782a6779a0fe3d084440dc80d | build_info.py | python | describe | (directory) | Returns a string describing the current Git HEAD version as descriptively
as possible.
Runs 'git describe', or alternately 'git rev-parse HEAD', in directory. If
successful, returns the output; otherwise returns 'unknown hash, <date>'. | Returns a string describing the current Git HEAD version as descriptively
as possible. | [
"Returns",
"a",
"string",
"describing",
"the",
"current",
"Git",
"HEAD",
"version",
"as",
"descriptively",
"as",
"possible",
"."
] | def describe(directory):
"""Returns a string describing the current Git HEAD version as descriptively
as possible.
Runs 'git describe', or alternately 'git rev-parse HEAD', in directory. If
successful, returns the output; otherwise returns 'unknown hash, <date>'."""
try:
# decode() is need... | [
"def",
"describe",
"(",
"directory",
")",
":",
"try",
":",
"# decode() is needed here for Python3 compatibility. In Python2,",
"# str and bytes are the same type, but not in Python3.",
"# Popen.communicate() returns a bytes instance, which needs to be",
"# decoded into text data first in Pytho... | https://github.com/KhronosGroup/glslang/blob/90d4bd05cd77ef5782a6779a0fe3d084440dc80d/build_info.py#L117-L143 | ||
FreeCAD/FreeCAD | ba42231b9c6889b89e064d6d563448ed81e376ec | src/Mod/Idf/Idf.py | python | Process_comp_outline | (doc,comp_outline,comp_height) | return out_shape | Process_comp_outline(doc,comp_outline,comp_height)->part shape
Create solid component shape base on its outline | Process_comp_outline(doc,comp_outline,comp_height)->part shape
Create solid component shape base on its outline | [
"Process_comp_outline",
"(",
"doc",
"comp_outline",
"comp_height",
")",
"-",
">",
"part",
"shape",
"Create",
"solid",
"component",
"shape",
"base",
"on",
"its",
"outline"
] | def Process_comp_outline(doc,comp_outline,comp_height):
"""Process_comp_outline(doc,comp_outline,comp_height)->part shape
Create solid component shape base on its outline"""
vertex_index=-1; #presume no vertex
out_shape=[]
if comp_outline==[]: #force 0.2mm circle shape for components without pla... | [
"def",
"Process_comp_outline",
"(",
"doc",
",",
"comp_outline",
",",
"comp_height",
")",
":",
"vertex_index",
"=",
"-",
"1",
"#presume no vertex",
"out_shape",
"=",
"[",
"]",
"if",
"comp_outline",
"==",
"[",
"]",
":",
"#force 0.2mm circle shape for components withou... | https://github.com/FreeCAD/FreeCAD/blob/ba42231b9c6889b89e064d6d563448ed81e376ec/src/Mod/Idf/Idf.py#L301-L328 | |
wxWidgets/wxPython-Classic | 19571e1ae65f1ac445f5491474121998c97a1bf0 | wx/tools/Editra/src/extern/aui/auibar.py | python | AuiToolBar.EnableTool | (self, tool_id, state) | Enables or disables the tool.
:param integer `tool_id`: identifier for the tool to enable or disable.
:param bool `state`: if ``True``, enables the tool, otherwise disables it. | Enables or disables the tool. | [
"Enables",
"or",
"disables",
"the",
"tool",
"."
] | def EnableTool(self, tool_id, state):
"""
Enables or disables the tool.
:param integer `tool_id`: identifier for the tool to enable or disable.
:param bool `state`: if ``True``, enables the tool, otherwise disables it.
"""
tool = self.FindTool(tool_id)
if tool:... | [
"def",
"EnableTool",
"(",
"self",
",",
"tool_id",
",",
"state",
")",
":",
"tool",
"=",
"self",
".",
"FindTool",
"(",
"tool_id",
")",
"if",
"tool",
":",
"if",
"state",
":",
"tool",
".",
"state",
"&=",
"~",
"AUI_BUTTON_STATE_DISABLED",
"else",
":",
"tool... | https://github.com/wxWidgets/wxPython-Classic/blob/19571e1ae65f1ac445f5491474121998c97a1bf0/wx/tools/Editra/src/extern/aui/auibar.py#L2680-L2695 | ||
quantOS-org/DataCore | e2ef9bd2c22ee9e2845675b6435a14fa607f3551 | mdlink/deps/windows/protobuf-2.5.0/python/google/protobuf/message_factory.py | python | GetMessages | (file_protos) | return result | Builds a dictionary of all the messages available in a set of files.
Args:
file_protos: A sequence of file protos to build messages out of.
Returns:
A dictionary containing all the message types in the files mapping the
fully qualified name to a Message subclass for the descriptor. | Builds a dictionary of all the messages available in a set of files. | [
"Builds",
"a",
"dictionary",
"of",
"all",
"the",
"messages",
"available",
"in",
"a",
"set",
"of",
"files",
"."
] | def GetMessages(file_protos):
"""Builds a dictionary of all the messages available in a set of files.
Args:
file_protos: A sequence of file protos to build messages out of.
Returns:
A dictionary containing all the message types in the files mapping the
fully qualified name to a Message subclass for ... | [
"def",
"GetMessages",
"(",
"file_protos",
")",
":",
"result",
"=",
"{",
"}",
"for",
"file_proto",
"in",
"file_protos",
":",
"_DB",
".",
"Add",
"(",
"file_proto",
")",
"for",
"file_proto",
"in",
"file_protos",
":",
"for",
"desc",
"in",
"_GetAllDescriptors",
... | https://github.com/quantOS-org/DataCore/blob/e2ef9bd2c22ee9e2845675b6435a14fa607f3551/mdlink/deps/windows/protobuf-2.5.0/python/google/protobuf/message_factory.py#L78-L95 | |
krishauser/Klampt | 972cc83ea5befac3f653c1ba20f80155768ad519 | Python/python2_version/klampt/plan/cspace.py | python | CSpace.setBounds | (self,bound) | Convenience function: sets the sampling bound and the
space properties in one line. | Convenience function: sets the sampling bound and the
space properties in one line. | [
"Convenience",
"function",
":",
"sets",
"the",
"sampling",
"bound",
"and",
"the",
"space",
"properties",
"in",
"one",
"line",
"."
] | def setBounds(self,bound):
"""Convenience function: sets the sampling bound and the
space properties in one line."""
self.bound = bound
self.properties["minimum"] = [b[0] for b in bound]
self.properties["maximum"] = [b[1] for b in bound]
volume = 1
for b in self.b... | [
"def",
"setBounds",
"(",
"self",
",",
"bound",
")",
":",
"self",
".",
"bound",
"=",
"bound",
"self",
".",
"properties",
"[",
"\"minimum\"",
"]",
"=",
"[",
"b",
"[",
"0",
"]",
"for",
"b",
"in",
"bound",
"]",
"self",
".",
"properties",
"[",
"\"maximu... | https://github.com/krishauser/Klampt/blob/972cc83ea5befac3f653c1ba20f80155768ad519/Python/python2_version/klampt/plan/cspace.py#L80-L89 | ||
ChromiumWebApps/chromium | c7361d39be8abd1574e6ce8957c8dbddd4c6ccf7 | chrome/common/extensions/docs/examples/apps/hello-python/oauth2/__init__.py | python | Server._get_version | (self, request) | return version | Verify the correct version request for this server. | Verify the correct version request for this server. | [
"Verify",
"the",
"correct",
"version",
"request",
"for",
"this",
"server",
"."
] | def _get_version(self, request):
"""Verify the correct version request for this server."""
try:
version = request.get_parameter('oauth_version')
except:
version = VERSION
if version and version != self.version:
raise Error('OAuth version %s not suppor... | [
"def",
"_get_version",
"(",
"self",
",",
"request",
")",
":",
"try",
":",
"version",
"=",
"request",
".",
"get_parameter",
"(",
"'oauth_version'",
")",
"except",
":",
"version",
"=",
"VERSION",
"if",
"version",
"and",
"version",
"!=",
"self",
".",
"version... | https://github.com/ChromiumWebApps/chromium/blob/c7361d39be8abd1574e6ce8957c8dbddd4c6ccf7/chrome/common/extensions/docs/examples/apps/hello-python/oauth2/__init__.py#L610-L620 | |
aws/lumberyard | f85344403c1c2e77ec8c75deb2c116e97b713217 | dev/Tools/Python/3.7.10/linux_x64/lib/python3.7/sysconfig.py | python | parse_config_h | (fp, vars=None) | return vars | Parse a config.h-style file.
A dictionary containing name/value pairs is returned. If an
optional dictionary is passed in as the second argument, it is
used instead of a new dictionary. | Parse a config.h-style file. | [
"Parse",
"a",
"config",
".",
"h",
"-",
"style",
"file",
"."
] | def parse_config_h(fp, vars=None):
"""Parse a config.h-style file.
A dictionary containing name/value pairs is returned. If an
optional dictionary is passed in as the second argument, it is
used instead of a new dictionary.
"""
if vars is None:
vars = {}
import re
define_rx = r... | [
"def",
"parse_config_h",
"(",
"fp",
",",
"vars",
"=",
"None",
")",
":",
"if",
"vars",
"is",
"None",
":",
"vars",
"=",
"{",
"}",
"import",
"re",
"define_rx",
"=",
"re",
".",
"compile",
"(",
"\"#define ([A-Z][A-Za-z0-9_]+) (.*)\\n\"",
")",
"undef_rx",
"=",
... | https://github.com/aws/lumberyard/blob/f85344403c1c2e77ec8c75deb2c116e97b713217/dev/Tools/Python/3.7.10/linux_x64/lib/python3.7/sysconfig.py#L442-L471 | |
hughperkins/tf-coriander | 970d3df6c11400ad68405f22b0c42a52374e94ca | tensorflow/contrib/distributions/python/ops/shape.py | python | _DistributionShape._assert_non_negative_int32_scalar | (self, x) | return x | Helper which ensures that input is a non-negative, int32, scalar. | Helper which ensures that input is a non-negative, int32, scalar. | [
"Helper",
"which",
"ensures",
"that",
"input",
"is",
"a",
"non",
"-",
"negative",
"int32",
"scalar",
"."
] | def _assert_non_negative_int32_scalar(self, x):
"""Helper which ensures that input is a non-negative, int32, scalar."""
x = ops.convert_to_tensor(x, name="x")
if x.dtype.base_dtype != dtypes.int32.base_dtype:
raise TypeError("%s.dtype=%s is not %s" % (x.name, x.dtype, dtypes.int32))
x_value_static... | [
"def",
"_assert_non_negative_int32_scalar",
"(",
"self",
",",
"x",
")",
":",
"x",
"=",
"ops",
".",
"convert_to_tensor",
"(",
"x",
",",
"name",
"=",
"\"x\"",
")",
"if",
"x",
".",
"dtype",
".",
"base_dtype",
"!=",
"dtypes",
".",
"int32",
".",
"base_dtype",... | https://github.com/hughperkins/tf-coriander/blob/970d3df6c11400ad68405f22b0c42a52374e94ca/tensorflow/contrib/distributions/python/ops/shape.py#L444-L462 | |
tensorflow/deepmath | b5b721f54de1d5d6a02d78f5da5995237f9995f9 | deepmath/deephol/predictions.py | python | Predictions._batch_goal_embedding | (self, goals: List[Text]) | Computes embeddings from a list of goals. | Computes embeddings from a list of goals. | [
"Computes",
"embeddings",
"from",
"a",
"list",
"of",
"goals",
"."
] | def _batch_goal_embedding(self, goals: List[Text]) -> BATCH_GOAL_EMB_TYPE:
"""Computes embeddings from a list of goals."""
pass | [
"def",
"_batch_goal_embedding",
"(",
"self",
",",
"goals",
":",
"List",
"[",
"Text",
"]",
")",
"->",
"BATCH_GOAL_EMB_TYPE",
":",
"pass"
] | https://github.com/tensorflow/deepmath/blob/b5b721f54de1d5d6a02d78f5da5995237f9995f9/deepmath/deephol/predictions.py#L156-L158 | ||
syoyo/tinygltf | e7f1ff5c59d3ca2489923beb239bdf93d863498f | deps/cpplint.py | python | FileInfo.BaseName | (self) | return self.Split()[1] | File base name - text after the final slash, before the final period. | File base name - text after the final slash, before the final period. | [
"File",
"base",
"name",
"-",
"text",
"after",
"the",
"final",
"slash",
"before",
"the",
"final",
"period",
"."
] | def BaseName(self):
"""File base name - text after the final slash, before the final period."""
return self.Split()[1] | [
"def",
"BaseName",
"(",
"self",
")",
":",
"return",
"self",
".",
"Split",
"(",
")",
"[",
"1",
"]"
] | https://github.com/syoyo/tinygltf/blob/e7f1ff5c59d3ca2489923beb239bdf93d863498f/deps/cpplint.py#L1047-L1049 | |
eventql/eventql | 7ca0dbb2e683b525620ea30dc40540a22d5eb227 | deps/3rdparty/spidermonkey/mozjs/python/pystache/pystache/parser.py | python | _Parser._make_interpolation_node | (self, tag_type, tag_key, leading_whitespace) | Create and return a non-section node for the parse tree. | Create and return a non-section node for the parse tree. | [
"Create",
"and",
"return",
"a",
"non",
"-",
"section",
"node",
"for",
"the",
"parse",
"tree",
"."
] | def _make_interpolation_node(self, tag_type, tag_key, leading_whitespace):
"""
Create and return a non-section node for the parse tree.
"""
# TODO: switch to using a dictionary instead of a bunch of ifs and elifs.
if tag_type == '!':
return _CommentNode()
if... | [
"def",
"_make_interpolation_node",
"(",
"self",
",",
"tag_type",
",",
"tag_key",
",",
"leading_whitespace",
")",
":",
"# TODO: switch to using a dictionary instead of a bunch of ifs and elifs.",
"if",
"tag_type",
"==",
"'!'",
":",
"return",
"_CommentNode",
"(",
")",
"if",... | https://github.com/eventql/eventql/blob/7ca0dbb2e683b525620ea30dc40540a22d5eb227/deps/3rdparty/spidermonkey/mozjs/python/pystache/pystache/parser.py#L340-L363 | ||
openvinotoolkit/openvino | dedcbeafa8b84cccdc55ca64b8da516682b381c7 | tools/mo/openvino/tools/mo/middle/ApplyPermutations.py | python | ApplyPermutation.shape_of_sub_graph_reinference | (graph: Graph) | After layout permutation (shape change in data nodes) shape sub-graphs contain values in the old layout
To change that we execute full partial inference on the shape-of sub-graphs | After layout permutation (shape change in data nodes) shape sub-graphs contain values in the old layout
To change that we execute full partial inference on the shape-of sub-graphs | [
"After",
"layout",
"permutation",
"(",
"shape",
"change",
"in",
"data",
"nodes",
")",
"shape",
"sub",
"-",
"graphs",
"contain",
"values",
"in",
"the",
"old",
"layout",
"To",
"change",
"that",
"we",
"execute",
"full",
"partial",
"inference",
"on",
"the",
"s... | def shape_of_sub_graph_reinference(graph: Graph):
"""
After layout permutation (shape change in data nodes) shape sub-graphs contain values in the old layout
To change that we execute full partial inference on the shape-of sub-graphs
"""
shape_ops = graph.get_op_nodes(op='ShapeOf... | [
"def",
"shape_of_sub_graph_reinference",
"(",
"graph",
":",
"Graph",
")",
":",
"shape_ops",
"=",
"graph",
".",
"get_op_nodes",
"(",
"op",
"=",
"'ShapeOf'",
")",
"for",
"shape",
"in",
"shape_ops",
":",
"shape",
".",
"infer",
"(",
"shape",
")",
"def",
"reinf... | https://github.com/openvinotoolkit/openvino/blob/dedcbeafa8b84cccdc55ca64b8da516682b381c7/tools/mo/openvino/tools/mo/middle/ApplyPermutations.py#L92-L108 | ||
ZintrulCre/LeetCode_Archiver | de23e16ead29336b5ee7aa1898a392a5d6463d27 | LeetCode/python/1073.py | python | Solution.addNegabinary | (self, arr1, arr2) | return arr1 | :type arr1: List[int]
:type arr2: List[int]
:rtype: List[int] | :type arr1: List[int]
:type arr2: List[int]
:rtype: List[int] | [
":",
"type",
"arr1",
":",
"List",
"[",
"int",
"]",
":",
"type",
"arr2",
":",
"List",
"[",
"int",
"]",
":",
"rtype",
":",
"List",
"[",
"int",
"]"
] | def addNegabinary(self, arr1, arr2):
"""
:type arr1: List[int]
:type arr2: List[int]
:rtype: List[int]
"""
m, n = len(arr1) - 1, len(arr2) - 1
if m < n:
return self.addNegabinary(arr2, arr1)
temp, res = 0, 0
while m >= 0:
te... | [
"def",
"addNegabinary",
"(",
"self",
",",
"arr1",
",",
"arr2",
")",
":",
"m",
",",
"n",
"=",
"len",
"(",
"arr1",
")",
"-",
"1",
",",
"len",
"(",
"arr2",
")",
"-",
"1",
"if",
"m",
"<",
"n",
":",
"return",
"self",
".",
"addNegabinary",
"(",
"ar... | https://github.com/ZintrulCre/LeetCode_Archiver/blob/de23e16ead29336b5ee7aa1898a392a5d6463d27/LeetCode/python/1073.py#L2-L44 | |
aws/lumberyard | f85344403c1c2e77ec8c75deb2c116e97b713217 | dev/Gems/CloudGemMetric/v1/AWS/common-code/Lib/numba/targets/arrayobj.py | python | _array_copy | (context, builder, sig, args) | return impl_ret_new_ref(context, builder, sig.return_type, ret._getvalue()) | Array copy. | Array copy. | [
"Array",
"copy",
"."
] | def _array_copy(context, builder, sig, args):
"""
Array copy.
"""
arytype = sig.args[0]
ary = make_array(arytype)(context, builder, value=args[0])
shapes = cgutils.unpack_tuple(builder, ary.shape)
rettype = sig.return_type
ret = _empty_nd_impl(context, builder, rettype, shapes)
src... | [
"def",
"_array_copy",
"(",
"context",
",",
"builder",
",",
"sig",
",",
"args",
")",
":",
"arytype",
"=",
"sig",
".",
"args",
"[",
"0",
"]",
"ary",
"=",
"make_array",
"(",
"arytype",
")",
"(",
"context",
",",
"builder",
",",
"value",
"=",
"args",
"[... | https://github.com/aws/lumberyard/blob/f85344403c1c2e77ec8c75deb2c116e97b713217/dev/Gems/CloudGemMetric/v1/AWS/common-code/Lib/numba/targets/arrayobj.py#L3934-L3968 | |
chatopera/clause | dee31153d5ffdef33deedb6bff03e7806c296968 | var/assets/clients/gen-py/clause/Serving.py | python | Iface.postUtter | (self, request) | Parameters:
- request | Parameters:
- request | [
"Parameters",
":",
"-",
"request"
] | def postUtter(self, request):
"""
Parameters:
- request
"""
pass | [
"def",
"postUtter",
"(",
"self",
",",
"request",
")",
":",
"pass"
] | https://github.com/chatopera/clause/blob/dee31153d5ffdef33deedb6bff03e7806c296968/var/assets/clients/gen-py/clause/Serving.py#L206-L212 | ||
calamares/calamares | 9f6f82405b3074af7c99dc26487d2e46e4ece3e5 | src/modules/unpackfs/main.py | python | get_supported_filesystems | () | return ["file"] + get_supported_filesystems_kernel() | Returns a list of all the supported filesystems
(valid values for the *sourcefs* key in an item. | Returns a list of all the supported filesystems
(valid values for the *sourcefs* key in an item. | [
"Returns",
"a",
"list",
"of",
"all",
"the",
"supported",
"filesystems",
"(",
"valid",
"values",
"for",
"the",
"*",
"sourcefs",
"*",
"key",
"in",
"an",
"item",
"."
] | def get_supported_filesystems():
"""
Returns a list of all the supported filesystems
(valid values for the *sourcefs* key in an item.
"""
return ["file"] + get_supported_filesystems_kernel() | [
"def",
"get_supported_filesystems",
"(",
")",
":",
"return",
"[",
"\"file\"",
"]",
"+",
"get_supported_filesystems_kernel",
"(",
")"
] | https://github.com/calamares/calamares/blob/9f6f82405b3074af7c99dc26487d2e46e4ece3e5/src/modules/unpackfs/main.py#L380-L385 | |
adobe/chromium | cfe5bf0b51b1f6b9fe239c2a3c2f2364da9967d7 | third_party/mesa/MesaLib/src/mapi/glapi/gen/gl_XML.py | python | gl_api.functionIterateByCategory | (self, cat = None) | return functions.__iter__() | Iterate over functions by category.
If cat is None, all known functions are iterated in category
order. See classify_category for details of the ordering.
Within a category, functions are sorted by name. If cat is
not None, then only functions in that category are iterated. | Iterate over functions by category.
If cat is None, all known functions are iterated in category
order. See classify_category for details of the ordering.
Within a category, functions are sorted by name. If cat is
not None, then only functions in that category are iterated. | [
"Iterate",
"over",
"functions",
"by",
"category",
".",
"If",
"cat",
"is",
"None",
"all",
"known",
"functions",
"are",
"iterated",
"in",
"category",
"order",
".",
"See",
"classify_category",
"for",
"details",
"of",
"the",
"ordering",
".",
"Within",
"a",
"cate... | def functionIterateByCategory(self, cat = None):
"""Iterate over functions by category.
If cat is None, all known functions are iterated in category
order. See classify_category for details of the ordering.
Within a category, functions are sorted by name. If cat is
not None, then only functions in that c... | [
"def",
"functionIterateByCategory",
"(",
"self",
",",
"cat",
"=",
"None",
")",
":",
"lists",
"=",
"[",
"{",
"}",
",",
"{",
"}",
",",
"{",
"}",
",",
"{",
"}",
"]",
"for",
"func",
"in",
"self",
".",
"functionIterateAll",
"(",
")",
":",
"[",
"cat_na... | https://github.com/adobe/chromium/blob/cfe5bf0b51b1f6b9fe239c2a3c2f2364da9967d7/third_party/mesa/MesaLib/src/mapi/glapi/gen/gl_XML.py#L859-L893 | |
WenmuZhou/PSENet.pytorch | f760c2f4938726a2d00efaf5e5b28218323c44ca | models/loss.py | python | PSELoss.__init__ | (self, Lambda, ratio=3, reduction='mean') | Implement PSE Loss. | Implement PSE Loss. | [
"Implement",
"PSE",
"Loss",
"."
] | def __init__(self, Lambda, ratio=3, reduction='mean'):
"""Implement PSE Loss.
"""
super(PSELoss, self).__init__()
assert reduction in ['mean', 'sum'], " reduction must in ['mean','sum']"
self.Lambda = Lambda
self.ratio = ratio
self.reduction = reduction | [
"def",
"__init__",
"(",
"self",
",",
"Lambda",
",",
"ratio",
"=",
"3",
",",
"reduction",
"=",
"'mean'",
")",
":",
"super",
"(",
"PSELoss",
",",
"self",
")",
".",
"__init__",
"(",
")",
"assert",
"reduction",
"in",
"[",
"'mean'",
",",
"'sum'",
"]",
"... | https://github.com/WenmuZhou/PSENet.pytorch/blob/f760c2f4938726a2d00efaf5e5b28218323c44ca/models/loss.py#L10-L17 | ||
catboost/catboost | 167f64f237114a4d10b2b4ee42adb4569137debe | contrib/python/protobuf/py2/google/protobuf/internal/encoder.py | python | MessageSetItemEncoder | (field_number) | return EncodeField | Encoder for extensions of MessageSet.
The message set message looks like this:
message MessageSet {
repeated group Item = 1 {
required int32 type_id = 2;
required string message = 3;
}
} | Encoder for extensions of MessageSet. | [
"Encoder",
"for",
"extensions",
"of",
"MessageSet",
"."
] | def MessageSetItemEncoder(field_number):
"""Encoder for extensions of MessageSet.
The message set message looks like this:
message MessageSet {
repeated group Item = 1 {
required int32 type_id = 2;
required string message = 3;
}
}
"""
start_bytes = b"".join([
TagBytes(... | [
"def",
"MessageSetItemEncoder",
"(",
"field_number",
")",
":",
"start_bytes",
"=",
"b\"\"",
".",
"join",
"(",
"[",
"TagBytes",
"(",
"1",
",",
"wire_format",
".",
"WIRETYPE_START_GROUP",
")",
",",
"TagBytes",
"(",
"2",
",",
"wire_format",
".",
"WIRETYPE_VARINT"... | https://github.com/catboost/catboost/blob/167f64f237114a4d10b2b4ee42adb4569137debe/contrib/python/protobuf/py2/google/protobuf/internal/encoder.py#L777-L802 | |
krishauser/Klampt | 972cc83ea5befac3f653c1ba20f80155768ad519 | Python/klampt/src/robotsim.py | python | RobotModel.enableSelfCollision | (self, link1: "int", link2: "int", value: "bool") | return _robotsim.RobotModel_enableSelfCollision(self, link1, link2, value) | r"""
enableSelfCollision(RobotModel self, int link1, int link2, bool value)
Enables/disables self collisions between two links (depending on value) | r"""
enableSelfCollision(RobotModel self, int link1, int link2, bool value) | [
"r",
"enableSelfCollision",
"(",
"RobotModel",
"self",
"int",
"link1",
"int",
"link2",
"bool",
"value",
")"
] | def enableSelfCollision(self, link1: "int", link2: "int", value: "bool") -> "void":
r"""
enableSelfCollision(RobotModel self, int link1, int link2, bool value)
Enables/disables self collisions between two links (depending on value)
"""
return _robotsim.RobotModel_enableSelfC... | [
"def",
"enableSelfCollision",
"(",
"self",
",",
"link1",
":",
"\"int\"",
",",
"link2",
":",
"\"int\"",
",",
"value",
":",
"\"bool\"",
")",
"->",
"\"void\"",
":",
"return",
"_robotsim",
".",
"RobotModel_enableSelfCollision",
"(",
"self",
",",
"link1",
",",
"l... | https://github.com/krishauser/Klampt/blob/972cc83ea5befac3f653c1ba20f80155768ad519/Python/klampt/src/robotsim.py#L5425-L5433 | |
sigmaai/self-driving-golf-cart | 8d891600af3d851add27a10ae45cf3c2108bb87c | ros/src/ros_carla_bridge/carla_ros_bridge/src/carla_ros_bridge/camera.py | python | SemanticSegmentationCamera.get_carla_image_data_array | (self, carla_image) | return carla_image_data_array, 'bgra8' | Function (override) to convert the carla image to a numpy data array
as input for the cv_bridge.cv2_to_imgmsg() function
The segmentation camera raw image is converted to the city scapes palette image
having 4-channel uint8.
:param carla_image: carla image object
:type carla_im... | Function (override) to convert the carla image to a numpy data array
as input for the cv_bridge.cv2_to_imgmsg() function | [
"Function",
"(",
"override",
")",
"to",
"convert",
"the",
"carla",
"image",
"to",
"a",
"numpy",
"data",
"array",
"as",
"input",
"for",
"the",
"cv_bridge",
".",
"cv2_to_imgmsg",
"()",
"function"
] | def get_carla_image_data_array(self, carla_image):
"""
Function (override) to convert the carla image to a numpy data array
as input for the cv_bridge.cv2_to_imgmsg() function
The segmentation camera raw image is converted to the city scapes palette image
having 4-channel uint8.... | [
"def",
"get_carla_image_data_array",
"(",
"self",
",",
"carla_image",
")",
":",
"carla_image",
".",
"convert",
"(",
"carla",
".",
"ColorConverter",
".",
"CityScapesPalette",
")",
"carla_image_data_array",
"=",
"numpy",
".",
"ndarray",
"(",
"shape",
"=",
"(",
"ca... | https://github.com/sigmaai/self-driving-golf-cart/blob/8d891600af3d851add27a10ae45cf3c2108bb87c/ros/src/ros_carla_bridge/carla_ros_bridge/src/carla_ros_bridge/camera.py#L323-L341 | |
tensorflow/tensorflow | 419e3a6b650ea4bd1b0cba23c4348f8a69f3272e | tensorflow/python/util/tf_stack.py | python | StackTraceMapper.get_effective_source_map | (self) | Returns a map (filename, lineno) -> (filename, lineno, function_name). | Returns a map (filename, lineno) -> (filename, lineno, function_name). | [
"Returns",
"a",
"map",
"(",
"filename",
"lineno",
")",
"-",
">",
"(",
"filename",
"lineno",
"function_name",
")",
"."
] | def get_effective_source_map(self):
"""Returns a map (filename, lineno) -> (filename, lineno, function_name)."""
raise NotImplementedError('subclasses need to override this') | [
"def",
"get_effective_source_map",
"(",
"self",
")",
":",
"raise",
"NotImplementedError",
"(",
"'subclasses need to override this'",
")"
] | https://github.com/tensorflow/tensorflow/blob/419e3a6b650ea4bd1b0cba23c4348f8a69f3272e/tensorflow/python/util/tf_stack.py#L77-L79 | ||
openvinotoolkit/openvino | dedcbeafa8b84cccdc55ca64b8da516682b381c7 | tools/mo/openvino/tools/mo/middle/MakeKaldiConstReshapable.py | python | create_const_with_batch_from_input | (producer_port: Port, second_dim, value=0, precision=np.float32) | return init_value_prev_lstm_output | Create const with batch taken from input_out_port and second dimension equals second_dim
:param producer_port: take batch from this port
:param second_dim: second dimension for created constant
:param value: value to initialize constant
:param precision: precision for constant
:return created consta... | Create const with batch taken from input_out_port and second dimension equals second_dim
:param producer_port: take batch from this port
:param second_dim: second dimension for created constant
:param value: value to initialize constant
:param precision: precision for constant
:return created consta... | [
"Create",
"const",
"with",
"batch",
"taken",
"from",
"input_out_port",
"and",
"second",
"dimension",
"equals",
"second_dim",
":",
"param",
"producer_port",
":",
"take",
"batch",
"from",
"this",
"port",
":",
"param",
"second_dim",
":",
"second",
"dimension",
"for... | def create_const_with_batch_from_input(producer_port: Port, second_dim, value=0, precision=np.float32):
"""
Create const with batch taken from input_out_port and second dimension equals second_dim
:param producer_port: take batch from this port
:param second_dim: second dimension for created constant
... | [
"def",
"create_const_with_batch_from_input",
"(",
"producer_port",
":",
"Port",
",",
"second_dim",
",",
"value",
"=",
"0",
",",
"precision",
"=",
"np",
".",
"float32",
")",
":",
"graph",
"=",
"producer_port",
".",
"node",
".",
"graph",
"input_name",
"=",
"pr... | https://github.com/openvinotoolkit/openvino/blob/dedcbeafa8b84cccdc55ca64b8da516682b381c7/tools/mo/openvino/tools/mo/middle/MakeKaldiConstReshapable.py#L17-L77 | |
hanpfei/chromium-net | 392cc1fa3a8f92f42e4071ab6e674d8e0482f83f | third_party/protobuf/python/google/protobuf/descriptor_database.py | python | DescriptorDatabase.FindFileByName | (self, name) | return self._file_desc_protos_by_file[name] | Finds the file descriptor proto by file name.
Typically the file name is a relative path ending to a .proto file. The
proto with the given name will have to have been added to this database
using the Add method or else an error will be raised.
Args:
name: The file name to find.
Returns:
... | Finds the file descriptor proto by file name. | [
"Finds",
"the",
"file",
"descriptor",
"proto",
"by",
"file",
"name",
"."
] | def FindFileByName(self, name):
"""Finds the file descriptor proto by file name.
Typically the file name is a relative path ending to a .proto file. The
proto with the given name will have to have been added to this database
using the Add method or else an error will be raised.
Args:
name: T... | [
"def",
"FindFileByName",
"(",
"self",
",",
"name",
")",
":",
"return",
"self",
".",
"_file_desc_protos_by_file",
"[",
"name",
"]"
] | https://github.com/hanpfei/chromium-net/blob/392cc1fa3a8f92f42e4071ab6e674d8e0482f83f/third_party/protobuf/python/google/protobuf/descriptor_database.py#L80-L97 | |
aws/lumberyard | f85344403c1c2e77ec8c75deb2c116e97b713217 | dev/Tools/Python/3.7.10/linux_x64/lib/python3.7/bz2.py | python | BZ2File.closed | (self) | return self._mode == _MODE_CLOSED | True if this file is closed. | True if this file is closed. | [
"True",
"if",
"this",
"file",
"is",
"closed",
"."
] | def closed(self):
"""True if this file is closed."""
return self._mode == _MODE_CLOSED | [
"def",
"closed",
"(",
"self",
")",
":",
"return",
"self",
".",
"_mode",
"==",
"_MODE_CLOSED"
] | https://github.com/aws/lumberyard/blob/f85344403c1c2e77ec8c75deb2c116e97b713217/dev/Tools/Python/3.7.10/linux_x64/lib/python3.7/bz2.py#L134-L136 | |
Xilinx/Vitis-AI | fc74d404563d9951b57245443c73bef389f3657f | tools/Vitis-AI-Quantizer/vai_q_tensorflow1.x/tensorflow/python/ops/gradients_util.py | python | _maybe_colocate_with | (op, gradient_uid, colocate_gradients_with_ops) | Context to colocate with `op` if `colocate_gradients_with_ops`. | Context to colocate with `op` if `colocate_gradients_with_ops`. | [
"Context",
"to",
"colocate",
"with",
"op",
"if",
"colocate_gradients_with_ops",
"."
] | def _maybe_colocate_with(op, gradient_uid, colocate_gradients_with_ops): # pylint: disable=invalid-name
"""Context to colocate with `op` if `colocate_gradients_with_ops`."""
if colocate_gradients_with_ops:
with ops._colocate_with_for_gradient(op, gradient_uid): # pylint: disable=protected-access
yield
... | [
"def",
"_maybe_colocate_with",
"(",
"op",
",",
"gradient_uid",
",",
"colocate_gradients_with_ops",
")",
":",
"# pylint: disable=invalid-name",
"if",
"colocate_gradients_with_ops",
":",
"with",
"ops",
".",
"_colocate_with_for_gradient",
"(",
"op",
",",
"gradient_uid",
")",... | https://github.com/Xilinx/Vitis-AI/blob/fc74d404563d9951b57245443c73bef389f3657f/tools/Vitis-AI-Quantizer/vai_q_tensorflow1.x/tensorflow/python/ops/gradients_util.py#L303-L309 | ||
tensorflow/tensorflow | 419e3a6b650ea4bd1b0cba23c4348f8a69f3272e | tensorflow/python/keras/saving/saved_model/utils.py | python | maybe_add_training_arg | (
original_call, wrapped_call, expects_training_arg, default_training_value) | return wrap_with_training_arg, decorator_argspec | Decorate call and optionally adds training argument.
If a layer expects a training argument, this function ensures that 'training'
is present in the layer args or kwonly args, with the default training value.
Args:
original_call: Original call function.
wrapped_call: Wrapped call function.
expects_t... | Decorate call and optionally adds training argument. | [
"Decorate",
"call",
"and",
"optionally",
"adds",
"training",
"argument",
"."
] | def maybe_add_training_arg(
original_call, wrapped_call, expects_training_arg, default_training_value):
"""Decorate call and optionally adds training argument.
If a layer expects a training argument, this function ensures that 'training'
is present in the layer args or kwonly args, with the default training ... | [
"def",
"maybe_add_training_arg",
"(",
"original_call",
",",
"wrapped_call",
",",
"expects_training_arg",
",",
"default_training_value",
")",
":",
"if",
"not",
"expects_training_arg",
":",
"return",
"wrapped_call",
",",
"None",
"def",
"wrap_with_training_arg",
"(",
"*",
... | https://github.com/tensorflow/tensorflow/blob/419e3a6b650ea4bd1b0cba23c4348f8a69f3272e/tensorflow/python/keras/saving/saved_model/utils.py#L130-L196 | |
baidu-research/tensorflow-allreduce | 66d5b855e90b0949e9fa5cca5599fd729a70e874 | tensorflow/python/ops/math_grad.py | python | _ComplexGrad | (op, grad) | return (array_ops.reshape(math_ops.reduce_sum(math_ops.real(grad), rx), sx),
array_ops.reshape(math_ops.reduce_sum(math_ops.imag(grad), ry), sy)) | Returns the real and imaginary components of 'grad', respectively. | Returns the real and imaginary components of 'grad', respectively. | [
"Returns",
"the",
"real",
"and",
"imaginary",
"components",
"of",
"grad",
"respectively",
"."
] | def _ComplexGrad(op, grad):
"""Returns the real and imaginary components of 'grad', respectively."""
x = op.inputs[0]
y = op.inputs[1]
sx = array_ops.shape(x)
sy = array_ops.shape(y)
rx, ry = gen_array_ops._broadcast_gradient_args(sx, sy)
return (array_ops.reshape(math_ops.reduce_sum(math_ops.real(grad), ... | [
"def",
"_ComplexGrad",
"(",
"op",
",",
"grad",
")",
":",
"x",
"=",
"op",
".",
"inputs",
"[",
"0",
"]",
"y",
"=",
"op",
".",
"inputs",
"[",
"1",
"]",
"sx",
"=",
"array_ops",
".",
"shape",
"(",
"x",
")",
"sy",
"=",
"array_ops",
".",
"shape",
"(... | https://github.com/baidu-research/tensorflow-allreduce/blob/66d5b855e90b0949e9fa5cca5599fd729a70e874/tensorflow/python/ops/math_grad.py#L993-L1001 | |
hpi-xnor/BMXNet-v2 | af2b1859eafc5c721b1397cef02f946aaf2ce20d | example/multivariate_time_series/src/metrics.py | python | rse | (label, pred) | return numerator / denominator | computes the root relative squared error (condensed using standard deviation formula) | computes the root relative squared error (condensed using standard deviation formula) | [
"computes",
"the",
"root",
"relative",
"squared",
"error",
"(",
"condensed",
"using",
"standard",
"deviation",
"formula",
")"
] | def rse(label, pred):
"""computes the root relative squared error (condensed using standard deviation formula)"""
numerator = np.sqrt(np.mean(np.square(label - pred), axis = None))
denominator = np.std(label, axis = None)
return numerator / denominator | [
"def",
"rse",
"(",
"label",
",",
"pred",
")",
":",
"numerator",
"=",
"np",
".",
"sqrt",
"(",
"np",
".",
"mean",
"(",
"np",
".",
"square",
"(",
"label",
"-",
"pred",
")",
",",
"axis",
"=",
"None",
")",
")",
"denominator",
"=",
"np",
".",
"std",
... | https://github.com/hpi-xnor/BMXNet-v2/blob/af2b1859eafc5c721b1397cef02f946aaf2ce20d/example/multivariate_time_series/src/metrics.py#L25-L29 | |
aws/lumberyard | f85344403c1c2e77ec8c75deb2c116e97b713217 | dev/Tools/Python/3.7.10/windows/Lib/site-packages/setuptools/dist.py | python | check_extras | (dist, attr, value) | Verify that extras_require mapping is valid | Verify that extras_require mapping is valid | [
"Verify",
"that",
"extras_require",
"mapping",
"is",
"valid"
] | def check_extras(dist, attr, value):
"""Verify that extras_require mapping is valid"""
try:
list(itertools.starmap(_check_extra, value.items()))
except (TypeError, ValueError, AttributeError):
raise DistutilsSetupError(
"'extras_require' must be a dictionary whose values are "
... | [
"def",
"check_extras",
"(",
"dist",
",",
"attr",
",",
"value",
")",
":",
"try",
":",
"list",
"(",
"itertools",
".",
"starmap",
"(",
"_check_extra",
",",
"value",
".",
"items",
"(",
")",
")",
")",
"except",
"(",
"TypeError",
",",
"ValueError",
",",
"A... | https://github.com/aws/lumberyard/blob/f85344403c1c2e77ec8c75deb2c116e97b713217/dev/Tools/Python/3.7.10/windows/Lib/site-packages/setuptools/dist.py#L246-L255 | ||
catboost/catboost | 167f64f237114a4d10b2b4ee42adb4569137debe | contrib/python/numpy/py2/numpy/ma/core.py | python | MaskedArray.__rpow__ | (self, other) | return power(other, self) | Raise other to the power self, masking the potential NaNs/Infs | Raise other to the power self, masking the potential NaNs/Infs | [
"Raise",
"other",
"to",
"the",
"power",
"self",
"masking",
"the",
"potential",
"NaNs",
"/",
"Infs"
] | def __rpow__(self, other):
"""
Raise other to the power self, masking the potential NaNs/Infs
"""
return power(other, self) | [
"def",
"__rpow__",
"(",
"self",
",",
"other",
")",
":",
"return",
"power",
"(",
"other",
",",
"self",
")"
] | https://github.com/catboost/catboost/blob/167f64f237114a4d10b2b4ee42adb4569137debe/contrib/python/numpy/py2/numpy/ma/core.py#L4159-L4164 | |
windystrife/UnrealEngine_NVIDIAGameWorks | b50e6338a7c5b26374d66306ebc7807541ff815e | Engine/Extras/ThirdPartyNotUE/emsdk/Win64/python/2.7.5.3_64bit/Lib/lib-tk/Tix.py | python | TixWidget._subwidget_name | (self,name) | Get a subwidget name (returns a String, not a Widget !) | Get a subwidget name (returns a String, not a Widget !) | [
"Get",
"a",
"subwidget",
"name",
"(",
"returns",
"a",
"String",
"not",
"a",
"Widget",
"!",
")"
] | def _subwidget_name(self,name):
"""Get a subwidget name (returns a String, not a Widget !)"""
try:
return self.tk.call(self._w, 'subwidget', name)
except TclError:
return None | [
"def",
"_subwidget_name",
"(",
"self",
",",
"name",
")",
":",
"try",
":",
"return",
"self",
".",
"tk",
".",
"call",
"(",
"self",
".",
"_w",
",",
"'subwidget'",
",",
"name",
")",
"except",
"TclError",
":",
"return",
"None"
] | https://github.com/windystrife/UnrealEngine_NVIDIAGameWorks/blob/b50e6338a7c5b26374d66306ebc7807541ff815e/Engine/Extras/ThirdPartyNotUE/emsdk/Win64/python/2.7.5.3_64bit/Lib/lib-tk/Tix.py#L372-L377 | ||
ycm-core/ycmd | fc0fb7e5e15176cc5a2a30c80956335988c6b59a | ycmd/utils.py | python | ByteOffsetToCodepointOffset | ( line_value, byte_offset ) | return len( ToUnicode( byte_line_value[ : byte_offset - 1 ] ) ) + 1 | The API calls for byte offsets into the UTF-8 encoded version of the
buffer. However, ycmd internally uses unicode strings. This means that
when we need to walk 'characters' within the buffer, such as when checking
for semantic triggers and similar, we must use codepoint offsets, rather than
byte offsets.
Th... | The API calls for byte offsets into the UTF-8 encoded version of the
buffer. However, ycmd internally uses unicode strings. This means that
when we need to walk 'characters' within the buffer, such as when checking
for semantic triggers and similar, we must use codepoint offsets, rather than
byte offsets. | [
"The",
"API",
"calls",
"for",
"byte",
"offsets",
"into",
"the",
"UTF",
"-",
"8",
"encoded",
"version",
"of",
"the",
"buffer",
".",
"However",
"ycmd",
"internally",
"uses",
"unicode",
"strings",
".",
"This",
"means",
"that",
"when",
"we",
"need",
"to",
"w... | def ByteOffsetToCodepointOffset( line_value, byte_offset ):
"""The API calls for byte offsets into the UTF-8 encoded version of the
buffer. However, ycmd internally uses unicode strings. This means that
when we need to walk 'characters' within the buffer, such as when checking
for semantic triggers and similar,... | [
"def",
"ByteOffsetToCodepointOffset",
"(",
"line_value",
",",
"byte_offset",
")",
":",
"byte_line_value",
"=",
"ToBytes",
"(",
"line_value",
")",
"return",
"len",
"(",
"ToUnicode",
"(",
"byte_line_value",
"[",
":",
"byte_offset",
"-",
"1",
"]",
")",
")",
"+",
... | https://github.com/ycm-core/ycmd/blob/fc0fb7e5e15176cc5a2a30c80956335988c6b59a/ycmd/utils.py#L156-L167 | |
yun-liu/RCF | 91bfb054ad04187dbbe21e539e165ad9bd3ff00b | scripts/cpp_lint.py | python | CloseExpression | (clean_lines, linenum, pos) | return (line, clean_lines.NumLines(), -1) | If input points to ( or { or [ or <, finds the position that closes it.
If lines[linenum][pos] points to a '(' or '{' or '[' or '<', finds the
linenum/pos that correspond to the closing of the expression.
Args:
clean_lines: A CleansedLines instance containing the file.
linenum: The number of the line to... | If input points to ( or { or [ or <, finds the position that closes it. | [
"If",
"input",
"points",
"to",
"(",
"or",
"{",
"or",
"[",
"or",
"<",
"finds",
"the",
"position",
"that",
"closes",
"it",
"."
] | def CloseExpression(clean_lines, linenum, pos):
"""If input points to ( or { or [ or <, finds the position that closes it.
If lines[linenum][pos] points to a '(' or '{' or '[' or '<', finds the
linenum/pos that correspond to the closing of the expression.
Args:
clean_lines: A CleansedLines instance contai... | [
"def",
"CloseExpression",
"(",
"clean_lines",
",",
"linenum",
",",
"pos",
")",
":",
"line",
"=",
"clean_lines",
".",
"elided",
"[",
"linenum",
"]",
"startchar",
"=",
"line",
"[",
"pos",
"]",
"if",
"startchar",
"not",
"in",
"'({[<'",
":",
"return",
"(",
... | https://github.com/yun-liu/RCF/blob/91bfb054ad04187dbbe21e539e165ad9bd3ff00b/scripts/cpp_lint.py#L1254-L1297 | |
adobe/chromium | cfe5bf0b51b1f6b9fe239c2a3c2f2364da9967d7 | native_client_sdk/src/build_tools/apply_patch.py | python | _Range.Parse | (self, diff_lines) | Parse a range diff line.
Parse the line at index 0 in diff_lines as a range-info line and set the
range info accordingly. Raise an Error exception if the line is not a valid
range line. If successful, the line at index 0 is removed from diff_lines.
Arguments:
diff_lines: a list of diff lines rea... | Parse a range diff line. | [
"Parse",
"a",
"range",
"diff",
"line",
"."
] | def Parse(self, diff_lines):
''' Parse a range diff line.
Parse the line at index 0 in diff_lines as a range-info line and set the
range info accordingly. Raise an Error exception if the line is not a valid
range line. If successful, the line at index 0 is removed from diff_lines.
Arguments:
... | [
"def",
"Parse",
"(",
"self",
",",
"diff_lines",
")",
":",
"match",
"=",
"re",
".",
"match",
"(",
"RE_RANGE",
",",
"diff_lines",
"[",
"0",
"]",
")",
"if",
"not",
"match",
":",
"raise",
"Error",
"(",
"context",
"=",
"diff_lines",
"[",
"0",
"]",
",",
... | https://github.com/adobe/chromium/blob/cfe5bf0b51b1f6b9fe239c2a3c2f2364da9967d7/native_client_sdk/src/build_tools/apply_patch.py#L76-L101 | ||
benoitsteiner/tensorflow-opencl | cb7cb40a57fde5cfd4731bc551e82a1e2fef43a5 | tensorflow/contrib/graph_editor/subgraph.py | python | make_view_from_scope | (scope, graph) | return SubGraphView(ops) | Make a subgraph from a name scope.
Args:
scope: the name of the scope.
graph: the `tf.Graph`.
Returns:
A subgraph view representing the given scope. | Make a subgraph from a name scope. | [
"Make",
"a",
"subgraph",
"from",
"a",
"name",
"scope",
"."
] | def make_view_from_scope(scope, graph):
"""Make a subgraph from a name scope.
Args:
scope: the name of the scope.
graph: the `tf.Graph`.
Returns:
A subgraph view representing the given scope.
"""
ops = select.get_name_scope_ops(graph, scope)
return SubGraphView(ops) | [
"def",
"make_view_from_scope",
"(",
"scope",
",",
"graph",
")",
":",
"ops",
"=",
"select",
".",
"get_name_scope_ops",
"(",
"graph",
",",
"scope",
")",
"return",
"SubGraphView",
"(",
"ops",
")"
] | https://github.com/benoitsteiner/tensorflow-opencl/blob/cb7cb40a57fde5cfd4731bc551e82a1e2fef43a5/tensorflow/contrib/graph_editor/subgraph.py#L658-L668 | |
tensorflow/tensorflow | 419e3a6b650ea4bd1b0cba23c4348f8a69f3272e | tensorflow/python/keras/utils/generic_utils.py | python | validate_config | (config) | return isinstance(config, dict) and _LAYER_UNDEFINED_CONFIG_KEY not in config | Determines whether config appears to be a valid layer config. | Determines whether config appears to be a valid layer config. | [
"Determines",
"whether",
"config",
"appears",
"to",
"be",
"a",
"valid",
"layer",
"config",
"."
] | def validate_config(config):
"""Determines whether config appears to be a valid layer config."""
return isinstance(config, dict) and _LAYER_UNDEFINED_CONFIG_KEY not in config | [
"def",
"validate_config",
"(",
"config",
")",
":",
"return",
"isinstance",
"(",
"config",
",",
"dict",
")",
"and",
"_LAYER_UNDEFINED_CONFIG_KEY",
"not",
"in",
"config"
] | https://github.com/tensorflow/tensorflow/blob/419e3a6b650ea4bd1b0cba23c4348f8a69f3272e/tensorflow/python/keras/utils/generic_utils.py#L1146-L1148 | |
makefile/frcnn | 8d9b9ebf8be8315ba2f374d460121b0adf1df29c | scripts/cpp_lint.py | python | _DropCommonSuffixes | (filename) | return os.path.splitext(filename)[0] | Drops common suffixes like _test.cc or -inl.h from filename.
For example:
>>> _DropCommonSuffixes('foo/foo-inl.h')
'foo/foo'
>>> _DropCommonSuffixes('foo/bar/foo.cc')
'foo/bar/foo'
>>> _DropCommonSuffixes('foo/foo_internal.h')
'foo/foo'
>>> _DropCommonSuffixes('foo/foo_unusualinternal.h')... | Drops common suffixes like _test.cc or -inl.h from filename. | [
"Drops",
"common",
"suffixes",
"like",
"_test",
".",
"cc",
"or",
"-",
"inl",
".",
"h",
"from",
"filename",
"."
] | def _DropCommonSuffixes(filename):
"""Drops common suffixes like _test.cc or -inl.h from filename.
For example:
>>> _DropCommonSuffixes('foo/foo-inl.h')
'foo/foo'
>>> _DropCommonSuffixes('foo/bar/foo.cc')
'foo/bar/foo'
>>> _DropCommonSuffixes('foo/foo_internal.h')
'foo/foo'
>>> _DropCom... | [
"def",
"_DropCommonSuffixes",
"(",
"filename",
")",
":",
"for",
"suffix",
"in",
"(",
"'test.cc'",
",",
"'regtest.cc'",
",",
"'unittest.cc'",
",",
"'inl.h'",
",",
"'impl.h'",
",",
"'internal.h'",
")",
":",
"if",
"(",
"filename",
".",
"endswith",
"(",
"suffix"... | https://github.com/makefile/frcnn/blob/8d9b9ebf8be8315ba2f374d460121b0adf1df29c/scripts/cpp_lint.py#L3576-L3600 | |
PaddlePaddle/Paddle | 1252f4bb3e574df80aa6d18c7ddae1b3a90bd81c | python/paddle/distributed/fleet/metrics/metric.py | python | max | (input, scope=None, util=None) | return output | distributed max in fleet
Args:
input(numpy.array|Variable|string): output of a layer
scope(Scope): specific scope
Returns:
global_metric(numpy.array): max array
Example:
.. code-block:: python
# in model.py
input = fluid.layers.cast(some_input, dtype='... | distributed max in fleet | [
"distributed",
"max",
"in",
"fleet"
] | def max(input, scope=None, util=None):
"""
distributed max in fleet
Args:
input(numpy.array|Variable|string): output of a layer
scope(Scope): specific scope
Returns:
global_metric(numpy.array): max array
Example:
.. code-block:: python
# in model.py
... | [
"def",
"max",
"(",
"input",
",",
"scope",
"=",
"None",
",",
"util",
"=",
"None",
")",
":",
"if",
"scope",
"is",
"None",
":",
"scope",
"=",
"paddle",
".",
"static",
".",
"global_scope",
"(",
")",
"if",
"util",
"is",
"None",
":",
"util",
"=",
"padd... | https://github.com/PaddlePaddle/Paddle/blob/1252f4bb3e574df80aa6d18c7ddae1b3a90bd81c/python/paddle/distributed/fleet/metrics/metric.py#L64-L101 | |
trilinos/Trilinos | 6168be6dd51e35e1cd681e9c4b24433e709df140 | packages/seacas/libraries/ioss/src/visualization/catalyst/phactori/PhactoriDriver.py | python | DuringRestartUseJsonToSetUp | (jsonIn, ioPipeAndViewsState) | used by process zero (broadcast send process) as well as other processes\n (broadcast recieve processes) to actually take the info in json format\n and set the system up for proper behavior after restart, particularly\n data ranges and plots over time | used by process zero (broadcast send process) as well as other processes\n (broadcast recieve processes) to actually take the info in json format\n and set the system up for proper behavior after restart, particularly\n data ranges and plots over time | [
"used",
"by",
"process",
"zero",
"(",
"broadcast",
"send",
"process",
")",
"as",
"well",
"as",
"other",
"processes",
"\\",
"n",
"(",
"broadcast",
"recieve",
"processes",
")",
"to",
"actually",
"take",
"the",
"info",
"in",
"json",
"format",
"\\",
"n",
"an... | def DuringRestartUseJsonToSetUp(jsonIn, ioPipeAndViewsState):
"used by process zero (broadcast send process) as well as other processes\n (broadcast recieve processes) to actually take the info in json format\n and set the system up for proper behavior after restart, particularly\n data ranges and plots o... | [
"def",
"DuringRestartUseJsonToSetUp",
"(",
"jsonIn",
",",
"ioPipeAndViewsState",
")",
":",
"#go through representations and have each add it's state info to jsonOut",
"if",
"\"RepresentationsRestartInfo\"",
"not",
"in",
"jsonIn",
":",
"if",
"PhactoriDbg",
"(",
")",
":",
"myDe... | https://github.com/trilinos/Trilinos/blob/6168be6dd51e35e1cd681e9c4b24433e709df140/packages/seacas/libraries/ioss/src/visualization/catalyst/phactori/PhactoriDriver.py#L19833-L19864 | ||
wxWidgets/wxPython-Classic | 19571e1ae65f1ac445f5491474121998c97a1bf0 | src/msw/_gdi.py | python | NamedColour | (*args, **kwargs) | return val | NamedColour(String colourName) -> Colour
Constructs a colour object using a colour name listed in
``wx.TheColourDatabase``, or any string format supported by the
wxColour typemaps. | NamedColour(String colourName) -> Colour | [
"NamedColour",
"(",
"String",
"colourName",
")",
"-",
">",
"Colour"
] | def NamedColour(*args, **kwargs):
"""
NamedColour(String colourName) -> Colour
Constructs a colour object using a colour name listed in
``wx.TheColourDatabase``, or any string format supported by the
wxColour typemaps.
"""
val = _gdi_.new_NamedColour(*args, **kwargs)
return val | [
"def",
"NamedColour",
"(",
"*",
"args",
",",
"*",
"*",
"kwargs",
")",
":",
"val",
"=",
"_gdi_",
".",
"new_NamedColour",
"(",
"*",
"args",
",",
"*",
"*",
"kwargs",
")",
"return",
"val"
] | https://github.com/wxWidgets/wxPython-Classic/blob/19571e1ae65f1ac445f5491474121998c97a1bf0/src/msw/_gdi.py#L302-L311 | |
Cisco-Talos/moflow | ed71dfb0540d9e0d7a4c72f0881b58958d573728 | BAP-0.7-moflow/libtracewrap/libtrace/protobuf/python/google/protobuf/internal/wire_format.py | python | IsTypePackable | (field_type) | return field_type not in NON_PACKABLE_TYPES | Return true iff packable = true is valid for fields of this type.
Args:
field_type: a FieldDescriptor::Type value.
Returns:
True iff fields of this type are packable. | Return true iff packable = true is valid for fields of this type. | [
"Return",
"true",
"iff",
"packable",
"=",
"true",
"is",
"valid",
"for",
"fields",
"of",
"this",
"type",
"."
] | def IsTypePackable(field_type):
"""Return true iff packable = true is valid for fields of this type.
Args:
field_type: a FieldDescriptor::Type value.
Returns:
True iff fields of this type are packable.
"""
return field_type not in NON_PACKABLE_TYPES | [
"def",
"IsTypePackable",
"(",
"field_type",
")",
":",
"return",
"field_type",
"not",
"in",
"NON_PACKABLE_TYPES"
] | https://github.com/Cisco-Talos/moflow/blob/ed71dfb0540d9e0d7a4c72f0881b58958d573728/BAP-0.7-moflow/libtracewrap/libtrace/protobuf/python/google/protobuf/internal/wire_format.py#L259-L268 | |
echronos/echronos | c996f1d2c8af6c6536205eb319c1bf1d4d84569c | external_tools/ply_info/example/unicalc/calc.py | python | p_expression_group | (p) | expression : LPAREN expression RPAREN | expression : LPAREN expression RPAREN | [
"expression",
":",
"LPAREN",
"expression",
"RPAREN"
] | def p_expression_group(p):
'expression : LPAREN expression RPAREN'
p[0] = p[2] | [
"def",
"p_expression_group",
"(",
"p",
")",
":",
"p",
"[",
"0",
"]",
"=",
"p",
"[",
"2",
"]"
] | https://github.com/echronos/echronos/blob/c996f1d2c8af6c6536205eb319c1bf1d4d84569c/external_tools/ply_info/example/unicalc/calc.py#L86-L88 | ||
kungfu-origin/kungfu | 90c84b2b590855654cb9a6395ed050e0f7763512 | core/deps/SQLiteCpp-2.3.0/cpplint.py | python | IsBlankLine | (line) | return not line or line.isspace() | Returns true if the given line is blank.
We consider a line to be blank if the line is empty or consists of
only white spaces.
Args:
line: A line of a string.
Returns:
True, if the given line is blank. | Returns true if the given line is blank. | [
"Returns",
"true",
"if",
"the",
"given",
"line",
"is",
"blank",
"."
] | def IsBlankLine(line):
"""Returns true if the given line is blank.
We consider a line to be blank if the line is empty or consists of
only white spaces.
Args:
line: A line of a string.
Returns:
True, if the given line is blank.
"""
return not line or line.isspace() | [
"def",
"IsBlankLine",
"(",
"line",
")",
":",
"return",
"not",
"line",
"or",
"line",
".",
"isspace",
"(",
")"
] | https://github.com/kungfu-origin/kungfu/blob/90c84b2b590855654cb9a6395ed050e0f7763512/core/deps/SQLiteCpp-2.3.0/cpplint.py#L2298-L2310 | |
wxWidgets/wxPython-Classic | 19571e1ae65f1ac445f5491474121998c97a1bf0 | wx/lib/agw/ribbon/gallery.py | python | RibbonGalleryEvent.GetGalleryItem | (self) | return self._item | Returns the gallery item which the event relates to, or ``None`` if it does not relate to an item. | Returns the gallery item which the event relates to, or ``None`` if it does not relate to an item. | [
"Returns",
"the",
"gallery",
"item",
"which",
"the",
"event",
"relates",
"to",
"or",
"None",
"if",
"it",
"does",
"not",
"relate",
"to",
"an",
"item",
"."
] | def GetGalleryItem(self):
""" Returns the gallery item which the event relates to, or ``None`` if it does not relate to an item. """
return self._item | [
"def",
"GetGalleryItem",
"(",
"self",
")",
":",
"return",
"self",
".",
"_item"
] | https://github.com/wxWidgets/wxPython-Classic/blob/19571e1ae65f1ac445f5491474121998c97a1bf0/wx/lib/agw/ribbon/gallery.py#L71-L74 | |
reverbrain/elliptics | 4b4f9b8094d7616c1ec50eb8605edb059b9f228e | bindings/python/src/route.py | python | RouteList.filter_by_address | (self, address) | return RouteList([route for route in self.routes
if route.address == address]) | Filters routes for specified address\n
address = Address.from_host_port_family('host.com:1025:2')
routes = routes.filter_by_address(address) | Filters routes for specified address\n
address = Address.from_host_port_family('host.com:1025:2')
routes = routes.filter_by_address(address) | [
"Filters",
"routes",
"for",
"specified",
"address",
"\\",
"n",
"address",
"=",
"Address",
".",
"from_host_port_family",
"(",
"host",
".",
"com",
":",
"1025",
":",
"2",
")",
"routes",
"=",
"routes",
".",
"filter_by_address",
"(",
"address",
")"
] | def filter_by_address(self, address):
"""
Filters routes for specified address\n
address = Address.from_host_port_family('host.com:1025:2')
routes = routes.filter_by_address(address)
"""
return RouteList([route for route in self.routes
if route.a... | [
"def",
"filter_by_address",
"(",
"self",
",",
"address",
")",
":",
"return",
"RouteList",
"(",
"[",
"route",
"for",
"route",
"in",
"self",
".",
"routes",
"if",
"route",
".",
"address",
"==",
"address",
"]",
")"
] | https://github.com/reverbrain/elliptics/blob/4b4f9b8094d7616c1ec50eb8605edb059b9f228e/bindings/python/src/route.py#L215-L222 | |
windystrife/UnrealEngine_NVIDIAGameWorks | b50e6338a7c5b26374d66306ebc7807541ff815e | Engine/Extras/ThirdPartyNotUE/emsdk/Win64/python/2.7.5.3_64bit/Lib/idlelib/AutoCompleteWindow.py | python | AutoCompleteWindow._binary_search | (self, s) | return min(i, len(self.completions)-1) | Find the first index in self.completions where completions[i] is
greater or equal to s, or the last index if there is no such
one. | Find the first index in self.completions where completions[i] is
greater or equal to s, or the last index if there is no such
one. | [
"Find",
"the",
"first",
"index",
"in",
"self",
".",
"completions",
"where",
"completions",
"[",
"i",
"]",
"is",
"greater",
"or",
"equal",
"to",
"s",
"or",
"the",
"last",
"index",
"if",
"there",
"is",
"no",
"such",
"one",
"."
] | def _binary_search(self, s):
"""Find the first index in self.completions where completions[i] is
greater or equal to s, or the last index if there is no such
one."""
i = 0; j = len(self.completions)
while j > i:
m = (i + j) // 2
if self.completions[m] >= s... | [
"def",
"_binary_search",
"(",
"self",
",",
"s",
")",
":",
"i",
"=",
"0",
"j",
"=",
"len",
"(",
"self",
".",
"completions",
")",
"while",
"j",
">",
"i",
":",
"m",
"=",
"(",
"i",
"+",
"j",
")",
"//",
"2",
"if",
"self",
".",
"completions",
"[",
... | https://github.com/windystrife/UnrealEngine_NVIDIAGameWorks/blob/b50e6338a7c5b26374d66306ebc7807541ff815e/Engine/Extras/ThirdPartyNotUE/emsdk/Win64/python/2.7.5.3_64bit/Lib/idlelib/AutoCompleteWindow.py#L69-L80 | |
smilehao/xlua-framework | a03801538be2b0e92d39332d445b22caca1ef61f | ConfigData/trunk/tools/protobuf-2.5.0/protobuf-2.5.0/python/build/lib/google/protobuf/text_format.py | python | ParseFloat | (text) | Parse a floating point number.
Args:
text: Text to parse.
Returns:
The number parsed.
Raises:
ValueError: If a floating point number couldn't be parsed. | Parse a floating point number. | [
"Parse",
"a",
"floating",
"point",
"number",
"."
] | def ParseFloat(text):
"""Parse a floating point number.
Args:
text: Text to parse.
Returns:
The number parsed.
Raises:
ValueError: If a floating point number couldn't be parsed.
"""
try:
# Assume Python compatible syntax.
return float(text)
except ValueError:
# Check alternative... | [
"def",
"ParseFloat",
"(",
"text",
")",
":",
"try",
":",
"# Assume Python compatible syntax.",
"return",
"float",
"(",
"text",
")",
"except",
"ValueError",
":",
"# Check alternative spellings.",
"if",
"_FLOAT_INFINITY",
".",
"match",
"(",
"text",
")",
":",
"if",
... | https://github.com/smilehao/xlua-framework/blob/a03801538be2b0e92d39332d445b22caca1ef61f/ConfigData/trunk/tools/protobuf-2.5.0/protobuf-2.5.0/python/build/lib/google/protobuf/text_format.py#L654-L683 | ||
domino-team/openwrt-cc | 8b181297c34d14d3ca521cc9f31430d561dbc688 | package/gli-pub/openwrt-node-packages-master/node/node-v6.9.1/tools/gyp/pylib/gyp/generator/msvs.py | python | _InitNinjaFlavor | (params, target_list, target_dicts) | Initialize targets for the ninja flavor.
This sets up the necessary variables in the targets to generate msvs projects
that use ninja as an external builder. The variables in the spec are only set
if they have not been set. This allows individual specs to override the
default values initialized here.
Argumen... | Initialize targets for the ninja flavor. | [
"Initialize",
"targets",
"for",
"the",
"ninja",
"flavor",
"."
] | def _InitNinjaFlavor(params, target_list, target_dicts):
"""Initialize targets for the ninja flavor.
This sets up the necessary variables in the targets to generate msvs projects
that use ninja as an external builder. The variables in the spec are only set
if they have not been set. This allows individual spec... | [
"def",
"_InitNinjaFlavor",
"(",
"params",
",",
"target_list",
",",
"target_dicts",
")",
":",
"for",
"qualified_target",
"in",
"target_list",
":",
"spec",
"=",
"target_dicts",
"[",
"qualified_target",
"]",
"if",
"spec",
".",
"get",
"(",
"'msvs_external_builder'",
... | https://github.com/domino-team/openwrt-cc/blob/8b181297c34d14d3ca521cc9f31430d561dbc688/package/gli-pub/openwrt-node-packages-master/node/node-v6.9.1/tools/gyp/pylib/gyp/generator/msvs.py#L1845-L1890 | ||
MythTV/mythtv | d282a209cb8be85d036f85a62a8ec971b67d45f4 | mythtv/bindings/python/MythTV/utility/dicttoxml.py | python | convert_dict | (obj, ids, parent, attr_type, item_func, cdata) | return ''.join(output) | Converts a dict into an XML string. | Converts a dict into an XML string. | [
"Converts",
"a",
"dict",
"into",
"an",
"XML",
"string",
"."
] | def convert_dict(obj, ids, parent, attr_type, item_func, cdata):
"""Converts a dict into an XML string."""
LOG.info('Inside convert_dict(): obj type is: "%s", obj="%s"' % (
type(obj).__name__, unicode_me(obj))
)
output = []
addline = output.append
item_name = item_func(parent)
for ... | [
"def",
"convert_dict",
"(",
"obj",
",",
"ids",
",",
"parent",
",",
"attr_type",
",",
"item_func",
",",
"cdata",
")",
":",
"LOG",
".",
"info",
"(",
"'Inside convert_dict(): obj type is: \"%s\", obj=\"%s\"'",
"%",
"(",
"type",
"(",
"obj",
")",
".",
"__name__",
... | https://github.com/MythTV/mythtv/blob/d282a209cb8be85d036f85a62a8ec971b67d45f4/mythtv/bindings/python/MythTV/utility/dicttoxml.py#L199-L256 | |
wxWidgets/wxPython-Classic | 19571e1ae65f1ac445f5491474121998c97a1bf0 | src/gtk/_core.py | python | ImageHandler.GetType | (*args, **kwargs) | return _core_.ImageHandler_GetType(*args, **kwargs) | GetType(self) -> int | GetType(self) -> int | [
"GetType",
"(",
"self",
")",
"-",
">",
"int"
] | def GetType(*args, **kwargs):
"""GetType(self) -> int"""
return _core_.ImageHandler_GetType(*args, **kwargs) | [
"def",
"GetType",
"(",
"*",
"args",
",",
"*",
"*",
"kwargs",
")",
":",
"return",
"_core_",
".",
"ImageHandler_GetType",
"(",
"*",
"args",
",",
"*",
"*",
"kwargs",
")"
] | https://github.com/wxWidgets/wxPython-Classic/blob/19571e1ae65f1ac445f5491474121998c97a1bf0/src/gtk/_core.py#L2632-L2634 | |
infinit/elle | a8154593c42743f45b9df09daf62b44630c24a02 | drake/src/drake/__init__.py | python | Path.without_last_extension | (self) | return self.with_extension(ext) | Remove the last dot and what follows from the basename.
Does nothing if there is no dot.
>>> p = Path('foo.tar.bz2')
>>> p
Path("foo.tar.bz2")
>>> p = p.without_last_extension()
>>> p
Path("foo.tar")
>>> p = p.without_last_extension()
>>> p
Path("foo")
... | Remove the last dot and what follows from the basename. | [
"Remove",
"the",
"last",
"dot",
"and",
"what",
"follows",
"from",
"the",
"basename",
"."
] | def without_last_extension(self):
"""Remove the last dot and what follows from the basename.
Does nothing if there is no dot.
>>> p = Path('foo.tar.bz2')
>>> p
Path("foo.tar.bz2")
>>> p = p.without_last_extension()
>>> p
Path("foo.tar")
>>> p = p.without_last_exte... | [
"def",
"without_last_extension",
"(",
"self",
")",
":",
"ext",
"=",
"'.'",
".",
"join",
"(",
"self",
".",
"extension",
".",
"split",
"(",
"'.'",
")",
"[",
":",
"-",
"1",
"]",
")",
"return",
"self",
".",
"with_extension",
"(",
"ext",
")"
] | https://github.com/infinit/elle/blob/a8154593c42743f45b9df09daf62b44630c24a02/drake/src/drake/__init__.py#L755-L773 | |
digibyte/digibyte | 0b8a04fb06d5470a15168e2f675aec57bcc24dac | contrib/devtools/security-check.py | python | check_PE_HIGH_ENTROPY_VA | (executable) | return (bits & reqbits) == reqbits | PIE: DllCharacteristics bit 0x20 signifies high-entropy ASLR | PIE: DllCharacteristics bit 0x20 signifies high-entropy ASLR | [
"PIE",
":",
"DllCharacteristics",
"bit",
"0x20",
"signifies",
"high",
"-",
"entropy",
"ASLR"
] | def check_PE_HIGH_ENTROPY_VA(executable):
'''PIE: DllCharacteristics bit 0x20 signifies high-entropy ASLR'''
(arch,bits) = get_PE_dll_characteristics(executable)
if arch == 'i386:x86-64':
reqbits = IMAGE_DLL_CHARACTERISTICS_HIGH_ENTROPY_VA
else: # Unnecessary on 32-bit
assert(arch == 'i3... | [
"def",
"check_PE_HIGH_ENTROPY_VA",
"(",
"executable",
")",
":",
"(",
"arch",
",",
"bits",
")",
"=",
"get_PE_dll_characteristics",
"(",
"executable",
")",
"if",
"arch",
"==",
"'i386:x86-64'",
":",
"reqbits",
"=",
"IMAGE_DLL_CHARACTERISTICS_HIGH_ENTROPY_VA",
"else",
"... | https://github.com/digibyte/digibyte/blob/0b8a04fb06d5470a15168e2f675aec57bcc24dac/contrib/devtools/security-check.py#L150-L158 | |
tinyobjloader/tinyobjloader | 8322e00ae685ea623ab6ac5a6cebcfa2d22fbf93 | deps/cpplint.py | python | _RestoreFilters | () | Restores filters previously backed up. | Restores filters previously backed up. | [
"Restores",
"filters",
"previously",
"backed",
"up",
"."
] | def _RestoreFilters():
""" Restores filters previously backed up."""
_cpplint_state.RestoreFilters() | [
"def",
"_RestoreFilters",
"(",
")",
":",
"_cpplint_state",
".",
"RestoreFilters",
"(",
")"
] | https://github.com/tinyobjloader/tinyobjloader/blob/8322e00ae685ea623ab6ac5a6cebcfa2d22fbf93/deps/cpplint.py#L909-L911 | ||
wxWidgets/wxPython-Classic | 19571e1ae65f1ac445f5491474121998c97a1bf0 | src/osx_carbon/_controls.py | python | RadioBox.IsItemEnabled | (*args, **kwargs) | return _controls_.RadioBox_IsItemEnabled(*args, **kwargs) | IsItemEnabled(self, unsigned int n) -> bool | IsItemEnabled(self, unsigned int n) -> bool | [
"IsItemEnabled",
"(",
"self",
"unsigned",
"int",
"n",
")",
"-",
">",
"bool"
] | def IsItemEnabled(*args, **kwargs):
"""IsItemEnabled(self, unsigned int n) -> bool"""
return _controls_.RadioBox_IsItemEnabled(*args, **kwargs) | [
"def",
"IsItemEnabled",
"(",
"*",
"args",
",",
"*",
"*",
"kwargs",
")",
":",
"return",
"_controls_",
".",
"RadioBox_IsItemEnabled",
"(",
"*",
"args",
",",
"*",
"*",
"kwargs",
")"
] | https://github.com/wxWidgets/wxPython-Classic/blob/19571e1ae65f1ac445f5491474121998c97a1bf0/src/osx_carbon/_controls.py#L2637-L2639 | |
gyunaev/birdtray | e9ddee108b3cdb9d668df88b3400205586ac9316 | .github/scripts/checkTranslation.py | python | TranslationHandler._checkPunctuation | (self) | Check for problems with punctuations. | Check for problems with punctuations. | [
"Check",
"for",
"problems",
"with",
"punctuations",
"."
] | def _checkPunctuation(self):
""" Check for problems with punctuations. """
if self._source == '' or self._translation == '':
return
lastSourceChar = self._source[-1]
lastTranslationChar = self._translation[-1]
if lastSourceChar not in self.SENTENCE_ENDING_PUNCTUATIONS... | [
"def",
"_checkPunctuation",
"(",
"self",
")",
":",
"if",
"self",
".",
"_source",
"==",
"''",
"or",
"self",
".",
"_translation",
"==",
"''",
":",
"return",
"lastSourceChar",
"=",
"self",
".",
"_source",
"[",
"-",
"1",
"]",
"lastTranslationChar",
"=",
"sel... | https://github.com/gyunaev/birdtray/blob/e9ddee108b3cdb9d668df88b3400205586ac9316/.github/scripts/checkTranslation.py#L520-L536 | ||
catboost/catboost | 167f64f237114a4d10b2b4ee42adb4569137debe | contrib/tools/python/src/Lib/distutils/cmd.py | python | Command.initialize_options | (self) | Set default values for all the options that this command
supports. Note that these defaults may be overridden by other
commands, by the setup script, by config files, or by the
command-line. Thus, this is not the place to code dependencies
between options; generally, 'initialize_option... | Set default values for all the options that this command
supports. Note that these defaults may be overridden by other
commands, by the setup script, by config files, or by the
command-line. Thus, this is not the place to code dependencies
between options; generally, 'initialize_option... | [
"Set",
"default",
"values",
"for",
"all",
"the",
"options",
"that",
"this",
"command",
"supports",
".",
"Note",
"that",
"these",
"defaults",
"may",
"be",
"overridden",
"by",
"other",
"commands",
"by",
"the",
"setup",
"script",
"by",
"config",
"files",
"or",
... | def initialize_options(self):
"""Set default values for all the options that this command
supports. Note that these defaults may be overridden by other
commands, by the setup script, by config files, or by the
command-line. Thus, this is not the place to code dependencies
betwe... | [
"def",
"initialize_options",
"(",
"self",
")",
":",
"raise",
"RuntimeError",
",",
"\"abstract method -- subclass %s must override\"",
"%",
"self",
".",
"__class__"
] | https://github.com/catboost/catboost/blob/167f64f237114a4d10b2b4ee42adb4569137debe/contrib/tools/python/src/Lib/distutils/cmd.py#L125-L136 | ||
tensorflow/minigo | 6d89c202cdceaf449aefc3149ab2110d44f1a6a4 | dual_net.py | python | freeze_graph_tpu | (model_path) | Custom freeze_graph implementation for Cloud TPU. | Custom freeze_graph implementation for Cloud TPU. | [
"Custom",
"freeze_graph",
"implementation",
"for",
"Cloud",
"TPU",
"."
] | def freeze_graph_tpu(model_path):
"""Custom freeze_graph implementation for Cloud TPU."""
assert model_path
assert FLAGS.tpu_name
if FLAGS.tpu_name.startswith('grpc://'):
tpu_grpc_url = FLAGS.tpu_name
else:
tpu_cluster_resolver = contrib_cluster_resolver.TPUClusterResolver(
... | [
"def",
"freeze_graph_tpu",
"(",
"model_path",
")",
":",
"assert",
"model_path",
"assert",
"FLAGS",
".",
"tpu_name",
"if",
"FLAGS",
".",
"tpu_name",
".",
"startswith",
"(",
"'grpc://'",
")",
":",
"tpu_grpc_url",
"=",
"FLAGS",
".",
"tpu_name",
"else",
":",
"tp... | https://github.com/tensorflow/minigo/blob/6d89c202cdceaf449aefc3149ab2110d44f1a6a4/dual_net.py#L720-L765 | ||
snap-stanford/snap-python | d53c51b0a26aa7e3e7400b014cdf728948fde80a | setup/snap.py | python | TStr.Empty | (self) | return _snap.TStr_Empty(self) | Empty(TStr self) -> bool
Parameters:
self: TStr const * | Empty(TStr self) -> bool | [
"Empty",
"(",
"TStr",
"self",
")",
"-",
">",
"bool"
] | def Empty(self):
"""
Empty(TStr self) -> bool
Parameters:
self: TStr const *
"""
return _snap.TStr_Empty(self) | [
"def",
"Empty",
"(",
"self",
")",
":",
"return",
"_snap",
".",
"TStr_Empty",
"(",
"self",
")"
] | https://github.com/snap-stanford/snap-python/blob/d53c51b0a26aa7e3e7400b014cdf728948fde80a/setup/snap.py#L9693-L9701 | |
aws/lumberyard | f85344403c1c2e77ec8c75deb2c116e97b713217 | dev/Tools/Python/3.7.10/mac/Python.framework/Versions/3.7/lib/python3.7/site-packages/pip/_vendor/pkg_resources/__init__.py | python | find_eggs_in_zip | (importer, path_item, only=False) | Find eggs in zip files; possibly multiple nested eggs. | Find eggs in zip files; possibly multiple nested eggs. | [
"Find",
"eggs",
"in",
"zip",
"files",
";",
"possibly",
"multiple",
"nested",
"eggs",
"."
] | def find_eggs_in_zip(importer, path_item, only=False):
"""
Find eggs in zip files; possibly multiple nested eggs.
"""
if importer.archive.endswith('.whl'):
# wheels are not supported with this finder
# they don't have PKG-INFO metadata, and won't ever contain eggs
return
meta... | [
"def",
"find_eggs_in_zip",
"(",
"importer",
",",
"path_item",
",",
"only",
"=",
"False",
")",
":",
"if",
"importer",
".",
"archive",
".",
"endswith",
"(",
"'.whl'",
")",
":",
"# wheels are not supported with this finder",
"# they don't have PKG-INFO metadata, and won't ... | https://github.com/aws/lumberyard/blob/f85344403c1c2e77ec8c75deb2c116e97b713217/dev/Tools/Python/3.7.10/mac/Python.framework/Versions/3.7/lib/python3.7/site-packages/pip/_vendor/pkg_resources/__init__.py#L1974-L1998 | ||
ApolloAuto/apollo-platform | 86d9dc6743b496ead18d597748ebabd34a513289 | ros/ros_comm/rostopic/src/rostopic/__init__.py | python | _rostopic_echo | (topic, callback_echo, bag_file=None, echo_all_topics=False) | Print new messages on topic to screen.
:param topic: topic name, ``str``
:param bag_file: name of bag file to echo messages from or ``None``, ``str`` | Print new messages on topic to screen.
:param topic: topic name, ``str``
:param bag_file: name of bag file to echo messages from or ``None``, ``str`` | [
"Print",
"new",
"messages",
"on",
"topic",
"to",
"screen",
".",
":",
"param",
"topic",
":",
"topic",
"name",
"str",
":",
"param",
"bag_file",
":",
"name",
"of",
"bag",
"file",
"to",
"echo",
"messages",
"from",
"or",
"None",
"str"
] | def _rostopic_echo(topic, callback_echo, bag_file=None, echo_all_topics=False):
"""
Print new messages on topic to screen.
:param topic: topic name, ``str``
:param bag_file: name of bag file to echo messages from or ``None``, ``str``
"""
# we have to init a node regardless and bag echoing c... | [
"def",
"_rostopic_echo",
"(",
"topic",
",",
"callback_echo",
",",
"bag_file",
"=",
"None",
",",
"echo_all_topics",
"=",
"False",
")",
":",
"# we have to init a node regardless and bag echoing can print timestamps",
"if",
"bag_file",
":",
"# initialize rospy time due to potent... | https://github.com/ApolloAuto/apollo-platform/blob/86d9dc6743b496ead18d597748ebabd34a513289/ros/ros_comm/rostopic/src/rostopic/__init__.py#L878-L937 | ||
mongodb/mongo | d8ff665343ad29cf286ee2cf4a1960d29371937b | buildscripts/idl/idl/common.py | python | camel_case | (name) | return name[0:1].lower() + name[1:] | Return a camelCased version of a string. | Return a camelCased version of a string. | [
"Return",
"a",
"camelCased",
"version",
"of",
"a",
"string",
"."
] | def camel_case(name):
# type: (str) -> str
"""Return a camelCased version of a string."""
return name[0:1].lower() + name[1:] | [
"def",
"camel_case",
"(",
"name",
")",
":",
"# type: (str) -> str",
"return",
"name",
"[",
"0",
":",
"1",
"]",
".",
"lower",
"(",
")",
"+",
"name",
"[",
"1",
":",
"]"
] | https://github.com/mongodb/mongo/blob/d8ff665343ad29cf286ee2cf4a1960d29371937b/buildscripts/idl/idl/common.py#L56-L59 | |
wlanjie/AndroidFFmpeg | 7baf9122f4b8e1c74e7baf4be5c422c7a5ba5aaf | tools/fdk-aac-build/x86/toolchain/lib/python2.7/mailbox.py | python | MaildirMessage.set_flags | (self, flags) | Set the given flags and unset all others. | Set the given flags and unset all others. | [
"Set",
"the",
"given",
"flags",
"and",
"unset",
"all",
"others",
"."
] | def set_flags(self, flags):
"""Set the given flags and unset all others."""
self._info = '2,' + ''.join(sorted(flags)) | [
"def",
"set_flags",
"(",
"self",
",",
"flags",
")",
":",
"self",
".",
"_info",
"=",
"'2,'",
"+",
"''",
".",
"join",
"(",
"sorted",
"(",
"flags",
")",
")"
] | https://github.com/wlanjie/AndroidFFmpeg/blob/7baf9122f4b8e1c74e7baf4be5c422c7a5ba5aaf/tools/fdk-aac-build/x86/toolchain/lib/python2.7/mailbox.py#L1499-L1501 | ||
mapnik/mapnik | f3da900c355e1d15059c4a91b00203dcc9d9f0ef | scons/scons-local-4.1.0/SCons/Tool/tex.py | python | tex_emitter_core | (target, source, env, graphics_extensions) | return (target, source) | An emitter for TeX and LaTeX sources.
For LaTeX sources we try and find the common created files that
are needed on subsequent runs of latex to finish tables of contents,
bibliographies, indices, lists of figures, and hyperlink references. | An emitter for TeX and LaTeX sources.
For LaTeX sources we try and find the common created files that
are needed on subsequent runs of latex to finish tables of contents,
bibliographies, indices, lists of figures, and hyperlink references. | [
"An",
"emitter",
"for",
"TeX",
"and",
"LaTeX",
"sources",
".",
"For",
"LaTeX",
"sources",
"we",
"try",
"and",
"find",
"the",
"common",
"created",
"files",
"that",
"are",
"needed",
"on",
"subsequent",
"runs",
"of",
"latex",
"to",
"finish",
"tables",
"of",
... | def tex_emitter_core(target, source, env, graphics_extensions):
"""An emitter for TeX and LaTeX sources.
For LaTeX sources we try and find the common created files that
are needed on subsequent runs of latex to finish tables of contents,
bibliographies, indices, lists of figures, and hyperlink reference... | [
"def",
"tex_emitter_core",
"(",
"target",
",",
"source",
",",
"env",
",",
"graphics_extensions",
")",
":",
"basename",
"=",
"SCons",
".",
"Util",
".",
"splitext",
"(",
"str",
"(",
"source",
"[",
"0",
"]",
")",
")",
"[",
"0",
"]",
"basefile",
"=",
"os... | https://github.com/mapnik/mapnik/blob/f3da900c355e1d15059c4a91b00203dcc9d9f0ef/scons/scons-local-4.1.0/SCons/Tool/tex.py#L675-L836 | |
ros-perception/image_pipeline | cd4aa7ab38726d88e8e0144aa0d45ad2f236535a | camera_calibration/src/camera_calibration/calibrator.py | python | _calculate_skew | (corners) | return skew | Get skew for given checkerboard detection.
Scaled to [0,1], which 0 = no skew, 1 = high skew
Skew is proportional to the divergence of three outside corners from 90 degrees. | Get skew for given checkerboard detection.
Scaled to [0,1], which 0 = no skew, 1 = high skew
Skew is proportional to the divergence of three outside corners from 90 degrees. | [
"Get",
"skew",
"for",
"given",
"checkerboard",
"detection",
".",
"Scaled",
"to",
"[",
"0",
"1",
"]",
"which",
"0",
"=",
"no",
"skew",
"1",
"=",
"high",
"skew",
"Skew",
"is",
"proportional",
"to",
"the",
"divergence",
"of",
"three",
"outside",
"corners",
... | def _calculate_skew(corners):
"""
Get skew for given checkerboard detection.
Scaled to [0,1], which 0 = no skew, 1 = high skew
Skew is proportional to the divergence of three outside corners from 90 degrees.
"""
# TODO Using three nearby interior corners might be more robust, outside corners occ... | [
"def",
"_calculate_skew",
"(",
"corners",
")",
":",
"# TODO Using three nearby interior corners might be more robust, outside corners occasionally",
"# get mis-detected",
"up_left",
",",
"up_right",
",",
"down_right",
",",
"_",
"=",
"corners",
"def",
"angle",
"(",
"a",
",",... | https://github.com/ros-perception/image_pipeline/blob/cd4aa7ab38726d88e8e0144aa0d45ad2f236535a/camera_calibration/src/camera_calibration/calibrator.py#L157-L176 | |
wxWidgets/wxPython-Classic | 19571e1ae65f1ac445f5491474121998c97a1bf0 | src/osx_cocoa/_core.py | python | Window.IsShownOnScreen | (*args, **kwargs) | return _core_.Window_IsShownOnScreen(*args, **kwargs) | IsShownOnScreen(self) -> bool
Returns ``True`` if the window is physically visible on the screen,
i.e. it is shown and all its parents up to the toplevel window are
shown as well. | IsShownOnScreen(self) -> bool | [
"IsShownOnScreen",
"(",
"self",
")",
"-",
">",
"bool"
] | def IsShownOnScreen(*args, **kwargs):
"""
IsShownOnScreen(self) -> bool
Returns ``True`` if the window is physically visible on the screen,
i.e. it is shown and all its parents up to the toplevel window are
shown as well.
"""
return _core_.Window_IsShownOnScreen(... | [
"def",
"IsShownOnScreen",
"(",
"*",
"args",
",",
"*",
"*",
"kwargs",
")",
":",
"return",
"_core_",
".",
"Window_IsShownOnScreen",
"(",
"*",
"args",
",",
"*",
"*",
"kwargs",
")"
] | https://github.com/wxWidgets/wxPython-Classic/blob/19571e1ae65f1ac445f5491474121998c97a1bf0/src/osx_cocoa/_core.py#L10006-L10014 | |
BDLDev/bdlauncher | d10fb098852ebcf9fb71afb23052a463ee7b5d0a | scripts/cppheaderparser.py | python | CppHeader.__init__ | (self, headerFileName, argType="file", **kwargs) | Create the parsed C++ header file parse tree
headerFileName - Name of the file to parse OR actual file contents (depends on argType)
argType - Indicates how to interpret headerFileName as a file string or file name
kwargs - Supports the following keywords | Create the parsed C++ header file parse tree
headerFileName - Name of the file to parse OR actual file contents (depends on argType)
argType - Indicates how to interpret headerFileName as a file string or file name
kwargs - Supports the following keywords | [
"Create",
"the",
"parsed",
"C",
"++",
"header",
"file",
"parse",
"tree",
"headerFileName",
"-",
"Name",
"of",
"the",
"file",
"to",
"parse",
"OR",
"actual",
"file",
"contents",
"(",
"depends",
"on",
"argType",
")",
"argType",
"-",
"Indicates",
"how",
"to",
... | def __init__(self, headerFileName, argType="file", **kwargs):
"""Create the parsed C++ header file parse tree
headerFileName - Name of the file to parse OR actual file contents (depends on argType)
argType - Indicates how to interpret headerFileName as a file string or file name
... | [
"def",
"__init__",
"(",
"self",
",",
"headerFileName",
",",
"argType",
"=",
"\"file\"",
",",
"*",
"*",
"kwargs",
")",
":",
"## reset global state ##",
"global",
"doxygenCommentCache",
"doxygenCommentCache",
"=",
"\"\"",
"CppVariable",
".",
"Vars",
"=",
"[",
"]",... | https://github.com/BDLDev/bdlauncher/blob/d10fb098852ebcf9fb71afb23052a463ee7b5d0a/scripts/cppheaderparser.py#L2070-L2426 | ||
benoitsteiner/tensorflow-opencl | cb7cb40a57fde5cfd4731bc551e82a1e2fef43a5 | tensorflow/python/ops/control_flow_ops.py | python | GradLoopState.forward_sync | (self) | return self._forward_sync | A control trigger node for synchronization in the forward loop.
One main use is to keep the push ops of a stack executed in the
iteration order. | A control trigger node for synchronization in the forward loop. | [
"A",
"control",
"trigger",
"node",
"for",
"synchronization",
"in",
"the",
"forward",
"loop",
"."
] | def forward_sync(self):
"""A control trigger node for synchronization in the forward loop.
One main use is to keep the push ops of a stack executed in the
iteration order.
"""
if self._forward_sync is None:
with ops.control_dependencies(None):
self._forward_sync = control_trigger(name... | [
"def",
"forward_sync",
"(",
"self",
")",
":",
"if",
"self",
".",
"_forward_sync",
"is",
"None",
":",
"with",
"ops",
".",
"control_dependencies",
"(",
"None",
")",
":",
"self",
".",
"_forward_sync",
"=",
"control_trigger",
"(",
"name",
"=",
"\"f_sync\"",
")... | https://github.com/benoitsteiner/tensorflow-opencl/blob/cb7cb40a57fde5cfd4731bc551e82a1e2fef43a5/tensorflow/python/ops/control_flow_ops.py#L762-L773 | |
wxWidgets/wxPython-Classic | 19571e1ae65f1ac445f5491474121998c97a1bf0 | src/msw/grid.py | python | GridSizeEvent.GetRowOrCol | (*args, **kwargs) | return _grid.GridSizeEvent_GetRowOrCol(*args, **kwargs) | GetRowOrCol(self) -> int | GetRowOrCol(self) -> int | [
"GetRowOrCol",
"(",
"self",
")",
"-",
">",
"int"
] | def GetRowOrCol(*args, **kwargs):
"""GetRowOrCol(self) -> int"""
return _grid.GridSizeEvent_GetRowOrCol(*args, **kwargs) | [
"def",
"GetRowOrCol",
"(",
"*",
"args",
",",
"*",
"*",
"kwargs",
")",
":",
"return",
"_grid",
".",
"GridSizeEvent_GetRowOrCol",
"(",
"*",
"args",
",",
"*",
"*",
"kwargs",
")"
] | https://github.com/wxWidgets/wxPython-Classic/blob/19571e1ae65f1ac445f5491474121998c97a1bf0/src/msw/grid.py#L2357-L2359 | |
mantidproject/mantid | 03deeb89254ec4289edb8771e0188c2090a02f32 | scripts/abins/spowdersemiempiricalcalculator.py | python | SPowderSemiEmpiricalCalculator._calculate_s | (self) | Calculate structure factor by dispatching to appropriate 1d or 2d workflow | Calculate structure factor by dispatching to appropriate 1d or 2d workflow | [
"Calculate",
"structure",
"factor",
"by",
"dispatching",
"to",
"appropriate",
"1d",
"or",
"2d",
"workflow"
] | def _calculate_s(self) -> SData:
"""Calculate structure factor by dispatching to appropriate 1d or 2d workflow"""
from abins.constants import ONE_DIMENSIONAL_INSTRUMENTS, TWO_DIMENSIONAL_INSTRUMENTS
# Compute tensors and traces, write to cache for access during atomic s calculations
pow... | [
"def",
"_calculate_s",
"(",
"self",
")",
"->",
"SData",
":",
"from",
"abins",
".",
"constants",
"import",
"ONE_DIMENSIONAL_INSTRUMENTS",
",",
"TWO_DIMENSIONAL_INSTRUMENTS",
"# Compute tensors and traces, write to cache for access during atomic s calculations",
"powder_calculator",
... | https://github.com/mantidproject/mantid/blob/03deeb89254ec4289edb8771e0188c2090a02f32/scripts/abins/spowdersemiempiricalcalculator.py#L242-L258 | ||
apple/turicreate | cce55aa5311300e3ce6af93cb45ba791fd1bdf49 | src/external/coremltools_wrap/coremltools/coremltools/converters/onnx/_error_utils.py | python | ErrorHandling.unsupported_op | (
self, node, # type: Node
) | Either raise an error for an unsupported op type or return custom layer add function | Either raise an error for an unsupported op type or return custom layer add function | [
"Either",
"raise",
"an",
"error",
"for",
"an",
"unsupported",
"op",
"type",
"or",
"return",
"custom",
"layer",
"add",
"function"
] | def unsupported_op(
self, node, # type: Node
):
# type: (...) -> Callable[[Any, Node, Graph, ErrorHandling], None]
"""
Either raise an error for an unsupported op type or return custom layer add function
"""
if self.add_custom_layers:
from ._operators import ... | [
"def",
"unsupported_op",
"(",
"self",
",",
"node",
",",
"# type: Node",
")",
":",
"# type: (...) -> Callable[[Any, Node, Graph, ErrorHandling], None]",
"if",
"self",
".",
"add_custom_layers",
":",
"from",
".",
"_operators",
"import",
"_convert_custom",
"return",
"_convert... | https://github.com/apple/turicreate/blob/cce55aa5311300e3ce6af93cb45ba791fd1bdf49/src/external/coremltools_wrap/coremltools/coremltools/converters/onnx/_error_utils.py#L31-L47 | ||
Polidea/SiriusObfuscator | b0e590d8130e97856afe578869b83a209e2b19be | SymbolExtractorAndRenamer/compiler-rt/lib/sanitizer_common/scripts/cpplint.py | python | IsCppString | (line) | return ((line.count('"') - line.count(r'\"') - line.count("'\"'")) & 1) == 1 | Does line terminate so, that the next symbol is in string constant.
This function does not consider single-line nor multi-line comments.
Args:
line: is a partial line of code starting from the 0..n.
Returns:
True, if next character appended to 'line' is inside a
string constant. | Does line terminate so, that the next symbol is in string constant. | [
"Does",
"line",
"terminate",
"so",
"that",
"the",
"next",
"symbol",
"is",
"in",
"string",
"constant",
"."
] | def IsCppString(line):
"""Does line terminate so, that the next symbol is in string constant.
This function does not consider single-line nor multi-line comments.
Args:
line: is a partial line of code starting from the 0..n.
Returns:
True, if next character appended to 'line' is inside a
string c... | [
"def",
"IsCppString",
"(",
"line",
")",
":",
"line",
"=",
"line",
".",
"replace",
"(",
"r'\\\\'",
",",
"'XX'",
")",
"# after this, \\\\\" does not match to \\\"",
"return",
"(",
"(",
"line",
".",
"count",
"(",
"'\"'",
")",
"-",
"line",
".",
"count",
"(",
... | https://github.com/Polidea/SiriusObfuscator/blob/b0e590d8130e97856afe578869b83a209e2b19be/SymbolExtractorAndRenamer/compiler-rt/lib/sanitizer_common/scripts/cpplint.py#L909-L923 | |
aws/lumberyard | f85344403c1c2e77ec8c75deb2c116e97b713217 | dev/Tools/Python/3.7.10/windows/Lib/ast.py | python | iter_fields | (node) | Yield a tuple of ``(fieldname, value)`` for each field in ``node._fields``
that is present on *node*. | Yield a tuple of ``(fieldname, value)`` for each field in ``node._fields``
that is present on *node*. | [
"Yield",
"a",
"tuple",
"of",
"(",
"fieldname",
"value",
")",
"for",
"each",
"field",
"in",
"node",
".",
"_fields",
"that",
"is",
"present",
"on",
"*",
"node",
"*",
"."
] | def iter_fields(node):
"""
Yield a tuple of ``(fieldname, value)`` for each field in ``node._fields``
that is present on *node*.
"""
for field in node._fields:
try:
yield field, getattr(node, field)
except AttributeError:
pass | [
"def",
"iter_fields",
"(",
"node",
")",
":",
"for",
"field",
"in",
"node",
".",
"_fields",
":",
"try",
":",
"yield",
"field",
",",
"getattr",
"(",
"node",
",",
"field",
")",
"except",
"AttributeError",
":",
"pass"
] | https://github.com/aws/lumberyard/blob/f85344403c1c2e77ec8c75deb2c116e97b713217/dev/Tools/Python/3.7.10/windows/Lib/ast.py#L181-L190 | ||
wxWidgets/wxPython-Classic | 19571e1ae65f1ac445f5491474121998c97a1bf0 | src/osx_carbon/richtext.py | python | RichTextRange.IsWithin | (*args, **kwargs) | return _richtext.RichTextRange_IsWithin(*args, **kwargs) | IsWithin(self, RichTextRange range) -> bool
Returns true if this range is completely within 'range' | IsWithin(self, RichTextRange range) -> bool | [
"IsWithin",
"(",
"self",
"RichTextRange",
"range",
")",
"-",
">",
"bool"
] | def IsWithin(*args, **kwargs):
"""
IsWithin(self, RichTextRange range) -> bool
Returns true if this range is completely within 'range'
"""
return _richtext.RichTextRange_IsWithin(*args, **kwargs) | [
"def",
"IsWithin",
"(",
"*",
"args",
",",
"*",
"*",
"kwargs",
")",
":",
"return",
"_richtext",
".",
"RichTextRange_IsWithin",
"(",
"*",
"args",
",",
"*",
"*",
"kwargs",
")"
] | https://github.com/wxWidgets/wxPython-Classic/blob/19571e1ae65f1ac445f5491474121998c97a1bf0/src/osx_carbon/richtext.py#L995-L1001 | |
kamyu104/LeetCode-Solutions | 77605708a927ea3b85aee5a479db733938c7c211 | Python/poor-pigs.py | python | Solution.poorPigs | (self, buckets, minutesToDie, minutesToTest) | return int(math.ceil(math.log(buckets) / math.log(minutesToTest / minutesToDie + 1))) | :type buckets: int
:type minutesToDie: int
:type minutesToTest: int
:rtype: int | :type buckets: int
:type minutesToDie: int
:type minutesToTest: int
:rtype: int | [
":",
"type",
"buckets",
":",
"int",
":",
"type",
"minutesToDie",
":",
"int",
":",
"type",
"minutesToTest",
":",
"int",
":",
"rtype",
":",
"int"
] | def poorPigs(self, buckets, minutesToDie, minutesToTest):
"""
:type buckets: int
:type minutesToDie: int
:type minutesToTest: int
:rtype: int
"""
return int(math.ceil(math.log(buckets) / math.log(minutesToTest / minutesToDie + 1))) | [
"def",
"poorPigs",
"(",
"self",
",",
"buckets",
",",
"minutesToDie",
",",
"minutesToTest",
")",
":",
"return",
"int",
"(",
"math",
".",
"ceil",
"(",
"math",
".",
"log",
"(",
"buckets",
")",
"/",
"math",
".",
"log",
"(",
"minutesToTest",
"/",
"minutesTo... | https://github.com/kamyu104/LeetCode-Solutions/blob/77605708a927ea3b85aee5a479db733938c7c211/Python/poor-pigs.py#L8-L15 | |
y123456yz/reading-and-annotate-mongodb-3.6 | 93280293672ca7586dc24af18132aa61e4ed7fcf | mongo/src/third_party/scons-2.5.0/scons-local-2.5.0/SCons/Variables/PathVariable.py | python | _PathVariableClass.PathIsDir | (self, key, val, env) | Validator to check if Path is a directory. | Validator to check if Path is a directory. | [
"Validator",
"to",
"check",
"if",
"Path",
"is",
"a",
"directory",
"."
] | def PathIsDir(self, key, val, env):
"""Validator to check if Path is a directory."""
if not os.path.isdir(val):
if os.path.isfile(val):
m = 'Directory path for option %s is a file: %s'
else:
m = 'Directory path for option %s does not exist: %s'
... | [
"def",
"PathIsDir",
"(",
"self",
",",
"key",
",",
"val",
",",
"env",
")",
":",
"if",
"not",
"os",
".",
"path",
".",
"isdir",
"(",
"val",
")",
":",
"if",
"os",
".",
"path",
".",
"isfile",
"(",
"val",
")",
":",
"m",
"=",
"'Directory path for option... | https://github.com/y123456yz/reading-and-annotate-mongodb-3.6/blob/93280293672ca7586dc24af18132aa61e4ed7fcf/mongo/src/third_party/scons-2.5.0/scons-local-2.5.0/SCons/Variables/PathVariable.py#L86-L93 | ||
NASA-SW-VnV/ikos | 71325dfb94737332542caa708d7537752021522d | analyzer/python/ikos/scan.py | python | check_output | (cmd) | Run the given command and return the standard output, in bytes | Run the given command and return the standard output, in bytes | [
"Run",
"the",
"given",
"command",
"and",
"return",
"the",
"standard",
"output",
"in",
"bytes"
] | def check_output(cmd):
''' Run the given command and return the standard output, in bytes '''
log.debug('Running %s' % command_string(cmd))
try:
return subprocess.check_output(cmd)
except OSError as e:
printf('error: %s: %s\n', cmd[0], e.strerror, file=sys.stderr)
sys.exit(e.err... | [
"def",
"check_output",
"(",
"cmd",
")",
":",
"log",
".",
"debug",
"(",
"'Running %s'",
"%",
"command_string",
"(",
"cmd",
")",
")",
"try",
":",
"return",
"subprocess",
".",
"check_output",
"(",
"cmd",
")",
"except",
"OSError",
"as",
"e",
":",
"printf",
... | https://github.com/NASA-SW-VnV/ikos/blob/71325dfb94737332542caa708d7537752021522d/analyzer/python/ikos/scan.py#L436-L444 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.