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 |
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
mantidproject/mantid | 03deeb89254ec4289edb8771e0188c2090a02f32 | qt/python/mantidqtinterfaces/mantidqtinterfaces/Muon/GUI/ElementalAnalysis/PeriodicTable/periodic_table.py | python | _ElementButton.setSelected | (self, b) | Set this element button as selected.
Only a single button can be selected.
:param b: boolean | Set this element button as selected.
Only a single button can be selected. | [
"Set",
"this",
"element",
"button",
"as",
"selected",
".",
"Only",
"a",
"single",
"button",
"can",
"be",
"selected",
"."
] | def setSelected(self, b):
"""Set this element button as selected.
Only a single button can be selected.
:param b: boolean
"""
self.selected = b
self._setBrush() | [
"def",
"setSelected",
"(",
"self",
",",
"b",
")",
":",
"self",
".",
"selected",
"=",
"b",
"self",
".",
"_setBrush",
"(",
")"
] | https://github.com/mantidproject/mantid/blob/03deeb89254ec4289edb8771e0188c2090a02f32/qt/python/mantidqtinterfaces/mantidqtinterfaces/Muon/GUI/ElementalAnalysis/PeriodicTable/periodic_table.py#L347-L354 | ||
forkineye/ESPixelStick | 22926f1c0d1131f1369fc7cad405689a095ae3cb | dist/bin/pyserial/serial/threaded/__init__.py | python | Packetizer.connection_lost | (self, exc) | Forget transport | Forget transport | [
"Forget",
"transport"
] | def connection_lost(self, exc):
"""Forget transport"""
self.transport = None
super(Packetizer, self).connection_lost(exc) | [
"def",
"connection_lost",
"(",
"self",
",",
"exc",
")",
":",
"self",
".",
"transport",
"=",
"None",
"super",
"(",
"Packetizer",
",",
"self",
")",
".",
"connection_lost",
"(",
"exc",
")"
] | https://github.com/forkineye/ESPixelStick/blob/22926f1c0d1131f1369fc7cad405689a095ae3cb/dist/bin/pyserial/serial/threaded/__init__.py#L55-L58 | ||
aws/lumberyard | f85344403c1c2e77ec8c75deb2c116e97b713217 | dev/Tools/Python/3.7.10/windows/Lib/tkinter/ttk.py | python | Scale.configure | (self, cnf=None, **kw) | return retval | Modify or query scale options.
Setting a value for any of the "from", "from_" or "to" options
generates a <<RangeChanged>> event. | Modify or query scale options. | [
"Modify",
"or",
"query",
"scale",
"options",
"."
] | def configure(self, cnf=None, **kw):
"""Modify or query scale options.
Setting a value for any of the "from", "from_" or "to" options
generates a <<RangeChanged>> event."""
retval = Widget.configure(self, cnf, **kw)
if not isinstance(cnf, (type(None), str)):
kw.updat... | [
"def",
"configure",
"(",
"self",
",",
"cnf",
"=",
"None",
",",
"*",
"*",
"kw",
")",
":",
"retval",
"=",
"Widget",
".",
"configure",
"(",
"self",
",",
"cnf",
",",
"*",
"*",
"kw",
")",
"if",
"not",
"isinstance",
"(",
"cnf",
",",
"(",
"type",
"(",... | https://github.com/aws/lumberyard/blob/f85344403c1c2e77ec8c75deb2c116e97b713217/dev/Tools/Python/3.7.10/windows/Lib/tkinter/ttk.py#L1084-L1094 | |
JumpingYang001/webrtc | c03d6e965e1f54aeadd670e491eabe5fdb8db968 | tools_webrtc/sslroots/generate_sslroots.py | python | main | () | The main entrypoint. | The main entrypoint. | [
"The",
"main",
"entrypoint",
"."
] | def main():
"""The main entrypoint."""
parser = OptionParser('usage %prog FILE')
parser.add_option('-v', '--verbose', dest='verbose', action='store_true')
parser.add_option('-f',
'--full_cert',
dest='full_cert',
action='store_true')
o... | [
"def",
"main",
"(",
")",
":",
"parser",
"=",
"OptionParser",
"(",
"'usage %prog FILE'",
")",
"parser",
".",
"add_option",
"(",
"'-v'",
",",
"'--verbose'",
",",
"dest",
"=",
"'verbose'",
",",
"action",
"=",
"'store_true'",
")",
"parser",
".",
"add_option",
... | https://github.com/JumpingYang001/webrtc/blob/c03d6e965e1f54aeadd670e491eabe5fdb8db968/tools_webrtc/sslroots/generate_sslroots.py#L41-L55 | ||
luliyucoordinate/Leetcode | 96afcdc54807d1d184e881a075d1dbf3371e31fb | src/0154-Find-Minimum-in-Rotated-Sorted-Array-II/0154.py | python | Solution.findMin | (self, nums) | return nums[low] | :type nums: List[int]
:rtype: int | :type nums: List[int]
:rtype: int | [
":",
"type",
"nums",
":",
"List",
"[",
"int",
"]",
":",
"rtype",
":",
"int"
] | def findMin(self, nums):
"""
:type nums: List[int]
:rtype: int
"""
low, high = 0, len(nums) - 1
while low <= high:
mid = (low + high) // 2
if nums[low] <= nums[mid]:
if nums[mid] <= nums[high]:
high -= 1
... | [
"def",
"findMin",
"(",
"self",
",",
"nums",
")",
":",
"low",
",",
"high",
"=",
"0",
",",
"len",
"(",
"nums",
")",
"-",
"1",
"while",
"low",
"<=",
"high",
":",
"mid",
"=",
"(",
"low",
"+",
"high",
")",
"//",
"2",
"if",
"nums",
"[",
"low",
"]... | https://github.com/luliyucoordinate/Leetcode/blob/96afcdc54807d1d184e881a075d1dbf3371e31fb/src/0154-Find-Minimum-in-Rotated-Sorted-Array-II/0154.py#L2-L19 | |
baidu-research/tensorflow-allreduce | 66d5b855e90b0949e9fa5cca5599fd729a70e874 | tensorflow/contrib/training/python/training/evaluation.py | python | evaluate_repeatedly | (checkpoint_dir,
master='',
scaffold=None,
eval_ops=None,
feed_dict=None,
final_ops=None,
final_ops_feed_dict=None,
eval_interval_secs=60,
... | return final_ops_hook.final_ops_values | Repeatedly searches for a checkpoint in `checkpoint_dir` and evaluates it.
During a single evaluation, the `eval_ops` is run until the session is
interrupted or requested to finish. This is typically requested via a
`tf.contrib.training.StopAfterNEvalsHook` which results in `eval_ops` running
the requested num... | Repeatedly searches for a checkpoint in `checkpoint_dir` and evaluates it. | [
"Repeatedly",
"searches",
"for",
"a",
"checkpoint",
"in",
"checkpoint_dir",
"and",
"evaluates",
"it",
"."
] | def evaluate_repeatedly(checkpoint_dir,
master='',
scaffold=None,
eval_ops=None,
feed_dict=None,
final_ops=None,
final_ops_feed_dict=None,
eval_interval... | [
"def",
"evaluate_repeatedly",
"(",
"checkpoint_dir",
",",
"master",
"=",
"''",
",",
"scaffold",
"=",
"None",
",",
"eval_ops",
"=",
"None",
",",
"feed_dict",
"=",
"None",
",",
"final_ops",
"=",
"None",
",",
"final_ops_feed_dict",
"=",
"None",
",",
"eval_inter... | https://github.com/baidu-research/tensorflow-allreduce/blob/66d5b855e90b0949e9fa5cca5599fd729a70e874/tensorflow/contrib/training/python/training/evaluation.py#L345-L462 | |
mindspore-ai/mindspore | fb8fd3338605bb34fa5cea054e535a8b1d753fab | mindspore/python/mindspore/_extends/builtin_operations.py | python | make_list | (*xs) | return list(xs) | Implement `make_list`. | Implement `make_list`. | [
"Implement",
"make_list",
"."
] | def make_list(*xs):
"""Implement `make_list`."""
return list(xs) | [
"def",
"make_list",
"(",
"*",
"xs",
")",
":",
"return",
"list",
"(",
"xs",
")"
] | https://github.com/mindspore-ai/mindspore/blob/fb8fd3338605bb34fa5cea054e535a8b1d753fab/mindspore/python/mindspore/_extends/builtin_operations.py#L120-L122 | |
larroy/clearskies_core | 3574ddf0edc8555454c7044126e786a6c29444dc | tools/gyp/pylib/gyp/xcode_emulation.py | python | GetStdout | (cmdlist) | return out.rstrip('\n') | Returns the content of standard output returned by invoking |cmdlist|.
Raises |GypError| if the command return with a non-zero return code. | Returns the content of standard output returned by invoking |cmdlist|.
Raises |GypError| if the command return with a non-zero return code. | [
"Returns",
"the",
"content",
"of",
"standard",
"output",
"returned",
"by",
"invoking",
"|cmdlist|",
".",
"Raises",
"|GypError|",
"if",
"the",
"command",
"return",
"with",
"a",
"non",
"-",
"zero",
"return",
"code",
"."
] | def GetStdout(cmdlist):
"""Returns the content of standard output returned by invoking |cmdlist|.
Raises |GypError| if the command return with a non-zero return code."""
job = subprocess.Popen(cmdlist, stdout=subprocess.PIPE)
out = job.communicate()[0]
if job.returncode != 0:
sys.stderr.write(out + '\n')
... | [
"def",
"GetStdout",
"(",
"cmdlist",
")",
":",
"job",
"=",
"subprocess",
".",
"Popen",
"(",
"cmdlist",
",",
"stdout",
"=",
"subprocess",
".",
"PIPE",
")",
"out",
"=",
"job",
".",
"communicate",
"(",
")",
"[",
"0",
"]",
"if",
"job",
".",
"returncode",
... | https://github.com/larroy/clearskies_core/blob/3574ddf0edc8555454c7044126e786a6c29444dc/tools/gyp/pylib/gyp/xcode_emulation.py#L1134-L1142 | |
catboost/catboost | 167f64f237114a4d10b2b4ee42adb4569137debe | contrib/tools/python3/src/Lib/bz2.py | python | BZ2File.fileno | (self) | return self._fp.fileno() | Return the file descriptor for the underlying file. | Return the file descriptor for the underlying file. | [
"Return",
"the",
"file",
"descriptor",
"for",
"the",
"underlying",
"file",
"."
] | def fileno(self):
"""Return the file descriptor for the underlying file."""
self._check_not_closed()
return self._fp.fileno() | [
"def",
"fileno",
"(",
"self",
")",
":",
"self",
".",
"_check_not_closed",
"(",
")",
"return",
"self",
".",
"_fp",
".",
"fileno",
"(",
")"
] | https://github.com/catboost/catboost/blob/167f64f237114a4d10b2b4ee42adb4569137debe/contrib/tools/python3/src/Lib/bz2.py#L131-L134 | |
protocolbuffers/protobuf | b5ab0b7a18b7336c60130f4ddb2d97c51792f896 | objectivec/DevTools/pddm.py | python | MacroCollection.ParseLines | (self, input_lines) | Parses list of lines.
Args:
input_lines: A list of strings of input to parse (no newlines on the
strings).
Raises:
PDDMError if there are any issues. | Parses list of lines. | [
"Parses",
"list",
"of",
"lines",
"."
] | def ParseLines(self, input_lines):
"""Parses list of lines.
Args:
input_lines: A list of strings of input to parse (no newlines on the
strings).
Raises:
PDDMError if there are any issues.
"""
current_macro = None
for line in input_lines:
if line.startswith(... | [
"def",
"ParseLines",
"(",
"self",
",",
"input_lines",
")",
":",
"current_macro",
"=",
"None",
"for",
"line",
"in",
"input_lines",
":",
"if",
"line",
".",
"startswith",
"(",
"'PDDM-'",
")",
":",
"directive",
"=",
"line",
".",
"split",
"(",
"' '",
",",
"... | https://github.com/protocolbuffers/protobuf/blob/b5ab0b7a18b7336c60130f4ddb2d97c51792f896/objectivec/DevTools/pddm.py#L195-L233 | ||
wxWidgets/wxPython-Classic | 19571e1ae65f1ac445f5491474121998c97a1bf0 | wx/lib/shell.py | python | PyShellOutput.write | (self, str, style=None) | stdout-like interface | stdout-like interface | [
"stdout",
"-",
"like",
"interface"
] | def write(self, str, style=None):
"""stdout-like interface"""
if style ==None: style =self.out_style
# do not process incomplete lines
if len(str) <1:
# hm... what was i supposed to do?
return
elif str[-1] !="\n":
self.line_buffer =self.line_bu... | [
"def",
"write",
"(",
"self",
",",
"str",
",",
"style",
"=",
"None",
")",
":",
"if",
"style",
"==",
"None",
":",
"style",
"=",
"self",
".",
"out_style",
"# do not process incomplete lines",
"if",
"len",
"(",
"str",
")",
"<",
"1",
":",
"# hm... what was i ... | https://github.com/wxWidgets/wxPython-Classic/blob/19571e1ae65f1ac445f5491474121998c97a1bf0/wx/lib/shell.py#L231-L242 | ||
wlanjie/AndroidFFmpeg | 7baf9122f4b8e1c74e7baf4be5c422c7a5ba5aaf | tools/fdk-aac-build/armeabi/toolchain/lib/python2.7/linecache.py | python | getlines | (filename, module_globals=None) | Get the lines for a file from the cache.
Update the cache if it doesn't contain an entry for this file already. | Get the lines for a file from the cache.
Update the cache if it doesn't contain an entry for this file already. | [
"Get",
"the",
"lines",
"for",
"a",
"file",
"from",
"the",
"cache",
".",
"Update",
"the",
"cache",
"if",
"it",
"doesn",
"t",
"contain",
"an",
"entry",
"for",
"this",
"file",
"already",
"."
] | def getlines(filename, module_globals=None):
"""Get the lines for a file from the cache.
Update the cache if it doesn't contain an entry for this file already."""
if filename in cache:
return cache[filename][2]
else:
return updatecache(filename, module_globals) | [
"def",
"getlines",
"(",
"filename",
",",
"module_globals",
"=",
"None",
")",
":",
"if",
"filename",
"in",
"cache",
":",
"return",
"cache",
"[",
"filename",
"]",
"[",
"2",
"]",
"else",
":",
"return",
"updatecache",
"(",
"filename",
",",
"module_globals",
... | https://github.com/wlanjie/AndroidFFmpeg/blob/7baf9122f4b8e1c74e7baf4be5c422c7a5ba5aaf/tools/fdk-aac-build/armeabi/toolchain/lib/python2.7/linecache.py#L33-L40 | ||
turi-code/SFrame | 796b9bdfb2fa1b881d82080754643c7e68629cd2 | oss_src/unity/python/sframe/util/__init__.py | python | _get_temp_file_location | () | return cache_dir | Returns user specified temporary file location.
The temporary location is specified through:
>>> graphlab.set_runtime_config('GRAPHLAB_CACHE_FILE_LOCATIONS', ...) | Returns user specified temporary file location.
The temporary location is specified through: | [
"Returns",
"user",
"specified",
"temporary",
"file",
"location",
".",
"The",
"temporary",
"location",
"is",
"specified",
"through",
":"
] | def _get_temp_file_location():
'''
Returns user specified temporary file location.
The temporary location is specified through:
>>> graphlab.set_runtime_config('GRAPHLAB_CACHE_FILE_LOCATIONS', ...)
'''
from ..connect import main as _glconnect
unity = _glconnect.get_unity()
cache_dir = ... | [
"def",
"_get_temp_file_location",
"(",
")",
":",
"from",
".",
".",
"connect",
"import",
"main",
"as",
"_glconnect",
"unity",
"=",
"_glconnect",
".",
"get_unity",
"(",
")",
"cache_dir",
"=",
"_convert_slashes",
"(",
"unity",
".",
"get_current_cache_file_location",
... | https://github.com/turi-code/SFrame/blob/796b9bdfb2fa1b881d82080754643c7e68629cd2/oss_src/unity/python/sframe/util/__init__.py#L650-L663 | |
wlanjie/AndroidFFmpeg | 7baf9122f4b8e1c74e7baf4be5c422c7a5ba5aaf | tools/fdk-aac-build/armeabi-v7a/toolchain/lib/python2.7/email/quoprimime.py | python | header_quopri_check | (c) | return bool(hqre.match(c)) | Return True if the character should be escaped with header quopri. | Return True if the character should be escaped with header quopri. | [
"Return",
"True",
"if",
"the",
"character",
"should",
"be",
"escaped",
"with",
"header",
"quopri",
"."
] | def header_quopri_check(c):
"""Return True if the character should be escaped with header quopri."""
return bool(hqre.match(c)) | [
"def",
"header_quopri_check",
"(",
"c",
")",
":",
"return",
"bool",
"(",
"hqre",
".",
"match",
"(",
"c",
")",
")"
] | https://github.com/wlanjie/AndroidFFmpeg/blob/7baf9122f4b8e1c74e7baf4be5c422c7a5ba5aaf/tools/fdk-aac-build/armeabi-v7a/toolchain/lib/python2.7/email/quoprimime.py#L63-L65 | |
aws/lumberyard | f85344403c1c2e77ec8c75deb2c116e97b713217 | dev/Gems/CloudGemMetric/v1/AWS/common-code/Lib/numpy/ma/core.py | python | common_fill_value | (a, b) | return None | Return the common filling value of two masked arrays, if any.
If ``a.fill_value == b.fill_value``, return the fill value,
otherwise return None.
Parameters
----------
a, b : MaskedArray
The masked arrays for which to compare fill values.
Returns
-------
fill_value : scalar or ... | Return the common filling value of two masked arrays, if any. | [
"Return",
"the",
"common",
"filling",
"value",
"of",
"two",
"masked",
"arrays",
"if",
"any",
"."
] | def common_fill_value(a, b):
"""
Return the common filling value of two masked arrays, if any.
If ``a.fill_value == b.fill_value``, return the fill value,
otherwise return None.
Parameters
----------
a, b : MaskedArray
The masked arrays for which to compare fill values.
Return... | [
"def",
"common_fill_value",
"(",
"a",
",",
"b",
")",
":",
"t1",
"=",
"get_fill_value",
"(",
"a",
")",
"t2",
"=",
"get_fill_value",
"(",
"b",
")",
"if",
"t1",
"==",
"t2",
":",
"return",
"t1",
"return",
"None"
] | https://github.com/aws/lumberyard/blob/f85344403c1c2e77ec8c75deb2c116e97b713217/dev/Gems/CloudGemMetric/v1/AWS/common-code/Lib/numpy/ma/core.py#L561-L590 | |
eventql/eventql | 7ca0dbb2e683b525620ea30dc40540a22d5eb227 | deps/3rdparty/spidermonkey/mozjs/python/psutil/psutil/_pslinux.py | python | Connections.decode_address | (self, addr, family) | return (ip, port) | Accept an "ip:port" address as displayed in /proc/net/*
and convert it into a human readable form, like:
"0500000A:0016" -> ("10.0.0.5", 22)
"0000000000000000FFFF00000100007F:9E49" -> ("::ffff:127.0.0.1", 40521)
The IP address portion is a little or big endian four-byte
hexadec... | Accept an "ip:port" address as displayed in /proc/net/*
and convert it into a human readable form, like: | [
"Accept",
"an",
"ip",
":",
"port",
"address",
"as",
"displayed",
"in",
"/",
"proc",
"/",
"net",
"/",
"*",
"and",
"convert",
"it",
"into",
"a",
"human",
"readable",
"form",
"like",
":"
] | def decode_address(self, addr, family):
"""Accept an "ip:port" address as displayed in /proc/net/*
and convert it into a human readable form, like:
"0500000A:0016" -> ("10.0.0.5", 22)
"0000000000000000FFFF00000100007F:9E49" -> ("::ffff:127.0.0.1", 40521)
The IP address portion ... | [
"def",
"decode_address",
"(",
"self",
",",
"addr",
",",
"family",
")",
":",
"ip",
",",
"port",
"=",
"addr",
".",
"split",
"(",
"':'",
")",
"port",
"=",
"int",
"(",
"port",
",",
"16",
")",
"# this usually refers to a local socket in listen mode with",
"# no e... | https://github.com/eventql/eventql/blob/7ca0dbb2e683b525620ea30dc40540a22d5eb227/deps/3rdparty/spidermonkey/mozjs/python/psutil/psutil/_pslinux.py#L428-L473 | |
aws/lumberyard | f85344403c1c2e77ec8c75deb2c116e97b713217 | dev/Tools/Python/3.7.10/linux_x64/lib/python3.7/site-packages/pip/_vendor/distlib/_backport/tarfile.py | python | TarFile.makedev | (self, tarinfo, targetpath) | Make a character or block device called targetpath. | Make a character or block device called targetpath. | [
"Make",
"a",
"character",
"or",
"block",
"device",
"called",
"targetpath",
"."
] | def makedev(self, tarinfo, targetpath):
"""Make a character or block device called targetpath.
"""
if not hasattr(os, "mknod") or not hasattr(os, "makedev"):
raise ExtractError("special devices not supported by system")
mode = tarinfo.mode
if tarinfo.isblk():
... | [
"def",
"makedev",
"(",
"self",
",",
"tarinfo",
",",
"targetpath",
")",
":",
"if",
"not",
"hasattr",
"(",
"os",
",",
"\"mknod\"",
")",
"or",
"not",
"hasattr",
"(",
"os",
",",
"\"makedev\"",
")",
":",
"raise",
"ExtractError",
"(",
"\"special devices not supp... | https://github.com/aws/lumberyard/blob/f85344403c1c2e77ec8c75deb2c116e97b713217/dev/Tools/Python/3.7.10/linux_x64/lib/python3.7/site-packages/pip/_vendor/distlib/_backport/tarfile.py#L4655-L4681 | ||
aws/lumberyard | f85344403c1c2e77ec8c75deb2c116e97b713217 | dev/Tools/Python/3.7.10/windows/Lib/idlelib/pyparse.py | python | Parser.compute_bracket_indent | (self) | return len(code[i:j].expandtabs(self.tabwidth)) + extra | Return number of spaces the next line should be indented.
Line continuation must be C_BRACKET. | Return number of spaces the next line should be indented. | [
"Return",
"number",
"of",
"spaces",
"the",
"next",
"line",
"should",
"be",
"indented",
"."
] | def compute_bracket_indent(self):
"""Return number of spaces the next line should be indented.
Line continuation must be C_BRACKET.
"""
self._study2()
assert self.continuation == C_BRACKET
j = self.lastopenbracketpos
code = self.code
n = len(code)
... | [
"def",
"compute_bracket_indent",
"(",
"self",
")",
":",
"self",
".",
"_study2",
"(",
")",
"assert",
"self",
".",
"continuation",
"==",
"C_BRACKET",
"j",
"=",
"self",
".",
"lastopenbracketpos",
"code",
"=",
"self",
".",
"code",
"n",
"=",
"len",
"(",
"code... | https://github.com/aws/lumberyard/blob/f85344403c1c2e77ec8c75deb2c116e97b713217/dev/Tools/Python/3.7.10/windows/Lib/idlelib/pyparse.py#L462-L491 | |
fatih/subvim | 241b6d170597857105da219c9b7d36059e9f11fb | vim/base/YouCompleteMe/third_party/requests/requests/utils.py | python | guess_filename | (obj) | Tries to guess the filename of the given object. | Tries to guess the filename of the given object. | [
"Tries",
"to",
"guess",
"the",
"filename",
"of",
"the",
"given",
"object",
"."
] | def guess_filename(obj):
"""Tries to guess the filename of the given object."""
name = getattr(obj, 'name', None)
if name and name[0] != '<' and name[-1] != '>':
return os.path.basename(name) | [
"def",
"guess_filename",
"(",
"obj",
")",
":",
"name",
"=",
"getattr",
"(",
"obj",
",",
"'name'",
",",
"None",
")",
"if",
"name",
"and",
"name",
"[",
"0",
"]",
"!=",
"'<'",
"and",
"name",
"[",
"-",
"1",
"]",
"!=",
"'>'",
":",
"return",
"os",
".... | https://github.com/fatih/subvim/blob/241b6d170597857105da219c9b7d36059e9f11fb/vim/base/YouCompleteMe/third_party/requests/requests/utils.py#L91-L95 | ||
aws/lumberyard | f85344403c1c2e77ec8c75deb2c116e97b713217 | dev/Tools/Python/3.7.10/linux_x64/lib/python3.7/tempfile.py | python | _get_candidate_names | () | return _name_sequence | Common setup sequence for all user-callable interfaces. | Common setup sequence for all user-callable interfaces. | [
"Common",
"setup",
"sequence",
"for",
"all",
"user",
"-",
"callable",
"interfaces",
"."
] | def _get_candidate_names():
"""Common setup sequence for all user-callable interfaces."""
global _name_sequence
if _name_sequence is None:
_once_lock.acquire()
try:
if _name_sequence is None:
_name_sequence = _RandomNameSequence()
finally:
_on... | [
"def",
"_get_candidate_names",
"(",
")",
":",
"global",
"_name_sequence",
"if",
"_name_sequence",
"is",
"None",
":",
"_once_lock",
".",
"acquire",
"(",
")",
"try",
":",
"if",
"_name_sequence",
"is",
"None",
":",
"_name_sequence",
"=",
"_RandomNameSequence",
"(",... | https://github.com/aws/lumberyard/blob/f85344403c1c2e77ec8c75deb2c116e97b713217/dev/Tools/Python/3.7.10/linux_x64/lib/python3.7/tempfile.py#L233-L244 | |
natanielruiz/android-yolo | 1ebb54f96a67a20ff83ddfc823ed83a13dc3a47f | jni-build/jni/include/tensorflow/contrib/learn/python/learn/dataframe/tensorflow_dataframe.py | python | _expand_file_names | (filepatterns) | return list(filenames) | Takes a list of file patterns and returns a list of resolved file names. | Takes a list of file patterns and returns a list of resolved file names. | [
"Takes",
"a",
"list",
"of",
"file",
"patterns",
"and",
"returns",
"a",
"list",
"of",
"resolved",
"file",
"names",
"."
] | def _expand_file_names(filepatterns):
"""Takes a list of file patterns and returns a list of resolved file names."""
if not isinstance(filepatterns, (list, tuple, set)):
filepatterns = [filepatterns]
filenames = set()
for filepattern in filepatterns:
names = set(gfile.Glob(filepattern))
filenames |=... | [
"def",
"_expand_file_names",
"(",
"filepatterns",
")",
":",
"if",
"not",
"isinstance",
"(",
"filepatterns",
",",
"(",
"list",
",",
"tuple",
",",
"set",
")",
")",
":",
"filepatterns",
"=",
"[",
"filepatterns",
"]",
"filenames",
"=",
"set",
"(",
")",
"for"... | https://github.com/natanielruiz/android-yolo/blob/1ebb54f96a67a20ff83ddfc823ed83a13dc3a47f/jni-build/jni/include/tensorflow/contrib/learn/python/learn/dataframe/tensorflow_dataframe.py#L47-L55 | |
aws/lumberyard | f85344403c1c2e77ec8c75deb2c116e97b713217 | dev/Tools/Python/3.7.10/linux_x64/lib/python3.7/site-packages/s3transfer/utils.py | python | OSUtils.is_special_file | (cls, filename) | return False | Checks to see if a file is a special UNIX file.
It checks if the file is a character special device, block special
device, FIFO, or socket.
:param filename: Name of the file
:returns: True if the file is a special file. False, if is not. | Checks to see if a file is a special UNIX file. | [
"Checks",
"to",
"see",
"if",
"a",
"file",
"is",
"a",
"special",
"UNIX",
"file",
"."
] | def is_special_file(cls, filename):
"""Checks to see if a file is a special UNIX file.
It checks if the file is a character special device, block special
device, FIFO, or socket.
:param filename: Name of the file
:returns: True if the file is a special file. False, if is not.
... | [
"def",
"is_special_file",
"(",
"cls",
",",
"filename",
")",
":",
"# If it does not exist, it must be a new file so it cannot be",
"# a special file.",
"if",
"not",
"os",
".",
"path",
".",
"exists",
"(",
"filename",
")",
":",
"return",
"False",
"mode",
"=",
"os",
"... | https://github.com/aws/lumberyard/blob/f85344403c1c2e77ec8c75deb2c116e97b713217/dev/Tools/Python/3.7.10/linux_x64/lib/python3.7/site-packages/s3transfer/utils.py#L275-L302 | |
catboost/catboost | 167f64f237114a4d10b2b4ee42adb4569137debe | contrib/tools/cython/Cython/Compiler/PyrexTypes.py | python | BaseType.deduce_template_params | (self, actual) | return {} | Deduce any template params in this (argument) type given the actual
argument type.
http://en.cppreference.com/w/cpp/language/function_template#Template_argument_deduction | Deduce any template params in this (argument) type given the actual
argument type. | [
"Deduce",
"any",
"template",
"params",
"in",
"this",
"(",
"argument",
")",
"type",
"given",
"the",
"actual",
"argument",
"type",
"."
] | def deduce_template_params(self, actual):
"""
Deduce any template params in this (argument) type given the actual
argument type.
http://en.cppreference.com/w/cpp/language/function_template#Template_argument_deduction
"""
return {} | [
"def",
"deduce_template_params",
"(",
"self",
",",
"actual",
")",
":",
"return",
"{",
"}"
] | https://github.com/catboost/catboost/blob/167f64f237114a4d10b2b4ee42adb4569137debe/contrib/tools/cython/Cython/Compiler/PyrexTypes.py#L113-L120 | |
hakuna-m/wubiuefi | caec1af0a09c78fd5a345180ada1fe45e0c63493 | src/openpgp/sap/api.py | python | verify_str | (signed, keys, **kw) | Verify signed a signed string.
:Parameters:
- `signed`: string containing signed messages or detached signatures
- `keys`: string containing one or more public keys
:Keywords:
- `detached`: str detached data - outside data that may be the target
of detached signatures
... | Verify signed a signed string. | [
"Verify",
"signed",
"a",
"signed",
"string",
"."
] | def verify_str(signed, keys, **kw):
"""Verify signed a signed string.
:Parameters:
- `signed`: string containing signed messages or detached signatures
- `keys`: string containing one or more public keys
:Keywords:
- `detached`: str detached data - outside data that may be the targ... | [
"def",
"verify_str",
"(",
"signed",
",",
"keys",
",",
"*",
"*",
"kw",
")",
":",
"saplog",
"=",
"logging",
".",
"getLogger",
"(",
"\"saplog\"",
")",
"keys",
"=",
"_filter_msgs",
"(",
"list_as_signed",
"(",
"keys",
")",
",",
"MSG_KEYS",
")",
"det",
"=",
... | https://github.com/hakuna-m/wubiuefi/blob/caec1af0a09c78fd5a345180ada1fe45e0c63493/src/openpgp/sap/api.py#L1151-L1233 | ||
AstarLight/Lets_OCR | b2af7120a34d785434c96e820b6eb1aa69269d20 | recognizer/crnn/lib/create_lmdb_dataset.py | python | createDataset | (outputPath, imagePathList, labelList, lexiconList=None, checkValid=True) | Create LMDB dataset for CRNN training.
ARGS:
outputPath : LMDB output path
imagePathList : list of image path
labelList : list of corresponding groundtruth texts
lexiconList : (optional) list of lexicon lists
checkValid : if true, check the validity of every image | Create LMDB dataset for CRNN training.
ARGS:
outputPath : LMDB output path
imagePathList : list of image path
labelList : list of corresponding groundtruth texts
lexiconList : (optional) list of lexicon lists
checkValid : if true, check the validity of every image | [
"Create",
"LMDB",
"dataset",
"for",
"CRNN",
"training",
".",
"ARGS",
":",
"outputPath",
":",
"LMDB",
"output",
"path",
"imagePathList",
":",
"list",
"of",
"image",
"path",
"labelList",
":",
"list",
"of",
"corresponding",
"groundtruth",
"texts",
"lexiconList",
... | def createDataset(outputPath, imagePathList, labelList, lexiconList=None, checkValid=True):
"""
Create LMDB dataset for CRNN training.
ARGS:
outputPath : LMDB output path
imagePathList : list of image path
labelList : list of corresponding groundtruth texts
lexiconList... | [
"def",
"createDataset",
"(",
"outputPath",
",",
"imagePathList",
",",
"labelList",
",",
"lexiconList",
"=",
"None",
",",
"checkValid",
"=",
"True",
")",
":",
"assert",
"(",
"len",
"(",
"imagePathList",
")",
"==",
"len",
"(",
"labelList",
")",
")",
"nSample... | https://github.com/AstarLight/Lets_OCR/blob/b2af7120a34d785434c96e820b6eb1aa69269d20/recognizer/crnn/lib/create_lmdb_dataset.py#L33-L80 | ||
wxWidgets/wxPython-Classic | 19571e1ae65f1ac445f5491474121998c97a1bf0 | src/msw/propgrid.py | python | PropertyGridEvent.GetPropertyName | (*args, **kwargs) | return _propgrid.PropertyGridEvent_GetPropertyName(*args, **kwargs) | GetPropertyName(self) -> String | GetPropertyName(self) -> String | [
"GetPropertyName",
"(",
"self",
")",
"-",
">",
"String"
] | def GetPropertyName(*args, **kwargs):
"""GetPropertyName(self) -> String"""
return _propgrid.PropertyGridEvent_GetPropertyName(*args, **kwargs) | [
"def",
"GetPropertyName",
"(",
"*",
"args",
",",
"*",
"*",
"kwargs",
")",
":",
"return",
"_propgrid",
".",
"PropertyGridEvent_GetPropertyName",
"(",
"*",
"args",
",",
"*",
"*",
"kwargs",
")"
] | https://github.com/wxWidgets/wxPython-Classic/blob/19571e1ae65f1ac445f5491474121998c97a1bf0/src/msw/propgrid.py#L2532-L2534 | |
hanpfei/chromium-net | 392cc1fa3a8f92f42e4071ab6e674d8e0482f83f | third_party/catapult/third_party/gsutil/third_party/boto/boto/ec2/elb/__init__.py | python | ELBConnection.delete_load_balancer_listeners | (self, name, ports) | return self.get_status('DeleteLoadBalancerListeners', params) | Deletes a load balancer listener (or group of listeners)
:type name: string
:param name: The name of the load balancer to create the listeners for
:type ports: List int
:param ports: Each int represents the port on the ELB to be removed
:return: The status of the request | Deletes a load balancer listener (or group of listeners) | [
"Deletes",
"a",
"load",
"balancer",
"listener",
"(",
"or",
"group",
"of",
"listeners",
")"
] | def delete_load_balancer_listeners(self, name, ports):
"""
Deletes a load balancer listener (or group of listeners)
:type name: string
:param name: The name of the load balancer to create the listeners for
:type ports: List int
:param ports: Each int represents the port... | [
"def",
"delete_load_balancer_listeners",
"(",
"self",
",",
"name",
",",
"ports",
")",
":",
"params",
"=",
"{",
"'LoadBalancerName'",
":",
"name",
"}",
"for",
"index",
",",
"port",
"in",
"enumerate",
"(",
"ports",
")",
":",
"params",
"[",
"'LoadBalancerPorts.... | https://github.com/hanpfei/chromium-net/blob/392cc1fa3a8f92f42e4071ab6e674d8e0482f83f/third_party/catapult/third_party/gsutil/third_party/boto/boto/ec2/elb/__init__.py#L327-L342 | |
benoitsteiner/tensorflow-opencl | cb7cb40a57fde5cfd4731bc551e82a1e2fef43a5 | tensorflow/contrib/tpu/python/tpu/tpu_sharding.py | python | ShardingPolicy._unshard_shape | (self, shape) | return tensor_shape.as_shape(dims) | Return the unsharded shape that would generate a given sharded shape.
Args:
shape: the sharded shape to unshard
Returns:
The unsharded shape.
Raises:
ValueError: if shape is unknown or does not contain
self.shard_dimension
TypeError: if shape is not convertible to a Tensor... | Return the unsharded shape that would generate a given sharded shape. | [
"Return",
"the",
"unsharded",
"shape",
"that",
"would",
"generate",
"a",
"given",
"sharded",
"shape",
"."
] | def _unshard_shape(self, shape):
"""Return the unsharded shape that would generate a given sharded shape.
Args:
shape: the sharded shape to unshard
Returns:
The unsharded shape.
Raises:
ValueError: if shape is unknown or does not contain
self.shard_dimension
TypeError:... | [
"def",
"_unshard_shape",
"(",
"self",
",",
"shape",
")",
":",
"shape",
"=",
"tensor_shape",
".",
"as_shape",
"(",
"shape",
")",
"if",
"self",
".",
"_number_of_shards",
"==",
"1",
":",
"# Don't do anything when there's only one shard.",
"return",
"shape",
"ndims",
... | https://github.com/benoitsteiner/tensorflow-opencl/blob/cb7cb40a57fde5cfd4731bc551e82a1e2fef43a5/tensorflow/contrib/tpu/python/tpu/tpu_sharding.py#L191-L217 | |
cyberbotics/webots | af7fa7d68dcf7b4550f1f2e132092b41e83698fc | resources/osm_importer/utils/vector.py | python | Vector2D.__mul__ | (self, other) | Multiply the vector with another. | Multiply the vector with another. | [
"Multiply",
"the",
"vector",
"with",
"another",
"."
] | def __mul__(self, other):
"""Multiply the vector with another."""
if isinstance(other, Vector2D):
# Dot product
return self.x * other.x + self.y * other.y
elif isinstance(other, float):
# Scalar product
return Vector2D(self.x * other, self.y * ot... | [
"def",
"__mul__",
"(",
"self",
",",
"other",
")",
":",
"if",
"isinstance",
"(",
"other",
",",
"Vector2D",
")",
":",
"# Dot product",
"return",
"self",
".",
"x",
"*",
"other",
".",
"x",
"+",
"self",
".",
"y",
"*",
"other",
".",
"y",
"elif",
"isinst... | https://github.com/cyberbotics/webots/blob/af7fa7d68dcf7b4550f1f2e132092b41e83698fc/resources/osm_importer/utils/vector.py#L52-L61 | ||
OAID/Tengine | 66b2c22ad129d25e2fc6de3b22a608bb54dd90db | pytengine/tengine/node.py | python | Node.__op__ | (self) | return _LIB.get_node_op(ctypes.c_void_p(self.node)) | Get the node op.
:return: The op name, None on error. | Get the node op.
:return: The op name, None on error. | [
"Get",
"the",
"node",
"op",
".",
":",
"return",
":",
"The",
"op",
"name",
"None",
"on",
"error",
"."
] | def __op__(self):
"""
Get the node op.
:return: The op name, None on error.
"""
_LIB.get_node_op.restype = ctypes.c_char_p
return _LIB.get_node_op(ctypes.c_void_p(self.node)) | [
"def",
"__op__",
"(",
"self",
")",
":",
"_LIB",
".",
"get_node_op",
".",
"restype",
"=",
"ctypes",
".",
"c_char_p",
"return",
"_LIB",
".",
"get_node_op",
"(",
"ctypes",
".",
"c_void_p",
"(",
"self",
".",
"node",
")",
")"
] | https://github.com/OAID/Tengine/blob/66b2c22ad129d25e2fc6de3b22a608bb54dd90db/pytengine/tengine/node.py#L47-L53 | |
ufal/udpipe | e51f02d2744cdfd4a29efc1320644ea04d535f0b | doc/t2t_docsys/txt2tags.py | python | TitleMaster._open_close_blocks | (self) | Open new title blocks, closing the previous (if any) | Open new title blocks, closing the previous (if any) | [
"Open",
"new",
"title",
"blocks",
"closing",
"the",
"previous",
"(",
"if",
"any",
")"
] | def _open_close_blocks(self):
"Open new title blocks, closing the previous (if any)"
if not rules['titleblocks']: return
tag = ''
last = self.last_level
curr = self.level
# Same level, just close the previous
if curr == last:
tag = TAGS.get('title%dClose'%last)
if tag: self.tag_hold.append(tag)
... | [
"def",
"_open_close_blocks",
"(",
"self",
")",
":",
"if",
"not",
"rules",
"[",
"'titleblocks'",
"]",
":",
"return",
"tag",
"=",
"''",
"last",
"=",
"self",
".",
"last_level",
"curr",
"=",
"self",
".",
"level",
"# Same level, just close the previous",
"if",
"c... | https://github.com/ufal/udpipe/blob/e51f02d2744cdfd4a29efc1320644ea04d535f0b/doc/t2t_docsys/txt2tags.py#L3222-L3265 | ||
ideawu/ssdb | f229ba277c7f7d0ca5a441c0c6fb3d1209af68e4 | deps/cpy/antlr3/tree.py | python | BaseTree.toString | (self) | Override to say how a node (not a tree) should look as text | Override to say how a node (not a tree) should look as text | [
"Override",
"to",
"say",
"how",
"a",
"node",
"(",
"not",
"a",
"tree",
")",
"should",
"look",
"as",
"text"
] | def toString(self):
"""Override to say how a node (not a tree) should look as text"""
raise NotImplementedError | [
"def",
"toString",
"(",
"self",
")",
":",
"raise",
"NotImplementedError"
] | https://github.com/ideawu/ssdb/blob/f229ba277c7f7d0ca5a441c0c6fb3d1209af68e4/deps/cpy/antlr3/tree.py#L898-L901 | ||
catboost/catboost | 167f64f237114a4d10b2b4ee42adb4569137debe | contrib/python/scipy/py2/scipy/signal/ltisys.py | python | TransferFunction.num | (self) | return self._num | Numerator of the `TransferFunction` system. | Numerator of the `TransferFunction` system. | [
"Numerator",
"of",
"the",
"TransferFunction",
"system",
"."
] | def num(self):
"""Numerator of the `TransferFunction` system."""
return self._num | [
"def",
"num",
"(",
"self",
")",
":",
"return",
"self",
".",
"_num"
] | https://github.com/catboost/catboost/blob/167f64f237114a4d10b2b4ee42adb4569137debe/contrib/python/scipy/py2/scipy/signal/ltisys.py#L604-L606 | |
freelan-developers/freelan | 779a1421adbbfa35568cea9b212d1ba0635570e1 | packaging/windows/innosetup.py | python | get_config | (source, env) | return config | Get a configuration from the specified source. | Get a configuration from the specified source. | [
"Get",
"a",
"configuration",
"from",
"the",
"specified",
"source",
"."
] | def get_config(source, env):
"""Get a configuration from the specified source."""
import configparser
from io import StringIO
config = configparser.ConfigParser(strict=False)
config.readfp(
StringIO(replace_defines(source.get_contents().decode(), env['ISCC_DEFINES'])))
return config | [
"def",
"get_config",
"(",
"source",
",",
"env",
")",
":",
"import",
"configparser",
"from",
"io",
"import",
"StringIO",
"config",
"=",
"configparser",
".",
"ConfigParser",
"(",
"strict",
"=",
"False",
")",
"config",
".",
"readfp",
"(",
"StringIO",
"(",
"re... | https://github.com/freelan-developers/freelan/blob/779a1421adbbfa35568cea9b212d1ba0635570e1/packaging/windows/innosetup.py#L59-L69 | |
ChromiumWebApps/chromium | c7361d39be8abd1574e6ce8957c8dbddd4c6ccf7 | third_party/google_appengine_cloudstorage/cloudstorage/api_utils.py | python | _quote_filename | (filename) | return urllib.quote(filename) | Quotes filename to use as a valid URI path.
Args:
filename: user provided filename. /bucket/filename.
Returns:
The filename properly quoted to use as URI's path component. | Quotes filename to use as a valid URI path. | [
"Quotes",
"filename",
"to",
"use",
"as",
"a",
"valid",
"URI",
"path",
"."
] | def _quote_filename(filename):
"""Quotes filename to use as a valid URI path.
Args:
filename: user provided filename. /bucket/filename.
Returns:
The filename properly quoted to use as URI's path component.
"""
return urllib.quote(filename) | [
"def",
"_quote_filename",
"(",
"filename",
")",
":",
"return",
"urllib",
".",
"quote",
"(",
"filename",
")"
] | https://github.com/ChromiumWebApps/chromium/blob/c7361d39be8abd1574e6ce8957c8dbddd4c6ccf7/third_party/google_appengine_cloudstorage/cloudstorage/api_utils.py#L74-L83 | |
trailofbits/llvm-sanitizer-tutorial | d29dfeec7f51fbf234fd0080f28f2b30cd0b6e99 | llvm/bindings/python/llvm/core.py | python | LLVMEnumeration.from_value | (cls, value) | return result | Obtain an enumeration instance from a numeric value. | Obtain an enumeration instance from a numeric value. | [
"Obtain",
"an",
"enumeration",
"instance",
"from",
"a",
"numeric",
"value",
"."
] | def from_value(cls, value):
"""Obtain an enumeration instance from a numeric value."""
result = cls._value_map.get(value, None)
if result is None:
raise ValueError('Unknown %s: %d' % (cls.__name__,
value))
return result | [
"def",
"from_value",
"(",
"cls",
",",
"value",
")",
":",
"result",
"=",
"cls",
".",
"_value_map",
".",
"get",
"(",
"value",
",",
"None",
")",
"if",
"result",
"is",
"None",
":",
"raise",
"ValueError",
"(",
"'Unknown %s: %d'",
"%",
"(",
"cls",
".",
"__... | https://github.com/trailofbits/llvm-sanitizer-tutorial/blob/d29dfeec7f51fbf234fd0080f28f2b30cd0b6e99/llvm/bindings/python/llvm/core.py#L53-L61 | |
bulletphysics/bullet3 | f0f2a952e146f016096db6f85cf0c44ed75b0b9a | examples/pybullet/gym/pybullet_envs/agents/tools/in_graph_batch_env.py | python | InGraphBatchEnv._parse_shape | (self, space) | Get a tensor shape from a OpenAI Gym space.
Args:
space: Gym space.
Returns:
Shape tuple. | Get a tensor shape from a OpenAI Gym space. | [
"Get",
"a",
"tensor",
"shape",
"from",
"a",
"OpenAI",
"Gym",
"space",
"."
] | def _parse_shape(self, space):
"""Get a tensor shape from a OpenAI Gym space.
Args:
space: Gym space.
Returns:
Shape tuple.
"""
if isinstance(space, gym.spaces.Discrete):
return ()
if isinstance(space, gym.spaces.Box):
return space.shape
raise NotImplementedError() | [
"def",
"_parse_shape",
"(",
"self",
",",
"space",
")",
":",
"if",
"isinstance",
"(",
"space",
",",
"gym",
".",
"spaces",
".",
"Discrete",
")",
":",
"return",
"(",
")",
"if",
"isinstance",
"(",
"space",
",",
"gym",
".",
"spaces",
".",
"Box",
")",
":... | https://github.com/bulletphysics/bullet3/blob/f0f2a952e146f016096db6f85cf0c44ed75b0b9a/examples/pybullet/gym/pybullet_envs/agents/tools/in_graph_batch_env.py#L149-L162 | ||
tensorflow/tensorflow | 419e3a6b650ea4bd1b0cba23c4348f8a69f3272e | tensorflow/python/ops/special_math_ops.py | python | bessel_k0 | (x, name=None) | Computes the Bessel k0 function of `x` element-wise.
Modified Bessel function of order 0.
It is preferable to use the numerically stabler function `k0e(x)` instead.
>>> tf.math.special.bessel_k0([0.5, 1., 2., 4.]).numpy()
array([0.92441907, 0.42102444, 0.11389387, 0.01115968], dtype=float32)
Args:
x: ... | Computes the Bessel k0 function of `x` element-wise. | [
"Computes",
"the",
"Bessel",
"k0",
"function",
"of",
"x",
"element",
"-",
"wise",
"."
] | def bessel_k0(x, name=None):
"""Computes the Bessel k0 function of `x` element-wise.
Modified Bessel function of order 0.
It is preferable to use the numerically stabler function `k0e(x)` instead.
>>> tf.math.special.bessel_k0([0.5, 1., 2., 4.]).numpy()
array([0.92441907, 0.42102444, 0.11389387, 0.01115968... | [
"def",
"bessel_k0",
"(",
"x",
",",
"name",
"=",
"None",
")",
":",
"with",
"ops",
".",
"name_scope",
"(",
"name",
",",
"'bessel_k0'",
",",
"[",
"x",
"]",
")",
":",
"return",
"gen_special_math_ops",
".",
"bessel_k0",
"(",
"x",
")"
] | https://github.com/tensorflow/tensorflow/blob/419e3a6b650ea4bd1b0cba23c4348f8a69f3272e/tensorflow/python/ops/special_math_ops.py#L367-L390 | ||
Xilinx/Vitis-AI | fc74d404563d9951b57245443c73bef389f3657f | tools/Vitis-AI-Quantizer/vai_q_tensorflow1.x/tensorflow/python/tpu/tensor_tracer.py | python | TensorTracer.__init__ | (self) | Initializes a TensorTracer.
Sets the various member fields from the flags (if given) or the defaults. | Initializes a TensorTracer. | [
"Initializes",
"a",
"TensorTracer",
"."
] | def __init__(self):
"""Initializes a TensorTracer.
Sets the various member fields from the flags (if given) or the defaults.
"""
self._replica_id = None
self._tt_config = tensor_tracer_report.TensorTracerConfig()
self._parameters = tensor_tracer_flags.TTParameters()
self._included_op_full_n... | [
"def",
"__init__",
"(",
"self",
")",
":",
"self",
".",
"_replica_id",
"=",
"None",
"self",
".",
"_tt_config",
"=",
"tensor_tracer_report",
".",
"TensorTracerConfig",
"(",
")",
"self",
".",
"_parameters",
"=",
"tensor_tracer_flags",
".",
"TTParameters",
"(",
")... | https://github.com/Xilinx/Vitis-AI/blob/fc74d404563d9951b57245443c73bef389f3657f/tools/Vitis-AI-Quantizer/vai_q_tensorflow1.x/tensorflow/python/tpu/tensor_tracer.py#L327-L337 | ||
catboost/catboost | 167f64f237114a4d10b2b4ee42adb4569137debe | contrib/python/setuptools/py3/setuptools/_distutils/cmd.py | python | Command.ensure_string | (self, option, default=None) | Ensure that 'option' is a string; if not defined, set it to
'default'. | Ensure that 'option' is a string; if not defined, set it to
'default'. | [
"Ensure",
"that",
"option",
"is",
"a",
"string",
";",
"if",
"not",
"defined",
"set",
"it",
"to",
"default",
"."
] | def ensure_string(self, option, default=None):
"""Ensure that 'option' is a string; if not defined, set it to
'default'.
"""
self._ensure_stringlike(option, "string", default) | [
"def",
"ensure_string",
"(",
"self",
",",
"option",
",",
"default",
"=",
"None",
")",
":",
"self",
".",
"_ensure_stringlike",
"(",
"option",
",",
"\"string\"",
",",
"default",
")"
] | https://github.com/catboost/catboost/blob/167f64f237114a4d10b2b4ee42adb4569137debe/contrib/python/setuptools/py3/setuptools/_distutils/cmd.py#L217-L221 | ||
PaddlePaddle/PaddleOCR | b756bf5f8c90142e0d89d3db0163965c686b6ffe | ppstructure/table/tablepyxl/style.py | python | Table.__init__ | (self, table) | takes an html table object (from lxml) | takes an html table object (from lxml) | [
"takes",
"an",
"html",
"table",
"object",
"(",
"from",
"lxml",
")"
] | def __init__(self, table):
"""
takes an html table object (from lxml)
"""
super(Table, self).__init__(table)
table_head = table.find('thead')
self.head = TableHead(table_head, parent=self) if table_head is not None else None
table_body = table.find('tbody')
... | [
"def",
"__init__",
"(",
"self",
",",
"table",
")",
":",
"super",
"(",
"Table",
",",
"self",
")",
".",
"__init__",
"(",
"table",
")",
"table_head",
"=",
"table",
".",
"find",
"(",
"'thead'",
")",
"self",
".",
"head",
"=",
"TableHead",
"(",
"table_head... | https://github.com/PaddlePaddle/PaddleOCR/blob/b756bf5f8c90142e0d89d3db0163965c686b6ffe/ppstructure/table/tablepyxl/style.py#L182-L190 | ||
Yelp/MOE | 5b5a6a2c6c3cf47320126f7f5894e2a83e347f5c | moe/views/rest/gp_next_points_constant_liar.py | python | GpNextPointsConstantLiar.pretty_view | (self) | return self.pretty_response() | A pretty, browser interactive view for the interface. Includes form request and response.
.. http:get:: /gp/next_points/constant_liar/pretty | A pretty, browser interactive view for the interface. Includes form request and response. | [
"A",
"pretty",
"browser",
"interactive",
"view",
"for",
"the",
"interface",
".",
"Includes",
"form",
"request",
"and",
"response",
"."
] | def pretty_view(self):
"""A pretty, browser interactive view for the interface. Includes form request and response.
.. http:get:: /gp/next_points/constant_liar/pretty
"""
return self.pretty_response() | [
"def",
"pretty_view",
"(",
"self",
")",
":",
"return",
"self",
".",
"pretty_response",
"(",
")"
] | https://github.com/Yelp/MOE/blob/5b5a6a2c6c3cf47320126f7f5894e2a83e347f5c/moe/views/rest/gp_next_points_constant_liar.py#L40-L46 | |
wlanjie/AndroidFFmpeg | 7baf9122f4b8e1c74e7baf4be5c422c7a5ba5aaf | tools/fdk-aac-build/armeabi/toolchain/lib/python2.7/plat-mac/lib-scriptpackages/CodeWarrior/Metrowerks_Shell_Suite.py | python | Metrowerks_Shell_Suite_Events.Touch | (self, _object, _attributes={}, **_arguments) | Touch: Force recompilation of the specified file(s)
Required argument: List of files to compile
Keyword argument _attributes: AppleEvent attribute dictionary
Returns: Error code for each file touched | Touch: Force recompilation of the specified file(s)
Required argument: List of files to compile
Keyword argument _attributes: AppleEvent attribute dictionary
Returns: Error code for each file touched | [
"Touch",
":",
"Force",
"recompilation",
"of",
"the",
"specified",
"file",
"(",
"s",
")",
"Required",
"argument",
":",
"List",
"of",
"files",
"to",
"compile",
"Keyword",
"argument",
"_attributes",
":",
"AppleEvent",
"attribute",
"dictionary",
"Returns",
":",
"E... | def Touch(self, _object, _attributes={}, **_arguments):
"""Touch: Force recompilation of the specified file(s)
Required argument: List of files to compile
Keyword argument _attributes: AppleEvent attribute dictionary
Returns: Error code for each file touched
"""
_code = '... | [
"def",
"Touch",
"(",
"self",
",",
"_object",
",",
"_attributes",
"=",
"{",
"}",
",",
"*",
"*",
"_arguments",
")",
":",
"_code",
"=",
"'MMPR'",
"_subcode",
"=",
"'Toch'",
"if",
"_arguments",
":",
"raise",
"TypeError",
",",
"'No optional args expected'",
"_a... | https://github.com/wlanjie/AndroidFFmpeg/blob/7baf9122f4b8e1c74e7baf4be5c422c7a5ba5aaf/tools/fdk-aac-build/armeabi/toolchain/lib/python2.7/plat-mac/lib-scriptpackages/CodeWarrior/Metrowerks_Shell_Suite.py#L746-L765 | ||
hughperkins/tf-coriander | 970d3df6c11400ad68405f22b0c42a52374e94ca | tensorflow/python/training/monitored_session.py | python | MonitoredSession.run | (self, fetches, feed_dict=None, options=None, run_metadata=None) | return self._sess.run(fetches,
feed_dict=feed_dict,
options=options,
run_metadata=run_metadata) | Run ops in the monitored session.
This method is completely compatible with the `tf.Session.run()` method.
Args:
fetches: Same as `tf.Session.run()`.
feed_dict: Same as `tf.Session.run()`.
options: Same as `tf.Session.run()`.
run_metadata: Same as `tf.Session.run()`.
Returns:
... | Run ops in the monitored session. | [
"Run",
"ops",
"in",
"the",
"monitored",
"session",
"."
] | def run(self, fetches, feed_dict=None, options=None, run_metadata=None):
"""Run ops in the monitored session.
This method is completely compatible with the `tf.Session.run()` method.
Args:
fetches: Same as `tf.Session.run()`.
feed_dict: Same as `tf.Session.run()`.
options: Same as `tf.Se... | [
"def",
"run",
"(",
"self",
",",
"fetches",
",",
"feed_dict",
"=",
"None",
",",
"options",
"=",
"None",
",",
"run_metadata",
"=",
"None",
")",
":",
"return",
"self",
".",
"_sess",
".",
"run",
"(",
"fetches",
",",
"feed_dict",
"=",
"feed_dict",
",",
"o... | https://github.com/hughperkins/tf-coriander/blob/970d3df6c11400ad68405f22b0c42a52374e94ca/tensorflow/python/training/monitored_session.py#L416-L433 | |
hanpfei/chromium-net | 392cc1fa3a8f92f42e4071ab6e674d8e0482f83f | third_party/catapult/third_party/closure_linter/closure_linter/typeannotation.py | python | TypeAnnotation.IsRecordType | (self) | return (self.record_type or
any(t.IsRecordType() for t in self.sub_types)) | Returns True if this type is a record type. | Returns True if this type is a record type. | [
"Returns",
"True",
"if",
"this",
"type",
"is",
"a",
"record",
"type",
"."
] | def IsRecordType(self):
"""Returns True if this type is a record type."""
return (self.record_type or
any(t.IsRecordType() for t in self.sub_types)) | [
"def",
"IsRecordType",
"(",
"self",
")",
":",
"return",
"(",
"self",
".",
"record_type",
"or",
"any",
"(",
"t",
".",
"IsRecordType",
"(",
")",
"for",
"t",
"in",
"self",
".",
"sub_types",
")",
")"
] | https://github.com/hanpfei/chromium-net/blob/392cc1fa3a8f92f42e4071ab6e674d8e0482f83f/third_party/catapult/third_party/closure_linter/closure_linter/typeannotation.py#L84-L87 | |
wxWidgets/wxPython-Classic | 19571e1ae65f1ac445f5491474121998c97a1bf0 | src/osx_carbon/combo.py | python | ComboCtrl.GetTextIndent | (*args, **kwargs) | return _combo.ComboCtrl_GetTextIndent(*args, **kwargs) | GetTextIndent(self) -> int
Returns actual indentation in pixels. | GetTextIndent(self) -> int | [
"GetTextIndent",
"(",
"self",
")",
"-",
">",
"int"
] | def GetTextIndent(*args, **kwargs):
"""
GetTextIndent(self) -> int
Returns actual indentation in pixels.
"""
return _combo.ComboCtrl_GetTextIndent(*args, **kwargs) | [
"def",
"GetTextIndent",
"(",
"*",
"args",
",",
"*",
"*",
"kwargs",
")",
":",
"return",
"_combo",
".",
"ComboCtrl_GetTextIndent",
"(",
"*",
"args",
",",
"*",
"*",
"kwargs",
")"
] | https://github.com/wxWidgets/wxPython-Classic/blob/19571e1ae65f1ac445f5491474121998c97a1bf0/src/osx_carbon/combo.py#L369-L375 | |
catboost/catboost | 167f64f237114a4d10b2b4ee42adb4569137debe | contrib/tools/python/src/Lib/rfc822.py | python | Message.getaddr | (self, name) | Get a single address from a header, as a tuple.
An example return value:
('Guido van Rossum', 'guido@cwi.nl') | Get a single address from a header, as a tuple. | [
"Get",
"a",
"single",
"address",
"from",
"a",
"header",
"as",
"a",
"tuple",
"."
] | def getaddr(self, name):
"""Get a single address from a header, as a tuple.
An example return value:
('Guido van Rossum', 'guido@cwi.nl')
"""
# New, by Ben Escoto
alist = self.getaddrlist(name)
if alist:
return alist[0]
else:
retur... | [
"def",
"getaddr",
"(",
"self",
",",
"name",
")",
":",
"# New, by Ben Escoto",
"alist",
"=",
"self",
".",
"getaddrlist",
"(",
"name",
")",
"if",
"alist",
":",
"return",
"alist",
"[",
"0",
"]",
"else",
":",
"return",
"(",
"None",
",",
"None",
")"
] | https://github.com/catboost/catboost/blob/167f64f237114a4d10b2b4ee42adb4569137debe/contrib/tools/python/src/Lib/rfc822.py#L325-L336 | ||
NeoGeographyToolkit/StereoPipeline | eedf54a919fb5cce1ab0e280bb0df4050763aa11 | src/asp/IceBridge/regenerate_summary_images.py | python | getMissingSummaryFiles | (folder, summaryFolder, isOrtho) | return missingSummaryList | Return a list of input/output pairs of missing summary files. | Return a list of input/output pairs of missing summary files. | [
"Return",
"a",
"list",
"of",
"input",
"/",
"output",
"pairs",
"of",
"missing",
"summary",
"files",
"."
] | def getMissingSummaryFiles(folder, summaryFolder, isOrtho):
'''Return a list of input/output pairs of missing summary files.'''
print 'Looking for missing summary files for folder: ' + folder
inFiles = getUnpackedFiles(folder)
summaryFiles = os.listdir(summaryFolder)
# Handle DEM and ORTHO b... | [
"def",
"getMissingSummaryFiles",
"(",
"folder",
",",
"summaryFolder",
",",
"isOrtho",
")",
":",
"print",
"'Looking for missing summary files for folder: '",
"+",
"folder",
"inFiles",
"=",
"getUnpackedFiles",
"(",
"folder",
")",
"summaryFiles",
"=",
"os",
".",
"listdir... | https://github.com/NeoGeographyToolkit/StereoPipeline/blob/eedf54a919fb5cce1ab0e280bb0df4050763aa11/src/asp/IceBridge/regenerate_summary_images.py#L238-L295 | |
mantidproject/mantid | 03deeb89254ec4289edb8771e0188c2090a02f32 | qt/python/mantidqtinterfaces/mantidqtinterfaces/drill/view/DrillView.py | python | DrillView.helpWindow | (self) | Popup the help window. | Popup the help window. | [
"Popup",
"the",
"help",
"window",
"."
] | def helpWindow(self):
"""
Popup the help window.
"""
from mantidqt.gui_helper import show_interface_help
show_interface_help("DrILL",self.assistant_process,area="ILL") | [
"def",
"helpWindow",
"(",
"self",
")",
":",
"from",
"mantidqt",
".",
"gui_helper",
"import",
"show_interface_help",
"show_interface_help",
"(",
"\"DrILL\"",
",",
"self",
".",
"assistant_process",
",",
"area",
"=",
"\"ILL\"",
")"
] | https://github.com/mantidproject/mantid/blob/03deeb89254ec4289edb8771e0188c2090a02f32/qt/python/mantidqtinterfaces/mantidqtinterfaces/drill/view/DrillView.py#L391-L396 | ||
llvm/llvm-project | ffa6262cb4e2a335d26416fad39a581b4f98c5f4 | clang/tools/scan-build-py/lib/libscanbuild/__init__.py | python | duplicate_check | (method) | return predicate | Predicate to detect duplicated entries.
Unique hash method can be use to detect duplicates. Entries are
represented as dictionaries, which has no default hash method.
This implementation uses a set datatype to store the unique hash values.
This method returns a method which can detect the duplicate va... | Predicate to detect duplicated entries. | [
"Predicate",
"to",
"detect",
"duplicated",
"entries",
"."
] | def duplicate_check(method):
""" Predicate to detect duplicated entries.
Unique hash method can be use to detect duplicates. Entries are
represented as dictionaries, which has no default hash method.
This implementation uses a set datatype to store the unique hash values.
This method returns a met... | [
"def",
"duplicate_check",
"(",
"method",
")",
":",
"def",
"predicate",
"(",
"entry",
")",
":",
"entry_hash",
"=",
"predicate",
".",
"unique",
"(",
"entry",
")",
"if",
"entry_hash",
"not",
"in",
"predicate",
".",
"state",
":",
"predicate",
".",
"state",
"... | https://github.com/llvm/llvm-project/blob/ffa6262cb4e2a335d26416fad39a581b4f98c5f4/clang/tools/scan-build-py/lib/libscanbuild/__init__.py#L25-L43 | |
aws/lumberyard | f85344403c1c2e77ec8c75deb2c116e97b713217 | dev/Tools/Python/3.7.10/windows/Lib/site-packages/pip/_vendor/urllib3/response.py | python | HTTPResponse._error_catcher | (self) | Catch low-level python exceptions, instead re-raising urllib3
variants, so that low-level exceptions are not leaked in the
high-level api.
On exit, release the connection back to the pool. | Catch low-level python exceptions, instead re-raising urllib3
variants, so that low-level exceptions are not leaked in the
high-level api. | [
"Catch",
"low",
"-",
"level",
"python",
"exceptions",
"instead",
"re",
"-",
"raising",
"urllib3",
"variants",
"so",
"that",
"low",
"-",
"level",
"exceptions",
"are",
"not",
"leaked",
"in",
"the",
"high",
"-",
"level",
"api",
"."
] | def _error_catcher(self):
"""
Catch low-level python exceptions, instead re-raising urllib3
variants, so that low-level exceptions are not leaked in the
high-level api.
On exit, release the connection back to the pool.
"""
clean_exit = False
try:
... | [
"def",
"_error_catcher",
"(",
"self",
")",
":",
"clean_exit",
"=",
"False",
"try",
":",
"try",
":",
"yield",
"except",
"SocketTimeout",
":",
"# FIXME: Ideally we'd like to include the url in the ReadTimeoutError but",
"# there is yet no clean way to get at it from this context.",... | https://github.com/aws/lumberyard/blob/f85344403c1c2e77ec8c75deb2c116e97b713217/dev/Tools/Python/3.7.10/windows/Lib/site-packages/pip/_vendor/urllib3/response.py#L426-L479 | ||
sdhash/sdhash | b9eff63e4e5867e910f41fd69032bbb1c94a2a5e | external/tools/build/v2/build/property.py | python | change | (properties, feature, value = None) | return result | Returns a modified version of properties with all values of the
given feature replaced by the given value.
If 'value' is None the feature will be removed. | Returns a modified version of properties with all values of the
given feature replaced by the given value.
If 'value' is None the feature will be removed. | [
"Returns",
"a",
"modified",
"version",
"of",
"properties",
"with",
"all",
"values",
"of",
"the",
"given",
"feature",
"replaced",
"by",
"the",
"given",
"value",
".",
"If",
"value",
"is",
"None",
"the",
"feature",
"will",
"be",
"removed",
"."
] | def change (properties, feature, value = None):
""" Returns a modified version of properties with all values of the
given feature replaced by the given value.
If 'value' is None the feature will be removed.
"""
result = []
feature = add_grist (feature)
for p in properties:
... | [
"def",
"change",
"(",
"properties",
",",
"feature",
",",
"value",
"=",
"None",
")",
":",
"result",
"=",
"[",
"]",
"feature",
"=",
"add_grist",
"(",
"feature",
")",
"for",
"p",
"in",
"properties",
":",
"if",
"get_grist",
"(",
"p",
")",
"==",
"feature"... | https://github.com/sdhash/sdhash/blob/b9eff63e4e5867e910f41fd69032bbb1c94a2a5e/external/tools/build/v2/build/property.py#L316-L333 | |
aws/lumberyard | f85344403c1c2e77ec8c75deb2c116e97b713217 | dev/Gems/CloudGemFramework/v1/AWS/common-code/lib/requests/_internal_utils.py | python | unicode_is_ascii | (u_string) | Determine if unicode string only contains ASCII characters.
:param str u_string: unicode string to check. Must be unicode
and not Python 2 `str`.
:rtype: bool | Determine if unicode string only contains ASCII characters. | [
"Determine",
"if",
"unicode",
"string",
"only",
"contains",
"ASCII",
"characters",
"."
] | def unicode_is_ascii(u_string):
"""Determine if unicode string only contains ASCII characters.
:param str u_string: unicode string to check. Must be unicode
and not Python 2 `str`.
:rtype: bool
"""
assert isinstance(u_string, str)
try:
u_string.encode('ascii')
return Tru... | [
"def",
"unicode_is_ascii",
"(",
"u_string",
")",
":",
"assert",
"isinstance",
"(",
"u_string",
",",
"str",
")",
"try",
":",
"u_string",
".",
"encode",
"(",
"'ascii'",
")",
"return",
"True",
"except",
"UnicodeEncodeError",
":",
"return",
"False"
] | https://github.com/aws/lumberyard/blob/f85344403c1c2e77ec8c75deb2c116e97b713217/dev/Gems/CloudGemFramework/v1/AWS/common-code/lib/requests/_internal_utils.py#L30-L42 | ||
wxWidgets/wxPython-Classic | 19571e1ae65f1ac445f5491474121998c97a1bf0 | src/gtk/richtext.py | python | RichTextObject.Merge | (self, obj, context) | return val | Merge(self, RichTextObject object) -> bool | Merge(self, RichTextObject object) -> bool | [
"Merge",
"(",
"self",
"RichTextObject",
"object",
")",
"-",
">",
"bool"
] | def Merge(self, obj, context):
"""Merge(self, RichTextObject object) -> bool"""
val = _richtext.RichTextObject_Merge(self, obj, context)
if val:
obj.this.own(True)
return val | [
"def",
"Merge",
"(",
"self",
",",
"obj",
",",
"context",
")",
":",
"val",
"=",
"_richtext",
".",
"RichTextObject_Merge",
"(",
"self",
",",
"obj",
",",
"context",
")",
"if",
"val",
":",
"obj",
".",
"this",
".",
"own",
"(",
"True",
")",
"return",
"va... | https://github.com/wxWidgets/wxPython-Classic/blob/19571e1ae65f1ac445f5491474121998c97a1bf0/src/gtk/richtext.py#L1242-L1247 | |
PyMesh/PyMesh | 384ba882b7558ba6e8653ed263c419226c22bddf | python/pymesh/wires/WireNetwork.py | python | WireNetwork.has_attribute | (self, name) | return self.raw_wires.has_attribute(name) | Check if an attribute exists. | Check if an attribute exists. | [
"Check",
"if",
"an",
"attribute",
"exists",
"."
] | def has_attribute(self, name):
""" Check if an attribute exists.
"""
return self.raw_wires.has_attribute(name) | [
"def",
"has_attribute",
"(",
"self",
",",
"name",
")",
":",
"return",
"self",
".",
"raw_wires",
".",
"has_attribute",
"(",
"name",
")"
] | https://github.com/PyMesh/PyMesh/blob/384ba882b7558ba6e8653ed263c419226c22bddf/python/pymesh/wires/WireNetwork.py#L218-L221 | |
catboost/catboost | 167f64f237114a4d10b2b4ee42adb4569137debe | contrib/python/scipy/py2/scipy/optimize/_root_scalar.py | python | _root_scalar_secant_doc | () | r"""
Options
-------
args : tuple, optional
Extra arguments passed to the objective function.
xtol : float, optional
Tolerance (absolute) for termination.
rtol : float, optional
Tolerance (relative) for termination.
maxiter : int, optional
Maximum number of iterat... | r"""
Options
-------
args : tuple, optional
Extra arguments passed to the objective function.
xtol : float, optional
Tolerance (absolute) for termination.
rtol : float, optional
Tolerance (relative) for termination.
maxiter : int, optional
Maximum number of iterat... | [
"r",
"Options",
"-------",
"args",
":",
"tuple",
"optional",
"Extra",
"arguments",
"passed",
"to",
"the",
"objective",
"function",
".",
"xtol",
":",
"float",
"optional",
"Tolerance",
"(",
"absolute",
")",
"for",
"termination",
".",
"rtol",
":",
"float",
"opt... | def _root_scalar_secant_doc():
r"""
Options
-------
args : tuple, optional
Extra arguments passed to the objective function.
xtol : float, optional
Tolerance (absolute) for termination.
rtol : float, optional
Tolerance (relative) for termination.
maxiter : int, option... | [
"def",
"_root_scalar_secant_doc",
"(",
")",
":",
"pass"
] | https://github.com/catboost/catboost/blob/167f64f237114a4d10b2b4ee42adb4569137debe/contrib/python/scipy/py2/scipy/optimize/_root_scalar.py#L345-L365 | ||
hanpfei/chromium-net | 392cc1fa3a8f92f42e4071ab6e674d8e0482f83f | tools/cygprofile/profile_android_startup.py | python | AndroidProfileTool._SetUpDevice | (self) | When profiling, files are output to the disk by every process. This
means running without sandboxing enabled. | When profiling, files are output to the disk by every process. This
means running without sandboxing enabled. | [
"When",
"profiling",
"files",
"are",
"output",
"to",
"the",
"disk",
"by",
"every",
"process",
".",
"This",
"means",
"running",
"without",
"sandboxing",
"enabled",
"."
] | def _SetUpDevice(self):
"""When profiling, files are output to the disk by every process. This
means running without sandboxing enabled.
"""
# We need to have adb root in order to pull cyglog data
try:
print 'Enabling root...'
self._device.EnableRoot()
# SELinux need to be in perm... | [
"def",
"_SetUpDevice",
"(",
"self",
")",
":",
"# We need to have adb root in order to pull cyglog data",
"try",
":",
"print",
"'Enabling root...'",
"self",
".",
"_device",
".",
"EnableRoot",
"(",
")",
"# SELinux need to be in permissive mode, otherwise the process cannot",
"# w... | https://github.com/hanpfei/chromium-net/blob/392cc1fa3a8f92f42e4071ab6e674d8e0482f83f/tools/cygprofile/profile_android_startup.py#L285-L300 | ||
Xilinx/Vitis-AI | fc74d404563d9951b57245443c73bef389f3657f | tools/Vitis-AI-Quantizer/vai_q_tensorflow1.x/tensorflow/python/keras/backend.py | python | random_normal_variable | (shape, mean, scale, dtype=None, name=None,
seed=None) | return variable(value, dtype=dtype, name=name) | Instantiates a variable with values drawn from a normal distribution.
Arguments:
shape: Tuple of integers, shape of returned Keras variable.
mean: Float, mean of the normal distribution.
scale: Float, standard deviation of the normal distribution.
dtype: String, dtype of returned Keras variab... | Instantiates a variable with values drawn from a normal distribution. | [
"Instantiates",
"a",
"variable",
"with",
"values",
"drawn",
"from",
"a",
"normal",
"distribution",
"."
] | def random_normal_variable(shape, mean, scale, dtype=None, name=None,
seed=None):
"""Instantiates a variable with values drawn from a normal distribution.
Arguments:
shape: Tuple of integers, shape of returned Keras variable.
mean: Float, mean of the normal distribution.
... | [
"def",
"random_normal_variable",
"(",
"shape",
",",
"mean",
",",
"scale",
",",
"dtype",
"=",
"None",
",",
"name",
"=",
"None",
",",
"seed",
"=",
"None",
")",
":",
"if",
"dtype",
"is",
"None",
":",
"dtype",
"=",
"floatx",
"(",
")",
"tf_dtype",
"=",
... | https://github.com/Xilinx/Vitis-AI/blob/fc74d404563d9951b57245443c73bef389f3657f/tools/Vitis-AI-Quantizer/vai_q_tensorflow1.x/tensorflow/python/keras/backend.py#L1476-L1510 | |
naver/sling | 5671cd445a2caae0b4dd0332299e4cfede05062c | webkit/Tools/Scripts/webkitpy/thirdparty/mod_pywebsocket/mux.py | python | _LogicalStream.__init__ | (self, request, stream_options, send_quota, receive_quota) | Constructs an instance.
Args:
request: _LogicalRequest instance.
stream_options: StreamOptions instance.
send_quota: Initial send quota.
receive_quota: Initial receive quota. | Constructs an instance. | [
"Constructs",
"an",
"instance",
"."
] | def __init__(self, request, stream_options, send_quota, receive_quota):
"""Constructs an instance.
Args:
request: _LogicalRequest instance.
stream_options: StreamOptions instance.
send_quota: Initial send quota.
receive_quota: Initial receive quota.
... | [
"def",
"__init__",
"(",
"self",
",",
"request",
",",
"stream_options",
",",
"send_quota",
",",
"receive_quota",
")",
":",
"# Physical stream is responsible for masking.",
"stream_options",
".",
"unmask_receive",
"=",
"False",
"Stream",
".",
"__init__",
"(",
"self",
... | https://github.com/naver/sling/blob/5671cd445a2caae0b4dd0332299e4cfede05062c/webkit/Tools/Scripts/webkitpy/thirdparty/mod_pywebsocket/mux.py#L813-L841 | ||
CRYTEK/CRYENGINE | 232227c59a220cbbd311576f0fbeba7bb53b2a8c | Code/Tools/waf-1.7.13/waflib/Context.py | python | Context.post_recurse | (self, node) | Restore ``self.cur_script`` and ``self.path`` right after :py:meth:`waflib.Context.Context.recurse` terminates.
:param node: script
:type node: :py:class:`waflib.Node.Node` | Restore ``self.cur_script`` and ``self.path`` right after :py:meth:`waflib.Context.Context.recurse` terminates. | [
"Restore",
"self",
".",
"cur_script",
"and",
"self",
".",
"path",
"right",
"after",
":",
"py",
":",
"meth",
":",
"waflib",
".",
"Context",
".",
"Context",
".",
"recurse",
"terminates",
"."
] | def post_recurse(self, node):
"""
Restore ``self.cur_script`` and ``self.path`` right after :py:meth:`waflib.Context.Context.recurse` terminates.
:param node: script
:type node: :py:class:`waflib.Node.Node`
"""
self.cur_script = self.stack_path.pop()
if self.cur_script:
self.path = self.cur_script.par... | [
"def",
"post_recurse",
"(",
"self",
",",
"node",
")",
":",
"self",
".",
"cur_script",
"=",
"self",
".",
"stack_path",
".",
"pop",
"(",
")",
"if",
"self",
".",
"cur_script",
":",
"self",
".",
"path",
"=",
"self",
".",
"cur_script",
".",
"parent"
] | https://github.com/CRYTEK/CRYENGINE/blob/232227c59a220cbbd311576f0fbeba7bb53b2a8c/Code/Tools/waf-1.7.13/waflib/Context.py#L239-L248 | ||
wxWidgets/wxPython-Classic | 19571e1ae65f1ac445f5491474121998c97a1bf0 | src/osx_carbon/_core.py | python | Image.RotateHue | (*args, **kwargs) | return _core_.Image_RotateHue(*args, **kwargs) | RotateHue(self, double angle)
Rotates the hue of each pixel of the image. Hue is a double in the
range -1.0..1.0 where -1.0 is -360 degrees and 1.0 is 360 degrees | RotateHue(self, double angle) | [
"RotateHue",
"(",
"self",
"double",
"angle",
")"
] | def RotateHue(*args, **kwargs):
"""
RotateHue(self, double angle)
Rotates the hue of each pixel of the image. Hue is a double in the
range -1.0..1.0 where -1.0 is -360 degrees and 1.0 is 360 degrees
"""
return _core_.Image_RotateHue(*args, **kwargs) | [
"def",
"RotateHue",
"(",
"*",
"args",
",",
"*",
"*",
"kwargs",
")",
":",
"return",
"_core_",
".",
"Image_RotateHue",
"(",
"*",
"args",
",",
"*",
"*",
"kwargs",
")"
] | https://github.com/wxWidgets/wxPython-Classic/blob/19571e1ae65f1ac445f5491474121998c97a1bf0/src/osx_carbon/_core.py#L3652-L3659 | |
aws/lumberyard | f85344403c1c2e77ec8c75deb2c116e97b713217 | dev/Gems/CloudGemFramework/v1/AWS/resource-manager-code/lib/setuptools/_vendor/pyparsing.py | python | ParseResults.pop | ( self, *args, **kwargs) | Removes and returns item at specified index (default=C{last}).
Supports both C{list} and C{dict} semantics for C{pop()}. If passed no
argument or an integer argument, it will use C{list} semantics
and pop tokens from the list of parsed tokens. If passed a
non-integer argument (most like... | Removes and returns item at specified index (default=C{last}).
Supports both C{list} and C{dict} semantics for C{pop()}. If passed no
argument or an integer argument, it will use C{list} semantics
and pop tokens from the list of parsed tokens. If passed a
non-integer argument (most like... | [
"Removes",
"and",
"returns",
"item",
"at",
"specified",
"index",
"(",
"default",
"=",
"C",
"{",
"last",
"}",
")",
".",
"Supports",
"both",
"C",
"{",
"list",
"}",
"and",
"C",
"{",
"dict",
"}",
"semantics",
"for",
"C",
"{",
"pop",
"()",
"}",
".",
"... | def pop( self, *args, **kwargs):
"""
Removes and returns item at specified index (default=C{last}).
Supports both C{list} and C{dict} semantics for C{pop()}. If passed no
argument or an integer argument, it will use C{list} semantics
and pop tokens from the list of parsed tokens.... | [
"def",
"pop",
"(",
"self",
",",
"*",
"args",
",",
"*",
"*",
"kwargs",
")",
":",
"if",
"not",
"args",
":",
"args",
"=",
"[",
"-",
"1",
"]",
"for",
"k",
",",
"v",
"in",
"kwargs",
".",
"items",
"(",
")",
":",
"if",
"k",
"==",
"'default'",
":",... | https://github.com/aws/lumberyard/blob/f85344403c1c2e77ec8c75deb2c116e97b713217/dev/Gems/CloudGemFramework/v1/AWS/resource-manager-code/lib/setuptools/_vendor/pyparsing.py#L511-L561 | ||
weichengkuo/DeepBox | c4f8c065b6a51cf296540cc453a44f0519aaacc9 | caffe-fast-rcnn/scripts/cpp_lint.py | python | CleanseComments | (line) | return _RE_PATTERN_CLEANSE_LINE_C_COMMENTS.sub('', line) | Removes //-comments and single-line C-style /* */ comments.
Args:
line: A line of C++ source.
Returns:
The line with single-line comments removed. | Removes //-comments and single-line C-style /* */ comments. | [
"Removes",
"//",
"-",
"comments",
"and",
"single",
"-",
"line",
"C",
"-",
"style",
"/",
"*",
"*",
"/",
"comments",
"."
] | def CleanseComments(line):
"""Removes //-comments and single-line C-style /* */ comments.
Args:
line: A line of C++ source.
Returns:
The line with single-line comments removed.
"""
commentpos = line.find('//')
if commentpos != -1 and not IsCppString(line[:commentpos]):
line = line[:commentpos]... | [
"def",
"CleanseComments",
"(",
"line",
")",
":",
"commentpos",
"=",
"line",
".",
"find",
"(",
"'//'",
")",
"if",
"commentpos",
"!=",
"-",
"1",
"and",
"not",
"IsCppString",
"(",
"line",
"[",
":",
"commentpos",
"]",
")",
":",
"line",
"=",
"line",
"[",
... | https://github.com/weichengkuo/DeepBox/blob/c4f8c065b6a51cf296540cc453a44f0519aaacc9/caffe-fast-rcnn/scripts/cpp_lint.py#L1167-L1180 | |
catboost/catboost | 167f64f237114a4d10b2b4ee42adb4569137debe | contrib/python/scipy/scipy/cluster/hierarchy.py | python | to_mlab_linkage | (Z) | return ZP | Converts a linkage matrix to a MATLAB(TM) compatible one.
Converts a linkage matrix ``Z`` generated by the linkage function
of this module to a MATLAB(TM) compatible one. The return linkage
matrix has the last column removed and the cluster indices are
converted to ``1..N`` indexing.
Parameters
... | Converts a linkage matrix to a MATLAB(TM) compatible one. | [
"Converts",
"a",
"linkage",
"matrix",
"to",
"a",
"MATLAB",
"(",
"TM",
")",
"compatible",
"one",
"."
] | def to_mlab_linkage(Z):
"""
Converts a linkage matrix to a MATLAB(TM) compatible one.
Converts a linkage matrix ``Z`` generated by the linkage function
of this module to a MATLAB(TM) compatible one. The return linkage
matrix has the last column removed and the cluster indices are
converted to `... | [
"def",
"to_mlab_linkage",
"(",
"Z",
")",
":",
"Z",
"=",
"np",
".",
"asarray",
"(",
"Z",
",",
"order",
"=",
"'c'",
",",
"dtype",
"=",
"np",
".",
"double",
")",
"Zs",
"=",
"Z",
".",
"shape",
"if",
"len",
"(",
"Zs",
")",
"==",
"0",
"or",
"(",
... | https://github.com/catboost/catboost/blob/167f64f237114a4d10b2b4ee42adb4569137debe/contrib/python/scipy/scipy/cluster/hierarchy.py#L1240-L1273 | |
wlanjie/AndroidFFmpeg | 7baf9122f4b8e1c74e7baf4be5c422c7a5ba5aaf | tools/fdk-aac-build/armeabi/toolchain/lib/python2.7/Bastion.py | python | BastionClass.__init__ | (self, get, name) | Constructor.
Arguments:
get - a function that gets the attribute value (by name)
name - a human-readable name for the original object
(suggestion: use repr(object)) | Constructor. | [
"Constructor",
"."
] | def __init__(self, get, name):
"""Constructor.
Arguments:
get - a function that gets the attribute value (by name)
name - a human-readable name for the original object
(suggestion: use repr(object))
"""
self._get_ = get
self._name_ = name | [
"def",
"__init__",
"(",
"self",
",",
"get",
",",
"name",
")",
":",
"self",
".",
"_get_",
"=",
"get",
"self",
".",
"_name_",
"=",
"name"
] | https://github.com/wlanjie/AndroidFFmpeg/blob/7baf9122f4b8e1c74e7baf4be5c422c7a5ba5aaf/tools/fdk-aac-build/armeabi/toolchain/lib/python2.7/Bastion.py#L47-L58 | ||
ZhouWeikuan/DouDiZhu | 0d84ff6c0bc54dba6ae37955de9ae9307513dc99 | code/frameworks/cocos2d-x/tools/bindings-generator/clang/cindex.py | python | Cursor.hash | (self) | return self._hash | Returns a hash of the cursor as an int. | Returns a hash of the cursor as an int. | [
"Returns",
"a",
"hash",
"of",
"the",
"cursor",
"as",
"an",
"int",
"."
] | def hash(self):
"""Returns a hash of the cursor as an int."""
if not hasattr(self, '_hash'):
self._hash = conf.lib.clang_hashCursor(self)
return self._hash | [
"def",
"hash",
"(",
"self",
")",
":",
"if",
"not",
"hasattr",
"(",
"self",
",",
"'_hash'",
")",
":",
"self",
".",
"_hash",
"=",
"conf",
".",
"lib",
".",
"clang_hashCursor",
"(",
"self",
")",
"return",
"self",
".",
"_hash"
] | https://github.com/ZhouWeikuan/DouDiZhu/blob/0d84ff6c0bc54dba6ae37955de9ae9307513dc99/code/frameworks/cocos2d-x/tools/bindings-generator/clang/cindex.py#L1396-L1401 | |
OSGeo/gdal | 3748fc4ba4fba727492774b2b908a2130c864a83 | swig/python/osgeo/ogr.py | python | CreateRangeFieldDomain | (*args) | return _ogr.CreateRangeFieldDomain(*args) | r"""CreateRangeFieldDomain(char const * name, char const * description, OGRFieldType type, OGRFieldSubType subtype, double min, bool minIsInclusive, double max, double maxIsInclusive) -> FieldDomain | r"""CreateRangeFieldDomain(char const * name, char const * description, OGRFieldType type, OGRFieldSubType subtype, double min, bool minIsInclusive, double max, double maxIsInclusive) -> FieldDomain | [
"r",
"CreateRangeFieldDomain",
"(",
"char",
"const",
"*",
"name",
"char",
"const",
"*",
"description",
"OGRFieldType",
"type",
"OGRFieldSubType",
"subtype",
"double",
"min",
"bool",
"minIsInclusive",
"double",
"max",
"double",
"maxIsInclusive",
")",
"-",
">",
"Fie... | def CreateRangeFieldDomain(*args):
r"""CreateRangeFieldDomain(char const * name, char const * description, OGRFieldType type, OGRFieldSubType subtype, double min, bool minIsInclusive, double max, double maxIsInclusive) -> FieldDomain"""
return _ogr.CreateRangeFieldDomain(*args) | [
"def",
"CreateRangeFieldDomain",
"(",
"*",
"args",
")",
":",
"return",
"_ogr",
".",
"CreateRangeFieldDomain",
"(",
"*",
"args",
")"
] | https://github.com/OSGeo/gdal/blob/3748fc4ba4fba727492774b2b908a2130c864a83/swig/python/osgeo/ogr.py#L7628-L7630 | |
gnuradio/gnuradio | 09c3c4fa4bfb1a02caac74cb5334dfe065391e3b | gr-blocks/python/blocks/qa_rotator_cc.py | python | qa_rotator_cc.test_scheduled_phase_inc_update | (self) | Update the phase increment at a chosen offset via command message | Update the phase increment at a chosen offset via command message | [
"Update",
"the",
"phase",
"increment",
"at",
"a",
"chosen",
"offset",
"via",
"command",
"message"
] | def test_scheduled_phase_inc_update(self):
"""Update the phase increment at a chosen offset via command message"""
new_phase_inc, \
offset, \
expected_samples = self._test_scheduled_phase_inc_update()
self.tb.run()
self._assert_tags([new_phase_inc], [offset])
... | [
"def",
"test_scheduled_phase_inc_update",
"(",
"self",
")",
":",
"new_phase_inc",
",",
"offset",
",",
"expected_samples",
"=",
"self",
".",
"_test_scheduled_phase_inc_update",
"(",
")",
"self",
".",
"tb",
".",
"run",
"(",
")",
"self",
".",
"_assert_tags",
"(",
... | https://github.com/gnuradio/gnuradio/blob/09c3c4fa4bfb1a02caac74cb5334dfe065391e3b/gr-blocks/python/blocks/qa_rotator_cc.py#L143-L153 | ||
Xilinx/Vitis-AI | fc74d404563d9951b57245443c73bef389f3657f | tools/Vitis-AI-Quantizer/vai_q_tensorflow1.x/tensorflow/contrib/image/python/ops/image_ops.py | python | translations_to_projective_transforms | (translations, name=None) | Returns projective transform(s) for the given translation(s).
Args:
translations: A 2-element list representing [dx, dy] or a matrix of
2-element lists representing [dx, dy] to translate for each image
(for a batch of images). The rank must be statically known (the shape
is not `T... | Returns projective transform(s) for the given translation(s). | [
"Returns",
"projective",
"transform",
"(",
"s",
")",
"for",
"the",
"given",
"translation",
"(",
"s",
")",
"."
] | def translations_to_projective_transforms(translations, name=None):
"""Returns projective transform(s) for the given translation(s).
Args:
translations: A 2-element list representing [dx, dy] or a matrix of
2-element lists representing [dx, dy] to translate for each image
(for a batch of ... | [
"def",
"translations_to_projective_transforms",
"(",
"translations",
",",
"name",
"=",
"None",
")",
":",
"with",
"ops",
".",
"name_scope",
"(",
"name",
",",
"\"translations_to_projective_transforms\"",
")",
":",
"translation_or_translations",
"=",
"ops",
".",
"convert... | https://github.com/Xilinx/Vitis-AI/blob/fc74d404563d9951b57245443c73bef389f3657f/tools/Vitis-AI-Quantizer/vai_q_tensorflow1.x/tensorflow/contrib/image/python/ops/image_ops.py#L176-L219 | ||
LLNL/lbann | 26083e6c86050302ce33148aea70f62e61cacb92 | applications/graph/node2vec/data/offline_walks.py | python | get_sample | (*args) | return next(_sample_iter) | Get a single data sample.
A data sample consists of a graph walk and several negative
samples. Input arguments are ignored. | Get a single data sample. | [
"Get",
"a",
"single",
"data",
"sample",
"."
] | def get_sample(*args):
"""Get a single data sample.
A data sample consists of a graph walk and several negative
samples. Input arguments are ignored.
"""
# Construct iterator the first time this is called
# Note: We assume there are more MPI ranks than walk files. Each
# MPI rank reads a ... | [
"def",
"get_sample",
"(",
"*",
"args",
")",
":",
"# Construct iterator the first time this is called",
"# Note: We assume there are more MPI ranks than walk files. Each",
"# MPI rank reads a distinct subset of one file.",
"global",
"_sample_iter",
"if",
"_sample_iter",
"is",
"None",
... | https://github.com/LLNL/lbann/blob/26083e6c86050302ce33148aea70f62e61cacb92/applications/graph/node2vec/data/offline_walks.py#L274-L308 | |
GoSSIP-SJTU/Armariris | ad5d868482956b2194a77b39c8d543c7c2318200 | tools/clang/tools/scan-build-py/libscanbuild/report.py | python | commonprefix | (files) | Fixed version of os.path.commonprefix. Return the longest path prefix
that is a prefix of all paths in filenames. | Fixed version of os.path.commonprefix. Return the longest path prefix
that is a prefix of all paths in filenames. | [
"Fixed",
"version",
"of",
"os",
".",
"path",
".",
"commonprefix",
".",
"Return",
"the",
"longest",
"path",
"prefix",
"that",
"is",
"a",
"prefix",
"of",
"all",
"paths",
"in",
"filenames",
"."
] | def commonprefix(files):
""" Fixed version of os.path.commonprefix. Return the longest path prefix
that is a prefix of all paths in filenames. """
result = None
for current in files:
if result is not None:
result = os.path.commonprefix([result, current])
else:
re... | [
"def",
"commonprefix",
"(",
"files",
")",
":",
"result",
"=",
"None",
"for",
"current",
"in",
"files",
":",
"if",
"result",
"is",
"not",
"None",
":",
"result",
"=",
"os",
".",
"path",
".",
"commonprefix",
"(",
"[",
"result",
",",
"current",
"]",
")",... | https://github.com/GoSSIP-SJTU/Armariris/blob/ad5d868482956b2194a77b39c8d543c7c2318200/tools/clang/tools/scan-build-py/libscanbuild/report.py#L519-L535 | ||
CRYTEK/CRYENGINE | 232227c59a220cbbd311576f0fbeba7bb53b2a8c | Code/Tools/waf-1.7.13/waflib/Utils.py | python | num2ver | (ver) | return ver | Convert a string, tuple or version number into an integer. The number is supposed to have at most 4 digits::
from waflib.Utils import num2ver
num2ver('1.3.2') == num2ver((1,3,2)) == num2ver((1,3,2,0))
:type ver: string or tuple of numbers
:param ver: a version number | Convert a string, tuple or version number into an integer. The number is supposed to have at most 4 digits:: | [
"Convert",
"a",
"string",
"tuple",
"or",
"version",
"number",
"into",
"an",
"integer",
".",
"The",
"number",
"is",
"supposed",
"to",
"have",
"at",
"most",
"4",
"digits",
"::"
] | def num2ver(ver):
"""
Convert a string, tuple or version number into an integer. The number is supposed to have at most 4 digits::
from waflib.Utils import num2ver
num2ver('1.3.2') == num2ver((1,3,2)) == num2ver((1,3,2,0))
:type ver: string or tuple of numbers
:param ver: a version number
"""
if isinstance(... | [
"def",
"num2ver",
"(",
"ver",
")",
":",
"if",
"isinstance",
"(",
"ver",
",",
"str",
")",
":",
"ver",
"=",
"tuple",
"(",
"ver",
".",
"split",
"(",
"'.'",
")",
")",
"if",
"isinstance",
"(",
"ver",
",",
"tuple",
")",
":",
"ret",
"=",
"0",
"for",
... | https://github.com/CRYTEK/CRYENGINE/blob/232227c59a220cbbd311576f0fbeba7bb53b2a8c/Code/Tools/waf-1.7.13/waflib/Utils.py#L354-L372 | |
catboost/catboost | 167f64f237114a4d10b2b4ee42adb4569137debe | contrib/python/jedi/jedi/api/__init__.py | python | names | (source=None, path=None, encoding='utf-8', all_scopes=False,
definitions=True, references=False, environment=None) | return sorted(filter(def_ref_filter, defs), key=lambda x: (x.line, x.column)) | Returns a list of `Definition` objects, containing name parts.
This means you can call ``Definition.goto_assignments()`` and get the
reference of a name.
The parameters are the same as in :py:class:`Script`, except or the
following ones:
:param all_scopes: If True lists the names of all scopes inst... | Returns a list of `Definition` objects, containing name parts.
This means you can call ``Definition.goto_assignments()`` and get the
reference of a name.
The parameters are the same as in :py:class:`Script`, except or the
following ones: | [
"Returns",
"a",
"list",
"of",
"Definition",
"objects",
"containing",
"name",
"parts",
".",
"This",
"means",
"you",
"can",
"call",
"Definition",
".",
"goto_assignments",
"()",
"and",
"get",
"the",
"reference",
"of",
"a",
"name",
".",
"The",
"parameters",
"are... | def names(source=None, path=None, encoding='utf-8', all_scopes=False,
definitions=True, references=False, environment=None):
"""
Returns a list of `Definition` objects, containing name parts.
This means you can call ``Definition.goto_assignments()`` and get the
reference of a name.
The par... | [
"def",
"names",
"(",
"source",
"=",
"None",
",",
"path",
"=",
"None",
",",
"encoding",
"=",
"'utf-8'",
",",
"all_scopes",
"=",
"False",
",",
"definitions",
"=",
"True",
",",
"references",
"=",
"False",
",",
"environment",
"=",
"None",
")",
":",
"def",
... | https://github.com/catboost/catboost/blob/167f64f237114a4d10b2b4ee42adb4569137debe/contrib/python/jedi/jedi/api/__init__.py#L442-L482 | |
aws/lumberyard | f85344403c1c2e77ec8c75deb2c116e97b713217 | dev/Tools/Python/3.7.10/mac/Python.framework/Versions/3.7/lib/python3.7/email/message.py | python | Message.as_string | (self, unixfrom=False, maxheaderlen=0, policy=None) | return fp.getvalue() | Return the entire formatted message as a string.
Optional 'unixfrom', when true, means include the Unix From_ envelope
header. For backward compatibility reasons, if maxheaderlen is
not specified it defaults to 0, so you must override it explicitly
if you want a different maxheaderlen.... | Return the entire formatted message as a string. | [
"Return",
"the",
"entire",
"formatted",
"message",
"as",
"a",
"string",
"."
] | def as_string(self, unixfrom=False, maxheaderlen=0, policy=None):
"""Return the entire formatted message as a string.
Optional 'unixfrom', when true, means include the Unix From_ envelope
header. For backward compatibility reasons, if maxheaderlen is
not specified it defaults to 0, so ... | [
"def",
"as_string",
"(",
"self",
",",
"unixfrom",
"=",
"False",
",",
"maxheaderlen",
"=",
"0",
",",
"policy",
"=",
"None",
")",
":",
"from",
"email",
".",
"generator",
"import",
"Generator",
"policy",
"=",
"self",
".",
"policy",
"if",
"policy",
"is",
"... | https://github.com/aws/lumberyard/blob/f85344403c1c2e77ec8c75deb2c116e97b713217/dev/Tools/Python/3.7.10/mac/Python.framework/Versions/3.7/lib/python3.7/email/message.py#L137-L159 | |
eomahony/Numberjack | 53fa9e994a36f881ffd320d8d04158097190aad8 | Numberjack/__init__.py | python | NBJ_STD_Solver.getWorkMem | (self) | return None | Get the limit of working memory, only used for CPLEX. | Get the limit of working memory, only used for CPLEX. | [
"Get",
"the",
"limit",
"of",
"working",
"memory",
"only",
"used",
"for",
"CPLEX",
"."
] | def getWorkMem(self):
"""
Get the limit of working memory, only used for CPLEX.
"""
if hasattr(self.solver, 'getWorkMem'):
return self.solver.getWorkMem()
else:
raise UnsupportedSolverFunction(
self.Library, "getWorkMem", "This solver does ... | [
"def",
"getWorkMem",
"(",
"self",
")",
":",
"if",
"hasattr",
"(",
"self",
".",
"solver",
",",
"'getWorkMem'",
")",
":",
"return",
"self",
".",
"solver",
".",
"getWorkMem",
"(",
")",
"else",
":",
"raise",
"UnsupportedSolverFunction",
"(",
"self",
".",
"Li... | https://github.com/eomahony/Numberjack/blob/53fa9e994a36f881ffd320d8d04158097190aad8/Numberjack/__init__.py#L3623-L3633 | |
cmu-db/bustub | fe1b9e984bd2967997b52df872c873d80f71cf7d | build_support/cpplint.py | python | IsOutOfLineMethodDefinition | (clean_lines, linenum) | return False | Check if current line contains an out-of-line method definition.
Args:
clean_lines: A CleansedLines instance containing the file.
linenum: The number of the line to check.
Returns:
True if current line contains an out-of-line method definition. | Check if current line contains an out-of-line method definition. | [
"Check",
"if",
"current",
"line",
"contains",
"an",
"out",
"-",
"of",
"-",
"line",
"method",
"definition",
"."
] | def IsOutOfLineMethodDefinition(clean_lines, linenum):
"""Check if current line contains an out-of-line method definition.
Args:
clean_lines: A CleansedLines instance containing the file.
linenum: The number of the line to check.
Returns:
True if current line contains an out-of-line method definition... | [
"def",
"IsOutOfLineMethodDefinition",
"(",
"clean_lines",
",",
"linenum",
")",
":",
"# Scan back a few lines for start of current function",
"for",
"i",
"in",
"xrange",
"(",
"linenum",
",",
"max",
"(",
"-",
"1",
",",
"linenum",
"-",
"10",
")",
",",
"-",
"1",
"... | https://github.com/cmu-db/bustub/blob/fe1b9e984bd2967997b52df872c873d80f71cf7d/build_support/cpplint.py#L5226-L5239 | |
hanpfei/chromium-net | 392cc1fa3a8f92f42e4071ab6e674d8e0482f83f | third_party/catapult/telemetry/telemetry/util/statistics.py | python | NormalizeSamples | (samples) | return samples, scale | Sorts the samples, and map them linearly to the range [0,1].
They're mapped such that for the N samples, the first sample is 0.5/N and the
last sample is (N-0.5)/N.
Background: The discrepancy of the sample set i/(N-1); i=0, ..., N-1 is 2/N,
twice the discrepancy of the sample set (i+1/2)/N; i=0, ..., N-1. In... | Sorts the samples, and map them linearly to the range [0,1]. | [
"Sorts",
"the",
"samples",
"and",
"map",
"them",
"linearly",
"to",
"the",
"range",
"[",
"0",
"1",
"]",
"."
] | def NormalizeSamples(samples):
"""Sorts the samples, and map them linearly to the range [0,1].
They're mapped such that for the N samples, the first sample is 0.5/N and the
last sample is (N-0.5)/N.
Background: The discrepancy of the sample set i/(N-1); i=0, ..., N-1 is 2/N,
twice the discrepancy of the sam... | [
"def",
"NormalizeSamples",
"(",
"samples",
")",
":",
"if",
"not",
"samples",
":",
"return",
"samples",
",",
"1.0",
"samples",
"=",
"sorted",
"(",
"samples",
")",
"low",
"=",
"min",
"(",
"samples",
")",
"high",
"=",
"max",
"(",
"samples",
")",
"new_low"... | https://github.com/hanpfei/chromium-net/blob/392cc1fa3a8f92f42e4071ab6e674d8e0482f83f/third_party/catapult/telemetry/telemetry/util/statistics.py#L15-L39 | |
wxWidgets/wxPython-Classic | 19571e1ae65f1ac445f5491474121998c97a1bf0 | src/osx_cocoa/_misc.py | python | ConfigBase.DontCreateOnDemand | (*args, **kwargs) | return _misc_.ConfigBase_DontCreateOnDemand(*args, **kwargs) | DontCreateOnDemand()
Should Get() try to create a new log object if there isn't a current
one? | DontCreateOnDemand() | [
"DontCreateOnDemand",
"()"
] | def DontCreateOnDemand(*args, **kwargs):
"""
DontCreateOnDemand()
Should Get() try to create a new log object if there isn't a current
one?
"""
return _misc_.ConfigBase_DontCreateOnDemand(*args, **kwargs) | [
"def",
"DontCreateOnDemand",
"(",
"*",
"args",
",",
"*",
"*",
"kwargs",
")",
":",
"return",
"_misc_",
".",
"ConfigBase_DontCreateOnDemand",
"(",
"*",
"args",
",",
"*",
"*",
"kwargs",
")"
] | https://github.com/wxWidgets/wxPython-Classic/blob/19571e1ae65f1ac445f5491474121998c97a1bf0/src/osx_cocoa/_misc.py#L3133-L3140 | |
tensorflow/tensorflow | 419e3a6b650ea4bd1b0cba23c4348f8a69f3272e | tensorflow/python/ops/special_math_ops.py | python | einsum | (equation, *inputs, **kwargs) | return _einsum_v2(equation, *inputs, **kwargs) | r"""Tensor contraction over specified indices and outer product.
Einsum allows defining Tensors by defining their element-wise computation.
This computation is defined by `equation`, a shorthand form based on Einstein
summation. As an example, consider multiplying two matrices A and B to form a
matrix C. The ... | r"""Tensor contraction over specified indices and outer product. | [
"r",
"Tensor",
"contraction",
"over",
"specified",
"indices",
"and",
"outer",
"product",
"."
] | def einsum(equation, *inputs, **kwargs):
r"""Tensor contraction over specified indices and outer product.
Einsum allows defining Tensors by defining their element-wise computation.
This computation is defined by `equation`, a shorthand form based on Einstein
summation. As an example, consider multiplying two m... | [
"def",
"einsum",
"(",
"equation",
",",
"*",
"inputs",
",",
"*",
"*",
"kwargs",
")",
":",
"return",
"_einsum_v2",
"(",
"equation",
",",
"*",
"inputs",
",",
"*",
"*",
"kwargs",
")"
] | https://github.com/tensorflow/tensorflow/blob/419e3a6b650ea4bd1b0cba23c4348f8a69f3272e/tensorflow/python/ops/special_math_ops.py#L619-L762 | |
stack-of-tasks/pinocchio | 593d4d43fded997bb9aa2421f4e55294dbd233c4 | bindings/python/pinocchio/visualize/base_visualizer.py | python | BaseVisualizer.initViewer | (self, *args, **kwargs) | Init the viewer by loading the gui and creating a window. | Init the viewer by loading the gui and creating a window. | [
"Init",
"the",
"viewer",
"by",
"loading",
"the",
"gui",
"and",
"creating",
"a",
"window",
"."
] | def initViewer(self, *args, **kwargs):
"""Init the viewer by loading the gui and creating a window."""
pass | [
"def",
"initViewer",
"(",
"self",
",",
"*",
"args",
",",
"*",
"*",
"kwargs",
")",
":",
"pass"
] | https://github.com/stack-of-tasks/pinocchio/blob/593d4d43fded997bb9aa2421f4e55294dbd233c4/bindings/python/pinocchio/visualize/base_visualizer.py#L49-L51 | ||
catboost/catboost | 167f64f237114a4d10b2b4ee42adb4569137debe | contrib/python/scipy/py2/scipy/stats/mstats_basic.py | python | ks_twosamp | (data1, data2, alternative="two-sided") | return (d, prob) | Computes the Kolmogorov-Smirnov test on two samples.
Missing values are discarded.
Parameters
----------
data1 : array_like
First data set
data2 : array_like
Second data set
alternative : {'two-sided', 'less', 'greater'}, optional
Indicates the alternative hypothesis. ... | Computes the Kolmogorov-Smirnov test on two samples. | [
"Computes",
"the",
"Kolmogorov",
"-",
"Smirnov",
"test",
"on",
"two",
"samples",
"."
] | def ks_twosamp(data1, data2, alternative="two-sided"):
"""
Computes the Kolmogorov-Smirnov test on two samples.
Missing values are discarded.
Parameters
----------
data1 : array_like
First data set
data2 : array_like
Second data set
alternative : {'two-sided', 'less', '... | [
"def",
"ks_twosamp",
"(",
"data1",
",",
"data2",
",",
"alternative",
"=",
"\"two-sided\"",
")",
":",
"(",
"data1",
",",
"data2",
")",
"=",
"(",
"ma",
".",
"asarray",
"(",
"data1",
")",
",",
"ma",
".",
"asarray",
"(",
"data2",
")",
")",
"(",
"n1",
... | https://github.com/catboost/catboost/blob/167f64f237114a4d10b2b4ee42adb4569137debe/contrib/python/scipy/py2/scipy/stats/mstats_basic.py#L1248-L1295 | |
albertz/openlierox | d316c14a8eb57848ef56e9bfa7b23a56f694a51b | tools/DedicatedServerVideo/gdata/auth.py | python | OAuthToken.set_token_string | (self, token_string) | Sets the token key and secret from the token string.
Args:
token_string: str Token string of form
oauth_token=[0]&oauth_token_secret=[1]. If oauth_token is not present,
self.key will be None. If oauth_token_secret is not present,
self.secret will be None. | Sets the token key and secret from the token string.
Args:
token_string: str Token string of form
oauth_token=[0]&oauth_token_secret=[1]. If oauth_token is not present,
self.key will be None. If oauth_token_secret is not present,
self.secret will be None. | [
"Sets",
"the",
"token",
"key",
"and",
"secret",
"from",
"the",
"token",
"string",
".",
"Args",
":",
"token_string",
":",
"str",
"Token",
"string",
"of",
"form",
"oauth_token",
"=",
"[",
"0",
"]",
"&oauth_token_secret",
"=",
"[",
"1",
"]",
".",
"If",
"o... | def set_token_string(self, token_string):
"""Sets the token key and secret from the token string.
Args:
token_string: str Token string of form
oauth_token=[0]&oauth_token_secret=[1]. If oauth_token is not present,
self.key will be None. If oauth_token_secret is not present,
... | [
"def",
"set_token_string",
"(",
"self",
",",
"token_string",
")",
":",
"token_params",
"=",
"cgi",
".",
"parse_qs",
"(",
"token_string",
",",
"keep_blank_values",
"=",
"False",
")",
"if",
"'oauth_token'",
"in",
"token_params",
":",
"self",
".",
"key",
"=",
"... | https://github.com/albertz/openlierox/blob/d316c14a8eb57848ef56e9bfa7b23a56f694a51b/tools/DedicatedServerVideo/gdata/auth.py#L816-L829 | ||
aws/lumberyard | f85344403c1c2e77ec8c75deb2c116e97b713217 | dev/Tools/Python/3.7.10/mac/Python.framework/Versions/3.7/lib/python3.7/mailbox.py | python | BabylMessage.add_label | (self, label) | Add label to list of labels on the message. | Add label to list of labels on the message. | [
"Add",
"label",
"to",
"list",
"of",
"labels",
"on",
"the",
"message",
"."
] | def add_label(self, label):
"""Add label to list of labels on the message."""
if isinstance(label, str):
if label not in self._labels:
self._labels.append(label)
else:
raise TypeError('label must be a string: %s' % type(label)) | [
"def",
"add_label",
"(",
"self",
",",
"label",
")",
":",
"if",
"isinstance",
"(",
"label",
",",
"str",
")",
":",
"if",
"label",
"not",
"in",
"self",
".",
"_labels",
":",
"self",
".",
"_labels",
".",
"append",
"(",
"label",
")",
"else",
":",
"raise"... | https://github.com/aws/lumberyard/blob/f85344403c1c2e77ec8c75deb2c116e97b713217/dev/Tools/Python/3.7.10/mac/Python.framework/Versions/3.7/lib/python3.7/mailbox.py#L1840-L1846 | ||
nasa/fprime | 595cf3682d8365943d86c1a6fe7c78f0a116acf0 | Utils/topologyTool.py | python | recursive_xml_parse | (tree_obj) | return out_obj | returns a list of items
[tagName , [(argKey:argVal)] , [" " or [tagName , [] , []] ] ] | returns a list of items
[tagName , [(argKey:argVal)] , [" " or [tagName , [] , []] ] ] | [
"returns",
"a",
"list",
"of",
"items",
"[",
"tagName",
"[",
"(",
"argKey",
":",
"argVal",
")",
"]",
"[",
"or",
"[",
"tagName",
"[]",
"[]",
"]",
"]",
"]"
] | def recursive_xml_parse(tree_obj):
"""
returns a list of items
[tagName , [(argKey:argVal)] , [" " or [tagName , [] , []] ] ]
"""
out_obj = [tree_obj.tag, [], []]
for att in tree_obj.attrib:
out_obj[1].append((att, tree_obj.attrib[att]))
internal_text = tree_obj.text
if interna... | [
"def",
"recursive_xml_parse",
"(",
"tree_obj",
")",
":",
"out_obj",
"=",
"[",
"tree_obj",
".",
"tag",
",",
"[",
"]",
",",
"[",
"]",
"]",
"for",
"att",
"in",
"tree_obj",
".",
"attrib",
":",
"out_obj",
"[",
"1",
"]",
".",
"append",
"(",
"(",
"att",
... | https://github.com/nasa/fprime/blob/595cf3682d8365943d86c1a6fe7c78f0a116acf0/Utils/topologyTool.py#L55-L74 | |
aws/lumberyard | f85344403c1c2e77ec8c75deb2c116e97b713217 | dev/Tools/Python/3.7.10/mac/Python.framework/Versions/3.7/share/doc/python3.7/examples/Tools/scripts/reindent.py | python | _rstrip | (line, JUNK='\n \t') | return line[:i] | Return line stripped of trailing spaces, tabs, newlines.
Note that line.rstrip() instead also strips sundry control characters,
but at least one known Emacs user expects to keep junk like that, not
mentioning Barry by name or anything <wink>. | Return line stripped of trailing spaces, tabs, newlines. | [
"Return",
"line",
"stripped",
"of",
"trailing",
"spaces",
"tabs",
"newlines",
"."
] | def _rstrip(line, JUNK='\n \t'):
"""Return line stripped of trailing spaces, tabs, newlines.
Note that line.rstrip() instead also strips sundry control characters,
but at least one known Emacs user expects to keep junk like that, not
mentioning Barry by name or anything <wink>.
"""
i = len(lin... | [
"def",
"_rstrip",
"(",
"line",
",",
"JUNK",
"=",
"'\\n \\t'",
")",
":",
"i",
"=",
"len",
"(",
"line",
")",
"while",
"i",
">",
"0",
"and",
"line",
"[",
"i",
"-",
"1",
"]",
"in",
"JUNK",
":",
"i",
"-=",
"1",
"return",
"line",
"[",
":",
"i",
"... | https://github.com/aws/lumberyard/blob/f85344403c1c2e77ec8c75deb2c116e97b713217/dev/Tools/Python/3.7.10/mac/Python.framework/Versions/3.7/share/doc/python3.7/examples/Tools/scripts/reindent.py#L160-L171 | |
hanpfei/chromium-net | 392cc1fa3a8f92f42e4071ab6e674d8e0482f83f | third_party/catapult/third_party/Paste/paste/auth/auth_tkt.py | python | parse_ticket | (secret, ticket, ip, digest_algo=DEFAULT_DIGEST) | return (timestamp, userid, tokens, user_data) | Parse the ticket, returning (timestamp, userid, tokens, user_data).
If the ticket cannot be parsed, ``BadTicket`` will be raised with
an explanation. | Parse the ticket, returning (timestamp, userid, tokens, user_data). | [
"Parse",
"the",
"ticket",
"returning",
"(",
"timestamp",
"userid",
"tokens",
"user_data",
")",
"."
] | def parse_ticket(secret, ticket, ip, digest_algo=DEFAULT_DIGEST):
"""
Parse the ticket, returning (timestamp, userid, tokens, user_data).
If the ticket cannot be parsed, ``BadTicket`` will be raised with
an explanation.
"""
if isinstance(digest_algo, str):
# correct specification of dig... | [
"def",
"parse_ticket",
"(",
"secret",
",",
"ticket",
",",
"ip",
",",
"digest_algo",
"=",
"DEFAULT_DIGEST",
")",
":",
"if",
"isinstance",
"(",
"digest_algo",
",",
"str",
")",
":",
"# correct specification of digest from hashlib or fail",
"digest_algo",
"=",
"getattr"... | https://github.com/hanpfei/chromium-net/blob/392cc1fa3a8f92f42e4071ab6e674d8e0482f83f/third_party/catapult/third_party/Paste/paste/auth/auth_tkt.py#L150-L189 | |
catboost/catboost | 167f64f237114a4d10b2b4ee42adb4569137debe | contrib/python/numpy/py3/numpy/lib/scimath.py | python | _fix_real_lt_zero | (x) | return x | Convert `x` to complex if it has real, negative components.
Otherwise, output is just the array version of the input (via asarray).
Parameters
----------
x : array_like
Returns
-------
array
Examples
--------
>>> np.lib.scimath._fix_real_lt_zero([1,2])
array([1, 2])
... | Convert `x` to complex if it has real, negative components. | [
"Convert",
"x",
"to",
"complex",
"if",
"it",
"has",
"real",
"negative",
"components",
"."
] | def _fix_real_lt_zero(x):
"""Convert `x` to complex if it has real, negative components.
Otherwise, output is just the array version of the input (via asarray).
Parameters
----------
x : array_like
Returns
-------
array
Examples
--------
>>> np.lib.scimath._fix_real_lt_ze... | [
"def",
"_fix_real_lt_zero",
"(",
"x",
")",
":",
"x",
"=",
"asarray",
"(",
"x",
")",
"if",
"any",
"(",
"isreal",
"(",
"x",
")",
"&",
"(",
"x",
"<",
"0",
")",
")",
":",
"x",
"=",
"_tocomplex",
"(",
"x",
")",
"return",
"x"
] | https://github.com/catboost/catboost/blob/167f64f237114a4d10b2b4ee42adb4569137debe/contrib/python/numpy/py3/numpy/lib/scimath.py#L113-L138 | |
kushview/Element | 1cc16380caa2ab79461246ba758b9de1f46db2a5 | waflib/ConfigSet.py | python | ConfigSet.store | (self, filename) | Serializes the :py:class:`ConfigSet` data to a file. See :py:meth:`ConfigSet.load` for reading such files.
:param filename: file to use
:type filename: string | Serializes the :py:class:`ConfigSet` data to a file. See :py:meth:`ConfigSet.load` for reading such files. | [
"Serializes",
"the",
":",
"py",
":",
"class",
":",
"ConfigSet",
"data",
"to",
"a",
"file",
".",
"See",
":",
"py",
":",
"meth",
":",
"ConfigSet",
".",
"load",
"for",
"reading",
"such",
"files",
"."
] | def store(self, filename):
"""
Serializes the :py:class:`ConfigSet` data to a file. See :py:meth:`ConfigSet.load` for reading such files.
:param filename: file to use
:type filename: string
"""
try:
os.makedirs(os.path.split(filename)[0])
except OSError:
pass
buf = []
merged_table = self.get_m... | [
"def",
"store",
"(",
"self",
",",
"filename",
")",
":",
"try",
":",
"os",
".",
"makedirs",
"(",
"os",
".",
"path",
".",
"split",
"(",
"filename",
")",
"[",
"0",
"]",
")",
"except",
"OSError",
":",
"pass",
"buf",
"=",
"[",
"]",
"merged_table",
"="... | https://github.com/kushview/Element/blob/1cc16380caa2ab79461246ba758b9de1f46db2a5/waflib/ConfigSet.py#L280-L305 | ||
scylladb/dpdk | cc7e6ed22c0fc08e3ff37b3e68a61979d8214547 | tools/dpdk_nic_bind.py | python | main | () | program main function | program main function | [
"program",
"main",
"function"
] | def main():
'''program main function'''
parse_args()
check_modules()
get_nic_details()
do_arg_actions() | [
"def",
"main",
"(",
")",
":",
"parse_args",
"(",
")",
"check_modules",
"(",
")",
"get_nic_details",
"(",
")",
"do_arg_actions",
"(",
")"
] | https://github.com/scylladb/dpdk/blob/cc7e6ed22c0fc08e3ff37b3e68a61979d8214547/tools/dpdk_nic_bind.py#L531-L536 | ||
aws/lumberyard | f85344403c1c2e77ec8c75deb2c116e97b713217 | dev/Gems/CloudGemFramework/v1/ResourceManager/lib/Crypto/PublicKey/ElGamal.py | python | construct | (tup) | return obj | r"""Construct an ElGamal key from a tuple of valid ElGamal components.
The modulus *p* must be a prime.
The following conditions must apply:
.. math::
\begin{align}
&1 < g < p-1 \\
&g^{p-1} = 1 \text{ mod } 1 \\
&1 < x < p-1 \\
&g^x = y \text{ mod } p
\end{... | r"""Construct an ElGamal key from a tuple of valid ElGamal components. | [
"r",
"Construct",
"an",
"ElGamal",
"key",
"from",
"a",
"tuple",
"of",
"valid",
"ElGamal",
"components",
"."
] | def construct(tup):
r"""Construct an ElGamal key from a tuple of valid ElGamal components.
The modulus *p* must be a prime.
The following conditions must apply:
.. math::
\begin{align}
&1 < g < p-1 \\
&g^{p-1} = 1 \text{ mod } 1 \\
&1 < x < p-1 \\
&g^x = y \tex... | [
"def",
"construct",
"(",
"tup",
")",
":",
"obj",
"=",
"ElGamalKey",
"(",
")",
"if",
"len",
"(",
"tup",
")",
"not",
"in",
"[",
"3",
",",
"4",
"]",
":",
"raise",
"ValueError",
"(",
"'argument for construct() wrong length'",
")",
"for",
"i",
"in",
"range"... | https://github.com/aws/lumberyard/blob/f85344403c1c2e77ec8c75deb2c116e97b713217/dev/Gems/CloudGemFramework/v1/ResourceManager/lib/Crypto/PublicKey/ElGamal.py#L96-L146 | |
aws/lumberyard | f85344403c1c2e77ec8c75deb2c116e97b713217 | dev/Tools/Python/3.7.10/windows/Lib/multiprocessing/context.py | python | BaseContext.Event | (self) | return Event(ctx=self.get_context()) | Returns an event object | Returns an event object | [
"Returns",
"an",
"event",
"object"
] | def Event(self):
'''Returns an event object'''
from .synchronize import Event
return Event(ctx=self.get_context()) | [
"def",
"Event",
"(",
"self",
")",
":",
"from",
".",
"synchronize",
"import",
"Event",
"return",
"Event",
"(",
"ctx",
"=",
"self",
".",
"get_context",
"(",
")",
")"
] | https://github.com/aws/lumberyard/blob/f85344403c1c2e77ec8c75deb2c116e97b713217/dev/Tools/Python/3.7.10/windows/Lib/multiprocessing/context.py#L89-L92 | |
catboost/catboost | 167f64f237114a4d10b2b4ee42adb4569137debe | contrib/python/pandas/py3/pandas/core/arrays/categorical.py | python | Categorical._set_dtype | (self, dtype: CategoricalDtype) | return type(self)(codes, dtype=dtype, fastpath=True) | Internal method for directly updating the CategoricalDtype
Parameters
----------
dtype : CategoricalDtype
Notes
-----
We don't do any validation here. It's assumed that the dtype is
a (valid) instance of `CategoricalDtype`. | Internal method for directly updating the CategoricalDtype | [
"Internal",
"method",
"for",
"directly",
"updating",
"the",
"CategoricalDtype"
] | def _set_dtype(self, dtype: CategoricalDtype) -> Categorical:
"""
Internal method for directly updating the CategoricalDtype
Parameters
----------
dtype : CategoricalDtype
Notes
-----
We don't do any validation here. It's assumed that the dtype is
... | [
"def",
"_set_dtype",
"(",
"self",
",",
"dtype",
":",
"CategoricalDtype",
")",
"->",
"Categorical",
":",
"codes",
"=",
"recode_for_categories",
"(",
"self",
".",
"codes",
",",
"self",
".",
"categories",
",",
"dtype",
".",
"categories",
")",
"return",
"type",
... | https://github.com/catboost/catboost/blob/167f64f237114a4d10b2b4ee42adb4569137debe/contrib/python/pandas/py3/pandas/core/arrays/categorical.py#L807-L821 | |
windystrife/UnrealEngine_NVIDIAGameWorks | b50e6338a7c5b26374d66306ebc7807541ff815e | Engine/Extras/ThirdPartyNotUE/emsdk/Win64/python/2.7.5.3_64bit/Lib/numbers.py | python | Integral.denominator | (self) | return 1 | Integers have a denominator of 1. | Integers have a denominator of 1. | [
"Integers",
"have",
"a",
"denominator",
"of",
"1",
"."
] | def denominator(self):
"""Integers have a denominator of 1."""
return 1 | [
"def",
"denominator",
"(",
"self",
")",
":",
"return",
"1"
] | https://github.com/windystrife/UnrealEngine_NVIDIAGameWorks/blob/b50e6338a7c5b26374d66306ebc7807541ff815e/Engine/Extras/ThirdPartyNotUE/emsdk/Win64/python/2.7.5.3_64bit/Lib/numbers.py#L386-L388 | |
wxWidgets/wxPython-Classic | 19571e1ae65f1ac445f5491474121998c97a1bf0 | src/osx_carbon/_gdi.py | python | DC.DrawArc | (*args, **kwargs) | return _gdi_.DC_DrawArc(*args, **kwargs) | DrawArc(self, int x1, int y1, int x2, int y2, int xc, int yc)
Draws an arc of a circle, centred on the *center* point (xc, yc), from
the first point to the second. The current pen is used for the outline
and the current brush for filling the shape.
The arc is drawn in an anticlockwise ... | DrawArc(self, int x1, int y1, int x2, int y2, int xc, int yc) | [
"DrawArc",
"(",
"self",
"int",
"x1",
"int",
"y1",
"int",
"x2",
"int",
"y2",
"int",
"xc",
"int",
"yc",
")"
] | def DrawArc(*args, **kwargs):
"""
DrawArc(self, int x1, int y1, int x2, int y2, int xc, int yc)
Draws an arc of a circle, centred on the *center* point (xc, yc), from
the first point to the second. The current pen is used for the outline
and the current brush for filling the sha... | [
"def",
"DrawArc",
"(",
"*",
"args",
",",
"*",
"*",
"kwargs",
")",
":",
"return",
"_gdi_",
".",
"DC_DrawArc",
"(",
"*",
"args",
",",
"*",
"*",
"kwargs",
")"
] | https://github.com/wxWidgets/wxPython-Classic/blob/19571e1ae65f1ac445f5491474121998c97a1bf0/src/osx_carbon/_gdi.py#L3448-L3459 | |
cms-sw/cmssw | fd9de012d503d3405420bcbeec0ec879baa57cf2 | PhysicsTools/Heppy/python/analyzers/examples/ZMuMuAnalyzer.py | python | ZMuMuAnalyzer.buildDiLeptons | (self, cmgDiLeptons, event) | return diLeptons | Build di-leptons, associate best vertex to both legs,
select di-leptons with a tight ID muon.
The tight ID selection is done so that dxy and dz can be computed
(the muon must not be standalone). | Build di-leptons, associate best vertex to both legs,
select di-leptons with a tight ID muon.
The tight ID selection is done so that dxy and dz can be computed
(the muon must not be standalone). | [
"Build",
"di",
"-",
"leptons",
"associate",
"best",
"vertex",
"to",
"both",
"legs",
"select",
"di",
"-",
"leptons",
"with",
"a",
"tight",
"ID",
"muon",
".",
"The",
"tight",
"ID",
"selection",
"is",
"done",
"so",
"that",
"dxy",
"and",
"dz",
"can",
"be",... | def buildDiLeptons(self, cmgDiLeptons, event):
'''Build di-leptons, associate best vertex to both legs,
select di-leptons with a tight ID muon.
The tight ID selection is done so that dxy and dz can be computed
(the muon must not be standalone).
'''
diLeptons = []
... | [
"def",
"buildDiLeptons",
"(",
"self",
",",
"cmgDiLeptons",
",",
"event",
")",
":",
"diLeptons",
"=",
"[",
"]",
"for",
"index",
",",
"dil",
"in",
"enumerate",
"(",
"cmgDiLeptons",
")",
":",
"pydil",
"=",
"self",
".",
"__class__",
".",
"DiObjectClass",
"("... | https://github.com/cms-sw/cmssw/blob/fd9de012d503d3405420bcbeec0ec879baa57cf2/PhysicsTools/Heppy/python/analyzers/examples/ZMuMuAnalyzer.py#L30-L42 | |
KratosMultiphysics/Kratos | 0000833054ed0503424eb28205d6508d9ca6cbbc | applications/MeshingApplication/python_scripts/multiscale_refining_process.py | python | MultiscaleRefiningProcess._GenerateVariableListFromInput | (self,param) | return [ KratosMultiphysics.KratosGlobals.GetVariable( param[i].GetString() ) for i in range( 0,param.size() ) ] | Parse a list of variables from input. | Parse a list of variables from input. | [
"Parse",
"a",
"list",
"of",
"variables",
"from",
"input",
"."
] | def _GenerateVariableListFromInput(self,param):
'''Parse a list of variables from input.'''
# At least verify that the input is a string
if not param.IsArray():
raise Exception("{0} Error: Variable list is unreadable".format(self.__class__.__name__))
# Retrieve variable name... | [
"def",
"_GenerateVariableListFromInput",
"(",
"self",
",",
"param",
")",
":",
"# At least verify that the input is a string",
"if",
"not",
"param",
".",
"IsArray",
"(",
")",
":",
"raise",
"Exception",
"(",
"\"{0} Error: Variable list is unreadable\"",
".",
"format",
"("... | https://github.com/KratosMultiphysics/Kratos/blob/0000833054ed0503424eb28205d6508d9ca6cbbc/applications/MeshingApplication/python_scripts/multiscale_refining_process.py#L185-L192 | |
monacoinproject/monacoin | 0d94a247eeabf0c1ed43ff1e1a62d115043a056e | contrib/linearize/linearize-data.py | python | hex_switchEndian | (s) | return b''.join(pairList[::-1]).decode() | Switches the endianness of a hex string (in pairs of hex chars) | Switches the endianness of a hex string (in pairs of hex chars) | [
"Switches",
"the",
"endianness",
"of",
"a",
"hex",
"string",
"(",
"in",
"pairs",
"of",
"hex",
"chars",
")"
] | def hex_switchEndian(s):
""" Switches the endianness of a hex string (in pairs of hex chars) """
pairList = [s[i:i+2].encode() for i in range(0, len(s), 2)]
return b''.join(pairList[::-1]).decode() | [
"def",
"hex_switchEndian",
"(",
"s",
")",
":",
"pairList",
"=",
"[",
"s",
"[",
"i",
":",
"i",
"+",
"2",
"]",
".",
"encode",
"(",
")",
"for",
"i",
"in",
"range",
"(",
"0",
",",
"len",
"(",
"s",
")",
",",
"2",
")",
"]",
"return",
"b''",
".",
... | https://github.com/monacoinproject/monacoin/blob/0d94a247eeabf0c1ed43ff1e1a62d115043a056e/contrib/linearize/linearize-data.py#L24-L27 | |
hanpfei/chromium-net | 392cc1fa3a8f92f42e4071ab6e674d8e0482f83f | tools/run-bisect-perf-regression.py | python | _RunBisectionScript | (
config, working_directory, path_to_goma, path_to_extra_src, dry_run) | return return_code | Attempts to execute the bisect script with the given parameters.
Args:
config: A dict containing the parameters to pass to the script.
working_directory: A working directory to provide to the bisect script,
where it will store it's own copy of the depot.
path_to_goma: Path to goma directory.
pa... | Attempts to execute the bisect script with the given parameters. | [
"Attempts",
"to",
"execute",
"the",
"bisect",
"script",
"with",
"the",
"given",
"parameters",
"."
] | def _RunBisectionScript(
config, working_directory, path_to_goma, path_to_extra_src, dry_run):
"""Attempts to execute the bisect script with the given parameters.
Args:
config: A dict containing the parameters to pass to the script.
working_directory: A working directory to provide to the bisect script... | [
"def",
"_RunBisectionScript",
"(",
"config",
",",
"working_directory",
",",
"path_to_goma",
",",
"path_to_extra_src",
",",
"dry_run",
")",
":",
"_PrintConfigStep",
"(",
"config",
")",
"# Construct the basic command with all necessary arguments.",
"cmd",
"=",
"[",
"'python... | https://github.com/hanpfei/chromium-net/blob/392cc1fa3a8f92f42e4071ab6e674d8e0482f83f/tools/run-bisect-perf-regression.py#L496-L585 | |
Xilinx/Vitis-AI | fc74d404563d9951b57245443c73bef389f3657f | tools/Vitis-AI-Quantizer/vai_q_tensorflow1.x/tensorflow/contrib/timeseries/python/timeseries/head.py | python | OneShotPredictionHead._serving_ops | (self, features) | return estimator_lib.EstimatorSpec(
mode=estimator_lib.ModeKeys.PREDICT,
export_outputs={
feature_keys.SavedModelLabels.PREDICT:
_NoStatePredictOutput(prediction_outputs),
},
# Likely unused, but it is necessary to return `predictions` to satisfy
# the... | Add ops for serving to the graph. | Add ops for serving to the graph. | [
"Add",
"ops",
"for",
"serving",
"to",
"the",
"graph",
"."
] | def _serving_ops(self, features):
"""Add ops for serving to the graph."""
with variable_scope.variable_scope("model", use_resource=True):
filtering_features = {}
prediction_features = {}
values_length = array_ops.shape(
features[feature_keys.FilteringFeatures.VALUES])[1]
for ke... | [
"def",
"_serving_ops",
"(",
"self",
",",
"features",
")",
":",
"with",
"variable_scope",
".",
"variable_scope",
"(",
"\"model\"",
",",
"use_resource",
"=",
"True",
")",
":",
"filtering_features",
"=",
"{",
"}",
"prediction_features",
"=",
"{",
"}",
"values_len... | https://github.com/Xilinx/Vitis-AI/blob/fc74d404563d9951b57245443c73bef389f3657f/tools/Vitis-AI-Quantizer/vai_q_tensorflow1.x/tensorflow/contrib/timeseries/python/timeseries/head.py#L335-L367 | |
wxWidgets/wxPython-Classic | 19571e1ae65f1ac445f5491474121998c97a1bf0 | src/osx_cocoa/propgrid.py | python | PropertyGrid.GetCommonValue | (*args, **kwargs) | return _propgrid.PropertyGrid_GetCommonValue(*args, **kwargs) | GetCommonValue(self, int i) -> PGCommonValue | GetCommonValue(self, int i) -> PGCommonValue | [
"GetCommonValue",
"(",
"self",
"int",
"i",
")",
"-",
">",
"PGCommonValue"
] | def GetCommonValue(*args, **kwargs):
"""GetCommonValue(self, int i) -> PGCommonValue"""
return _propgrid.PropertyGrid_GetCommonValue(*args, **kwargs) | [
"def",
"GetCommonValue",
"(",
"*",
"args",
",",
"*",
"*",
"kwargs",
")",
":",
"return",
"_propgrid",
".",
"PropertyGrid_GetCommonValue",
"(",
"*",
"args",
",",
"*",
"*",
"kwargs",
")"
] | https://github.com/wxWidgets/wxPython-Classic/blob/19571e1ae65f1ac445f5491474121998c97a1bf0/src/osx_cocoa/propgrid.py#L2320-L2322 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.