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 |
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
klzgrad/naiveproxy | ed2c513637c77b18721fe428d7ed395b4d284c83 | src/build/toolchain/win/rc/rc.py | python | ReadInput | (input) | return rc_file_data, is_utf8 | Reads input and returns it. For UTF-16LEBOM input, converts to UTF-8. | Reads input and returns it. For UTF-16LEBOM input, converts to UTF-8. | [
"Reads",
"input",
"and",
"returns",
"it",
".",
"For",
"UTF",
"-",
"16LEBOM",
"input",
"converts",
"to",
"UTF",
"-",
"8",
"."
] | def ReadInput(input):
""""Reads input and returns it. For UTF-16LEBOM input, converts to UTF-8."""
# Microsoft's rc.exe only supports unicode in the form of UTF-16LE with a BOM.
# Our rc binary sniffs for UTF-16LE. If that's not found, if /utf-8 is
# passed, the input is treated as UTF-8. If /utf-8 is not pas... | [
"def",
"ReadInput",
"(",
"input",
")",
":",
"# Microsoft's rc.exe only supports unicode in the form of UTF-16LE with a BOM.",
"# Our rc binary sniffs for UTF-16LE. If that's not found, if /utf-8 is",
"# passed, the input is treated as UTF-8. If /utf-8 is not passed and the",
"# input is not UTF-... | https://github.com/klzgrad/naiveproxy/blob/ed2c513637c77b18721fe428d7ed395b4d284c83/src/build/toolchain/win/rc/rc.py#L96-L122 | |
trilinos/Trilinos | 6168be6dd51e35e1cd681e9c4b24433e709df140 | packages/muelu/doc/Tutorial/src/hands-on.py | python | deleteDir | (path) | deletes the path entirely | deletes the path entirely | [
"deletes",
"the",
"path",
"entirely"
] | def deleteDir(path):
"""deletes the path entirely"""
cmd = "rm -rf "+path
result = getstatusoutput(cmd)
if(result[0]!=0):
raise RuntimeError(result[1]) | [
"def",
"deleteDir",
"(",
"path",
")",
":",
"cmd",
"=",
"\"rm -rf \"",
"+",
"path",
"result",
"=",
"getstatusoutput",
"(",
"cmd",
")",
"if",
"(",
"result",
"[",
"0",
"]",
"!=",
"0",
")",
":",
"raise",
"RuntimeError",
"(",
"result",
"[",
"1",
"]",
")... | https://github.com/trilinos/Trilinos/blob/6168be6dd51e35e1cd681e9c4b24433e709df140/packages/muelu/doc/Tutorial/src/hands-on.py#L17-L22 | ||
RamadhanAmizudin/malware | 2c6c53c8b0d556f5d8078d6ca0fc4448f4697cf1 | Fuzzbunch/fuzzbunch/coli.py | python | CommandlineWrapper.doRendezvousServer | (self, rendezvous, sock) | return 0 | Setup the rendezvous server so the next plugin can talk 'through' us | Setup the rendezvous server so the next plugin can talk 'through' us | [
"Setup",
"the",
"rendezvous",
"server",
"so",
"the",
"next",
"plugin",
"can",
"talk",
"through",
"us"
] | def doRendezvousServer(self, rendezvous, sock):
"""Setup the rendezvous server so the next plugin can talk 'through' us"""
if sock is not None:
r = ctypes.c_uint(sock)
if -1 == exma.sendSockets(r):
return -1
exma.closeRendezvous( ctypes.c_ushort(rendez... | [
"def",
"doRendezvousServer",
"(",
"self",
",",
"rendezvous",
",",
"sock",
")",
":",
"if",
"sock",
"is",
"not",
"None",
":",
"r",
"=",
"ctypes",
".",
"c_uint",
"(",
"sock",
")",
"if",
"-",
"1",
"==",
"exma",
".",
"sendSockets",
"(",
"r",
")",
":",
... | https://github.com/RamadhanAmizudin/malware/blob/2c6c53c8b0d556f5d8078d6ca0fc4448f4697cf1/Fuzzbunch/fuzzbunch/coli.py#L237-L245 | |
aws/lumberyard | f85344403c1c2e77ec8c75deb2c116e97b713217 | dev/Gems/CloudGemMetric/v1/AWS/python/windows/Lib/pandas/io/common.py | python | is_url | (url) | return parse_url(url).scheme in _VALID_URLS | Check to see if a URL has a valid protocol.
Parameters
----------
url : str or unicode
Returns
-------
isurl : bool
If `url` has a valid protocol return True otherwise False. | Check to see if a URL has a valid protocol. | [
"Check",
"to",
"see",
"if",
"a",
"URL",
"has",
"a",
"valid",
"protocol",
"."
] | def is_url(url) -> bool:
"""
Check to see if a URL has a valid protocol.
Parameters
----------
url : str or unicode
Returns
-------
isurl : bool
If `url` has a valid protocol return True otherwise False.
"""
if not isinstance(url, str):
return False
return p... | [
"def",
"is_url",
"(",
"url",
")",
"->",
"bool",
":",
"if",
"not",
"isinstance",
"(",
"url",
",",
"str",
")",
":",
"return",
"False",
"return",
"parse_url",
"(",
"url",
")",
".",
"scheme",
"in",
"_VALID_URLS"
] | https://github.com/aws/lumberyard/blob/f85344403c1c2e77ec8c75deb2c116e97b713217/dev/Gems/CloudGemMetric/v1/AWS/python/windows/Lib/pandas/io/common.py#L40-L55 | |
aws/lumberyard | f85344403c1c2e77ec8c75deb2c116e97b713217 | dev/Gems/CloudGemMetric/v1/AWS/python/windows/Lib/numpy/polynomial/hermite.py | python | hermweight | (x) | return w | Weight function of the Hermite polynomials.
The weight function is :math:`\\exp(-x^2)` and the interval of
integration is :math:`[-\\inf, \\inf]`. the Hermite polynomials are
orthogonal, but not normalized, with respect to this weight function.
Parameters
----------
x : array_like
Value... | Weight function of the Hermite polynomials. | [
"Weight",
"function",
"of",
"the",
"Hermite",
"polynomials",
"."
] | def hermweight(x):
"""
Weight function of the Hermite polynomials.
The weight function is :math:`\\exp(-x^2)` and the interval of
integration is :math:`[-\\inf, \\inf]`. the Hermite polynomials are
orthogonal, but not normalized, with respect to this weight function.
Parameters
----------
... | [
"def",
"hermweight",
"(",
"x",
")",
":",
"w",
"=",
"np",
".",
"exp",
"(",
"-",
"x",
"**",
"2",
")",
"return",
"w"
] | https://github.com/aws/lumberyard/blob/f85344403c1c2e77ec8c75deb2c116e97b713217/dev/Gems/CloudGemMetric/v1/AWS/python/windows/Lib/numpy/polynomial/hermite.py#L1595-L1620 | |
tensorflow/tensorflow | 419e3a6b650ea4bd1b0cba23c4348f8a69f3272e | tensorflow/lite/python/util.py | python | convert_bytes_to_c_source | (data,
array_name,
max_line_width=80,
include_guard=None,
include_path=None,
use_tensorflow_license=False) | return source_text, header_text | Returns strings representing a C constant array containing `data`.
Args:
data: Byte array that will be converted into a C constant.
array_name: String to use as the variable name for the constant array.
max_line_width: The longest line length, for formatting purposes.
include_guard: Name to use for t... | Returns strings representing a C constant array containing `data`. | [
"Returns",
"strings",
"representing",
"a",
"C",
"constant",
"array",
"containing",
"data",
"."
] | def convert_bytes_to_c_source(data,
array_name,
max_line_width=80,
include_guard=None,
include_path=None,
use_tensorflow_license=False):
"""Returns strings representing... | [
"def",
"convert_bytes_to_c_source",
"(",
"data",
",",
"array_name",
",",
"max_line_width",
"=",
"80",
",",
"include_guard",
"=",
"None",
",",
"include_path",
"=",
"None",
",",
"use_tensorflow_license",
"=",
"False",
")",
":",
"starting_pad",
"=",
"\" \"",
"arr... | https://github.com/tensorflow/tensorflow/blob/419e3a6b650ea4bd1b0cba23c4348f8a69f3272e/tensorflow/lite/python/util.py#L433-L550 | |
mantidproject/mantid | 03deeb89254ec4289edb8771e0188c2090a02f32 | scripts/Inelastic/Direct/DirectEnergyConversion.py | python | DirectEnergyConversion._clear_old_results | (self) | Remove workspaces, processed earlier and not used any more | Remove workspaces, processed earlier and not used any more | [
"Remove",
"workspaces",
"processed",
"earlier",
"and",
"not",
"used",
"any",
"more"
] | def _clear_old_results(self):
"""Remove workspaces, processed earlier and not used any more"""
ws_list = self._old_runs_list
for ws_name in ws_list:
if ws_name in mtd:
DeleteWorkspace(ws_name)
object.__setattr__(self,'_old_runs_list',[]) | [
"def",
"_clear_old_results",
"(",
"self",
")",
":",
"ws_list",
"=",
"self",
".",
"_old_runs_list",
"for",
"ws_name",
"in",
"ws_list",
":",
"if",
"ws_name",
"in",
"mtd",
":",
"DeleteWorkspace",
"(",
"ws_name",
")",
"object",
".",
"__setattr__",
"(",
"self",
... | https://github.com/mantidproject/mantid/blob/03deeb89254ec4289edb8771e0188c2090a02f32/scripts/Inelastic/Direct/DirectEnergyConversion.py#L1944-L1950 | ||
catboost/catboost | 167f64f237114a4d10b2b4ee42adb4569137debe | catboost/python-package/catboost/core.py | python | Pool._check_label_shape | (self, label, samples_count) | Check label length and dimension. | Check label length and dimension. | [
"Check",
"label",
"length",
"and",
"dimension",
"."
] | def _check_label_shape(self, label, samples_count):
"""
Check label length and dimension.
"""
if len(label) != samples_count:
raise CatBoostError("Length of label={} and length of data={} is different.".format(len(label), samples_count)) | [
"def",
"_check_label_shape",
"(",
"self",
",",
"label",
",",
"samples_count",
")",
":",
"if",
"len",
"(",
"label",
")",
"!=",
"samples_count",
":",
"raise",
"CatBoostError",
"(",
"\"Length of label={} and length of data={} is different.\"",
".",
"format",
"(",
"len"... | https://github.com/catboost/catboost/blob/167f64f237114a4d10b2b4ee42adb4569137debe/catboost/python-package/catboost/core.py#L859-L864 | ||
google-ar/WebARonTango | e86965d2cbc652156b480e0fcf77c716745578cd | chromium/src/gpu/command_buffer/build_gles2_cmd_buffer.py | python | Argument.GetInvalidArg | (self, index) | return ("---ERROR0---", "---ERROR2---", None) | returns an invalid value and expected parse result by index. | returns an invalid value and expected parse result by index. | [
"returns",
"an",
"invalid",
"value",
"and",
"expected",
"parse",
"result",
"by",
"index",
"."
] | def GetInvalidArg(self, index):
"""returns an invalid value and expected parse result by index."""
return ("---ERROR0---", "---ERROR2---", None) | [
"def",
"GetInvalidArg",
"(",
"self",
",",
"index",
")",
":",
"return",
"(",
"\"---ERROR0---\"",
",",
"\"---ERROR2---\"",
",",
"None",
")"
] | https://github.com/google-ar/WebARonTango/blob/e86965d2cbc652156b480e0fcf77c716745578cd/chromium/src/gpu/command_buffer/build_gles2_cmd_buffer.py#L8583-L8585 | |
neoml-lib/neoml | a0d370fba05269a1b2258cef126f77bbd2054a3e | NeoML/Python/neoml/Dnn/Conv.py | python | ChannelwiseConv.filter_size | (self) | return self._internal.get_filter_height(), self._internal.get_filter_width() | Gets the filter size. | Gets the filter size. | [
"Gets",
"the",
"filter",
"size",
"."
] | def filter_size(self):
"""Gets the filter size.
"""
return self._internal.get_filter_height(), self._internal.get_filter_width() | [
"def",
"filter_size",
"(",
"self",
")",
":",
"return",
"self",
".",
"_internal",
".",
"get_filter_height",
"(",
")",
",",
"self",
".",
"_internal",
".",
"get_filter_width",
"(",
")"
] | https://github.com/neoml-lib/neoml/blob/a0d370fba05269a1b2258cef126f77bbd2054a3e/NeoML/Python/neoml/Dnn/Conv.py#L899-L902 | |
kamyu104/LeetCode-Solutions | 77605708a927ea3b85aee5a479db733938c7c211 | Python/minimum-cost-to-separate-sentence-into-rows.py | python | Solution2.minimumCost | (self, sentence, k) | return dp[0] | :type sentence: str
:type k: int
:rtype: int | :type sentence: str
:type k: int
:rtype: int | [
":",
"type",
"sentence",
":",
"str",
":",
"type",
"k",
":",
"int",
":",
"rtype",
":",
"int"
] | def minimumCost(self, sentence, k):
"""
:type sentence: str
:type k: int
:rtype: int
"""
word_lens = []
j = 0
for i in xrange(len(sentence)+1):
if i != len(sentence) and sentence[i] != ' ':
continue
word_lens.append(... | [
"def",
"minimumCost",
"(",
"self",
",",
"sentence",
",",
"k",
")",
":",
"word_lens",
"=",
"[",
"]",
"j",
"=",
"0",
"for",
"i",
"in",
"xrange",
"(",
"len",
"(",
"sentence",
")",
"+",
"1",
")",
":",
"if",
"i",
"!=",
"len",
"(",
"sentence",
")",
... | https://github.com/kamyu104/LeetCode-Solutions/blob/77605708a927ea3b85aee5a479db733938c7c211/Python/minimum-cost-to-separate-sentence-into-rows.py#L41-L67 | |
baidu-research/tensorflow-allreduce | 66d5b855e90b0949e9fa5cca5599fd729a70e874 | tensorflow/contrib/metrics/python/ops/metric_ops.py | python | streaming_auc | (predictions, labels, weights=None, num_thresholds=200,
metrics_collections=None, updates_collections=None,
curve='ROC', name=None) | return metrics.auc(
predictions=predictions, labels=labels, weights=weights,
metrics_collections=metrics_collections, num_thresholds=num_thresholds,
curve=curve, updates_collections=updates_collections, name=name) | Computes the approximate AUC via a Riemann sum.
The `streaming_auc` function creates four local variables, `true_positives`,
`true_negatives`, `false_positives` and `false_negatives` that are used to
compute the AUC. To discretize the AUC curve, a linearly spaced set of
thresholds is used to compute pairs of r... | Computes the approximate AUC via a Riemann sum. | [
"Computes",
"the",
"approximate",
"AUC",
"via",
"a",
"Riemann",
"sum",
"."
] | def streaming_auc(predictions, labels, weights=None, num_thresholds=200,
metrics_collections=None, updates_collections=None,
curve='ROC', name=None):
"""Computes the approximate AUC via a Riemann sum.
The `streaming_auc` function creates four local variables, `true_positives`,
... | [
"def",
"streaming_auc",
"(",
"predictions",
",",
"labels",
",",
"weights",
"=",
"None",
",",
"num_thresholds",
"=",
"200",
",",
"metrics_collections",
"=",
"None",
",",
"updates_collections",
"=",
"None",
",",
"curve",
"=",
"'ROC'",
",",
"name",
"=",
"None",... | https://github.com/baidu-research/tensorflow-allreduce/blob/66d5b855e90b0949e9fa5cca5599fd729a70e874/tensorflow/contrib/metrics/python/ops/metric_ops.py#L833-L894 | |
domino-team/openwrt-cc | 8b181297c34d14d3ca521cc9f31430d561dbc688 | package/gli-pub/openwrt-node-packages-master/node/node-v6.9.1/tools/gyp/pylib/gyp/easy_xml.py | python | WriteXmlIfChanged | (content, path, encoding='utf-8', pretty=False,
win32=False) | Writes the XML content to disk, touching the file only if it has changed.
Args:
content: The structured content to be written.
path: Location of the file.
encoding: The encoding to report on the first line of the XML file.
pretty: True if we want pretty printing with indents and new lines. | Writes the XML content to disk, touching the file only if it has changed. | [
"Writes",
"the",
"XML",
"content",
"to",
"disk",
"touching",
"the",
"file",
"only",
"if",
"it",
"has",
"changed",
"."
] | def WriteXmlIfChanged(content, path, encoding='utf-8', pretty=False,
win32=False):
""" Writes the XML content to disk, touching the file only if it has changed.
Args:
content: The structured content to be written.
path: Location of the file.
encoding: The encoding to report on th... | [
"def",
"WriteXmlIfChanged",
"(",
"content",
",",
"path",
",",
"encoding",
"=",
"'utf-8'",
",",
"pretty",
"=",
"False",
",",
"win32",
"=",
"False",
")",
":",
"xml_string",
"=",
"XmlToString",
"(",
"content",
",",
"encoding",
",",
"pretty",
")",
"if",
"win... | https://github.com/domino-team/openwrt-cc/blob/8b181297c34d14d3ca521cc9f31430d561dbc688/package/gli-pub/openwrt-node-packages-master/node/node-v6.9.1/tools/gyp/pylib/gyp/easy_xml.py#L105-L131 | ||
mantidproject/mantid | 03deeb89254ec4289edb8771e0188c2090a02f32 | qt/python/mantidqtinterfaces/mantidqtinterfaces/Muon/GUI/Common/contexts/fitting_contexts/basic_fitting_context.py | python | BasicFittingContext.plot_guess_points | (self) | return self._plot_guess_points | Returns the number of points to use in the guess plot. | Returns the number of points to use in the guess plot. | [
"Returns",
"the",
"number",
"of",
"points",
"to",
"use",
"in",
"the",
"guess",
"plot",
"."
] | def plot_guess_points(self) -> int:
"""Returns the number of points to use in the guess plot."""
return self._plot_guess_points | [
"def",
"plot_guess_points",
"(",
"self",
")",
"->",
"int",
":",
"return",
"self",
".",
"_plot_guess_points"
] | https://github.com/mantidproject/mantid/blob/03deeb89254ec4289edb8771e0188c2090a02f32/qt/python/mantidqtinterfaces/mantidqtinterfaces/Muon/GUI/Common/contexts/fitting_contexts/basic_fitting_context.py#L227-L229 | |
wxWidgets/wxPython-Classic | 19571e1ae65f1ac445f5491474121998c97a1bf0 | src/osx_carbon/_core.py | python | Image.ComputeHistogram | (*args, **kwargs) | return _core_.Image_ComputeHistogram(*args, **kwargs) | ComputeHistogram(self, ImageHistogram h) -> unsigned long | ComputeHistogram(self, ImageHistogram h) -> unsigned long | [
"ComputeHistogram",
"(",
"self",
"ImageHistogram",
"h",
")",
"-",
">",
"unsigned",
"long"
] | def ComputeHistogram(*args, **kwargs):
"""ComputeHistogram(self, ImageHistogram h) -> unsigned long"""
return _core_.Image_ComputeHistogram(*args, **kwargs) | [
"def",
"ComputeHistogram",
"(",
"*",
"args",
",",
"*",
"*",
"kwargs",
")",
":",
"return",
"_core_",
".",
"Image_ComputeHistogram",
"(",
"*",
"args",
",",
"*",
"*",
"kwargs",
")"
] | https://github.com/wxWidgets/wxPython-Classic/blob/19571e1ae65f1ac445f5491474121998c97a1bf0/src/osx_carbon/_core.py#L3609-L3611 | |
PX4/PX4-Autopilot | 0b9f60a0370be53d683352c63fd92db3d6586e18 | Tools/px4events/srcparser.py | python | Event._shift_printed_arguments | (self, msg, offset) | return msg | shift all {<idx> arguments by an offset | shift all {<idx> arguments by an offset | [
"shift",
"all",
"{",
"<idx",
">",
"arguments",
"by",
"an",
"offset"
] | def _shift_printed_arguments(self, msg, offset):
""" shift all {<idx> arguments by an offset """
i = 0
while i < len(msg):
if msg[i] == '\\': # escaped character
i += 2
continue
if msg[i] == '{':
m = re.match(r"^(\d+)", ms... | [
"def",
"_shift_printed_arguments",
"(",
"self",
",",
"msg",
",",
"offset",
")",
":",
"i",
"=",
"0",
"while",
"i",
"<",
"len",
"(",
"msg",
")",
":",
"if",
"msg",
"[",
"i",
"]",
"==",
"'\\\\'",
":",
"# escaped character",
"i",
"+=",
"2",
"continue",
... | https://github.com/PX4/PX4-Autopilot/blob/0b9f60a0370be53d683352c63fd92db3d6586e18/Tools/px4events/srcparser.py#L42-L57 | |
apple/swift-lldb | d74be846ef3e62de946df343e8c234bde93a8912 | scripts/Python/static-binding/lldb.py | python | SBType.__eq__ | (self, rhs) | return _lldb.SBType___eq__(self, rhs) | __eq__(SBType self, SBType rhs) -> bool | __eq__(SBType self, SBType rhs) -> bool | [
"__eq__",
"(",
"SBType",
"self",
"SBType",
"rhs",
")",
"-",
">",
"bool"
] | def __eq__(self, rhs):
"""__eq__(SBType self, SBType rhs) -> bool"""
return _lldb.SBType___eq__(self, rhs) | [
"def",
"__eq__",
"(",
"self",
",",
"rhs",
")",
":",
"return",
"_lldb",
".",
"SBType___eq__",
"(",
"self",
",",
"rhs",
")"
] | https://github.com/apple/swift-lldb/blob/d74be846ef3e62de946df343e8c234bde93a8912/scripts/Python/static-binding/lldb.py#L12820-L12822 | |
aws/lumberyard | f85344403c1c2e77ec8c75deb2c116e97b713217 | dev/Tools/Python/3.7.10/mac/Python.framework/Versions/3.7/lib/python3.7/_pyio.py | python | IOBase.fileno | (self) | Returns underlying file descriptor (an int) if one exists.
An OSError is raised if the IO object does not use a file descriptor. | Returns underlying file descriptor (an int) if one exists. | [
"Returns",
"underlying",
"file",
"descriptor",
"(",
"an",
"int",
")",
"if",
"one",
"exists",
"."
] | def fileno(self):
"""Returns underlying file descriptor (an int) if one exists.
An OSError is raised if the IO object does not use a file descriptor.
"""
self._unsupported("fileno") | [
"def",
"fileno",
"(",
"self",
")",
":",
"self",
".",
"_unsupported",
"(",
"\"fileno\"",
")"
] | https://github.com/aws/lumberyard/blob/f85344403c1c2e77ec8c75deb2c116e97b713217/dev/Tools/Python/3.7.10/mac/Python.framework/Versions/3.7/lib/python3.7/_pyio.py#L461-L466 | ||
wxWidgets/wxPython-Classic | 19571e1ae65f1ac445f5491474121998c97a1bf0 | src/osx_carbon/_controls.py | python | TreeEvent.GetKeyEvent | (*args, **kwargs) | return _controls_.TreeEvent_GetKeyEvent(*args, **kwargs) | GetKeyEvent(self) -> KeyEvent | GetKeyEvent(self) -> KeyEvent | [
"GetKeyEvent",
"(",
"self",
")",
"-",
">",
"KeyEvent"
] | def GetKeyEvent(*args, **kwargs):
"""GetKeyEvent(self) -> KeyEvent"""
return _controls_.TreeEvent_GetKeyEvent(*args, **kwargs) | [
"def",
"GetKeyEvent",
"(",
"*",
"args",
",",
"*",
"*",
"kwargs",
")",
":",
"return",
"_controls_",
".",
"TreeEvent_GetKeyEvent",
"(",
"*",
"args",
",",
"*",
"*",
"kwargs",
")"
] | https://github.com/wxWidgets/wxPython-Classic/blob/19571e1ae65f1ac445f5491474121998c97a1bf0/src/osx_carbon/_controls.py#L5132-L5134 | |
eclipse/sumo | 7132a9b8b6eea734bdec38479026b4d8c4336d03 | tools/contributed/sumopy/coremodules/demand/virtualpop_wxgui.py | python | VirtualpopWxGuiMixin.on_plot_strategies | (self, event=None) | Plot different results on strategies in Matplotlib plotting envitonment. | Plot different results on strategies in Matplotlib plotting envitonment. | [
"Plot",
"different",
"results",
"on",
"strategies",
"in",
"Matplotlib",
"plotting",
"envitonment",
"."
] | def on_plot_strategies(self, event=None):
"""
Plot different results on strategies in Matplotlib plotting envitonment.
"""
if is_mpl:
resultplotter = results_mpl.StrategyPlotter(self._demand.virtualpop,
logger=self._main... | [
"def",
"on_plot_strategies",
"(",
"self",
",",
"event",
"=",
"None",
")",
":",
"if",
"is_mpl",
":",
"resultplotter",
"=",
"results_mpl",
".",
"StrategyPlotter",
"(",
"self",
".",
"_demand",
".",
"virtualpop",
",",
"logger",
"=",
"self",
".",
"_mainframe",
... | https://github.com/eclipse/sumo/blob/7132a9b8b6eea734bdec38479026b4d8c4336d03/tools/contributed/sumopy/coremodules/demand/virtualpop_wxgui.py#L358-L382 | ||
mindspore-ai/mindspore | fb8fd3338605bb34fa5cea054e535a8b1d753fab | mindspore/python/mindspore/_extends/parse/parser.py | python | Parser.is_unsupported_python_builtin_type | (self, value) | return unsupported | To check if not supported builtin type | To check if not supported builtin type | [
"To",
"check",
"if",
"not",
"supported",
"builtin",
"type"
] | def is_unsupported_python_builtin_type(self, value):
"""To check if not supported builtin type"""
unsupported = value in _unsupported_python_builtin_type
logger.debug(f"value: '{value}', unsupported builtin type: {unsupported}.")
return unsupported | [
"def",
"is_unsupported_python_builtin_type",
"(",
"self",
",",
"value",
")",
":",
"unsupported",
"=",
"value",
"in",
"_unsupported_python_builtin_type",
"logger",
".",
"debug",
"(",
"f\"value: '{value}', unsupported builtin type: {unsupported}.\"",
")",
"return",
"unsupported... | https://github.com/mindspore-ai/mindspore/blob/fb8fd3338605bb34fa5cea054e535a8b1d753fab/mindspore/python/mindspore/_extends/parse/parser.py#L656-L660 | |
plaidml/plaidml | f3c6681db21460e5fdc11ae651d6d7b6c27f8262 | plaidml/edsl/__init__.py | python | IndexedTensor.__add__ | (self, rhs) | return IndexedTensor(lib.PLAIDML_COMBO_OP_ADD, args=(self, rhs)) | Represents an `addition` combination within a contraction.
Example:
>>> i, j, k = TensorIndexes(3)
>>> A = Placeholder(DType.FLOAT32, [3, 3])
>>> B = Placeholder(DType.FLOAT32, [3, 3])
>>> A[i, j] + B[j, k] | Represents an `addition` combination within a contraction. | [
"Represents",
"an",
"addition",
"combination",
"within",
"a",
"contraction",
"."
] | def __add__(self, rhs):
"""Represents an `addition` combination within a contraction.
Example:
>>> i, j, k = TensorIndexes(3)
>>> A = Placeholder(DType.FLOAT32, [3, 3])
>>> B = Placeholder(DType.FLOAT32, [3, 3])
>>> A[i, j] + B[j, k]
"""
r... | [
"def",
"__add__",
"(",
"self",
",",
"rhs",
")",
":",
"return",
"IndexedTensor",
"(",
"lib",
".",
"PLAIDML_COMBO_OP_ADD",
",",
"args",
"=",
"(",
"self",
",",
"rhs",
")",
")"
] | https://github.com/plaidml/plaidml/blob/f3c6681db21460e5fdc11ae651d6d7b6c27f8262/plaidml/edsl/__init__.py#L468-L477 | |
Xilinx/Vitis-AI | fc74d404563d9951b57245443c73bef389f3657f | tools/Vitis-AI-Quantizer/vai_q_tensorflow1.x/tensorflow/tools/tensorflow_builder/config_detector/config_detector.py | python | get_distrib_version | () | return out.strip("\n") | Retrieves distribution version of the operating system.
Returns:
String that is the distribution version.
e.g. '14.04' | Retrieves distribution version of the operating system. | [
"Retrieves",
"distribution",
"version",
"of",
"the",
"operating",
"system",
"."
] | def get_distrib_version():
"""Retrieves distribution version of the operating system.
Returns:
String that is the distribution version.
e.g. '14.04'
"""
key = "distrib_ver"
out, err = run_shell_cmd(cmds_all[PLATFORM][key])
if err and FLAGS.debug:
print(
"Error in detecting distributio... | [
"def",
"get_distrib_version",
"(",
")",
":",
"key",
"=",
"\"distrib_ver\"",
"out",
",",
"err",
"=",
"run_shell_cmd",
"(",
"cmds_all",
"[",
"PLATFORM",
"]",
"[",
"key",
"]",
")",
"if",
"err",
"and",
"FLAGS",
".",
"debug",
":",
"print",
"(",
"\"Error in de... | https://github.com/Xilinx/Vitis-AI/blob/fc74d404563d9951b57245443c73bef389f3657f/tools/Vitis-AI-Quantizer/vai_q_tensorflow1.x/tensorflow/tools/tensorflow_builder/config_detector/config_detector.py#L222-L236 | |
catboost/catboost | 167f64f237114a4d10b2b4ee42adb4569137debe | contrib/python/scipy/py2/scipy/signal/ltisys.py | python | lsim | (system, U, T, X0=None, interp=True) | return T, squeeze(yout), squeeze(xout) | Simulate output of a continuous-time linear system.
Parameters
----------
system : an instance of the LTI class or a tuple describing the system.
The following gives the number of elements in the tuple and
the interpretation:
* 1: (instance of `lti`)
* 2: (num, den)
... | Simulate output of a continuous-time linear system. | [
"Simulate",
"output",
"of",
"a",
"continuous",
"-",
"time",
"linear",
"system",
"."
] | def lsim(system, U, T, X0=None, interp=True):
"""
Simulate output of a continuous-time linear system.
Parameters
----------
system : an instance of the LTI class or a tuple describing the system.
The following gives the number of elements in the tuple and
the interpretation:
... | [
"def",
"lsim",
"(",
"system",
",",
"U",
",",
"T",
",",
"X0",
"=",
"None",
",",
"interp",
"=",
"True",
")",
":",
"if",
"isinstance",
"(",
"system",
",",
"lti",
")",
":",
"sys",
"=",
"system",
".",
"_as_ss",
"(",
")",
"elif",
"isinstance",
"(",
"... | https://github.com/catboost/catboost/blob/167f64f237114a4d10b2b4ee42adb4569137debe/contrib/python/scipy/py2/scipy/signal/ltisys.py#L1870-L2032 | |
tensorflow/tensorflow | 419e3a6b650ea4bd1b0cba23c4348f8a69f3272e | tensorflow/python/tpu/tensor_tracer.py | python | TensorTracer._signature_types | (self) | return {} | Returns a dictionary holding the order of signatures in the cache for the selected trace mode. | Returns a dictionary holding the order of signatures in the cache for the selected trace mode. | [
"Returns",
"a",
"dictionary",
"holding",
"the",
"order",
"of",
"signatures",
"in",
"the",
"cache",
"for",
"the",
"selected",
"trace",
"mode",
"."
] | def _signature_types(self):
"""Returns a dictionary holding the order of signatures in the cache for the selected trace mode."""
if self._parameters.trace_mode in set([
tensor_tracer_flags.TRACE_MODE_NAN_INF,
tensor_tracer_flags.TRACE_MODE_NORM,
tensor_tracer_flags.TRACE_MODE_MAX_ABS]):
... | [
"def",
"_signature_types",
"(",
"self",
")",
":",
"if",
"self",
".",
"_parameters",
".",
"trace_mode",
"in",
"set",
"(",
"[",
"tensor_tracer_flags",
".",
"TRACE_MODE_NAN_INF",
",",
"tensor_tracer_flags",
".",
"TRACE_MODE_NORM",
",",
"tensor_tracer_flags",
".",
"TR... | https://github.com/tensorflow/tensorflow/blob/419e3a6b650ea4bd1b0cba23c4348f8a69f3272e/tensorflow/python/tpu/tensor_tracer.py#L696-L705 | |
PaddlePaddle/Paddle | 1252f4bb3e574df80aa6d18c7ddae1b3a90bd81c | python/paddle/fluid/contrib/mixed_precision/bf16/amp_utils.py | python | _insert_cast_op | (block, op, idx, src_dtype, dest_dtype) | return num_cast_ops | Insert cast op and rename args of input and output.
Args:
block (Program): The block in which the operator is.
op (Operator): The operator to insert cast op.
idx (int): The index of current operator.
src_dtype (VarType): The input variable dtype of cast op.
dest_dtype (VarTy... | Insert cast op and rename args of input and output. | [
"Insert",
"cast",
"op",
"and",
"rename",
"args",
"of",
"input",
"and",
"output",
"."
] | def _insert_cast_op(block, op, idx, src_dtype, dest_dtype):
"""
Insert cast op and rename args of input and output.
Args:
block (Program): The block in which the operator is.
op (Operator): The operator to insert cast op.
idx (int): The index of current operator.
src_dtype (... | [
"def",
"_insert_cast_op",
"(",
"block",
",",
"op",
",",
"idx",
",",
"src_dtype",
",",
"dest_dtype",
")",
":",
"num_cast_ops",
"=",
"0",
"for",
"in_name",
"in",
"op",
".",
"input_names",
":",
"if",
"src_dtype",
"==",
"core",
".",
"VarDesc",
".",
"VarType"... | https://github.com/PaddlePaddle/Paddle/blob/1252f4bb3e574df80aa6d18c7ddae1b3a90bd81c/python/paddle/fluid/contrib/mixed_precision/bf16/amp_utils.py#L69-L133 | |
wlanjie/AndroidFFmpeg | 7baf9122f4b8e1c74e7baf4be5c422c7a5ba5aaf | tools/fdk-aac-build/armeabi-v7a/toolchain/lib/python2.7/ftplib.py | python | FTP.retrlines | (self, cmd, callback = None) | return self.voidresp() | Retrieve data in line mode. A new port is created for you.
Args:
cmd: A RETR, LIST, NLST, or MLSD command.
callback: An optional single parameter callable that is called
for each line with the trailing CRLF stripped.
[default: print_line()]
... | Retrieve data in line mode. A new port is created for you. | [
"Retrieve",
"data",
"in",
"line",
"mode",
".",
"A",
"new",
"port",
"is",
"created",
"for",
"you",
"."
] | def retrlines(self, cmd, callback = None):
"""Retrieve data in line mode. A new port is created for you.
Args:
cmd: A RETR, LIST, NLST, or MLSD command.
callback: An optional single parameter callable that is called
for each line with the trailing CRLF stripped.... | [
"def",
"retrlines",
"(",
"self",
",",
"cmd",
",",
"callback",
"=",
"None",
")",
":",
"if",
"callback",
"is",
"None",
":",
"callback",
"=",
"print_line",
"resp",
"=",
"self",
".",
"sendcmd",
"(",
"'TYPE A'",
")",
"conn",
"=",
"self",
".",
"transfercmd",... | https://github.com/wlanjie/AndroidFFmpeg/blob/7baf9122f4b8e1c74e7baf4be5c422c7a5ba5aaf/tools/fdk-aac-build/armeabi-v7a/toolchain/lib/python2.7/ftplib.py#L418-L446 | |
wisdompeak/LeetCode | ef729c1249ead3ead47f1a94b5eeb5958a69e152 | Greedy/452.Minimum-Number-of-Arrows-to-Burst-Balloons/452.Minimum-Number-of-Arrows-to-Burst-Balloons.py | python | Solution.findMinArrowShots | (self, points) | return count | :type points: List[List[int]]
:rtype: int | :type points: List[List[int]]
:rtype: int | [
":",
"type",
"points",
":",
"List",
"[",
"List",
"[",
"int",
"]]",
":",
"rtype",
":",
"int"
] | def findMinArrowShots(self, points):
"""
:type points: List[List[int]]
:rtype: int
"""
points = sorted(points, key=lambda x:x[1])
j = 0
count = 0
while (j<len(points)) :
right = points[j][1]
while (j<len(points) and points[j][0]<=ri... | [
"def",
"findMinArrowShots",
"(",
"self",
",",
"points",
")",
":",
"points",
"=",
"sorted",
"(",
"points",
",",
"key",
"=",
"lambda",
"x",
":",
"x",
"[",
"1",
"]",
")",
"j",
"=",
"0",
"count",
"=",
"0",
"while",
"(",
"j",
"<",
"len",
"(",
"point... | https://github.com/wisdompeak/LeetCode/blob/ef729c1249ead3ead47f1a94b5eeb5958a69e152/Greedy/452.Minimum-Number-of-Arrows-to-Burst-Balloons/452.Minimum-Number-of-Arrows-to-Burst-Balloons.py#L2-L15 | |
BlzFans/wke | b0fa21158312e40c5fbd84682d643022b6c34a93 | cygwin/lib/python2.6/wsgiref/headers.py | python | _formatparam | (param, value=None, quote=1) | Convenience function to format and return a key=value pair.
This will quote the value if needed or if quote is true. | Convenience function to format and return a key=value pair. | [
"Convenience",
"function",
"to",
"format",
"and",
"return",
"a",
"key",
"=",
"value",
"pair",
"."
] | def _formatparam(param, value=None, quote=1):
"""Convenience function to format and return a key=value pair.
This will quote the value if needed or if quote is true.
"""
if value is not None and len(value) > 0:
if quote or tspecials.search(value):
value = value.replace('\\', '\\\\')... | [
"def",
"_formatparam",
"(",
"param",
",",
"value",
"=",
"None",
",",
"quote",
"=",
"1",
")",
":",
"if",
"value",
"is",
"not",
"None",
"and",
"len",
"(",
"value",
")",
">",
"0",
":",
"if",
"quote",
"or",
"tspecials",
".",
"search",
"(",
"value",
"... | https://github.com/BlzFans/wke/blob/b0fa21158312e40c5fbd84682d643022b6c34a93/cygwin/lib/python2.6/wsgiref/headers.py#L15-L27 | ||
InsightSoftwareConsortium/ITK | 87acfce9a93d928311c38bc371b666b515b9f19d | Utilities/Maintenance/FindRedundantHeaderIncludes.py | python | FileToPathMapping.comment_out | (self, filename, remove_header) | Get rid of include lines that are redundant | Get rid of include lines that are redundant | [
"Get",
"rid",
"of",
"include",
"lines",
"that",
"are",
"redundant"
] | def comment_out(self, filename, remove_header):
"""Get rid of include lines that are redundant"""
ff = open(self.filePathBaseDirs[filename] + "/" + filename)
outfile = open(
self.filePathBaseDirs[filename] + "/" + filename + "_cleaned", "w"
)
for line in ff:
... | [
"def",
"comment_out",
"(",
"self",
",",
"filename",
",",
"remove_header",
")",
":",
"ff",
"=",
"open",
"(",
"self",
".",
"filePathBaseDirs",
"[",
"filename",
"]",
"+",
"\"/\"",
"+",
"filename",
")",
"outfile",
"=",
"open",
"(",
"self",
".",
"filePathBase... | https://github.com/InsightSoftwareConsortium/ITK/blob/87acfce9a93d928311c38bc371b666b515b9f19d/Utilities/Maintenance/FindRedundantHeaderIncludes.py#L67-L87 | ||
logcabin/logcabin | ee6c55ae9744b82b451becd9707d26c7c1b6bbfb | scripts/cpplint.py | python | CheckSpacing | (filename, clean_lines, linenum, error) | Checks for the correctness of various spacing issues in the code.
Things we check for: spaces around operators, spaces after
if/for/while/switch, no spaces around parens in function calls, two
spaces between code and comment, don't start a block with a blank
line, don't end a function with a blank line, don't ... | Checks for the correctness of various spacing issues in the code. | [
"Checks",
"for",
"the",
"correctness",
"of",
"various",
"spacing",
"issues",
"in",
"the",
"code",
"."
] | def CheckSpacing(filename, clean_lines, linenum, error):
"""Checks for the correctness of various spacing issues in the code.
Things we check for: spaces around operators, spaces after
if/for/while/switch, no spaces around parens in function calls, two
spaces between code and comment, don't start a block with ... | [
"def",
"CheckSpacing",
"(",
"filename",
",",
"clean_lines",
",",
"linenum",
",",
"error",
")",
":",
"raw",
"=",
"clean_lines",
".",
"raw_lines",
"line",
"=",
"raw",
"[",
"linenum",
"]",
"# Before nixing comments, check if the line is blank for no good",
"# reason. Th... | https://github.com/logcabin/logcabin/blob/ee6c55ae9744b82b451becd9707d26c7c1b6bbfb/scripts/cpplint.py#L1615-L1835 | ||
hanpfei/chromium-net | 392cc1fa3a8f92f42e4071ab6e674d8e0482f83f | third_party/catapult/third_party/gsutil/third_party/boto/boto/route53/zone.py | python | Zone.update_record | (self, old_record, new_value, new_ttl=None,
new_identifier=None, comment="") | return Status(self.route53connection, self._commit(changes)) | Update an existing record in this Zone. Returns a Status object.
:type old_record: ResourceRecord
:param old_record: A ResourceRecord (e.g. returned by find_records)
See _new_record for additional parameter documentation. | Update an existing record in this Zone. Returns a Status object. | [
"Update",
"an",
"existing",
"record",
"in",
"this",
"Zone",
".",
"Returns",
"a",
"Status",
"object",
"."
] | def update_record(self, old_record, new_value, new_ttl=None,
new_identifier=None, comment=""):
"""
Update an existing record in this Zone. Returns a Status object.
:type old_record: ResourceRecord
:param old_record: A ResourceRecord (e.g. returned by find_records)... | [
"def",
"update_record",
"(",
"self",
",",
"old_record",
",",
"new_value",
",",
"new_ttl",
"=",
"None",
",",
"new_identifier",
"=",
"None",
",",
"comment",
"=",
"\"\"",
")",
":",
"new_ttl",
"=",
"new_ttl",
"or",
"default_ttl",
"record",
"=",
"copy",
".",
... | https://github.com/hanpfei/chromium-net/blob/392cc1fa3a8f92f42e4071ab6e674d8e0482f83f/third_party/catapult/third_party/gsutil/third_party/boto/boto/route53/zone.py#L122-L138 | |
miyosuda/TensorFlowAndroidDemo | 35903e0221aa5f109ea2dbef27f20b52e317f42d | jni-build/jni/include/tensorflow/python/ops/nn_ops.py | python | _AvgPoolGradShape | (op) | Shape function for the AvgPoolGrad op. | Shape function for the AvgPoolGrad op. | [
"Shape",
"function",
"for",
"the",
"AvgPoolGrad",
"op",
"."
] | def _AvgPoolGradShape(op):
"""Shape function for the AvgPoolGrad op."""
orig_input_shape = tensor_util.constant_value(op.inputs[0])
if orig_input_shape is not None:
return [tensor_shape.TensorShape(orig_input_shape.tolist())]
else:
# NOTE(mrry): We could in principle work out the shape from the
# gr... | [
"def",
"_AvgPoolGradShape",
"(",
"op",
")",
":",
"orig_input_shape",
"=",
"tensor_util",
".",
"constant_value",
"(",
"op",
".",
"inputs",
"[",
"0",
"]",
")",
"if",
"orig_input_shape",
"is",
"not",
"None",
":",
"return",
"[",
"tensor_shape",
".",
"TensorShape... | https://github.com/miyosuda/TensorFlowAndroidDemo/blob/35903e0221aa5f109ea2dbef27f20b52e317f42d/jni-build/jni/include/tensorflow/python/ops/nn_ops.py#L782-L792 | ||
wxWidgets/wxPython-Classic | 19571e1ae65f1ac445f5491474121998c97a1bf0 | src/msw/_misc.py | python | DataObject.GetDataHere | (*args, **kwargs) | return _misc_.DataObject_GetDataHere(*args, **kwargs) | GetDataHere(self, DataFormat format) -> String
Get the data bytes in the specified format, returns None on failure. | GetDataHere(self, DataFormat format) -> String | [
"GetDataHere",
"(",
"self",
"DataFormat",
"format",
")",
"-",
">",
"String"
] | def GetDataHere(*args, **kwargs):
"""
GetDataHere(self, DataFormat format) -> String
Get the data bytes in the specified format, returns None on failure.
"""
return _misc_.DataObject_GetDataHere(*args, **kwargs) | [
"def",
"GetDataHere",
"(",
"*",
"args",
",",
"*",
"*",
"kwargs",
")",
":",
"return",
"_misc_",
".",
"DataObject_GetDataHere",
"(",
"*",
"args",
",",
"*",
"*",
"kwargs",
")"
] | https://github.com/wxWidgets/wxPython-Classic/blob/19571e1ae65f1ac445f5491474121998c97a1bf0/src/msw/_misc.py#L4974-L4980 | |
wxWidgets/wxPython-Classic | 19571e1ae65f1ac445f5491474121998c97a1bf0 | distrib/mac/buildpkg.py | python | PackageMaker._addBom | (self) | Write .bom file containing 'Bill of Materials'. | Write .bom file containing 'Bill of Materials'. | [
"Write",
".",
"bom",
"file",
"containing",
"Bill",
"of",
"Materials",
"."
] | def _addBom(self):
"Write .bom file containing 'Bill of Materials'."
# Currently ignores if the 'mkbom' tool is not available.
try:
base = self.packageInfo["Title"] + ".bom"
bomPath = join(self.packageResourceFolder, base)
cmd = "mkbom %s %s" % (self.sourceF... | [
"def",
"_addBom",
"(",
"self",
")",
":",
"# Currently ignores if the 'mkbom' tool is not available.",
"try",
":",
"base",
"=",
"self",
".",
"packageInfo",
"[",
"\"Title\"",
"]",
"+",
"\".bom\"",
"bomPath",
"=",
"join",
"(",
"self",
".",
"packageResourceFolder",
",... | https://github.com/wxWidgets/wxPython-Classic/blob/19571e1ae65f1ac445f5491474121998c97a1bf0/distrib/mac/buildpkg.py#L243-L254 | ||
Xilinx/Vitis-AI | fc74d404563d9951b57245443c73bef389f3657f | tools/Vitis-AI-Quantizer/vai_q_tensorflow1.x/tensorflow/python/autograph/pyct/origin_info.py | python | resolve_entity | (node, source, entity) | Like resolve, but extracts the context informartion from an entity. | Like resolve, but extracts the context informartion from an entity. | [
"Like",
"resolve",
"but",
"extracts",
"the",
"context",
"informartion",
"from",
"an",
"entity",
"."
] | def resolve_entity(node, source, entity):
"""Like resolve, but extracts the context informartion from an entity."""
lines, lineno = tf_inspect.getsourcelines(entity)
filepath = tf_inspect.getsourcefile(entity)
# Poor man's attempt at guessing the column offset: count the leading
# whitespace. This might not ... | [
"def",
"resolve_entity",
"(",
"node",
",",
"source",
",",
"entity",
")",
":",
"lines",
",",
"lineno",
"=",
"tf_inspect",
".",
"getsourcelines",
"(",
"entity",
")",
"filepath",
"=",
"tf_inspect",
".",
"getsourcefile",
"(",
"entity",
")",
"# Poor man's attempt a... | https://github.com/Xilinx/Vitis-AI/blob/fc74d404563d9951b57245443c73bef389f3657f/tools/Vitis-AI-Quantizer/vai_q_tensorflow1.x/tensorflow/python/autograph/pyct/origin_info.py#L252-L262 | ||
catboost/catboost | 167f64f237114a4d10b2b4ee42adb4569137debe | contrib/tools/python/src/Lib/_pyio.py | python | TextIOBase.truncate | (self, pos=None) | Truncate size to pos. | Truncate size to pos. | [
"Truncate",
"size",
"to",
"pos",
"."
] | def truncate(self, pos=None):
"""Truncate size to pos."""
self._unsupported("truncate") | [
"def",
"truncate",
"(",
"self",
",",
"pos",
"=",
"None",
")",
":",
"self",
".",
"_unsupported",
"(",
"\"truncate\"",
")"
] | https://github.com/catboost/catboost/blob/167f64f237114a4d10b2b4ee42adb4569137debe/contrib/tools/python/src/Lib/_pyio.py#L1326-L1328 | ||
wxWidgets/wxPython-Classic | 19571e1ae65f1ac445f5491474121998c97a1bf0 | src/osx_carbon/_gdi.py | python | GraphicsContext.DrawIcon | (*args, **kwargs) | return _gdi_.GraphicsContext_DrawIcon(*args, **kwargs) | DrawIcon(self, Icon icon, Double x, Double y, Double w, Double h)
Draws the icon. | DrawIcon(self, Icon icon, Double x, Double y, Double w, Double h) | [
"DrawIcon",
"(",
"self",
"Icon",
"icon",
"Double",
"x",
"Double",
"y",
"Double",
"w",
"Double",
"h",
")"
] | def DrawIcon(*args, **kwargs):
"""
DrawIcon(self, Icon icon, Double x, Double y, Double w, Double h)
Draws the icon.
"""
return _gdi_.GraphicsContext_DrawIcon(*args, **kwargs) | [
"def",
"DrawIcon",
"(",
"*",
"args",
",",
"*",
"*",
"kwargs",
")",
":",
"return",
"_gdi_",
".",
"GraphicsContext_DrawIcon",
"(",
"*",
"args",
",",
"*",
"*",
"kwargs",
")"
] | https://github.com/wxWidgets/wxPython-Classic/blob/19571e1ae65f1ac445f5491474121998c97a1bf0/src/osx_carbon/_gdi.py#L6442-L6448 | |
kevin-ssy/Optical-Flow-Guided-Feature | 07d4501a29002ee7821c38c1820e4a64c1acf6e8 | lib/caffe-action/python/caffe/draw.py | python | get_layer_label | (layer, rankdir) | return node_label | Define node label based on layer type.
Parameters
----------
layer : ?
rankdir : {'LR', 'TB', 'BT'}
Direction of graph layout.
Returns
-------
string :
A label for the current layer | Define node label based on layer type. | [
"Define",
"node",
"label",
"based",
"on",
"layer",
"type",
"."
] | def get_layer_label(layer, rankdir):
"""Define node label based on layer type.
Parameters
----------
layer : ?
rankdir : {'LR', 'TB', 'BT'}
Direction of graph layout.
Returns
-------
string :
A label for the current layer
"""
if rankdir in ('TB', 'BT'):
... | [
"def",
"get_layer_label",
"(",
"layer",
",",
"rankdir",
")",
":",
"if",
"rankdir",
"in",
"(",
"'TB'",
",",
"'BT'",
")",
":",
"# If graph orientation is vertical, horizontal space is free and",
"# vertical space is not; separate words with spaces",
"separator",
"=",
"' '",
... | https://github.com/kevin-ssy/Optical-Flow-Guided-Feature/blob/07d4501a29002ee7821c38c1820e4a64c1acf6e8/lib/caffe-action/python/caffe/draw.py#L53-L105 | |
catboost/catboost | 167f64f237114a4d10b2b4ee42adb4569137debe | contrib/tools/python/src/Lib/lib2to3/pgen2/parse.py | python | Parser.push | (self, type, newdfa, newstate, context) | Push a nonterminal. (Internal) | Push a nonterminal. (Internal) | [
"Push",
"a",
"nonterminal",
".",
"(",
"Internal",
")"
] | def push(self, type, newdfa, newstate, context):
"""Push a nonterminal. (Internal)"""
dfa, state, node = self.stack[-1]
newnode = (type, None, context, [])
self.stack[-1] = (dfa, newstate, node)
self.stack.append((newdfa, 0, newnode)) | [
"def",
"push",
"(",
"self",
",",
"type",
",",
"newdfa",
",",
"newstate",
",",
"context",
")",
":",
"dfa",
",",
"state",
",",
"node",
"=",
"self",
".",
"stack",
"[",
"-",
"1",
"]",
"newnode",
"=",
"(",
"type",
",",
"None",
",",
"context",
",",
"... | https://github.com/catboost/catboost/blob/167f64f237114a4d10b2b4ee42adb4569137debe/contrib/tools/python/src/Lib/lib2to3/pgen2/parse.py#L184-L189 | ||
hpi-xnor/BMXNet-v2 | af2b1859eafc5c721b1397cef02f946aaf2ce20d | python/mxnet/util.py | python | np_shape | (active=True) | return _NumpyShapeScope(active) | Returns an activated/deactivated NumPy shape scope to be used in 'with' statement
and captures code that needs the NumPy shape semantics, i.e. support of scalar and
zero-size tensors.
Please note that this is designed as an infrastructure for the incoming
MXNet-NumPy operators. Legacy operators registe... | Returns an activated/deactivated NumPy shape scope to be used in 'with' statement
and captures code that needs the NumPy shape semantics, i.e. support of scalar and
zero-size tensors. | [
"Returns",
"an",
"activated",
"/",
"deactivated",
"NumPy",
"shape",
"scope",
"to",
"be",
"used",
"in",
"with",
"statement",
"and",
"captures",
"code",
"that",
"needs",
"the",
"NumPy",
"shape",
"semantics",
"i",
".",
"e",
".",
"support",
"of",
"scalar",
"an... | def np_shape(active=True):
"""Returns an activated/deactivated NumPy shape scope to be used in 'with' statement
and captures code that needs the NumPy shape semantics, i.e. support of scalar and
zero-size tensors.
Please note that this is designed as an infrastructure for the incoming
MXNet-NumPy o... | [
"def",
"np_shape",
"(",
"active",
"=",
"True",
")",
":",
"return",
"_NumpyShapeScope",
"(",
"active",
")"
] | https://github.com/hpi-xnor/BMXNet-v2/blob/af2b1859eafc5c721b1397cef02f946aaf2ce20d/python/mxnet/util.py#L147-L213 | |
hughperkins/tf-coriander | 970d3df6c11400ad68405f22b0c42a52374e94ca | tensorflow/python/ops/math_grad.py | python | _SegmentMeanGrad | (op, grad) | return array_ops.gather(scaled_grad, op.inputs[1]), None | Gradient for SegmentMean. | Gradient for SegmentMean. | [
"Gradient",
"for",
"SegmentMean",
"."
] | def _SegmentMeanGrad(op, grad):
"""Gradient for SegmentMean."""
input_rank = array_ops.rank(op.inputs[0])
ones_shape = array_ops.concat(
0, [array_ops.shape(op.inputs[1]),
array_ops.fill(array_ops.expand_dims(input_rank - 1, 0), 1)])
ones = array_ops.fill(ones_shape,
cons... | [
"def",
"_SegmentMeanGrad",
"(",
"op",
",",
"grad",
")",
":",
"input_rank",
"=",
"array_ops",
".",
"rank",
"(",
"op",
".",
"inputs",
"[",
"0",
"]",
")",
"ones_shape",
"=",
"array_ops",
".",
"concat",
"(",
"0",
",",
"[",
"array_ops",
".",
"shape",
"(",... | https://github.com/hughperkins/tf-coriander/blob/970d3df6c11400ad68405f22b0c42a52374e94ca/tensorflow/python/ops/math_grad.py#L155-L164 | |
intel-iot-devkit/how-to-code-samples | b4ea616f36bbfa2e042beb1698f968cfd651d79f | access-control/python/iot_access_control/hardware/board.py | python | Board.update_hardware_state | (self) | Abstract method for updating hardware state. | Abstract method for updating hardware state. | [
"Abstract",
"method",
"for",
"updating",
"hardware",
"state",
"."
] | def update_hardware_state(self):
"""
Abstract method for updating hardware state.
"""
pass | [
"def",
"update_hardware_state",
"(",
"self",
")",
":",
"pass"
] | https://github.com/intel-iot-devkit/how-to-code-samples/blob/b4ea616f36bbfa2e042beb1698f968cfd651d79f/access-control/python/iot_access_control/hardware/board.py#L95-L101 | ||
mindspore-ai/mindspore | fb8fd3338605bb34fa5cea054e535a8b1d753fab | mindspore/python/mindspore/train/dataset_helper.py | python | _send_data_no_flag | (dataset, epoch_num) | Engine dataset to write data to tdt queue directly. | Engine dataset to write data to tdt queue directly. | [
"Engine",
"dataset",
"to",
"write",
"data",
"to",
"tdt",
"queue",
"directly",
"."
] | def _send_data_no_flag(dataset, epoch_num):
"""Engine dataset to write data to tdt queue directly."""
exec_dataset = dataset.__transfer_dataset__
exec_dataset.send(epoch_num) | [
"def",
"_send_data_no_flag",
"(",
"dataset",
",",
"epoch_num",
")",
":",
"exec_dataset",
"=",
"dataset",
".",
"__transfer_dataset__",
"exec_dataset",
".",
"send",
"(",
"epoch_num",
")"
] | https://github.com/mindspore-ai/mindspore/blob/fb8fd3338605bb34fa5cea054e535a8b1d753fab/mindspore/python/mindspore/train/dataset_helper.py#L36-L39 | ||
wxWidgets/wxPython-Classic | 19571e1ae65f1ac445f5491474121998c97a1bf0 | wx/tools/Editra/src/extern/aui/framemanager.py | python | AuiManager.CheckMovableSizer | (self, part) | return True | Checks if a UI part can be actually resized.
:param AuiDockUIPart `part`: a UI part. | Checks if a UI part can be actually resized. | [
"Checks",
"if",
"a",
"UI",
"part",
"can",
"be",
"actually",
"resized",
"."
] | def CheckMovableSizer(self, part):
"""
Checks if a UI part can be actually resized.
:param AuiDockUIPart `part`: a UI part.
"""
# a dock may not be resized if it has a single
# pane which is not resizable
if part.type == AuiDockUIPart.typeDockSizer and part.dock... | [
"def",
"CheckMovableSizer",
"(",
"self",
",",
"part",
")",
":",
"# a dock may not be resized if it has a single",
"# pane which is not resizable",
"if",
"part",
".",
"type",
"==",
"AuiDockUIPart",
".",
"typeDockSizer",
"and",
"part",
".",
"dock",
"and",
"len",
"(",
... | https://github.com/wxWidgets/wxPython-Classic/blob/19571e1ae65f1ac445f5491474121998c97a1bf0/wx/tools/Editra/src/extern/aui/framemanager.py#L7261-L7283 | |
kushview/Element | 1cc16380caa2ab79461246ba758b9de1f46db2a5 | waflib/Tools/vala.py | python | vala_file | (self, node) | Compile a vala file and bind the task to *self.valatask*. If an existing vala task is already set, add the node
to its inputs. The typical example is::
def build(bld):
bld.program(
packages = 'gtk+-2.0',
target = 'vala-gtk-example',
use = 'GTK GLIB',
source = 'vala-gt... | Compile a vala file and bind the task to *self.valatask*. If an existing vala task is already set, add the node
to its inputs. The typical example is:: | [
"Compile",
"a",
"vala",
"file",
"and",
"bind",
"the",
"task",
"to",
"*",
"self",
".",
"valatask",
"*",
".",
"If",
"an",
"existing",
"vala",
"task",
"is",
"already",
"set",
"add",
"the",
"node",
"to",
"its",
"inputs",
".",
"The",
"typical",
"example",
... | def vala_file(self, node):
"""
Compile a vala file and bind the task to *self.valatask*. If an existing vala task is already set, add the node
to its inputs. The typical example is::
def build(bld):
bld.program(
packages = 'gtk+-2.0',
target = 'vala-gtk-example',
use = 'GTK GL... | [
"def",
"vala_file",
"(",
"self",
",",
"node",
")",
":",
"try",
":",
"valatask",
"=",
"self",
".",
"valatask",
"except",
"AttributeError",
":",
"valatask",
"=",
"self",
".",
"valatask",
"=",
"self",
".",
"create_task",
"(",
"'valac'",
")",
"self",
".",
... | https://github.com/kushview/Element/blob/1cc16380caa2ab79461246ba758b9de1f46db2a5/waflib/Tools/vala.py#L209-L250 | ||
apple/turicreate | cce55aa5311300e3ce6af93cb45ba791fd1bdf49 | src/python/turicreate/toolkits/clustering/kmeans.py | python | KmeansModel.__repr__ | (self) | return out + "\n" + out2 | Print a string description of the model when the model name is entered
in the terminal. | Print a string description of the model when the model name is entered
in the terminal. | [
"Print",
"a",
"string",
"description",
"of",
"the",
"model",
"when",
"the",
"model",
"name",
"is",
"entered",
"in",
"the",
"terminal",
"."
] | def __repr__(self):
"""
Print a string description of the model when the model name is entered
in the terminal.
"""
width = 32
(sections, section_titles) = self._get_summary_struct()
accessible_fields = {
"cluster_id": "An SFrame containing the clust... | [
"def",
"__repr__",
"(",
"self",
")",
":",
"width",
"=",
"32",
"(",
"sections",
",",
"section_titles",
")",
"=",
"self",
".",
"_get_summary_struct",
"(",
")",
"accessible_fields",
"=",
"{",
"\"cluster_id\"",
":",
"\"An SFrame containing the cluster assignments.\"",
... | https://github.com/apple/turicreate/blob/cce55aa5311300e3ce6af93cb45ba791fd1bdf49/src/python/turicreate/toolkits/clustering/kmeans.py#L414-L430 | |
catboost/catboost | 167f64f237114a4d10b2b4ee42adb4569137debe | contrib/python/setuptools/py2/setuptools/sandbox.py | python | AbstractSandbox._remap_input | (self, operation, path, *args, **kw) | return self._validate_path(path) | Called for path inputs | Called for path inputs | [
"Called",
"for",
"path",
"inputs"
] | def _remap_input(self, operation, path, *args, **kw):
"""Called for path inputs"""
return self._validate_path(path) | [
"def",
"_remap_input",
"(",
"self",
",",
"operation",
",",
"path",
",",
"*",
"args",
",",
"*",
"*",
"kw",
")",
":",
"return",
"self",
".",
"_validate_path",
"(",
"path",
")"
] | https://github.com/catboost/catboost/blob/167f64f237114a4d10b2b4ee42adb4569137debe/contrib/python/setuptools/py2/setuptools/sandbox.py#L360-L362 | |
wxWidgets/wxPython-Classic | 19571e1ae65f1ac445f5491474121998c97a1bf0 | wx/lib/masked/textctrl.py | python | BaseMaskedTextCtrl._GetSelection | (self) | return self.GetSelection() | Allow mixin to get the text selection of this control.
REQUIRED by any class derived from MaskedEditMixin. | Allow mixin to get the text selection of this control.
REQUIRED by any class derived from MaskedEditMixin. | [
"Allow",
"mixin",
"to",
"get",
"the",
"text",
"selection",
"of",
"this",
"control",
".",
"REQUIRED",
"by",
"any",
"class",
"derived",
"from",
"MaskedEditMixin",
"."
] | def _GetSelection(self):
"""
Allow mixin to get the text selection of this control.
REQUIRED by any class derived from MaskedEditMixin.
"""
return self.GetSelection() | [
"def",
"_GetSelection",
"(",
"self",
")",
":",
"return",
"self",
".",
"GetSelection",
"(",
")"
] | https://github.com/wxWidgets/wxPython-Classic/blob/19571e1ae65f1ac445f5491474121998c97a1bf0/wx/lib/masked/textctrl.py#L107-L112 | |
catboost/catboost | 167f64f237114a4d10b2b4ee42adb4569137debe | contrib/python/ipython/py3/IPython/core/completerlib.py | python | module_list | (path) | return list(set(modules)) | Return the list containing the names of the modules available in the given
folder. | Return the list containing the names of the modules available in the given
folder. | [
"Return",
"the",
"list",
"containing",
"the",
"names",
"of",
"the",
"modules",
"available",
"in",
"the",
"given",
"folder",
"."
] | def module_list(path):
"""
Return the list containing the names of the modules available in the given
folder.
"""
# sys.path has the cwd as an empty string, but isdir/listdir need it as '.'
if path == '':
path = '.'
# A few local constants to be used in loops below
pjoin = os.pa... | [
"def",
"module_list",
"(",
"path",
")",
":",
"# sys.path has the cwd as an empty string, but isdir/listdir need it as '.'",
"if",
"path",
"==",
"''",
":",
"path",
"=",
"'.'",
"# A few local constants to be used in loops below",
"pjoin",
"=",
"os",
".",
"path",
".",
"join"... | https://github.com/catboost/catboost/blob/167f64f237114a4d10b2b4ee42adb4569137debe/contrib/python/ipython/py3/IPython/core/completerlib.py#L114-L151 | |
wlanjie/AndroidFFmpeg | 7baf9122f4b8e1c74e7baf4be5c422c7a5ba5aaf | tools/fdk-aac-build/armeabi-v7a/toolchain/lib/python2.7/asynchat.py | python | async_chat.set_terminator | (self, term) | Set the input delimiter. Can be a fixed string of any length, an integer, or None | Set the input delimiter. Can be a fixed string of any length, an integer, or None | [
"Set",
"the",
"input",
"delimiter",
".",
"Can",
"be",
"a",
"fixed",
"string",
"of",
"any",
"length",
"an",
"integer",
"or",
"None"
] | def set_terminator (self, term):
"Set the input delimiter. Can be a fixed string of any length, an integer, or None"
self.terminator = term | [
"def",
"set_terminator",
"(",
"self",
",",
"term",
")",
":",
"self",
".",
"terminator",
"=",
"term"
] | https://github.com/wlanjie/AndroidFFmpeg/blob/7baf9122f4b8e1c74e7baf4be5c422c7a5ba5aaf/tools/fdk-aac-build/armeabi-v7a/toolchain/lib/python2.7/asynchat.py#L95-L97 | ||
rbgirshick/caffe-fast-rcnn | 28a579eaf0668850705598b3075b8969f22226d9 | scripts/cpp_lint.py | python | _SetOutputFormat | (output_format) | Sets the module's output format. | Sets the module's output format. | [
"Sets",
"the",
"module",
"s",
"output",
"format",
"."
] | def _SetOutputFormat(output_format):
"""Sets the module's output format."""
_cpplint_state.SetOutputFormat(output_format) | [
"def",
"_SetOutputFormat",
"(",
"output_format",
")",
":",
"_cpplint_state",
".",
"SetOutputFormat",
"(",
"output_format",
")"
] | https://github.com/rbgirshick/caffe-fast-rcnn/blob/28a579eaf0668850705598b3075b8969f22226d9/scripts/cpp_lint.py#L772-L774 | ||
catboost/catboost | 167f64f237114a4d10b2b4ee42adb4569137debe | contrib/python/scipy/py2/scipy/io/matlab/mio4.py | python | MatFile4Reader.initialize_read | (self) | Run when beginning read of variables
Sets up readers from parameters in `self` | Run when beginning read of variables | [
"Run",
"when",
"beginning",
"read",
"of",
"variables"
] | def initialize_read(self):
''' Run when beginning read of variables
Sets up readers from parameters in `self`
'''
self.dtypes = convert_dtypes(mdtypes_template, self.byte_order)
self._matrix_reader = VarReader4(self) | [
"def",
"initialize_read",
"(",
"self",
")",
":",
"self",
".",
"dtypes",
"=",
"convert_dtypes",
"(",
"mdtypes_template",
",",
"self",
".",
"byte_order",
")",
"self",
".",
"_matrix_reader",
"=",
"VarReader4",
"(",
"self",
")"
] | https://github.com/catboost/catboost/blob/167f64f237114a4d10b2b4ee42adb4569137debe/contrib/python/scipy/py2/scipy/io/matlab/mio4.py#L328-L334 | ||
xiaolonw/caffe-video_triplet | c39ea1ad6e937ccf7deba4510b7e555165abf05f | python/caffe/pycaffe.py | python | _Net_blob_loss_weights | (self) | return OrderedDict(zip(self._blob_names, self._blob_loss_weights)) | An OrderedDict (bottom to top, i.e., input to output) of network
blob loss weights indexed by name | An OrderedDict (bottom to top, i.e., input to output) of network
blob loss weights indexed by name | [
"An",
"OrderedDict",
"(",
"bottom",
"to",
"top",
"i",
".",
"e",
".",
"input",
"to",
"output",
")",
"of",
"network",
"blob",
"loss",
"weights",
"indexed",
"by",
"name"
] | def _Net_blob_loss_weights(self):
"""
An OrderedDict (bottom to top, i.e., input to output) of network
blob loss weights indexed by name
"""
return OrderedDict(zip(self._blob_names, self._blob_loss_weights)) | [
"def",
"_Net_blob_loss_weights",
"(",
"self",
")",
":",
"return",
"OrderedDict",
"(",
"zip",
"(",
"self",
".",
"_blob_names",
",",
"self",
".",
"_blob_loss_weights",
")",
")"
] | https://github.com/xiaolonw/caffe-video_triplet/blob/c39ea1ad6e937ccf7deba4510b7e555165abf05f/python/caffe/pycaffe.py#L32-L37 | |
letscontrolit/ESPEasy | acb2c9e695d6f61d8d67adf0fe4037c08d4baedd | lib/IRremoteESP8266/tools/auto_analyse_raw_data.py | python | RawIRMessage._usec_compare | (self, seen, expected) | return expected - self.margin < seen <= expected | Compare two usec values and see if they match within a
subtractive margin. | Compare two usec values and see if they match within a
subtractive margin. | [
"Compare",
"two",
"usec",
"values",
"and",
"see",
"if",
"they",
"match",
"within",
"a",
"subtractive",
"margin",
"."
] | def _usec_compare(self, seen, expected):
"""Compare two usec values and see if they match within a
subtractive margin."""
if expected is None:
return False
return expected - self.margin < seen <= expected | [
"def",
"_usec_compare",
"(",
"self",
",",
"seen",
",",
"expected",
")",
":",
"if",
"expected",
"is",
"None",
":",
"return",
"False",
"return",
"expected",
"-",
"self",
".",
"margin",
"<",
"seen",
"<=",
"expected"
] | https://github.com/letscontrolit/ESPEasy/blob/acb2c9e695d6f61d8d67adf0fe4037c08d4baedd/lib/IRremoteESP8266/tools/auto_analyse_raw_data.py#L67-L72 | |
goldeneye-source/ges-code | 2630cd8ef3d015af53c72ec2e19fc1f7e7fe8d9d | thirdparty/protobuf-2.3.0/python/google/protobuf/internal/encoder.py | python | GroupSizer | (field_number, is_repeated, is_packed) | Returns a sizer for a group field. | Returns a sizer for a group field. | [
"Returns",
"a",
"sizer",
"for",
"a",
"group",
"field",
"."
] | def GroupSizer(field_number, is_repeated, is_packed):
"""Returns a sizer for a group field."""
tag_size = _TagSize(field_number) * 2
assert not is_packed
if is_repeated:
def RepeatedFieldSize(value):
result = tag_size * len(value)
for element in value:
result += element.ByteSize()
... | [
"def",
"GroupSizer",
"(",
"field_number",
",",
"is_repeated",
",",
"is_packed",
")",
":",
"tag_size",
"=",
"_TagSize",
"(",
"field_number",
")",
"*",
"2",
"assert",
"not",
"is_packed",
"if",
"is_repeated",
":",
"def",
"RepeatedFieldSize",
"(",
"value",
")",
... | https://github.com/goldeneye-source/ges-code/blob/2630cd8ef3d015af53c72ec2e19fc1f7e7fe8d9d/thirdparty/protobuf-2.3.0/python/google/protobuf/internal/encoder.py#L265-L280 | ||
windystrife/UnrealEngine_NVIDIAGameWorks | b50e6338a7c5b26374d66306ebc7807541ff815e | Engine/Extras/ThirdPartyNotUE/emsdk/Win64/python/2.7.5.3_64bit/Lib/lib-tk/Tix.py | python | Grid.unset | (self, x, y) | Clears the cell at (x, y) by removing its display item. | Clears the cell at (x, y) by removing its display item. | [
"Clears",
"the",
"cell",
"at",
"(",
"x",
"y",
")",
"by",
"removing",
"its",
"display",
"item",
"."
] | def unset(self, x, y):
"""Clears the cell at (x, y) by removing its display item."""
self.tk.call(self._w, 'unset', x, y) | [
"def",
"unset",
"(",
"self",
",",
"x",
",",
"y",
")",
":",
"self",
".",
"tk",
".",
"call",
"(",
"self",
".",
"_w",
",",
"'unset'",
",",
"x",
",",
"y",
")"
] | https://github.com/windystrife/UnrealEngine_NVIDIAGameWorks/blob/b50e6338a7c5b26374d66306ebc7807541ff815e/Engine/Extras/ThirdPartyNotUE/emsdk/Win64/python/2.7.5.3_64bit/Lib/lib-tk/Tix.py#L1955-L1957 | ||
PaddlePaddle/Paddle | 1252f4bb3e574df80aa6d18c7ddae1b3a90bd81c | python/paddle/fluid/dygraph/amp/loss_scaler.py | python | AmpScaler.get_incr_ratio | (self) | return self._incr_ratio | Return the multiplier to use when increasing the loss scaling.
Reurns:
float: the multiplier to use when increasing the loss scaling. | Return the multiplier to use when increasing the loss scaling. | [
"Return",
"the",
"multiplier",
"to",
"use",
"when",
"increasing",
"the",
"loss",
"scaling",
"."
] | def get_incr_ratio(self):
"""
Return the multiplier to use when increasing the loss scaling.
Reurns:
float: the multiplier to use when increasing the loss scaling.
"""
return self._incr_ratio | [
"def",
"get_incr_ratio",
"(",
"self",
")",
":",
"return",
"self",
".",
"_incr_ratio"
] | https://github.com/PaddlePaddle/Paddle/blob/1252f4bb3e574df80aa6d18c7ddae1b3a90bd81c/python/paddle/fluid/dygraph/amp/loss_scaler.py#L371-L378 | |
MythTV/mythtv | d282a209cb8be85d036f85a62a8ec971b67d45f4 | mythtv/programs/scripts/internetcontent/nv_python_libs/mnvsearch/mnvsearch_api.py | python | Videos.searchTitle | (self, title, pagenumber, pagelen, feedtitle=False) | return [itemDict, morePages] | Key word video search of the MNV treeview tables
return an array of matching item elements
return | Key word video search of the MNV treeview tables
return an array of matching item elements
return | [
"Key",
"word",
"video",
"search",
"of",
"the",
"MNV",
"treeview",
"tables",
"return",
"an",
"array",
"of",
"matching",
"item",
"elements",
"return"
] | def searchTitle(self, title, pagenumber, pagelen, feedtitle=False):
'''Key word video search of the MNV treeview tables
return an array of matching item elements
return
'''
# Usually commented out - Easier for debugging
# resultList = self.getTreeviewData(title, pagenumbe... | [
"def",
"searchTitle",
"(",
"self",
",",
"title",
",",
"pagenumber",
",",
"pagelen",
",",
"feedtitle",
"=",
"False",
")",
":",
"# Usually commented out - Easier for debugging",
"# resultList = self.getTreeviewData(title, pagenumber, pagelen)",
"# print resultList",
... | https://github.com/MythTV/mythtv/blob/d282a209cb8be85d036f85a62a8ec971b67d45f4/mythtv/programs/scripts/internetcontent/nv_python_libs/mnvsearch/mnvsearch_api.py#L194-L283 | |
wxWidgets/wxPython-Classic | 19571e1ae65f1ac445f5491474121998c97a1bf0 | src/osx_cocoa/_controls.py | python | ToolBarBase.AddLabelTool | (self, id, label, bitmap,
bmpDisabled = wx.NullBitmap,
kind = wx.ITEM_NORMAL,
shortHelp = '', longHelp = '',
clientData = None) | return self.DoAddTool(id, label, bitmap, bmpDisabled, kind,
shortHelp, longHelp, clientData) | The full AddTool() function.
If bmpDisabled is wx.NullBitmap, a shadowed version of the normal bitmap
is created and used as the disabled image. | The full AddTool() function. | [
"The",
"full",
"AddTool",
"()",
"function",
"."
] | def AddLabelTool(self, id, label, bitmap,
bmpDisabled = wx.NullBitmap,
kind = wx.ITEM_NORMAL,
shortHelp = '', longHelp = '',
clientData = None):
'''
The full AddTool() function.
If bmpDisabled is wx.NullBitmap, ... | [
"def",
"AddLabelTool",
"(",
"self",
",",
"id",
",",
"label",
",",
"bitmap",
",",
"bmpDisabled",
"=",
"wx",
".",
"NullBitmap",
",",
"kind",
"=",
"wx",
".",
"ITEM_NORMAL",
",",
"shortHelp",
"=",
"''",
",",
"longHelp",
"=",
"''",
",",
"clientData",
"=",
... | https://github.com/wxWidgets/wxPython-Classic/blob/19571e1ae65f1ac445f5491474121998c97a1bf0/src/osx_cocoa/_controls.py#L3666-L3678 | |
hpi-xnor/BMXNet-v2 | af2b1859eafc5c721b1397cef02f946aaf2ce20d | python/mxnet/ndarray/ndarray.py | python | lesser | (lhs, rhs) | return _ufunc_helper(
lhs,
rhs,
op.broadcast_lesser,
lambda x, y: 1 if x < y else 0,
_internal._lesser_scalar,
_internal._greater_scalar) | Returns the result of element-wise **lesser than** (<) comparison operation
with broadcasting.
For each element in input arrays, return 1(true) if lhs elements are less than rhs,
otherwise return 0(false).
Equivalent to ``lhs < rhs`` and ``mx.nd.broadcast_lesser(lhs, rhs)``.
.. note::
If ... | Returns the result of element-wise **lesser than** (<) comparison operation
with broadcasting. | [
"Returns",
"the",
"result",
"of",
"element",
"-",
"wise",
"**",
"lesser",
"than",
"**",
"(",
"<",
")",
"comparison",
"operation",
"with",
"broadcasting",
"."
] | def lesser(lhs, rhs):
"""Returns the result of element-wise **lesser than** (<) comparison operation
with broadcasting.
For each element in input arrays, return 1(true) if lhs elements are less than rhs,
otherwise return 0(false).
Equivalent to ``lhs < rhs`` and ``mx.nd.broadcast_lesser(lhs, rhs)`... | [
"def",
"lesser",
"(",
"lhs",
",",
"rhs",
")",
":",
"# pylint: disable= no-member, protected-access",
"return",
"_ufunc_helper",
"(",
"lhs",
",",
"rhs",
",",
"op",
".",
"broadcast_lesser",
",",
"lambda",
"x",
",",
"y",
":",
"1",
"if",
"x",
"<",
"y",
"else",... | https://github.com/hpi-xnor/BMXNet-v2/blob/af2b1859eafc5c721b1397cef02f946aaf2ce20d/python/mxnet/ndarray/ndarray.py#L3468-L3528 | |
catboost/catboost | 167f64f237114a4d10b2b4ee42adb4569137debe | contrib/python/scikit-learn/py3/sklearn/discriminant_analysis.py | python | LinearDiscriminantAnalysis._solve_eigen | (self, X, y, shrinkage) | Eigenvalue solver.
The eigenvalue solver computes the optimal solution of the Rayleigh
coefficient (basically the ratio of between class scatter to within
class scatter). This solver supports both classification and
dimensionality reduction (with optional shrinkage).
Parameters... | Eigenvalue solver. | [
"Eigenvalue",
"solver",
"."
] | def _solve_eigen(self, X, y, shrinkage):
"""Eigenvalue solver.
The eigenvalue solver computes the optimal solution of the Rayleigh
coefficient (basically the ratio of between class scatter to within
class scatter). This solver supports both classification and
dimensionality redu... | [
"def",
"_solve_eigen",
"(",
"self",
",",
"X",
",",
"y",
",",
"shrinkage",
")",
":",
"self",
".",
"means_",
"=",
"_class_means",
"(",
"X",
",",
"y",
")",
"self",
".",
"covariance_",
"=",
"_class_cov",
"(",
"X",
",",
"y",
",",
"self",
".",
"priors_",... | https://github.com/catboost/catboost/blob/167f64f237114a4d10b2b4ee42adb4569137debe/contrib/python/scikit-learn/py3/sklearn/discriminant_analysis.py#L298-L345 | ||
sdhash/sdhash | b9eff63e4e5867e910f41fd69032bbb1c94a2a5e | sdhash-ui/jinja2/lexer.py | python | TokenStream.skip_if | (self, expr) | return self.next_if(expr) is not None | Like :meth:`next_if` but only returns `True` or `False`. | Like :meth:`next_if` but only returns `True` or `False`. | [
"Like",
":",
"meth",
":",
"next_if",
"but",
"only",
"returns",
"True",
"or",
"False",
"."
] | def skip_if(self, expr):
"""Like :meth:`next_if` but only returns `True` or `False`."""
return self.next_if(expr) is not None | [
"def",
"skip_if",
"(",
"self",
",",
"expr",
")",
":",
"return",
"self",
".",
"next_if",
"(",
"expr",
")",
"is",
"not",
"None"
] | https://github.com/sdhash/sdhash/blob/b9eff63e4e5867e910f41fd69032bbb1c94a2a5e/sdhash-ui/jinja2/lexer.py#L332-L334 | |
quarkslab/arybo | 89d9a4266fa51c1a560f6c4a66f65d1ffde5f093 | arybo/lib/mba_if.py | python | simplify_inplace | (e) | return e | Simplify **inplace** the expression or variable e. returns e for conveniance. | Simplify **inplace** the expression or variable e. returns e for conveniance. | [
"Simplify",
"**",
"inplace",
"**",
"the",
"expression",
"or",
"variable",
"e",
".",
"returns",
"e",
"for",
"conveniance",
"."
] | def simplify_inplace(e):
''' Simplify **inplace** the expression or variable e. returns e for conveniance. '''
__call_impl_func_inplace(simplify_inplace_vec, e)
return e | [
"def",
"simplify_inplace",
"(",
"e",
")",
":",
"__call_impl_func_inplace",
"(",
"simplify_inplace_vec",
",",
"e",
")",
"return",
"e"
] | https://github.com/quarkslab/arybo/blob/89d9a4266fa51c1a560f6c4a66f65d1ffde5f093/arybo/lib/mba_if.py#L66-L69 | |
pytorch/xla | 93174035e8149d5d03cee446486de861f56493e1 | torch_xla/debug/metrics.py | python | metric_data | (name) | return torch_xla._XLAC._xla_metric_data(name) | Returns the data of an active metric.
Args:
name (string): The name of the metric whose data needs to be retrieved.
Returns:
The metric data, which is a tuple of (TOTAL_SAMPLES, ACCUMULATOR, SAMPLES).
The `TOTAL_SAMPLES` is the total number of samples which have been posted to
the metric. A metric... | Returns the data of an active metric. | [
"Returns",
"the",
"data",
"of",
"an",
"active",
"metric",
"."
] | def metric_data(name):
"""Returns the data of an active metric.
Args:
name (string): The name of the metric whose data needs to be retrieved.
Returns:
The metric data, which is a tuple of (TOTAL_SAMPLES, ACCUMULATOR, SAMPLES).
The `TOTAL_SAMPLES` is the total number of samples which have been posted... | [
"def",
"metric_data",
"(",
"name",
")",
":",
"return",
"torch_xla",
".",
"_XLAC",
".",
"_xla_metric_data",
"(",
"name",
")"
] | https://github.com/pytorch/xla/blob/93174035e8149d5d03cee446486de861f56493e1/torch_xla/debug/metrics.py#L28-L42 | |
adobe/chromium | cfe5bf0b51b1f6b9fe239c2a3c2f2364da9967d7 | ppapi/native_client/src/tools/srpcgen.py | python | PrintSourceFileTop | (output, srpcgen_h_file) | Prints the header of the .cc file including copyright,
header comment and includes. | Prints the header of the .cc file including copyright,
header comment and includes. | [
"Prints",
"the",
"header",
"of",
"the",
".",
"cc",
"file",
"including",
"copyright",
"header",
"comment",
"and",
"includes",
"."
] | def PrintSourceFileTop(output, srpcgen_h_file):
"""Prints the header of the .cc file including copyright,
header comment and includes."""
print >>output, COPYRIGHT_AND_AUTOGEN_COMMENT
print >>output, SourceFileIncludes(srpcgen_h_file) | [
"def",
"PrintSourceFileTop",
"(",
"output",
",",
"srpcgen_h_file",
")",
":",
"print",
">>",
"output",
",",
"COPYRIGHT_AND_AUTOGEN_COMMENT",
"print",
">>",
"output",
",",
"SourceFileIncludes",
"(",
"srpcgen_h_file",
")"
] | https://github.com/adobe/chromium/blob/cfe5bf0b51b1f6b9fe239c2a3c2f2364da9967d7/ppapi/native_client/src/tools/srpcgen.py#L120-L124 | ||
aws/lumberyard | f85344403c1c2e77ec8c75deb2c116e97b713217 | dev/Tools/Python/3.7.10/windows/Lib/site-packages/pip/_vendor/pkg_resources/__init__.py | python | _ReqExtras.markers_pass | (self, req, extras=None) | return not req.marker or any(extra_evals) | Evaluate markers for req against each extra that
demanded it.
Return False if the req has a marker and fails
evaluation. Otherwise, return True. | Evaluate markers for req against each extra that
demanded it. | [
"Evaluate",
"markers",
"for",
"req",
"against",
"each",
"extra",
"that",
"demanded",
"it",
"."
] | def markers_pass(self, req, extras=None):
"""
Evaluate markers for req against each extra that
demanded it.
Return False if the req has a marker and fails
evaluation. Otherwise, return True.
"""
extra_evals = (
req.marker.evaluate({'extra': extra})
... | [
"def",
"markers_pass",
"(",
"self",
",",
"req",
",",
"extras",
"=",
"None",
")",
":",
"extra_evals",
"=",
"(",
"req",
".",
"marker",
".",
"evaluate",
"(",
"{",
"'extra'",
":",
"extra",
"}",
")",
"for",
"extra",
"in",
"self",
".",
"get",
"(",
"req",... | https://github.com/aws/lumberyard/blob/f85344403c1c2e77ec8c75deb2c116e97b713217/dev/Tools/Python/3.7.10/windows/Lib/site-packages/pip/_vendor/pkg_resources/__init__.py#L944-L956 | |
benoitsteiner/tensorflow-opencl | cb7cb40a57fde5cfd4731bc551e82a1e2fef43a5 | tensorflow/python/saved_model/builder_impl.py | python | _asset_path_from_tensor | (path_tensor) | return str_values[0] | Returns the filepath value stored in constant `path_tensor`.
Args:
path_tensor: Tensor of a file-path.
Returns:
The string value i.e. path of the tensor, if valid.
Raises:
TypeError if tensor does not match expected op type, dtype or value. | Returns the filepath value stored in constant `path_tensor`. | [
"Returns",
"the",
"filepath",
"value",
"stored",
"in",
"constant",
"path_tensor",
"."
] | def _asset_path_from_tensor(path_tensor):
"""Returns the filepath value stored in constant `path_tensor`.
Args:
path_tensor: Tensor of a file-path.
Returns:
The string value i.e. path of the tensor, if valid.
Raises:
TypeError if tensor does not match expected op type, dtype or value.
"""
if ... | [
"def",
"_asset_path_from_tensor",
"(",
"path_tensor",
")",
":",
"if",
"not",
"isinstance",
"(",
"path_tensor",
",",
"ops",
".",
"Tensor",
")",
":",
"raise",
"TypeError",
"(",
"\"Asset path tensor must be a Tensor.\"",
")",
"if",
"path_tensor",
".",
"op",
".",
"t... | https://github.com/benoitsteiner/tensorflow-opencl/blob/cb7cb40a57fde5cfd4731bc551e82a1e2fef43a5/tensorflow/python/saved_model/builder_impl.py#L467-L488 | |
wxWidgets/wxPython-Classic | 19571e1ae65f1ac445f5491474121998c97a1bf0 | src/gtk/_windows.py | python | TextEntryDialog.SetValue | (*args, **kwargs) | return _windows_.TextEntryDialog_SetValue(*args, **kwargs) | SetValue(self, String value)
Sets the default text value. | SetValue(self, String value) | [
"SetValue",
"(",
"self",
"String",
"value",
")"
] | def SetValue(*args, **kwargs):
"""
SetValue(self, String value)
Sets the default text value.
"""
return _windows_.TextEntryDialog_SetValue(*args, **kwargs) | [
"def",
"SetValue",
"(",
"*",
"args",
",",
"*",
"*",
"kwargs",
")",
":",
"return",
"_windows_",
".",
"TextEntryDialog_SetValue",
"(",
"*",
"args",
",",
"*",
"*",
"kwargs",
")"
] | https://github.com/wxWidgets/wxPython-Classic/blob/19571e1ae65f1ac445f5491474121998c97a1bf0/src/gtk/_windows.py#L3393-L3399 | |
catboost/catboost | 167f64f237114a4d10b2b4ee42adb4569137debe | contrib/tools/python/src/Lib/wsgiref/headers.py | python | Headers.keys | (self) | return [k for k, v in self._headers] | Return a list of all the header field names.
These will be sorted in the order they appeared in the original header
list, or were added to this instance, and may contain duplicates.
Any fields deleted and re-inserted are always appended to the header
list. | Return a list of all the header field names. | [
"Return",
"a",
"list",
"of",
"all",
"the",
"header",
"field",
"names",
"."
] | def keys(self):
"""Return a list of all the header field names.
These will be sorted in the order they appeared in the original header
list, or were added to this instance, and may contain duplicates.
Any fields deleted and re-inserted are always appended to the header
list.
... | [
"def",
"keys",
"(",
"self",
")",
":",
"return",
"[",
"k",
"for",
"k",
",",
"v",
"in",
"self",
".",
"_headers",
"]"
] | https://github.com/catboost/catboost/blob/167f64f237114a4d10b2b4ee42adb4569137debe/contrib/tools/python/src/Lib/wsgiref/headers.py#L95-L103 | |
wxWidgets/wxPython-Classic | 19571e1ae65f1ac445f5491474121998c97a1bf0 | src/osx_carbon/_misc.py | python | LogInfo | (*args, **kwargs) | return _misc_.LogInfo(*args, **kwargs) | LogInfo(String msg) | LogInfo(String msg) | [
"LogInfo",
"(",
"String",
"msg",
")"
] | def LogInfo(*args, **kwargs):
"""LogInfo(String msg)"""
return _misc_.LogInfo(*args, **kwargs) | [
"def",
"LogInfo",
"(",
"*",
"args",
",",
"*",
"*",
"kwargs",
")",
":",
"return",
"_misc_",
".",
"LogInfo",
"(",
"*",
"args",
",",
"*",
"*",
"kwargs",
")"
] | https://github.com/wxWidgets/wxPython-Classic/blob/19571e1ae65f1ac445f5491474121998c97a1bf0/src/osx_carbon/_misc.py#L1863-L1865 | |
aws/lumberyard | f85344403c1c2e77ec8c75deb2c116e97b713217 | dev/Gems/CloudGemFramework/v1/ResourceManager/lib/Crypto/Cipher/_mode_siv.py | python | SivMode.__init__ | (self, factory, key, nonce, kwargs) | The block size of the underlying cipher, in bytes. | The block size of the underlying cipher, in bytes. | [
"The",
"block",
"size",
"of",
"the",
"underlying",
"cipher",
"in",
"bytes",
"."
] | def __init__(self, factory, key, nonce, kwargs):
self.block_size = factory.block_size
"""The block size of the underlying cipher, in bytes."""
self._factory = factory
self._cipher_params = kwargs
if len(key) not in (32, 48, 64):
raise ValueError("Incorrect key len... | [
"def",
"__init__",
"(",
"self",
",",
"factory",
",",
"key",
",",
"nonce",
",",
"kwargs",
")",
":",
"self",
".",
"block_size",
"=",
"factory",
".",
"block_size",
"self",
".",
"_factory",
"=",
"factory",
"self",
".",
"_cipher_params",
"=",
"kwargs",
"if",
... | https://github.com/aws/lumberyard/blob/f85344403c1c2e77ec8c75deb2c116e97b713217/dev/Gems/CloudGemFramework/v1/ResourceManager/lib/Crypto/Cipher/_mode_siv.py#L91-L127 | ||
wxWidgets/wxPython-Classic | 19571e1ae65f1ac445f5491474121998c97a1bf0 | src/osx_carbon/_core.py | python | Image_RGBValue.__init__ | (self, *args, **kwargs) | __init__(self, byte r=0, byte g=0, byte b=0) -> Image_RGBValue
Constructor. | __init__(self, byte r=0, byte g=0, byte b=0) -> Image_RGBValue | [
"__init__",
"(",
"self",
"byte",
"r",
"=",
"0",
"byte",
"g",
"=",
"0",
"byte",
"b",
"=",
"0",
")",
"-",
">",
"Image_RGBValue"
] | def __init__(self, *args, **kwargs):
"""
__init__(self, byte r=0, byte g=0, byte b=0) -> Image_RGBValue
Constructor.
"""
_core_.Image_RGBValue_swiginit(self,_core_.new_Image_RGBValue(*args, **kwargs)) | [
"def",
"__init__",
"(",
"self",
",",
"*",
"args",
",",
"*",
"*",
"kwargs",
")",
":",
"_core_",
".",
"Image_RGBValue_swiginit",
"(",
"self",
",",
"_core_",
".",
"new_Image_RGBValue",
"(",
"*",
"args",
",",
"*",
"*",
"kwargs",
")",
")"
] | https://github.com/wxWidgets/wxPython-Classic/blob/19571e1ae65f1ac445f5491474121998c97a1bf0/src/osx_carbon/_core.py#L2810-L2816 | ||
OSGeo/gdal | 3748fc4ba4fba727492774b2b908a2130c864a83 | swig/python/osgeo/ogr.py | python | FieldDefn.GetSubType | (self, *args) | return _ogr.FieldDefn_GetSubType(self, *args) | r"""
GetSubType(FieldDefn self) -> OGRFieldSubType
OGRFieldSubType
OGR_Fld_GetSubType(OGRFieldDefnH hDefn)
Fetch subtype of this field.
This function is the same as the CPP method
OGRFieldDefn::GetSubType().
Parameters:
-----------
hDefn: hand... | r"""
GetSubType(FieldDefn self) -> OGRFieldSubType
OGRFieldSubType
OGR_Fld_GetSubType(OGRFieldDefnH hDefn) | [
"r",
"GetSubType",
"(",
"FieldDefn",
"self",
")",
"-",
">",
"OGRFieldSubType",
"OGRFieldSubType",
"OGR_Fld_GetSubType",
"(",
"OGRFieldDefnH",
"hDefn",
")"
] | def GetSubType(self, *args):
r"""
GetSubType(FieldDefn self) -> OGRFieldSubType
OGRFieldSubType
OGR_Fld_GetSubType(OGRFieldDefnH hDefn)
Fetch subtype of this field.
This function is the same as the CPP method
OGRFieldDefn::GetSubType().
Parameters:
... | [
"def",
"GetSubType",
"(",
"self",
",",
"*",
"args",
")",
":",
"return",
"_ogr",
".",
"FieldDefn_GetSubType",
"(",
"self",
",",
"*",
"args",
")"
] | https://github.com/OSGeo/gdal/blob/3748fc4ba4fba727492774b2b908a2130c864a83/swig/python/osgeo/ogr.py#L5105-L5125 | |
PaddlePaddle/Paddle | 1252f4bb3e574df80aa6d18c7ddae1b3a90bd81c | python/paddle/fluid/layers/nn.py | python | slice | (input, axes, starts, ends) | return out | This operator produces a slice of ``input`` along multiple axes. Similar to numpy:
https://docs.scipy.org/doc/numpy/reference/arrays.indexing.html
Slice uses ``axes``, ``starts`` and ``ends`` attributes to specify the start and
end dimension for each axis in the list of axes and Slice uses this information
... | This operator produces a slice of ``input`` along multiple axes. Similar to numpy:
https://docs.scipy.org/doc/numpy/reference/arrays.indexing.html
Slice uses ``axes``, ``starts`` and ``ends`` attributes to specify the start and
end dimension for each axis in the list of axes and Slice uses this information
... | [
"This",
"operator",
"produces",
"a",
"slice",
"of",
"input",
"along",
"multiple",
"axes",
".",
"Similar",
"to",
"numpy",
":",
"https",
":",
"//",
"docs",
".",
"scipy",
".",
"org",
"/",
"doc",
"/",
"numpy",
"/",
"reference",
"/",
"arrays",
".",
"indexin... | def slice(input, axes, starts, ends):
"""
This operator produces a slice of ``input`` along multiple axes. Similar to numpy:
https://docs.scipy.org/doc/numpy/reference/arrays.indexing.html
Slice uses ``axes``, ``starts`` and ``ends`` attributes to specify the start and
end dimension for each axis in... | [
"def",
"slice",
"(",
"input",
",",
"axes",
",",
"starts",
",",
"ends",
")",
":",
"if",
"in_dygraph_mode",
"(",
")",
":",
"attrs",
"=",
"(",
")",
"starts_tensor",
"=",
"None",
"ends_tensor",
"=",
"None",
"if",
"isinstance",
"(",
"axes",
",",
"(",
"lis... | https://github.com/PaddlePaddle/Paddle/blob/1252f4bb3e574df80aa6d18c7ddae1b3a90bd81c/python/paddle/fluid/layers/nn.py#L11039-L11215 | |
opengauss-mirror/openGauss-server | e383f1b77720a00ddbe4c0655bc85914d9b02a2b | src/gausskernel/dbmind/tools/anomaly_detection/utils/__init__.py | python | AesCbcUtil.format_path | (root_path) | return os.path.join(root_path, "cipher"), os.path.join(root_path, "rand") | format decrypt_with_multi or decrypt_with_path | format decrypt_with_multi or decrypt_with_path | [
"format",
"decrypt_with_multi",
"or",
"decrypt_with_path"
] | def format_path(root_path):
"""format decrypt_with_multi or decrypt_with_path"""
return os.path.join(root_path, "cipher"), os.path.join(root_path, "rand") | [
"def",
"format_path",
"(",
"root_path",
")",
":",
"return",
"os",
".",
"path",
".",
"join",
"(",
"root_path",
",",
"\"cipher\"",
")",
",",
"os",
".",
"path",
".",
"join",
"(",
"root_path",
",",
"\"rand\"",
")"
] | https://github.com/opengauss-mirror/openGauss-server/blob/e383f1b77720a00ddbe4c0655bc85914d9b02a2b/src/gausskernel/dbmind/tools/anomaly_detection/utils/__init__.py#L169-L171 | |
aws/lumberyard | f85344403c1c2e77ec8c75deb2c116e97b713217 | dev/Tools/Python/3.7.10/windows/Lib/multiprocessing/util.py | python | log_to_stderr | (level=None) | return _logger | Turn on logging and add a handler which prints to stderr | Turn on logging and add a handler which prints to stderr | [
"Turn",
"on",
"logging",
"and",
"add",
"a",
"handler",
"which",
"prints",
"to",
"stderr"
] | def log_to_stderr(level=None):
'''
Turn on logging and add a handler which prints to stderr
'''
global _log_to_stderr
import logging
logger = get_logger()
formatter = logging.Formatter(DEFAULT_LOGGING_FORMAT)
handler = logging.StreamHandler()
handler.setFormatter(formatter)
logg... | [
"def",
"log_to_stderr",
"(",
"level",
"=",
"None",
")",
":",
"global",
"_log_to_stderr",
"import",
"logging",
"logger",
"=",
"get_logger",
"(",
")",
"formatter",
"=",
"logging",
".",
"Formatter",
"(",
"DEFAULT_LOGGING_FORMAT",
")",
"handler",
"=",
"logging",
"... | https://github.com/aws/lumberyard/blob/f85344403c1c2e77ec8c75deb2c116e97b713217/dev/Tools/Python/3.7.10/windows/Lib/multiprocessing/util.py#L87-L103 | |
aws/lumberyard | f85344403c1c2e77ec8c75deb2c116e97b713217 | dev/Gems/CloudGemMetric/v1/AWS/common-code/Lib/pandas/io/json/_json.py | python | Parser._try_convert_to_date | (self, data) | return data, False | Try to parse a ndarray like into a date column.
Try to coerce object in epoch/iso formats and integer/float in epoch
formats. Return a boolean if parsing was successful. | Try to parse a ndarray like into a date column. | [
"Try",
"to",
"parse",
"a",
"ndarray",
"like",
"into",
"a",
"date",
"column",
"."
] | def _try_convert_to_date(self, data):
"""
Try to parse a ndarray like into a date column.
Try to coerce object in epoch/iso formats and integer/float in epoch
formats. Return a boolean if parsing was successful.
"""
# no conversion on empty
if not len(data):
... | [
"def",
"_try_convert_to_date",
"(",
"self",
",",
"data",
")",
":",
"# no conversion on empty",
"if",
"not",
"len",
"(",
"data",
")",
":",
"return",
"data",
",",
"False",
"new_data",
"=",
"data",
"if",
"new_data",
".",
"dtype",
"==",
"\"object\"",
":",
"try... | https://github.com/aws/lumberyard/blob/f85344403c1c2e77ec8c75deb2c116e97b713217/dev/Gems/CloudGemMetric/v1/AWS/common-code/Lib/pandas/io/json/_json.py#L954-L990 | |
benoitsteiner/tensorflow-opencl | cb7cb40a57fde5cfd4731bc551e82a1e2fef43a5 | tensorflow/python/tools/freeze_graph.py | python | _parse_input_graph_proto | (input_graph, input_binary) | return input_graph_def | Parser input tensorflow graph into GraphDef proto. | Parser input tensorflow graph into GraphDef proto. | [
"Parser",
"input",
"tensorflow",
"graph",
"into",
"GraphDef",
"proto",
"."
] | def _parse_input_graph_proto(input_graph, input_binary):
"""Parser input tensorflow graph into GraphDef proto."""
if not gfile.Exists(input_graph):
print("Input graph file '" + input_graph + "' does not exist!")
return -1
input_graph_def = graph_pb2.GraphDef()
mode = "rb" if input_binary else "r"
with... | [
"def",
"_parse_input_graph_proto",
"(",
"input_graph",
",",
"input_binary",
")",
":",
"if",
"not",
"gfile",
".",
"Exists",
"(",
"input_graph",
")",
":",
"print",
"(",
"\"Input graph file '\"",
"+",
"input_graph",
"+",
"\"' does not exist!\"",
")",
"return",
"-",
... | https://github.com/benoitsteiner/tensorflow-opencl/blob/cb7cb40a57fde5cfd4731bc551e82a1e2fef43a5/tensorflow/python/tools/freeze_graph.py#L160-L172 | |
catboost/catboost | 167f64f237114a4d10b2b4ee42adb4569137debe | contrib/tools/python/src/Lib/decimal.py | python | Context._ignore_flags | (self, *flags) | return list(flags) | Ignore the flags, if they are raised | Ignore the flags, if they are raised | [
"Ignore",
"the",
"flags",
"if",
"they",
"are",
"raised"
] | def _ignore_flags(self, *flags):
"""Ignore the flags, if they are raised"""
# Do not mutate-- This way, copies of a context leave the original
# alone.
self._ignored_flags = (self._ignored_flags + list(flags))
return list(flags) | [
"def",
"_ignore_flags",
"(",
"self",
",",
"*",
"flags",
")",
":",
"# Do not mutate-- This way, copies of a context leave the original",
"# alone.",
"self",
".",
"_ignored_flags",
"=",
"(",
"self",
".",
"_ignored_flags",
"+",
"list",
"(",
"flags",
")",
")",
"return",... | https://github.com/catboost/catboost/blob/167f64f237114a4d10b2b4ee42adb4569137debe/contrib/tools/python/src/Lib/decimal.py#L3878-L3883 | |
blackberry/Boost | fc90c3fde129c62565c023f091eddc4a7ed9902b | tools/build/v2/build/virtual_target.py | python | Subvariant.all_referenced_targets | (self, result) | Returns all targets referenced by this subvariant,
either directly or indirectly, and either as sources,
or as dependency properties. Targets referred with
dependency property are returned a properties, not targets. | Returns all targets referenced by this subvariant,
either directly or indirectly, and either as sources,
or as dependency properties. Targets referred with
dependency property are returned a properties, not targets. | [
"Returns",
"all",
"targets",
"referenced",
"by",
"this",
"subvariant",
"either",
"directly",
"or",
"indirectly",
"and",
"either",
"as",
"sources",
"or",
"as",
"dependency",
"properties",
".",
"Targets",
"referred",
"with",
"dependency",
"property",
"are",
"returne... | def all_referenced_targets(self, result):
"""Returns all targets referenced by this subvariant,
either directly or indirectly, and either as sources,
or as dependency properties. Targets referred with
dependency property are returned a properties, not targets."""
# Find directly... | [
"def",
"all_referenced_targets",
"(",
"self",
",",
"result",
")",
":",
"# Find directly referenced targets.",
"deps",
"=",
"self",
".",
"build_properties",
"(",
")",
".",
"dependency",
"(",
")",
"all_targets",
"=",
"self",
".",
"sources_",
"+",
"deps",
"# Find o... | https://github.com/blackberry/Boost/blob/fc90c3fde129c62565c023f091eddc4a7ed9902b/tools/build/v2/build/virtual_target.py#L1047-L1074 | ||
apple/turicreate | cce55aa5311300e3ce6af93cb45ba791fd1bdf49 | deps/src/libxml2-2.9.1/python/libxml2class.py | python | loadCatalogs | (pathss) | Load the catalogs and makes their definitions effective for
the default external entity loader. this function is not
thread safe, catalog initialization should preferably be
done once at startup | Load the catalogs and makes their definitions effective for
the default external entity loader. this function is not
thread safe, catalog initialization should preferably be
done once at startup | [
"Load",
"the",
"catalogs",
"and",
"makes",
"their",
"definitions",
"effective",
"for",
"the",
"default",
"external",
"entity",
"loader",
".",
"this",
"function",
"is",
"not",
"thread",
"safe",
"catalog",
"initialization",
"should",
"preferably",
"be",
"done",
"o... | def loadCatalogs(pathss):
"""Load the catalogs and makes their definitions effective for
the default external entity loader. this function is not
thread safe, catalog initialization should preferably be
done once at startup """
libxml2mod.xmlLoadCatalogs(pathss) | [
"def",
"loadCatalogs",
"(",
"pathss",
")",
":",
"libxml2mod",
".",
"xmlLoadCatalogs",
"(",
"pathss",
")"
] | https://github.com/apple/turicreate/blob/cce55aa5311300e3ce6af93cb45ba791fd1bdf49/deps/src/libxml2-2.9.1/python/libxml2class.py#L206-L211 | ||
openvinotoolkit/openvino | dedcbeafa8b84cccdc55ca64b8da516682b381c7 | .github/github_org_control/github_api.py | python | print_users | (users) | Print list of users in different formats: list, set, PaginatedList | Print list of users in different formats: list, set, PaginatedList | [
"Print",
"list",
"of",
"users",
"in",
"different",
"formats",
":",
"list",
"set",
"PaginatedList"
] | def print_users(users):
"""Print list of users in different formats: list, set, PaginatedList"""
if isinstance(users, (list, set, PaginatedList)):
users_count = users.totalCount if isinstance(users, PaginatedList) else len(users)
print(f"GitHub users {users_count} (login - name - company - email... | [
"def",
"print_users",
"(",
"users",
")",
":",
"if",
"isinstance",
"(",
"users",
",",
"(",
"list",
",",
"set",
",",
"PaginatedList",
")",
")",
":",
"users_count",
"=",
"users",
".",
"totalCount",
"if",
"isinstance",
"(",
"users",
",",
"PaginatedList",
")"... | https://github.com/openvinotoolkit/openvino/blob/dedcbeafa8b84cccdc55ca64b8da516682b381c7/.github/github_org_control/github_api.py#L65-L97 | ||
hanpfei/chromium-net | 392cc1fa3a8f92f42e4071ab6e674d8e0482f83f | third_party/catapult/third_party/py_vulcanize/third_party/rcssmin/_setup/py2/setup.py | python | find_classifiers | (docs) | return [] | Determine classifiers from CLASSIFIERS
:return: List of classifiers (``['classifier', ...]``)
:rtype: ``list`` | Determine classifiers from CLASSIFIERS | [
"Determine",
"classifiers",
"from",
"CLASSIFIERS"
] | def find_classifiers(docs):
"""
Determine classifiers from CLASSIFIERS
:return: List of classifiers (``['classifier', ...]``)
:rtype: ``list``
"""
filename = docs.get('meta.classifiers', 'CLASSIFIERS').strip()
if filename and _os.path.isfile(filename):
fp = open(filename)
tr... | [
"def",
"find_classifiers",
"(",
"docs",
")",
":",
"filename",
"=",
"docs",
".",
"get",
"(",
"'meta.classifiers'",
",",
"'CLASSIFIERS'",
")",
".",
"strip",
"(",
")",
"if",
"filename",
"and",
"_os",
".",
"path",
".",
"isfile",
"(",
"filename",
")",
":",
... | https://github.com/hanpfei/chromium-net/blob/392cc1fa3a8f92f42e4071ab6e674d8e0482f83f/third_party/catapult/third_party/py_vulcanize/third_party/rcssmin/_setup/py2/setup.py#L119-L135 | |
tensorflow/tensorflow | 419e3a6b650ea4bd1b0cba23c4348f8a69f3272e | tensorflow/python/distribute/cluster_resolver/slurm_cluster_resolver.py | python | _get_slurm_var | (name) | Gets the SLURM variable from the environment.
Args:
name: Name of the step variable
Returns:
SLURM_<name> from os.environ
Raises:
RuntimeError if variable is not found | Gets the SLURM variable from the environment. | [
"Gets",
"the",
"SLURM",
"variable",
"from",
"the",
"environment",
"."
] | def _get_slurm_var(name):
"""Gets the SLURM variable from the environment.
Args:
name: Name of the step variable
Returns:
SLURM_<name> from os.environ
Raises:
RuntimeError if variable is not found
"""
name = 'SLURM_' + name
try:
return os.environ[name]
except KeyError:
raise Runtim... | [
"def",
"_get_slurm_var",
"(",
"name",
")",
":",
"name",
"=",
"'SLURM_'",
"+",
"name",
"try",
":",
"return",
"os",
".",
"environ",
"[",
"name",
"]",
"except",
"KeyError",
":",
"raise",
"RuntimeError",
"(",
"'%s not found in environment. '",
"'Not running inside a... | https://github.com/tensorflow/tensorflow/blob/419e3a6b650ea4bd1b0cba23c4348f8a69f3272e/tensorflow/python/distribute/cluster_resolver/slurm_cluster_resolver.py#L106-L122 | ||
aws/lumberyard | f85344403c1c2e77ec8c75deb2c116e97b713217 | dev/Tools/AWSPythonSDK/1.5.8/docutils/utils/math/math2html.py | python | Trace.show | (cls, message, channel) | Show a message out of a channel | Show a message out of a channel | [
"Show",
"a",
"message",
"out",
"of",
"a",
"channel"
] | def show(cls, message, channel):
"Show a message out of a channel"
if sys.version_info < (3,0):
message = message.encode('utf-8')
channel.write(message + '\n') | [
"def",
"show",
"(",
"cls",
",",
"message",
",",
"channel",
")",
":",
"if",
"sys",
".",
"version_info",
"<",
"(",
"3",
",",
"0",
")",
":",
"message",
"=",
"message",
".",
"encode",
"(",
"'utf-8'",
")",
"channel",
".",
"write",
"(",
"message",
"+",
... | https://github.com/aws/lumberyard/blob/f85344403c1c2e77ec8c75deb2c116e97b713217/dev/Tools/AWSPythonSDK/1.5.8/docutils/utils/math/math2html.py#L63-L67 | ||
apache/singa | 93fd9da72694e68bfe3fb29d0183a65263d238a1 | python/singa/autograd.py | python | round | (x) | return Round()(x)[0] | Element-wise round the input
Args:
x (Tensor): input tensor.
Returns:
the output Tensor. | Element-wise round the input
Args:
x (Tensor): input tensor.
Returns:
the output Tensor. | [
"Element",
"-",
"wise",
"round",
"the",
"input",
"Args",
":",
"x",
"(",
"Tensor",
")",
":",
"input",
"tensor",
".",
"Returns",
":",
"the",
"output",
"Tensor",
"."
] | def round(x):
"""
Element-wise round the input
Args:
x (Tensor): input tensor.
Returns:
the output Tensor.
"""
return Round()(x)[0] | [
"def",
"round",
"(",
"x",
")",
":",
"return",
"Round",
"(",
")",
"(",
"x",
")",
"[",
"0",
"]"
] | https://github.com/apache/singa/blob/93fd9da72694e68bfe3fb29d0183a65263d238a1/python/singa/autograd.py#L5609-L5617 | |
wxWidgets/wxPython-Classic | 19571e1ae65f1ac445f5491474121998c97a1bf0 | contrib/gizmos/msw/gizmos.py | python | EditableListBox.GetEditButton | (*args, **kwargs) | return _gizmos.EditableListBox_GetEditButton(*args, **kwargs) | GetEditButton(self) -> BitmapButton | GetEditButton(self) -> BitmapButton | [
"GetEditButton",
"(",
"self",
")",
"-",
">",
"BitmapButton"
] | def GetEditButton(*args, **kwargs):
"""GetEditButton(self) -> BitmapButton"""
return _gizmos.EditableListBox_GetEditButton(*args, **kwargs) | [
"def",
"GetEditButton",
"(",
"*",
"args",
",",
"*",
"*",
"kwargs",
")",
":",
"return",
"_gizmos",
".",
"EditableListBox_GetEditButton",
"(",
"*",
"args",
",",
"*",
"*",
"kwargs",
")"
] | https://github.com/wxWidgets/wxPython-Classic/blob/19571e1ae65f1ac445f5491474121998c97a1bf0/contrib/gizmos/msw/gizmos.py#L183-L185 | |
OKCoin/websocket | 50c806cf1e9a84984c6cf2efd94a937738cfc35c | python/websocket/_app.py | python | WebSocketApp.send | (self, data, opcode=ABNF.OPCODE_TEXT) | send message.
data: message to send. If you set opcode to OPCODE_TEXT,
data must be utf-8 string or unicode.
opcode: operation code of data. default is OPCODE_TEXT. | send message.
data: message to send. If you set opcode to OPCODE_TEXT,
data must be utf-8 string or unicode.
opcode: operation code of data. default is OPCODE_TEXT. | [
"send",
"message",
".",
"data",
":",
"message",
"to",
"send",
".",
"If",
"you",
"set",
"opcode",
"to",
"OPCODE_TEXT",
"data",
"must",
"be",
"utf",
"-",
"8",
"string",
"or",
"unicode",
".",
"opcode",
":",
"operation",
"code",
"of",
"data",
".",
"default... | def send(self, data, opcode=ABNF.OPCODE_TEXT):
"""
send message.
data: message to send. If you set opcode to OPCODE_TEXT,
data must be utf-8 string or unicode.
opcode: operation code of data. default is OPCODE_TEXT.
"""
if not self.sock or self.sock.send(da... | [
"def",
"send",
"(",
"self",
",",
"data",
",",
"opcode",
"=",
"ABNF",
".",
"OPCODE_TEXT",
")",
":",
"if",
"not",
"self",
".",
"sock",
"or",
"self",
".",
"sock",
".",
"send",
"(",
"data",
",",
"opcode",
")",
"==",
"0",
":",
"raise",
"WebSocketConnect... | https://github.com/OKCoin/websocket/blob/50c806cf1e9a84984c6cf2efd94a937738cfc35c/python/websocket/_app.py#L96-L105 | ||
wxWidgets/wxPython-Classic | 19571e1ae65f1ac445f5491474121998c97a1bf0 | wx/tools/Editra/src/extern/aui/framemanager.py | python | AuiPaneInfo.MinSize1 | (self, size) | return self | Sets the minimum size of the pane.
:see: :meth:`MinSize` for an explanation of input parameters. | Sets the minimum size of the pane. | [
"Sets",
"the",
"minimum",
"size",
"of",
"the",
"pane",
"."
] | def MinSize1(self, size):
"""
Sets the minimum size of the pane.
:see: :meth:`MinSize` for an explanation of input parameters.
"""
self.min_size = size
return self | [
"def",
"MinSize1",
"(",
"self",
",",
"size",
")",
":",
"self",
".",
"min_size",
"=",
"size",
"return",
"self"
] | https://github.com/wxWidgets/wxPython-Classic/blob/19571e1ae65f1ac445f5491474121998c97a1bf0/wx/tools/Editra/src/extern/aui/framemanager.py#L1059-L1066 | |
naver/sling | 5671cd445a2caae0b4dd0332299e4cfede05062c | webkit/Tools/Scripts/webkitpy/thirdparty/mod_pywebsocket/common.py | python | format_extension | (extension) | return '; '.join(formatted_params) | Formats an ExtensionParameter object. | Formats an ExtensionParameter object. | [
"Formats",
"an",
"ExtensionParameter",
"object",
"."
] | def format_extension(extension):
"""Formats an ExtensionParameter object."""
formatted_params = [extension.name()]
for param_name, param_value in extension.get_parameters():
if param_value is None:
formatted_params.append(param_name)
else:
quoted_value = http_header_... | [
"def",
"format_extension",
"(",
"extension",
")",
":",
"formatted_params",
"=",
"[",
"extension",
".",
"name",
"(",
")",
"]",
"for",
"param_name",
",",
"param_value",
"in",
"extension",
".",
"get_parameters",
"(",
")",
":",
"if",
"param_value",
"is",
"None",... | https://github.com/naver/sling/blob/5671cd445a2caae0b4dd0332299e4cfede05062c/webkit/Tools/Scripts/webkitpy/thirdparty/mod_pywebsocket/common.py#L285-L295 | |
eventql/eventql | 7ca0dbb2e683b525620ea30dc40540a22d5eb227 | deps/3rdparty/spidermonkey/mozjs/python/lldbutils/lldbutils/layout.py | python | frametreelimited | (debugger, command, result, dict) | Dumps the subtree of a frame tree rooted at the given nsIFrame*. | Dumps the subtree of a frame tree rooted at the given nsIFrame*. | [
"Dumps",
"the",
"subtree",
"of",
"a",
"frame",
"tree",
"rooted",
"at",
"the",
"given",
"nsIFrame",
"*",
"."
] | def frametreelimited(debugger, command, result, dict):
"""Dumps the subtree of a frame tree rooted at the given nsIFrame*."""
debugger.HandleCommand('expr (' + command + ')->DumpFrameTreeLimited()') | [
"def",
"frametreelimited",
"(",
"debugger",
",",
"command",
",",
"result",
",",
"dict",
")",
":",
"debugger",
".",
"HandleCommand",
"(",
"'expr ('",
"+",
"command",
"+",
"')->DumpFrameTreeLimited()'",
")"
] | https://github.com/eventql/eventql/blob/7ca0dbb2e683b525620ea30dc40540a22d5eb227/deps/3rdparty/spidermonkey/mozjs/python/lldbutils/lldbutils/layout.py#L7-L9 | ||
wxWidgets/wxPython-Classic | 19571e1ae65f1ac445f5491474121998c97a1bf0 | src/msw/html.py | python | HtmlEasyPrinting.SetParentWindow | (*args, **kwargs) | return _html.HtmlEasyPrinting_SetParentWindow(*args, **kwargs) | SetParentWindow(self, Window window) | SetParentWindow(self, Window window) | [
"SetParentWindow",
"(",
"self",
"Window",
"window",
")"
] | def SetParentWindow(*args, **kwargs):
"""SetParentWindow(self, Window window)"""
return _html.HtmlEasyPrinting_SetParentWindow(*args, **kwargs) | [
"def",
"SetParentWindow",
"(",
"*",
"args",
",",
"*",
"*",
"kwargs",
")",
":",
"return",
"_html",
".",
"HtmlEasyPrinting_SetParentWindow",
"(",
"*",
"args",
",",
"*",
"*",
"kwargs",
")"
] | https://github.com/wxWidgets/wxPython-Classic/blob/19571e1ae65f1ac445f5491474121998c97a1bf0/src/msw/html.py#L1384-L1386 | |
SFTtech/openage | d6a08c53c48dc1e157807471df92197f6ca9e04d | buildsystem/codecompliance/util.py | python | has_ext | (fname, exts) | return False | Returns true if fname ends in any of the extensions in ext. | Returns true if fname ends in any of the extensions in ext. | [
"Returns",
"true",
"if",
"fname",
"ends",
"in",
"any",
"of",
"the",
"extensions",
"in",
"ext",
"."
] | def has_ext(fname, exts):
"""
Returns true if fname ends in any of the extensions in ext.
"""
for ext in exts:
if ext == '':
if os.path.splitext(fname)[1] == '':
return True
elif fname.endswith(ext):
return True
return False | [
"def",
"has_ext",
"(",
"fname",
",",
"exts",
")",
":",
"for",
"ext",
"in",
"exts",
":",
"if",
"ext",
"==",
"''",
":",
"if",
"os",
".",
"path",
".",
"splitext",
"(",
"fname",
")",
"[",
"1",
"]",
"==",
"''",
":",
"return",
"True",
"elif",
"fname"... | https://github.com/SFTtech/openage/blob/d6a08c53c48dc1e157807471df92197f6ca9e04d/buildsystem/codecompliance/util.py#L16-L27 | |
hanpfei/chromium-net | 392cc1fa3a8f92f42e4071ab6e674d8e0482f83f | build/android/pylib/utils/proguard.py | python | Dump | (jar_path) | Dumps class and method information from a JAR into a dict via proguard.
Args:
jar_path: An absolute path to the JAR file to dump.
Returns:
A dict in the following format:
{
'classes': [
{
'class': '',
'superclass': '',
'annotations': {/* dict -- s... | Dumps class and method information from a JAR into a dict via proguard. | [
"Dumps",
"class",
"and",
"method",
"information",
"from",
"a",
"JAR",
"into",
"a",
"dict",
"via",
"proguard",
"."
] | def Dump(jar_path):
"""Dumps class and method information from a JAR into a dict via proguard.
Args:
jar_path: An absolute path to the JAR file to dump.
Returns:
A dict in the following format:
{
'classes': [
{
'class': '',
'superclass': '',
'an... | [
"def",
"Dump",
"(",
"jar_path",
")",
":",
"with",
"tempfile",
".",
"NamedTemporaryFile",
"(",
")",
"as",
"proguard_output",
":",
"cmd_helper",
".",
"GetCmdStatusAndOutput",
"(",
"[",
"'java'",
",",
"'-jar'",
",",
"_PROGUARD_PATH",
",",
"'-injars'",
",",
"jar_p... | https://github.com/hanpfei/chromium-net/blob/392cc1fa3a8f92f42e4071ab6e674d8e0482f83f/build/android/pylib/utils/proguard.py#L45-L103 | ||
deepmind/streetlearn | ccf1d60b9c45154894d45a897748aee85d7eb69b | streetlearn/python/experiment.py | python | FlowEnvironment.step | (self, action, state) | Takes a step in the environment.
Args:
action: An action tensor suitable for the underlying environment.
state: The environment state from the last step or initial state.
Returns:
A tuple of (`StepOutput`, environment state). The environment state should
be passed in to the next invoca... | Takes a step in the environment. | [
"Takes",
"a",
"step",
"in",
"the",
"environment",
"."
] | def step(self, action, state):
"""Takes a step in the environment.
Args:
action: An action tensor suitable for the underlying environment.
state: The environment state from the last step or initial state.
Returns:
A tuple of (`StepOutput`, environment state). The environment state should... | [
"def",
"step",
"(",
"self",
",",
"action",
",",
"state",
")",
":",
"with",
"tf",
".",
"name_scope",
"(",
"'flow_environment_step'",
")",
":",
"flow",
",",
"info",
"=",
"nest",
".",
"map_structure",
"(",
"tf",
".",
"convert_to_tensor",
",",
"state",
")",
... | https://github.com/deepmind/streetlearn/blob/ccf1d60b9c45154894d45a897748aee85d7eb69b/streetlearn/python/experiment.py#L210-L244 | ||
microsoft/TSS.MSR | 0f2516fca2cd9929c31d5450e39301c9bde43688 | TSS.Py/src/TpmTypes.py | python | TPM2_ContextLoad_REQUEST.toTpm | (self, buf) | TpmMarshaller method | TpmMarshaller method | [
"TpmMarshaller",
"method"
] | def toTpm(self, buf):
""" TpmMarshaller method """
self.context.toTpm(buf) | [
"def",
"toTpm",
"(",
"self",
",",
"buf",
")",
":",
"self",
".",
"context",
".",
"toTpm",
"(",
"buf",
")"
] | https://github.com/microsoft/TSS.MSR/blob/0f2516fca2cd9929c31d5450e39301c9bde43688/TSS.Py/src/TpmTypes.py#L16143-L16145 | ||
microsoft/LightGBM | 904b2d5158703c4900b68008617951dd2f9ff21b | python-package/lightgbm/basic.py | python | _is_2d_collection | (data: Any) | return (
_is_numpy_2d_array(data)
or _is_2d_list(data)
or isinstance(data, pd_DataFrame)
) | Check whether data is a 2-D collection. | Check whether data is a 2-D collection. | [
"Check",
"whether",
"data",
"is",
"a",
"2",
"-",
"D",
"collection",
"."
] | def _is_2d_collection(data: Any) -> bool:
"""Check whether data is a 2-D collection."""
return (
_is_numpy_2d_array(data)
or _is_2d_list(data)
or isinstance(data, pd_DataFrame)
) | [
"def",
"_is_2d_collection",
"(",
"data",
":",
"Any",
")",
"->",
"bool",
":",
"return",
"(",
"_is_numpy_2d_array",
"(",
"data",
")",
"or",
"_is_2d_list",
"(",
"data",
")",
"or",
"isinstance",
"(",
"data",
",",
"pd_DataFrame",
")",
")"
] | https://github.com/microsoft/LightGBM/blob/904b2d5158703c4900b68008617951dd2f9ff21b/python-package/lightgbm/basic.py#L205-L211 | |
tensorflow/tensorflow | 419e3a6b650ea4bd1b0cba23c4348f8a69f3272e | tensorflow/python/framework/importer.py | python | _ProcessNewOps | (graph) | Processes the newly-added TF_Operations in `graph`. | Processes the newly-added TF_Operations in `graph`. | [
"Processes",
"the",
"newly",
"-",
"added",
"TF_Operations",
"in",
"graph",
"."
] | def _ProcessNewOps(graph):
"""Processes the newly-added TF_Operations in `graph`."""
# Maps from a node to the names of the ops it's colocated with, if colocation
# is specified in the attributes.
colocation_pairs = {}
for new_op in graph._add_new_tf_operations(compute_devices=False): # pylint: disable=prot... | [
"def",
"_ProcessNewOps",
"(",
"graph",
")",
":",
"# Maps from a node to the names of the ops it's colocated with, if colocation",
"# is specified in the attributes.",
"colocation_pairs",
"=",
"{",
"}",
"for",
"new_op",
"in",
"graph",
".",
"_add_new_tf_operations",
"(",
"compute... | https://github.com/tensorflow/tensorflow/blob/419e3a6b650ea4bd1b0cba23c4348f8a69f3272e/tensorflow/python/framework/importer.py#L241-L290 | ||
ablab/quast | 5f6709528129a6ad266a6b24ef3f40b88f0fe04b | quast_libs/busco/GeneSetAnalysis.py | python | GeneSetAnalysis._init_tools | (self) | Init the tools needed for the analysis | Init the tools needed for the analysis | [
"Init",
"the",
"tools",
"needed",
"for",
"the",
"analysis"
] | def _init_tools(self):
"""
Init the tools needed for the analysis
"""
GeneSetAnalysis._logger.info('Init tools...')
self._hmmer = Tool('hmmsearch', self._params)
GeneSetAnalysis._logger.info('Check dependencies...')
self._check_tool_dependencies() | [
"def",
"_init_tools",
"(",
"self",
")",
":",
"GeneSetAnalysis",
".",
"_logger",
".",
"info",
"(",
"'Init tools...'",
")",
"self",
".",
"_hmmer",
"=",
"Tool",
"(",
"'hmmsearch'",
",",
"self",
".",
"_params",
")",
"GeneSetAnalysis",
".",
"_logger",
".",
"inf... | https://github.com/ablab/quast/blob/5f6709528129a6ad266a6b24ef3f40b88f0fe04b/quast_libs/busco/GeneSetAnalysis.py#L79-L86 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.