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 |
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
aws/lumberyard | f85344403c1c2e77ec8c75deb2c116e97b713217 | dev/Tools/Python/3.7.10/linux_x64/lib/python3.7/importlib/_bootstrap_external.py | python | FileFinder.find_spec | (self, fullname, target=None) | return None | Try to find a spec for the specified module.
Returns the matching spec, or None if not found. | Try to find a spec for the specified module. | [
"Try",
"to",
"find",
"a",
"spec",
"for",
"the",
"specified",
"module",
"."
] | def find_spec(self, fullname, target=None):
"""Try to find a spec for the specified module.
Returns the matching spec, or None if not found.
"""
is_namespace = False
tail_module = fullname.rpartition('.')[2]
try:
mtime = _path_stat(self.path or _os.getcwd()).... | [
"def",
"find_spec",
"(",
"self",
",",
"fullname",
",",
"target",
"=",
"None",
")",
":",
"is_namespace",
"=",
"False",
"tail_module",
"=",
"fullname",
".",
"rpartition",
"(",
"'.'",
")",
"[",
"2",
"]",
"try",
":",
"mtime",
"=",
"_path_stat",
"(",
"self"... | https://github.com/aws/lumberyard/blob/f85344403c1c2e77ec8c75deb2c116e97b713217/dev/Tools/Python/3.7.10/linux_x64/lib/python3.7/importlib/_bootstrap_external.py#L1356-L1402 | |
commaai/openpilot | 4416c21b1e738ab7d04147c5ae52b5135e0cdb40 | pyextra/acados_template/acados_ocp.py | python | AcadosOcpConstraints.idxsphi_e | (self) | return self.__idxsphi_e | Indices of soft nonlinear constraints at shooting node N within the indices of nonlinear constraints at terminal shooting node N.
Can be set by using :py:attr:`Jsphi_e`.
Type: :code:`np.ndarray`; default: :code:`np.array([])` | Indices of soft nonlinear constraints at shooting node N within the indices of nonlinear constraints at terminal shooting node N.
Can be set by using :py:attr:`Jsphi_e`.
Type: :code:`np.ndarray`; default: :code:`np.array([])` | [
"Indices",
"of",
"soft",
"nonlinear",
"constraints",
"at",
"shooting",
"node",
"N",
"within",
"the",
"indices",
"of",
"nonlinear",
"constraints",
"at",
"terminal",
"shooting",
"node",
"N",
".",
"Can",
"be",
"set",
"by",
"using",
":",
"py",
":",
"attr",
":"... | def idxsphi_e(self):
"""Indices of soft nonlinear constraints at shooting node N within the indices of nonlinear constraints at terminal shooting node N.
Can be set by using :py:attr:`Jsphi_e`.
Type: :code:`np.ndarray`; default: :code:`np.array([])`"""
return self.__idxsphi_e | [
"def",
"idxsphi_e",
"(",
"self",
")",
":",
"return",
"self",
".",
"__idxsphi_e"
] | https://github.com/commaai/openpilot/blob/4416c21b1e738ab7d04147c5ae52b5135e0cdb40/pyextra/acados_template/acados_ocp.py#L1549-L1553 | |
espressomd/espresso | 7e29f9052e710fe1ebf0f5d2a8076b32921fbc6a | samples/gibbs_ensemble/gibbs_ensemble.py | python | Client.add_particle | (self) | Add a particle at random inside box | Add a particle at random inside box | [
"Add",
"a",
"particle",
"at",
"random",
"inside",
"box"
] | def add_particle(self):
""" Add a particle at random inside box """
self.last_added_particle = self.system.part.add(
pos=np.random.random(3) * self.system.box_l)
self.send_energy() | [
"def",
"add_particle",
"(",
"self",
")",
":",
"self",
".",
"last_added_particle",
"=",
"self",
".",
"system",
".",
"part",
".",
"add",
"(",
"pos",
"=",
"np",
".",
"random",
".",
"random",
"(",
"3",
")",
"*",
"self",
".",
"system",
".",
"box_l",
")"... | https://github.com/espressomd/espresso/blob/7e29f9052e710fe1ebf0f5d2a8076b32921fbc6a/samples/gibbs_ensemble/gibbs_ensemble.py#L96-L100 | ||
gnuradio/gnuradio | 09c3c4fa4bfb1a02caac74cb5334dfe065391e3b | grc/gui/ParamWidgets.py | python | DirectoryParam._handle_clicked | (self, widget=None) | Open the directory selector, when the button is clicked.
On success, update the entry. | Open the directory selector, when the button is clicked.
On success, update the entry. | [
"Open",
"the",
"directory",
"selector",
"when",
"the",
"button",
"is",
"clicked",
".",
"On",
"success",
"update",
"the",
"entry",
"."
] | def _handle_clicked(self, widget=None):
"""
Open the directory selector, when the button is clicked.
On success, update the entry.
"""
dirname = self.param.get_evaluated() if self.param.is_valid() else ''
# Check if directory exists, if not fall back to workdir
i... | [
"def",
"_handle_clicked",
"(",
"self",
",",
"widget",
"=",
"None",
")",
":",
"dirname",
"=",
"self",
".",
"param",
".",
"get_evaluated",
"(",
")",
"if",
"self",
".",
"param",
".",
"is_valid",
"(",
")",
"else",
"''",
"# Check if directory exists, if not fall ... | https://github.com/gnuradio/gnuradio/blob/09c3c4fa4bfb1a02caac74cb5334dfe065391e3b/grc/gui/ParamWidgets.py#L351-L386 | ||
ApolloAuto/apollo-platform | 86d9dc6743b496ead18d597748ebabd34a513289 | ros/third_party/lib_x86_64/python2.7/dist-packages/catkin_pkg/python_setup.py | python | generate_distutils_setup | (package_xml_path=os.path.curdir, **kwargs) | return data | Extract the information relevant for distutils from the package
manifest. The following keys will be set:
The "name" and "version" are taken from the eponymous tags.
A single maintainer will set the keys "maintainer" and
"maintainer_email" while multiple maintainers are merged into the
"maintainer... | Extract the information relevant for distutils from the package
manifest. The following keys will be set: | [
"Extract",
"the",
"information",
"relevant",
"for",
"distutils",
"from",
"the",
"package",
"manifest",
".",
"The",
"following",
"keys",
"will",
"be",
"set",
":"
] | def generate_distutils_setup(package_xml_path=os.path.curdir, **kwargs):
"""
Extract the information relevant for distutils from the package
manifest. The following keys will be set:
The "name" and "version" are taken from the eponymous tags.
A single maintainer will set the keys "maintainer" and
... | [
"def",
"generate_distutils_setup",
"(",
"package_xml_path",
"=",
"os",
".",
"path",
".",
"curdir",
",",
"*",
"*",
"kwargs",
")",
":",
"package",
"=",
"parse_package",
"(",
"package_xml_path",
")",
"data",
"=",
"{",
"}",
"data",
"[",
"'name'",
"]",
"=",
"... | https://github.com/ApolloAuto/apollo-platform/blob/86d9dc6743b496ead18d597748ebabd34a513289/ros/third_party/lib_x86_64/python2.7/dist-packages/catkin_pkg/python_setup.py#L46-L119 | |
root-project/root | fcd3583bb14852bf2e8cd2415717cbaac0e75896 | interpreter/llvm/src/utils/sort_includes.py | python | sort_includes | (f) | Sort the #include lines of a specific file. | Sort the #include lines of a specific file. | [
"Sort",
"the",
"#include",
"lines",
"of",
"a",
"specific",
"file",
"."
] | def sort_includes(f):
"""Sort the #include lines of a specific file."""
# Skip files which are under INPUTS trees or test trees.
if 'INPUTS/' in f.name or 'test/' in f.name:
return
ext = os.path.splitext(f.name)[1]
if ext not in ['.cpp', '.c', '.h', '.inc', '.def']:
return
lines = f.readlines()
... | [
"def",
"sort_includes",
"(",
"f",
")",
":",
"# Skip files which are under INPUTS trees or test trees.",
"if",
"'INPUTS/'",
"in",
"f",
".",
"name",
"or",
"'test/'",
"in",
"f",
".",
"name",
":",
"return",
"ext",
"=",
"os",
".",
"path",
".",
"splitext",
"(",
"f... | https://github.com/root-project/root/blob/fcd3583bb14852bf2e8cd2415717cbaac0e75896/interpreter/llvm/src/utils/sort_includes.py#L14-L82 | ||
wxWidgets/wxPython-Classic | 19571e1ae65f1ac445f5491474121998c97a1bf0 | src/osx_cocoa/_windows.py | python | Dialog.CreateTextSizer | (*args, **kwargs) | return _windows_.Dialog_CreateTextSizer(*args, **kwargs) | CreateTextSizer(self, String message) -> Sizer | CreateTextSizer(self, String message) -> Sizer | [
"CreateTextSizer",
"(",
"self",
"String",
"message",
")",
"-",
">",
"Sizer"
] | def CreateTextSizer(*args, **kwargs):
"""CreateTextSizer(self, String message) -> Sizer"""
return _windows_.Dialog_CreateTextSizer(*args, **kwargs) | [
"def",
"CreateTextSizer",
"(",
"*",
"args",
",",
"*",
"*",
"kwargs",
")",
":",
"return",
"_windows_",
".",
"Dialog_CreateTextSizer",
"(",
"*",
"args",
",",
"*",
"*",
"kwargs",
")"
] | https://github.com/wxWidgets/wxPython-Classic/blob/19571e1ae65f1ac445f5491474121998c97a1bf0/src/osx_cocoa/_windows.py#L776-L778 | |
NASA-SW-VnV/ikos | 71325dfb94737332542caa708d7537752021522d | analyzer/python/ikos/report.py | python | generate_summary | (db) | return summary | Return the analysis summary: number of errors, warnings, ok and
unreachable per checked statements. | Return the analysis summary: number of errors, warnings, ok and
unreachable per checked statements. | [
"Return",
"the",
"analysis",
"summary",
":",
"number",
"of",
"errors",
"warnings",
"ok",
"and",
"unreachable",
"per",
"checked",
"statements",
"."
] | def generate_summary(db):
'''
Return the analysis summary: number of errors, warnings, ok and
unreachable per checked statements.
'''
summary = Summary(ok=0, error=0, warning=0, unreachable=0)
c = db.con.cursor()
order_by = 'statement_id, call_context_id'
c.execute('SELECT * FROM checks... | [
"def",
"generate_summary",
"(",
"db",
")",
":",
"summary",
"=",
"Summary",
"(",
"ok",
"=",
"0",
",",
"error",
"=",
"0",
",",
"warning",
"=",
"0",
",",
"unreachable",
"=",
"0",
")",
"c",
"=",
"db",
".",
"con",
".",
"cursor",
"(",
")",
"order_by",
... | https://github.com/NASA-SW-VnV/ikos/blob/71325dfb94737332542caa708d7537752021522d/analyzer/python/ikos/report.py#L181-L231 | |
wlanjie/AndroidFFmpeg | 7baf9122f4b8e1c74e7baf4be5c422c7a5ba5aaf | tools/fdk-aac-build/armeabi-v7a/toolchain/lib/python2.7/xml/dom/expatbuilder.py | python | Namespaces.install | (self, parser) | Insert the namespace-handlers onto the parser. | Insert the namespace-handlers onto the parser. | [
"Insert",
"the",
"namespace",
"-",
"handlers",
"onto",
"the",
"parser",
"."
] | def install(self, parser):
"""Insert the namespace-handlers onto the parser."""
ExpatBuilder.install(self, parser)
if self._options.namespace_declarations:
parser.StartNamespaceDeclHandler = (
self.start_namespace_decl_handler) | [
"def",
"install",
"(",
"self",
",",
"parser",
")",
":",
"ExpatBuilder",
".",
"install",
"(",
"self",
",",
"parser",
")",
"if",
"self",
".",
"_options",
".",
"namespace_declarations",
":",
"parser",
".",
"StartNamespaceDeclHandler",
"=",
"(",
"self",
".",
"... | https://github.com/wlanjie/AndroidFFmpeg/blob/7baf9122f4b8e1c74e7baf4be5c422c7a5ba5aaf/tools/fdk-aac-build/armeabi-v7a/toolchain/lib/python2.7/xml/dom/expatbuilder.py#L732-L737 | ||
aws/lumberyard | f85344403c1c2e77ec8c75deb2c116e97b713217 | dev/Gems/CloudGemMetric/v1/AWS/common-code/Lib/pandas/core/generic.py | python | NDFrame._validate_dtype | (self, dtype) | return dtype | validate the passed dtype | validate the passed dtype | [
"validate",
"the",
"passed",
"dtype"
] | def _validate_dtype(self, dtype):
""" validate the passed dtype """
if dtype is not None:
dtype = pandas_dtype(dtype)
# a compound dtype
if dtype.kind == "V":
raise NotImplementedError(
"compound dtypes are not implemented"
... | [
"def",
"_validate_dtype",
"(",
"self",
",",
"dtype",
")",
":",
"if",
"dtype",
"is",
"not",
"None",
":",
"dtype",
"=",
"pandas_dtype",
"(",
"dtype",
")",
"# a compound dtype",
"if",
"dtype",
".",
"kind",
"==",
"\"V\"",
":",
"raise",
"NotImplementedError",
"... | https://github.com/aws/lumberyard/blob/f85344403c1c2e77ec8c75deb2c116e97b713217/dev/Gems/CloudGemMetric/v1/AWS/common-code/Lib/pandas/core/generic.py#L255-L268 | |
aws/lumberyard | f85344403c1c2e77ec8c75deb2c116e97b713217 | dev/Tools/Python/3.7.10/windows/Lib/lib2to3/fixer_util.py | python | Subscript | (index_node) | return Node(syms.trailer, [Leaf(token.LBRACE, "["),
index_node,
Leaf(token.RBRACE, "]")]) | A numeric or string subscript | A numeric or string subscript | [
"A",
"numeric",
"or",
"string",
"subscript"
] | def Subscript(index_node):
"""A numeric or string subscript"""
return Node(syms.trailer, [Leaf(token.LBRACE, "["),
index_node,
Leaf(token.RBRACE, "]")]) | [
"def",
"Subscript",
"(",
"index_node",
")",
":",
"return",
"Node",
"(",
"syms",
".",
"trailer",
",",
"[",
"Leaf",
"(",
"token",
".",
"LBRACE",
",",
"\"[\"",
")",
",",
"index_node",
",",
"Leaf",
"(",
"token",
".",
"RBRACE",
",",
"\"]\"",
")",
"]",
"... | https://github.com/aws/lumberyard/blob/f85344403c1c2e77ec8c75deb2c116e97b713217/dev/Tools/Python/3.7.10/windows/Lib/lib2to3/fixer_util.py#L77-L81 | |
wxWidgets/wxPython-Classic | 19571e1ae65f1ac445f5491474121998c97a1bf0 | wx/tools/Editra/src/extern/pubsub.py | python | _TopicTreeNode.hasSubtopic | (self, subtopic) | return self.__subtopics.has_key(subtopic) | Return true only if topic string is one of subtopics of this node | Return true only if topic string is one of subtopics of this node | [
"Return",
"true",
"only",
"if",
"topic",
"string",
"is",
"one",
"of",
"subtopics",
"of",
"this",
"node"
] | def hasSubtopic(self, subtopic):
"""Return true only if topic string is one of subtopics of this node"""
return self.__subtopics.has_key(subtopic) | [
"def",
"hasSubtopic",
"(",
"self",
",",
"subtopic",
")",
":",
"return",
"self",
".",
"__subtopics",
".",
"has_key",
"(",
"subtopic",
")"
] | https://github.com/wxWidgets/wxPython-Classic/blob/19571e1ae65f1ac445f5491474121998c97a1bf0/wx/tools/Editra/src/extern/pubsub.py#L285-L287 | |
tensorflow/tensorflow | 419e3a6b650ea4bd1b0cba23c4348f8a69f3272e | tensorflow/python/ops/math_ops.py | python | tensordot | (a, b, axes, name=None) | r"""Tensor contraction of a and b along specified axes and outer product.
Tensordot (also known as tensor contraction) sums the product of elements
from `a` and `b` over the indices specified by `axes`.
This operation corresponds to `numpy.tensordot(a, b, axes)`.
Example 1: When `a` and `b` are matrices (ord... | r"""Tensor contraction of a and b along specified axes and outer product. | [
"r",
"Tensor",
"contraction",
"of",
"a",
"and",
"b",
"along",
"specified",
"axes",
"and",
"outer",
"product",
"."
] | def tensordot(a, b, axes, name=None):
r"""Tensor contraction of a and b along specified axes and outer product.
Tensordot (also known as tensor contraction) sums the product of elements
from `a` and `b` over the indices specified by `axes`.
This operation corresponds to `numpy.tensordot(a, b, axes)`.
Examp... | [
"def",
"tensordot",
"(",
"a",
",",
"b",
",",
"axes",
",",
"name",
"=",
"None",
")",
":",
"def",
"_tensordot_reshape",
"(",
"a",
",",
"axes",
",",
"flipped",
"=",
"False",
")",
":",
"\"\"\"Helper method to perform transpose and reshape for contraction op.\n\n Th... | https://github.com/tensorflow/tensorflow/blob/419e3a6b650ea4bd1b0cba23c4348f8a69f3272e/tensorflow/python/ops/math_ops.py#L4962-L5139 | ||
gamedev-net/nehe-opengl | 9f073e5b092ad8dbcb21393871a2855fe86a65c6 | python/lesson44/ztv121/glCamera.py | python | glCamera.PointInFrustum | (self, x,y,z) | return(True) | // This member fuction checks to see if a point is in
// the viewing volume. | // This member fuction checks to see if a point is in
// the viewing volume. | [
"//",
"This",
"member",
"fuction",
"checks",
"to",
"see",
"if",
"a",
"point",
"is",
"in",
"//",
"the",
"viewing",
"volume",
"."
] | def PointInFrustum(self, x,y,z):
""" // This member fuction checks to see if a point is in
// the viewing volume. """
# // The idea behind this algorithum is that if the point
# // is inside all 6 clipping planes then it is inside our
# // viewing volume so we can return true.
Frustum = self.m_Frustum
... | [
"def",
"PointInFrustum",
"(",
"self",
",",
"x",
",",
"y",
",",
"z",
")",
":",
"# // The idea behind this algorithum is that if the point",
"# // is inside all 6 clipping planes then it is inside our",
"# // viewing volume so we can return true.",
"Frustum",
"=",
"self",
".",
"m... | https://github.com/gamedev-net/nehe-opengl/blob/9f073e5b092ad8dbcb21393871a2855fe86a65c6/python/lesson44/ztv121/glCamera.py#L452-L467 | |
microsoft/DirectXShaderCompiler | 8348ff8d9e0287610ba05d3a828e10af981a1c05 | utils/hct/hctdb.py | python | db_dxil.add_enum_type | (self, name, doc, valNameDocTuples) | Adds a new enumeration type with name/value/doc tuples | Adds a new enumeration type with name/value/doc tuples | [
"Adds",
"a",
"new",
"enumeration",
"type",
"with",
"name",
"/",
"value",
"/",
"doc",
"tuples"
] | def add_enum_type(self, name, doc, valNameDocTuples):
"Adds a new enumeration type with name/value/doc tuples"
self.enums.append(db_dxil_enum(name, doc, valNameDocTuples)) | [
"def",
"add_enum_type",
"(",
"self",
",",
"name",
",",
"doc",
",",
"valNameDocTuples",
")",
":",
"self",
".",
"enums",
".",
"append",
"(",
"db_dxil_enum",
"(",
"name",
",",
"doc",
",",
"valNameDocTuples",
")",
")"
] | https://github.com/microsoft/DirectXShaderCompiler/blob/8348ff8d9e0287610ba05d3a828e10af981a1c05/utils/hct/hctdb.py#L199-L201 | ||
Polidea/SiriusObfuscator | b0e590d8130e97856afe578869b83a209e2b19be | SymbolExtractorAndRenamer/clang/bindings/python/clang/cindex.py | python | TokenKind.from_value | (value) | return result | Obtain a registered TokenKind instance from its value. | Obtain a registered TokenKind instance from its value. | [
"Obtain",
"a",
"registered",
"TokenKind",
"instance",
"from",
"its",
"value",
"."
] | def from_value(value):
"""Obtain a registered TokenKind instance from its value."""
result = TokenKind._value_map.get(value, None)
if result is None:
raise ValueError('Unknown TokenKind: %d' % value)
return result | [
"def",
"from_value",
"(",
"value",
")",
":",
"result",
"=",
"TokenKind",
".",
"_value_map",
".",
"get",
"(",
"value",
",",
"None",
")",
"if",
"result",
"is",
"None",
":",
"raise",
"ValueError",
"(",
"'Unknown TokenKind: %d'",
"%",
"value",
")",
"return",
... | https://github.com/Polidea/SiriusObfuscator/blob/b0e590d8130e97856afe578869b83a209e2b19be/SymbolExtractorAndRenamer/clang/bindings/python/clang/cindex.py#L517-L524 | |
psi4/psi4 | be533f7f426b6ccc263904e55122899b16663395 | psi4/driver/qcdb/vecutil.py | python | matadd | (matrix1, matrix2, fac1=1.0, fac2=1.0) | return new_matrix | Matrix addition | Matrix addition | [
"Matrix",
"addition"
] | def matadd(matrix1, matrix2, fac1=1.0, fac2=1.0):
"""Matrix addition"""
if (len(matrix1[0]) != len(matrix2[0])) or (len(matrix1) != len(matrix2)):
raise ValidationError('Matrices must be same dimension to add.')
new_matrix = zero(len(matrix1), len(matrix1[0]))
for i in range(len(matrix1)):
... | [
"def",
"matadd",
"(",
"matrix1",
",",
"matrix2",
",",
"fac1",
"=",
"1.0",
",",
"fac2",
"=",
"1.0",
")",
":",
"if",
"(",
"len",
"(",
"matrix1",
"[",
"0",
"]",
")",
"!=",
"len",
"(",
"matrix2",
"[",
"0",
"]",
")",
")",
"or",
"(",
"len",
"(",
... | https://github.com/psi4/psi4/blob/be533f7f426b6ccc263904e55122899b16663395/psi4/driver/qcdb/vecutil.py#L339-L347 | |
apple/turicreate | cce55aa5311300e3ce6af93cb45ba791fd1bdf49 | src/python/turicreate/toolkits/_tf_utils.py | python | convert_shared_float_array_to_numpy | (array) | return np.array(array, copy=False, dtype=np.float32) | The initialization from C++ implementation is mapped to SharedFloatArray
in Python through Pybind. It must be converted to numpy arrays to be used
in TensorFlow.
Parameters
----------
array: SharedFloatArray
Returns
-------
return: Numpy Array
SharedFloatArray casted as Numpy Array | The initialization from C++ implementation is mapped to SharedFloatArray
in Python through Pybind. It must be converted to numpy arrays to be used
in TensorFlow. | [
"The",
"initialization",
"from",
"C",
"++",
"implementation",
"is",
"mapped",
"to",
"SharedFloatArray",
"in",
"Python",
"through",
"Pybind",
".",
"It",
"must",
"be",
"converted",
"to",
"numpy",
"arrays",
"to",
"be",
"used",
"in",
"TensorFlow",
"."
] | def convert_shared_float_array_to_numpy(array):
"""
The initialization from C++ implementation is mapped to SharedFloatArray
in Python through Pybind. It must be converted to numpy arrays to be used
in TensorFlow.
Parameters
----------
array: SharedFloatArray
Returns
-------
re... | [
"def",
"convert_shared_float_array_to_numpy",
"(",
"array",
")",
":",
"return",
"np",
".",
"array",
"(",
"array",
",",
"copy",
"=",
"False",
",",
"dtype",
"=",
"np",
".",
"float32",
")"
] | https://github.com/apple/turicreate/blob/cce55aa5311300e3ce6af93cb45ba791fd1bdf49/src/python/turicreate/toolkits/_tf_utils.py#L79-L95 | |
catboost/catboost | 167f64f237114a4d10b2b4ee42adb4569137debe | contrib/python/traitlets/py2/traitlets/traitlets.py | python | UseEnum.select_by_name | (self, value, default=Undefined) | return self.enum_class.__members__.get(value, default) | Selects enum-value by using its name or scoped-name. | Selects enum-value by using its name or scoped-name. | [
"Selects",
"enum",
"-",
"value",
"by",
"using",
"its",
"name",
"or",
"scoped",
"-",
"name",
"."
] | def select_by_name(self, value, default=Undefined):
"""Selects enum-value by using its name or scoped-name."""
assert isinstance(value, six.string_types)
if value.startswith(self.name_prefix):
# -- SUPPORT SCOPED-NAMES, like: "Color.red" => "red"
value = value.replace(sel... | [
"def",
"select_by_name",
"(",
"self",
",",
"value",
",",
"default",
"=",
"Undefined",
")",
":",
"assert",
"isinstance",
"(",
"value",
",",
"six",
".",
"string_types",
")",
"if",
"value",
".",
"startswith",
"(",
"self",
".",
"name_prefix",
")",
":",
"# --... | https://github.com/catboost/catboost/blob/167f64f237114a4d10b2b4ee42adb4569137debe/contrib/python/traitlets/py2/traitlets/traitlets.py#L2657-L2663 | |
BDLDev/bdlauncher | d10fb098852ebcf9fb71afb23052a463ee7b5d0a | scripts/cppheaderparser.py | python | CppUnion.__str__ | (self) | return rtn | Convert class to a string | Convert class to a string | [
"Convert",
"class",
"to",
"a",
"string"
] | def __str__(self):
"""Convert class to a string"""
namespace_prefix = ""
if self["namespace"]: namespace_prefix = self["namespace"] + "::"
rtn = "%s %s"%(self["declaration_method"], namespace_prefix + self["name"])
if self['abstract']: rtn += ' (abstract)\n'
else: rtn ... | [
"def",
"__str__",
"(",
"self",
")",
":",
"namespace_prefix",
"=",
"\"\"",
"if",
"self",
"[",
"\"namespace\"",
"]",
":",
"namespace_prefix",
"=",
"self",
"[",
"\"namespace\"",
"]",
"+",
"\"::\"",
"rtn",
"=",
"\"%s %s\"",
"%",
"(",
"self",
"[",
"\"declaratio... | https://github.com/BDLDev/bdlauncher/blob/d10fb098852ebcf9fb71afb23052a463ee7b5d0a/scripts/cppheaderparser.py#L694-L709 | |
aws/lumberyard | f85344403c1c2e77ec8c75deb2c116e97b713217 | dev/Tools/Python/3.7.10/linux_x64/lib/python3.7/site-packages/requests/exceptions.py | python | RequestException.__init__ | (self, *args, **kwargs) | Initialize RequestException with `request` and `response` objects. | Initialize RequestException with `request` and `response` objects. | [
"Initialize",
"RequestException",
"with",
"request",
"and",
"response",
"objects",
"."
] | def __init__(self, *args, **kwargs):
"""Initialize RequestException with `request` and `response` objects."""
response = kwargs.pop('response', None)
self.response = response
self.request = kwargs.pop('request', None)
if (response is not None and not self.request and
... | [
"def",
"__init__",
"(",
"self",
",",
"*",
"args",
",",
"*",
"*",
"kwargs",
")",
":",
"response",
"=",
"kwargs",
".",
"pop",
"(",
"'response'",
",",
"None",
")",
"self",
".",
"response",
"=",
"response",
"self",
".",
"request",
"=",
"kwargs",
".",
"... | https://github.com/aws/lumberyard/blob/f85344403c1c2e77ec8c75deb2c116e97b713217/dev/Tools/Python/3.7.10/linux_x64/lib/python3.7/site-packages/requests/exceptions.py#L17-L25 | ||
xiaolonw/caffe-video_triplet | c39ea1ad6e937ccf7deba4510b7e555165abf05f | scripts/cpp_lint.py | python | CheckAltTokens | (filename, clean_lines, linenum, error) | Check alternative keywords being used in boolean expressions.
Args:
filename: The name of the current file.
clean_lines: A CleansedLines instance containing the file.
linenum: The number of the line to check.
error: The function to call with any errors found. | Check alternative keywords being used in boolean expressions. | [
"Check",
"alternative",
"keywords",
"being",
"used",
"in",
"boolean",
"expressions",
"."
] | def CheckAltTokens(filename, clean_lines, linenum, error):
"""Check alternative keywords being used in boolean expressions.
Args:
filename: The name of the current file.
clean_lines: A CleansedLines instance containing the file.
linenum: The number of the line to check.
error: The function to call ... | [
"def",
"CheckAltTokens",
"(",
"filename",
",",
"clean_lines",
",",
"linenum",
",",
"error",
")",
":",
"line",
"=",
"clean_lines",
".",
"elided",
"[",
"linenum",
"]",
"# Avoid preprocessor lines",
"if",
"Match",
"(",
"r'^\\s*#'",
",",
"line",
")",
":",
"retur... | https://github.com/xiaolonw/caffe-video_triplet/blob/c39ea1ad6e937ccf7deba4510b7e555165abf05f/scripts/cpp_lint.py#L3405-L3434 | ||
strukturag/libheif | 0082fea96ee70a20c8906a0373bedec0c01777bc | scripts/cpplint.py | python | FileInfo.Extension | (self) | return self.Split()[2] | File extension - text following the final period. | File extension - text following the final period. | [
"File",
"extension",
"-",
"text",
"following",
"the",
"final",
"period",
"."
] | def Extension(self):
"""File extension - text following the final period."""
return self.Split()[2] | [
"def",
"Extension",
"(",
"self",
")",
":",
"return",
"self",
".",
"Split",
"(",
")",
"[",
"2",
"]"
] | https://github.com/strukturag/libheif/blob/0082fea96ee70a20c8906a0373bedec0c01777bc/scripts/cpplint.py#L1128-L1130 | |
kamyu104/LeetCode-Solutions | 77605708a927ea3b85aee5a479db733938c7c211 | Python/largest-rectangle-in-histogram.py | python | Solution.largestRectangleArea | (self, heights) | return result | :type heights: List[int]
:rtype: int | :type heights: List[int]
:rtype: int | [
":",
"type",
"heights",
":",
"List",
"[",
"int",
"]",
":",
"rtype",
":",
"int"
] | def largestRectangleArea(self, heights):
"""
:type heights: List[int]
:rtype: int
"""
stk, result = [-1], 0
for i in xrange(len(heights)+1):
while stk[-1] != -1 and (i == len(heights) or heights[stk[-1]] >= heights[i]):
result = max(result, hei... | [
"def",
"largestRectangleArea",
"(",
"self",
",",
"heights",
")",
":",
"stk",
",",
"result",
"=",
"[",
"-",
"1",
"]",
",",
"0",
"for",
"i",
"in",
"xrange",
"(",
"len",
"(",
"heights",
")",
"+",
"1",
")",
":",
"while",
"stk",
"[",
"-",
"1",
"]",
... | https://github.com/kamyu104/LeetCode-Solutions/blob/77605708a927ea3b85aee5a479db733938c7c211/Python/largest-rectangle-in-histogram.py#L5-L15 | |
bumptop/BumpTop | 466d23597a07ae738f4265262fa01087fc6e257c | trunk/mac/Build/cpplint.py | python | CheckLanguage | (filename, clean_lines, linenum, file_extension, include_state,
error) | Checks rules from the 'C++ language rules' section of cppguide.html.
Some of these rules are hard to test (function overloading, using
uint32 inappropriately), but we do the best we can.
Args:
filename: The name of the current file.
clean_lines: A CleansedLines instance containing the file.
linenum:... | Checks rules from the 'C++ language rules' section of cppguide.html. | [
"Checks",
"rules",
"from",
"the",
"C",
"++",
"language",
"rules",
"section",
"of",
"cppguide",
".",
"html",
"."
] | def CheckLanguage(filename, clean_lines, linenum, file_extension, include_state,
error):
"""Checks rules from the 'C++ language rules' section of cppguide.html.
Some of these rules are hard to test (function overloading, using
uint32 inappropriately), but we do the best we can.
Args:
fil... | [
"def",
"CheckLanguage",
"(",
"filename",
",",
"clean_lines",
",",
"linenum",
",",
"file_extension",
",",
"include_state",
",",
"error",
")",
":",
"fileinfo",
"=",
"FileInfo",
"(",
"filename",
")",
"# get rid of comments",
"comment_elided_line",
"=",
"clean_lines",
... | https://github.com/bumptop/BumpTop/blob/466d23597a07ae738f4265262fa01087fc6e257c/trunk/mac/Build/cpplint.py#L2063-L2362 | ||
aws/lumberyard | f85344403c1c2e77ec8c75deb2c116e97b713217 | dev/Gems/CloudGemMetric/v1/AWS/common-code/Lib/numba/typeconv/typeconv.py | python | TypeCastingRules.promote | (self, a, b) | Set `a` can promote to `b` | Set `a` can promote to `b` | [
"Set",
"a",
"can",
"promote",
"to",
"b"
] | def promote(self, a, b):
"""
Set `a` can promote to `b`
"""
self._tg.promote(a, b) | [
"def",
"promote",
"(",
"self",
",",
"a",
",",
"b",
")",
":",
"self",
".",
"_tg",
".",
"promote",
"(",
"a",
",",
"b",
")"
] | https://github.com/aws/lumberyard/blob/f85344403c1c2e77ec8c75deb2c116e97b713217/dev/Gems/CloudGemMetric/v1/AWS/common-code/Lib/numba/typeconv/typeconv.py#L83-L87 | ||
catboost/catboost | 167f64f237114a4d10b2b4ee42adb4569137debe | contrib/tools/python/src/Lib/idlelib/TreeWidget.py | python | TreeItem.GetSelectedIconName | (self) | Return name of icon to be displayed when selected. | Return name of icon to be displayed when selected. | [
"Return",
"name",
"of",
"icon",
"to",
"be",
"displayed",
"when",
"selected",
"."
] | def GetSelectedIconName(self):
"""Return name of icon to be displayed when selected.""" | [
"def",
"GetSelectedIconName",
"(",
"self",
")",
":"
] | https://github.com/catboost/catboost/blob/167f64f237114a4d10b2b4ee42adb4569137debe/contrib/tools/python/src/Lib/idlelib/TreeWidget.py#L353-L354 | ||
wallix/redemption | fb4ceefb39e11e1ae250bce17e878e1dc7d195d2 | tools/conf_migration_tool/conf_migrate.py | python | ConfigurationFile.__is_variable_exist | (self, section_name:Optional[str], variable_name:str) | return False | Retourne False si la variable n'existe pas dans la section, ou si la
section n'existe pas. Sinon retourne True. | Retourne False si la variable n'existe pas dans la section, ou si la
section n'existe pas. Sinon retourne True. | [
"Retourne",
"False",
"si",
"la",
"variable",
"n",
"existe",
"pas",
"dans",
"la",
"section",
"ou",
"si",
"la",
"section",
"n",
"existe",
"pas",
".",
"Sinon",
"retourne",
"True",
"."
] | def __is_variable_exist(self, section_name:Optional[str], variable_name:str) -> bool:
"""
Retourne False si la variable n'existe pas dans la section, ou si la
section n'existe pas. Sinon retourne True.
"""
current_section_name = None
for line in self._content:
... | [
"def",
"__is_variable_exist",
"(",
"self",
",",
"section_name",
":",
"Optional",
"[",
"str",
"]",
",",
"variable_name",
":",
"str",
")",
"->",
"bool",
":",
"current_section_name",
"=",
"None",
"for",
"line",
"in",
"self",
".",
"_content",
":",
"if",
"line"... | https://github.com/wallix/redemption/blob/fb4ceefb39e11e1ae250bce17e878e1dc7d195d2/tools/conf_migration_tool/conf_migrate.py#L348-L366 | |
aws/lumberyard | f85344403c1c2e77ec8c75deb2c116e97b713217 | dev/Gems/CloudGemFramework/v1/ResourceManager/resource_manager/resource_group.py | python | ResourceGroup.create_file | (self, relative_destination_path, initial_content, force=False) | return file_util.create_ignore_filter_function(self.__context, destination_path, initial_content) | Creates a file in a resource group.
Args:
relative_destination_path: the path and name of the file relative to
the resource group directory.
initial_content: The file's initial content.
force (named): Overwrite existing files. Default is False.
Return... | Creates a file in a resource group. | [
"Creates",
"a",
"file",
"in",
"a",
"resource",
"group",
"."
] | def create_file(self, relative_destination_path, initial_content, force=False):
"""Creates a file in a resource group.
Args:
relative_destination_path: the path and name of the file relative to
the resource group directory.
initial_content: The file's initial conte... | [
"def",
"create_file",
"(",
"self",
",",
"relative_destination_path",
",",
"initial_content",
",",
"force",
"=",
"False",
")",
":",
"destination_path",
"=",
"os",
".",
"path",
".",
"join",
"(",
"self",
".",
"directory_path",
",",
"relative_destination_path",
")",... | https://github.com/aws/lumberyard/blob/f85344403c1c2e77ec8c75deb2c116e97b713217/dev/Gems/CloudGemFramework/v1/ResourceManager/resource_manager/resource_group.py#L532-L551 | |
crosslife/OpenBird | 9e0198a1a2295f03fa1e8676e216e22c9c7d380b | cocos2d/tools/bindings-generator/backup/clang-llvm-3.3-pybinding/cindex.py | python | register_functions | (lib, ignore_errors) | Register function prototypes with a libclang library instance.
This must be called as part of library instantiation so Python knows how
to call out to the shared library. | Register function prototypes with a libclang library instance. | [
"Register",
"function",
"prototypes",
"with",
"a",
"libclang",
"library",
"instance",
"."
] | def register_functions(lib, ignore_errors):
"""Register function prototypes with a libclang library instance.
This must be called as part of library instantiation so Python knows how
to call out to the shared library.
"""
def register(item):
return register_function(lib, item, ignore_error... | [
"def",
"register_functions",
"(",
"lib",
",",
"ignore_errors",
")",
":",
"def",
"register",
"(",
"item",
")",
":",
"return",
"register_function",
"(",
"lib",
",",
"item",
",",
"ignore_errors",
")",
"map",
"(",
"register",
",",
"functionList",
")"
] | https://github.com/crosslife/OpenBird/blob/9e0198a1a2295f03fa1e8676e216e22c9c7d380b/cocos2d/tools/bindings-generator/backup/clang-llvm-3.3-pybinding/cindex.py#L3121-L3131 | ||
hanpfei/chromium-net | 392cc1fa3a8f92f42e4071ab6e674d8e0482f83f | tools/memory_inspector/memory_inspector/__init__.py | python | _IncludeDeps | () | Imports all the project dependencies. | Imports all the project dependencies. | [
"Imports",
"all",
"the",
"project",
"dependencies",
"."
] | def _IncludeDeps():
"""Imports all the project dependencies."""
chromium_dir = os.path.abspath(os.path.join(ROOT_DIR, os.pardir, os.pardir))
sys.path += [
ROOT_DIR,
# Include all dependencies.
os.path.join(chromium_dir, 'build', 'android'), # For pylib.
] | [
"def",
"_IncludeDeps",
"(",
")",
":",
"chromium_dir",
"=",
"os",
".",
"path",
".",
"abspath",
"(",
"os",
".",
"path",
".",
"join",
"(",
"ROOT_DIR",
",",
"os",
".",
"pardir",
",",
"os",
".",
"pardir",
")",
")",
"sys",
".",
"path",
"+=",
"[",
"ROOT... | https://github.com/hanpfei/chromium-net/blob/392cc1fa3a8f92f42e4071ab6e674d8e0482f83f/tools/memory_inspector/memory_inspector/__init__.py#L19-L28 | ||
aws/lumberyard | f85344403c1c2e77ec8c75deb2c116e97b713217 | dev/Tools/Python/3.7.10/windows/Lib/site-packages/pip/_vendor/distlib/_backport/tarfile.py | python | TarFile.utime | (self, tarinfo, targetpath) | Set modification time of targetpath according to tarinfo. | Set modification time of targetpath according to tarinfo. | [
"Set",
"modification",
"time",
"of",
"targetpath",
"according",
"to",
"tarinfo",
"."
] | def utime(self, tarinfo, targetpath):
"""Set modification time of targetpath according to tarinfo.
"""
if not hasattr(os, 'utime'):
return
try:
os.utime(targetpath, (tarinfo.mtime, tarinfo.mtime))
except EnvironmentError as e:
raise ExtractErro... | [
"def",
"utime",
"(",
"self",
",",
"tarinfo",
",",
"targetpath",
")",
":",
"if",
"not",
"hasattr",
"(",
"os",
",",
"'utime'",
")",
":",
"return",
"try",
":",
"os",
".",
"utime",
"(",
"targetpath",
",",
"(",
"tarinfo",
".",
"mtime",
",",
"tarinfo",
"... | https://github.com/aws/lumberyard/blob/f85344403c1c2e77ec8c75deb2c116e97b713217/dev/Tools/Python/3.7.10/windows/Lib/site-packages/pip/_vendor/distlib/_backport/tarfile.py#L2403-L2411 | ||
wxWidgets/wxPython-Classic | 19571e1ae65f1ac445f5491474121998c97a1bf0 | src/osx_carbon/_core.py | python | Rect.GetY | (*args, **kwargs) | return _core_.Rect_GetY(*args, **kwargs) | GetY(self) -> int | GetY(self) -> int | [
"GetY",
"(",
"self",
")",
"-",
">",
"int"
] | def GetY(*args, **kwargs):
"""GetY(self) -> int"""
return _core_.Rect_GetY(*args, **kwargs) | [
"def",
"GetY",
"(",
"*",
"args",
",",
"*",
"*",
"kwargs",
")",
":",
"return",
"_core_",
".",
"Rect_GetY",
"(",
"*",
"args",
",",
"*",
"*",
"kwargs",
")"
] | https://github.com/wxWidgets/wxPython-Classic/blob/19571e1ae65f1ac445f5491474121998c97a1bf0/src/osx_carbon/_core.py#L1277-L1279 | |
hughperkins/tf-coriander | 970d3df6c11400ad68405f22b0c42a52374e94ca | tensorflow/contrib/tensor_forest/data/data_ops.py | python | ParseDataTensorOrDict | (data) | Return a tensor to use for input data.
The incoming features can be a dict where keys are the string names of the
columns, which we turn into a single 2-D tensor.
Args:
data: `Tensor` or `dict` of `Tensor` objects.
Returns:
A 2-D tensor for input to tensor_forest, a keys tensor for the
tf.Example... | Return a tensor to use for input data. | [
"Return",
"a",
"tensor",
"to",
"use",
"for",
"input",
"data",
"."
] | def ParseDataTensorOrDict(data):
"""Return a tensor to use for input data.
The incoming features can be a dict where keys are the string names of the
columns, which we turn into a single 2-D tensor.
Args:
data: `Tensor` or `dict` of `Tensor` objects.
Returns:
A 2-D tensor for input to tensor_forest... | [
"def",
"ParseDataTensorOrDict",
"(",
"data",
")",
":",
"if",
"isinstance",
"(",
"data",
",",
"dict",
")",
":",
"# If there's at least one sparse tensor, everything has to be sparse.",
"is_sparse",
"=",
"False",
"for",
"v",
"in",
"data",
".",
"values",
"(",
")",
":... | https://github.com/hughperkins/tf-coriander/blob/970d3df6c11400ad68405f22b0c42a52374e94ca/tensorflow/contrib/tensor_forest/data/data_ops.py#L164-L191 | ||
openvinotoolkit/openvino | dedcbeafa8b84cccdc55ca64b8da516682b381c7 | src/bindings/python/src/openvino/runtime/opset3/ops.py | python | non_max_suppression | (
boxes: NodeInput,
scores: NodeInput,
max_output_boxes_per_class: Optional[NodeInput] = None,
iou_threshold: Optional[NodeInput] = None,
score_threshold: Optional[NodeInput] = None,
box_encoding: str = "corner",
sort_result_descending: bool = True,
output_type: str = "i64",
name: Op... | return _get_node_factory_opset3().create("NonMaxSuppression", inputs, attributes) | Return a node which performs NonMaxSuppression.
@param boxes: Tensor with box coordinates.
@param scores: Tensor with box scores.
@param max_output_boxes_per_class: Tensor Specifying maximum number of boxes
to be selected per class.
@param iou_threshold: Tensor s... | Return a node which performs NonMaxSuppression. | [
"Return",
"a",
"node",
"which",
"performs",
"NonMaxSuppression",
"."
] | def non_max_suppression(
boxes: NodeInput,
scores: NodeInput,
max_output_boxes_per_class: Optional[NodeInput] = None,
iou_threshold: Optional[NodeInput] = None,
score_threshold: Optional[NodeInput] = None,
box_encoding: str = "corner",
sort_result_descending: bool = True,
output_type: st... | [
"def",
"non_max_suppression",
"(",
"boxes",
":",
"NodeInput",
",",
"scores",
":",
"NodeInput",
",",
"max_output_boxes_per_class",
":",
"Optional",
"[",
"NodeInput",
"]",
"=",
"None",
",",
"iou_threshold",
":",
"Optional",
"[",
"NodeInput",
"]",
"=",
"None",
",... | https://github.com/openvinotoolkit/openvino/blob/dedcbeafa8b84cccdc55ca64b8da516682b381c7/src/bindings/python/src/openvino/runtime/opset3/ops.py#L313-L352 | |
gzc/CLRS | b7d3df5ba834b2a15007d0f0fc320f1dfc9f4041 | C33-Computational-Geometry/Graham_Scan.py | python | Point.polar_sort | (cls, p0, *P) | return sorted(point_and_angle, key = lambda p_tuple: p_tuple[1]) | Sort a sequence <p1, p2, ..., pN> of n points according to their polar
angles w.r.t a given original point p0. Time Complexity: O(n log(n))
:param p0: The reference point.
:param P: A sorted sequence of tuple of Point object and its angle.
Sorting is done by angle. | Sort a sequence <p1, p2, ..., pN> of n points according to their polar
angles w.r.t a given original point p0. Time Complexity: O(n log(n))
:param p0: The reference point.
:param P: A sorted sequence of tuple of Point object and its angle.
Sorting is done by angle. | [
"Sort",
"a",
"sequence",
"<p1",
"p2",
"...",
"pN",
">",
"of",
"n",
"points",
"according",
"to",
"their",
"polar",
"angles",
"w",
".",
"r",
".",
"t",
"a",
"given",
"original",
"point",
"p0",
".",
"Time",
"Complexity",
":",
"O",
"(",
"n",
"log",
"(",... | def polar_sort(cls, p0, *P):
"""
Sort a sequence <p1, p2, ..., pN> of n points according to their polar
angles w.r.t a given original point p0. Time Complexity: O(n log(n))
:param p0: The reference point.
:param P: A sorted sequence of tuple of Point object and its angle.
... | [
"def",
"polar_sort",
"(",
"cls",
",",
"p0",
",",
"*",
"P",
")",
":",
"point_and_angle",
"=",
"map",
"(",
"lambda",
"p",
":",
"(",
"p",
",",
"cls",
".",
"angle",
"(",
"p",
",",
"p0",
")",
")",
",",
"P",
")",
"return",
"sorted",
"(",
"point_and_a... | https://github.com/gzc/CLRS/blob/b7d3df5ba834b2a15007d0f0fc320f1dfc9f4041/C33-Computational-Geometry/Graham_Scan.py#L81-L90 | |
SFTtech/openage | d6a08c53c48dc1e157807471df92197f6ca9e04d | openage/nyan/nyan_structs.py | python | NyanMember.get_name | (self) | return self.name | Returns the name of the member. | Returns the name of the member. | [
"Returns",
"the",
"name",
"of",
"the",
"member",
"."
] | def get_name(self):
"""
Returns the name of the member.
"""
return self.name | [
"def",
"get_name",
"(",
"self",
")",
":",
"return",
"self",
".",
"name"
] | https://github.com/SFTtech/openage/blob/d6a08c53c48dc1e157807471df92197f6ca9e04d/openage/nyan/nyan_structs.py#L882-L886 | |
Samsung/veles | 95ed733c2e49bc011ad98ccf2416ecec23fbf352 | veles/loader/file_image.py | python | FileImageLoaderBase.get_image_data | (self, key) | Loads data from image and normalizes it.
Returns:
:class:`numpy.ndarrayarray`: if there was one image in the file.
tuple: `(data, labels)` if there were many images in the file | Loads data from image and normalizes it. | [
"Loads",
"data",
"from",
"image",
"and",
"normalizes",
"it",
"."
] | def get_image_data(self, key):
"""
Loads data from image and normalizes it.
Returns:
:class:`numpy.ndarrayarray`: if there was one image in the file.
tuple: `(data, labels)` if there were many images in the file
"""
try:
with open(key, "rb") a... | [
"def",
"get_image_data",
"(",
"self",
",",
"key",
")",
":",
"try",
":",
"with",
"open",
"(",
"key",
",",
"\"rb\"",
")",
"as",
"fin",
":",
"img",
"=",
"Image",
".",
"open",
"(",
"fin",
")",
"if",
"img",
".",
"mode",
"in",
"(",
"\"P\"",
",",
"\"C... | https://github.com/Samsung/veles/blob/95ed733c2e49bc011ad98ccf2416ecec23fbf352/veles/loader/file_image.py#L82-L105 | ||
aws/lumberyard | f85344403c1c2e77ec8c75deb2c116e97b713217 | dev/Tools/Python/3.7.10/mac/Python.framework/Versions/3.7/lib/python3.7/difflib.py | python | Differ._fancy_replace | (self, a, alo, ahi, b, blo, bhi) | r"""
When replacing one block of lines with another, search the blocks
for *similar* lines; the best-matching pair (if any) is used as a
synch point, and intraline difference marking is done on the
similar pair. Lots of work, but often worth it.
Example:
>>> d = Differ(... | r"""
When replacing one block of lines with another, search the blocks
for *similar* lines; the best-matching pair (if any) is used as a
synch point, and intraline difference marking is done on the
similar pair. Lots of work, but often worth it. | [
"r",
"When",
"replacing",
"one",
"block",
"of",
"lines",
"with",
"another",
"search",
"the",
"blocks",
"for",
"*",
"similar",
"*",
"lines",
";",
"the",
"best",
"-",
"matching",
"pair",
"(",
"if",
"any",
")",
"is",
"used",
"as",
"a",
"synch",
"point",
... | def _fancy_replace(self, a, alo, ahi, b, blo, bhi):
r"""
When replacing one block of lines with another, search the blocks
for *similar* lines; the best-matching pair (if any) is used as a
synch point, and intraline difference marking is done on the
similar pair. Lots of work, bu... | [
"def",
"_fancy_replace",
"(",
"self",
",",
"a",
",",
"alo",
",",
"ahi",
",",
"b",
",",
"blo",
",",
"bhi",
")",
":",
"# don't synch up unless the lines have a similarity score of at",
"# least cutoff; best_ratio tracks the best score seen so far",
"best_ratio",
",",
"cutof... | https://github.com/aws/lumberyard/blob/f85344403c1c2e77ec8c75deb2c116e97b713217/dev/Tools/Python/3.7.10/mac/Python.framework/Versions/3.7/lib/python3.7/difflib.py#L928-L1020 | ||
kamyu104/LeetCode-Solutions | 77605708a927ea3b85aee5a479db733938c7c211 | Python/longest-substring-with-at-most-k-distinct-characters.py | python | Solution.lengthOfLongestSubstringKDistinct | (self, s, k) | return longest | :type s: str
:type k: int
:rtype: int | :type s: str
:type k: int
:rtype: int | [
":",
"type",
"s",
":",
"str",
":",
"type",
"k",
":",
"int",
":",
"rtype",
":",
"int"
] | def lengthOfLongestSubstringKDistinct(self, s, k):
"""
:type s: str
:type k: int
:rtype: int
"""
longest, start, distinct_count, visited = 0, 0, 0, [0 for _ in xrange(256)]
for i, char in enumerate(s):
if visited[ord(char)] == 0:
distin... | [
"def",
"lengthOfLongestSubstringKDistinct",
"(",
"self",
",",
"s",
",",
"k",
")",
":",
"longest",
",",
"start",
",",
"distinct_count",
",",
"visited",
"=",
"0",
",",
"0",
",",
"0",
",",
"[",
"0",
"for",
"_",
"in",
"xrange",
"(",
"256",
")",
"]",
"f... | https://github.com/kamyu104/LeetCode-Solutions/blob/77605708a927ea3b85aee5a479db733938c7c211/Python/longest-substring-with-at-most-k-distinct-characters.py#L5-L22 | |
baidu/bigflow | 449245016c0df7d1252e85581e588bfc60cefad3 | bigflow_python/python/bigflow/pcollection.py | python | PCollection.cogroup | (self, other, *others) | return transforms.cogroup(self, other, *others) | 等同于
:func:`bigflow.transforms.cogroup(self, other, *others)
<bigflow.transforms.cogroup>`,
Args:
other (PCollection): 用于协同分组的PCollection
*others: 更多的PCollection
Returns:
PTable: 分组结果 | 等同于
:func:`bigflow.transforms.cogroup(self, other, *others)
<bigflow.transforms.cogroup>`, | [
"等同于",
":",
"func",
":",
"bigflow",
".",
"transforms",
".",
"cogroup",
"(",
"self",
"other",
"*",
"others",
")",
"<bigflow",
".",
"transforms",
".",
"cogroup",
">"
] | def cogroup(self, other, *others):
"""
等同于
:func:`bigflow.transforms.cogroup(self, other, *others)
<bigflow.transforms.cogroup>`,
Args:
other (PCollection): 用于协同分组的PCollection
*others: 更多的PCollection
Returns:
PTable: 分组结果
"""
... | [
"def",
"cogroup",
"(",
"self",
",",
"other",
",",
"*",
"others",
")",
":",
"return",
"transforms",
".",
"cogroup",
"(",
"self",
",",
"other",
",",
"*",
"others",
")"
] | https://github.com/baidu/bigflow/blob/449245016c0df7d1252e85581e588bfc60cefad3/bigflow_python/python/bigflow/pcollection.py#L97-L110 | |
wxWidgets/wxPython-Classic | 19571e1ae65f1ac445f5491474121998c97a1bf0 | src/gtk/_windows.py | python | ScrollHelper.SetScale | (*args, **kwargs) | return _windows_.ScrollHelper_SetScale(*args, **kwargs) | SetScale(self, double xs, double ys) | SetScale(self, double xs, double ys) | [
"SetScale",
"(",
"self",
"double",
"xs",
"double",
"ys",
")"
] | def SetScale(*args, **kwargs):
"""SetScale(self, double xs, double ys)"""
return _windows_.ScrollHelper_SetScale(*args, **kwargs) | [
"def",
"SetScale",
"(",
"*",
"args",
",",
"*",
"*",
"kwargs",
")",
":",
"return",
"_windows_",
".",
"ScrollHelper_SetScale",
"(",
"*",
"args",
",",
"*",
"*",
"kwargs",
")"
] | https://github.com/wxWidgets/wxPython-Classic/blob/19571e1ae65f1ac445f5491474121998c97a1bf0/src/gtk/_windows.py#L203-L205 | |
google/earthenterprise | 0fe84e29be470cd857e3a0e52e5d0afd5bb8cee9 | earth_enterprise/src/fusion/portableglobe/cutter/cgi-bin/common/portable_globe.py | python | Globe._GetData | (self) | return content | Returns package or file content currently pointed to by unpacker. | Returns package or file content currently pointed to by unpacker. | [
"Returns",
"package",
"or",
"file",
"content",
"currently",
"pointed",
"to",
"by",
"unpacker",
"."
] | def _GetData(self):
"""Returns package or file content currently pointed to by unpacker."""
assert self.unpacker_
offset = 0L + (self.file_loc_.HighOffset() & 0xffffffff) << 32
offset += (self.file_loc_.LowOffset() & 0xffffffff)
fp = open(self.GlobePath(), "rb")
fp.seek(offset)
# We should n... | [
"def",
"_GetData",
"(",
"self",
")",
":",
"assert",
"self",
".",
"unpacker_",
"offset",
"=",
"0L",
"+",
"(",
"self",
".",
"file_loc_",
".",
"HighOffset",
"(",
")",
"&",
"0xffffffff",
")",
"<<",
"32",
"offset",
"+=",
"(",
"self",
".",
"file_loc_",
"."... | https://github.com/google/earthenterprise/blob/0fe84e29be470cd857e3a0e52e5d0afd5bb8cee9/earth_enterprise/src/fusion/portableglobe/cutter/cgi-bin/common/portable_globe.py#L116-L127 | |
PaddlePaddle/Anakin | 5fd68a6cc4c4620cd1a30794c1bf06eebd3f4730 | tools/external_converter_v2/parser/proto/helper.py | python | reverse_cache_data | (data) | tensor_pb2.CacheDate => 1.0 / tensor_pb2.CacheDate | tensor_pb2.CacheDate => 1.0 / tensor_pb2.CacheDate | [
"tensor_pb2",
".",
"CacheDate",
"=",
">",
"1",
".",
"0",
"/",
"tensor_pb2",
".",
"CacheDate"
] | def reverse_cache_data(data): # type: tensor_pb2.CacheDate -> None
"""tensor_pb2.CacheDate => 1.0 / tensor_pb2.CacheDate
"""
if data.type is tensor_pb2.INT8:
data.c[:] = map(lambda x: 1.0 / x, data.c)
elif data.type is tensor_pb2.INT32:
data.i[:] = map(lambda x: 1.0 / x, data.i)
eli... | [
"def",
"reverse_cache_data",
"(",
"data",
")",
":",
"# type: tensor_pb2.CacheDate -> None",
"if",
"data",
".",
"type",
"is",
"tensor_pb2",
".",
"INT8",
":",
"data",
".",
"c",
"[",
":",
"]",
"=",
"map",
"(",
"lambda",
"x",
":",
"1.0",
"/",
"x",
",",
"da... | https://github.com/PaddlePaddle/Anakin/blob/5fd68a6cc4c4620cd1a30794c1bf06eebd3f4730/tools/external_converter_v2/parser/proto/helper.py#L71-L84 | ||
aws/lumberyard | f85344403c1c2e77ec8c75deb2c116e97b713217 | dev/Gems/CloudGemMetric/v1/AWS/common-code/Lib/pkg_resources/_vendor/pyparsing.py | python | ParserElement.addCondition | (self, *fns, **kwargs) | return self | Add a boolean predicate function to expression's list of parse actions. See
L{I{setParseAction}<setParseAction>} for function call signatures. Unlike C{setParseAction},
functions passed to C{addCondition} need to return boolean success/fail of the condition.
Optional keyword arguments:
... | Add a boolean predicate function to expression's list of parse actions. See
L{I{setParseAction}<setParseAction>} for function call signatures. Unlike C{setParseAction},
functions passed to C{addCondition} need to return boolean success/fail of the condition. | [
"Add",
"a",
"boolean",
"predicate",
"function",
"to",
"expression",
"s",
"list",
"of",
"parse",
"actions",
".",
"See",
"L",
"{",
"I",
"{",
"setParseAction",
"}",
"<setParseAction",
">",
"}",
"for",
"function",
"call",
"signatures",
".",
"Unlike",
"C",
"{",... | def addCondition(self, *fns, **kwargs):
"""Add a boolean predicate function to expression's list of parse actions. See
L{I{setParseAction}<setParseAction>} for function call signatures. Unlike C{setParseAction},
functions passed to C{addCondition} need to return boolean success/fail of the con... | [
"def",
"addCondition",
"(",
"self",
",",
"*",
"fns",
",",
"*",
"*",
"kwargs",
")",
":",
"msg",
"=",
"kwargs",
".",
"get",
"(",
"\"message\"",
",",
"\"failed user-defined condition\"",
")",
"exc_type",
"=",
"ParseFatalException",
"if",
"kwargs",
".",
"get",
... | https://github.com/aws/lumberyard/blob/f85344403c1c2e77ec8c75deb2c116e97b713217/dev/Gems/CloudGemMetric/v1/AWS/common-code/Lib/pkg_resources/_vendor/pyparsing.py#L1299-L1324 | |
thalium/icebox | 99d147d5b9269222225443ce171b4fd46d8985d4 | third_party/virtualbox/src/libs/libxml2-2.9.4/python/libxml2class.py | python | parserCtxt.htmlFreeParserCtxt | (self) | Free all the memory used by a parser context. However the
parsed document in ctxt->myDoc is not freed. | Free all the memory used by a parser context. However the
parsed document in ctxt->myDoc is not freed. | [
"Free",
"all",
"the",
"memory",
"used",
"by",
"a",
"parser",
"context",
".",
"However",
"the",
"parsed",
"document",
"in",
"ctxt",
"-",
">",
"myDoc",
"is",
"not",
"freed",
"."
] | def htmlFreeParserCtxt(self):
"""Free all the memory used by a parser context. However the
parsed document in ctxt->myDoc is not freed. """
libxml2mod.htmlFreeParserCtxt(self._o) | [
"def",
"htmlFreeParserCtxt",
"(",
"self",
")",
":",
"libxml2mod",
".",
"htmlFreeParserCtxt",
"(",
"self",
".",
"_o",
")"
] | https://github.com/thalium/icebox/blob/99d147d5b9269222225443ce171b4fd46d8985d4/third_party/virtualbox/src/libs/libxml2-2.9.4/python/libxml2class.py#L4210-L4213 | ||
epiqc/ScaffCC | 66a79944ee4cd116b27bc1a69137276885461db8 | llvm/utils/benchmark/tools/gbench/util.py | python | check_input_file | (filename) | return ftype | Classify the file named by 'filename' and return the classification.
If the file is classified as 'IT_Invalid' print an error message and exit
the program. | Classify the file named by 'filename' and return the classification.
If the file is classified as 'IT_Invalid' print an error message and exit
the program. | [
"Classify",
"the",
"file",
"named",
"by",
"filename",
"and",
"return",
"the",
"classification",
".",
"If",
"the",
"file",
"is",
"classified",
"as",
"IT_Invalid",
"print",
"an",
"error",
"message",
"and",
"exit",
"the",
"program",
"."
] | def check_input_file(filename):
"""
Classify the file named by 'filename' and return the classification.
If the file is classified as 'IT_Invalid' print an error message and exit
the program.
"""
ftype, msg = classify_input_file(filename)
if ftype == IT_Invalid:
print("Invalid input ... | [
"def",
"check_input_file",
"(",
"filename",
")",
":",
"ftype",
",",
"msg",
"=",
"classify_input_file",
"(",
"filename",
")",
"if",
"ftype",
"==",
"IT_Invalid",
":",
"print",
"(",
"\"Invalid input file: %s\"",
"%",
"msg",
")",
"sys",
".",
"exit",
"(",
"1",
... | https://github.com/epiqc/ScaffCC/blob/66a79944ee4cd116b27bc1a69137276885461db8/llvm/utils/benchmark/tools/gbench/util.py#L75-L85 | |
y123456yz/reading-and-annotate-mongodb-3.6 | 93280293672ca7586dc24af18132aa61e4ed7fcf | mongo/src/third_party/scons-2.5.0/scons-local-2.5.0/SCons/Variables/__init__.py | python | Variables.Save | (self, filename, env) | Saves all the options in the given file. This file can
then be used to load the options next run. This can be used
to create an option cache file.
filename - Name of the file to save into
env - the environment get the option values from | Saves all the options in the given file. This file can
then be used to load the options next run. This can be used
to create an option cache file. | [
"Saves",
"all",
"the",
"options",
"in",
"the",
"given",
"file",
".",
"This",
"file",
"can",
"then",
"be",
"used",
"to",
"load",
"the",
"options",
"next",
"run",
".",
"This",
"can",
"be",
"used",
"to",
"create",
"an",
"option",
"cache",
"file",
"."
] | def Save(self, filename, env):
"""
Saves all the options in the given file. This file can
then be used to load the options next run. This can be used
to create an option cache file.
filename - Name of the file to save into
env - the environment get the option values fr... | [
"def",
"Save",
"(",
"self",
",",
"filename",
",",
"env",
")",
":",
"# Create the file and write out the header",
"try",
":",
"fh",
"=",
"open",
"(",
"filename",
",",
"'w'",
")",
"try",
":",
"# Make an assignment in the file for each option",
"# within the environment ... | 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/__init__.py#L230-L277 | ||
chanyn/3Dpose_ssl | 585696676279683a279b1ecca136c0e0d02aef2a | caffe-3dssl/scripts/cpp_lint.py | python | ReplaceAll | (pattern, rep, s) | return _regexp_compile_cache[pattern].sub(rep, s) | Replaces instances of pattern in a string with a replacement.
The compiled regex is kept in a cache shared by Match and Search.
Args:
pattern: regex pattern
rep: replacement text
s: search string
Returns:
string with replacements made (or original string if no replacements) | Replaces instances of pattern in a string with a replacement. | [
"Replaces",
"instances",
"of",
"pattern",
"in",
"a",
"string",
"with",
"a",
"replacement",
"."
] | def ReplaceAll(pattern, rep, s):
"""Replaces instances of pattern in a string with a replacement.
The compiled regex is kept in a cache shared by Match and Search.
Args:
pattern: regex pattern
rep: replacement text
s: search string
Returns:
string with replacements made (or original string if... | [
"def",
"ReplaceAll",
"(",
"pattern",
",",
"rep",
",",
"s",
")",
":",
"if",
"pattern",
"not",
"in",
"_regexp_compile_cache",
":",
"_regexp_compile_cache",
"[",
"pattern",
"]",
"=",
"sre_compile",
".",
"compile",
"(",
"pattern",
")",
"return",
"_regexp_compile_c... | https://github.com/chanyn/3Dpose_ssl/blob/585696676279683a279b1ecca136c0e0d02aef2a/caffe-3dssl/scripts/cpp_lint.py#L525-L540 | |
apple/turicreate | cce55aa5311300e3ce6af93cb45ba791fd1bdf49 | deps/src/libxml2-2.9.1/python/libxml2class.py | python | uCSIsCJKCompatibilityForms | (code) | return ret | Check whether the character is part of
CJKCompatibilityForms UCS Block | Check whether the character is part of
CJKCompatibilityForms UCS Block | [
"Check",
"whether",
"the",
"character",
"is",
"part",
"of",
"CJKCompatibilityForms",
"UCS",
"Block"
] | def uCSIsCJKCompatibilityForms(code):
"""Check whether the character is part of
CJKCompatibilityForms UCS Block """
ret = libxml2mod.xmlUCSIsCJKCompatibilityForms(code)
return ret | [
"def",
"uCSIsCJKCompatibilityForms",
"(",
"code",
")",
":",
"ret",
"=",
"libxml2mod",
".",
"xmlUCSIsCJKCompatibilityForms",
"(",
"code",
")",
"return",
"ret"
] | https://github.com/apple/turicreate/blob/cce55aa5311300e3ce6af93cb45ba791fd1bdf49/deps/src/libxml2-2.9.1/python/libxml2class.py#L1405-L1409 | |
lammps/lammps | b75c3065430a75b1b5543a10e10f46d9b4c91913 | tools/i-pi/ipi/engine/forces.py | python | FFSocket.copy | (self) | return type(self)(self.pars, self.socket) | Creates a deep copy without the bound objects.
Used in ForceBeads to create a FFSocket for each replica of the system.
Returns:
A FFSocket object without atoms or cell attributes. | Creates a deep copy without the bound objects. | [
"Creates",
"a",
"deep",
"copy",
"without",
"the",
"bound",
"objects",
"."
] | def copy(self):
"""Creates a deep copy without the bound objects.
Used in ForceBeads to create a FFSocket for each replica of the system.
Returns:
A FFSocket object without atoms or cell attributes.
"""
# does not copy the bound objects
# (i.e., the returned forcefield mu... | [
"def",
"copy",
"(",
"self",
")",
":",
"# does not copy the bound objects",
"# (i.e., the returned forcefield must be bound before use)",
"return",
"type",
"(",
"self",
")",
"(",
"self",
".",
"pars",
",",
"self",
".",
"socket",
")"
] | https://github.com/lammps/lammps/blob/b75c3065430a75b1b5543a10e10f46d9b4c91913/tools/i-pi/ipi/engine/forces.py#L252-L263 | |
CRYTEK/CRYENGINE | 232227c59a220cbbd311576f0fbeba7bb53b2a8c | Editor/Python/windows/Lib/site-packages/setuptools/wheel.py | python | Wheel.is_compatible | (self) | return next((True for t in self.tags() if t in supported_tags), False) | Is the wheel is compatible with the current platform? | Is the wheel is compatible with the current platform? | [
"Is",
"the",
"wheel",
"is",
"compatible",
"with",
"the",
"current",
"platform?"
] | def is_compatible(self):
'''Is the wheel is compatible with the current platform?'''
supported_tags = pep425tags.get_supported()
return next((True for t in self.tags() if t in supported_tags), False) | [
"def",
"is_compatible",
"(",
"self",
")",
":",
"supported_tags",
"=",
"pep425tags",
".",
"get_supported",
"(",
")",
"return",
"next",
"(",
"(",
"True",
"for",
"t",
"in",
"self",
".",
"tags",
"(",
")",
"if",
"t",
"in",
"supported_tags",
")",
",",
"False... | https://github.com/CRYTEK/CRYENGINE/blob/232227c59a220cbbd311576f0fbeba7bb53b2a8c/Editor/Python/windows/Lib/site-packages/setuptools/wheel.py#L77-L80 | |
brave/brave-core | ceaa3de4735789d355b6fa80c21d4709e2c1d0e8 | script/lib/changelog.py | python | reconstruct_brave_changelog_list | (li) | return changes | li is a list | li is a list | [
"li",
"is",
"a",
"list"
] | def reconstruct_brave_changelog_list(li):
"""
li is a list
"""
changes = []
for item in li['children']:
# For special markdown characters such as *EMPHASIS* or `inline code
# blocks`, mistletoe's AST provides us with a nested list. We need
# to traverse the list elements an... | [
"def",
"reconstruct_brave_changelog_list",
"(",
"li",
")",
":",
"changes",
"=",
"[",
"]",
"for",
"item",
"in",
"li",
"[",
"'children'",
"]",
":",
"# For special markdown characters such as *EMPHASIS* or `inline code",
"# blocks`, mistletoe's AST provides us with a nested list. ... | https://github.com/brave/brave-core/blob/ceaa3de4735789d355b6fa80c21d4709e2c1d0e8/script/lib/changelog.py#L55-L87 | |
apiaryio/snowcrash | b5b39faa85f88ee17459edf39fdc6fe4fc70d2e3 | tools/gyp/pylib/gyp/generator/make.py | python | MakefileWriter.ComputeMacBundleOutput | (self, spec) | return os.path.join(path, self.xcode_settings.GetWrapperName()) | Return the 'output' (full output path) to a bundle output directory. | Return the 'output' (full output path) to a bundle output directory. | [
"Return",
"the",
"output",
"(",
"full",
"output",
"path",
")",
"to",
"a",
"bundle",
"output",
"directory",
"."
] | def ComputeMacBundleOutput(self, spec):
"""Return the 'output' (full output path) to a bundle output directory."""
assert self.is_mac_bundle
path = generator_default_variables['PRODUCT_DIR']
return os.path.join(path, self.xcode_settings.GetWrapperName()) | [
"def",
"ComputeMacBundleOutput",
"(",
"self",
",",
"spec",
")",
":",
"assert",
"self",
".",
"is_mac_bundle",
"path",
"=",
"generator_default_variables",
"[",
"'PRODUCT_DIR'",
"]",
"return",
"os",
".",
"path",
".",
"join",
"(",
"path",
",",
"self",
".",
"xcod... | https://github.com/apiaryio/snowcrash/blob/b5b39faa85f88ee17459edf39fdc6fe4fc70d2e3/tools/gyp/pylib/gyp/generator/make.py#L1386-L1390 | |
catboost/catboost | 167f64f237114a4d10b2b4ee42adb4569137debe | contrib/python/numpy/py3/numpy/lib/nanfunctions.py | python | nancumprod | (a, axis=None, dtype=None, out=None) | return np.cumprod(a, axis=axis, dtype=dtype, out=out) | Return the cumulative product of array elements over a given axis treating Not a
Numbers (NaNs) as one. The cumulative product does not change when NaNs are
encountered and leading NaNs are replaced by ones.
Ones are returned for slices that are all-NaN or empty.
.. versionadded:: 1.12.0
Paramet... | Return the cumulative product of array elements over a given axis treating Not a
Numbers (NaNs) as one. The cumulative product does not change when NaNs are
encountered and leading NaNs are replaced by ones. | [
"Return",
"the",
"cumulative",
"product",
"of",
"array",
"elements",
"over",
"a",
"given",
"axis",
"treating",
"Not",
"a",
"Numbers",
"(",
"NaNs",
")",
"as",
"one",
".",
"The",
"cumulative",
"product",
"does",
"not",
"change",
"when",
"NaNs",
"are",
"encou... | def nancumprod(a, axis=None, dtype=None, out=None):
"""
Return the cumulative product of array elements over a given axis treating Not a
Numbers (NaNs) as one. The cumulative product does not change when NaNs are
encountered and leading NaNs are replaced by ones.
Ones are returned for slices that ... | [
"def",
"nancumprod",
"(",
"a",
",",
"axis",
"=",
"None",
",",
"dtype",
"=",
"None",
",",
"out",
"=",
"None",
")",
":",
"a",
",",
"mask",
"=",
"_replace_nan",
"(",
"a",
",",
"1",
")",
"return",
"np",
".",
"cumprod",
"(",
"a",
",",
"axis",
"=",
... | https://github.com/catboost/catboost/blob/167f64f237114a4d10b2b4ee42adb4569137debe/contrib/python/numpy/py3/numpy/lib/nanfunctions.py#L796-L855 | |
ChromiumWebApps/chromium | c7361d39be8abd1574e6ce8957c8dbddd4c6ccf7 | native_client_sdk/src/build_tools/update_nacl_manifest.py | python | Updater._GetPlatformArchiveBundle | (self, archive) | return bundle | Downloads the manifest "snippet" for an archive, and reads it as a
Bundle.
Args:
archive: A full URL of a platform-specific archive, using the gs schema.
Returns:
An object of type manifest_util.Bundle, read from a JSON file storing
metadata for this archive. | Downloads the manifest "snippet" for an archive, and reads it as a
Bundle. | [
"Downloads",
"the",
"manifest",
"snippet",
"for",
"an",
"archive",
"and",
"reads",
"it",
"as",
"a",
"Bundle",
"."
] | def _GetPlatformArchiveBundle(self, archive):
"""Downloads the manifest "snippet" for an archive, and reads it as a
Bundle.
Args:
archive: A full URL of a platform-specific archive, using the gs schema.
Returns:
An object of type manifest_util.Bundle, read from a JSON file storing
... | [
"def",
"_GetPlatformArchiveBundle",
"(",
"self",
",",
"archive",
")",
":",
"stdout",
"=",
"self",
".",
"delegate",
".",
"GsUtil_cat",
"(",
"archive",
"+",
"'.json'",
")",
"bundle",
"=",
"manifest_util",
".",
"Bundle",
"(",
"''",
")",
"bundle",
".",
"LoadDa... | https://github.com/ChromiumWebApps/chromium/blob/c7361d39be8abd1574e6ce8957c8dbddd4c6ccf7/native_client_sdk/src/build_tools/update_nacl_manifest.py#L710-L732 | |
catboost/catboost | 167f64f237114a4d10b2b4ee42adb4569137debe | contrib/tools/python3/src/Lib/tarfile.py | python | TarFile.__init__ | (self, name=None, mode="r", fileobj=None, format=None,
tarinfo=None, dereference=None, ignore_zeros=None, encoding=None,
errors="surrogateescape", pax_headers=None, debug=None,
errorlevel=None, copybufsize=None) | Open an (uncompressed) tar archive `name'. `mode' is either 'r' to
read from an existing archive, 'a' to append data to an existing
file or 'w' to create a new file overwriting an existing one. `mode'
defaults to 'r'.
If `fileobj' is given, it is used for reading or writing d... | Open an (uncompressed) tar archive `name'. `mode' is either 'r' to
read from an existing archive, 'a' to append data to an existing
file or 'w' to create a new file overwriting an existing one. `mode'
defaults to 'r'.
If `fileobj' is given, it is used for reading or writing d... | [
"Open",
"an",
"(",
"uncompressed",
")",
"tar",
"archive",
"name",
".",
"mode",
"is",
"either",
"r",
"to",
"read",
"from",
"an",
"existing",
"archive",
"a",
"to",
"append",
"data",
"to",
"an",
"existing",
"file",
"or",
"w",
"to",
"create",
"a",
"new",
... | def __init__(self, name=None, mode="r", fileobj=None, format=None,
tarinfo=None, dereference=None, ignore_zeros=None, encoding=None,
errors="surrogateescape", pax_headers=None, debug=None,
errorlevel=None, copybufsize=None):
"""Open an (uncompressed) tar archive `name'. `mode... | [
"def",
"__init__",
"(",
"self",
",",
"name",
"=",
"None",
",",
"mode",
"=",
"\"r\"",
",",
"fileobj",
"=",
"None",
",",
"format",
"=",
"None",
",",
"tarinfo",
"=",
"None",
",",
"dereference",
"=",
"None",
",",
"ignore_zeros",
"=",
"None",
",",
"encodi... | https://github.com/catboost/catboost/blob/167f64f237114a4d10b2b4ee42adb4569137debe/contrib/tools/python3/src/Lib/tarfile.py#L1451-L1549 | ||
catboost/catboost | 167f64f237114a4d10b2b4ee42adb4569137debe | contrib/tools/cython/Cython/Compiler/Code.py | python | GlobalState.use_utility_code | (self, utility_code) | Adds code to the C file. utility_code should
a) implement __eq__/__hash__ for the purpose of knowing whether the same
code has already been included
b) implement put_code, which takes a globalstate instance
See UtilityCode. | Adds code to the C file. utility_code should
a) implement __eq__/__hash__ for the purpose of knowing whether the same
code has already been included
b) implement put_code, which takes a globalstate instance | [
"Adds",
"code",
"to",
"the",
"C",
"file",
".",
"utility_code",
"should",
"a",
")",
"implement",
"__eq__",
"/",
"__hash__",
"for",
"the",
"purpose",
"of",
"knowing",
"whether",
"the",
"same",
"code",
"has",
"already",
"been",
"included",
"b",
")",
"implemen... | def use_utility_code(self, utility_code):
"""
Adds code to the C file. utility_code should
a) implement __eq__/__hash__ for the purpose of knowing whether the same
code has already been included
b) implement put_code, which takes a globalstate instance
See UtilityCode... | [
"def",
"use_utility_code",
"(",
"self",
",",
"utility_code",
")",
":",
"if",
"utility_code",
"and",
"utility_code",
"not",
"in",
"self",
".",
"utility_codes",
":",
"self",
".",
"utility_codes",
".",
"add",
"(",
"utility_code",
")",
"utility_code",
".",
"put_co... | https://github.com/catboost/catboost/blob/167f64f237114a4d10b2b4ee42adb4569137debe/contrib/tools/cython/Cython/Compiler/Code.py#L1643-L1654 | ||
NicknineTheEagle/TF2-Base | 20459c5a7fbc995b6bf54fa85c2f62a101e9fb64 | src/thirdparty/protobuf-2.3.0/python/mox.py | python | MockObject.__getitem__ | (self, key) | return self._CreateMockMethod('__getitem__')(key) | Provide custom logic for mocking classes that are subscriptable.
Args:
key: Key to return the value for.
Returns:
Expected return value in replay mode. A MockMethod object for the
__getitem__ method that has already been called if not in replay mode.
Raises:
TypeError if the unde... | Provide custom logic for mocking classes that are subscriptable. | [
"Provide",
"custom",
"logic",
"for",
"mocking",
"classes",
"that",
"are",
"subscriptable",
"."
] | def __getitem__(self, key):
"""Provide custom logic for mocking classes that are subscriptable.
Args:
key: Key to return the value for.
Returns:
Expected return value in replay mode. A MockMethod object for the
__getitem__ method that has already been called if not in replay mode.
... | [
"def",
"__getitem__",
"(",
"self",
",",
"key",
")",
":",
"getitem",
"=",
"self",
".",
"_class_to_mock",
".",
"__dict__",
".",
"get",
"(",
"'__getitem__'",
",",
"None",
")",
"# Verify the class supports item assignment.",
"if",
"getitem",
"is",
"None",
":",
"ra... | https://github.com/NicknineTheEagle/TF2-Base/blob/20459c5a7fbc995b6bf54fa85c2f62a101e9fb64/src/thirdparty/protobuf-2.3.0/python/mox.py#L459-L488 | |
catboost/catboost | 167f64f237114a4d10b2b4ee42adb4569137debe | contrib/python/scipy/py2/scipy/sparse/base.py | python | spmatrix.transpose | (self, axes=None, copy=False) | return self.tocsr(copy=copy).transpose(axes=axes, copy=False) | Reverses the dimensions of the sparse matrix.
Parameters
----------
axes : None, optional
This argument is in the signature *solely* for NumPy
compatibility reasons. Do not pass in anything except
for the default value.
copy : bool, optional
... | Reverses the dimensions of the sparse matrix. | [
"Reverses",
"the",
"dimensions",
"of",
"the",
"sparse",
"matrix",
"."
] | def transpose(self, axes=None, copy=False):
"""
Reverses the dimensions of the sparse matrix.
Parameters
----------
axes : None, optional
This argument is in the signature *solely* for NumPy
compatibility reasons. Do not pass in anything except
... | [
"def",
"transpose",
"(",
"self",
",",
"axes",
"=",
"None",
",",
"copy",
"=",
"False",
")",
":",
"return",
"self",
".",
"tocsr",
"(",
"copy",
"=",
"copy",
")",
".",
"transpose",
"(",
"axes",
"=",
"axes",
",",
"copy",
"=",
"False",
")"
] | https://github.com/catboost/catboost/blob/167f64f237114a4d10b2b4ee42adb4569137debe/contrib/python/scipy/py2/scipy/sparse/base.py#L689-L714 | |
catboost/catboost | 167f64f237114a4d10b2b4ee42adb4569137debe | contrib/tools/python/src/Lib/copy_reg.py | python | add_extension | (module, name, code) | Register an extension code. | Register an extension code. | [
"Register",
"an",
"extension",
"code",
"."
] | def add_extension(module, name, code):
"""Register an extension code."""
code = int(code)
if not 1 <= code <= 0x7fffffff:
raise ValueError, "code out of range"
key = (module, name)
if (_extension_registry.get(key) == code and
_inverted_registry.get(code) == key):
return # Red... | [
"def",
"add_extension",
"(",
"module",
",",
"name",
",",
"code",
")",
":",
"code",
"=",
"int",
"(",
"code",
")",
"if",
"not",
"1",
"<=",
"code",
"<=",
"0x7fffffff",
":",
"raise",
"ValueError",
",",
"\"code out of range\"",
"key",
"=",
"(",
"module",
",... | https://github.com/catboost/catboost/blob/167f64f237114a4d10b2b4ee42adb4569137debe/contrib/tools/python/src/Lib/copy_reg.py#L161-L177 | ||
mantidproject/mantid | 03deeb89254ec4289edb8771e0188c2090a02f32 | qt/python/mantidqtinterfaces/mantidqtinterfaces/HFIR_4Circle_Reduction/guiutility.py | python | GetValueDialog.__init__ | (self, parent=None, label_name='') | return | :param parent:
:param label_name | :param parent:
:param label_name | [
":",
"param",
"parent",
":",
":",
"param",
"label_name"
] | def __init__(self, parent=None, label_name=''):
"""
:param parent:
:param label_name
"""
super(GetValueDialog, self).__init__(parent)
layout = QVBoxLayout(self)
# details information
self.info_line = QPlainTextEdit(self)
self.info_line.setEnabled... | [
"def",
"__init__",
"(",
"self",
",",
"parent",
"=",
"None",
",",
"label_name",
"=",
"''",
")",
":",
"super",
"(",
"GetValueDialog",
",",
"self",
")",
".",
"__init__",
"(",
"parent",
")",
"layout",
"=",
"QVBoxLayout",
"(",
"self",
")",
"# details informat... | https://github.com/mantidproject/mantid/blob/03deeb89254ec4289edb8771e0188c2090a02f32/qt/python/mantidqtinterfaces/mantidqtinterfaces/HFIR_4Circle_Reduction/guiutility.py#L379-L418 | |
wxWidgets/wxPython-Classic | 19571e1ae65f1ac445f5491474121998c97a1bf0 | src/gtk/dataview.py | python | DataViewModel.BeforeReset | (*args, **kwargs) | return _dataview.DataViewModel_BeforeReset(*args, **kwargs) | BeforeReset(self) -> bool | BeforeReset(self) -> bool | [
"BeforeReset",
"(",
"self",
")",
"-",
">",
"bool"
] | def BeforeReset(*args, **kwargs):
"""BeforeReset(self) -> bool"""
return _dataview.DataViewModel_BeforeReset(*args, **kwargs) | [
"def",
"BeforeReset",
"(",
"*",
"args",
",",
"*",
"*",
"kwargs",
")",
":",
"return",
"_dataview",
".",
"DataViewModel_BeforeReset",
"(",
"*",
"args",
",",
"*",
"*",
"kwargs",
")"
] | https://github.com/wxWidgets/wxPython-Classic/blob/19571e1ae65f1ac445f5491474121998c97a1bf0/src/gtk/dataview.py#L628-L630 | |
natanielruiz/android-yolo | 1ebb54f96a67a20ff83ddfc823ed83a13dc3a47f | jni-build/jni/include/tensorflow/contrib/factorization/python/ops/clustering_ops.py | python | KMeans._full_batch_training_op | (self, inputs, cluster_idx_list, cluster_centers) | return tf.assign(cluster_centers, new_clusters_centers) | Creates an op for training for full batch case.
Args:
inputs: list of input Tensors.
cluster_idx_list: A vector (or list of vectors). Each element in the
vector corresponds to an input row in 'inp' and specifies the cluster id
corresponding to the input.
cluster_centers: Tensor Re... | Creates an op for training for full batch case. | [
"Creates",
"an",
"op",
"for",
"training",
"for",
"full",
"batch",
"case",
"."
] | def _full_batch_training_op(self, inputs, cluster_idx_list, cluster_centers):
"""Creates an op for training for full batch case.
Args:
inputs: list of input Tensors.
cluster_idx_list: A vector (or list of vectors). Each element in the
vector corresponds to an input row in 'inp' and specifie... | [
"def",
"_full_batch_training_op",
"(",
"self",
",",
"inputs",
",",
"cluster_idx_list",
",",
"cluster_centers",
")",
":",
"cluster_sums",
"=",
"[",
"]",
"cluster_counts",
"=",
"[",
"]",
"epsilon",
"=",
"tf",
".",
"constant",
"(",
"1e-6",
",",
"dtype",
"=",
... | https://github.com/natanielruiz/android-yolo/blob/1ebb54f96a67a20ff83ddfc823ed83a13dc3a47f/jni-build/jni/include/tensorflow/contrib/factorization/python/ops/clustering_ops.py#L378-L408 | |
benoitsteiner/tensorflow-opencl | cb7cb40a57fde5cfd4731bc551e82a1e2fef43a5 | tensorflow/python/ops/distributions/student_t.py | python | StudentT.__init__ | (self,
df,
loc,
scale,
validate_args=False,
allow_nan_stats=True,
name="StudentT") | Construct Student's t distributions.
The distributions have degree of freedom `df`, mean `loc`, and scale
`scale`.
The parameters `df`, `loc`, and `scale` must be shaped in a way that
supports broadcasting (e.g. `df + loc + scale` is a valid operation).
Args:
df: Floating-point `Tensor`. Th... | Construct Student's t distributions. | [
"Construct",
"Student",
"s",
"t",
"distributions",
"."
] | def __init__(self,
df,
loc,
scale,
validate_args=False,
allow_nan_stats=True,
name="StudentT"):
"""Construct Student's t distributions.
The distributions have degree of freedom `df`, mean `loc`, and scale
`scale`.
... | [
"def",
"__init__",
"(",
"self",
",",
"df",
",",
"loc",
",",
"scale",
",",
"validate_args",
"=",
"False",
",",
"allow_nan_stats",
"=",
"True",
",",
"name",
"=",
"\"StudentT\"",
")",
":",
"parameters",
"=",
"locals",
"(",
")",
"with",
"ops",
".",
"name_s... | https://github.com/benoitsteiner/tensorflow-opencl/blob/cb7cb40a57fde5cfd4731bc551e82a1e2fef43a5/tensorflow/python/ops/distributions/student_t.py#L122-L174 | ||
wxWidgets/wxPython-Classic | 19571e1ae65f1ac445f5491474121998c97a1bf0 | wx/tools/Editra/src/extern/stcspellcheck.py | python | STCSpellCheck.reloadEnchant | (cls, libpath=u'') | Try (re)loading the enchant module. Use to dynamically try to
import enchant incase it could be loaded at the time of the import of
this module.
@keyword libpath: optionally specify path to libenchant
@return: bool | Try (re)loading the enchant module. Use to dynamically try to
import enchant incase it could be loaded at the time of the import of
this module.
@keyword libpath: optionally specify path to libenchant
@return: bool | [
"Try",
"(",
"re",
")",
"loading",
"the",
"enchant",
"module",
".",
"Use",
"to",
"dynamically",
"try",
"to",
"import",
"enchant",
"incase",
"it",
"could",
"be",
"loaded",
"at",
"the",
"time",
"of",
"the",
"import",
"of",
"this",
"module",
".",
"@keyword",... | def reloadEnchant(cls, libpath=u''):
"""Try (re)loading the enchant module. Use to dynamically try to
import enchant incase it could be loaded at the time of the import of
this module.
@keyword libpath: optionally specify path to libenchant
@return: bool
"""
try:... | [
"def",
"reloadEnchant",
"(",
"cls",
",",
"libpath",
"=",
"u''",
")",
":",
"try",
":",
"if",
"libpath",
"and",
"os",
".",
"path",
".",
"exists",
"(",
"libpath",
")",
":",
"os",
".",
"environ",
"[",
"'PYENCHANT_LIBRARY_PATH'",
"]",
"=",
"libpath",
"if",
... | https://github.com/wxWidgets/wxPython-Classic/blob/19571e1ae65f1ac445f5491474121998c97a1bf0/wx/tools/Editra/src/extern/stcspellcheck.py#L260-L280 | ||
apple/turicreate | cce55aa5311300e3ce6af93cb45ba791fd1bdf49 | deps/src/libxml2-2.9.1/python/libxml2class.py | python | uCSIsCJKSymbolsandPunctuation | (code) | return ret | Check whether the character is part of
CJKSymbolsandPunctuation UCS Block | Check whether the character is part of
CJKSymbolsandPunctuation UCS Block | [
"Check",
"whether",
"the",
"character",
"is",
"part",
"of",
"CJKSymbolsandPunctuation",
"UCS",
"Block"
] | def uCSIsCJKSymbolsandPunctuation(code):
"""Check whether the character is part of
CJKSymbolsandPunctuation UCS Block """
ret = libxml2mod.xmlUCSIsCJKSymbolsandPunctuation(code)
return ret | [
"def",
"uCSIsCJKSymbolsandPunctuation",
"(",
"code",
")",
":",
"ret",
"=",
"libxml2mod",
".",
"xmlUCSIsCJKSymbolsandPunctuation",
"(",
"code",
")",
"return",
"ret"
] | https://github.com/apple/turicreate/blob/cce55aa5311300e3ce6af93cb45ba791fd1bdf49/deps/src/libxml2-2.9.1/python/libxml2class.py#L1429-L1433 | |
Xilinx/Vitis-AI | fc74d404563d9951b57245443c73bef389f3657f | tools/Vitis-AI-Quantizer/vai_q_tensorflow1.x/tensorflow/python/autograph/pyct/cfg.py | python | GraphBuilder._add_new_node | (self, ast_node) | return node | Grows the graph by adding a CFG node following the current leaves. | Grows the graph by adding a CFG node following the current leaves. | [
"Grows",
"the",
"graph",
"by",
"adding",
"a",
"CFG",
"node",
"following",
"the",
"current",
"leaves",
"."
] | def _add_new_node(self, ast_node):
"""Grows the graph by adding a CFG node following the current leaves."""
if ast_node is self.node_index:
raise ValueError('%s added twice' % ast_node)
# Assumption: All CFG nodes have identical life spans, because the graph
# owns them. Nodes should never be used... | [
"def",
"_add_new_node",
"(",
"self",
",",
"ast_node",
")",
":",
"if",
"ast_node",
"is",
"self",
".",
"node_index",
":",
"raise",
"ValueError",
"(",
"'%s added twice'",
"%",
"ast_node",
")",
"# Assumption: All CFG nodes have identical life spans, because the graph",
"# o... | https://github.com/Xilinx/Vitis-AI/blob/fc74d404563d9951b57245443c73bef389f3657f/tools/Vitis-AI-Quantizer/vai_q_tensorflow1.x/tensorflow/python/autograph/pyct/cfg.py#L324-L346 | |
ApolloAuto/apollo-platform | 86d9dc6743b496ead18d597748ebabd34a513289 | ros/third_party/lib_aarch64/python2.7/dist-packages/rospkg/distro.py | python | _distro_version | (version_val) | return version_val | Parse distro version value, converting SVN revision to version value if necessary | Parse distro version value, converting SVN revision to version value if necessary | [
"Parse",
"distro",
"version",
"value",
"converting",
"SVN",
"revision",
"to",
"version",
"value",
"if",
"necessary"
] | def _distro_version(version_val):
"""
Parse distro version value, converting SVN revision to version value if necessary
"""
version_val = str(version_val)
# check for no keyword sub
if version_val == '$Revision$':
return 0
m = re.search('\$Revision:\s*([0-9]*)\s*\$', version_val)
... | [
"def",
"_distro_version",
"(",
"version_val",
")",
":",
"version_val",
"=",
"str",
"(",
"version_val",
")",
"# check for no keyword sub",
"if",
"version_val",
"==",
"'$Revision$'",
":",
"return",
"0",
"m",
"=",
"re",
".",
"search",
"(",
"'\\$Revision:\\s*([0-9]*)\... | https://github.com/ApolloAuto/apollo-platform/blob/86d9dc6743b496ead18d597748ebabd34a513289/ros/third_party/lib_aarch64/python2.7/dist-packages/rospkg/distro.py#L267-L283 | |
wxWidgets/wxPython-Classic | 19571e1ae65f1ac445f5491474121998c97a1bf0 | src/osx_cocoa/_controls.py | python | TextAttr.HasFontUnderlined | (*args, **kwargs) | return _controls_.TextAttr_HasFontUnderlined(*args, **kwargs) | HasFontUnderlined(self) -> bool | HasFontUnderlined(self) -> bool | [
"HasFontUnderlined",
"(",
"self",
")",
"-",
">",
"bool"
] | def HasFontUnderlined(*args, **kwargs):
"""HasFontUnderlined(self) -> bool"""
return _controls_.TextAttr_HasFontUnderlined(*args, **kwargs) | [
"def",
"HasFontUnderlined",
"(",
"*",
"args",
",",
"*",
"*",
"kwargs",
")",
":",
"return",
"_controls_",
".",
"TextAttr_HasFontUnderlined",
"(",
"*",
"args",
",",
"*",
"*",
"kwargs",
")"
] | https://github.com/wxWidgets/wxPython-Classic/blob/19571e1ae65f1ac445f5491474121998c97a1bf0/src/osx_cocoa/_controls.py#L1804-L1806 | |
tensorflow/tensorflow | 419e3a6b650ea4bd1b0cba23c4348f8a69f3272e | tensorflow/python/data/benchmarks/from_tensor_slices_benchmark.py | python | SingleThreadedFlatMapDataset.__init__ | (self, input_dataset, map_func) | See `Dataset.flat_map()` for details. | See `Dataset.flat_map()` for details. | [
"See",
"Dataset",
".",
"flat_map",
"()",
"for",
"details",
"."
] | def __init__(self, input_dataset, map_func):
"""See `Dataset.flat_map()` for details."""
self._input_dataset = input_dataset
self._map_func = structured_function.StructuredFunctionWrapper(
map_func,
self._transformation_name(),
dataset=input_dataset,
defun_kwargs={"_executor"... | [
"def",
"__init__",
"(",
"self",
",",
"input_dataset",
",",
"map_func",
")",
":",
"self",
".",
"_input_dataset",
"=",
"input_dataset",
"self",
".",
"_map_func",
"=",
"structured_function",
".",
"StructuredFunctionWrapper",
"(",
"map_func",
",",
"self",
".",
"_tra... | https://github.com/tensorflow/tensorflow/blob/419e3a6b650ea4bd1b0cba23c4348f8a69f3272e/tensorflow/python/data/benchmarks/from_tensor_slices_benchmark.py#L30-L45 | ||
microsoft/checkedc-clang | a173fefde5d7877b7750e7ce96dd08cf18baebf2 | libcxx/utils/libcxx/sym_check/util.py | python | read_syms_from_file | (filename) | return read_syms_from_list(data.splitlines()) | Read a list of symbols in from a file. | Read a list of symbols in from a file. | [
"Read",
"a",
"list",
"of",
"symbols",
"in",
"from",
"a",
"file",
"."
] | def read_syms_from_file(filename):
"""
Read a list of symbols in from a file.
"""
with open(filename, 'r') as f:
data = f.read()
return read_syms_from_list(data.splitlines()) | [
"def",
"read_syms_from_file",
"(",
"filename",
")",
":",
"with",
"open",
"(",
"filename",
",",
"'r'",
")",
"as",
"f",
":",
"data",
"=",
"f",
".",
"read",
"(",
")",
"return",
"read_syms_from_list",
"(",
"data",
".",
"splitlines",
"(",
")",
")"
] | https://github.com/microsoft/checkedc-clang/blob/a173fefde5d7877b7750e7ce96dd08cf18baebf2/libcxx/utils/libcxx/sym_check/util.py#L25-L31 | |
aws/lumberyard | f85344403c1c2e77ec8c75deb2c116e97b713217 | dev/Gems/CloudGemDefectReporter/v1/AWS/common-code/Lib/setuptools/command/easy_install.py | python | PthDistributions.add | (self, dist) | Add `dist` to the distribution map | Add `dist` to the distribution map | [
"Add",
"dist",
"to",
"the",
"distribution",
"map"
] | def add(self, dist):
"""Add `dist` to the distribution map"""
new_path = (
dist.location not in self.paths and (
dist.location not in self.sitedirs or
# account for '.' being in PYTHONPATH
dist.location == os.getcwd()
)
)
... | [
"def",
"add",
"(",
"self",
",",
"dist",
")",
":",
"new_path",
"=",
"(",
"dist",
".",
"location",
"not",
"in",
"self",
".",
"paths",
"and",
"(",
"dist",
".",
"location",
"not",
"in",
"self",
".",
"sitedirs",
"or",
"# account for '.' being in PYTHONPATH",
... | https://github.com/aws/lumberyard/blob/f85344403c1c2e77ec8c75deb2c116e97b713217/dev/Gems/CloudGemDefectReporter/v1/AWS/common-code/Lib/setuptools/command/easy_install.py#L1644-L1656 | ||
hanpfei/chromium-net | 392cc1fa3a8f92f42e4071ab6e674d8e0482f83f | third_party/catapult/third_party/gsutil/third_party/httplib2/upload-diffs.py | python | VersionControlSystem.GetGUID | (self) | Return string to distinguish the repository from others, for example to
query all opened review issues for it | Return string to distinguish the repository from others, for example to
query all opened review issues for it | [
"Return",
"string",
"to",
"distinguish",
"the",
"repository",
"from",
"others",
"for",
"example",
"to",
"query",
"all",
"opened",
"review",
"issues",
"for",
"it"
] | def GetGUID(self):
"""Return string to distinguish the repository from others, for example to
query all opened review issues for it"""
raise NotImplementedError(
"abstract method -- subclass %s must override" % self.__class__) | [
"def",
"GetGUID",
"(",
"self",
")",
":",
"raise",
"NotImplementedError",
"(",
"\"abstract method -- subclass %s must override\"",
"%",
"self",
".",
"__class__",
")"
] | https://github.com/hanpfei/chromium-net/blob/392cc1fa3a8f92f42e4071ab6e674d8e0482f83f/third_party/catapult/third_party/gsutil/third_party/httplib2/upload-diffs.py#L814-L818 | ||
facebookincubator/mvfst | 034a40c797485113d00127852d4df3c5bb44b3ed | build/fbcode_builder/fbcode_builder.py | python | FBCodeBuilder.render | (self, steps) | return res | Converts nested actions to your builder's expected output format.
Typically takes the output of build(). | [] | def render(self, steps):
"""
Converts nested actions to your builder's expected output format.
Typically takes the output of build().
"""
res = self._render_impl(steps) # Implementation-dependent
# Now that the output is rendered, we expect all options to have
... | [
"def",
"render",
"(",
"self",
",",
"steps",
")",
":",
"res",
"=",
"self",
".",
"_render_impl",
"(",
"steps",
")",
"# Implementation-dependent",
"# Now that the output is rendered, we expect all options to have",
"# been used.",
"unused_options",
"=",
"set",
"(",
"self",... | https://github.com/facebookincubator/mvfst/blob/034a40c797485113d00127852d4df3c5bb44b3ed/build/fbcode_builder/fbcode_builder.py#L120-L140 | ||
aws/lumberyard | f85344403c1c2e77ec8c75deb2c116e97b713217 | dev/Tools/Python/3.7.10/linux_x64/lib/python3.7/codecs.py | python | StreamReader.read | (self, size=-1, chars=-1, firstline=False) | return result | Decodes data from the stream self.stream and returns the
resulting object.
chars indicates the number of decoded code points or bytes to
return. read() will never return more data than requested,
but it might return less, if there is not enough available.
si... | Decodes data from the stream self.stream and returns the
resulting object. | [
"Decodes",
"data",
"from",
"the",
"stream",
"self",
".",
"stream",
"and",
"returns",
"the",
"resulting",
"object",
"."
] | def read(self, size=-1, chars=-1, firstline=False):
""" Decodes data from the stream self.stream and returns the
resulting object.
chars indicates the number of decoded code points or bytes to
return. read() will never return more data than requested,
but it mig... | [
"def",
"read",
"(",
"self",
",",
"size",
"=",
"-",
"1",
",",
"chars",
"=",
"-",
"1",
",",
"firstline",
"=",
"False",
")",
":",
"# If we have lines cached, first merge them back into characters",
"if",
"self",
".",
"linebuffer",
":",
"self",
".",
"charbuffer",
... | https://github.com/aws/lumberyard/blob/f85344403c1c2e77ec8c75deb2c116e97b713217/dev/Tools/Python/3.7.10/linux_x64/lib/python3.7/codecs.py#L451-L529 | |
catboost/catboost | 167f64f237114a4d10b2b4ee42adb4569137debe | contrib/tools/python/src/Lib/lib-tk/Tkinter.py | python | NoDefaultRoot | () | Inhibit setting of default root window.
Call this function to inhibit that the first instance of
Tk is used for windows without an explicit parent window. | Inhibit setting of default root window. | [
"Inhibit",
"setting",
"of",
"default",
"root",
"window",
"."
] | def NoDefaultRoot():
"""Inhibit setting of default root window.
Call this function to inhibit that the first instance of
Tk is used for windows without an explicit parent window.
"""
global _support_default_root
_support_default_root = 0
global _default_root
_default_root = None
del... | [
"def",
"NoDefaultRoot",
"(",
")",
":",
"global",
"_support_default_root",
"_support_default_root",
"=",
"0",
"global",
"_default_root",
"_default_root",
"=",
"None",
"del",
"_default_root"
] | https://github.com/catboost/catboost/blob/167f64f237114a4d10b2b4ee42adb4569137debe/contrib/tools/python/src/Lib/lib-tk/Tkinter.py#L199-L209 | ||
wxWidgets/wxPython-Classic | 19571e1ae65f1ac445f5491474121998c97a1bf0 | src/msw/dataview.py | python | DataViewVirtualListModel.GetAttrByRow | (*args, **kwargs) | return _dataview.DataViewVirtualListModel_GetAttrByRow(*args, **kwargs) | GetAttrByRow(self, unsigned int row, unsigned int col, DataViewItemAttr attr) -> bool
Override this to indicate that the item has special font
attributes. This only affects the `DataViewTextRenderer` renderer.
Return ``False`` if the default attributes should be used. | GetAttrByRow(self, unsigned int row, unsigned int col, DataViewItemAttr attr) -> bool | [
"GetAttrByRow",
"(",
"self",
"unsigned",
"int",
"row",
"unsigned",
"int",
"col",
"DataViewItemAttr",
"attr",
")",
"-",
">",
"bool"
] | def GetAttrByRow(*args, **kwargs):
"""
GetAttrByRow(self, unsigned int row, unsigned int col, DataViewItemAttr attr) -> bool
Override this to indicate that the item has special font
attributes. This only affects the `DataViewTextRenderer` renderer.
Return ``False`` if the defaul... | [
"def",
"GetAttrByRow",
"(",
"*",
"args",
",",
"*",
"*",
"kwargs",
")",
":",
"return",
"_dataview",
".",
"DataViewVirtualListModel_GetAttrByRow",
"(",
"*",
"args",
",",
"*",
"*",
"kwargs",
")"
] | https://github.com/wxWidgets/wxPython-Classic/blob/19571e1ae65f1ac445f5491474121998c97a1bf0/src/msw/dataview.py#L974-L982 | |
hanpfei/chromium-net | 392cc1fa3a8f92f42e4071ab6e674d8e0482f83f | third_party/catapult/dashboard/dashboard/utils.py | python | ServiceAccountCredentials | () | return client.SignedJwtAssertionCredentials(
service_account_name=account_details['client_email'],
private_key=account_details['private_key'],
scope=EMAIL_SCOPE) | Returns the Credentials of the service account if available. | Returns the Credentials of the service account if available. | [
"Returns",
"the",
"Credentials",
"of",
"the",
"service",
"account",
"if",
"available",
"."
] | def ServiceAccountCredentials():
"""Returns the Credentials of the service account if available."""
account_details = stored_object.Get(SERVICE_ACCOUNT_KEY)
if not account_details:
logging.error('Service account credentials not found.')
return None
return client.SignedJwtAssertionCredentials(
serv... | [
"def",
"ServiceAccountCredentials",
"(",
")",
":",
"account_details",
"=",
"stored_object",
".",
"Get",
"(",
"SERVICE_ACCOUNT_KEY",
")",
"if",
"not",
"account_details",
":",
"logging",
".",
"error",
"(",
"'Service account credentials not found.'",
")",
"return",
"None... | https://github.com/hanpfei/chromium-net/blob/392cc1fa3a8f92f42e4071ab6e674d8e0482f83f/third_party/catapult/dashboard/dashboard/utils.py#L335-L344 | |
ApolloAuto/apollo-platform | 86d9dc6743b496ead18d597748ebabd34a513289 | ros/third_party/lib_x86_64/python2.7/dist-packages/numpy/oldnumeric/ma.py | python | zeros | (shape, dtype=float) | return array(numeric.zeros(shape, dtype)) | zeros(n, dtype=float) =
an array of all zeros of the given length or shape. | zeros(n, dtype=float) =
an array of all zeros of the given length or shape. | [
"zeros",
"(",
"n",
"dtype",
"=",
"float",
")",
"=",
"an",
"array",
"of",
"all",
"zeros",
"of",
"the",
"given",
"length",
"or",
"shape",
"."
] | def zeros (shape, dtype=float):
"""zeros(n, dtype=float) =
an array of all zeros of the given length or shape."""
return array(numeric.zeros(shape, dtype)) | [
"def",
"zeros",
"(",
"shape",
",",
"dtype",
"=",
"float",
")",
":",
"return",
"array",
"(",
"numeric",
".",
"zeros",
"(",
"shape",
",",
"dtype",
")",
")"
] | https://github.com/ApolloAuto/apollo-platform/blob/86d9dc6743b496ead18d597748ebabd34a513289/ros/third_party/lib_x86_64/python2.7/dist-packages/numpy/oldnumeric/ma.py#L1576-L1579 | |
aws/lumberyard | f85344403c1c2e77ec8c75deb2c116e97b713217 | dev/Gems/CloudGemMetric/v1/AWS/python/windows/Lib/pandas/core/indexes/multi.py | python | MultiIndexUIntEngine._codes_to_ints | (self, codes) | return np.bitwise_or.reduce(codes, axis=1) | Transform combination(s) of uint64 in one uint64 (each), in a strictly
monotonic way (i.e. respecting the lexicographic order of integer
combinations): see BaseMultiIndexCodesEngine documentation.
Parameters
----------
codes : 1- or 2-dimensional array of dtype uint64
... | Transform combination(s) of uint64 in one uint64 (each), in a strictly
monotonic way (i.e. respecting the lexicographic order of integer
combinations): see BaseMultiIndexCodesEngine documentation. | [
"Transform",
"combination",
"(",
"s",
")",
"of",
"uint64",
"in",
"one",
"uint64",
"(",
"each",
")",
"in",
"a",
"strictly",
"monotonic",
"way",
"(",
"i",
".",
"e",
".",
"respecting",
"the",
"lexicographic",
"order",
"of",
"integer",
"combinations",
")",
"... | def _codes_to_ints(self, codes):
"""
Transform combination(s) of uint64 in one uint64 (each), in a strictly
monotonic way (i.e. respecting the lexicographic order of integer
combinations): see BaseMultiIndexCodesEngine documentation.
Parameters
----------
codes :... | [
"def",
"_codes_to_ints",
"(",
"self",
",",
"codes",
")",
":",
"# Shift the representation of each level by the pre-calculated number",
"# of bits:",
"codes",
"<<=",
"self",
".",
"offsets",
"# Now sum and OR are in fact interchangeable. This is a simple",
"# composition of the (disjun... | https://github.com/aws/lumberyard/blob/f85344403c1c2e77ec8c75deb2c116e97b713217/dev/Gems/CloudGemMetric/v1/AWS/python/windows/Lib/pandas/core/indexes/multi.py#L73-L101 | |
gnina/gnina | b9ae032f52fc7a8153987bde09c0efa3620d8bb6 | caffe/python/caffe/coord_map.py | python | coord_map | (fn) | Define the coordinate mapping by its
- axis
- scale: output coord[i * scale] <- input_coord[i]
- shift: output coord[i] <- output_coord[i + shift]
s.t. the identity mapping, as for pointwise layers like ReLu, is defined by
(None, 1, 0) since it is independent of axis and does not transform coords. | Define the coordinate mapping by its
- axis
- scale: output coord[i * scale] <- input_coord[i]
- shift: output coord[i] <- output_coord[i + shift]
s.t. the identity mapping, as for pointwise layers like ReLu, is defined by
(None, 1, 0) since it is independent of axis and does not transform coords. | [
"Define",
"the",
"coordinate",
"mapping",
"by",
"its",
"-",
"axis",
"-",
"scale",
":",
"output",
"coord",
"[",
"i",
"*",
"scale",
"]",
"<",
"-",
"input_coord",
"[",
"i",
"]",
"-",
"shift",
":",
"output",
"coord",
"[",
"i",
"]",
"<",
"-",
"output_co... | def coord_map(fn):
"""
Define the coordinate mapping by its
- axis
- scale: output coord[i * scale] <- input_coord[i]
- shift: output coord[i] <- output_coord[i + shift]
s.t. the identity mapping, as for pointwise layers like ReLu, is defined by
(None, 1, 0) since it is independent of axis a... | [
"def",
"coord_map",
"(",
"fn",
")",
":",
"if",
"fn",
".",
"type_name",
"in",
"[",
"'Convolution'",
",",
"'Pooling'",
",",
"'Im2col'",
"]",
":",
"axis",
",",
"stride",
",",
"ks",
",",
"pad",
"=",
"conv_params",
"(",
"fn",
")",
"return",
"axis",
",",
... | https://github.com/gnina/gnina/blob/b9ae032f52fc7a8153987bde09c0efa3620d8bb6/caffe/python/caffe/coord_map.py#L57-L79 | ||
krishauser/Klampt | 972cc83ea5befac3f653c1ba20f80155768ad519 | Python/klampt/model/types.py | python | object_to_types | (object,world=None) | Returns a string defining the type of the given Python Klamp't object.
If multiple types could be associated with it, then it returns a list of all
possible valid types. | Returns a string defining the type of the given Python Klamp't object.
If multiple types could be associated with it, then it returns a list of all
possible valid types. | [
"Returns",
"a",
"string",
"defining",
"the",
"type",
"of",
"the",
"given",
"Python",
"Klamp",
"t",
"object",
".",
"If",
"multiple",
"types",
"could",
"be",
"associated",
"with",
"it",
"then",
"it",
"returns",
"a",
"list",
"of",
"all",
"possible",
"valid",
... | def object_to_types(object,world=None):
"""Returns a string defining the type of the given Python Klamp't object.
If multiple types could be associated with it, then it returns a list of all
possible valid types."""
if isinstance(object,ContactPoint):
return 'ContactPoint'
elif isinstance(ob... | [
"def",
"object_to_types",
"(",
"object",
",",
"world",
"=",
"None",
")",
":",
"if",
"isinstance",
"(",
"object",
",",
"ContactPoint",
")",
":",
"return",
"'ContactPoint'",
"elif",
"isinstance",
"(",
"object",
",",
"Hold",
")",
":",
"return",
"'Hold'",
"eli... | https://github.com/krishauser/Klampt/blob/972cc83ea5befac3f653c1ba20f80155768ad519/Python/klampt/model/types.py#L24-L118 | ||
wlanjie/AndroidFFmpeg | 7baf9122f4b8e1c74e7baf4be5c422c7a5ba5aaf | tools/fdk-aac-build/armeabi-v7a/toolchain/lib/python2.7/email/message.py | python | Message.set_type | (self, type, header='Content-Type', requote=True) | Set the main type and subtype for the Content-Type header.
type must be a string in the form "maintype/subtype", otherwise a
ValueError is raised.
This method replaces the Content-Type header, keeping all the
parameters in place. If requote is False, this leaves the existing
h... | Set the main type and subtype for the Content-Type header. | [
"Set",
"the",
"main",
"type",
"and",
"subtype",
"for",
"the",
"Content",
"-",
"Type",
"header",
"."
] | def set_type(self, type, header='Content-Type', requote=True):
"""Set the main type and subtype for the Content-Type header.
type must be a string in the form "maintype/subtype", otherwise a
ValueError is raised.
This method replaces the Content-Type header, keeping all the
par... | [
"def",
"set_type",
"(",
"self",
",",
"type",
",",
"header",
"=",
"'Content-Type'",
",",
"requote",
"=",
"True",
")",
":",
"# BAW: should we be strict?",
"if",
"not",
"type",
".",
"count",
"(",
"'/'",
")",
"==",
"1",
":",
"raise",
"ValueError",
"# Set the C... | https://github.com/wlanjie/AndroidFFmpeg/blob/7baf9122f4b8e1c74e7baf4be5c422c7a5ba5aaf/tools/fdk-aac-build/armeabi-v7a/toolchain/lib/python2.7/email/message.py#L641-L671 | ||
raymondlu/super-animation-samples | 04234269112ff0dc32447f27a761dbbb00b8ba17 | samples/cocos2d-x-3.1/CocosLuaGame2/frameworks/cocos2d-x/tools/bindings-generator/clang/cindex.py | python | Cursor.extent | (self) | return self._extent | Return the source range (the range of text) occupied by the entity
pointed at by the cursor. | Return the source range (the range of text) occupied by the entity
pointed at by the cursor. | [
"Return",
"the",
"source",
"range",
"(",
"the",
"range",
"of",
"text",
")",
"occupied",
"by",
"the",
"entity",
"pointed",
"at",
"by",
"the",
"cursor",
"."
] | def extent(self):
"""
Return the source range (the range of text) occupied by the entity
pointed at by the cursor.
"""
if not hasattr(self, '_extent'):
self._extent = conf.lib.clang_getCursorExtent(self)
return self._extent | [
"def",
"extent",
"(",
"self",
")",
":",
"if",
"not",
"hasattr",
"(",
"self",
",",
"'_extent'",
")",
":",
"self",
".",
"_extent",
"=",
"conf",
".",
"lib",
".",
"clang_getCursorExtent",
"(",
"self",
")",
"return",
"self",
".",
"_extent"
] | https://github.com/raymondlu/super-animation-samples/blob/04234269112ff0dc32447f27a761dbbb00b8ba17/samples/cocos2d-x-3.1/CocosLuaGame2/frameworks/cocos2d-x/tools/bindings-generator/clang/cindex.py#L1288-L1296 | |
aws/lumberyard | f85344403c1c2e77ec8c75deb2c116e97b713217 | dev/Tools/AWSPythonSDK/1.5.8/dateutil/rrule.py | python | _rrulestr._handle_BYWEEKDAY | (self, rrkwargs, name, value, **kwargs) | Two ways to specify this: +1MO or MO(+1) | Two ways to specify this: +1MO or MO(+1) | [
"Two",
"ways",
"to",
"specify",
"this",
":",
"+",
"1MO",
"or",
"MO",
"(",
"+",
"1",
")"
] | def _handle_BYWEEKDAY(self, rrkwargs, name, value, **kwargs):
"""
Two ways to specify this: +1MO or MO(+1)
"""
l = []
for wday in value.split(','):
if '(' in wday:
# If it's of the form TH(+1), etc.
splt = wday.split('(')
... | [
"def",
"_handle_BYWEEKDAY",
"(",
"self",
",",
"rrkwargs",
",",
"name",
",",
"value",
",",
"*",
"*",
"kwargs",
")",
":",
"l",
"=",
"[",
"]",
"for",
"wday",
"in",
"value",
".",
"split",
"(",
"','",
")",
":",
"if",
"'('",
"in",
"wday",
":",
"# If it... | https://github.com/aws/lumberyard/blob/f85344403c1c2e77ec8c75deb2c116e97b713217/dev/Tools/AWSPythonSDK/1.5.8/dateutil/rrule.py#L1438-L1462 | ||
aws/lumberyard | f85344403c1c2e77ec8c75deb2c116e97b713217 | dev/Tools/AWSPythonSDK/1.5.8/concurrent/futures/_base.py | python | Executor.shutdown | (self, wait=True) | Clean-up the resources associated with the Executor.
It is safe to call this method several times. Otherwise, no other
methods can be called after this one.
Args:
wait: If True then shutdown will not return until all running
futures have finished executing and the r... | Clean-up the resources associated with the Executor. | [
"Clean",
"-",
"up",
"the",
"resources",
"associated",
"with",
"the",
"Executor",
"."
] | def shutdown(self, wait=True):
"""Clean-up the resources associated with the Executor.
It is safe to call this method several times. Otherwise, no other
methods can be called after this one.
Args:
wait: If True then shutdown will not return until all running
... | [
"def",
"shutdown",
"(",
"self",
",",
"wait",
"=",
"True",
")",
":",
"pass"
] | https://github.com/aws/lumberyard/blob/f85344403c1c2e77ec8c75deb2c116e97b713217/dev/Tools/AWSPythonSDK/1.5.8/concurrent/futures/_base.py#L613-L624 | ||
snap-stanford/snap-python | d53c51b0a26aa7e3e7400b014cdf728948fde80a | setup/snap.py | python | TStrV.IsInBin | (self, *args) | return _snap.TStrV_IsInBin(self, *args) | IsInBin(TStrV self, TStr Val) -> bool
Parameters:
Val: TStr const & | IsInBin(TStrV self, TStr Val) -> bool | [
"IsInBin",
"(",
"TStrV",
"self",
"TStr",
"Val",
")",
"-",
">",
"bool"
] | def IsInBin(self, *args):
"""
IsInBin(TStrV self, TStr Val) -> bool
Parameters:
Val: TStr const &
"""
return _snap.TStrV_IsInBin(self, *args) | [
"def",
"IsInBin",
"(",
"self",
",",
"*",
"args",
")",
":",
"return",
"_snap",
".",
"TStrV_IsInBin",
"(",
"self",
",",
"*",
"args",
")"
] | https://github.com/snap-stanford/snap-python/blob/d53c51b0a26aa7e3e7400b014cdf728948fde80a/setup/snap.py#L19926-L19934 | |
catboost/catboost | 167f64f237114a4d10b2b4ee42adb4569137debe | contrib/tools/python/src/Lib/string.py | python | lower | (s) | return s.lower() | lower(s) -> string
Return a copy of the string s converted to lowercase. | lower(s) -> string | [
"lower",
"(",
"s",
")",
"-",
">",
"string"
] | def lower(s):
"""lower(s) -> string
Return a copy of the string s converted to lowercase.
"""
return s.lower() | [
"def",
"lower",
"(",
"s",
")",
":",
"return",
"s",
".",
"lower",
"(",
")"
] | https://github.com/catboost/catboost/blob/167f64f237114a4d10b2b4ee42adb4569137debe/contrib/tools/python/src/Lib/string.py#L222-L228 | |
wxWidgets/wxPython-Classic | 19571e1ae65f1ac445f5491474121998c97a1bf0 | wx/tools/Editra/src/plugin.py | python | PluginManager.UpdateConfig | (self) | Updates the in memory config data to recognize
any plugins that may have been added or initialzed
by a call to InitPlugins.
@postcondition: plugins are enabled or disabled based
on the configuration data. | Updates the in memory config data to recognize
any plugins that may have been added or initialzed
by a call to InitPlugins.
@postcondition: plugins are enabled or disabled based
on the configuration data. | [
"Updates",
"the",
"in",
"memory",
"config",
"data",
"to",
"recognize",
"any",
"plugins",
"that",
"may",
"have",
"been",
"added",
"or",
"initialzed",
"by",
"a",
"call",
"to",
"InitPlugins",
".",
"@postcondition",
":",
"plugins",
"are",
"enabled",
"or",
"disab... | def UpdateConfig(self):
"""Updates the in memory config data to recognize
any plugins that may have been added or initialzed
by a call to InitPlugins.
@postcondition: plugins are enabled or disabled based
on the configuration data.
"""
for pdata i... | [
"def",
"UpdateConfig",
"(",
"self",
")",
":",
"for",
"pdata",
"in",
"self",
".",
"_pdata",
".",
"values",
"(",
")",
":",
"plugin",
"=",
"pdata",
".",
"GetClass",
"(",
")",
"if",
"self",
".",
"_config",
".",
"get",
"(",
"plugin",
".",
"__module__",
... | https://github.com/wxWidgets/wxPython-Classic/blob/19571e1ae65f1ac445f5491474121998c97a1bf0/wx/tools/Editra/src/plugin.py#L845-L859 | ||
catboost/catboost | 167f64f237114a4d10b2b4ee42adb4569137debe | contrib/python/setuptools/py2/setuptools/command/alias.py | python | shquote | (arg) | return arg | Quote an argument for later parsing by shlex.split() | Quote an argument for later parsing by shlex.split() | [
"Quote",
"an",
"argument",
"for",
"later",
"parsing",
"by",
"shlex",
".",
"split",
"()"
] | def shquote(arg):
"""Quote an argument for later parsing by shlex.split()"""
for c in '"', "'", "\\", "#":
if c in arg:
return repr(arg)
if arg.split() != [arg]:
return repr(arg)
return arg | [
"def",
"shquote",
"(",
"arg",
")",
":",
"for",
"c",
"in",
"'\"'",
",",
"\"'\"",
",",
"\"\\\\\"",
",",
"\"#\"",
":",
"if",
"c",
"in",
"arg",
":",
"return",
"repr",
"(",
"arg",
")",
"if",
"arg",
".",
"split",
"(",
")",
"!=",
"[",
"arg",
"]",
":... | https://github.com/catboost/catboost/blob/167f64f237114a4d10b2b4ee42adb4569137debe/contrib/python/setuptools/py2/setuptools/command/alias.py#L8-L15 | |
hanpfei/chromium-net | 392cc1fa3a8f92f42e4071ab6e674d8e0482f83f | third_party/catapult/third_party/gsutil/third_party/httplib2/upload-diffs.py | python | VersionControlSystem.__init__ | (self, options) | Constructor.
Args:
options: Command line options. | Constructor. | [
"Constructor",
"."
] | def __init__(self, options):
"""Constructor.
Args:
options: Command line options.
"""
self.options = options | [
"def",
"__init__",
"(",
"self",
",",
"options",
")",
":",
"self",
".",
"options",
"=",
"options"
] | https://github.com/hanpfei/chromium-net/blob/392cc1fa3a8f92f42e4071ab6e674d8e0482f83f/third_party/catapult/third_party/gsutil/third_party/httplib2/upload-diffs.py#L806-L812 | ||
mantidproject/mantid | 03deeb89254ec4289edb8771e0188c2090a02f32 | Framework/PythonInterface/mantid/plots/mantidaxes.py | python | MantidAxes._remove_workspace_artists | (self, workspace) | return True | Remove the artists reference by this workspace (if any) and return True
if the axes is then empty
:param workspace: A Workspace object
:return: True is an artist was removed False if one was not | Remove the artists reference by this workspace (if any) and return True
if the axes is then empty
:param workspace: A Workspace object
:return: True is an artist was removed False if one was not | [
"Remove",
"the",
"artists",
"reference",
"by",
"this",
"workspace",
"(",
"if",
"any",
")",
"and",
"return",
"True",
"if",
"the",
"axes",
"is",
"then",
"empty",
":",
"param",
"workspace",
":",
"A",
"Workspace",
"object",
":",
"return",
":",
"True",
"is",
... | def _remove_workspace_artists(self, workspace):
"""
Remove the artists reference by this workspace (if any) and return True
if the axes is then empty
:param workspace: A Workspace object
:return: True is an artist was removed False if one was not
"""
try:
... | [
"def",
"_remove_workspace_artists",
"(",
"self",
",",
"workspace",
")",
":",
"try",
":",
"# pop to ensure we don't hold onto an artist reference",
"artist_info",
"=",
"self",
".",
"tracked_workspaces",
".",
"pop",
"(",
"workspace",
".",
"name",
"(",
")",
")",
"excep... | https://github.com/mantidproject/mantid/blob/03deeb89254ec4289edb8771e0188c2090a02f32/Framework/PythonInterface/mantid/plots/mantidaxes.py#L369-L385 | |
catboost/catboost | 167f64f237114a4d10b2b4ee42adb4569137debe | contrib/python/prompt-toolkit/py3/prompt_toolkit/contrib/regular_languages/compiler.py | python | _CompiledGrammar.match | (self, string: str) | return None | Match the string with the grammar.
Returns a :class:`Match` instance or `None` when the input doesn't match the grammar.
:param string: The input string. | Match the string with the grammar.
Returns a :class:`Match` instance or `None` when the input doesn't match the grammar. | [
"Match",
"the",
"string",
"with",
"the",
"grammar",
".",
"Returns",
"a",
":",
"class",
":",
"Match",
"instance",
"or",
"None",
"when",
"the",
"input",
"doesn",
"t",
"match",
"the",
"grammar",
"."
] | def match(self, string: str) -> Optional["Match"]:
"""
Match the string with the grammar.
Returns a :class:`Match` instance or `None` when the input doesn't match the grammar.
:param string: The input string.
"""
m = self._re.match(string)
if m:
retu... | [
"def",
"match",
"(",
"self",
",",
"string",
":",
"str",
")",
"->",
"Optional",
"[",
"\"Match\"",
"]",
":",
"m",
"=",
"self",
".",
"_re",
".",
"match",
"(",
"string",
")",
"if",
"m",
":",
"return",
"Match",
"(",
"string",
",",
"[",
"(",
"self",
... | https://github.com/catboost/catboost/blob/167f64f237114a4d10b2b4ee42adb4569137debe/contrib/python/prompt-toolkit/py3/prompt_toolkit/contrib/regular_languages/compiler.py#L359-L372 | |
wxWidgets/wxPython-Classic | 19571e1ae65f1ac445f5491474121998c97a1bf0 | src/osx_carbon/_core.py | python | Rect.GetSize | (*args, **kwargs) | return _core_.Rect_GetSize(*args, **kwargs) | GetSize(self) -> Size | GetSize(self) -> Size | [
"GetSize",
"(",
"self",
")",
"-",
">",
"Size"
] | def GetSize(*args, **kwargs):
"""GetSize(self) -> Size"""
return _core_.Rect_GetSize(*args, **kwargs) | [
"def",
"GetSize",
"(",
"*",
"args",
",",
"*",
"*",
"kwargs",
")",
":",
"return",
"_core_",
".",
"Rect_GetSize",
"(",
"*",
"args",
",",
"*",
"*",
"kwargs",
")"
] | https://github.com/wxWidgets/wxPython-Classic/blob/19571e1ae65f1ac445f5491474121998c97a1bf0/src/osx_carbon/_core.py#L1309-L1311 | |
hanpfei/chromium-net | 392cc1fa3a8f92f42e4071ab6e674d8e0482f83f | third_party/catapult/third_party/gsutil/third_party/httplib2/upload-diffs.py | python | ErrorExit | (msg) | Print an error message to stderr and exit. | Print an error message to stderr and exit. | [
"Print",
"an",
"error",
"message",
"to",
"stderr",
"and",
"exit",
"."
] | def ErrorExit(msg):
"""Print an error message to stderr and exit."""
print >>sys.stderr, msg
sys.exit(1) | [
"def",
"ErrorExit",
"(",
"msg",
")",
":",
"print",
">>",
"sys",
".",
"stderr",
",",
"msg",
"sys",
".",
"exit",
"(",
"1",
")"
] | https://github.com/hanpfei/chromium-net/blob/392cc1fa3a8f92f42e4071ab6e674d8e0482f83f/third_party/catapult/third_party/gsutil/third_party/httplib2/upload-diffs.py#L156-L159 | ||
wlanjie/AndroidFFmpeg | 7baf9122f4b8e1c74e7baf4be5c422c7a5ba5aaf | tools/fdk-aac-build/x86/toolchain/lib/python2.7/xml/sax/xmlreader.py | python | XMLReader.setEntityResolver | (self, resolver) | Register an object to resolve external entities. | Register an object to resolve external entities. | [
"Register",
"an",
"object",
"to",
"resolve",
"external",
"entities",
"."
] | def setEntityResolver(self, resolver):
"Register an object to resolve external entities."
self._ent_handler = resolver | [
"def",
"setEntityResolver",
"(",
"self",
",",
"resolver",
")",
":",
"self",
".",
"_ent_handler",
"=",
"resolver"
] | https://github.com/wlanjie/AndroidFFmpeg/blob/7baf9122f4b8e1c74e7baf4be5c422c7a5ba5aaf/tools/fdk-aac-build/x86/toolchain/lib/python2.7/xml/sax/xmlreader.py#L54-L56 | ||
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 | Environment.add | (self, dist) | Add `dist` if we ``can_add()`` it and it has not already been added | Add `dist` if we ``can_add()`` it and it has not already been added | [
"Add",
"dist",
"if",
"we",
"can_add",
"()",
"it",
"and",
"it",
"has",
"not",
"already",
"been",
"added"
] | def add(self, dist):
"""Add `dist` if we ``can_add()`` it and it has not already been added
"""
if self.can_add(dist) and dist.has_version():
dists = self._distmap.setdefault(dist.key, [])
if dist not in dists:
dists.append(dist)
dists.sort... | [
"def",
"add",
"(",
"self",
",",
"dist",
")",
":",
"if",
"self",
".",
"can_add",
"(",
"dist",
")",
"and",
"dist",
".",
"has_version",
"(",
")",
":",
"dists",
"=",
"self",
".",
"_distmap",
".",
"setdefault",
"(",
"dist",
".",
"key",
",",
"[",
"]",
... | 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#L1030-L1037 | ||
Xilinx/Vitis-AI | fc74d404563d9951b57245443c73bef389f3657f | tools/Vitis-AI-Quantizer/vai_q_tensorflow1.x/tensorflow/contrib/layers/python/layers/feature_column.py | python | _real_valued_var_len_column | (column_name,
default_value=None,
dtype=dtypes.float32,
normalizer=None,
is_sparse=False) | return _RealValuedVarLenColumn(column_name, default_value, dtype, normalizer,
is_sparse) | Creates a `_RealValuedVarLenColumn` for variable-length numeric data.
Note, this is not integrated with any of the DNNEstimators, except the RNN
ones DynamicRNNEstimator and the StateSavingRNNEstimator.
It can either create a parsing config for a SparseTensor (with is_sparse=True)
or a padded Tensor.
The (d... | Creates a `_RealValuedVarLenColumn` for variable-length numeric data. | [
"Creates",
"a",
"_RealValuedVarLenColumn",
"for",
"variable",
"-",
"length",
"numeric",
"data",
"."
] | def _real_valued_var_len_column(column_name,
default_value=None,
dtype=dtypes.float32,
normalizer=None,
is_sparse=False):
"""Creates a `_RealValuedVarLenColumn` for variable-length numeric d... | [
"def",
"_real_valued_var_len_column",
"(",
"column_name",
",",
"default_value",
"=",
"None",
",",
"dtype",
"=",
"dtypes",
".",
"float32",
",",
"normalizer",
"=",
"None",
",",
"is_sparse",
"=",
"False",
")",
":",
"if",
"not",
"(",
"dtype",
".",
"is_integer",
... | https://github.com/Xilinx/Vitis-AI/blob/fc74d404563d9951b57245443c73bef389f3657f/tools/Vitis-AI-Quantizer/vai_q_tensorflow1.x/tensorflow/contrib/layers/python/layers/feature_column.py#L1765-L1825 | |
wxWidgets/wxPython-Classic | 19571e1ae65f1ac445f5491474121998c97a1bf0 | src/gtk/propgrid.py | python | PropertyGrid.OnTLPChanging | (*args, **kwargs) | return _propgrid.PropertyGrid_OnTLPChanging(*args, **kwargs) | OnTLPChanging(self, Window newTLP) | OnTLPChanging(self, Window newTLP) | [
"OnTLPChanging",
"(",
"self",
"Window",
"newTLP",
")"
] | def OnTLPChanging(*args, **kwargs):
"""OnTLPChanging(self, Window newTLP)"""
return _propgrid.PropertyGrid_OnTLPChanging(*args, **kwargs) | [
"def",
"OnTLPChanging",
"(",
"*",
"args",
",",
"*",
"*",
"kwargs",
")",
":",
"return",
"_propgrid",
".",
"PropertyGrid_OnTLPChanging",
"(",
"*",
"args",
",",
"*",
"*",
"kwargs",
")"
] | https://github.com/wxWidgets/wxPython-Classic/blob/19571e1ae65f1ac445f5491474121998c97a1bf0/src/gtk/propgrid.py#L2183-L2185 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.