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 |
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
microsoft/TSS.MSR | 0f2516fca2cd9929c31d5450e39301c9bde43688 | TSS.Py/src/TpmTypes.py | python | TPMS_CREATION_INFO.__init__ | (self, objectName = None, creationHash = None) | This is the attested data for TPM2_CertifyCreation().
Attributes:
objectName (bytes): Name of the object
creationHash (bytes): CreationHash | This is the attested data for TPM2_CertifyCreation(). | [
"This",
"is",
"the",
"attested",
"data",
"for",
"TPM2_CertifyCreation",
"()",
"."
] | def __init__(self, objectName = None, creationHash = None):
""" This is the attested data for TPM2_CertifyCreation().
Attributes:
objectName (bytes): Name of the object
creationHash (bytes): CreationHash
"""
self.objectName = objectName
self.creationHash ... | [
"def",
"__init__",
"(",
"self",
",",
"objectName",
"=",
"None",
",",
"creationHash",
"=",
"None",
")",
":",
"self",
".",
"objectName",
"=",
"objectName",
"self",
".",
"creationHash",
"=",
"creationHash"
] | https://github.com/microsoft/TSS.MSR/blob/0f2516fca2cd9929c31d5450e39301c9bde43688/TSS.Py/src/TpmTypes.py#L5280-L5288 | ||
stellar-deprecated/stellard | 67eabb2217bdfa9a6ea317f62338fb6bca458c90 | src/protobuf/python/google/protobuf/internal/decoder.py | python | GroupDecoder | (field_number, is_repeated, is_packed, key, new_default) | Returns a decoder for a group field. | Returns a decoder for a group field. | [
"Returns",
"a",
"decoder",
"for",
"a",
"group",
"field",
"."
] | def GroupDecoder(field_number, is_repeated, is_packed, key, new_default):
"""Returns a decoder for a group field."""
end_tag_bytes = encoder.TagBytes(field_number,
wire_format.WIRETYPE_END_GROUP)
end_tag_len = len(end_tag_bytes)
assert not is_packed
if is_repeated:
tag... | [
"def",
"GroupDecoder",
"(",
"field_number",
",",
"is_repeated",
",",
"is_packed",
",",
"key",
",",
"new_default",
")",
":",
"end_tag_bytes",
"=",
"encoder",
".",
"TagBytes",
"(",
"field_number",
",",
"wire_format",
".",
"WIRETYPE_END_GROUP",
")",
"end_tag_len",
... | https://github.com/stellar-deprecated/stellard/blob/67eabb2217bdfa9a6ea317f62338fb6bca458c90/src/protobuf/python/google/protobuf/internal/decoder.py#L452-L496 | ||
hughperkins/tf-coriander | 970d3df6c11400ad68405f22b0c42a52374e94ca | tensorflow/contrib/learn/python/learn/experiment.py | python | _new_attr_context | (obj, attr) | Creates a new context in which an object's attribute can be changed.
This creates a context in which an object's attribute can be changed.
Once the context is exited, the attribute reverts to its original value.
Example usage:
my_obj.x = 1
with _new_attr_context(my_obj, "x"):
my_obj.x = 2
pr... | Creates a new context in which an object's attribute can be changed. | [
"Creates",
"a",
"new",
"context",
"in",
"which",
"an",
"object",
"s",
"attribute",
"can",
"be",
"changed",
"."
] | def _new_attr_context(obj, attr):
"""Creates a new context in which an object's attribute can be changed.
This creates a context in which an object's attribute can be changed.
Once the context is exited, the attribute reverts to its original value.
Example usage:
my_obj.x = 1
with _new_attr_context(my... | [
"def",
"_new_attr_context",
"(",
"obj",
",",
"attr",
")",
":",
"saved",
"=",
"getattr",
"(",
"obj",
",",
"attr",
")",
"try",
":",
"yield",
"finally",
":",
"setattr",
"(",
"obj",
",",
"attr",
",",
"saved",
")"
] | https://github.com/hughperkins/tf-coriander/blob/970d3df6c11400ad68405f22b0c42a52374e94ca/tensorflow/contrib/learn/python/learn/experiment.py#L348-L365 | ||
natanielruiz/android-yolo | 1ebb54f96a67a20ff83ddfc823ed83a13dc3a47f | jni-build/jni/include/tensorflow/contrib/graph_editor/select.py | python | select_ops_and_ts | (*args, **kwargs) | return ops, ts | Helper to select operations and tensors.
Args:
*args: list of 1) regular expressions (compiled or not) or 2) (array of)
tf.Operation 3) (array of) tf.Tensor. Regular expressions matching tensors
must start with the comment "(?#ts)", for instance: "(?#ts)^foo/.*".
**kwargs: 'graph': tf.Graph in w... | Helper to select operations and tensors. | [
"Helper",
"to",
"select",
"operations",
"and",
"tensors",
"."
] | def select_ops_and_ts(*args, **kwargs):
"""Helper to select operations and tensors.
Args:
*args: list of 1) regular expressions (compiled or not) or 2) (array of)
tf.Operation 3) (array of) tf.Tensor. Regular expressions matching tensors
must start with the comment "(?#ts)", for instance: "(?#ts)^... | [
"def",
"select_ops_and_ts",
"(",
"*",
"args",
",",
"*",
"*",
"kwargs",
")",
":",
"ops",
"=",
"select_ops",
"(",
"*",
"args",
",",
"restrict_ops_regex",
"=",
"False",
",",
"*",
"*",
"kwargs",
")",
"ts",
"=",
"select_ts",
"(",
"*",
"args",
",",
"restri... | https://github.com/natanielruiz/android-yolo/blob/1ebb54f96a67a20ff83ddfc823ed83a13dc3a47f/jni-build/jni/include/tensorflow/contrib/graph_editor/select.py#L704-L727 | |
SpenceKonde/megaTinyCore | 1c4a70b18a149fe6bcb551dfa6db11ca50b8997b | megaavr/tools/libs/serial/tools/list_ports_windows.py | python | iterate_comports | () | Return a generator that yields descriptions for serial ports | Return a generator that yields descriptions for serial ports | [
"Return",
"a",
"generator",
"that",
"yields",
"descriptions",
"for",
"serial",
"ports"
] | def iterate_comports():
"""Return a generator that yields descriptions for serial ports"""
GUIDs = (GUID * 8)() # so far only seen one used, so hope 8 are enough...
guids_size = DWORD()
if not SetupDiClassGuidsFromName(
"Ports",
GUIDs,
ctypes.sizeof(GUIDs),
... | [
"def",
"iterate_comports",
"(",
")",
":",
"GUIDs",
"=",
"(",
"GUID",
"*",
"8",
")",
"(",
")",
"# so far only seen one used, so hope 8 are enough...",
"guids_size",
"=",
"DWORD",
"(",
")",
"if",
"not",
"SetupDiClassGuidsFromName",
"(",
"\"Ports\"",
",",
"GUIDs",
... | https://github.com/SpenceKonde/megaTinyCore/blob/1c4a70b18a149fe6bcb551dfa6db11ca50b8997b/megaavr/tools/libs/serial/tools/list_ports_windows.py#L133-L294 | ||
aws/lumberyard | f85344403c1c2e77ec8c75deb2c116e97b713217 | dev/Gems/CloudGemMetric/v1/AWS/python/windows/Lib/numba/typedobjectutils.py | python | _sentry_safe_cast_default | (default, valty) | return _sentry_safe_cast(default, valty) | Similar to _sentry_safe_cast but handle default value. | Similar to _sentry_safe_cast but handle default value. | [
"Similar",
"to",
"_sentry_safe_cast",
"but",
"handle",
"default",
"value",
"."
] | def _sentry_safe_cast_default(default, valty):
"""Similar to _sentry_safe_cast but handle default value.
"""
# Handle default values
# TODO: simplify default values; too many possible way to spell None
if default is None:
return
if isinstance(default, (types.Omitted, types.NoneType)):
... | [
"def",
"_sentry_safe_cast_default",
"(",
"default",
",",
"valty",
")",
":",
"# Handle default values",
"# TODO: simplify default values; too many possible way to spell None",
"if",
"default",
"is",
"None",
":",
"return",
"if",
"isinstance",
"(",
"default",
",",
"(",
"type... | https://github.com/aws/lumberyard/blob/f85344403c1c2e77ec8c75deb2c116e97b713217/dev/Gems/CloudGemMetric/v1/AWS/python/windows/Lib/numba/typedobjectutils.py#L77-L86 | |
krishauser/Klampt | 972cc83ea5befac3f653c1ba20f80155768ad519 | Python/python2_version/klampt/model/coordinates.py | python | Frame.relativeOrigin | (self) | return self._relativeCoordinates[1] | Returns an element of R^3 denoting the translation of the origin
of this frame relative to its parent | Returns an element of R^3 denoting the translation of the origin
of this frame relative to its parent | [
"Returns",
"an",
"element",
"of",
"R^3",
"denoting",
"the",
"translation",
"of",
"the",
"origin",
"of",
"this",
"frame",
"relative",
"to",
"its",
"parent"
] | def relativeOrigin(self):
"""Returns an element of R^3 denoting the translation of the origin
of this frame relative to its parent"""
return self._relativeCoordinates[1] | [
"def",
"relativeOrigin",
"(",
"self",
")",
":",
"return",
"self",
".",
"_relativeCoordinates",
"[",
"1",
"]"
] | https://github.com/krishauser/Klampt/blob/972cc83ea5befac3f653c1ba20f80155768ad519/Python/python2_version/klampt/model/coordinates.py#L55-L58 | |
zhaoweicai/cascade-rcnn | 2252f46158ea6555868ca6fa5c221ea71d9b5e6c | scripts/cpp_lint.py | python | CheckForNonConstReference | (filename, clean_lines, linenum,
nesting_state, error) | Check for non-const references.
Separate from CheckLanguage since it scans backwards from current
line, instead of scanning forward.
Args:
filename: The name of the current file.
clean_lines: A CleansedLines instance containing the file.
linenum: The number of the line to check.
nesting_state: A... | Check for non-const references. | [
"Check",
"for",
"non",
"-",
"const",
"references",
"."
] | def CheckForNonConstReference(filename, clean_lines, linenum,
nesting_state, error):
"""Check for non-const references.
Separate from CheckLanguage since it scans backwards from current
line, instead of scanning forward.
Args:
filename: The name of the current file.
clean... | [
"def",
"CheckForNonConstReference",
"(",
"filename",
",",
"clean_lines",
",",
"linenum",
",",
"nesting_state",
",",
"error",
")",
":",
"# Do nothing if there is no '&' on current line.",
"line",
"=",
"clean_lines",
".",
"elided",
"[",
"linenum",
"]",
"if",
"'&'",
"n... | https://github.com/zhaoweicai/cascade-rcnn/blob/2252f46158ea6555868ca6fa5c221ea71d9b5e6c/scripts/cpp_lint.py#L4138-L4248 | ||
aws/lumberyard | f85344403c1c2e77ec8c75deb2c116e97b713217 | dev/Tools/Python/3.7.10/windows/Lib/distutils/ccompiler.py | python | CCompiler.find_library_file | (self, dirs, lib, debug=0) | Search the specified list of directories for a static or shared
library file 'lib' and return the full path to that file. If
'debug' true, look for a debugging version (if that makes sense on
the current platform). Return None if 'lib' wasn't found in any of
the specified directories. | Search the specified list of directories for a static or shared
library file 'lib' and return the full path to that file. If
'debug' true, look for a debugging version (if that makes sense on
the current platform). Return None if 'lib' wasn't found in any of
the specified directories. | [
"Search",
"the",
"specified",
"list",
"of",
"directories",
"for",
"a",
"static",
"or",
"shared",
"library",
"file",
"lib",
"and",
"return",
"the",
"full",
"path",
"to",
"that",
"file",
".",
"If",
"debug",
"true",
"look",
"for",
"a",
"debugging",
"version",... | def find_library_file (self, dirs, lib, debug=0):
"""Search the specified list of directories for a static or shared
library file 'lib' and return the full path to that file. If
'debug' true, look for a debugging version (if that makes sense on
the current platform). Return None if 'li... | [
"def",
"find_library_file",
"(",
"self",
",",
"dirs",
",",
"lib",
",",
"debug",
"=",
"0",
")",
":",
"raise",
"NotImplementedError"
] | https://github.com/aws/lumberyard/blob/f85344403c1c2e77ec8c75deb2c116e97b713217/dev/Tools/Python/3.7.10/windows/Lib/distutils/ccompiler.py#L804-L811 | ||
oracle/graaljs | 36a56e8e993d45fc40939a3a4d9c0c24990720f1 | graal-nodejs/deps/npm/node_modules/node-gyp/gyp/pylib/gyp/xcode_emulation.py | python | XcodeSettings.GetLibtoolflags | (self, configname) | return libtoolflags | Returns flags that need to be passed to the static linker.
Args:
configname: The name of the configuration to get ld flags for. | Returns flags that need to be passed to the static linker. | [
"Returns",
"flags",
"that",
"need",
"to",
"be",
"passed",
"to",
"the",
"static",
"linker",
"."
] | def GetLibtoolflags(self, configname):
"""Returns flags that need to be passed to the static linker.
Args:
configname: The name of the configuration to get ld flags for.
"""
self.configname = configname
libtoolflags = []
for libtoolflag in self._Settings().get("OTHER_LD... | [
"def",
"GetLibtoolflags",
"(",
"self",
",",
"configname",
")",
":",
"self",
".",
"configname",
"=",
"configname",
"libtoolflags",
"=",
"[",
"]",
"for",
"libtoolflag",
"in",
"self",
".",
"_Settings",
"(",
")",
".",
"get",
"(",
"\"OTHER_LDFLAGS\"",
",",
"[",... | https://github.com/oracle/graaljs/blob/36a56e8e993d45fc40939a3a4d9c0c24990720f1/graal-nodejs/deps/npm/node_modules/node-gyp/gyp/pylib/gyp/xcode_emulation.py#L1001-L1015 | |
monacoinproject/monacoin | 0d94a247eeabf0c1ed43ff1e1a62d115043a056e | contrib/devtools/copyright_header.py | python | call_git_toplevel | () | return subprocess.check_output(GIT_TOPLEVEL_CMD).strip().decode("utf-8") | Returns the absolute path to the project root | Returns the absolute path to the project root | [
"Returns",
"the",
"absolute",
"path",
"to",
"the",
"project",
"root"
] | def call_git_toplevel():
"Returns the absolute path to the project root"
return subprocess.check_output(GIT_TOPLEVEL_CMD).strip().decode("utf-8") | [
"def",
"call_git_toplevel",
"(",
")",
":",
"return",
"subprocess",
".",
"check_output",
"(",
"GIT_TOPLEVEL_CMD",
")",
".",
"strip",
"(",
")",
".",
"decode",
"(",
"\"utf-8\"",
")"
] | https://github.com/monacoinproject/monacoin/blob/0d94a247eeabf0c1ed43ff1e1a62d115043a056e/contrib/devtools/copyright_header.py#L61-L63 | |
tfwu/FaceDetection-ConvNet-3D | f9251c48eb40c5aec8fba7455115c355466555be | python/mxnet/ndarray.py | python | save | (fname, data) | Save list of NDArray or dict of str->NDArray to binary file.
You can also use pickle to do the job if you only work on python.
The advantage of load/save is the file is language agnostic.
This means the file saved using save can be loaded by other language binding of mxnet.
You also get the benefit bei... | Save list of NDArray or dict of str->NDArray to binary file. | [
"Save",
"list",
"of",
"NDArray",
"or",
"dict",
"of",
"str",
"-",
">",
"NDArray",
"to",
"binary",
"file",
"."
] | def save(fname, data):
"""Save list of NDArray or dict of str->NDArray to binary file.
You can also use pickle to do the job if you only work on python.
The advantage of load/save is the file is language agnostic.
This means the file saved using save can be loaded by other language binding of mxnet.
... | [
"def",
"save",
"(",
"fname",
",",
"data",
")",
":",
"handles",
"=",
"[",
"]",
"if",
"isinstance",
"(",
"data",
",",
"dict",
")",
":",
"keys",
"=",
"[",
"]",
"for",
"key",
",",
"val",
"in",
"data",
".",
"items",
"(",
")",
":",
"if",
"not",
"is... | https://github.com/tfwu/FaceDetection-ConvNet-3D/blob/f9251c48eb40c5aec8fba7455115c355466555be/python/mxnet/ndarray.py#L845-L886 | ||
kamyu104/LeetCode-Solutions | 77605708a927ea3b85aee5a479db733938c7c211 | Python/find-the-longest-valid-obstacle-course-at-each-position.py | python | Solution2_TLE.longestObstacleCourseAtEachPosition | (self, obstacles) | return result | :type obstacles: List[int]
:rtype: List[int] | :type obstacles: List[int]
:rtype: List[int] | [
":",
"type",
"obstacles",
":",
"List",
"[",
"int",
"]",
":",
"rtype",
":",
"List",
"[",
"int",
"]"
] | def longestObstacleCourseAtEachPosition(self, obstacles):
"""
:type obstacles: List[int]
:rtype: List[int]
"""
sorted_obstacles = sorted(set(obstacles))
lookup = {x:i for i, x in enumerate(sorted_obstacles)}
segment_tree = SegmentTree(len(lookup))
result =... | [
"def",
"longestObstacleCourseAtEachPosition",
"(",
"self",
",",
"obstacles",
")",
":",
"sorted_obstacles",
"=",
"sorted",
"(",
"set",
"(",
"obstacles",
")",
")",
"lookup",
"=",
"{",
"x",
":",
"i",
"for",
"i",
",",
"x",
"in",
"enumerate",
"(",
"sorted_obsta... | https://github.com/kamyu104/LeetCode-Solutions/blob/77605708a927ea3b85aee5a479db733938c7c211/Python/find-the-longest-valid-obstacle-course-at-each-position.py#L108-L121 | |
aws/lumberyard | f85344403c1c2e77ec8c75deb2c116e97b713217 | dev/Gems/CloudGemDefectReporter/v1/AWS/common-code/Lib/requests/models.py | python | Response.iter_lines | (self, chunk_size=ITER_CHUNK_SIZE, decode_unicode=None, delimiter=None) | Iterates over the response data, one line at a time. When
stream=True is set on the request, this avoids reading the
content at once into memory for large responses.
.. note:: This method is not reentrant safe. | Iterates over the response data, one line at a time. When
stream=True is set on the request, this avoids reading the
content at once into memory for large responses. | [
"Iterates",
"over",
"the",
"response",
"data",
"one",
"line",
"at",
"a",
"time",
".",
"When",
"stream",
"=",
"True",
"is",
"set",
"on",
"the",
"request",
"this",
"avoids",
"reading",
"the",
"content",
"at",
"once",
"into",
"memory",
"for",
"large",
"resp... | def iter_lines(self, chunk_size=ITER_CHUNK_SIZE, decode_unicode=None, delimiter=None):
"""Iterates over the response data, one line at a time. When
stream=True is set on the request, this avoids reading the
content at once into memory for large responses.
.. note:: This method is not r... | [
"def",
"iter_lines",
"(",
"self",
",",
"chunk_size",
"=",
"ITER_CHUNK_SIZE",
",",
"decode_unicode",
"=",
"None",
",",
"delimiter",
"=",
"None",
")",
":",
"pending",
"=",
"None",
"for",
"chunk",
"in",
"self",
".",
"iter_content",
"(",
"chunk_size",
"=",
"ch... | https://github.com/aws/lumberyard/blob/f85344403c1c2e77ec8c75deb2c116e97b713217/dev/Gems/CloudGemDefectReporter/v1/AWS/common-code/Lib/requests/models.py#L779-L808 | ||
microsoft/checkedc-clang | a173fefde5d7877b7750e7ce96dd08cf18baebf2 | clang/bindings/python/clang/cindex.py | python | Cursor.is_default_constructor | (self) | return conf.lib.clang_CXXConstructor_isDefaultConstructor(self) | Returns True if the cursor refers to a C++ default constructor. | Returns True if the cursor refers to a C++ default constructor. | [
"Returns",
"True",
"if",
"the",
"cursor",
"refers",
"to",
"a",
"C",
"++",
"default",
"constructor",
"."
] | def is_default_constructor(self):
"""Returns True if the cursor refers to a C++ default constructor.
"""
return conf.lib.clang_CXXConstructor_isDefaultConstructor(self) | [
"def",
"is_default_constructor",
"(",
"self",
")",
":",
"return",
"conf",
".",
"lib",
".",
"clang_CXXConstructor_isDefaultConstructor",
"(",
"self",
")"
] | https://github.com/microsoft/checkedc-clang/blob/a173fefde5d7877b7750e7ce96dd08cf18baebf2/clang/bindings/python/clang/cindex.py#L1460-L1463 | |
ideawu/ssdb | f229ba277c7f7d0ca5a441c0c6fb3d1209af68e4 | deps/cpy/antlr3/streams.py | python | CommonTokenStream.skipOffTokenChannels | (self, i) | return i | Given a starting index, return the index of the first on-channel
token. | Given a starting index, return the index of the first on-channel
token. | [
"Given",
"a",
"starting",
"index",
"return",
"the",
"index",
"of",
"the",
"first",
"on",
"-",
"channel",
"token",
"."
] | def skipOffTokenChannels(self, i):
"""
Given a starting index, return the index of the first on-channel
token.
"""
try:
while self.tokens[i].channel != self.channel:
i += 1
except IndexError:
# hit the end of token stream
... | [
"def",
"skipOffTokenChannels",
"(",
"self",
",",
"i",
")",
":",
"try",
":",
"while",
"self",
".",
"tokens",
"[",
"i",
"]",
".",
"channel",
"!=",
"self",
".",
"channel",
":",
"i",
"+=",
"1",
"except",
"IndexError",
":",
"# hit the end of token stream",
"p... | https://github.com/ideawu/ssdb/blob/f229ba277c7f7d0ca5a441c0c6fb3d1209af68e4/deps/cpy/antlr3/streams.py#L721-L734 | |
rrwick/Unicycler | 96ffea71e3a78d63ade19d6124946773e65cf129 | unicycler/assembly_graph_copy_depth.py | python | get_error | (source, target) | Returns the relative error from trying to assign the source value to the target value.
E.g. if source = 1.6 and target = 2.0, the error is 0.2 | Returns the relative error from trying to assign the source value to the target value.
E.g. if source = 1.6 and target = 2.0, the error is 0.2 | [
"Returns",
"the",
"relative",
"error",
"from",
"trying",
"to",
"assign",
"the",
"source",
"value",
"to",
"the",
"target",
"value",
".",
"E",
".",
"g",
".",
"if",
"source",
"=",
"1",
".",
"6",
"and",
"target",
"=",
"2",
".",
"0",
"the",
"error",
"is... | def get_error(source, target):
"""
Returns the relative error from trying to assign the source value to the target value.
E.g. if source = 1.6 and target = 2.0, the error is 0.2
"""
if target > 0.0:
return abs(source - target) / target
else:
return float('inf') | [
"def",
"get_error",
"(",
"source",
",",
"target",
")",
":",
"if",
"target",
">",
"0.0",
":",
"return",
"abs",
"(",
"source",
"-",
"target",
")",
"/",
"target",
"else",
":",
"return",
"float",
"(",
"'inf'",
")"
] | https://github.com/rrwick/Unicycler/blob/96ffea71e3a78d63ade19d6124946773e65cf129/unicycler/assembly_graph_copy_depth.py#L422-L430 | ||
aws/lumberyard | f85344403c1c2e77ec8c75deb2c116e97b713217 | dev/Tools/Python/3.7.10/windows/Lib/site-packages/pip/_internal/index/package_finder.py | python | PackageFinder.find_requirement | (self, req, upgrade) | return best_candidate | Try to find a Link matching req
Expects req, an InstallRequirement and upgrade, a boolean
Returns a InstallationCandidate if found,
Raises DistributionNotFound or BestVersionAlreadyInstalled otherwise | Try to find a Link matching req | [
"Try",
"to",
"find",
"a",
"Link",
"matching",
"req"
] | def find_requirement(self, req, upgrade):
# type: (InstallRequirement, bool) -> Optional[InstallationCandidate]
"""Try to find a Link matching req
Expects req, an InstallRequirement and upgrade, a boolean
Returns a InstallationCandidate if found,
Raises DistributionNotFound or B... | [
"def",
"find_requirement",
"(",
"self",
",",
"req",
",",
"upgrade",
")",
":",
"# type: (InstallRequirement, bool) -> Optional[InstallationCandidate]",
"hashes",
"=",
"req",
".",
"hashes",
"(",
"trust_internet",
"=",
"False",
")",
"best_candidate_result",
"=",
"self",
... | https://github.com/aws/lumberyard/blob/f85344403c1c2e77ec8c75deb2c116e97b713217/dev/Tools/Python/3.7.10/windows/Lib/site-packages/pip/_internal/index/package_finder.py#L880-L959 | |
MichalBusta/E2E-MLT | 2f0b54e31ebb414cd2daad824d7d474062ebe834 | train.py | python | area | (a) | return width * height | Computes rectangle area | Computes rectangle area | [
"Computes",
"rectangle",
"area"
] | def area(a):
'''Computes rectangle area'''
width = a[2] - a[0]
height = a[3] - a[1]
return width * height | [
"def",
"area",
"(",
"a",
")",
":",
"width",
"=",
"a",
"[",
"2",
"]",
"-",
"a",
"[",
"0",
"]",
"height",
"=",
"a",
"[",
"3",
"]",
"-",
"a",
"[",
"1",
"]",
"return",
"width",
"*",
"height"
] | https://github.com/MichalBusta/E2E-MLT/blob/2f0b54e31ebb414cd2daad824d7d474062ebe834/train.py#L69-L73 | |
wxWidgets/wxPython-Classic | 19571e1ae65f1ac445f5491474121998c97a1bf0 | src/osx_cocoa/_core.py | python | VersionInfo.GetDescription | (*args, **kwargs) | return _core_.VersionInfo_GetDescription(*args, **kwargs) | GetDescription(self) -> String | GetDescription(self) -> String | [
"GetDescription",
"(",
"self",
")",
"-",
">",
"String"
] | def GetDescription(*args, **kwargs):
"""GetDescription(self) -> String"""
return _core_.VersionInfo_GetDescription(*args, **kwargs) | [
"def",
"GetDescription",
"(",
"*",
"args",
",",
"*",
"*",
"kwargs",
")",
":",
"return",
"_core_",
".",
"VersionInfo_GetDescription",
"(",
"*",
"args",
",",
"*",
"*",
"kwargs",
")"
] | https://github.com/wxWidgets/wxPython-Classic/blob/19571e1ae65f1ac445f5491474121998c97a1bf0/src/osx_cocoa/_core.py#L16593-L16595 | |
aws/lumberyard | f85344403c1c2e77ec8c75deb2c116e97b713217 | dev/Gems/CloudGemMetric/v1/AWS/python/windows/Lib/pandas/io/pytables.py | python | Fixed.set_object_info | (self) | set my pandas type & version | set my pandas type & version | [
"set",
"my",
"pandas",
"type",
"&",
"version"
] | def set_object_info(self):
""" set my pandas type & version """
self.attrs.pandas_type = str(self.pandas_kind)
self.attrs.pandas_version = str(_version) | [
"def",
"set_object_info",
"(",
"self",
")",
":",
"self",
".",
"attrs",
".",
"pandas_type",
"=",
"str",
"(",
"self",
".",
"pandas_kind",
")",
"self",
".",
"attrs",
".",
"pandas_version",
"=",
"str",
"(",
"_version",
")"
] | https://github.com/aws/lumberyard/blob/f85344403c1c2e77ec8c75deb2c116e97b713217/dev/Gems/CloudGemMetric/v1/AWS/python/windows/Lib/pandas/io/pytables.py#L2532-L2535 | ||
ros2/demos | fb3ad7e7fc6548c30e77a6ed86a2bd108fce5d82 | quality_of_service_demo/rclpy/quality_of_service_demo_py/common_nodes.py | python | Listener.start_listening | (self) | Instantiate Subscription.
Does nothing if it has already been called. | Instantiate Subscription. | [
"Instantiate",
"Subscription",
"."
] | def start_listening(self):
"""
Instantiate Subscription.
Does nothing if it has already been called.
"""
if not self.subscription:
self.subscription = self.create_subscription(
String, self.topic_name, self._message_callback,
self.qos_... | [
"def",
"start_listening",
"(",
"self",
")",
":",
"if",
"not",
"self",
".",
"subscription",
":",
"self",
".",
"subscription",
"=",
"self",
".",
"create_subscription",
"(",
"String",
",",
"self",
".",
"topic_name",
",",
"self",
".",
"_message_callback",
",",
... | https://github.com/ros2/demos/blob/fb3ad7e7fc6548c30e77a6ed86a2bd108fce5d82/quality_of_service_demo/rclpy/quality_of_service_demo_py/common_nodes.py#L110-L121 | ||
floooh/oryol | eb08cffe1b1cb6b05ed14ec692bca9372cef064e | fips-files/generators/util/png.py | python | Test.testExtraPixels | (self) | Test file that contains too many pixels. | Test file that contains too many pixels. | [
"Test",
"file",
"that",
"contains",
"too",
"many",
"pixels",
"."
] | def testExtraPixels(self):
"""Test file that contains too many pixels."""
def eachchunk(chunk):
if chunk[0] != 'IDAT':
return chunk
data = zlib.decompress(chunk[1])
data += strtobytes('\x00garbage')
data = zlib.compress(data)
c... | [
"def",
"testExtraPixels",
"(",
"self",
")",
":",
"def",
"eachchunk",
"(",
"chunk",
")",
":",
"if",
"chunk",
"[",
"0",
"]",
"!=",
"'IDAT'",
":",
"return",
"chunk",
"data",
"=",
"zlib",
".",
"decompress",
"(",
"chunk",
"[",
"1",
"]",
")",
"data",
"+=... | https://github.com/floooh/oryol/blob/eb08cffe1b1cb6b05ed14ec692bca9372cef064e/fips-files/generators/util/png.py#L2656-L2667 | ||
aws/lumberyard | f85344403c1c2e77ec8c75deb2c116e97b713217 | dev/Tools/Python/3.7.10/mac/Python.framework/Versions/3.7/lib/python3.7/lib2to3/pytree.py | python | convert | (gr, raw_node) | Convert raw node information to a Node or Leaf instance.
This is passed to the parser driver which calls it whenever a reduction of a
grammar rule produces a new complete node, so that the tree is build
strictly bottom-up. | Convert raw node information to a Node or Leaf instance. | [
"Convert",
"raw",
"node",
"information",
"to",
"a",
"Node",
"or",
"Leaf",
"instance",
"."
] | def convert(gr, raw_node):
"""
Convert raw node information to a Node or Leaf instance.
This is passed to the parser driver which calls it whenever a reduction of a
grammar rule produces a new complete node, so that the tree is build
strictly bottom-up.
"""
type, value, context, children = ... | [
"def",
"convert",
"(",
"gr",
",",
"raw_node",
")",
":",
"type",
",",
"value",
",",
"context",
",",
"children",
"=",
"raw_node",
"if",
"children",
"or",
"type",
"in",
"gr",
".",
"number2symbol",
":",
"# If there's exactly one child, return that child instead of",
... | https://github.com/aws/lumberyard/blob/f85344403c1c2e77ec8c75deb2c116e97b713217/dev/Tools/Python/3.7.10/mac/Python.framework/Versions/3.7/lib/python3.7/lib2to3/pytree.py#L395-L411 | ||
microsoft/CNTK | e9396480025b9ca457d26b6f33dd07c474c6aa04 | Examples/Image/Detection/utils/rpn/bbox_transform.py | python | clip_boxes | (boxes, im_info) | return boxes | Clip boxes to image boundaries.
:param boxes: boxes
:param im_info: (pad_width, pad_height, scaled_image_width, scaled_image_height, orig_img_width, orig_img_height)
e.g.(1000, 1000, 1000, 600, 500, 300) for an original image of 600x300 that is scaled and padded to 1000x1000 | Clip boxes to image boundaries.
:param boxes: boxes
:param im_info: (pad_width, pad_height, scaled_image_width, scaled_image_height, orig_img_width, orig_img_height)
e.g.(1000, 1000, 1000, 600, 500, 300) for an original image of 600x300 that is scaled and padded to 1000x1000 | [
"Clip",
"boxes",
"to",
"image",
"boundaries",
".",
":",
"param",
"boxes",
":",
"boxes",
":",
"param",
"im_info",
":",
"(",
"pad_width",
"pad_height",
"scaled_image_width",
"scaled_image_height",
"orig_img_width",
"orig_img_height",
")",
"e",
".",
"g",
".",
"(",
... | def clip_boxes(boxes, im_info):
'''
Clip boxes to image boundaries.
:param boxes: boxes
:param im_info: (pad_width, pad_height, scaled_image_width, scaled_image_height, orig_img_width, orig_img_height)
e.g.(1000, 1000, 1000, 600, 500, 300) for an original image of 600x300 that is sca... | [
"def",
"clip_boxes",
"(",
"boxes",
",",
"im_info",
")",
":",
"im_info",
".",
"shape",
"=",
"(",
"6",
")",
"padded_wh",
"=",
"im_info",
"[",
"0",
":",
"2",
"]",
"scaled_wh",
"=",
"im_info",
"[",
"2",
":",
"4",
"]",
"xy_offset",
"=",
"(",
"padded_wh"... | https://github.com/microsoft/CNTK/blob/e9396480025b9ca457d26b6f33dd07c474c6aa04/Examples/Image/Detection/utils/rpn/bbox_transform.py#L74-L97 | |
FirebirdSQL/firebird | 95e3e71622ab0b26cafa8b184ce08500f2eb613f | extern/re2/re2/make_unicode_casefold.py | python | _MakeRanges | (pairs) | return ranges | Turn a list like [(65,97), (66, 98), ..., (90,122)]
into [(65, 90, +32)]. | Turn a list like [(65,97), (66, 98), ..., (90,122)]
into [(65, 90, +32)]. | [
"Turn",
"a",
"list",
"like",
"[",
"(",
"65",
"97",
")",
"(",
"66",
"98",
")",
"...",
"(",
"90",
"122",
")",
"]",
"into",
"[",
"(",
"65",
"90",
"+",
"32",
")",
"]",
"."
] | def _MakeRanges(pairs):
"""Turn a list like [(65,97), (66, 98), ..., (90,122)]
into [(65, 90, +32)]."""
ranges = []
last = -100
def evenodd(last, a, b, r):
if a != last+1 or b != _AddDelta(a, r[2]):
return False
r[1] = a
return True
def evenoddpair(last, a, b, r):
if a != last+2:
... | [
"def",
"_MakeRanges",
"(",
"pairs",
")",
":",
"ranges",
"=",
"[",
"]",
"last",
"=",
"-",
"100",
"def",
"evenodd",
"(",
"last",
",",
"a",
",",
"b",
",",
"r",
")",
":",
"if",
"a",
"!=",
"last",
"+",
"1",
"or",
"b",
"!=",
"_AddDelta",
"(",
"a",
... | https://github.com/FirebirdSQL/firebird/blob/95e3e71622ab0b26cafa8b184ce08500f2eb613f/extern/re2/re2/make_unicode_casefold.py#L67-L104 | |
catboost/catboost | 167f64f237114a4d10b2b4ee42adb4569137debe | contrib/tools/python3/src/Lib/ipaddress.py | python | IPv6Address.scope_id | (self) | return self._scope_id | Identifier of a particular zone of the address's scope.
See RFC 4007 for details.
Returns:
A string identifying the zone of the address if specified, else None. | Identifier of a particular zone of the address's scope. | [
"Identifier",
"of",
"a",
"particular",
"zone",
"of",
"the",
"address",
"s",
"scope",
"."
] | def scope_id(self):
"""Identifier of a particular zone of the address's scope.
See RFC 4007 for details.
Returns:
A string identifying the zone of the address if specified, else None.
"""
return self._scope_id | [
"def",
"scope_id",
"(",
"self",
")",
":",
"return",
"self",
".",
"_scope_id"
] | https://github.com/catboost/catboost/blob/167f64f237114a4d10b2b4ee42adb4569137debe/contrib/tools/python3/src/Lib/ipaddress.py#L1936-L1945 | |
generalized-intelligence/GAAS | 29ab17d3e8a4ba18edef3a57c36d8db6329fac73 | deprecated/algorithms/sfm/OpenSfM/opensfm/dataset.py | python | DataSet.load_exif_overrides | (self) | Load EXIF overrides data. | Load EXIF overrides data. | [
"Load",
"EXIF",
"overrides",
"data",
"."
] | def load_exif_overrides(self):
"""Load EXIF overrides data."""
with io.open_rt(self._exif_overrides_file()) as fin:
return json.load(fin) | [
"def",
"load_exif_overrides",
"(",
"self",
")",
":",
"with",
"io",
".",
"open_rt",
"(",
"self",
".",
"_exif_overrides_file",
"(",
")",
")",
"as",
"fin",
":",
"return",
"json",
".",
"load",
"(",
"fin",
")"
] | https://github.com/generalized-intelligence/GAAS/blob/29ab17d3e8a4ba18edef3a57c36d8db6329fac73/deprecated/algorithms/sfm/OpenSfM/opensfm/dataset.py#L678-L681 | ||
aws/lumberyard | f85344403c1c2e77ec8c75deb2c116e97b713217 | dev/Tools/Python/3.7.10/mac/Python.framework/Versions/3.7/lib/python3.7/asyncio/unix_events.py | python | _sighandler_noop | (signum, frame) | Dummy signal handler. | Dummy signal handler. | [
"Dummy",
"signal",
"handler",
"."
] | def _sighandler_noop(signum, frame):
"""Dummy signal handler."""
pass | [
"def",
"_sighandler_noop",
"(",
"signum",
",",
"frame",
")",
":",
"pass"
] | https://github.com/aws/lumberyard/blob/f85344403c1c2e77ec8c75deb2c116e97b713217/dev/Tools/Python/3.7.10/mac/Python.framework/Versions/3.7/lib/python3.7/asyncio/unix_events.py#L39-L41 | ||
catboost/catboost | 167f64f237114a4d10b2b4ee42adb4569137debe | contrib/python/pandas/py2/pandas/util/_decorators.py | python | Substitution.update | (self, *args, **kwargs) | Update self.params with supplied args.
If called, we assume self.params is a dict. | Update self.params with supplied args. | [
"Update",
"self",
".",
"params",
"with",
"supplied",
"args",
"."
] | def update(self, *args, **kwargs):
"""
Update self.params with supplied args.
If called, we assume self.params is a dict.
"""
self.params.update(*args, **kwargs) | [
"def",
"update",
"(",
"self",
",",
"*",
"args",
",",
"*",
"*",
"kwargs",
")",
":",
"self",
".",
"params",
".",
"update",
"(",
"*",
"args",
",",
"*",
"*",
"kwargs",
")"
] | https://github.com/catboost/catboost/blob/167f64f237114a4d10b2b4ee42adb4569137debe/contrib/python/pandas/py2/pandas/util/_decorators.py#L261-L268 | ||
wxWidgets/wxPython-Classic | 19571e1ae65f1ac445f5491474121998c97a1bf0 | src/osx_cocoa/_core.py | python | version | () | return "%s %s (classic)" % (wx.VERSION_STRING, port) | Returns a string containing version and port info | Returns a string containing version and port info | [
"Returns",
"a",
"string",
"containing",
"version",
"and",
"port",
"info"
] | def version():
"""Returns a string containing version and port info"""
if wx.Platform == '__WXMSW__':
port = 'msw'
elif wx.Platform == '__WXMAC__':
if 'wxOSX-carbon' in wx.PlatformInfo:
port = 'osx-carbon'
else:
port = 'osx-cocoa'
elif wx.Platform == '__WX... | [
"def",
"version",
"(",
")",
":",
"if",
"wx",
".",
"Platform",
"==",
"'__WXMSW__'",
":",
"port",
"=",
"'msw'",
"elif",
"wx",
".",
"Platform",
"==",
"'__WXMAC__'",
":",
"if",
"'wxOSX-carbon'",
"in",
"wx",
".",
"PlatformInfo",
":",
"port",
"=",
"'osx-carbon... | https://github.com/wxWidgets/wxPython-Classic/blob/19571e1ae65f1ac445f5491474121998c97a1bf0/src/osx_cocoa/_core.py#L16640-L16658 | |
aws/lumberyard | f85344403c1c2e77ec8c75deb2c116e97b713217 | dev/Tools/AWSPythonSDK/1.5.8/docutils/utils/math/math2html.py | python | ContainerSize.extractnumber | (self, text) | return result | Extract the first number in the given text. | Extract the first number in the given text. | [
"Extract",
"the",
"first",
"number",
"in",
"the",
"given",
"text",
"."
] | def extractnumber(self, text):
"Extract the first number in the given text."
result = ''
decimal = False
for char in text:
if char.isdigit():
result += char
elif char == '.' and not decimal:
result += char
decimal = True
else:
return result
return re... | [
"def",
"extractnumber",
"(",
"self",
",",
"text",
")",
":",
"result",
"=",
"''",
"decimal",
"=",
"False",
"for",
"char",
"in",
"text",
":",
"if",
"char",
".",
"isdigit",
"(",
")",
":",
"result",
"+=",
"char",
"elif",
"char",
"==",
"'.'",
"and",
"no... | https://github.com/aws/lumberyard/blob/f85344403c1c2e77ec8c75deb2c116e97b713217/dev/Tools/AWSPythonSDK/1.5.8/docutils/utils/math/math2html.py#L3471-L3483 | |
vgough/encfs | c444f9b9176beea1ad41a7b2e29ca26e709b57f7 | vendor/github.com/muflihun/easyloggingpp/tools/cpplint.py | python | _IncludeState.CheckNextIncludeOrder | (self, header_type) | return '' | Returns a non-empty error message if the next header is out of order.
This function also updates the internal state to be ready to check
the next include.
Args:
header_type: One of the _XXX_HEADER constants defined above.
Returns:
The empty string if the header is in the right order, or a... | Returns a non-empty error message if the next header is out of order. | [
"Returns",
"a",
"non",
"-",
"empty",
"error",
"message",
"if",
"the",
"next",
"header",
"is",
"out",
"of",
"order",
"."
] | def CheckNextIncludeOrder(self, header_type):
"""Returns a non-empty error message if the next header is out of order.
This function also updates the internal state to be ready to check
the next include.
Args:
header_type: One of the _XXX_HEADER constants defined above.
Returns:
The e... | [
"def",
"CheckNextIncludeOrder",
"(",
"self",
",",
"header_type",
")",
":",
"error_message",
"=",
"(",
"'Found %s after %s'",
"%",
"(",
"self",
".",
"_TYPE_NAMES",
"[",
"header_type",
"]",
",",
"self",
".",
"_SECTION_NAMES",
"[",
"self",
".",
"_section",
"]",
... | https://github.com/vgough/encfs/blob/c444f9b9176beea1ad41a7b2e29ca26e709b57f7/vendor/github.com/muflihun/easyloggingpp/tools/cpplint.py#L610-L661 | |
gem5/gem5 | 141cc37c2d4b93959d4c249b8f7e6a8b2ef75338 | src/mem/slicc/parser.py | python | SLICC.p_typestr__multi | (self, p) | typestr : typestr DOUBLE_COLON ident | typestr : typestr DOUBLE_COLON ident | [
"typestr",
":",
"typestr",
"DOUBLE_COLON",
"ident"
] | def p_typestr__multi(self, p):
"typestr : typestr DOUBLE_COLON ident"
p[0] = '%s::%s' % (p[1], p[3]) | [
"def",
"p_typestr__multi",
"(",
"self",
",",
"p",
")",
":",
"p",
"[",
"0",
"]",
"=",
"'%s::%s'",
"%",
"(",
"p",
"[",
"1",
"]",
",",
"p",
"[",
"3",
"]",
")"
] | https://github.com/gem5/gem5/blob/141cc37c2d4b93959d4c249b8f7e6a8b2ef75338/src/mem/slicc/parser.py#L491-L493 | ||
emscripten-core/emscripten | 0d413d3c5af8b28349682496edc14656f5700c2f | third_party/ply/example/yply/yparse.py | python | p_rule | (p) | rule : ID ':' rulelist ';' | rule : ID ':' rulelist ';' | [
"rule",
":",
"ID",
":",
"rulelist",
";"
] | def p_rule(p):
'''rule : ID ':' rulelist ';' '''
p[0] = (p[1],[p[3]]) | [
"def",
"p_rule",
"(",
"p",
")",
":",
"p",
"[",
"0",
"]",
"=",
"(",
"p",
"[",
"1",
"]",
",",
"[",
"p",
"[",
"3",
"]",
"]",
")"
] | https://github.com/emscripten-core/emscripten/blob/0d413d3c5af8b28349682496edc14656f5700c2f/third_party/ply/example/yply/yparse.py#L153-L155 | ||
mindspore-ai/mindspore | fb8fd3338605bb34fa5cea054e535a8b1d753fab | mindspore/python/mindspore/_checkparam.py | python | Rel.get_strs | (rel) | return rel_strs.get(rel, "") | Get value from rel_strs. | Get value from rel_strs. | [
"Get",
"value",
"from",
"rel_strs",
"."
] | def get_strs(rel):
"""Get value from rel_strs."""
return rel_strs.get(rel, "") | [
"def",
"get_strs",
"(",
"rel",
")",
":",
"return",
"rel_strs",
".",
"get",
"(",
"rel",
",",
"\"\"",
")"
] | https://github.com/mindspore-ai/mindspore/blob/fb8fd3338605bb34fa5cea054e535a8b1d753fab/mindspore/python/mindspore/_checkparam.py#L52-L54 | |
ApolloAuto/apollo-platform | 86d9dc6743b496ead18d597748ebabd34a513289 | ros/ros_comm/rospy/src/rospy/impl/tcpros_pubsub.py | python | _configure_pub_socket | (sock, is_tcp_nodelay) | Configure socket options on a new publisher socket.
@param sock: socket.socket
@type sock: socket.socket
@param is_tcp_nodelay: if True, TCP_NODELAY will be set on outgoing socket if available
@param is_tcp_nodelay: bool | Configure socket options on a new publisher socket. | [
"Configure",
"socket",
"options",
"on",
"a",
"new",
"publisher",
"socket",
"."
] | def _configure_pub_socket(sock, is_tcp_nodelay):
"""
Configure socket options on a new publisher socket.
@param sock: socket.socket
@type sock: socket.socket
@param is_tcp_nodelay: if True, TCP_NODELAY will be set on outgoing socket if available
@param is_tcp_nodelay: bool
"""
# #956: lo... | [
"def",
"_configure_pub_socket",
"(",
"sock",
",",
"is_tcp_nodelay",
")",
":",
"# #956: low latency, TCP_NODELAY support",
"if",
"is_tcp_nodelay",
":",
"if",
"hasattr",
"(",
"socket",
",",
"'TCP_NODELAY'",
")",
":",
"sock",
".",
"setsockopt",
"(",
"socket",
".",
"I... | https://github.com/ApolloAuto/apollo-platform/blob/86d9dc6743b496ead18d597748ebabd34a513289/ros/ros_comm/rospy/src/rospy/impl/tcpros_pubsub.py#L103-L116 | ||
benoitsteiner/tensorflow-opencl | cb7cb40a57fde5cfd4731bc551e82a1e2fef43a5 | tensorflow/python/ops/resource_variable_ops.py | python | ResourceVariable._OverloadOperator | (operator) | Defer an operator overload to `ops.Tensor`.
We pull the operator out of ops.Tensor dynamically to avoid ordering issues.
Args:
operator: string. The operator name. | Defer an operator overload to `ops.Tensor`. | [
"Defer",
"an",
"operator",
"overload",
"to",
"ops",
".",
"Tensor",
"."
] | def _OverloadOperator(operator): # pylint: disable=invalid-name
"""Defer an operator overload to `ops.Tensor`.
We pull the operator out of ops.Tensor dynamically to avoid ordering issues.
Args:
operator: string. The operator name.
"""
def _run_op(a, *args):
# pylint: disable=protecte... | [
"def",
"_OverloadOperator",
"(",
"operator",
")",
":",
"# pylint: disable=invalid-name",
"def",
"_run_op",
"(",
"a",
",",
"*",
"args",
")",
":",
"# pylint: disable=protected-access",
"value",
"=",
"a",
".",
"_AsTensor",
"(",
")",
"return",
"getattr",
"(",
"ops",... | https://github.com/benoitsteiner/tensorflow-opencl/blob/cb7cb40a57fde5cfd4731bc551e82a1e2fef43a5/tensorflow/python/ops/resource_variable_ops.py#L684-L704 | ||
MegEngine/MegEngine | ce9ad07a27ec909fb8db4dd67943d24ba98fb93a | lite/pylite/megenginelite/tensor.py | python | LiteTensor.update | (self) | update the member from C, this will auto used after slice, share | update the member from C, this will auto used after slice, share | [
"update",
"the",
"member",
"from",
"C",
"this",
"will",
"auto",
"used",
"after",
"slice",
"share"
] | def update(self):
"""
update the member from C, this will auto used after slice, share
"""
pinned = c_int()
self._api.LITE_is_pinned_host(self._tensor, byref(pinned))
self._is_pinned_host = pinned
device_type = c_int()
self._api.LITE_get_tensor_device_type... | [
"def",
"update",
"(",
"self",
")",
":",
"pinned",
"=",
"c_int",
"(",
")",
"self",
".",
"_api",
".",
"LITE_is_pinned_host",
"(",
"self",
".",
"_tensor",
",",
"byref",
"(",
"pinned",
")",
")",
"self",
".",
"_is_pinned_host",
"=",
"pinned",
"device_type",
... | https://github.com/MegEngine/MegEngine/blob/ce9ad07a27ec909fb8db4dd67943d24ba98fb93a/lite/pylite/megenginelite/tensor.py#L309-L319 | ||
apple/turicreate | cce55aa5311300e3ce6af93cb45ba791fd1bdf49 | src/python/turicreate/data_structures/sarray.py | python | SArray.contains | (self, item) | return SArray(_proxy=self.__proxy__.left_scalar_operator(item, "in")) | Performs an element-wise search of "item" in the SArray.
Conceptually equivalent to:
>>> sa.apply(lambda x: item in x)
If the current SArray contains strings and item is a string. Produces a 1
for each row if 'item' is a substring of the row and 0 otherwise.
If the current SA... | Performs an element-wise search of "item" in the SArray. | [
"Performs",
"an",
"element",
"-",
"wise",
"search",
"of",
"item",
"in",
"the",
"SArray",
"."
] | def contains(self, item):
"""
Performs an element-wise search of "item" in the SArray.
Conceptually equivalent to:
>>> sa.apply(lambda x: item in x)
If the current SArray contains strings and item is a string. Produces a 1
for each row if 'item' is a substring of the r... | [
"def",
"contains",
"(",
"self",
",",
"item",
")",
":",
"return",
"SArray",
"(",
"_proxy",
"=",
"self",
".",
"__proxy__",
".",
"left_scalar_operator",
"(",
"item",
",",
"\"in\"",
")",
")"
] | https://github.com/apple/turicreate/blob/cce55aa5311300e3ce6af93cb45ba791fd1bdf49/src/python/turicreate/data_structures/sarray.py#L952-L999 | |
Xilinx/Vitis-AI | fc74d404563d9951b57245443c73bef389f3657f | tools/Vitis-AI-Quantizer/vai_q_tensorflow1.x/tensorflow/contrib/distributions/python/ops/distribution_util.py | python | make_diag_scale | (
loc=None,
scale_diag=None,
scale_identity_multiplier=None,
shape_hint=None,
validate_args=False,
assert_positive=False,
name=None) | Creates a LinOp representing a diagonal matrix.
Args:
loc: Floating-point `Tensor`. This is used for inferring shape in the case
where only `scale_identity_multiplier` is set.
scale_diag: Floating-point `Tensor` representing the diagonal matrix.
`scale_diag` has shape [N1, N2, ... k], which repr... | Creates a LinOp representing a diagonal matrix. | [
"Creates",
"a",
"LinOp",
"representing",
"a",
"diagonal",
"matrix",
"."
] | def make_diag_scale(
loc=None,
scale_diag=None,
scale_identity_multiplier=None,
shape_hint=None,
validate_args=False,
assert_positive=False,
name=None):
"""Creates a LinOp representing a diagonal matrix.
Args:
loc: Floating-point `Tensor`. This is used for inferring shape in the cas... | [
"def",
"make_diag_scale",
"(",
"loc",
"=",
"None",
",",
"scale_diag",
"=",
"None",
",",
"scale_identity_multiplier",
"=",
"None",
",",
"shape_hint",
"=",
"None",
",",
"validate_args",
"=",
"False",
",",
"assert_positive",
"=",
"False",
",",
"name",
"=",
"Non... | https://github.com/Xilinx/Vitis-AI/blob/fc74d404563d9951b57245443c73bef389f3657f/tools/Vitis-AI-Quantizer/vai_q_tensorflow1.x/tensorflow/contrib/distributions/python/ops/distribution_util.py#L186-L277 | ||
catboost/catboost | 167f64f237114a4d10b2b4ee42adb4569137debe | contrib/python/setuptools/py2/setuptools/wheel.py | python | Wheel._move_data_entries | (destination_eggdir, dist_data) | Move data entries to their correct location. | Move data entries to their correct location. | [
"Move",
"data",
"entries",
"to",
"their",
"correct",
"location",
"."
] | def _move_data_entries(destination_eggdir, dist_data):
"""Move data entries to their correct location."""
dist_data = os.path.join(destination_eggdir, dist_data)
dist_data_scripts = os.path.join(dist_data, 'scripts')
if os.path.exists(dist_data_scripts):
egg_info_scripts = os... | [
"def",
"_move_data_entries",
"(",
"destination_eggdir",
",",
"dist_data",
")",
":",
"dist_data",
"=",
"os",
".",
"path",
".",
"join",
"(",
"destination_eggdir",
",",
"dist_data",
")",
"dist_data_scripts",
"=",
"os",
".",
"path",
".",
"join",
"(",
"dist_data",
... | https://github.com/catboost/catboost/blob/167f64f237114a4d10b2b4ee42adb4569137debe/contrib/python/setuptools/py2/setuptools/wheel.py#L179-L204 | ||
catboost/catboost | 167f64f237114a4d10b2b4ee42adb4569137debe | contrib/python/prompt-toolkit/py3/prompt_toolkit/buffer.py | python | Buffer.go_to_completion | (self, index: Optional[int]) | Select a completion from the list of current completions. | Select a completion from the list of current completions. | [
"Select",
"a",
"completion",
"from",
"the",
"list",
"of",
"current",
"completions",
"."
] | def go_to_completion(self, index: Optional[int]) -> None:
"""
Select a completion from the list of current completions.
"""
assert self.complete_state
# Set new completion
state = self.complete_state
state.go_to_index(index)
# Set text/cursor position
... | [
"def",
"go_to_completion",
"(",
"self",
",",
"index",
":",
"Optional",
"[",
"int",
"]",
")",
"->",
"None",
":",
"assert",
"self",
".",
"complete_state",
"# Set new completion",
"state",
"=",
"self",
".",
"complete_state",
"state",
".",
"go_to_index",
"(",
"i... | https://github.com/catboost/catboost/blob/167f64f237114a4d10b2b4ee42adb4569137debe/contrib/python/prompt-toolkit/py3/prompt_toolkit/buffer.py#L983-L998 | ||
mongodb/mongo | d8ff665343ad29cf286ee2cf4a1960d29371937b | src/third_party/scons-3.1.2/scons-local-3.1.2/SCons/Tool/masm.py | python | generate | (env) | Add Builders and construction variables for masm to an Environment. | Add Builders and construction variables for masm to an Environment. | [
"Add",
"Builders",
"and",
"construction",
"variables",
"for",
"masm",
"to",
"an",
"Environment",
"."
] | def generate(env):
"""Add Builders and construction variables for masm to an Environment."""
static_obj, shared_obj = SCons.Tool.createObjBuilders(env)
for suffix in ASSuffixes:
static_obj.add_action(suffix, SCons.Defaults.ASAction)
shared_obj.add_action(suffix, SCons.Defaults.ASAction)
... | [
"def",
"generate",
"(",
"env",
")",
":",
"static_obj",
",",
"shared_obj",
"=",
"SCons",
".",
"Tool",
".",
"createObjBuilders",
"(",
"env",
")",
"for",
"suffix",
"in",
"ASSuffixes",
":",
"static_obj",
".",
"add_action",
"(",
"suffix",
",",
"SCons",
".",
"... | https://github.com/mongodb/mongo/blob/d8ff665343ad29cf286ee2cf4a1960d29371937b/src/third_party/scons-3.1.2/scons-local-3.1.2/SCons/Tool/masm.py#L47-L68 | ||
tensorflow/tensorflow | 419e3a6b650ea4bd1b0cba23c4348f8a69f3272e | tensorflow/python/ops/distributions/util.py | python | prefer_static_broadcast_shape | (shape1,
shape2,
name="prefer_static_broadcast_shape") | Convenience function which statically broadcasts shape when possible.
Args:
shape1: `1-D` integer `Tensor`. Already converted to tensor!
shape2: `1-D` integer `Tensor`. Already converted to tensor!
name: A string name to prepend to created ops.
Returns:
The broadcast shape, either as `TensorS... | Convenience function which statically broadcasts shape when possible. | [
"Convenience",
"function",
"which",
"statically",
"broadcasts",
"shape",
"when",
"possible",
"."
] | def prefer_static_broadcast_shape(shape1,
shape2,
name="prefer_static_broadcast_shape"):
"""Convenience function which statically broadcasts shape when possible.
Args:
shape1: `1-D` integer `Tensor`. Already converted to tensor!
shape2: ... | [
"def",
"prefer_static_broadcast_shape",
"(",
"shape1",
",",
"shape2",
",",
"name",
"=",
"\"prefer_static_broadcast_shape\"",
")",
":",
"with",
"ops",
".",
"name_scope",
"(",
"name",
",",
"values",
"=",
"[",
"shape1",
",",
"shape2",
"]",
")",
":",
"def",
"mak... | https://github.com/tensorflow/tensorflow/blob/419e3a6b650ea4bd1b0cba23c4348f8a69f3272e/tensorflow/python/ops/distributions/util.py#L703-L745 | ||
wlanjie/AndroidFFmpeg | 7baf9122f4b8e1c74e7baf4be5c422c7a5ba5aaf | tools/fdk-aac-build/x86/toolchain/lib/python2.7/sets.py | python | BaseSet.symmetric_difference | (self, other) | return result | Return the symmetric difference of two sets as a new set.
(I.e. all elements that are in exactly one of the sets.) | Return the symmetric difference of two sets as a new set. | [
"Return",
"the",
"symmetric",
"difference",
"of",
"two",
"sets",
"as",
"a",
"new",
"set",
"."
] | def symmetric_difference(self, other):
"""Return the symmetric difference of two sets as a new set.
(I.e. all elements that are in exactly one of the sets.)
"""
result = self.__class__()
data = result._data
value = True
selfdata = self._data
try:
... | [
"def",
"symmetric_difference",
"(",
"self",
",",
"other",
")",
":",
"result",
"=",
"self",
".",
"__class__",
"(",
")",
"data",
"=",
"result",
".",
"_data",
"value",
"=",
"True",
"selfdata",
"=",
"self",
".",
"_data",
"try",
":",
"otherdata",
"=",
"othe... | https://github.com/wlanjie/AndroidFFmpeg/blob/7baf9122f4b8e1c74e7baf4be5c422c7a5ba5aaf/tools/fdk-aac-build/x86/toolchain/lib/python2.7/sets.py#L228-L245 | |
ros-planning/moveit | ee48dc5cedc981d0869352aa3db0b41469c2735c | moveit_commander/src/moveit_commander/robot.py | python | RobotCommander.get_link | (self, name) | @param name str: Name of movegroup
@rtype: moveit_commander.robot.Link
@raise exception: MoveItCommanderException | [] | def get_link(self, name):
"""
@param name str: Name of movegroup
@rtype: moveit_commander.robot.Link
@raise exception: MoveItCommanderException
"""
if name in self.get_link_names():
return self.Link(self, name)
else:
raise MoveItCommanderEx... | [
"def",
"get_link",
"(",
"self",
",",
"name",
")",
":",
"if",
"name",
"in",
"self",
".",
"get_link_names",
"(",
")",
":",
"return",
"self",
".",
"Link",
"(",
"self",
",",
"name",
")",
"else",
":",
"raise",
"MoveItCommanderException",
"(",
"\"There is no l... | https://github.com/ros-planning/moveit/blob/ee48dc5cedc981d0869352aa3db0b41469c2735c/moveit_commander/src/moveit_commander/robot.py#L267-L276 | |||
catboost/catboost | 167f64f237114a4d10b2b4ee42adb4569137debe | contrib/python/pandas/py2/pandas/core/generic.py | python | NDFrame._dir_additions | (self) | return super(NDFrame, self)._dir_additions().union(additions) | add the string-like attributes from the info_axis.
If info_axis is a MultiIndex, it's first level values are used. | add the string-like attributes from the info_axis.
If info_axis is a MultiIndex, it's first level values are used. | [
"add",
"the",
"string",
"-",
"like",
"attributes",
"from",
"the",
"info_axis",
".",
"If",
"info_axis",
"is",
"a",
"MultiIndex",
"it",
"s",
"first",
"level",
"values",
"are",
"used",
"."
] | def _dir_additions(self):
""" add the string-like attributes from the info_axis.
If info_axis is a MultiIndex, it's first level values are used.
"""
additions = {c for c in self._info_axis.unique(level=0)[:100]
if isinstance(c, string_types) and isidentifier(c)}
... | [
"def",
"_dir_additions",
"(",
"self",
")",
":",
"additions",
"=",
"{",
"c",
"for",
"c",
"in",
"self",
".",
"_info_axis",
".",
"unique",
"(",
"level",
"=",
"0",
")",
"[",
":",
"100",
"]",
"if",
"isinstance",
"(",
"c",
",",
"string_types",
")",
"and"... | https://github.com/catboost/catboost/blob/167f64f237114a4d10b2b4ee42adb4569137debe/contrib/python/pandas/py2/pandas/core/generic.py#L5108-L5114 | |
RamadhanAmizudin/malware | 2c6c53c8b0d556f5d8078d6ca0fc4448f4697cf1 | Fuzzbunch/fuzzbunch/pyreadline/console/console.py | python | Console.rectangle | (self, rect, attr=None, fill=' ') | Fill Rectangle. | Fill Rectangle. | [
"Fill",
"Rectangle",
"."
] | def rectangle(self, rect, attr=None, fill=' '):
'''Fill Rectangle.'''
log_sock("rect:%s"%[rect])
x0, y0, x1, y1 = rect
n = c_int(0)
if attr is None:
attr = self.attr
for y in range(y0, y1):
pos = self.fixcoord(x0, y)
self.FillConsoleOut... | [
"def",
"rectangle",
"(",
"self",
",",
"rect",
",",
"attr",
"=",
"None",
",",
"fill",
"=",
"' '",
")",
":",
"log_sock",
"(",
"\"rect:%s\"",
"%",
"[",
"rect",
"]",
")",
"x0",
",",
"y0",
",",
"x1",
",",
"y1",
"=",
"rect",
"n",
"=",
"c_int",
"(",
... | https://github.com/RamadhanAmizudin/malware/blob/2c6c53c8b0d556f5d8078d6ca0fc4448f4697cf1/Fuzzbunch/fuzzbunch/pyreadline/console/console.py#L436-L446 | ||
SFTtech/openage | d6a08c53c48dc1e157807471df92197f6ca9e04d | openage/convert/entity_object/export/formats/nyan_file.py | python | NyanFile.set_modpack_name | (self, modpack_name) | Set the name of the modpack, the file is contained in. | Set the name of the modpack, the file is contained in. | [
"Set",
"the",
"name",
"of",
"the",
"modpack",
"the",
"file",
"is",
"contained",
"in",
"."
] | def set_modpack_name(self, modpack_name):
"""
Set the name of the modpack, the file is contained in.
"""
self.modpack_name = modpack_name | [
"def",
"set_modpack_name",
"(",
"self",
",",
"modpack_name",
")",
":",
"self",
".",
"modpack_name",
"=",
"modpack_name"
] | https://github.com/SFTtech/openage/blob/d6a08c53c48dc1e157807471df92197f6ca9e04d/openage/convert/entity_object/export/formats/nyan_file.py#L102-L106 | ||
aws/lumberyard | f85344403c1c2e77ec8c75deb2c116e97b713217 | dev/Gems/CloudGemDefectReporter/v1/AWS/common-code/Lib/PIL/ImageShow.py | python | Viewer.show_image | (self, image, **options) | return self.show_file(self.save_image(image), **options) | Display given image | Display given image | [
"Display",
"given",
"image"
] | def show_image(self, image, **options):
"""Display given image"""
return self.show_file(self.save_image(image), **options) | [
"def",
"show_image",
"(",
"self",
",",
"image",
",",
"*",
"*",
"options",
")",
":",
"return",
"self",
".",
"show_file",
"(",
"self",
".",
"save_image",
"(",
"image",
")",
",",
"*",
"*",
"options",
")"
] | https://github.com/aws/lumberyard/blob/f85344403c1c2e77ec8c75deb2c116e97b713217/dev/Gems/CloudGemDefectReporter/v1/AWS/common-code/Lib/PIL/ImageShow.py#L86-L88 | |
goldeneye-source/ges-code | 2630cd8ef3d015af53c72ec2e19fc1f7e7fe8d9d | thirdparty/protobuf-2.3.0/python/google/protobuf/reflection.py | python | _AddSetListenerMethod | (cls) | Helper for _AddMessageMethods(). | Helper for _AddMessageMethods(). | [
"Helper",
"for",
"_AddMessageMethods",
"()",
"."
] | def _AddSetListenerMethod(cls):
"""Helper for _AddMessageMethods()."""
def SetListener(self, listener):
if listener is None:
self._listener = message_listener_mod.NullMessageListener()
else:
self._listener = listener
cls._SetListener = SetListener | [
"def",
"_AddSetListenerMethod",
"(",
"cls",
")",
":",
"def",
"SetListener",
"(",
"self",
",",
"listener",
")",
":",
"if",
"listener",
"is",
"None",
":",
"self",
".",
"_listener",
"=",
"message_listener_mod",
".",
"NullMessageListener",
"(",
")",
"else",
":",... | https://github.com/goldeneye-source/ges-code/blob/2630cd8ef3d015af53c72ec2e19fc1f7e7fe8d9d/thirdparty/protobuf-2.3.0/python/google/protobuf/reflection.py#L738-L745 | ||
ideawu/ssdb-rocks | a3cbb322cafb2f493252829c608e2239df98c9ac | deps/cpy/antlr3/recognizers.py | python | BaseRecognizer.mismatch | (self, input, ttype, follow) | Factor out what to do upon token mismatch so tree parsers can behave
differently. Override and call mismatchRecover(input, ttype, follow)
to get single token insertion and deletion. Use this to turn of
single token insertion and deletion. Override mismatchRecover
to call this instead. | Factor out what to do upon token mismatch so tree parsers can behave
differently. Override and call mismatchRecover(input, ttype, follow)
to get single token insertion and deletion. Use this to turn of
single token insertion and deletion. Override mismatchRecover
to call this instead. | [
"Factor",
"out",
"what",
"to",
"do",
"upon",
"token",
"mismatch",
"so",
"tree",
"parsers",
"can",
"behave",
"differently",
".",
"Override",
"and",
"call",
"mismatchRecover",
"(",
"input",
"ttype",
"follow",
")",
"to",
"get",
"single",
"token",
"insertion",
"... | def mismatch(self, input, ttype, follow):
"""
Factor out what to do upon token mismatch so tree parsers can behave
differently. Override and call mismatchRecover(input, ttype, follow)
to get single token insertion and deletion. Use this to turn of
single token insertion and dele... | [
"def",
"mismatch",
"(",
"self",
",",
"input",
",",
"ttype",
",",
"follow",
")",
":",
"if",
"self",
".",
"mismatchIsUnwantedToken",
"(",
"input",
",",
"ttype",
")",
":",
"raise",
"UnwantedTokenException",
"(",
"ttype",
",",
"input",
")",
"elif",
"self",
"... | https://github.com/ideawu/ssdb-rocks/blob/a3cbb322cafb2f493252829c608e2239df98c9ac/deps/cpy/antlr3/recognizers.py#L276-L291 | ||
PlatformLab/RAMCloud | b1866af19124325a6dfd8cbc267e2e3ef1f965d1 | scripts/common.py | python | captureSh | (command, **kwargs) | Execute a local command and capture its output. | Execute a local command and capture its output. | [
"Execute",
"a",
"local",
"command",
"and",
"capture",
"its",
"output",
"."
] | def captureSh(command, **kwargs):
"""Execute a local command and capture its output."""
kwargs['shell'] = True
kwargs['stdout'] = subprocess.PIPE
p = subprocess.Popen(command, **kwargs)
output = p.communicate()[0]
if p.returncode:
raise subprocess.CalledProcessError(p.returncode, comman... | [
"def",
"captureSh",
"(",
"command",
",",
"*",
"*",
"kwargs",
")",
":",
"kwargs",
"[",
"'shell'",
"]",
"=",
"True",
"kwargs",
"[",
"'stdout'",
"]",
"=",
"subprocess",
".",
"PIPE",
"p",
"=",
"subprocess",
".",
"Popen",
"(",
"command",
",",
"*",
"*",
... | https://github.com/PlatformLab/RAMCloud/blob/b1866af19124325a6dfd8cbc267e2e3ef1f965d1/scripts/common.py#L40-L52 | ||
SIPp/sipp | f44d0cf5dec0013eff8fd7b4da885d455aa82e0e | cpplint.py | python | CheckCStyleCast | (filename, linenum, line, raw_line, cast_type, pattern,
error) | return True | Checks for a C-style cast by looking for the pattern.
This also handles sizeof(type) warnings, due to similarity of content.
Args:
filename: The name of the current file.
linenum: The number of the line to check.
line: The line of code to check.
raw_line: The raw line of code to check, with commen... | Checks for a C-style cast by looking for the pattern. | [
"Checks",
"for",
"a",
"C",
"-",
"style",
"cast",
"by",
"looking",
"for",
"the",
"pattern",
"."
] | def CheckCStyleCast(filename, linenum, line, raw_line, cast_type, pattern,
error):
"""Checks for a C-style cast by looking for the pattern.
This also handles sizeof(type) warnings, due to similarity of content.
Args:
filename: The name of the current file.
linenum: The number of the ... | [
"def",
"CheckCStyleCast",
"(",
"filename",
",",
"linenum",
",",
"line",
",",
"raw_line",
",",
"cast_type",
",",
"pattern",
",",
"error",
")",
":",
"match",
"=",
"Search",
"(",
"pattern",
",",
"line",
")",
"if",
"not",
"match",
":",
"return",
"False",
"... | https://github.com/SIPp/sipp/blob/f44d0cf5dec0013eff8fd7b4da885d455aa82e0e/cpplint.py#L3447-L3512 | |
TheImagingSource/tiscamera | baacb4cfaa7858c2e6cfb4f1a297b404c4e002f6 | examples/python/02-set-properties.py | python | print_properties | (camera) | Print selected properties | Print selected properties | [
"Print",
"selected",
"properties"
] | def print_properties(camera):
"""
Print selected properties
"""
(ret, value,
min_value, max_value,
default_value, step_size,
value_type, flags,
category, group) = camera.get_tcam_property("Exposure Auto")
if ret:
print("Exposure Auto has value: {}".format(value))
els... | [
"def",
"print_properties",
"(",
"camera",
")",
":",
"(",
"ret",
",",
"value",
",",
"min_value",
",",
"max_value",
",",
"default_value",
",",
"step_size",
",",
"value_type",
",",
"flags",
",",
"category",
",",
"group",
")",
"=",
"camera",
".",
"get_tcam_pro... | https://github.com/TheImagingSource/tiscamera/blob/baacb4cfaa7858c2e6cfb4f1a297b404c4e002f6/examples/python/02-set-properties.py#L30-L65 | ||
hanpfei/chromium-net | 392cc1fa3a8f92f42e4071ab6e674d8e0482f83f | tools/grit/grit/format/policy_templates/writers/template_writer.py | python | TemplateWriter.SortPoliciesGroupsFirst | (self, policy_list) | return policy_list | Sorts a list of policies alphabetically. The order is the
following: first groups alphabetically by caption, then other policies
alphabetically by name. The order of policies inside groups is unchanged.
Args:
policy_list: The list of policies to sort. Sub-lists in groups will not
be sorted. | Sorts a list of policies alphabetically. The order is the
following: first groups alphabetically by caption, then other policies
alphabetically by name. The order of policies inside groups is unchanged. | [
"Sorts",
"a",
"list",
"of",
"policies",
"alphabetically",
".",
"The",
"order",
"is",
"the",
"following",
":",
"first",
"groups",
"alphabetically",
"by",
"caption",
"then",
"other",
"policies",
"alphabetically",
"by",
"name",
".",
"The",
"order",
"of",
"policie... | def SortPoliciesGroupsFirst(self, policy_list):
'''Sorts a list of policies alphabetically. The order is the
following: first groups alphabetically by caption, then other policies
alphabetically by name. The order of policies inside groups is unchanged.
Args:
policy_list: The list of policies to ... | [
"def",
"SortPoliciesGroupsFirst",
"(",
"self",
",",
"policy_list",
")",
":",
"policy_list",
".",
"sort",
"(",
"key",
"=",
"self",
".",
"GetPolicySortingKeyGroupsFirst",
")",
"return",
"policy_list"
] | https://github.com/hanpfei/chromium-net/blob/392cc1fa3a8f92f42e4071ab6e674d8e0482f83f/tools/grit/grit/format/policy_templates/writers/template_writer.py#L276-L286 | |
ApolloAuto/apollo-platform | 86d9dc6743b496ead18d597748ebabd34a513289 | ros/third_party/lib_x86_64/python2.7/dist-packages/numpy/distutils/misc_util.py | python | Configuration.append_to | (self, extlib) | Append libraries, include_dirs to extension or library item. | Append libraries, include_dirs to extension or library item. | [
"Append",
"libraries",
"include_dirs",
"to",
"extension",
"or",
"library",
"item",
"."
] | def append_to(self, extlib):
"""Append libraries, include_dirs to extension or library item.
"""
if is_sequence(extlib):
lib_name, build_info = extlib
dict_append(build_info,
libraries=self.libraries,
include_dirs=self.inclu... | [
"def",
"append_to",
"(",
"self",
",",
"extlib",
")",
":",
"if",
"is_sequence",
"(",
"extlib",
")",
":",
"lib_name",
",",
"build_info",
"=",
"extlib",
"dict_append",
"(",
"build_info",
",",
"libraries",
"=",
"self",
".",
"libraries",
",",
"include_dirs",
"=... | https://github.com/ApolloAuto/apollo-platform/blob/86d9dc6743b496ead18d597748ebabd34a513289/ros/third_party/lib_x86_64/python2.7/dist-packages/numpy/distutils/misc_util.py#L1753-L1765 | ||
aws/lumberyard | f85344403c1c2e77ec8c75deb2c116e97b713217 | dev/Tools/Python/3.7.10/linux_x64/lib/python3.7/asyncio/sslproto.py | python | _SSLProtocolTransport.pause_reading | (self) | Pause the receiving end.
No data will be passed to the protocol's data_received()
method until resume_reading() is called. | Pause the receiving end. | [
"Pause",
"the",
"receiving",
"end",
"."
] | def pause_reading(self):
"""Pause the receiving end.
No data will be passed to the protocol's data_received()
method until resume_reading() is called.
"""
self._ssl_protocol._transport.pause_reading() | [
"def",
"pause_reading",
"(",
"self",
")",
":",
"self",
".",
"_ssl_protocol",
".",
"_transport",
".",
"pause_reading",
"(",
")"
] | https://github.com/aws/lumberyard/blob/f85344403c1c2e77ec8c75deb2c116e97b713217/dev/Tools/Python/3.7.10/linux_x64/lib/python3.7/asyncio/sslproto.py#L331-L337 | ||
wxWidgets/wxPython-Classic | 19571e1ae65f1ac445f5491474121998c97a1bf0 | src/osx_carbon/_misc.py | python | DateTime.GetMillisecond | (*args, **kwargs) | return _misc_.DateTime_GetMillisecond(*args, **kwargs) | GetMillisecond(self, wxDateTime::TimeZone tz=LOCAL_TZ) -> int | GetMillisecond(self, wxDateTime::TimeZone tz=LOCAL_TZ) -> int | [
"GetMillisecond",
"(",
"self",
"wxDateTime",
"::",
"TimeZone",
"tz",
"=",
"LOCAL_TZ",
")",
"-",
">",
"int"
] | def GetMillisecond(*args, **kwargs):
"""GetMillisecond(self, wxDateTime::TimeZone tz=LOCAL_TZ) -> int"""
return _misc_.DateTime_GetMillisecond(*args, **kwargs) | [
"def",
"GetMillisecond",
"(",
"*",
"args",
",",
"*",
"*",
"kwargs",
")",
":",
"return",
"_misc_",
".",
"DateTime_GetMillisecond",
"(",
"*",
"args",
",",
"*",
"*",
"kwargs",
")"
] | https://github.com/wxWidgets/wxPython-Classic/blob/19571e1ae65f1ac445f5491474121998c97a1bf0/src/osx_carbon/_misc.py#L4005-L4007 | |
ricardoquesada/Spidermonkey | 4a75ea2543408bd1b2c515aa95901523eeef7858 | python/psutil/psutil/_psosx.py | python | Process.get_process_ppid | (self) | return _psutil_osx.get_process_ppid(self.pid) | Return process parent pid. | Return process parent pid. | [
"Return",
"process",
"parent",
"pid",
"."
] | def get_process_ppid(self):
"""Return process parent pid."""
return _psutil_osx.get_process_ppid(self.pid) | [
"def",
"get_process_ppid",
"(",
"self",
")",
":",
"return",
"_psutil_osx",
".",
"get_process_ppid",
"(",
"self",
".",
"pid",
")"
] | https://github.com/ricardoquesada/Spidermonkey/blob/4a75ea2543408bd1b2c515aa95901523eeef7858/python/psutil/psutil/_psosx.py#L192-L194 | |
bigartm/bigartm | 47e37f982de87aa67bfd475ff1f39da696b181b3 | 3rdparty/protobuf-3.0.0/python/google/protobuf/descriptor.py | python | MakeDescriptor | (desc_proto, package='', build_file_if_cpp=True,
syntax=None) | return Descriptor(desc_proto.name, desc_name, None, None, fields,
list(nested_types.values()), list(enum_types.values()), [],
options=desc_proto.options) | Make a protobuf Descriptor given a DescriptorProto protobuf.
Handles nested descriptors. Note that this is limited to the scope of defining
a message inside of another message. Composite fields can currently only be
resolved if the message is defined in the same scope as the field.
Args:
desc_proto: The d... | Make a protobuf Descriptor given a DescriptorProto protobuf. | [
"Make",
"a",
"protobuf",
"Descriptor",
"given",
"a",
"DescriptorProto",
"protobuf",
"."
] | def MakeDescriptor(desc_proto, package='', build_file_if_cpp=True,
syntax=None):
"""Make a protobuf Descriptor given a DescriptorProto protobuf.
Handles nested descriptors. Note that this is limited to the scope of defining
a message inside of another message. Composite fields can currently on... | [
"def",
"MakeDescriptor",
"(",
"desc_proto",
",",
"package",
"=",
"''",
",",
"build_file_if_cpp",
"=",
"True",
",",
"syntax",
"=",
"None",
")",
":",
"if",
"api_implementation",
".",
"Type",
"(",
")",
"==",
"'cpp'",
"and",
"build_file_if_cpp",
":",
"# The C++ ... | https://github.com/bigartm/bigartm/blob/47e37f982de87aa67bfd475ff1f39da696b181b3/3rdparty/protobuf-3.0.0/python/google/protobuf/descriptor.py#L897-L993 | |
Tencent/CMONGO | c40380caa14e05509f46993aa8b8da966b09b0b5 | src/third_party/scons-2.5.0/scons-local-2.5.0/SCons/Tool/packaging/rpm.py | python | build_specfile | (target, source, env) | Builds a RPM specfile from a dictionary with string metadata and
by analyzing a tree of nodes. | Builds a RPM specfile from a dictionary with string metadata and
by analyzing a tree of nodes. | [
"Builds",
"a",
"RPM",
"specfile",
"from",
"a",
"dictionary",
"with",
"string",
"metadata",
"and",
"by",
"analyzing",
"a",
"tree",
"of",
"nodes",
"."
] | def build_specfile(target, source, env):
""" Builds a RPM specfile from a dictionary with string metadata and
by analyzing a tree of nodes.
"""
file = open(target[0].get_abspath(), 'w')
try:
file.write( build_specfile_header(env) )
file.write( build_specfile_sections(env) )
... | [
"def",
"build_specfile",
"(",
"target",
",",
"source",
",",
"env",
")",
":",
"file",
"=",
"open",
"(",
"target",
"[",
"0",
"]",
".",
"get_abspath",
"(",
")",
",",
"'w'",
")",
"try",
":",
"file",
".",
"write",
"(",
"build_specfile_header",
"(",
"env",... | https://github.com/Tencent/CMONGO/blob/c40380caa14e05509f46993aa8b8da966b09b0b5/src/third_party/scons-2.5.0/scons-local-2.5.0/SCons/Tool/packaging/rpm.py#L123-L140 | ||
gnuradio/gnuradio | 09c3c4fa4bfb1a02caac74cb5334dfe065391e3b | gr-blocks/python/blocks/qa_block_behavior.py | python | test_block_behavior.test_000 | (self) | Tests the max noutput sizes set by the scheduler. When creating
the block, there is no block_detail and so the max buffer size
is 0. When the top_block is run, it builds the detail and
buffers and sets the max value. test_0001 tests when the
max_noutput_items is set by hand. | Tests the max noutput sizes set by the scheduler. When creating
the block, there is no block_detail and so the max buffer size
is 0. When the top_block is run, it builds the detail and
buffers and sets the max value. test_0001 tests when the
max_noutput_items is set by hand. | [
"Tests",
"the",
"max",
"noutput",
"sizes",
"set",
"by",
"the",
"scheduler",
".",
"When",
"creating",
"the",
"block",
"there",
"is",
"no",
"block_detail",
"and",
"so",
"the",
"max",
"buffer",
"size",
"is",
"0",
".",
"When",
"the",
"top_block",
"is",
"run"... | def test_000(self):
'''
Tests the max noutput sizes set by the scheduler. When creating
the block, there is no block_detail and so the max buffer size
is 0. When the top_block is run, it builds the detail and
buffers and sets the max value. test_0001 tests when the
max_no... | [
"def",
"test_000",
"(",
"self",
")",
":",
"src",
"=",
"blocks",
".",
"null_source",
"(",
"gr",
".",
"sizeof_float",
")",
"op",
"=",
"blocks",
".",
"head",
"(",
"gr",
".",
"sizeof_float",
",",
"100",
")",
"snk",
"=",
"blocks",
".",
"null_sink",
"(",
... | https://github.com/gnuradio/gnuradio/blob/09c3c4fa4bfb1a02caac74cb5334dfe065391e3b/gr-blocks/python/blocks/qa_block_behavior.py#L23-L45 | ||
idaholab/moose | 9eeebc65e098b4c30f8205fb41591fd5b61eb6ff | modules/geochemistry/python/dbutils.py | python | printSpeciesInfo | (db, species) | return | Find the given species and return all information related to it | Find the given species and return all information related to it | [
"Find",
"the",
"given",
"species",
"and",
"return",
"all",
"information",
"related",
"to",
"it"
] | def printSpeciesInfo(db, species):
"""
Find the given species and return all information related to it
"""
while True:
# Check basis species
if db['basis species']:
if species in db['basis species']:
type, result = 'basis species', db['basis species'][species]... | [
"def",
"printSpeciesInfo",
"(",
"db",
",",
"species",
")",
":",
"while",
"True",
":",
"# Check basis species",
"if",
"db",
"[",
"'basis species'",
"]",
":",
"if",
"species",
"in",
"db",
"[",
"'basis species'",
"]",
":",
"type",
",",
"result",
"=",
"'basis ... | https://github.com/idaholab/moose/blob/9eeebc65e098b4c30f8205fb41591fd5b61eb6ff/modules/geochemistry/python/dbutils.py#L20-L66 | |
aws/lumberyard | f85344403c1c2e77ec8c75deb2c116e97b713217 | dev/Tools/Python/3.7.10/windows/Lib/site-packages/pip/_vendor/resolvelib/providers.py | python | AbstractResolver.resolve | (self, requirements, **kwargs) | Take a collection of constraints, spit out the resolution result.
This returns a representation of the final resolution state, with one
guarenteed attribute ``mapping`` that contains resolved candidates as
values. The keys are their respective identifiers.
:param requirements: A collec... | Take a collection of constraints, spit out the resolution result. | [
"Take",
"a",
"collection",
"of",
"constraints",
"spit",
"out",
"the",
"resolution",
"result",
"."
] | def resolve(self, requirements, **kwargs):
"""Take a collection of constraints, spit out the resolution result.
This returns a representation of the final resolution state, with one
guarenteed attribute ``mapping`` that contains resolved candidates as
values. The keys are their respecti... | [
"def",
"resolve",
"(",
"self",
",",
"requirements",
",",
"*",
"*",
"kwargs",
")",
":",
"raise",
"NotImplementedError"
] | https://github.com/aws/lumberyard/blob/f85344403c1c2e77ec8c75deb2c116e97b713217/dev/Tools/Python/3.7.10/windows/Lib/site-packages/pip/_vendor/resolvelib/providers.py#L107-L119 | ||
nvdla/sw | 79538ba1b52b040a4a4645f630e457fa01839e90 | umd/external/protobuf-2.6/python/google/protobuf/service_reflection.py | python | GeneratedServiceStubType.__init__ | (cls, name, bases, dictionary) | Creates a message service stub class.
Args:
name: Name of the class (ignored, here).
bases: Base classes of the class being constructed.
dictionary: The class dictionary of the class being constructed.
dictionary[_DESCRIPTOR_KEY] must contain a ServiceDescriptor object
describing ... | Creates a message service stub class. | [
"Creates",
"a",
"message",
"service",
"stub",
"class",
"."
] | def __init__(cls, name, bases, dictionary):
"""Creates a message service stub class.
Args:
name: Name of the class (ignored, here).
bases: Base classes of the class being constructed.
dictionary: The class dictionary of the class being constructed.
dictionary[_DESCRIPTOR_KEY] must con... | [
"def",
"__init__",
"(",
"cls",
",",
"name",
",",
"bases",
",",
"dictionary",
")",
":",
"super",
"(",
"GeneratedServiceStubType",
",",
"cls",
")",
".",
"__init__",
"(",
"name",
",",
"bases",
",",
"dictionary",
")",
"# Don't do anything if this class doesn't have ... | https://github.com/nvdla/sw/blob/79538ba1b52b040a4a4645f630e457fa01839e90/umd/external/protobuf-2.6/python/google/protobuf/service_reflection.py#L94-L111 | ||
abforce/xposed_art_n | ec3fbe417d74d4664cec053d91dd4e3881176374 | tools/checker/file_format/checker/parser.py | python | __extractLine | (prefix, line, arch = None, debuggable = False) | Attempts to parse a check line. The regex searches for a comment symbol
followed by the CHECK keyword, given attribute and a colon at the very
beginning of the line. Whitespaces are ignored. | Attempts to parse a check line. The regex searches for a comment symbol
followed by the CHECK keyword, given attribute and a colon at the very
beginning of the line. Whitespaces are ignored. | [
"Attempts",
"to",
"parse",
"a",
"check",
"line",
".",
"The",
"regex",
"searches",
"for",
"a",
"comment",
"symbol",
"followed",
"by",
"the",
"CHECK",
"keyword",
"given",
"attribute",
"and",
"a",
"colon",
"at",
"the",
"very",
"beginning",
"of",
"the",
"line"... | def __extractLine(prefix, line, arch = None, debuggable = False):
""" Attempts to parse a check line. The regex searches for a comment symbol
followed by the CHECK keyword, given attribute and a colon at the very
beginning of the line. Whitespaces are ignored.
"""
rIgnoreWhitespace = r"\s*"
rComment... | [
"def",
"__extractLine",
"(",
"prefix",
",",
"line",
",",
"arch",
"=",
"None",
",",
"debuggable",
"=",
"False",
")",
":",
"rIgnoreWhitespace",
"=",
"r\"\\s*\"",
"rCommentSymbols",
"=",
"[",
"r\"///\"",
",",
"r\"##\"",
"]",
"arch_specifier",
"=",
"r\"-%s\"",
"... | https://github.com/abforce/xposed_art_n/blob/ec3fbe417d74d4664cec053d91dd4e3881176374/tools/checker/file_format/checker/parser.py#L25-L45 | ||
wxWidgets/wxPython-Classic | 19571e1ae65f1ac445f5491474121998c97a1bf0 | src/gtk/_core.py | python | Window.HasFocus | (*args, **kwargs) | return _core_.Window_HasFocus(*args, **kwargs) | HasFocus(self) -> bool
Returns ``True`` if the window has the keyboard focus. | HasFocus(self) -> bool | [
"HasFocus",
"(",
"self",
")",
"-",
">",
"bool"
] | def HasFocus(*args, **kwargs):
"""
HasFocus(self) -> bool
Returns ``True`` if the window has the keyboard focus.
"""
return _core_.Window_HasFocus(*args, **kwargs) | [
"def",
"HasFocus",
"(",
"*",
"args",
",",
"*",
"*",
"kwargs",
")",
":",
"return",
"_core_",
".",
"Window_HasFocus",
"(",
"*",
"args",
",",
"*",
"*",
"kwargs",
")"
] | https://github.com/wxWidgets/wxPython-Classic/blob/19571e1ae65f1ac445f5491474121998c97a1bf0/src/gtk/_core.py#L10150-L10156 | |
sdhash/sdhash | b9eff63e4e5867e910f41fd69032bbb1c94a2a5e | sdhash-server/gen-py/sdhashsrv/sdhashsrv.py | python | Iface.removeResult | (self, resultID) | Parameters:
- resultID | Parameters:
- resultID | [
"Parameters",
":",
"-",
"resultID"
] | def removeResult(self, resultID):
"""
Parameters:
- resultID
"""
pass | [
"def",
"removeResult",
"(",
"self",
",",
"resultID",
")",
":",
"pass"
] | https://github.com/sdhash/sdhash/blob/b9eff63e4e5867e910f41fd69032bbb1c94a2a5e/sdhash-server/gen-py/sdhashsrv/sdhashsrv.py#L151-L156 | ||
VAR-solutions/Algorithms | 4ad6773e9675ef35aa858ca3969be5ddf6e3daea | LinkedList/LinkedListModule.py | python | LinkedList.addNodeAtEnd | (self,value) | return True | Adds a node containing given value to the end of the list | Adds a node containing given value to the end of the list | [
"Adds",
"a",
"node",
"containing",
"given",
"value",
"to",
"the",
"end",
"of",
"the",
"list"
] | def addNodeAtEnd(self,value):
"""Adds a node containing given value to the end of the list"""
if self.head is None:
self.head = Node(value)
else:
# iterate to the end of the list and add the node
CurrentNode = self.head
while CurrentNo... | [
"def",
"addNodeAtEnd",
"(",
"self",
",",
"value",
")",
":",
"if",
"self",
".",
"head",
"is",
"None",
":",
"self",
".",
"head",
"=",
"Node",
"(",
"value",
")",
"else",
":",
"# iterate to the end of the list and add the node",
"CurrentNode",
"=",
"self",
".",
... | https://github.com/VAR-solutions/Algorithms/blob/4ad6773e9675ef35aa858ca3969be5ddf6e3daea/LinkedList/LinkedListModule.py#L15-L28 | |
apple/swift-lldb | d74be846ef3e62de946df343e8c234bde93a8912 | scripts/Python/static-binding/lldb.py | python | SBProcess.ReadPointerFromMemory | (self, addr, error) | return _lldb.SBProcess_ReadPointerFromMemory(self, addr, error) | Reads a pointer from memory from an address and returns the value. Example:
# Read a pointer from address 0x1000
error = lldb.SBError()
ptr = ReadPointerFromMemory(0x1000, error)
if error.Success():
print('pointer: 0x%x' % ptr)
else
print('error: ', error... | [] | def ReadPointerFromMemory(self, addr, error):
"""
Reads a pointer from memory from an address and returns the value. Example:
# Read a pointer from address 0x1000
error = lldb.SBError()
ptr = ReadPointerFromMemory(0x1000, error)
if error.Success():
print('po... | [
"def",
"ReadPointerFromMemory",
"(",
"self",
",",
"addr",
",",
"error",
")",
":",
"return",
"_lldb",
".",
"SBProcess_ReadPointerFromMemory",
"(",
"self",
",",
"addr",
",",
"error",
")"
] | https://github.com/apple/swift-lldb/blob/d74be846ef3e62de946df343e8c234bde93a8912/scripts/Python/static-binding/lldb.py#L8631-L8644 | ||
idaholab/moose | 9eeebc65e098b4c30f8205fb41591fd5b61eb6ff | python/peacock/ExodusViewer/plugins/BackgroundPlugin.py | python | BackgroundPlugin.onSetEnableWidget | (self, value) | Enable/disable the menu items. | Enable/disable the menu items. | [
"Enable",
"/",
"disable",
"the",
"menu",
"items",
"."
] | def onSetEnableWidget(self, value):
"""
Enable/disable the menu items.
"""
super(BackgroundPlugin, self).onSetEnableWidget(value)
self.GradientToggle.setEnabled(value)
self.BlackPreset.setEnabled(value)
self.WhitePreset.setEnabled(value)
self.ColorbarBlack... | [
"def",
"onSetEnableWidget",
"(",
"self",
",",
"value",
")",
":",
"super",
"(",
"BackgroundPlugin",
",",
"self",
")",
".",
"onSetEnableWidget",
"(",
"value",
")",
"self",
".",
"GradientToggle",
".",
"setEnabled",
"(",
"value",
")",
"self",
".",
"BlackPreset",... | https://github.com/idaholab/moose/blob/9eeebc65e098b4c30f8205fb41591fd5b61eb6ff/python/peacock/ExodusViewer/plugins/BackgroundPlugin.py#L161-L172 | ||
catboost/catboost | 167f64f237114a4d10b2b4ee42adb4569137debe | contrib/python/ipython/py2/IPython/core/completerlib.py | python | magic_run_completer | (self, event) | return [compress_user(p, tilde_expand, tilde_val) for p in matches] | Complete files that end in .py or .ipy or .ipynb for the %run command. | Complete files that end in .py or .ipy or .ipynb for the %run command. | [
"Complete",
"files",
"that",
"end",
"in",
".",
"py",
"or",
".",
"ipy",
"or",
".",
"ipynb",
"for",
"the",
"%run",
"command",
"."
] | def magic_run_completer(self, event):
"""Complete files that end in .py or .ipy or .ipynb for the %run command.
"""
comps = arg_split(event.line, strict=False)
# relpath should be the current token that we need to complete.
if (len(comps) > 1) and (not event.line.endswith(' ')):
relpath = co... | [
"def",
"magic_run_completer",
"(",
"self",
",",
"event",
")",
":",
"comps",
"=",
"arg_split",
"(",
"event",
".",
"line",
",",
"strict",
"=",
"False",
")",
"# relpath should be the current token that we need to complete.",
"if",
"(",
"len",
"(",
"comps",
")",
">"... | https://github.com/catboost/catboost/blob/167f64f237114a4d10b2b4ee42adb4569137debe/contrib/python/ipython/py2/IPython/core/completerlib.py#L313-L347 | |
BitMEX/api-connectors | 37a3a5b806ad5d0e0fc975ab86d9ed43c3bcd812 | auto-generated/python/swagger_client/models/trade.py | python | Trade.gross_value | (self, gross_value) | Sets the gross_value of this Trade.
:param gross_value: The gross_value of this Trade. # noqa: E501
:type: float | Sets the gross_value of this Trade. | [
"Sets",
"the",
"gross_value",
"of",
"this",
"Trade",
"."
] | def gross_value(self, gross_value):
"""Sets the gross_value of this Trade.
:param gross_value: The gross_value of this Trade. # noqa: E501
:type: float
"""
self._gross_value = gross_value | [
"def",
"gross_value",
"(",
"self",
",",
"gross_value",
")",
":",
"self",
".",
"_gross_value",
"=",
"gross_value"
] | https://github.com/BitMEX/api-connectors/blob/37a3a5b806ad5d0e0fc975ab86d9ed43c3bcd812/auto-generated/python/swagger_client/models/trade.py#L255-L263 | ||
catboost/catboost | 167f64f237114a4d10b2b4ee42adb4569137debe | contrib/python/ipython/py3/IPython/core/prefilter.py | python | AutocallChecker.check | (self, line_info) | Check if the initial word/function is callable and autocall is on. | Check if the initial word/function is callable and autocall is on. | [
"Check",
"if",
"the",
"initial",
"word",
"/",
"function",
"is",
"callable",
"and",
"autocall",
"is",
"on",
"."
] | def check(self, line_info):
"Check if the initial word/function is callable and autocall is on."
if not self.shell.autocall:
return None
oinfo = line_info.ofind(self.shell) # This can mutate state via getattr
if not oinfo['found']:
return None
ignored_fu... | [
"def",
"check",
"(",
"self",
",",
"line_info",
")",
":",
"if",
"not",
"self",
".",
"shell",
".",
"autocall",
":",
"return",
"None",
"oinfo",
"=",
"line_info",
".",
"ofind",
"(",
"self",
".",
"shell",
")",
"# This can mutate state via getattr",
"if",
"not",... | https://github.com/catboost/catboost/blob/167f64f237114a4d10b2b4ee42adb4569137debe/contrib/python/ipython/py3/IPython/core/prefilter.py#L504-L524 | ||
catboost/catboost | 167f64f237114a4d10b2b4ee42adb4569137debe | contrib/tools/python3/src/Lib/importlib/_bootstrap.py | python | _sanity_check | (name, package, level) | Verify arguments are "sane". | Verify arguments are "sane". | [
"Verify",
"arguments",
"are",
"sane",
"."
] | def _sanity_check(name, package, level):
"""Verify arguments are "sane"."""
if not isinstance(name, str):
raise TypeError('module name must be str, not {}'.format(type(name)))
if level < 0:
raise ValueError('level must be >= 0')
if level > 0:
if not isinstance(package, str):
... | [
"def",
"_sanity_check",
"(",
"name",
",",
"package",
",",
"level",
")",
":",
"if",
"not",
"isinstance",
"(",
"name",
",",
"str",
")",
":",
"raise",
"TypeError",
"(",
"'module name must be str, not {}'",
".",
"format",
"(",
"type",
"(",
"name",
")",
")",
... | https://github.com/catboost/catboost/blob/167f64f237114a4d10b2b4ee42adb4569137debe/contrib/tools/python3/src/Lib/importlib/_bootstrap.py#L948-L961 | ||
apiaryio/snowcrash | b5b39faa85f88ee17459edf39fdc6fe4fc70d2e3 | tools/gyp/pylib/gyp/generator/msvs.py | python | _ConvertToolsToExpectedForm | (tools) | return tool_list | Convert tools to a form expected by Visual Studio.
Arguments:
tools: A dictionary of settings; the tool name is the key.
Returns:
A list of Tool objects. | Convert tools to a form expected by Visual Studio. | [
"Convert",
"tools",
"to",
"a",
"form",
"expected",
"by",
"Visual",
"Studio",
"."
] | def _ConvertToolsToExpectedForm(tools):
"""Convert tools to a form expected by Visual Studio.
Arguments:
tools: A dictionary of settings; the tool name is the key.
Returns:
A list of Tool objects.
"""
tool_list = []
for tool, settings in tools.iteritems():
# Collapse settings with lists.
se... | [
"def",
"_ConvertToolsToExpectedForm",
"(",
"tools",
")",
":",
"tool_list",
"=",
"[",
"]",
"for",
"tool",
",",
"settings",
"in",
"tools",
".",
"iteritems",
"(",
")",
":",
"# Collapse settings with lists.",
"settings_fixed",
"=",
"{",
"}",
"for",
"setting",
",",... | https://github.com/apiaryio/snowcrash/blob/b5b39faa85f88ee17459edf39fdc6fe4fc70d2e3/tools/gyp/pylib/gyp/generator/msvs.py#L1346-L1370 | |
trailofbits/llvm-sanitizer-tutorial | d29dfeec7f51fbf234fd0080f28f2b30cd0b6e99 | llvm/tools/clang/tools/scan-build-py/libscanbuild/report.py | python | parse_bug_html | (filename) | Parse out the bug information from HTML output. | Parse out the bug information from HTML output. | [
"Parse",
"out",
"the",
"bug",
"information",
"from",
"HTML",
"output",
"."
] | def parse_bug_html(filename):
""" Parse out the bug information from HTML output. """
patterns = [re.compile(r'<!-- BUGTYPE (?P<bug_type>.*) -->$'),
re.compile(r'<!-- BUGFILE (?P<bug_file>.*) -->$'),
re.compile(r'<!-- BUGPATHLENGTH (?P<bug_path_length>.*) -->$'),
... | [
"def",
"parse_bug_html",
"(",
"filename",
")",
":",
"patterns",
"=",
"[",
"re",
".",
"compile",
"(",
"r'<!-- BUGTYPE (?P<bug_type>.*) -->$'",
")",
",",
"re",
".",
"compile",
"(",
"r'<!-- BUGFILE (?P<bug_file>.*) -->$'",
")",
",",
"re",
".",
"compile",
"(",
"r'<!... | https://github.com/trailofbits/llvm-sanitizer-tutorial/blob/d29dfeec7f51fbf234fd0080f28f2b30cd0b6e99/llvm/tools/clang/tools/scan-build-py/libscanbuild/report.py#L302-L337 | ||
google/llvm-propeller | 45c226984fe8377ebfb2ad7713c680d652ba678d | compiler-rt/lib/sanitizer_common/scripts/cpplint.py | python | FileInfo.RepositoryName | (self) | return fullname | FullName after removing the local path to the repository.
If we have a real absolute path name here we can try to do something smart:
detecting the root of the checkout and truncating /path/to/checkout from
the name so that we get header guards that don't include things like
"C:\Documents and Settings\... | FullName after removing the local path to the repository. | [
"FullName",
"after",
"removing",
"the",
"local",
"path",
"to",
"the",
"repository",
"."
] | def RepositoryName(self):
"""FullName after removing the local path to the repository.
If we have a real absolute path name here we can try to do something smart:
detecting the root of the checkout and truncating /path/to/checkout from
the name so that we get header guards that don't include things lik... | [
"def",
"RepositoryName",
"(",
"self",
")",
":",
"fullname",
"=",
"self",
".",
"FullName",
"(",
")",
"if",
"os",
".",
"path",
".",
"exists",
"(",
"fullname",
")",
":",
"project_dir",
"=",
"os",
".",
"path",
".",
"dirname",
"(",
"fullname",
")",
"if",
... | https://github.com/google/llvm-propeller/blob/45c226984fe8377ebfb2ad7713c680d652ba678d/compiler-rt/lib/sanitizer_common/scripts/cpplint.py#L1111-L1155 | |
panda3d/panda3d | 833ad89ebad58395d0af0b7ec08538e5e4308265 | direct/src/showbase/Transitions.py | python | Transitions.getFadeOutIval | (self, t=0.5, finishIval=None, blendType='noBlend') | return transitionIval | Create a sequence that lerps the color out, then
parents the fade to hidden | Create a sequence that lerps the color out, then
parents the fade to hidden | [
"Create",
"a",
"sequence",
"that",
"lerps",
"the",
"color",
"out",
"then",
"parents",
"the",
"fade",
"to",
"hidden"
] | def getFadeOutIval(self, t=0.5, finishIval=None, blendType='noBlend'):
"""
Create a sequence that lerps the color out, then
parents the fade to hidden
"""
self.noTransitions()
self.loadFade()
transitionIval = Sequence(Func(self.fade.reparentTo, ShowBaseGlobal.asp... | [
"def",
"getFadeOutIval",
"(",
"self",
",",
"t",
"=",
"0.5",
",",
"finishIval",
"=",
"None",
",",
"blendType",
"=",
"'noBlend'",
")",
":",
"self",
".",
"noTransitions",
"(",
")",
"self",
".",
"loadFade",
"(",
")",
"transitionIval",
"=",
"Sequence",
"(",
... | https://github.com/panda3d/panda3d/blob/833ad89ebad58395d0af0b7ec08538e5e4308265/direct/src/showbase/Transitions.py#L118-L137 | |
natanielruiz/android-yolo | 1ebb54f96a67a20ff83ddfc823ed83a13dc3a47f | jni-build/jni/include/tensorflow/python/client/session.py | python | SessionInterface.run | (self, fetches, feed_dict=None, options=None, run_metadata=None) | Runs operations in the session. See `Session.run()` for details. | Runs operations in the session. See `Session.run()` for details. | [
"Runs",
"operations",
"in",
"the",
"session",
".",
"See",
"Session",
".",
"run",
"()",
"for",
"details",
"."
] | def run(self, fetches, feed_dict=None, options=None, run_metadata=None):
"""Runs operations in the session. See `Session.run()` for details."""
raise NotImplementedError('run') | [
"def",
"run",
"(",
"self",
",",
"fetches",
",",
"feed_dict",
"=",
"None",
",",
"options",
"=",
"None",
",",
"run_metadata",
"=",
"None",
")",
":",
"raise",
"NotImplementedError",
"(",
"'run'",
")"
] | https://github.com/natanielruiz/android-yolo/blob/1ebb54f96a67a20ff83ddfc823ed83a13dc3a47f/jni-build/jni/include/tensorflow/python/client/session.py#L50-L52 | ||
wxWidgets/wxPython-Classic | 19571e1ae65f1ac445f5491474121998c97a1bf0 | wx/lib/plot.py | python | PlotCanvas._getFont | (self, size) | Take font size, adjusts if printing and returns wx.Font | Take font size, adjusts if printing and returns wx.Font | [
"Take",
"font",
"size",
"adjusts",
"if",
"printing",
"and",
"returns",
"wx",
".",
"Font"
] | def _getFont(self, size):
"""Take font size, adjusts if printing and returns wx.Font"""
s = size * self.printerScale * self._fontScale
of = self.GetFont()
# Linux speed up to get font from cache rather than X font server
key = (int(s), of.GetFamily(), of.GetStyle(), of.GetWeight(... | [
"def",
"_getFont",
"(",
"self",
",",
"size",
")",
":",
"s",
"=",
"size",
"*",
"self",
".",
"printerScale",
"*",
"self",
".",
"_fontScale",
"of",
"=",
"self",
".",
"GetFont",
"(",
")",
"# Linux speed up to get font from cache rather than X font server",
"key",
... | https://github.com/wxWidgets/wxPython-Classic/blob/19571e1ae65f1ac445f5491474121998c97a1bf0/wx/lib/plot.py#L1680-L1693 | ||
domino-team/openwrt-cc | 8b181297c34d14d3ca521cc9f31430d561dbc688 | package/gli-pub/openwrt-node-packages-master/node/node-v6.9.1/tools/gyp/pylib/gyp/generator/ninja.py | python | NinjaWriter.ComputeExportEnvString | (self, env) | return ' '.join(export_str) | Given an environment, returns a string looking like
'export FOO=foo; export BAR="${FOO} bar;'
that exports |env| to the shell. | Given an environment, returns a string looking like
'export FOO=foo; export BAR="${FOO} bar;'
that exports |env| to the shell. | [
"Given",
"an",
"environment",
"returns",
"a",
"string",
"looking",
"like",
"export",
"FOO",
"=",
"foo",
";",
"export",
"BAR",
"=",
"$",
"{",
"FOO",
"}",
"bar",
";",
"that",
"exports",
"|env|",
"to",
"the",
"shell",
"."
] | def ComputeExportEnvString(self, env):
"""Given an environment, returns a string looking like
'export FOO=foo; export BAR="${FOO} bar;'
that exports |env| to the shell."""
export_str = []
for k, v in env:
export_str.append('export %s=%s;' %
(k, ninja_syntax.escape(gyp.common.Enco... | [
"def",
"ComputeExportEnvString",
"(",
"self",
",",
"env",
")",
":",
"export_str",
"=",
"[",
"]",
"for",
"k",
",",
"v",
"in",
"env",
":",
"export_str",
".",
"append",
"(",
"'export %s=%s;'",
"%",
"(",
"k",
",",
"ninja_syntax",
".",
"escape",
"(",
"gyp",... | https://github.com/domino-team/openwrt-cc/blob/8b181297c34d14d3ca521cc9f31430d561dbc688/package/gli-pub/openwrt-node-packages-master/node/node-v6.9.1/tools/gyp/pylib/gyp/generator/ninja.py#L1401-L1409 | |
GNOME/gjs | ccbfa21e2be3ebe700050f85e93bfcbc18cc676d | tools/heapgraph.py | python | parse_roots | (fobj) | return [roots, root_labels, weakMapEntries] | Parse the roots portion of a garbage collector heap. | Parse the roots portion of a garbage collector heap. | [
"Parse",
"the",
"roots",
"portion",
"of",
"a",
"garbage",
"collector",
"heap",
"."
] | def parse_roots(fobj):
"""Parse the roots portion of a garbage collector heap."""
roots = {}
root_labels = {}
weakMapEntries = []
for line in fobj:
node = node_regex.match(line)
if node:
addr = node.group(1)
color = node.group(2)
label = node.gr... | [
"def",
"parse_roots",
"(",
"fobj",
")",
":",
"roots",
"=",
"{",
"}",
"root_labels",
"=",
"{",
"}",
"weakMapEntries",
"=",
"[",
"]",
"for",
"line",
"in",
"fobj",
":",
"node",
"=",
"node_regex",
".",
"match",
"(",
"line",
")",
"if",
"node",
":",
"add... | https://github.com/GNOME/gjs/blob/ccbfa21e2be3ebe700050f85e93bfcbc18cc676d/tools/heapgraph.py#L132-L171 | |
aws/lumberyard | f85344403c1c2e77ec8c75deb2c116e97b713217 | dev/Tools/Python/3.7.10/mac/Python.framework/Versions/3.7/lib/python3.7/site-packages/pip/_internal/utils/virtualenv.py | python | _get_pyvenv_cfg_lines | () | Reads {sys.prefix}/pyvenv.cfg and returns its contents as list of lines
Returns None, if it could not read/access the file. | Reads {sys.prefix}/pyvenv.cfg and returns its contents as list of lines | [
"Reads",
"{",
"sys",
".",
"prefix",
"}",
"/",
"pyvenv",
".",
"cfg",
"and",
"returns",
"its",
"contents",
"as",
"list",
"of",
"lines"
] | def _get_pyvenv_cfg_lines():
# type: () -> Optional[List[str]]
"""Reads {sys.prefix}/pyvenv.cfg and returns its contents as list of lines
Returns None, if it could not read/access the file.
"""
pyvenv_cfg_file = os.path.join(sys.prefix, 'pyvenv.cfg')
try:
# Although PEP 405 does not spe... | [
"def",
"_get_pyvenv_cfg_lines",
"(",
")",
":",
"# type: () -> Optional[List[str]]",
"pyvenv_cfg_file",
"=",
"os",
".",
"path",
".",
"join",
"(",
"sys",
".",
"prefix",
",",
"'pyvenv.cfg'",
")",
"try",
":",
"# Although PEP 405 does not specify, the built-in venv module alwa... | https://github.com/aws/lumberyard/blob/f85344403c1c2e77ec8c75deb2c116e97b713217/dev/Tools/Python/3.7.10/mac/Python.framework/Versions/3.7/lib/python3.7/site-packages/pip/_internal/utils/virtualenv.py#L44-L57 | ||
kevin-ssy/Optical-Flow-Guided-Feature | 07d4501a29002ee7821c38c1820e4a64c1acf6e8 | lib/caffe-action/scripts/cpp_lint.py | python | CheckCaffeDataLayerSetUp | (filename, clean_lines, linenum, error) | Except the base classes, Caffe DataLayer should define DataLayerSetUp
instead of LayerSetUp.
The base DataLayers define common SetUp steps, the subclasses should
not override them.
Args:
filename: The name of the current file.
clean_lines: A CleansedLines instance containing the file.
li... | Except the base classes, Caffe DataLayer should define DataLayerSetUp
instead of LayerSetUp.
The base DataLayers define common SetUp steps, the subclasses should
not override them.
Args:
filename: The name of the current file.
clean_lines: A CleansedLines instance containing the file.
li... | [
"Except",
"the",
"base",
"classes",
"Caffe",
"DataLayer",
"should",
"define",
"DataLayerSetUp",
"instead",
"of",
"LayerSetUp",
".",
"The",
"base",
"DataLayers",
"define",
"common",
"SetUp",
"steps",
"the",
"subclasses",
"should",
"not",
"override",
"them",
".",
... | def CheckCaffeDataLayerSetUp(filename, clean_lines, linenum, error):
"""Except the base classes, Caffe DataLayer should define DataLayerSetUp
instead of LayerSetUp.
The base DataLayers define common SetUp steps, the subclasses should
not override them.
Args:
filename: The name of the current f... | [
"def",
"CheckCaffeDataLayerSetUp",
"(",
"filename",
",",
"clean_lines",
",",
"linenum",
",",
"error",
")",
":",
"line",
"=",
"clean_lines",
".",
"elided",
"[",
"linenum",
"]",
"ix",
"=",
"line",
".",
"find",
"(",
"'DataLayer<Dtype>::LayerSetUp'",
")",
"if",
... | https://github.com/kevin-ssy/Optical-Flow-Guided-Feature/blob/07d4501a29002ee7821c38c1820e4a64c1acf6e8/lib/caffe-action/scripts/cpp_lint.py#L1595-L1631 | ||
koth/kcws | 88efbd36a7022de4e6e90f5a1fb880cf87cfae9f | third_party/setuptools/pkg_resources.py | python | file_ns_handler | (importer, path_item, packageName, module) | Compute an ns-package subpath for a filesystem or zipfile importer | Compute an ns-package subpath for a filesystem or zipfile importer | [
"Compute",
"an",
"ns",
"-",
"package",
"subpath",
"for",
"a",
"filesystem",
"or",
"zipfile",
"importer"
] | def file_ns_handler(importer, path_item, packageName, module):
"""Compute an ns-package subpath for a filesystem or zipfile importer"""
subpath = os.path.join(path_item, packageName.split('.')[-1])
normalized = _normalize_cached(subpath)
for item in module.__path__:
if _normalize_cached(item)==... | [
"def",
"file_ns_handler",
"(",
"importer",
",",
"path_item",
",",
"packageName",
",",
"module",
")",
":",
"subpath",
"=",
"os",
".",
"path",
".",
"join",
"(",
"path_item",
",",
"packageName",
".",
"split",
"(",
"'.'",
")",
"[",
"-",
"1",
"]",
")",
"n... | https://github.com/koth/kcws/blob/88efbd36a7022de4e6e90f5a1fb880cf87cfae9f/third_party/setuptools/pkg_resources.py#L1993-L2003 | ||
MythTV/mythtv | d282a209cb8be85d036f85a62a8ec971b67d45f4 | mythtv/bindings/python/MythTV/dataheap.py | python | Recorded.getRecordedFile | (self) | return RecordedFile.fromRecorded(self) | Recorded.getRecordedFile() -> RecordedFile object | Recorded.getRecordedFile() -> RecordedFile object | [
"Recorded",
".",
"getRecordedFile",
"()",
"-",
">",
"RecordedFile",
"object"
] | def getRecordedFile(self):
"""Recorded.getRecordedFile() -> RecordedFile object"""
return RecordedFile.fromRecorded(self) | [
"def",
"getRecordedFile",
"(",
"self",
")",
":",
"return",
"RecordedFile",
".",
"fromRecorded",
"(",
"self",
")"
] | https://github.com/MythTV/mythtv/blob/d282a209cb8be85d036f85a62a8ec971b67d45f4/mythtv/bindings/python/MythTV/dataheap.py#L378-L380 | |
yuxng/PoseCNN | 9f3dd7b7bce21dcafc05e8f18ccc90da3caabd04 | lib/gt_synthesize_layer/layer.py | python | GtSynthesizeLayer.__init__ | (self, roidb, num_classes, extents, points, symmetry, cache_path, name, data_queue, model_file, pose_file) | Set the roidb to be used by this layer during training. | Set the roidb to be used by this layer during training. | [
"Set",
"the",
"roidb",
"to",
"be",
"used",
"by",
"this",
"layer",
"during",
"training",
"."
] | def __init__(self, roidb, num_classes, extents, points, symmetry, cache_path, name, data_queue, model_file, pose_file):
"""Set the roidb to be used by this layer during training."""
self._roidb = roidb
self._num_classes = num_classes
self._extents = extents
self._points = points
... | [
"def",
"__init__",
"(",
"self",
",",
"roidb",
",",
"num_classes",
",",
"extents",
",",
"points",
",",
"symmetry",
",",
"cache_path",
",",
"name",
",",
"data_queue",
",",
"model_file",
",",
"pose_file",
")",
":",
"self",
".",
"_roidb",
"=",
"roidb",
"self... | https://github.com/yuxng/PoseCNN/blob/9f3dd7b7bce21dcafc05e8f18ccc90da3caabd04/lib/gt_synthesize_layer/layer.py#L23-L38 | ||
bulletphysics/bullet3 | f0f2a952e146f016096db6f85cf0c44ed75b0b9a | examples/pybullet/gym/pybullet_envs/agents/ppo/utility.py | python | available_gpus | () | return [x.name for x in local_device_protos if x.device_type == 'GPU'] | List of GPU device names detected by TensorFlow. | List of GPU device names detected by TensorFlow. | [
"List",
"of",
"GPU",
"device",
"names",
"detected",
"by",
"TensorFlow",
"."
] | def available_gpus():
"""List of GPU device names detected by TensorFlow."""
local_device_protos = device_lib.list_local_devices()
return [x.name for x in local_device_protos if x.device_type == 'GPU'] | [
"def",
"available_gpus",
"(",
")",
":",
"local_device_protos",
"=",
"device_lib",
".",
"list_local_devices",
"(",
")",
"return",
"[",
"x",
".",
"name",
"for",
"x",
"in",
"local_device_protos",
"if",
"x",
".",
"device_type",
"==",
"'GPU'",
"]"
] | https://github.com/bulletphysics/bullet3/blob/f0f2a952e146f016096db6f85cf0c44ed75b0b9a/examples/pybullet/gym/pybullet_envs/agents/ppo/utility.py#L145-L148 | |
catboost/catboost | 167f64f237114a4d10b2b4ee42adb4569137debe | contrib/python/scikit-learn/py3/sklearn/covariance/_robust_covariance.py | python | select_candidates | (X, n_support, n_trials, select=1, n_iter=30,
verbose=False,
cov_computation_method=empirical_covariance,
random_state=None) | return best_locations, best_covariances, best_supports, best_ds | Finds the best pure subset of observations to compute MCD from it.
The purpose of this function is to find the best sets of n_support
observations with respect to a minimization of their covariance
matrix determinant. Equivalently, it removes n_samples-n_support
observations to construct what we call a... | Finds the best pure subset of observations to compute MCD from it. | [
"Finds",
"the",
"best",
"pure",
"subset",
"of",
"observations",
"to",
"compute",
"MCD",
"from",
"it",
"."
] | def select_candidates(X, n_support, n_trials, select=1, n_iter=30,
verbose=False,
cov_computation_method=empirical_covariance,
random_state=None):
"""Finds the best pure subset of observations to compute MCD from it.
The purpose of this function... | [
"def",
"select_candidates",
"(",
"X",
",",
"n_support",
",",
"n_trials",
",",
"select",
"=",
"1",
",",
"n_iter",
"=",
"30",
",",
"verbose",
"=",
"False",
",",
"cov_computation_method",
"=",
"empirical_covariance",
",",
"random_state",
"=",
"None",
")",
":",
... | https://github.com/catboost/catboost/blob/167f64f237114a4d10b2b4ee42adb4569137debe/contrib/python/scikit-learn/py3/sklearn/covariance/_robust_covariance.py#L183-L303 | |
llvm/llvm-project | ffa6262cb4e2a335d26416fad39a581b4f98c5f4 | llvm/bindings/python/llvm/object.py | python | ObjectFile.__init__ | (self, filename=None, contents=None) | Construct an instance from a filename or binary data.
filename must be a path to a file that can be opened with open().
contents can be either a native Python buffer type (like str) or a
llvm.core.MemoryBuffer instance. | Construct an instance from a filename or binary data. | [
"Construct",
"an",
"instance",
"from",
"a",
"filename",
"or",
"binary",
"data",
"."
] | def __init__(self, filename=None, contents=None):
"""Construct an instance from a filename or binary data.
filename must be a path to a file that can be opened with open().
contents can be either a native Python buffer type (like str) or a
llvm.core.MemoryBuffer instance.
"""
... | [
"def",
"__init__",
"(",
"self",
",",
"filename",
"=",
"None",
",",
"contents",
"=",
"None",
")",
":",
"if",
"contents",
":",
"assert",
"isinstance",
"(",
"contents",
",",
"MemoryBuffer",
")",
"if",
"filename",
"is",
"not",
"None",
":",
"contents",
"=",
... | https://github.com/llvm/llvm-project/blob/ffa6262cb4e2a335d26416fad39a581b4f98c5f4/llvm/bindings/python/llvm/object.py#L102-L120 | ||
msracver/Deep-Image-Analogy | 632b9287b42552e32dad64922967c8c9ec7fc4d3 | scripts/cpp_lint.py | python | _CppLintState.SetVerboseLevel | (self, level) | return last_verbose_level | Sets the module's verbosity, and returns the previous setting. | Sets the module's verbosity, and returns the previous setting. | [
"Sets",
"the",
"module",
"s",
"verbosity",
"and",
"returns",
"the",
"previous",
"setting",
"."
] | def SetVerboseLevel(self, level):
"""Sets the module's verbosity, and returns the previous setting."""
last_verbose_level = self.verbose_level
self.verbose_level = level
return last_verbose_level | [
"def",
"SetVerboseLevel",
"(",
"self",
",",
"level",
")",
":",
"last_verbose_level",
"=",
"self",
".",
"verbose_level",
"self",
".",
"verbose_level",
"=",
"level",
"return",
"last_verbose_level"
] | https://github.com/msracver/Deep-Image-Analogy/blob/632b9287b42552e32dad64922967c8c9ec7fc4d3/scripts/cpp_lint.py#L707-L711 | |
wlanjie/AndroidFFmpeg | 7baf9122f4b8e1c74e7baf4be5c422c7a5ba5aaf | tools/fdk-aac-build/x86/toolchain/lib/python2.7/cgitb.py | python | enable | (display=1, logdir=None, context=5, format="html") | Install an exception handler that formats tracebacks as HTML.
The optional argument 'display' can be set to 0 to suppress sending the
traceback to the browser, and 'logdir' can be set to a directory to cause
tracebacks to be written to files there. | Install an exception handler that formats tracebacks as HTML. | [
"Install",
"an",
"exception",
"handler",
"that",
"formats",
"tracebacks",
"as",
"HTML",
"."
] | def enable(display=1, logdir=None, context=5, format="html"):
"""Install an exception handler that formats tracebacks as HTML.
The optional argument 'display' can be set to 0 to suppress sending the
traceback to the browser, and 'logdir' can be set to a directory to cause
tracebacks to be written to fi... | [
"def",
"enable",
"(",
"display",
"=",
"1",
",",
"logdir",
"=",
"None",
",",
"context",
"=",
"5",
",",
"format",
"=",
"\"html\"",
")",
":",
"sys",
".",
"excepthook",
"=",
"Hook",
"(",
"display",
"=",
"display",
",",
"logdir",
"=",
"logdir",
",",
"co... | https://github.com/wlanjie/AndroidFFmpeg/blob/7baf9122f4b8e1c74e7baf4be5c422c7a5ba5aaf/tools/fdk-aac-build/x86/toolchain/lib/python2.7/cgitb.py#L316-L323 | ||
wlanjie/AndroidFFmpeg | 7baf9122f4b8e1c74e7baf4be5c422c7a5ba5aaf | tools/fdk-aac-build/armeabi/toolchain/lib/python2.7/logging/__init__.py | python | LoggerAdapter.critical | (self, msg, *args, **kwargs) | Delegate a critical call to the underlying logger, after adding
contextual information from this adapter instance. | Delegate a critical call to the underlying logger, after adding
contextual information from this adapter instance. | [
"Delegate",
"a",
"critical",
"call",
"to",
"the",
"underlying",
"logger",
"after",
"adding",
"contextual",
"information",
"from",
"this",
"adapter",
"instance",
"."
] | def critical(self, msg, *args, **kwargs):
"""
Delegate a critical call to the underlying logger, after adding
contextual information from this adapter instance.
"""
msg, kwargs = self.process(msg, kwargs)
self.logger.critical(msg, *args, **kwargs) | [
"def",
"critical",
"(",
"self",
",",
"msg",
",",
"*",
"args",
",",
"*",
"*",
"kwargs",
")",
":",
"msg",
",",
"kwargs",
"=",
"self",
".",
"process",
"(",
"msg",
",",
"kwargs",
")",
"self",
".",
"logger",
".",
"critical",
"(",
"msg",
",",
"*",
"a... | https://github.com/wlanjie/AndroidFFmpeg/blob/7baf9122f4b8e1c74e7baf4be5c422c7a5ba5aaf/tools/fdk-aac-build/armeabi/toolchain/lib/python2.7/logging/__init__.py#L1457-L1463 | ||
freesurfer/freesurfer | 6dbe527d43ffa611acb2cd112e9469f9bfec8e36 | sscnn_skullstripping/sscnn_skullstripping/image_utils/image_utils/patch_utils.py | python | build_image_from_patches | (in_patches, patch_size, idx_x, idx_y, idx_z, padded_img_size, patch_crop_size) | return out_img_data, count_img_data | patch_crop_size depends on the size of the cnn filter. If [3,3,3] then [1,1,1] | patch_crop_size depends on the size of the cnn filter. If [3,3,3] then [1,1,1] | [
"patch_crop_size",
"depends",
"on",
"the",
"size",
"of",
"the",
"cnn",
"filter",
".",
"If",
"[",
"3",
"3",
"3",
"]",
"then",
"[",
"1",
"1",
"1",
"]"
] | def build_image_from_patches(in_patches, patch_size, idx_x, idx_y, idx_z, padded_img_size, patch_crop_size):
''' patch_crop_size depends on the size of the cnn filter. If [3,3,3] then [1,1,1]'''
import numpy as np
out_img_data = np.zeros(padded_img_size)
count_img_data = np.zeros(padded_img_size)
pa... | [
"def",
"build_image_from_patches",
"(",
"in_patches",
",",
"patch_size",
",",
"idx_x",
",",
"idx_y",
",",
"idx_z",
",",
"padded_img_size",
",",
"patch_crop_size",
")",
":",
"import",
"numpy",
"as",
"np",
"out_img_data",
"=",
"np",
".",
"zeros",
"(",
"padded_im... | https://github.com/freesurfer/freesurfer/blob/6dbe527d43ffa611acb2cd112e9469f9bfec8e36/sscnn_skullstripping/sscnn_skullstripping/image_utils/image_utils/patch_utils.py#L110-L174 | |
ppizarro/coursera | b39847928df4d9d5986b801085c025e8e9122b6a | cloud-computing/concepts1/mp1_assignment/submit.py | python | basicPrompt | () | return login, password | Prompt the user for login credentials. Returns a tuple (login, password). | Prompt the user for login credentials. Returns a tuple (login, password). | [
"Prompt",
"the",
"user",
"for",
"login",
"credentials",
".",
"Returns",
"a",
"tuple",
"(",
"login",
"password",
")",
"."
] | def basicPrompt():
"""Prompt the user for login credentials. Returns a tuple (login, password)."""
login = raw_input('Login (Email address): ')
password = raw_input('One-time Password (from the assignment page. This is NOT your own account\'s password): ')
return login, password | [
"def",
"basicPrompt",
"(",
")",
":",
"login",
"=",
"raw_input",
"(",
"'Login (Email address): '",
")",
"password",
"=",
"raw_input",
"(",
"'One-time Password (from the assignment page. This is NOT your own account\\'s password): '",
")",
"return",
"login",
",",
"password"
] | https://github.com/ppizarro/coursera/blob/b39847928df4d9d5986b801085c025e8e9122b6a/cloud-computing/concepts1/mp1_assignment/submit.py#L68-L72 | |
ChromiumWebApps/chromium | c7361d39be8abd1574e6ce8957c8dbddd4c6ccf7 | build/android/buildbot/bb_device_steps.py | python | RebootDeviceSafe | (device) | Reboot a device, wait for it to start, and squelch timeout exceptions. | Reboot a device, wait for it to start, and squelch timeout exceptions. | [
"Reboot",
"a",
"device",
"wait",
"for",
"it",
"to",
"start",
"and",
"squelch",
"timeout",
"exceptions",
"."
] | def RebootDeviceSafe(device):
"""Reboot a device, wait for it to start, and squelch timeout exceptions."""
try:
android_commands.AndroidCommands(device).Reboot(True)
except errors.DeviceUnresponsiveError as e:
return e | [
"def",
"RebootDeviceSafe",
"(",
"device",
")",
":",
"try",
":",
"android_commands",
".",
"AndroidCommands",
"(",
"device",
")",
".",
"Reboot",
"(",
"True",
")",
"except",
"errors",
".",
"DeviceUnresponsiveError",
"as",
"e",
":",
"return",
"e"
] | https://github.com/ChromiumWebApps/chromium/blob/c7361d39be8abd1574e6ce8957c8dbddd4c6ccf7/build/android/buildbot/bb_device_steps.py#L102-L107 | ||
mantidproject/mantid | 03deeb89254ec4289edb8771e0188c2090a02f32 | Framework/PythonInterface/plugins/algorithms/WorkflowAlgorithms/ILL_utilities.py | python | Cleanup.__init__ | (self, cleanupMode, deleteAlgorithmLogging) | Initialize an instance of the class. | Initialize an instance of the class. | [
"Initialize",
"an",
"instance",
"of",
"the",
"class",
"."
] | def __init__(self, cleanupMode, deleteAlgorithmLogging):
"""Initialize an instance of the class."""
self._deleteAlgorithmLogging = deleteAlgorithmLogging
self._doDelete = cleanupMode == self.ON
self._protected = set()
self._toBeDeleted = set() | [
"def",
"__init__",
"(",
"self",
",",
"cleanupMode",
",",
"deleteAlgorithmLogging",
")",
":",
"self",
".",
"_deleteAlgorithmLogging",
"=",
"deleteAlgorithmLogging",
"self",
".",
"_doDelete",
"=",
"cleanupMode",
"==",
"self",
".",
"ON",
"self",
".",
"_protected",
... | https://github.com/mantidproject/mantid/blob/03deeb89254ec4289edb8771e0188c2090a02f32/Framework/PythonInterface/plugins/algorithms/WorkflowAlgorithms/ILL_utilities.py#L18-L23 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.