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 |
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
kamyu104/LeetCode-Solutions | 77605708a927ea3b85aee5a479db733938c7c211 | Python/largest-multiple-of-three.py | python | Solution2.largestMultipleOfThree | (self, digits) | return "0" if result and result[0] == '0' else result | :type digits: List[int]
:rtype: str | :type digits: List[int]
:rtype: str | [
":",
"type",
"digits",
":",
"List",
"[",
"int",
"]",
":",
"rtype",
":",
"str"
] | def largestMultipleOfThree(self, digits):
"""
:type digits: List[int]
:rtype: str
"""
def candidates_gen(r):
if r == 0:
return
for i in xrange(10):
yield [i]
for i in xrange(10):
for j in xrange(i... | [
"def",
"largestMultipleOfThree",
"(",
"self",
",",
"digits",
")",
":",
"def",
"candidates_gen",
"(",
"r",
")",
":",
"if",
"r",
"==",
"0",
":",
"return",
"for",
"i",
"in",
"xrange",
"(",
"10",
")",
":",
"yield",
"[",
"i",
"]",
"for",
"i",
"in",
"x... | https://github.com/kamyu104/LeetCode-Solutions/blob/77605708a927ea3b85aee5a479db733938c7c211/Python/largest-multiple-of-three.py#L30-L53 | |
catboost/catboost | 167f64f237114a4d10b2b4ee42adb4569137debe | contrib/tools/python/src/Lib/pydoc.py | python | cram | (text, maxlen) | return text | Omit part of a string if needed to make it fit in a maximum length. | Omit part of a string if needed to make it fit in a maximum length. | [
"Omit",
"part",
"of",
"a",
"string",
"if",
"needed",
"to",
"make",
"it",
"fit",
"in",
"a",
"maximum",
"length",
"."
] | def cram(text, maxlen):
"""Omit part of a string if needed to make it fit in a maximum length."""
if len(text) > maxlen:
pre = max(0, (maxlen-3)//2)
post = max(0, maxlen-3-pre)
return text[:pre] + '...' + text[len(text)-post:]
return text | [
"def",
"cram",
"(",
"text",
",",
"maxlen",
")",
":",
"if",
"len",
"(",
"text",
")",
">",
"maxlen",
":",
"pre",
"=",
"max",
"(",
"0",
",",
"(",
"maxlen",
"-",
"3",
")",
"//",
"2",
")",
"post",
"=",
"max",
"(",
"0",
",",
"maxlen",
"-",
"3",
... | https://github.com/catboost/catboost/blob/167f64f237114a4d10b2b4ee42adb4569137debe/contrib/tools/python/src/Lib/pydoc.py#L117-L123 | |
albertz/openlierox | d316c14a8eb57848ef56e9bfa7b23a56f694a51b | tools/DedicatedServerVideo/atom/__init__.py | python | AtomBase._ToElementTree | (self) | return new_tree | Note, this method is designed to be used only with classes that have a
_tag and _namespace. It is placed in AtomBase for inheritance but should
not be called on this class. | [] | def _ToElementTree(self):
"""
Note, this method is designed to be used only with classes that have a
_tag and _namespace. It is placed in AtomBase for inheritance but should
not be called on this class.
"""
new_tree = ElementTree.Element('{%s}%s' % (self.__class__._namespace,
... | [
"def",
"_ToElementTree",
"(",
"self",
")",
":",
"new_tree",
"=",
"ElementTree",
".",
"Element",
"(",
"'{%s}%s'",
"%",
"(",
"self",
".",
"__class__",
".",
"_namespace",
",",
"self",
".",
"__class__",
".",
"_tag",
")",
")",
"self",
".",
"_AddMembersToElement... | https://github.com/albertz/openlierox/blob/d316c14a8eb57848ef56e9bfa7b23a56f694a51b/tools/DedicatedServerVideo/atom/__init__.py#L359-L370 | ||
mindspore-ai/mindspore | fb8fd3338605bb34fa5cea054e535a8b1d753fab | mindspore/python/mindspore/ops/_op_impl/tbe/floor_div.py | python | _floor_div_tbe | () | return | FloorDiv TBE register | FloorDiv TBE register | [
"FloorDiv",
"TBE",
"register"
] | def _floor_div_tbe():
"""FloorDiv TBE register"""
return | [
"def",
"_floor_div_tbe",
"(",
")",
":",
"return"
] | https://github.com/mindspore-ai/mindspore/blob/fb8fd3338605bb34fa5cea054e535a8b1d753fab/mindspore/python/mindspore/ops/_op_impl/tbe/floor_div.py#L39-L41 | |
aws/lumberyard | f85344403c1c2e77ec8c75deb2c116e97b713217 | dev/Tools/AWSPythonSDK/1.5.8/docutils/parsers/rst/states.py | python | Line.text | (self, match, context, next_state) | return [], 'Body', [] | Potential over- & underlined title. | Potential over- & underlined title. | [
"Potential",
"over",
"-",
"&",
"underlined",
"title",
"."
] | def text(self, match, context, next_state):
"""Potential over- & underlined title."""
lineno = self.state_machine.abs_line_number() - 1
overline = context[0]
title = match.string
underline = ''
try:
underline = self.state_machine.next_line()
except EOF... | [
"def",
"text",
"(",
"self",
",",
"match",
",",
"context",
",",
"next_state",
")",
":",
"lineno",
"=",
"self",
".",
"state_machine",
".",
"abs_line_number",
"(",
")",
"-",
"1",
"overline",
"=",
"context",
"[",
"0",
"]",
"title",
"=",
"match",
".",
"st... | https://github.com/aws/lumberyard/blob/f85344403c1c2e77ec8c75deb2c116e97b713217/dev/Tools/AWSPythonSDK/1.5.8/docutils/parsers/rst/states.py#L2930-L2990 | |
Yelp/MOE | 5b5a6a2c6c3cf47320126f7f5894e2a83e347f5c | moe/optimal_learning/python/interfaces/covariance_interface.py | python | CovarianceInterface.hyperparameter_grad_covariance | (self, point_one, point_two) | r"""Compute the gradient of self.covariance(point_one, point_two) with respect to its hyperparameters.
.. Note:: comments are copied from the matching method comments of CovarianceInterface in gpp_covariance.hpp
and comments are copied to the matching method comments of
:mod:`moe.optimal_le... | r"""Compute the gradient of self.covariance(point_one, point_two) with respect to its hyperparameters. | [
"r",
"Compute",
"the",
"gradient",
"of",
"self",
".",
"covariance",
"(",
"point_one",
"point_two",
")",
"with",
"respect",
"to",
"its",
"hyperparameters",
"."
] | def hyperparameter_grad_covariance(self, point_one, point_two):
r"""Compute the gradient of self.covariance(point_one, point_two) with respect to its hyperparameters.
.. Note:: comments are copied from the matching method comments of CovarianceInterface in gpp_covariance.hpp
and comments are ... | [
"def",
"hyperparameter_grad_covariance",
"(",
"self",
",",
"point_one",
",",
"point_two",
")",
":",
"pass"
] | https://github.com/Yelp/MOE/blob/5b5a6a2c6c3cf47320126f7f5894e2a83e347f5c/moe/optimal_learning/python/interfaces/covariance_interface.py#L120-L138 | ||
microsoft/TSS.MSR | 0f2516fca2cd9929c31d5450e39301c9bde43688 | TSS.Py/src/TpmTypes.py | python | AC_SendResponse.__init__ | (self, acDataOut = None) | The purpose of this command is to send (copy) a loaded object from
the TPM to an Attached Component.
Attributes:
acDataOut (TPMS_AC_OUTPUT): May include AC specific data or
information about an error. | The purpose of this command is to send (copy) a loaded object from
the TPM to an Attached Component. | [
"The",
"purpose",
"of",
"this",
"command",
"is",
"to",
"send",
"(",
"copy",
")",
"a",
"loaded",
"object",
"from",
"the",
"TPM",
"to",
"an",
"Attached",
"Component",
"."
] | def __init__(self, acDataOut = None):
""" The purpose of this command is to send (copy) a loaded object from
the TPM to an Attached Component.
Attributes:
acDataOut (TPMS_AC_OUTPUT): May include AC specific data or
information about an error.
"""
self... | [
"def",
"__init__",
"(",
"self",
",",
"acDataOut",
"=",
"None",
")",
":",
"self",
".",
"acDataOut",
"=",
"acDataOut"
] | https://github.com/microsoft/TSS.MSR/blob/0f2516fca2cd9929c31d5450e39301c9bde43688/TSS.Py/src/TpmTypes.py#L17457-L17465 | ||
aws/lumberyard | f85344403c1c2e77ec8c75deb2c116e97b713217 | dev/Tools/Python/3.7.10/mac/Python.framework/Versions/3.7/lib/python3.7/site-packages/pip/_internal/vcs/git.py | python | Git.has_commit | (cls, location, rev) | Check if rev is a commit that is available in the local repository. | Check if rev is a commit that is available in the local repository. | [
"Check",
"if",
"rev",
"is",
"a",
"commit",
"that",
"is",
"available",
"in",
"the",
"local",
"repository",
"."
] | def has_commit(cls, location, rev):
"""
Check if rev is a commit that is available in the local repository.
"""
try:
cls.run_command(
['rev-parse', '-q', '--verify', "sha^" + rev],
cwd=location,
log_failed_cmd=False,
... | [
"def",
"has_commit",
"(",
"cls",
",",
"location",
",",
"rev",
")",
":",
"try",
":",
"cls",
".",
"run_command",
"(",
"[",
"'rev-parse'",
",",
"'-q'",
",",
"'--verify'",
",",
"\"sha^\"",
"+",
"rev",
"]",
",",
"cwd",
"=",
"location",
",",
"log_failed_cmd"... | https://github.com/aws/lumberyard/blob/f85344403c1c2e77ec8c75deb2c116e97b713217/dev/Tools/Python/3.7.10/mac/Python.framework/Versions/3.7/lib/python3.7/site-packages/pip/_internal/vcs/git.py#L342-L355 | ||
shedskin/shedskin | ae88dbca7b1d9671cd8be448cb0b497122758936 | examples/msp_ss.py | python | LowLevel.bslSync | (self,wait=0) | Transmits Synchronization character and expects to receive Acknowledge character
if wait is 0 it must work the first time. otherwise if wait is 1
it is retried (forever). | Transmits Synchronization character and expects to receive Acknowledge character
if wait is 0 it must work the first time. otherwise if wait is 1
it is retried (forever). | [
"Transmits",
"Synchronization",
"character",
"and",
"expects",
"to",
"receive",
"Acknowledge",
"character",
"if",
"wait",
"is",
"0",
"it",
"must",
"work",
"the",
"first",
"time",
".",
"otherwise",
"if",
"wait",
"is",
"1",
"it",
"is",
"retried",
"(",
"forever... | def bslSync(self,wait=0):
"""Transmits Synchronization character and expects to receive Acknowledge character
if wait is 0 it must work the first time. otherwise if wait is 1
it is retried (forever).
"""
loopcnt = 5 #Max. tries to get synchronization
... | [
"def",
"bslSync",
"(",
"self",
",",
"wait",
"=",
"0",
")",
":",
"loopcnt",
"=",
"5",
"#Max. tries to get synchronization",
"if",
"DEBUG",
">",
"1",
":",
"sys",
".",
"stderr",
".",
"write",
"(",
"\"* bslSync(wait=%d)\\n\"",
"%",
"wait",
")",
"while",
"wait"... | https://github.com/shedskin/shedskin/blob/ae88dbca7b1d9671cd8be448cb0b497122758936/examples/msp_ss.py#L588-L622 | ||
microsoft/CNTK | e9396480025b9ca457d26b6f33dd07c474c6aa04 | Examples/Image/Detection/utils/rpn/proposal_target_layer.py | python | ProposalTargetLayer._sample_rois | (self, all_rois, gt_boxes, fg_rois_per_image, rois_per_image, num_classes, deterministic=False) | return labels, rois, bbox_targets, bbox_inside_weights | Generate a random sample of RoIs comprising foreground and background
examples. | Generate a random sample of RoIs comprising foreground and background
examples. | [
"Generate",
"a",
"random",
"sample",
"of",
"RoIs",
"comprising",
"foreground",
"and",
"background",
"examples",
"."
] | def _sample_rois(self, all_rois, gt_boxes, fg_rois_per_image, rois_per_image, num_classes, deterministic=False):
"""Generate a random sample of RoIs comprising foreground and background
examples.
"""
# overlaps: (rois x gt_boxes)
overlaps = bbox_overlaps(
np.ascontigu... | [
"def",
"_sample_rois",
"(",
"self",
",",
"all_rois",
",",
"gt_boxes",
",",
"fg_rois_per_image",
",",
"rois_per_image",
",",
"num_classes",
",",
"deterministic",
"=",
"False",
")",
":",
"# overlaps: (rois x gt_boxes)",
"overlaps",
"=",
"bbox_overlaps",
"(",
"np",
"... | https://github.com/microsoft/CNTK/blob/e9396480025b9ca457d26b6f33dd07c474c6aa04/Examples/Image/Detection/utils/rpn/proposal_target_layer.py#L252-L305 | |
wxWidgets/wxPython-Classic | 19571e1ae65f1ac445f5491474121998c97a1bf0 | src/osx_cocoa/_misc.py | python | Joystick.GetPosition | (*args, **kwargs) | return _misc_.Joystick_GetPosition(*args, **kwargs) | GetPosition(self) -> Point | GetPosition(self) -> Point | [
"GetPosition",
"(",
"self",
")",
"-",
">",
"Point"
] | def GetPosition(*args, **kwargs):
"""GetPosition(self) -> Point"""
return _misc_.Joystick_GetPosition(*args, **kwargs) | [
"def",
"GetPosition",
"(",
"*",
"args",
",",
"*",
"*",
"kwargs",
")",
":",
"return",
"_misc_",
".",
"Joystick_GetPosition",
"(",
"*",
"args",
",",
"*",
"*",
"kwargs",
")"
] | https://github.com/wxWidgets/wxPython-Classic/blob/19571e1ae65f1ac445f5491474121998c97a1bf0/src/osx_cocoa/_misc.py#L2126-L2128 | |
PaddlePaddle/Paddle | 1252f4bb3e574df80aa6d18c7ddae1b3a90bd81c | python/paddle/fluid/layers/tensor.py | python | assign | (input, output=None) | return output | The OP copies the :attr:`input` to the :attr:`output`.
Parameters:
input (Tensor|numpy.ndarray|list|tuple|scalar): A tensor, numpy ndarray, tuple/list of scalar,
or scalar. Its data type supports float16, float32, float64, int32, int64, and bool.
Note: the float64 data will be conve... | [] | def assign(input, output=None):
"""
The OP copies the :attr:`input` to the :attr:`output`.
Parameters:
input (Tensor|numpy.ndarray|list|tuple|scalar): A tensor, numpy ndarray, tuple/list of scalar,
or scalar. Its data type supports float16, float32, float64, int32, int64, and bool.
... | [
"def",
"assign",
"(",
"input",
",",
"output",
"=",
"None",
")",
":",
"helper",
"=",
"LayerHelper",
"(",
"'assign'",
",",
"*",
"*",
"locals",
"(",
")",
")",
"check_type",
"(",
"input",
",",
"'input'",
",",
"(",
"Variable",
",",
"numpy",
".",
"ndarray"... | https://github.com/PaddlePaddle/Paddle/blob/1252f4bb3e574df80aa6d18c7ddae1b3a90bd81c/python/paddle/fluid/layers/tensor.py#L564-L668 | ||
sonyxperiadev/WebGL | 0299b38196f78c6d5f74bcf6fa312a3daee6de60 | Tools/Scripts/webkitpy/thirdparty/BeautifulSoup.py | python | Tag.__nonzero__ | (self) | return True | A tag is non-None even if it has no contents. | A tag is non-None even if it has no contents. | [
"A",
"tag",
"is",
"non",
"-",
"None",
"even",
"if",
"it",
"has",
"no",
"contents",
"."
] | def __nonzero__(self):
"A tag is non-None even if it has no contents."
return True | [
"def",
"__nonzero__",
"(",
"self",
")",
":",
"return",
"True"
] | https://github.com/sonyxperiadev/WebGL/blob/0299b38196f78c6d5f74bcf6fa312a3daee6de60/Tools/Scripts/webkitpy/thirdparty/BeautifulSoup.py#L554-L556 | |
mongodb/mongo | d8ff665343ad29cf286ee2cf4a1960d29371937b | src/third_party/abseil-cpp-master/abseil-cpp/absl/abseil.podspec.gen.py | python | get_spec_name | (label) | return "abseil/" + label[7:] | Converts the label of bazel rule to the name of podspec. | Converts the label of bazel rule to the name of podspec. | [
"Converts",
"the",
"label",
"of",
"bazel",
"rule",
"to",
"the",
"name",
"of",
"podspec",
"."
] | def get_spec_name(label):
"""Converts the label of bazel rule to the name of podspec."""
assert label.startswith("//absl/"), "{} doesn't start with //absl/".format(
label)
# e.g. //absl/apple/banana -> abseil/apple/banana
return "abseil/" + label[7:] | [
"def",
"get_spec_name",
"(",
"label",
")",
":",
"assert",
"label",
".",
"startswith",
"(",
"\"//absl/\"",
")",
",",
"\"{} doesn't start with //absl/\"",
".",
"format",
"(",
"label",
")",
"# e.g. //absl/apple/banana -> abseil/apple/banana",
"return",
"\"abseil/\"",
"+",
... | https://github.com/mongodb/mongo/blob/d8ff665343ad29cf286ee2cf4a1960d29371937b/src/third_party/abseil-cpp-master/abseil-cpp/absl/abseil.podspec.gen.py#L127-L132 | |
wxWidgets/wxPython-Classic | 19571e1ae65f1ac445f5491474121998c97a1bf0 | src/osx_cocoa/_windows.py | python | StatusBarPane.PopText | (*args, **kwargs) | return _windows_.StatusBarPane_PopText(*args, **kwargs) | PopText(self) -> bool | PopText(self) -> bool | [
"PopText",
"(",
"self",
")",
"-",
">",
"bool"
] | def PopText(*args, **kwargs):
"""PopText(self) -> bool"""
return _windows_.StatusBarPane_PopText(*args, **kwargs) | [
"def",
"PopText",
"(",
"*",
"args",
",",
"*",
"*",
"kwargs",
")",
":",
"return",
"_windows_",
".",
"StatusBarPane_PopText",
"(",
"*",
"args",
",",
"*",
"*",
"kwargs",
")"
] | https://github.com/wxWidgets/wxPython-Classic/blob/19571e1ae65f1ac445f5491474121998c97a1bf0/src/osx_cocoa/_windows.py#L1217-L1219 | |
wxWidgets/wxPython-Classic | 19571e1ae65f1ac445f5491474121998c97a1bf0 | src/osx_carbon/_core.py | python | ScrollEvent.SetPosition | (*args, **kwargs) | return _core_.ScrollEvent_SetPosition(*args, **kwargs) | SetPosition(self, int pos) | SetPosition(self, int pos) | [
"SetPosition",
"(",
"self",
"int",
"pos",
")"
] | def SetPosition(*args, **kwargs):
"""SetPosition(self, int pos)"""
return _core_.ScrollEvent_SetPosition(*args, **kwargs) | [
"def",
"SetPosition",
"(",
"*",
"args",
",",
"*",
"*",
"kwargs",
")",
":",
"return",
"_core_",
".",
"ScrollEvent_SetPosition",
"(",
"*",
"args",
",",
"*",
"*",
"kwargs",
")"
] | https://github.com/wxWidgets/wxPython-Classic/blob/19571e1ae65f1ac445f5491474121998c97a1bf0/src/osx_carbon/_core.py#L5449-L5451 | |
eclipse/sumo | 7132a9b8b6eea734bdec38479026b4d8c4336d03 | tools/turn-defs/collectinghandler.py | python | CollectingHandler.__init__ | (self, level=0) | Constructor. The level parameter stands for logging level. | Constructor. The level parameter stands for logging level. | [
"Constructor",
".",
"The",
"level",
"parameter",
"stands",
"for",
"logging",
"level",
"."
] | def __init__(self, level=0):
""" Constructor. The level parameter stands for logging level. """
self.log_records = []
logging.Handler.__init__(self, level) | [
"def",
"__init__",
"(",
"self",
",",
"level",
"=",
"0",
")",
":",
"self",
".",
"log_records",
"=",
"[",
"]",
"logging",
".",
"Handler",
".",
"__init__",
"(",
"self",
",",
"level",
")"
] | https://github.com/eclipse/sumo/blob/7132a9b8b6eea734bdec38479026b4d8c4336d03/tools/turn-defs/collectinghandler.py#L27-L31 | ||
wxWidgets/wxPython-Classic | 19571e1ae65f1ac445f5491474121998c97a1bf0 | src/osx_cocoa/propgrid.py | python | PyStringProperty.__init__ | (self, *args, **kwargs) | __init__(self, String label=(*wxPGProperty::sm_wxPG_LABEL), String name=(*wxPGProperty::sm_wxPG_LABEL),
String value=wxEmptyString) -> PyStringProperty | __init__(self, String label=(*wxPGProperty::sm_wxPG_LABEL), String name=(*wxPGProperty::sm_wxPG_LABEL),
String value=wxEmptyString) -> PyStringProperty | [
"__init__",
"(",
"self",
"String",
"label",
"=",
"(",
"*",
"wxPGProperty",
"::",
"sm_wxPG_LABEL",
")",
"String",
"name",
"=",
"(",
"*",
"wxPGProperty",
"::",
"sm_wxPG_LABEL",
")",
"String",
"value",
"=",
"wxEmptyString",
")",
"-",
">",
"PyStringProperty"
] | def __init__(self, *args, **kwargs):
"""
__init__(self, String label=(*wxPGProperty::sm_wxPG_LABEL), String name=(*wxPGProperty::sm_wxPG_LABEL),
String value=wxEmptyString) -> PyStringProperty
"""
_propgrid.PyStringProperty_swiginit(self,_propgrid.new_PyStringProperty(*args... | [
"def",
"__init__",
"(",
"self",
",",
"*",
"args",
",",
"*",
"*",
"kwargs",
")",
":",
"_propgrid",
".",
"PyStringProperty_swiginit",
"(",
"self",
",",
"_propgrid",
".",
"new_PyStringProperty",
"(",
"*",
"args",
",",
"*",
"*",
"kwargs",
")",
")",
"self",
... | https://github.com/wxWidgets/wxPython-Classic/blob/19571e1ae65f1ac445f5491474121998c97a1bf0/src/osx_cocoa/propgrid.py#L4022-L4028 | ||
google/mozc | 7329757e1ad30e327c1ae823a8302c79482d6b9c | src/build_tools/replace_macros.py | python | ParseOptions | () | return parser.parse_args() | Parses command line options.
Returns:
Parsed options and arguments. | Parses command line options. | [
"Parses",
"command",
"line",
"options",
"."
] | def ParseOptions():
"""Parses command line options.
Returns:
Parsed options and arguments.
"""
parser = optparse.OptionParser()
parser.add_option('--input', dest='input')
parser.add_option('--output', dest='output')
parser.add_option('--define', dest='variables', action='append', default=[])
retur... | [
"def",
"ParseOptions",
"(",
")",
":",
"parser",
"=",
"optparse",
".",
"OptionParser",
"(",
")",
"parser",
".",
"add_option",
"(",
"'--input'",
",",
"dest",
"=",
"'input'",
")",
"parser",
".",
"add_option",
"(",
"'--output'",
",",
"dest",
"=",
"'output'",
... | https://github.com/google/mozc/blob/7329757e1ad30e327c1ae823a8302c79482d6b9c/src/build_tools/replace_macros.py#L56-L67 | |
maidsafe-archive/MaidSafe | defd65e1c8cfb6a1cbdeaaa0eee31d065421792d | tools/cpplint.py | python | IsCppString | (line) | return ((line.count('"') - line.count(r'\"') - line.count("'\"'")) & 1) == 1 | Does line terminate so, that the next symbol is in string constant.
This function does not consider single-line nor multi-line comments.
Args:
line: is a partial line of code starting from the 0..n.
Returns:
True, if next character appended to 'line' is inside a
string constant. | Does line terminate so, that the next symbol is in string constant. | [
"Does",
"line",
"terminate",
"so",
"that",
"the",
"next",
"symbol",
"is",
"in",
"string",
"constant",
"."
] | def IsCppString(line):
"""Does line terminate so, that the next symbol is in string constant.
This function does not consider single-line nor multi-line comments.
Args:
line: is a partial line of code starting from the 0..n.
Returns:
True, if next character appended to 'line' is inside a
string c... | [
"def",
"IsCppString",
"(",
"line",
")",
":",
"line",
"=",
"line",
".",
"replace",
"(",
"r'\\\\'",
",",
"'XX'",
")",
"# after this, \\\\\" does not match to \\\"",
"return",
"(",
"(",
"line",
".",
"count",
"(",
"'\"'",
")",
"-",
"line",
".",
"count",
"(",
... | https://github.com/maidsafe-archive/MaidSafe/blob/defd65e1c8cfb6a1cbdeaaa0eee31d065421792d/tools/cpplint.py#L912-L926 | |
neoml-lib/neoml | a0d370fba05269a1b2258cef126f77bbd2054a3e | NeoML/Python/neoml/Dnn/Dropout.py | python | Dropout.batchwise | (self) | return self._internal.get_batchwise() | Checks if the batchwise mode is on. | Checks if the batchwise mode is on. | [
"Checks",
"if",
"the",
"batchwise",
"mode",
"is",
"on",
"."
] | def batchwise(self):
"""Checks if the batchwise mode is on.
"""
return self._internal.get_batchwise() | [
"def",
"batchwise",
"(",
"self",
")",
":",
"return",
"self",
".",
"_internal",
".",
"get_batchwise",
"(",
")"
] | https://github.com/neoml-lib/neoml/blob/a0d370fba05269a1b2258cef126f77bbd2054a3e/NeoML/Python/neoml/Dnn/Dropout.py#L99-L102 | |
liulei01/DRBox | b5c76e033c555c9009590ab384e1f7bd3c66c237 | scripts/cpp_lint.py | python | ProcessFileData | (filename, file_extension, lines, error,
extra_check_functions=[]) | Performs lint checks and reports any errors to the given error function.
Args:
filename: Filename of the file that is being processed.
file_extension: The extension (dot not included) of the file.
lines: An array of strings, each representing a line of the file, with the
last element being emp... | Performs lint checks and reports any errors to the given error function. | [
"Performs",
"lint",
"checks",
"and",
"reports",
"any",
"errors",
"to",
"the",
"given",
"error",
"function",
"."
] | def ProcessFileData(filename, file_extension, lines, error,
extra_check_functions=[]):
"""Performs lint checks and reports any errors to the given error function.
Args:
filename: Filename of the file that is being processed.
file_extension: The extension (dot not included) of the file.
... | [
"def",
"ProcessFileData",
"(",
"filename",
",",
"file_extension",
",",
"lines",
",",
"error",
",",
"extra_check_functions",
"=",
"[",
"]",
")",
":",
"lines",
"=",
"(",
"[",
"'// marker so line numbers and indices both start at 1'",
"]",
"+",
"lines",
"+",
"[",
"... | https://github.com/liulei01/DRBox/blob/b5c76e033c555c9009590ab384e1f7bd3c66c237/scripts/cpp_lint.py#L4648-L4691 | ||
Samsung/veles | 95ed733c2e49bc011ad98ccf2416ecec23fbf352 | veles/external/prettytable.py | python | PrettyTable._get_int_format | (self) | return self._int_format | Controls formatting of integer data
Arguments:
int_format - integer format string | Controls formatting of integer data
Arguments: | [
"Controls",
"formatting",
"of",
"integer",
"data",
"Arguments",
":"
] | def _get_int_format(self):
"""Controls formatting of integer data
Arguments:
int_format - integer format string"""
return self._int_format | [
"def",
"_get_int_format",
"(",
"self",
")",
":",
"return",
"self",
".",
"_int_format"
] | https://github.com/Samsung/veles/blob/95ed733c2e49bc011ad98ccf2416ecec23fbf352/veles/external/prettytable.py#L593-L598 | |
benoitsteiner/tensorflow-opencl | cb7cb40a57fde5cfd4731bc551e82a1e2fef43a5 | tensorflow/python/ops/nn_ops.py | python | bias_add | (value, bias, data_format=None, name=None) | Adds `bias` to `value`.
This is (mostly) a special case of `tf.add` where `bias` is restricted to 1-D.
Broadcasting is supported, so `value` may have any number of dimensions.
Unlike `tf.add`, the type of `bias` is allowed to differ from `value` in the
case where both types are quantized.
Args:
value: A... | Adds `bias` to `value`. | [
"Adds",
"bias",
"to",
"value",
"."
] | def bias_add(value, bias, data_format=None, name=None):
"""Adds `bias` to `value`.
This is (mostly) a special case of `tf.add` where `bias` is restricted to 1-D.
Broadcasting is supported, so `value` may have any number of dimensions.
Unlike `tf.add`, the type of `bias` is allowed to differ from `value` in the... | [
"def",
"bias_add",
"(",
"value",
",",
"bias",
",",
"data_format",
"=",
"None",
",",
"name",
"=",
"None",
")",
":",
"with",
"ops",
".",
"name_scope",
"(",
"name",
",",
"\"BiasAdd\"",
",",
"[",
"value",
",",
"bias",
"]",
")",
"as",
"name",
":",
"valu... | https://github.com/benoitsteiner/tensorflow-opencl/blob/cb7cb40a57fde5cfd4731bc551e82a1e2fef43a5/tensorflow/python/ops/nn_ops.py#L1432-L1455 | ||
wlanjie/AndroidFFmpeg | 7baf9122f4b8e1c74e7baf4be5c422c7a5ba5aaf | tools/fdk-aac-build/x86/toolchain/lib/python2.7/pkgutil.py | python | iter_modules | (path=None, prefix='') | Yields (module_loader, name, ispkg) for all submodules on path,
or, if path is None, all top-level modules on sys.path.
'path' should be either None or a list of paths to look for
modules in.
'prefix' is a string to output on the front of every module name
on output. | Yields (module_loader, name, ispkg) for all submodules on path,
or, if path is None, all top-level modules on sys.path. | [
"Yields",
"(",
"module_loader",
"name",
"ispkg",
")",
"for",
"all",
"submodules",
"on",
"path",
"or",
"if",
"path",
"is",
"None",
"all",
"top",
"-",
"level",
"modules",
"on",
"sys",
".",
"path",
"."
] | def iter_modules(path=None, prefix=''):
"""Yields (module_loader, name, ispkg) for all submodules on path,
or, if path is None, all top-level modules on sys.path.
'path' should be either None or a list of paths to look for
modules in.
'prefix' is a string to output on the front of every module nam... | [
"def",
"iter_modules",
"(",
"path",
"=",
"None",
",",
"prefix",
"=",
"''",
")",
":",
"if",
"path",
"is",
"None",
":",
"importers",
"=",
"iter_importers",
"(",
")",
"else",
":",
"importers",
"=",
"map",
"(",
"get_importer",
",",
"path",
")",
"yielded",
... | https://github.com/wlanjie/AndroidFFmpeg/blob/7baf9122f4b8e1c74e7baf4be5c422c7a5ba5aaf/tools/fdk-aac-build/x86/toolchain/lib/python2.7/pkgutil.py#L129-L150 | ||
panda3d/panda3d | 833ad89ebad58395d0af0b7ec08538e5e4308265 | direct/src/particles/ParticleEffect.py | python | ParticleEffect.isEnabled | (self) | return self.fEnabled | Note: this may be misleading if enable(), disable() not used | Note: this may be misleading if enable(), disable() not used | [
"Note",
":",
"this",
"may",
"be",
"misleading",
"if",
"enable",
"()",
"disable",
"()",
"not",
"used"
] | def isEnabled(self):
"""
Note: this may be misleading if enable(), disable() not used
"""
return self.fEnabled | [
"def",
"isEnabled",
"(",
"self",
")",
":",
"return",
"self",
".",
"fEnabled"
] | https://github.com/panda3d/panda3d/blob/833ad89ebad58395d0af0b7ec08538e5e4308265/direct/src/particles/ParticleEffect.py#L90-L94 | |
wxWidgets/wxPython-Classic | 19571e1ae65f1ac445f5491474121998c97a1bf0 | wx/lib/agw/foldpanelbar.py | python | FoldPanelBar.OnSizePanel | (self, event) | Handles the ``wx.EVT_SIZE`` event for :class:`FoldPanelBar`.
:param `event`: a :class:`SizeEvent` event to be processed. | Handles the ``wx.EVT_SIZE`` event for :class:`FoldPanelBar`. | [
"Handles",
"the",
"wx",
".",
"EVT_SIZE",
"event",
"for",
":",
"class",
":",
"FoldPanelBar",
"."
] | def OnSizePanel(self, event):
"""
Handles the ``wx.EVT_SIZE`` event for :class:`FoldPanelBar`.
:param `event`: a :class:`SizeEvent` event to be processed.
"""
# skip all stuff when we are not initialised yet
if not self._controlCreated:
event.Skip()
... | [
"def",
"OnSizePanel",
"(",
"self",
",",
"event",
")",
":",
"# skip all stuff when we are not initialised yet",
"if",
"not",
"self",
".",
"_controlCreated",
":",
"event",
".",
"Skip",
"(",
")",
"return",
"foldrect",
"=",
"self",
".",
"GetRect",
"(",
")",
"# fol... | https://github.com/wxWidgets/wxPython-Classic/blob/19571e1ae65f1ac445f5491474121998c97a1bf0/wx/lib/agw/foldpanelbar.py#L1398-L1430 | ||
macchina-io/macchina.io | ef24ba0e18379c3dd48fb84e6dbf991101cb8db0 | platform/JS/V8/tools/gyp/pylib/gyp/generator/msvs.py | python | _EscapeCommandLineArgumentForMSBuild | (s) | return s | Escapes a Windows command-line argument for use by MSBuild. | Escapes a Windows command-line argument for use by MSBuild. | [
"Escapes",
"a",
"Windows",
"command",
"-",
"line",
"argument",
"for",
"use",
"by",
"MSBuild",
"."
] | def _EscapeCommandLineArgumentForMSBuild(s):
"""Escapes a Windows command-line argument for use by MSBuild."""
def _Replace(match):
return (len(match.group(1)) / 2 * 4) * '\\' + '\\"'
# Escape all quotes so that they are interpreted literally.
s = quote_replacer_regex2.sub(_Replace, s)
return s | [
"def",
"_EscapeCommandLineArgumentForMSBuild",
"(",
"s",
")",
":",
"def",
"_Replace",
"(",
"match",
")",
":",
"return",
"(",
"len",
"(",
"match",
".",
"group",
"(",
"1",
")",
")",
"/",
"2",
"*",
"4",
")",
"*",
"'\\\\'",
"+",
"'\\\\\"'",
"# Escape all q... | https://github.com/macchina-io/macchina.io/blob/ef24ba0e18379c3dd48fb84e6dbf991101cb8db0/platform/JS/V8/tools/gyp/pylib/gyp/generator/msvs.py#L797-L805 | |
Xilinx/Vitis-AI | fc74d404563d9951b57245443c73bef389f3657f | tools/Vitis-AI-Quantizer/vai_q_tensorflow1.x/tensorflow/python/tpu/tpu.py | python | prune_unconnected_ops_from_xla | (prune_graph) | Prunes unconnected ops as listed in _UNCONNECTED_OPS_TO_PRUNE.
Args:
prune_graph: A tensorflow graph from which we wish to prune unconnected ops
as listed in _UNCONNECTED_OPS_TO_PRUNE. In general, these ops should have
no inputs and no consumers. These can often be left behind due to graph
con... | Prunes unconnected ops as listed in _UNCONNECTED_OPS_TO_PRUNE. | [
"Prunes",
"unconnected",
"ops",
"as",
"listed",
"in",
"_UNCONNECTED_OPS_TO_PRUNE",
"."
] | def prune_unconnected_ops_from_xla(prune_graph):
"""Prunes unconnected ops as listed in _UNCONNECTED_OPS_TO_PRUNE.
Args:
prune_graph: A tensorflow graph from which we wish to prune unconnected ops
as listed in _UNCONNECTED_OPS_TO_PRUNE. In general, these ops should have
no inputs and no consumers.... | [
"def",
"prune_unconnected_ops_from_xla",
"(",
"prune_graph",
")",
":",
"# Scan over the top level graph and all function graphs.",
"for",
"graph",
"in",
"[",
"prune_graph",
"]",
"+",
"[",
"f",
"for",
"f",
"in",
"prune_graph",
".",
"_functions",
".",
"values",
"(",
"... | https://github.com/Xilinx/Vitis-AI/blob/fc74d404563d9951b57245443c73bef389f3657f/tools/Vitis-AI-Quantizer/vai_q_tensorflow1.x/tensorflow/python/tpu/tpu.py#L1682-L1711 | ||
aws/lumberyard | f85344403c1c2e77ec8c75deb2c116e97b713217 | dev/Gems/CloudGemMetric/v1/AWS/common-code/Lib/pandas/io/parsers.py | python | _read | (filepath_or_buffer: FilePathOrBuffer, kwds) | return data | Generic reader of line files. | Generic reader of line files. | [
"Generic",
"reader",
"of",
"line",
"files",
"."
] | def _read(filepath_or_buffer: FilePathOrBuffer, kwds):
"""Generic reader of line files."""
encoding = kwds.get("encoding", None)
if encoding is not None:
encoding = re.sub("_", "-", encoding).lower()
kwds["encoding"] = encoding
compression = kwds.get("compression", "infer")
compress... | [
"def",
"_read",
"(",
"filepath_or_buffer",
":",
"FilePathOrBuffer",
",",
"kwds",
")",
":",
"encoding",
"=",
"kwds",
".",
"get",
"(",
"\"encoding\"",
",",
"None",
")",
"if",
"encoding",
"is",
"not",
"None",
":",
"encoding",
"=",
"re",
".",
"sub",
"(",
"... | https://github.com/aws/lumberyard/blob/f85344403c1c2e77ec8c75deb2c116e97b713217/dev/Gems/CloudGemMetric/v1/AWS/common-code/Lib/pandas/io/parsers.py#L416-L464 | |
facebook/mysql-5.6 | 65a650660ec7b4d627d1b738f397252ff4706207 | arcanist/lint/cpp_linter/cpplint.py | python | ReplaceAll | (pattern, rep, s) | return _regexp_compile_cache[pattern].sub(rep, s) | Replaces instances of pattern in a string with a replacement.
The compiled regex is kept in a cache shared by Match and Search.
Args:
pattern: regex pattern
rep: replacement text
s: search string
Returns:
string with replacements made (or original string if no replacements) | Replaces instances of pattern in a string with a replacement. | [
"Replaces",
"instances",
"of",
"pattern",
"in",
"a",
"string",
"with",
"a",
"replacement",
"."
] | def ReplaceAll(pattern, rep, s):
"""Replaces instances of pattern in a string with a replacement.
The compiled regex is kept in a cache shared by Match and Search.
Args:
pattern: regex pattern
rep: replacement text
s: search string
Returns:
string with replacements made (or original string if... | [
"def",
"ReplaceAll",
"(",
"pattern",
",",
"rep",
",",
"s",
")",
":",
"if",
"pattern",
"not",
"in",
"_regexp_compile_cache",
":",
"_regexp_compile_cache",
"[",
"pattern",
"]",
"=",
"sre_compile",
".",
"compile",
"(",
"pattern",
")",
"return",
"_regexp_compile_c... | https://github.com/facebook/mysql-5.6/blob/65a650660ec7b4d627d1b738f397252ff4706207/arcanist/lint/cpp_linter/cpplint.py#L519-L534 | |
BlzFans/wke | b0fa21158312e40c5fbd84682d643022b6c34a93 | cygwin/lib/python2.6/cgi.py | python | print_form | (form) | Dump the contents of a form as HTML. | Dump the contents of a form as HTML. | [
"Dump",
"the",
"contents",
"of",
"a",
"form",
"as",
"HTML",
"."
] | def print_form(form):
"""Dump the contents of a form as HTML."""
keys = form.keys()
keys.sort()
print
print "<H3>Form Contents:</H3>"
if not keys:
print "<P>No form fields."
print "<DL>"
for key in keys:
print "<DT>" + escape(key) + ":",
value = form[key]
... | [
"def",
"print_form",
"(",
"form",
")",
":",
"keys",
"=",
"form",
".",
"keys",
"(",
")",
"keys",
".",
"sort",
"(",
")",
"print",
"print",
"\"<H3>Form Contents:</H3>\"",
"if",
"not",
"keys",
":",
"print",
"\"<P>No form fields.\"",
"print",
"\"<DL>\"",
"for",
... | https://github.com/BlzFans/wke/blob/b0fa21158312e40c5fbd84682d643022b6c34a93/cygwin/lib/python2.6/cgi.py#L948-L963 | ||
catboost/catboost | 167f64f237114a4d10b2b4ee42adb4569137debe | contrib/python/tornado/tornado-6/tornado/simple_httpclient.py | python | _HTTPConnection._on_timeout | (self, info: Optional[str] = None) | Timeout callback of _HTTPConnection instance.
Raise a `HTTPTimeoutError` when a timeout occurs.
:info string key: More detailed timeout information. | Timeout callback of _HTTPConnection instance. | [
"Timeout",
"callback",
"of",
"_HTTPConnection",
"instance",
"."
] | def _on_timeout(self, info: Optional[str] = None) -> None:
"""Timeout callback of _HTTPConnection instance.
Raise a `HTTPTimeoutError` when a timeout occurs.
:info string key: More detailed timeout information.
"""
self._timeout = None
error_message = "Timeout {0}".form... | [
"def",
"_on_timeout",
"(",
"self",
",",
"info",
":",
"Optional",
"[",
"str",
"]",
"=",
"None",
")",
"->",
"None",
":",
"self",
".",
"_timeout",
"=",
"None",
"error_message",
"=",
"\"Timeout {0}\"",
".",
"format",
"(",
"info",
")",
"if",
"info",
"else",... | https://github.com/catboost/catboost/blob/167f64f237114a4d10b2b4ee42adb4569137debe/contrib/python/tornado/tornado-6/tornado/simple_httpclient.py#L480-L492 | ||
wxWidgets/wxPython-Classic | 19571e1ae65f1ac445f5491474121998c97a1bf0 | wx/tools/Editra/src/extern/aui/framemanager.py | python | AuiManager.OnCaptureLost | (self, event) | Handles the ``wx.EVT_MOUSE_CAPTURE_LOST`` event for :class:`AuiManager`.
:param `event`: a :class:`MouseCaptureLostEvent` to be processed. | Handles the ``wx.EVT_MOUSE_CAPTURE_LOST`` event for :class:`AuiManager`. | [
"Handles",
"the",
"wx",
".",
"EVT_MOUSE_CAPTURE_LOST",
"event",
"for",
":",
"class",
":",
"AuiManager",
"."
] | def OnCaptureLost(self, event):
"""
Handles the ``wx.EVT_MOUSE_CAPTURE_LOST`` event for :class:`AuiManager`.
:param `event`: a :class:`MouseCaptureLostEvent` to be processed.
"""
# cancel the operation in progress, if any
if self._action != actionNone:
self.... | [
"def",
"OnCaptureLost",
"(",
"self",
",",
"event",
")",
":",
"# cancel the operation in progress, if any",
"if",
"self",
".",
"_action",
"!=",
"actionNone",
":",
"self",
".",
"_action",
"=",
"actionNone",
"self",
".",
"HideHint",
"(",
")"
] | https://github.com/wxWidgets/wxPython-Classic/blob/19571e1ae65f1ac445f5491474121998c97a1bf0/wx/tools/Editra/src/extern/aui/framemanager.py#L9237-L9247 | ||
apple/turicreate | cce55aa5311300e3ce6af93cb45ba791fd1bdf49 | deps/src/libxml2-2.9.1/python/libxml2.py | python | uCSIsUnifiedCanadianAboriginalSyllabics | (code) | return ret | Check whether the character is part of
UnifiedCanadianAboriginalSyllabics UCS Block | Check whether the character is part of
UnifiedCanadianAboriginalSyllabics UCS Block | [
"Check",
"whether",
"the",
"character",
"is",
"part",
"of",
"UnifiedCanadianAboriginalSyllabics",
"UCS",
"Block"
] | def uCSIsUnifiedCanadianAboriginalSyllabics(code):
"""Check whether the character is part of
UnifiedCanadianAboriginalSyllabics UCS Block """
ret = libxml2mod.xmlUCSIsUnifiedCanadianAboriginalSyllabics(code)
return ret | [
"def",
"uCSIsUnifiedCanadianAboriginalSyllabics",
"(",
"code",
")",
":",
"ret",
"=",
"libxml2mod",
".",
"xmlUCSIsUnifiedCanadianAboriginalSyllabics",
"(",
"code",
")",
"return",
"ret"
] | https://github.com/apple/turicreate/blob/cce55aa5311300e3ce6af93cb45ba791fd1bdf49/deps/src/libxml2-2.9.1/python/libxml2.py#L2961-L2965 | |
mapsme/omim | 1892903b63f2c85b16ed4966d21fe76aba06b9ba | tools/python/mwm_downloader.py | python | progress_bar | (total, progress) | Displays or updates a console progress bar.
Original source: https://stackoverflow.com/a/15860757/1391441 | Displays or updates a console progress bar. | [
"Displays",
"or",
"updates",
"a",
"console",
"progress",
"bar",
"."
] | def progress_bar(total, progress):
"""
Displays or updates a console progress bar.
Original source: https://stackoverflow.com/a/15860757/1391441
"""
initial_progress = progress
bar_length = 20
progress = progress / total
block = int(round(bar_length * progress))
progress_bar_str = '... | [
"def",
"progress_bar",
"(",
"total",
",",
"progress",
")",
":",
"initial_progress",
"=",
"progress",
"bar_length",
"=",
"20",
"progress",
"=",
"progress",
"/",
"total",
"block",
"=",
"int",
"(",
"round",
"(",
"bar_length",
"*",
"progress",
")",
")",
"progr... | https://github.com/mapsme/omim/blob/1892903b63f2c85b16ed4966d21fe76aba06b9ba/tools/python/mwm_downloader.py#L95-L114 | ||
catboost/catboost | 167f64f237114a4d10b2b4ee42adb4569137debe | contrib/python/protobuf/py2/google/protobuf/descriptor_pool.py | python | DescriptorPool.AddSerializedFile | (self, serialized_file_desc_proto) | Adds the FileDescriptorProto and its types to this pool.
Args:
serialized_file_desc_proto (bytes): A bytes string, serialization of the
:class:`FileDescriptorProto` to add. | Adds the FileDescriptorProto and its types to this pool. | [
"Adds",
"the",
"FileDescriptorProto",
"and",
"its",
"types",
"to",
"this",
"pool",
"."
] | def AddSerializedFile(self, serialized_file_desc_proto):
"""Adds the FileDescriptorProto and its types to this pool.
Args:
serialized_file_desc_proto (bytes): A bytes string, serialization of the
:class:`FileDescriptorProto` to add.
"""
# pylint: disable=g-import-not-at-top
from goog... | [
"def",
"AddSerializedFile",
"(",
"self",
",",
"serialized_file_desc_proto",
")",
":",
"# pylint: disable=g-import-not-at-top",
"from",
"google",
".",
"protobuf",
"import",
"descriptor_pb2",
"file_desc_proto",
"=",
"descriptor_pb2",
".",
"FileDescriptorProto",
".",
"FromStri... | https://github.com/catboost/catboost/blob/167f64f237114a4d10b2b4ee42adb4569137debe/contrib/python/protobuf/py2/google/protobuf/descriptor_pool.py#L204-L216 | ||
mixxxdj/mixxx | b519aba1d967a39c63b5f5c56cf5c3a95addec28 | tools/deploy.py | python | url_fetch | (url, headers=None, **kwargs) | return urllib.request.urlopen(req, timeout=10) | Make a web request to the given URL and return the response object. | Make a web request to the given URL and return the response object. | [
"Make",
"a",
"web",
"request",
"to",
"the",
"given",
"URL",
"and",
"return",
"the",
"response",
"object",
"."
] | def url_fetch(url, headers=None, **kwargs):
"""Make a web request to the given URL and return the response object."""
request_headers = {
# Override the User-Agent because our download server seems to block
# requests with the default UA value and responds "403 Forbidden".
"User-Agent": ... | [
"def",
"url_fetch",
"(",
"url",
",",
"headers",
"=",
"None",
",",
"*",
"*",
"kwargs",
")",
":",
"request_headers",
"=",
"{",
"# Override the User-Agent because our download server seems to block",
"# requests with the default UA value and responds \"403 Forbidden\".",
"\"User-A... | https://github.com/mixxxdj/mixxx/blob/b519aba1d967a39c63b5f5c56cf5c3a95addec28/tools/deploy.py#L16-L29 | |
BlzFans/wke | b0fa21158312e40c5fbd84682d643022b6c34a93 | cygwin/lib/python2.6/codecs.py | python | StreamWriter.reset | (self) | Flushes and resets the codec buffers used for keeping state.
Calling this method should ensure that the data on the
output is put into a clean state, that allows appending
of new fresh data without having to rescan the whole
stream to recover state. | Flushes and resets the codec buffers used for keeping state. | [
"Flushes",
"and",
"resets",
"the",
"codec",
"buffers",
"used",
"for",
"keeping",
"state",
"."
] | def reset(self):
""" Flushes and resets the codec buffers used for keeping state.
Calling this method should ensure that the data on the
output is put into a clean state, that allows appending
of new fresh data without having to rescan the whole
stream to recove... | [
"def",
"reset",
"(",
"self",
")",
":",
"pass"
] | https://github.com/BlzFans/wke/blob/b0fa21158312e40c5fbd84682d643022b6c34a93/cygwin/lib/python2.6/codecs.py#L361-L371 | ||
generalized-intelligence/GAAS | 29ab17d3e8a4ba18edef3a57c36d8db6329fac73 | algorithms/src/SystemManagement/json_request_response_lib/src/third_party/nlohmann_json/third_party/cpplint/cpplint.py | python | _CppLintState.AddFilters | (self, filters) | Adds more filters to the existing list of error-message filters. | Adds more filters to the existing list of error-message filters. | [
"Adds",
"more",
"filters",
"to",
"the",
"existing",
"list",
"of",
"error",
"-",
"message",
"filters",
"."
] | def AddFilters(self, filters):
""" Adds more filters to the existing list of error-message filters. """
for filt in filters.split(','):
clean_filt = filt.strip()
if clean_filt:
self.filters.append(clean_filt)
for filt in self.filters:
if not (filt.startswith('+') or filt.startswith... | [
"def",
"AddFilters",
"(",
"self",
",",
"filters",
")",
":",
"for",
"filt",
"in",
"filters",
".",
"split",
"(",
"','",
")",
":",
"clean_filt",
"=",
"filt",
".",
"strip",
"(",
")",
"if",
"clean_filt",
":",
"self",
".",
"filters",
".",
"append",
"(",
... | https://github.com/generalized-intelligence/GAAS/blob/29ab17d3e8a4ba18edef3a57c36d8db6329fac73/algorithms/src/SystemManagement/json_request_response_lib/src/third_party/nlohmann_json/third_party/cpplint/cpplint.py#L1059-L1068 | ||
FreeCAD/FreeCAD | ba42231b9c6889b89e064d6d563448ed81e376ec | src/Mod/Draft/draftguitools/gui_togglemodes.py | python | ToggleContinueMode.Activated | (self) | Execute when the command is called.
It calls the `toggleContinue()` method of the `DraftToolbar` class. | Execute when the command is called. | [
"Execute",
"when",
"the",
"command",
"is",
"called",
"."
] | def Activated(self):
"""Execute when the command is called.
It calls the `toggleContinue()` method of the `DraftToolbar` class.
"""
super(ToggleContinueMode, self).Activated(mode="continue") | [
"def",
"Activated",
"(",
"self",
")",
":",
"super",
"(",
"ToggleContinueMode",
",",
"self",
")",
".",
"Activated",
"(",
"mode",
"=",
"\"continue\"",
")"
] | https://github.com/FreeCAD/FreeCAD/blob/ba42231b9c6889b89e064d6d563448ed81e376ec/src/Mod/Draft/draftguitools/gui_togglemodes.py#L135-L140 | ||
wxWidgets/wxPython-Classic | 19571e1ae65f1ac445f5491474121998c97a1bf0 | src/msw/_controls.py | python | CheckListBox.GetChecked | (self) | return tuple([i for i in range(self.Count) if self.IsChecked(i)]) | GetChecked(self)
Return a tuple of integers corresponding to the checked items in
the control, based on `IsChecked`. | GetChecked(self) | [
"GetChecked",
"(",
"self",
")"
] | def GetChecked(self):
"""
GetChecked(self)
Return a tuple of integers corresponding to the checked items in
the control, based on `IsChecked`.
"""
return tuple([i for i in range(self.Count) if self.IsChecked(i)]) | [
"def",
"GetChecked",
"(",
"self",
")",
":",
"return",
"tuple",
"(",
"[",
"i",
"for",
"i",
"in",
"range",
"(",
"self",
".",
"Count",
")",
"if",
"self",
".",
"IsChecked",
"(",
"i",
")",
"]",
")"
] | https://github.com/wxWidgets/wxPython-Classic/blob/19571e1ae65f1ac445f5491474121998c97a1bf0/src/msw/_controls.py#L1334-L1341 | |
NVIDIA/DALI | bf16cc86ba8f091b145f91962f21fe1b6aff243d | qa/setup_packages.py | python | for_all_pckg | (packages, fun, add_additional_packages=True) | return ret + additional | Iterates over all packages, executes a function. Returns all function results as a list | Iterates over all packages, executes a function. Returns all function results as a list | [
"Iterates",
"over",
"all",
"packages",
"executes",
"a",
"function",
".",
"Returns",
"all",
"function",
"results",
"as",
"a",
"list"
] | def for_all_pckg(packages, fun, add_additional_packages=True):
"""Iterates over all packages, executes a function. Returns all function results as a list"""
ret = []
for pckg in all_packages:
if pckg.key in packages:
ret.append(fun(pckg))
additional = []
if add_additional_package... | [
"def",
"for_all_pckg",
"(",
"packages",
",",
"fun",
",",
"add_additional_packages",
"=",
"True",
")",
":",
"ret",
"=",
"[",
"]",
"for",
"pckg",
"in",
"all_packages",
":",
"if",
"pckg",
".",
"key",
"in",
"packages",
":",
"ret",
".",
"append",
"(",
"fun"... | https://github.com/NVIDIA/DALI/blob/bf16cc86ba8f091b145f91962f21fe1b6aff243d/qa/setup_packages.py#L487-L497 | |
twtygqyy/caffe-augmentation | c76600d247e5132fa5bd89d87bb5df458341fa84 | scripts/cpp_lint.py | python | CheckMakePairUsesDeduction | (filename, clean_lines, linenum, error) | Check that make_pair's template arguments are deduced.
G++ 4.6 in C++0x mode fails badly if make_pair's template arguments are
specified explicitly, and such use isn't intended in any case.
Args:
filename: The name of the current file.
clean_lines: A CleansedLines instance containing the file.
linen... | Check that make_pair's template arguments are deduced. | [
"Check",
"that",
"make_pair",
"s",
"template",
"arguments",
"are",
"deduced",
"."
] | def CheckMakePairUsesDeduction(filename, clean_lines, linenum, error):
"""Check that make_pair's template arguments are deduced.
G++ 4.6 in C++0x mode fails badly if make_pair's template arguments are
specified explicitly, and such use isn't intended in any case.
Args:
filename: The name of the current fi... | [
"def",
"CheckMakePairUsesDeduction",
"(",
"filename",
",",
"clean_lines",
",",
"linenum",
",",
"error",
")",
":",
"line",
"=",
"clean_lines",
".",
"elided",
"[",
"linenum",
"]",
"match",
"=",
"_RE_PATTERN_EXPLICIT_MAKEPAIR",
".",
"search",
"(",
"line",
")",
"i... | https://github.com/twtygqyy/caffe-augmentation/blob/c76600d247e5132fa5bd89d87bb5df458341fa84/scripts/cpp_lint.py#L4583-L4601 | ||
wxWidgets/wxPython-Classic | 19571e1ae65f1ac445f5491474121998c97a1bf0 | src/osx_carbon/_core.py | python | GBSizerItemList.index | (*args, **kwargs) | return _core_.GBSizerItemList_index(*args, **kwargs) | index(self, GBSizerItem obj) -> int | index(self, GBSizerItem obj) -> int | [
"index",
"(",
"self",
"GBSizerItem",
"obj",
")",
"-",
">",
"int"
] | def index(*args, **kwargs):
"""index(self, GBSizerItem obj) -> int"""
return _core_.GBSizerItemList_index(*args, **kwargs) | [
"def",
"index",
"(",
"*",
"args",
",",
"*",
"*",
"kwargs",
")",
":",
"return",
"_core_",
".",
"GBSizerItemList_index",
"(",
"*",
"args",
",",
"*",
"*",
"kwargs",
")"
] | https://github.com/wxWidgets/wxPython-Classic/blob/19571e1ae65f1ac445f5491474121998c97a1bf0/src/osx_carbon/_core.py#L15895-L15897 | |
kamyu104/LeetCode-Solutions | 77605708a927ea3b85aee5a479db733938c7c211 | Python/longest-increasing-path-in-a-matrix.py | python | Solution2.longestIncreasingPath | (self, matrix) | return result | :type matrix: List[List[int]]
:rtype: int | :type matrix: List[List[int]]
:rtype: int | [
":",
"type",
"matrix",
":",
"List",
"[",
"List",
"[",
"int",
"]]",
":",
"rtype",
":",
"int"
] | def longestIncreasingPath(self, matrix):
"""
:type matrix: List[List[int]]
:rtype: int
"""
directions = [(0, -1), (0, 1), (-1, 0), (1, 0)]
def longestpath(matrix, i, j, max_lengths):
if max_lengths[i][j]:
return max_lengths[i][j]
m... | [
"def",
"longestIncreasingPath",
"(",
"self",
",",
"matrix",
")",
":",
"directions",
"=",
"[",
"(",
"0",
",",
"-",
"1",
")",
",",
"(",
"0",
",",
"1",
")",
",",
"(",
"-",
"1",
",",
"0",
")",
",",
"(",
"1",
",",
"0",
")",
"]",
"def",
"longestp... | https://github.com/kamyu104/LeetCode-Solutions/blob/77605708a927ea3b85aee5a479db733938c7c211/Python/longest-increasing-path-in-a-matrix.py#L53-L79 | |
LLNL/lbann | 26083e6c86050302ce33148aea70f62e61cacb92 | applications/graph/communityGAN/main.py | python | setup_walks | (script, config) | Add random walker to batch script. | Add random walker to batch script. | [
"Add",
"random",
"walker",
"to",
"batch",
"script",
"."
] | def setup_walks(script, config):
"""Add random walker to batch script."""
# Get parameters
graph_file = config.get('Graph', 'file')
walks_file = config.get('Walks', 'file')
walk_length = config.getint('Walks', 'walk_length')
num_walkers = config.getint('Walks', 'num_walkers')
p = config.get... | [
"def",
"setup_walks",
"(",
"script",
",",
"config",
")",
":",
"# Get parameters",
"graph_file",
"=",
"config",
".",
"get",
"(",
"'Graph'",
",",
"'file'",
")",
"walks_file",
"=",
"config",
".",
"get",
"(",
"'Walks'",
",",
"'file'",
")",
"walk_length",
"=",
... | https://github.com/LLNL/lbann/blob/26083e6c86050302ce33148aea70f62e61cacb92/applications/graph/communityGAN/main.py#L175-L221 | ||
aws/lumberyard | f85344403c1c2e77ec8c75deb2c116e97b713217 | dev/Gems/CloudGemMetric/v1/AWS/common-code/Lib/numba/roc/hsadrv/driver.py | python | device_ctypes_pointer | (obj) | return obj.device_ctypes_pointer | Get the ctypes object for the device pointer | Get the ctypes object for the device pointer | [
"Get",
"the",
"ctypes",
"object",
"for",
"the",
"device",
"pointer"
] | def device_ctypes_pointer(obj):
"Get the ctypes object for the device pointer"
if obj is None:
return c_void_p(0)
require_device_memory(obj)
return obj.device_ctypes_pointer | [
"def",
"device_ctypes_pointer",
"(",
"obj",
")",
":",
"if",
"obj",
"is",
"None",
":",
"return",
"c_void_p",
"(",
"0",
")",
"require_device_memory",
"(",
"obj",
")",
"return",
"obj",
".",
"device_ctypes_pointer"
] | https://github.com/aws/lumberyard/blob/f85344403c1c2e77ec8c75deb2c116e97b713217/dev/Gems/CloudGemMetric/v1/AWS/common-code/Lib/numba/roc/hsadrv/driver.py#L1429-L1434 | |
nucleic/atom | 9f0cb2a8101dd63c354a98ebc7489b2c616dc82a | atom/enum.py | python | Enum.added | (self, *items) | return clone | Create a clone of the Enum with added items.
Parameters
----------
*items
Additional items to include in the Enum.
Returns
-------
result : Enum
A new enum object which contains all of the original items
plus the new items. | Create a clone of the Enum with added items. | [
"Create",
"a",
"clone",
"of",
"the",
"Enum",
"with",
"added",
"items",
"."
] | def added(self, *items):
"""Create a clone of the Enum with added items.
Parameters
----------
*items
Additional items to include in the Enum.
Returns
-------
result : Enum
A new enum object which contains all of the original items
... | [
"def",
"added",
"(",
"self",
",",
"*",
"items",
")",
":",
"olditems",
"=",
"self",
".",
"items",
"newitems",
"=",
"olditems",
"+",
"items",
"clone",
"=",
"self",
".",
"clone",
"(",
")",
"clone",
".",
"set_validate_mode",
"(",
"Validate",
".",
"Enum",
... | https://github.com/nucleic/atom/blob/9f0cb2a8101dd63c354a98ebc7489b2c616dc82a/atom/enum.py#L35-L54 | |
ceph/ceph | 959663007321a369c83218414a29bd9dbc8bda3a | qa/tasks/ceph_manager.py | python | CephManager.list_pg_unfound | (self, pgid) | return r | return list of unfound pgs with the id specified | return list of unfound pgs with the id specified | [
"return",
"list",
"of",
"unfound",
"pgs",
"with",
"the",
"id",
"specified"
] | def list_pg_unfound(self, pgid):
"""
return list of unfound pgs with the id specified
"""
r = None
offset = {}
while True:
out = self.raw_cluster_cmd('--', 'pg', pgid, 'list_unfound',
json.dumps(offset))
j = j... | [
"def",
"list_pg_unfound",
"(",
"self",
",",
"pgid",
")",
":",
"r",
"=",
"None",
"offset",
"=",
"{",
"}",
"while",
"True",
":",
"out",
"=",
"self",
".",
"raw_cluster_cmd",
"(",
"'--'",
",",
"'pg'",
",",
"pgid",
",",
"'list_unfound'",
",",
"json",
".",... | https://github.com/ceph/ceph/blob/959663007321a369c83218414a29bd9dbc8bda3a/qa/tasks/ceph_manager.py#L2306-L2327 | |
aws/lumberyard | f85344403c1c2e77ec8c75deb2c116e97b713217 | dev/Tools/Python/3.7.10/windows/Lib/tkinter/__init__.py | python | Place.place_info | (self) | return d | Return information about the placing options
for this widget. | Return information about the placing options
for this widget. | [
"Return",
"information",
"about",
"the",
"placing",
"options",
"for",
"this",
"widget",
"."
] | def place_info(self):
"""Return information about the placing options
for this widget."""
d = _splitdict(self.tk, self.tk.call('place', 'info', self._w))
if 'in' in d:
d['in'] = self.nametowidget(d['in'])
return d | [
"def",
"place_info",
"(",
"self",
")",
":",
"d",
"=",
"_splitdict",
"(",
"self",
".",
"tk",
",",
"self",
".",
"tk",
".",
"call",
"(",
"'place'",
",",
"'info'",
",",
"self",
".",
"_w",
")",
")",
"if",
"'in'",
"in",
"d",
":",
"d",
"[",
"'in'",
... | https://github.com/aws/lumberyard/blob/f85344403c1c2e77ec8c75deb2c116e97b713217/dev/Tools/Python/3.7.10/windows/Lib/tkinter/__init__.py#L2194-L2200 | |
wxWidgets/wxPython-Classic | 19571e1ae65f1ac445f5491474121998c97a1bf0 | src/osx_cocoa/stc.py | python | StyledTextCtrl.StyleGetSize | (*args, **kwargs) | return _stc.StyledTextCtrl_StyleGetSize(*args, **kwargs) | StyleGetSize(self, int style) -> int
Get the size of characters of a style. | StyleGetSize(self, int style) -> int | [
"StyleGetSize",
"(",
"self",
"int",
"style",
")",
"-",
">",
"int"
] | def StyleGetSize(*args, **kwargs):
"""
StyleGetSize(self, int style) -> int
Get the size of characters of a style.
"""
return _stc.StyledTextCtrl_StyleGetSize(*args, **kwargs) | [
"def",
"StyleGetSize",
"(",
"*",
"args",
",",
"*",
"*",
"kwargs",
")",
":",
"return",
"_stc",
".",
"StyledTextCtrl_StyleGetSize",
"(",
"*",
"args",
",",
"*",
"*",
"kwargs",
")"
] | https://github.com/wxWidgets/wxPython-Classic/blob/19571e1ae65f1ac445f5491474121998c97a1bf0/src/osx_cocoa/stc.py#L2618-L2624 | |
albertz/openlierox | d316c14a8eb57848ef56e9bfa7b23a56f694a51b | tools/DedicatedServerVideo/gdata/gauth.py | python | SecureAuthSubToken.modify_request | (self, http_request) | Sets the Authorization header and includes a digital signature.
Calculates a digital signature using the private RSA key, a timestamp
(uses now at the time this method is called) and a random nonce.
Args:
http_request: The atom.http_core.HttpRequest which contains all of the
information ne... | Sets the Authorization header and includes a digital signature. | [
"Sets",
"the",
"Authorization",
"header",
"and",
"includes",
"a",
"digital",
"signature",
"."
] | def modify_request(self, http_request):
"""Sets the Authorization header and includes a digital signature.
Calculates a digital signature using the private RSA key, a timestamp
(uses now at the time this method is called) and a random nonce.
Args:
http_request: The atom.http_core.HttpRequest whi... | [
"def",
"modify_request",
"(",
"self",
",",
"http_request",
")",
":",
"timestamp",
"=",
"str",
"(",
"int",
"(",
"time",
".",
"time",
"(",
")",
")",
")",
"nonce",
"=",
"''",
".",
"join",
"(",
"[",
"str",
"(",
"random",
".",
"randint",
"(",
"0",
","... | https://github.com/albertz/openlierox/blob/d316c14a8eb57848ef56e9bfa7b23a56f694a51b/tools/DedicatedServerVideo/gdata/gauth.py#L421-L440 | ||
vnpy/vnpy | f50f2535ed39dd33272e0985ed40c7078e4c19f6 | vnpy/trader/ui/widget.py | python | ActiveOrderMonitor.process_event | (self, event) | Hides the row if order is not active. | Hides the row if order is not active. | [
"Hides",
"the",
"row",
"if",
"order",
"is",
"not",
"active",
"."
] | def process_event(self, event) -> None:
"""
Hides the row if order is not active.
"""
super(ActiveOrderMonitor, self).process_event(event)
order = event.data
row_cells = self.cells[order.vt_orderid]
row = self.row(row_cells["volume"])
if order.is_active(... | [
"def",
"process_event",
"(",
"self",
",",
"event",
")",
"->",
"None",
":",
"super",
"(",
"ActiveOrderMonitor",
",",
"self",
")",
".",
"process_event",
"(",
"event",
")",
"order",
"=",
"event",
".",
"data",
"row_cells",
"=",
"self",
".",
"cells",
"[",
"... | https://github.com/vnpy/vnpy/blob/f50f2535ed39dd33272e0985ed40c7078e4c19f6/vnpy/trader/ui/widget.py#L1016-L1029 | ||
wxWidgets/wxPython-Classic | 19571e1ae65f1ac445f5491474121998c97a1bf0 | src/msw/dataview.py | python | DataViewIndexListModel.RowPrepended | (*args, **kwargs) | return _dataview.DataViewIndexListModel_RowPrepended(*args, **kwargs) | RowPrepended(self)
Call this after a row has been prepended to the model. | RowPrepended(self) | [
"RowPrepended",
"(",
"self",
")"
] | def RowPrepended(*args, **kwargs):
"""
RowPrepended(self)
Call this after a row has been prepended to the model.
"""
return _dataview.DataViewIndexListModel_RowPrepended(*args, **kwargs) | [
"def",
"RowPrepended",
"(",
"*",
"args",
",",
"*",
"*",
"kwargs",
")",
":",
"return",
"_dataview",
".",
"DataViewIndexListModel_RowPrepended",
"(",
"*",
"args",
",",
"*",
"*",
"kwargs",
")"
] | https://github.com/wxWidgets/wxPython-Classic/blob/19571e1ae65f1ac445f5491474121998c97a1bf0/src/msw/dataview.py#L829-L835 | |
benoitsteiner/tensorflow-opencl | cb7cb40a57fde5cfd4731bc551e82a1e2fef43a5 | tensorflow/python/ops/data_flow_ops.py | python | BaseStagingArea._create_device_transfers | (self, tensors) | return tensors | Encode inter-device transfers if the current device
is not the same as the Staging Area's device | Encode inter-device transfers if the current device
is not the same as the Staging Area's device | [
"Encode",
"inter",
"-",
"device",
"transfers",
"if",
"the",
"current",
"device",
"is",
"not",
"the",
"same",
"as",
"the",
"Staging",
"Area",
"s",
"device"
] | def _create_device_transfers(self, tensors):
"""Encode inter-device transfers if the current device
is not the same as the Staging Area's device
"""
if not isinstance(tensors, (tuple, list)):
tensors = [tensors]
curr_device_scope = control_flow_ops.no_op().device
if curr_device_scope !=... | [
"def",
"_create_device_transfers",
"(",
"self",
",",
"tensors",
")",
":",
"if",
"not",
"isinstance",
"(",
"tensors",
",",
"(",
"tuple",
",",
"list",
")",
")",
":",
"tensors",
"=",
"[",
"tensors",
"]",
"curr_device_scope",
"=",
"control_flow_ops",
".",
"no_... | https://github.com/benoitsteiner/tensorflow-opencl/blob/cb7cb40a57fde5cfd4731bc551e82a1e2fef43a5/tensorflow/python/ops/data_flow_ops.py#L1541-L1554 | |
LiquidPlayer/LiquidCore | 9405979363f2353ac9a71ad8ab59685dd7f919c9 | deps/node-10.15.3/deps/npm/node_modules/node-gyp/gyp/pylib/gyp/xcodeproj_file.py | python | XCConfigurationList.ConfigurationNamed | (self, name) | Convenience accessor to obtain an XCBuildConfiguration by name. | Convenience accessor to obtain an XCBuildConfiguration by name. | [
"Convenience",
"accessor",
"to",
"obtain",
"an",
"XCBuildConfiguration",
"by",
"name",
"."
] | def ConfigurationNamed(self, name):
"""Convenience accessor to obtain an XCBuildConfiguration by name."""
for configuration in self._properties['buildConfigurations']:
if configuration._properties['name'] == name:
return configuration
raise KeyError(name) | [
"def",
"ConfigurationNamed",
"(",
"self",
",",
"name",
")",
":",
"for",
"configuration",
"in",
"self",
".",
"_properties",
"[",
"'buildConfigurations'",
"]",
":",
"if",
"configuration",
".",
"_properties",
"[",
"'name'",
"]",
"==",
"name",
":",
"return",
"co... | https://github.com/LiquidPlayer/LiquidCore/blob/9405979363f2353ac9a71ad8ab59685dd7f919c9/deps/node-10.15.3/deps/npm/node_modules/node-gyp/gyp/pylib/gyp/xcodeproj_file.py#L1605-L1611 | ||
PX4/PX4-Autopilot | 0b9f60a0370be53d683352c63fd92db3d6586e18 | Tools/ecl_ekf/plotting/data_plots.py | python | DataPlot._create_figure | (self) | creates the figure handle.
:return: | creates the figure handle.
:return: | [
"creates",
"the",
"figure",
"handle",
".",
":",
"return",
":"
] | def _create_figure(self) -> None:
"""
creates the figure handle.
:return:
"""
self._fig, self._ax = plt.subplots(frameon=True, figsize=self._fig_size)
self._fig.suptitle(self._plot_title) | [
"def",
"_create_figure",
"(",
"self",
")",
"->",
"None",
":",
"self",
".",
"_fig",
",",
"self",
".",
"_ax",
"=",
"plt",
".",
"subplots",
"(",
"frameon",
"=",
"True",
",",
"figsize",
"=",
"self",
".",
"_fig_size",
")",
"self",
".",
"_fig",
".",
"sup... | https://github.com/PX4/PX4-Autopilot/blob/0b9f60a0370be53d683352c63fd92db3d6586e18/Tools/ecl_ekf/plotting/data_plots.py#L102-L108 | ||
LiquidPlayer/LiquidCore | 9405979363f2353ac9a71ad8ab59685dd7f919c9 | deps/node-10.15.3/tools/gyp/pylib/gyp/xcode_emulation.py | python | XcodeSettings.GetFullProductName | (self) | Returns FULL_PRODUCT_NAME. | Returns FULL_PRODUCT_NAME. | [
"Returns",
"FULL_PRODUCT_NAME",
"."
] | def GetFullProductName(self):
"""Returns FULL_PRODUCT_NAME."""
if self._IsBundle():
return self.GetWrapperName()
else:
return self._GetStandaloneBinaryPath() | [
"def",
"GetFullProductName",
"(",
"self",
")",
":",
"if",
"self",
".",
"_IsBundle",
"(",
")",
":",
"return",
"self",
".",
"GetWrapperName",
"(",
")",
"else",
":",
"return",
"self",
".",
"_GetStandaloneBinaryPath",
"(",
")"
] | https://github.com/LiquidPlayer/LiquidCore/blob/9405979363f2353ac9a71ad8ab59685dd7f919c9/deps/node-10.15.3/tools/gyp/pylib/gyp/xcode_emulation.py#L281-L286 | ||
intel/caffe | 3f494b442ee3f9d17a07b09ecbd5fa2bbda00836 | scripts/cpp_lint.py | python | CheckLanguage | (filename, clean_lines, linenum, file_extension,
include_state, nesting_state, error) | Checks rules from the 'C++ language rules' section of cppguide.html.
Some of these rules are hard to test (function overloading, using
uint32 inappropriately), but we do the best we can.
Args:
filename: The name of the current file.
clean_lines: A CleansedLines instance containing the file.
linenum:... | Checks rules from the 'C++ language rules' section of cppguide.html. | [
"Checks",
"rules",
"from",
"the",
"C",
"++",
"language",
"rules",
"section",
"of",
"cppguide",
".",
"html",
"."
] | def CheckLanguage(filename, clean_lines, linenum, file_extension,
include_state, nesting_state, error):
"""Checks rules from the 'C++ language rules' section of cppguide.html.
Some of these rules are hard to test (function overloading, using
uint32 inappropriately), but we do the best we can.
... | [
"def",
"CheckLanguage",
"(",
"filename",
",",
"clean_lines",
",",
"linenum",
",",
"file_extension",
",",
"include_state",
",",
"nesting_state",
",",
"error",
")",
":",
"# If the line is empty or consists of entirely a comment, no need to",
"# check it.",
"line",
"=",
"cle... | https://github.com/intel/caffe/blob/3f494b442ee3f9d17a07b09ecbd5fa2bbda00836/scripts/cpp_lint.py#L3838-L4136 | ||
miyosuda/TensorFlowAndroidDemo | 35903e0221aa5f109ea2dbef27f20b52e317f42d | jni-build/jni/include/tensorflow/contrib/learn/python/learn/estimators/dnn_linear_combined.py | python | _DNNLinearCombinedBaseEstimator.__init__ | (self,
target_column,
model_dir=None,
linear_feature_columns=None,
linear_optimizer=None,
dnn_feature_columns=None,
dnn_optimizer=None,
dnn_hidden_units=None,
dnn_activation_fn=nn.relu,
... | Initializes a _DNNLinearCombinedBaseEstimator instance.
Args:
target_column: A _TargetColumn object.
model_dir: Directory to save model parameters, graph and etc. This can
also be used to load checkpoints from the directory into a estimator
to continue training a previously saved model.... | Initializes a _DNNLinearCombinedBaseEstimator instance. | [
"Initializes",
"a",
"_DNNLinearCombinedBaseEstimator",
"instance",
"."
] | def __init__(self,
target_column,
model_dir=None,
linear_feature_columns=None,
linear_optimizer=None,
dnn_feature_columns=None,
dnn_optimizer=None,
dnn_hidden_units=None,
dnn_activation_fn=nn.relu,
... | [
"def",
"__init__",
"(",
"self",
",",
"target_column",
",",
"model_dir",
"=",
"None",
",",
"linear_feature_columns",
"=",
"None",
",",
"linear_optimizer",
"=",
"None",
",",
"dnn_feature_columns",
"=",
"None",
",",
"dnn_optimizer",
"=",
"None",
",",
"dnn_hidden_un... | https://github.com/miyosuda/TensorFlowAndroidDemo/blob/35903e0221aa5f109ea2dbef27f20b52e317f42d/jni-build/jni/include/tensorflow/contrib/learn/python/learn/estimators/dnn_linear_combined.py#L57-L131 | ||
catboost/catboost | 167f64f237114a4d10b2b4ee42adb4569137debe | contrib/python/pandas/py2/pandas/core/computation/eval.py | python | eval | (expr, parser='pandas', engine=None, truediv=True,
local_dict=None, global_dict=None, resolvers=(), level=0,
target=None, inplace=False) | Evaluate a Python expression as a string using various backends.
The following arithmetic operations are supported: ``+``, ``-``, ``*``,
``/``, ``**``, ``%``, ``//`` (python engine only) along with the following
boolean operations: ``|`` (or), ``&`` (and), and ``~`` (not).
Additionally, the ``'pandas'`... | Evaluate a Python expression as a string using various backends. | [
"Evaluate",
"a",
"Python",
"expression",
"as",
"a",
"string",
"using",
"various",
"backends",
"."
] | def eval(expr, parser='pandas', engine=None, truediv=True,
local_dict=None, global_dict=None, resolvers=(), level=0,
target=None, inplace=False):
"""Evaluate a Python expression as a string using various backends.
The following arithmetic operations are supported: ``+``, ``-``, ``*``,
``/... | [
"def",
"eval",
"(",
"expr",
",",
"parser",
"=",
"'pandas'",
",",
"engine",
"=",
"None",
",",
"truediv",
"=",
"True",
",",
"local_dict",
"=",
"None",
",",
"global_dict",
"=",
"None",
",",
"resolvers",
"=",
"(",
")",
",",
"level",
"=",
"0",
",",
"tar... | https://github.com/catboost/catboost/blob/167f64f237114a4d10b2b4ee42adb4569137debe/contrib/python/pandas/py2/pandas/core/computation/eval.py#L156-L351 | ||
blocknetdx/blocknet | f85bdf3eeebb1ed8c2321ebd928232d4885b30b6 | contrib/devtools/security-check.py | python | get_PE_dll_characteristics | (executable) | return (arch,bits) | Get PE DllCharacteristics bits.
Returns a tuple (arch,bits) where arch is 'i386:x86-64' or 'i386'
and bits is the DllCharacteristics value. | Get PE DllCharacteristics bits.
Returns a tuple (arch,bits) where arch is 'i386:x86-64' or 'i386'
and bits is the DllCharacteristics value. | [
"Get",
"PE",
"DllCharacteristics",
"bits",
".",
"Returns",
"a",
"tuple",
"(",
"arch",
"bits",
")",
"where",
"arch",
"is",
"i386",
":",
"x86",
"-",
"64",
"or",
"i386",
"and",
"bits",
"is",
"the",
"DllCharacteristics",
"value",
"."
] | def get_PE_dll_characteristics(executable):
'''
Get PE DllCharacteristics bits.
Returns a tuple (arch,bits) where arch is 'i386:x86-64' or 'i386'
and bits is the DllCharacteristics value.
'''
p = subprocess.Popen([OBJDUMP_CMD, '-x', executable], stdout=subprocess.PIPE, stderr=subprocess.PIPE, s... | [
"def",
"get_PE_dll_characteristics",
"(",
"executable",
")",
":",
"p",
"=",
"subprocess",
".",
"Popen",
"(",
"[",
"OBJDUMP_CMD",
",",
"'-x'",
",",
"executable",
"]",
",",
"stdout",
"=",
"subprocess",
".",
"PIPE",
",",
"stderr",
"=",
"subprocess",
".",
"PIP... | https://github.com/blocknetdx/blocknet/blob/f85bdf3eeebb1ed8c2321ebd928232d4885b30b6/contrib/devtools/security-check.py#L118-L136 | |
zhubenfu/License-Plate-Detect-Recognition-via-Deep-Neural-Networks-accuracy-up-to-99.9 | a2cf438a8d2df7b3a55f869fb01f5410741aae5e | train_mtcnn_LPR/48train_wm_lpr/utils.py | python | convert_to_square | (bbox) | return square_bbox | Convert bbox to square
Parameters:
----------
bbox: numpy array , shape n x 5
input bbox
Returns:
-------
square bbox | Convert bbox to square | [
"Convert",
"bbox",
"to",
"square"
] | def convert_to_square(bbox):
"""Convert bbox to square
Parameters:
----------
bbox: numpy array , shape n x 5
input bbox
Returns:
-------
square bbox
"""
square_bbox = bbox.copy()
h = bbox[:, 3] - bbox[:, 1] + 1
w = bbox[:, 2] - bbox[:, 0] + 1
max_side = np.max... | [
"def",
"convert_to_square",
"(",
"bbox",
")",
":",
"square_bbox",
"=",
"bbox",
".",
"copy",
"(",
")",
"h",
"=",
"bbox",
"[",
":",
",",
"3",
"]",
"-",
"bbox",
"[",
":",
",",
"1",
"]",
"+",
"1",
"w",
"=",
"bbox",
"[",
":",
",",
"2",
"]",
"-",... | https://github.com/zhubenfu/License-Plate-Detect-Recognition-via-Deep-Neural-Networks-accuracy-up-to-99.9/blob/a2cf438a8d2df7b3a55f869fb01f5410741aae5e/train_mtcnn_LPR/48train_wm_lpr/utils.py#L34-L55 | |
mongodb/mongo | d8ff665343ad29cf286ee2cf4a1960d29371937b | src/third_party/scons-3.1.2/scons-local-3.1.2/SCons/Defaults.py | python | DefaultEnvironment | (*args, **kw) | return _default_env | Initial public entry point for creating the default construction
Environment.
After creating the environment, we overwrite our name
(DefaultEnvironment) with the _fetch_DefaultEnvironment() function,
which more efficiently returns the initialized default construction
environment without checking fo... | Initial public entry point for creating the default construction
Environment. | [
"Initial",
"public",
"entry",
"point",
"for",
"creating",
"the",
"default",
"construction",
"Environment",
"."
] | def DefaultEnvironment(*args, **kw):
"""
Initial public entry point for creating the default construction
Environment.
After creating the environment, we overwrite our name
(DefaultEnvironment) with the _fetch_DefaultEnvironment() function,
which more efficiently returns the initialized default... | [
"def",
"DefaultEnvironment",
"(",
"*",
"args",
",",
"*",
"*",
"kw",
")",
":",
"global",
"_default_env",
"if",
"not",
"_default_env",
":",
"import",
"SCons",
".",
"Util",
"_default_env",
"=",
"SCons",
".",
"Environment",
".",
"Environment",
"(",
"*",
"args"... | https://github.com/mongodb/mongo/blob/d8ff665343ad29cf286ee2cf4a1960d29371937b/src/third_party/scons-3.1.2/scons-local-3.1.2/SCons/Defaults.py#L69-L96 | |
hanpfei/chromium-net | 392cc1fa3a8f92f42e4071ab6e674d8e0482f83f | third_party/catapult/third_party/gsutil/third_party/boto/boto/mws/connection.py | python | MWSConnection.method_for | (self, name) | return None | Return the MWS API method referred to in the argument.
The named method can be in CamelCase or underlined_lower_case.
This is the complement to MWSConnection.any_call.action | Return the MWS API method referred to in the argument.
The named method can be in CamelCase or underlined_lower_case.
This is the complement to MWSConnection.any_call.action | [
"Return",
"the",
"MWS",
"API",
"method",
"referred",
"to",
"in",
"the",
"argument",
".",
"The",
"named",
"method",
"can",
"be",
"in",
"CamelCase",
"or",
"underlined_lower_case",
".",
"This",
"is",
"the",
"complement",
"to",
"MWSConnection",
".",
"any_call",
... | def method_for(self, name):
"""Return the MWS API method referred to in the argument.
The named method can be in CamelCase or underlined_lower_case.
This is the complement to MWSConnection.any_call.action
"""
action = '_' in name and string.capwords(name, '_') or name
... | [
"def",
"method_for",
"(",
"self",
",",
"name",
")",
":",
"action",
"=",
"'_'",
"in",
"name",
"and",
"string",
".",
"capwords",
"(",
"name",
",",
"'_'",
")",
"or",
"name",
"if",
"action",
"in",
"api_call_map",
":",
"return",
"getattr",
"(",
"self",
",... | https://github.com/hanpfei/chromium-net/blob/392cc1fa3a8f92f42e4071ab6e674d8e0482f83f/third_party/catapult/third_party/gsutil/third_party/boto/boto/mws/connection.py#L337-L345 | |
grpc/grpc | 27bc6fe7797e43298dc931b96dc57322d0852a9f | src/python/grpcio/grpc/__init__.py | python | ServicerContext.peer_identities | (self) | Gets one or more peer identity(s).
Equivalent to
servicer_context.auth_context().get(servicer_context.peer_identity_key())
Returns:
An iterable of the identities, or None if the call is not
authenticated. Each identity is returned as a raw bytes type. | Gets one or more peer identity(s). | [
"Gets",
"one",
"or",
"more",
"peer",
"identity",
"(",
"s",
")",
"."
] | def peer_identities(self):
"""Gets one or more peer identity(s).
Equivalent to
servicer_context.auth_context().get(servicer_context.peer_identity_key())
Returns:
An iterable of the identities, or None if the call is not
authenticated. Each identity is returned as a ... | [
"def",
"peer_identities",
"(",
"self",
")",
":",
"raise",
"NotImplementedError",
"(",
")"
] | https://github.com/grpc/grpc/blob/27bc6fe7797e43298dc931b96dc57322d0852a9f/src/python/grpcio/grpc/__init__.py#L1106-L1116 | ||
miyosuda/TensorFlowAndroidDemo | 35903e0221aa5f109ea2dbef27f20b52e317f42d | jni-build/jni/include/tensorflow/contrib/learn/python/learn/learn_io/dask_io.py | python | _get_divisions | (df) | return divisions | Number of rows in each sub-dataframe. | Number of rows in each sub-dataframe. | [
"Number",
"of",
"rows",
"in",
"each",
"sub",
"-",
"dataframe",
"."
] | def _get_divisions(df):
"""Number of rows in each sub-dataframe."""
lengths = df.map_partitions(len).compute()
divisions = np.cumsum(lengths).tolist()
divisions.insert(0, 0)
return divisions | [
"def",
"_get_divisions",
"(",
"df",
")",
":",
"lengths",
"=",
"df",
".",
"map_partitions",
"(",
"len",
")",
".",
"compute",
"(",
")",
"divisions",
"=",
"np",
".",
"cumsum",
"(",
"lengths",
")",
".",
"tolist",
"(",
")",
"divisions",
".",
"insert",
"("... | https://github.com/miyosuda/TensorFlowAndroidDemo/blob/35903e0221aa5f109ea2dbef27f20b52e317f42d/jni-build/jni/include/tensorflow/contrib/learn/python/learn/learn_io/dask_io.py#L40-L45 | |
aws/lumberyard | f85344403c1c2e77ec8c75deb2c116e97b713217 | dev/Gems/CloudGemFramework/v1/AWS/common-code/lib/pycparser/c_lexer.py | python | CLexer.t_NEWLINE | (self, t) | r'\n+ | r'\n+ | [
"r",
"\\",
"n",
"+"
] | def t_NEWLINE(self, t):
r'\n+'
t.lexer.lineno += t.value.count("\n") | [
"def",
"t_NEWLINE",
"(",
"self",
",",
"t",
")",
":",
"t",
".",
"lexer",
".",
"lineno",
"+=",
"t",
".",
"value",
".",
"count",
"(",
"\"\\n\"",
")"
] | https://github.com/aws/lumberyard/blob/f85344403c1c2e77ec8c75deb2c116e97b713217/dev/Gems/CloudGemFramework/v1/AWS/common-code/lib/pycparser/c_lexer.py#L352-L354 | ||
mindspore-ai/mindspore | fb8fd3338605bb34fa5cea054e535a8b1d753fab | mindspore/python/mindspore/nn/optim/thor.py | python | ThorAscend._process_matrix_init_and_weight_idx_map | (self, net) | for Ascend, process matrix init shape, and get weight idx map | for Ascend, process matrix init shape, and get weight idx map | [
"for",
"Ascend",
"process",
"matrix",
"init",
"shape",
"and",
"get",
"weight",
"idx",
"map"
] | def _process_matrix_init_and_weight_idx_map(self, net):
"""for Ascend, process matrix init shape, and get weight idx map"""
layer_counter = 0
layer_type_map = get_net_layertype_mask(net)
for idx in range(len(self.params)):
layer_type = layer_type_map[layer_counter]
... | [
"def",
"_process_matrix_init_and_weight_idx_map",
"(",
"self",
",",
"net",
")",
":",
"layer_counter",
"=",
"0",
"layer_type_map",
"=",
"get_net_layertype_mask",
"(",
"net",
")",
"for",
"idx",
"in",
"range",
"(",
"len",
"(",
"self",
".",
"params",
")",
")",
"... | https://github.com/mindspore-ai/mindspore/blob/fb8fd3338605bb34fa5cea054e535a8b1d753fab/mindspore/python/mindspore/nn/optim/thor.py#L831-L872 | ||
windystrife/UnrealEngine_NVIDIAGameWorks | b50e6338a7c5b26374d66306ebc7807541ff815e | Engine/Extras/ThirdPartyNotUE/emsdk/Win64/python/2.7.5.3_64bit/Lib/lib2to3/pgen2/grammar.py | python | Grammar.copy | (self) | return new | Copy the grammar. | Copy the grammar. | [
"Copy",
"the",
"grammar",
"."
] | def copy(self):
"""
Copy the grammar.
"""
new = self.__class__()
for dict_attr in ("symbol2number", "number2symbol", "dfas", "keywords",
"tokens", "symbol2label"):
setattr(new, dict_attr, getattr(self, dict_attr).copy())
new.labels = ... | [
"def",
"copy",
"(",
"self",
")",
":",
"new",
"=",
"self",
".",
"__class__",
"(",
")",
"for",
"dict_attr",
"in",
"(",
"\"symbol2number\"",
",",
"\"number2symbol\"",
",",
"\"dfas\"",
",",
"\"keywords\"",
",",
"\"tokens\"",
",",
"\"symbol2label\"",
")",
":",
... | https://github.com/windystrife/UnrealEngine_NVIDIAGameWorks/blob/b50e6338a7c5b26374d66306ebc7807541ff815e/Engine/Extras/ThirdPartyNotUE/emsdk/Win64/python/2.7.5.3_64bit/Lib/lib2to3/pgen2/grammar.py#L100-L111 | |
LiquidPlayer/LiquidCore | 9405979363f2353ac9a71ad8ab59685dd7f919c9 | deps/node-10.15.3/deps/v8/third_party/jinja2/nodes.py | python | Node.find_all | (self, node_type) | Find all the nodes of a given type. If the type is a tuple,
the check is performed for any of the tuple items. | Find all the nodes of a given type. If the type is a tuple,
the check is performed for any of the tuple items. | [
"Find",
"all",
"the",
"nodes",
"of",
"a",
"given",
"type",
".",
"If",
"the",
"type",
"is",
"a",
"tuple",
"the",
"check",
"is",
"performed",
"for",
"any",
"of",
"the",
"tuple",
"items",
"."
] | def find_all(self, node_type):
"""Find all the nodes of a given type. If the type is a tuple,
the check is performed for any of the tuple items.
"""
for child in self.iter_child_nodes():
if isinstance(child, node_type):
yield child
for result in c... | [
"def",
"find_all",
"(",
"self",
",",
"node_type",
")",
":",
"for",
"child",
"in",
"self",
".",
"iter_child_nodes",
"(",
")",
":",
"if",
"isinstance",
"(",
"child",
",",
"node_type",
")",
":",
"yield",
"child",
"for",
"result",
"in",
"child",
".",
"find... | https://github.com/LiquidPlayer/LiquidCore/blob/9405979363f2353ac9a71ad8ab59685dd7f919c9/deps/node-10.15.3/deps/v8/third_party/jinja2/nodes.py#L184-L192 | ||
mantidproject/mantid | 03deeb89254ec4289edb8771e0188c2090a02f32 | Framework/PythonInterface/plugins/algorithms/WorkflowAlgorithms/TransformToIqt.py | python | TransformToIqt._transform | (self) | return iqt | Run TransformToIqt. | Run TransformToIqt. | [
"Run",
"TransformToIqt",
"."
] | def _transform(self):
"""
Run TransformToIqt.
"""
from IndirectCommon import CheckHistZero, CheckHistSame
# Process resolution data
res_number_of_histograms = CheckHistZero(self._resolution)[0]
sample_number_of_histograms = CheckHistZero(self._sample)[0]
... | [
"def",
"_transform",
"(",
"self",
")",
":",
"from",
"IndirectCommon",
"import",
"CheckHistZero",
",",
"CheckHistSame",
"# Process resolution data",
"res_number_of_histograms",
"=",
"CheckHistZero",
"(",
"self",
".",
"_resolution",
")",
"[",
"0",
"]",
"sample_number_of... | https://github.com/mantidproject/mantid/blob/03deeb89254ec4289edb8771e0188c2090a02f32/Framework/PythonInterface/plugins/algorithms/WorkflowAlgorithms/TransformToIqt.py#L232-L264 | |
aws/lumberyard | f85344403c1c2e77ec8c75deb2c116e97b713217 | dev/Tools/Python/3.7.10/linux_x64/lib/python3.7/_pydecimal.py | python | Decimal.__ceil__ | (self) | return int(self._rescale(0, ROUND_CEILING)) | Return the ceiling of self, as an integer.
For a finite Decimal instance self, return the least integer n
such that n >= self. If self is infinite or a NaN then a
Python exception is raised. | Return the ceiling of self, as an integer. | [
"Return",
"the",
"ceiling",
"of",
"self",
"as",
"an",
"integer",
"."
] | def __ceil__(self):
"""Return the ceiling of self, as an integer.
For a finite Decimal instance self, return the least integer n
such that n >= self. If self is infinite or a NaN then a
Python exception is raised.
"""
if self._is_special:
if self.is_nan():
... | [
"def",
"__ceil__",
"(",
"self",
")",
":",
"if",
"self",
".",
"_is_special",
":",
"if",
"self",
".",
"is_nan",
"(",
")",
":",
"raise",
"ValueError",
"(",
"\"cannot round a NaN\"",
")",
"else",
":",
"raise",
"OverflowError",
"(",
"\"cannot round an infinity\"",
... | https://github.com/aws/lumberyard/blob/f85344403c1c2e77ec8c75deb2c116e97b713217/dev/Tools/Python/3.7.10/linux_x64/lib/python3.7/_pydecimal.py#L1907-L1920 | |
mantidproject/mantid | 03deeb89254ec4289edb8771e0188c2090a02f32 | qt/python/mantidqtinterfaces/mantidqtinterfaces/reduction_gui/widgets/sans/sans_catalog.py | python | SANSCatalogWidget._data_updated | (self, key, value) | Respond to application-level key/value pair updates.
@param key: key string
@param value: value string | Respond to application-level key/value pair updates. | [
"Respond",
"to",
"application",
"-",
"level",
"key",
"/",
"value",
"pair",
"updates",
"."
] | def _data_updated(self, key, value):
"""
Respond to application-level key/value pair updates.
@param key: key string
@param value: value string
"""
try:
if key == "sample_run":
self._current_run = self._catalog_cls.data_set_cls.hand... | [
"def",
"_data_updated",
"(",
"self",
",",
"key",
",",
"value",
")",
":",
"try",
":",
"if",
"key",
"==",
"\"sample_run\"",
":",
"self",
".",
"_current_run",
"=",
"self",
".",
"_catalog_cls",
".",
"data_set_cls",
".",
"handle",
"(",
"str",
"(",
"value",
... | https://github.com/mantidproject/mantid/blob/03deeb89254ec4289edb8771e0188c2090a02f32/qt/python/mantidqtinterfaces/mantidqtinterfaces/reduction_gui/widgets/sans/sans_catalog.py#L88-L103 | ||
baidu-research/tensorflow-allreduce | 66d5b855e90b0949e9fa5cca5599fd729a70e874 | tensorflow/contrib/graph_editor/select.py | python | compute_boundary_ts | (ops) | return outside_input_ts, outside_output_ts, inside_ts | Compute the tensors at the boundary of a set of ops.
This function looks at all the tensors connected to the given ops (in/out)
and classify them into three categories:
1) input tensors: tensors whose generating operation is not in ops.
2) output tensors: tensors whose consumer operations are not in ops
3) i... | Compute the tensors at the boundary of a set of ops. | [
"Compute",
"the",
"tensors",
"at",
"the",
"boundary",
"of",
"a",
"set",
"of",
"ops",
"."
] | def compute_boundary_ts(ops):
"""Compute the tensors at the boundary of a set of ops.
This function looks at all the tensors connected to the given ops (in/out)
and classify them into three categories:
1) input tensors: tensors whose generating operation is not in ops.
2) output tensors: tensors whose consum... | [
"def",
"compute_boundary_ts",
"(",
"ops",
")",
":",
"ops",
"=",
"util",
".",
"make_list_of_op",
"(",
"ops",
")",
"input_ts",
"=",
"_get_input_ts",
"(",
"ops",
")",
"output_ts",
"=",
"_get_output_ts",
"(",
"ops",
")",
"output_ts_set",
"=",
"frozenset",
"(",
... | https://github.com/baidu-research/tensorflow-allreduce/blob/66d5b855e90b0949e9fa5cca5599fd729a70e874/tensorflow/contrib/graph_editor/select.py#L276-L325 | |
cybermaggedon/cyberprobe | f826dbc35ad3a79019cb871c0bc3fb1236130b3e | indicators/cyberprobe/indicators.py | python | Indicators.add_indicator | (self, i) | Adds an indicator | Adds an indicator | [
"Adds",
"an",
"indicator"
] | def add_indicator(self, i):
""" Adds an indicator """
self.indicators.append(i) | [
"def",
"add_indicator",
"(",
"self",
",",
"i",
")",
":",
"self",
".",
"indicators",
".",
"append",
"(",
"i",
")"
] | https://github.com/cybermaggedon/cyberprobe/blob/f826dbc35ad3a79019cb871c0bc3fb1236130b3e/indicators/cyberprobe/indicators.py#L22-L24 | ||
lballabio/quantlib-old | 136336947ed4fea9ecc1da6edad188700e821739 | gensrc/gensrc/parameters/parameter.py | python | ReturnValue.postSerialize | (self) | Perform post serialization initialization. | Perform post serialization initialization. | [
"Perform",
"post",
"serialization",
"initialization",
"."
] | def postSerialize(self):
"""Perform post serialization initialization."""
self.fullType_ = environment.getType(self.type_, self.superType_) | [
"def",
"postSerialize",
"(",
"self",
")",
":",
"self",
".",
"fullType_",
"=",
"environment",
".",
"getType",
"(",
"self",
".",
"type_",
",",
"self",
".",
"superType_",
")"
] | https://github.com/lballabio/quantlib-old/blob/136336947ed4fea9ecc1da6edad188700e821739/gensrc/gensrc/parameters/parameter.py#L189-L191 | ||
apple/turicreate | cce55aa5311300e3ce6af93cb45ba791fd1bdf49 | src/external/coremltools_wrap/coremltools/coremltools/converters/sklearn/_decision_tree_classifier.py | python | convert | (model, input_name, output_features) | return _MLModel(
convert_tree_ensemble(
model,
input_name,
output_features,
mode="classifier",
class_labels=model.classes_,
)
) | Convert a decision tree model to protobuf format.
Parameters
----------
decision_tree : DecisionTreeClassifier
A trained scikit-learn tree model.
input_name: str
Name of the input columns.
output_name: str
Name of the output columns.
Returns
-------
model_spec... | Convert a decision tree model to protobuf format. | [
"Convert",
"a",
"decision",
"tree",
"model",
"to",
"protobuf",
"format",
"."
] | def convert(model, input_name, output_features):
"""Convert a decision tree model to protobuf format.
Parameters
----------
decision_tree : DecisionTreeClassifier
A trained scikit-learn tree model.
input_name: str
Name of the input columns.
output_name: str
Name of the... | [
"def",
"convert",
"(",
"model",
",",
"input_name",
",",
"output_features",
")",
":",
"if",
"not",
"(",
"_HAS_SKLEARN",
")",
":",
"raise",
"RuntimeError",
"(",
"\"scikit-learn not found. scikit-learn conversion API is disabled.\"",
")",
"_sklearn_util",
".",
"check_expec... | https://github.com/apple/turicreate/blob/cce55aa5311300e3ce6af93cb45ba791fd1bdf49/src/external/coremltools_wrap/coremltools/coremltools/converters/sklearn/_decision_tree_classifier.py#L19-L56 | |
wxWidgets/wxPython-Classic | 19571e1ae65f1ac445f5491474121998c97a1bf0 | src/gtk/_gdi.py | python | RendererNative.GetGeneric | (*args, **kwargs) | return _gdi_.RendererNative_GetGeneric(*args, **kwargs) | GetGeneric() -> RendererNative
Return the generic implementation of the renderer. Under some
platforms, this is the default renderer implementation, others have
platform-specific default renderer which can be retrieved by calling
`wx.RendererNative.GetDefault`. | GetGeneric() -> RendererNative | [
"GetGeneric",
"()",
"-",
">",
"RendererNative"
] | def GetGeneric(*args, **kwargs):
"""
GetGeneric() -> RendererNative
Return the generic implementation of the renderer. Under some
platforms, this is the default renderer implementation, others have
platform-specific default renderer which can be retrieved by calling
`wx.... | [
"def",
"GetGeneric",
"(",
"*",
"args",
",",
"*",
"*",
"kwargs",
")",
":",
"return",
"_gdi_",
".",
"RendererNative_GetGeneric",
"(",
"*",
"args",
",",
"*",
"*",
"kwargs",
")"
] | https://github.com/wxWidgets/wxPython-Classic/blob/19571e1ae65f1ac445f5491474121998c97a1bf0/src/gtk/_gdi.py#L7448-L7457 | |
wxWidgets/wxPython-Classic | 19571e1ae65f1ac445f5491474121998c97a1bf0 | src/osx_carbon/_misc.py | python | AboutDialogInfo.GetName | (*args, **kwargs) | return _misc_.AboutDialogInfo_GetName(*args, **kwargs) | GetName(self) -> String
Returns the program name. | GetName(self) -> String | [
"GetName",
"(",
"self",
")",
"-",
">",
"String"
] | def GetName(*args, **kwargs):
"""
GetName(self) -> String
Returns the program name.
"""
return _misc_.AboutDialogInfo_GetName(*args, **kwargs) | [
"def",
"GetName",
"(",
"*",
"args",
",",
"*",
"*",
"kwargs",
")",
":",
"return",
"_misc_",
".",
"AboutDialogInfo_GetName",
"(",
"*",
"args",
",",
"*",
"*",
"kwargs",
")"
] | https://github.com/wxWidgets/wxPython-Classic/blob/19571e1ae65f1ac445f5491474121998c97a1bf0/src/osx_carbon/_misc.py#L6596-L6602 | |
qgis/QGIS | 15a77662d4bb712184f6aa60d0bd663010a76a75 | python/plugins/MetaSearch/dialogs/maindialog.py | python | MetaSearchDialog.reject | (self) | back out of dialogue | back out of dialogue | [
"back",
"out",
"of",
"dialogue"
] | def reject(self):
"""back out of dialogue"""
QDialog.reject(self)
self.rubber_band.reset() | [
"def",
"reject",
"(",
"self",
")",
":",
"QDialog",
".",
"reject",
"(",
"self",
")",
"self",
".",
"rubber_band",
".",
"reset",
"(",
")"
] | https://github.com/qgis/QGIS/blob/15a77662d4bb712184f6aa60d0bd663010a76a75/python/plugins/MetaSearch/dialogs/maindialog.py#L938-L942 | ||
catboost/catboost | 167f64f237114a4d10b2b4ee42adb4569137debe | catboost/python-package/catboost/datasets.py | python | adult | () | return train_df, test_df | Download "Adult Data Set" [1] from UCI Machine Learning Repository.
Will return two pandas.DataFrame-s, first with train part (adult.data) and second with test part
(adult.test) of the dataset.
[1]: https://archive.ics.uci.edu/ml/datasets/Adult | Download "Adult Data Set" [1] from UCI Machine Learning Repository. | [
"Download",
"Adult",
"Data",
"Set",
"[",
"1",
"]",
"from",
"UCI",
"Machine",
"Learning",
"Repository",
"."
] | def adult():
"""
Download "Adult Data Set" [1] from UCI Machine Learning Repository.
Will return two pandas.DataFrame-s, first with train part (adult.data) and second with test part
(adult.test) of the dataset.
[1]: https://archive.ics.uci.edu/ml/datasets/Adult
"""
# via https://archive.ic... | [
"def",
"adult",
"(",
")",
":",
"# via https://archive.ics.uci.edu/ml/machine-learning-databases/adult/adult.names",
"names",
"=",
"(",
"'age'",
",",
"'workclass'",
",",
"'fnlwgt'",
",",
"'education'",
",",
"'education-num'",
",",
"'marital-status'",
",",
"'occupation'",
"... | https://github.com/catboost/catboost/blob/167f64f237114a4d10b2b4ee42adb4569137debe/catboost/python-package/catboost/datasets.py#L263-L313 | |
catboost/catboost | 167f64f237114a4d10b2b4ee42adb4569137debe | contrib/python/pandas/py3/pandas/core/frame.py | python | DataFrame._get_agg_axis | (self, axis_num: int) | Let's be explicit about this. | Let's be explicit about this. | [
"Let",
"s",
"be",
"explicit",
"about",
"this",
"."
] | def _get_agg_axis(self, axis_num: int) -> Index:
"""
Let's be explicit about this.
"""
if axis_num == 0:
return self.columns
elif axis_num == 1:
return self.index
else:
raise ValueError(f"Axis must be 0 or 1 (got {repr(axis_num)})") | [
"def",
"_get_agg_axis",
"(",
"self",
",",
"axis_num",
":",
"int",
")",
"->",
"Index",
":",
"if",
"axis_num",
"==",
"0",
":",
"return",
"self",
".",
"columns",
"elif",
"axis_num",
"==",
"1",
":",
"return",
"self",
".",
"index",
"else",
":",
"raise",
"... | https://github.com/catboost/catboost/blob/167f64f237114a4d10b2b4ee42adb4569137debe/contrib/python/pandas/py3/pandas/core/frame.py#L10114-L10123 | ||
wxWidgets/wxPython-Classic | 19571e1ae65f1ac445f5491474121998c97a1bf0 | src/msw/_controls.py | python | Gauge.SetShadowWidth | (*args, **kwargs) | return _controls_.Gauge_SetShadowWidth(*args, **kwargs) | SetShadowWidth(self, int w) | SetShadowWidth(self, int w) | [
"SetShadowWidth",
"(",
"self",
"int",
"w",
")"
] | def SetShadowWidth(*args, **kwargs):
"""SetShadowWidth(self, int w)"""
return _controls_.Gauge_SetShadowWidth(*args, **kwargs) | [
"def",
"SetShadowWidth",
"(",
"*",
"args",
",",
"*",
"*",
"kwargs",
")",
":",
"return",
"_controls_",
".",
"Gauge_SetShadowWidth",
"(",
"*",
"args",
",",
"*",
"*",
"kwargs",
")"
] | https://github.com/wxWidgets/wxPython-Classic/blob/19571e1ae65f1ac445f5491474121998c97a1bf0/src/msw/_controls.py#L771-L773 | |
aws/lumberyard | f85344403c1c2e77ec8c75deb2c116e97b713217 | dev/Tools/Python/3.7.10/windows/Lib/pdb.py | python | Pdb.do_next | (self, arg) | return 1 | n(ext)
Continue execution until the next line in the current function
is reached or it returns. | n(ext)
Continue execution until the next line in the current function
is reached or it returns. | [
"n",
"(",
"ext",
")",
"Continue",
"execution",
"until",
"the",
"next",
"line",
"in",
"the",
"current",
"function",
"is",
"reached",
"or",
"it",
"returns",
"."
] | def do_next(self, arg):
"""n(ext)
Continue execution until the next line in the current function
is reached or it returns.
"""
self.set_next(self.curframe)
return 1 | [
"def",
"do_next",
"(",
"self",
",",
"arg",
")",
":",
"self",
".",
"set_next",
"(",
"self",
".",
"curframe",
")",
"return",
"1"
] | https://github.com/aws/lumberyard/blob/f85344403c1c2e77ec8c75deb2c116e97b713217/dev/Tools/Python/3.7.10/windows/Lib/pdb.py#L1004-L1010 | |
wxWidgets/wxPython-Classic | 19571e1ae65f1ac445f5491474121998c97a1bf0 | wx/lib/masked/combobox.py | python | BaseMaskedComboBox._SetValue | (self, value) | Allow mixin to set the raw value of the control with this function.
REQUIRED by any class derived from MaskedEditMixin. | Allow mixin to set the raw value of the control with this function.
REQUIRED by any class derived from MaskedEditMixin. | [
"Allow",
"mixin",
"to",
"set",
"the",
"raw",
"value",
"of",
"the",
"control",
"with",
"this",
"function",
".",
"REQUIRED",
"by",
"any",
"class",
"derived",
"from",
"MaskedEditMixin",
"."
] | def _SetValue(self, value):
"""
Allow mixin to set the raw value of the control with this function.
REQUIRED by any class derived from MaskedEditMixin.
"""
# For wxComboBox, ensure that values are properly padded so that
# if varying length choices are supplied, they alwa... | [
"def",
"_SetValue",
"(",
"self",
",",
"value",
")",
":",
"# For wxComboBox, ensure that values are properly padded so that",
"# if varying length choices are supplied, they always show up",
"# in the window properly, and will be the appropriate length",
"# to match the mask:",
"if",
"self"... | https://github.com/wxWidgets/wxPython-Classic/blob/19571e1ae65f1ac445f5491474121998c97a1bf0/wx/lib/masked/combobox.py#L270-L292 | ||
aws/lumberyard | f85344403c1c2e77ec8c75deb2c116e97b713217 | dev/Tools/Python/3.7.10/linux_x64/lib/python3.7/site-packages/pip/_vendor/msgpack/fallback.py | python | Packer.reset | (self) | Reset internal buffer.
This method is useful only when autoreset=False. | Reset internal buffer. | [
"Reset",
"internal",
"buffer",
"."
] | def reset(self):
"""Reset internal buffer.
This method is useful only when autoreset=False.
"""
self._buffer = StringIO() | [
"def",
"reset",
"(",
"self",
")",
":",
"self",
".",
"_buffer",
"=",
"StringIO",
"(",
")"
] | https://github.com/aws/lumberyard/blob/f85344403c1c2e77ec8c75deb2c116e97b713217/dev/Tools/Python/3.7.10/linux_x64/lib/python3.7/site-packages/pip/_vendor/msgpack/fallback.py#L2149-L2159 | ||
stan-dev/math | 5fd79f89933269a4ca4d8dd1fde2a36d53d4768c | lib/benchmark_1.5.1/tools/gbench/report.py | python | filter_benchmark | (json_orig, family, replacement="") | return filtered | Apply a filter to the json, and only leave the 'family' of benchmarks. | Apply a filter to the json, and only leave the 'family' of benchmarks. | [
"Apply",
"a",
"filter",
"to",
"the",
"json",
"and",
"only",
"leave",
"the",
"family",
"of",
"benchmarks",
"."
] | def filter_benchmark(json_orig, family, replacement=""):
"""
Apply a filter to the json, and only leave the 'family' of benchmarks.
"""
regex = re.compile(family)
filtered = {}
filtered['benchmarks'] = []
for be in json_orig['benchmarks']:
if not regex.search(be['name']):
... | [
"def",
"filter_benchmark",
"(",
"json_orig",
",",
"family",
",",
"replacement",
"=",
"\"\"",
")",
":",
"regex",
"=",
"re",
".",
"compile",
"(",
"family",
")",
"filtered",
"=",
"{",
"}",
"filtered",
"[",
"'benchmarks'",
"]",
"=",
"[",
"]",
"for",
"be",
... | https://github.com/stan-dev/math/blob/5fd79f89933269a4ca4d8dd1fde2a36d53d4768c/lib/benchmark_1.5.1/tools/gbench/report.py#L82-L95 | |
alexozer/jankdrone | c4b403eb254b41b832ab2bdfade12ba59c99e5dc | drone/lib/nanopb/generator/nanopb_generator.py | python | Message.count_required_fields | (self) | return count | Returns number of required fields inside this message | Returns number of required fields inside this message | [
"Returns",
"number",
"of",
"required",
"fields",
"inside",
"this",
"message"
] | def count_required_fields(self):
'''Returns number of required fields inside this message'''
count = 0
for f in self.fields:
if not isinstance(f, OneOf):
if f.rules == 'REQUIRED':
count += 1
return count | [
"def",
"count_required_fields",
"(",
"self",
")",
":",
"count",
"=",
"0",
"for",
"f",
"in",
"self",
".",
"fields",
":",
"if",
"not",
"isinstance",
"(",
"f",
",",
"OneOf",
")",
":",
"if",
"f",
".",
"rules",
"==",
"'REQUIRED'",
":",
"count",
"+=",
"1... | https://github.com/alexozer/jankdrone/blob/c4b403eb254b41b832ab2bdfade12ba59c99e5dc/drone/lib/nanopb/generator/nanopb_generator.py#L881-L888 | |
mindspore-ai/mindspore | fb8fd3338605bb34fa5cea054e535a8b1d753fab | mindspore/python/mindspore/nn/transformer/transformer.py | python | TransformerEncoderLayer._check_input | (self, x, input_mask, init_reset, batch_valid_length) | return True | r"""Check inputs | r"""Check inputs | [
"r",
"Check",
"inputs"
] | def _check_input(self, x, input_mask, init_reset, batch_valid_length):
r"""Check inputs"""
if not self.use_past or (self.use_past and self.is_first_iteration):
_check_shape_equal(F.shape(x), "x", self.cls_name,
[[self.batch_size, self.seq_length, self.hidden_si... | [
"def",
"_check_input",
"(",
"self",
",",
"x",
",",
"input_mask",
",",
"init_reset",
",",
"batch_valid_length",
")",
":",
"if",
"not",
"self",
".",
"use_past",
"or",
"(",
"self",
".",
"use_past",
"and",
"self",
".",
"is_first_iteration",
")",
":",
"_check_s... | https://github.com/mindspore-ai/mindspore/blob/fb8fd3338605bb34fa5cea054e535a8b1d753fab/mindspore/python/mindspore/nn/transformer/transformer.py#L1423-L1452 | |
mantidproject/mantid | 03deeb89254ec4289edb8771e0188c2090a02f32 | qt/python/mantidqt/mantidqt/widgets/instrumentview/api.py | python | get_instrumentview | (workspace, wait=True) | return ivp | Return a handle to the instrument view of given workspace
:param ws: input workspace | Return a handle to the instrument view of given workspace
:param ws: input workspace | [
"Return",
"a",
"handle",
"to",
"the",
"instrument",
"view",
"of",
"given",
"workspace",
":",
"param",
"ws",
":",
"input",
"workspace"
] | def get_instrumentview(workspace, wait=True):
"""Return a handle to the instrument view of given workspace
:param ws: input workspace
"""
def _wrappper(ws):
return force_method_calls_to_qapp_thread(InstrumentViewPresenter(ws))
# need to do some duck-typing here
ivp = QAppThreadCall(_wra... | [
"def",
"get_instrumentview",
"(",
"workspace",
",",
"wait",
"=",
"True",
")",
":",
"def",
"_wrappper",
"(",
"ws",
")",
":",
"return",
"force_method_calls_to_qapp_thread",
"(",
"InstrumentViewPresenter",
"(",
"ws",
")",
")",
"# need to do some duck-typing here",
"ivp... | https://github.com/mantidproject/mantid/blob/03deeb89254ec4289edb8771e0188c2090a02f32/qt/python/mantidqt/mantidqt/widgets/instrumentview/api.py#L25-L52 | |
google-ar/WebARonTango | e86965d2cbc652156b480e0fcf77c716745578cd | chromium/src/gpu/command_buffer/build_gles2_cmd_buffer.py | python | GLGenerator.WriteServiceUtilsHeader | (self, filename) | Writes the gles2 auto generated utility header. | Writes the gles2 auto generated utility header. | [
"Writes",
"the",
"gles2",
"auto",
"generated",
"utility",
"header",
"."
] | def WriteServiceUtilsHeader(self, filename):
"""Writes the gles2 auto generated utility header."""
with CHeaderWriter(filename) as f:
for name in sorted(_NAMED_TYPE_INFO.keys()):
named_type = NamedType(_NAMED_TYPE_INFO[name])
if not named_type.CreateValidator():
continue
... | [
"def",
"WriteServiceUtilsHeader",
"(",
"self",
",",
"filename",
")",
":",
"with",
"CHeaderWriter",
"(",
"filename",
")",
"as",
"f",
":",
"for",
"name",
"in",
"sorted",
"(",
"_NAMED_TYPE_INFO",
".",
"keys",
"(",
")",
")",
":",
"named_type",
"=",
"NamedType"... | https://github.com/google-ar/WebARonTango/blob/e86965d2cbc652156b480e0fcf77c716745578cd/chromium/src/gpu/command_buffer/build_gles2_cmd_buffer.py#L10724-L10750 | ||
hanpfei/chromium-net | 392cc1fa3a8f92f42e4071ab6e674d8e0482f83f | third_party/catapult/telemetry/telemetry/timeline/event_container.py | python | TimelineEventContainer.IterAllEvents | (self,
recursive=True,
event_type_predicate=lambda t: True,
event_predicate=lambda e: True) | Iterates all events in this container, pre-filtered by two predicates.
Only events with a type matching event_type_predicate AND matching event
event_predicate will be yielded.
event_type_predicate is given an actual type object, e.g.:
event_type_predicate(slice_module.Slice)
event_predicate ... | Iterates all events in this container, pre-filtered by two predicates. | [
"Iterates",
"all",
"events",
"in",
"this",
"container",
"pre",
"-",
"filtered",
"by",
"two",
"predicates",
"."
] | def IterAllEvents(self,
recursive=True,
event_type_predicate=lambda t: True,
event_predicate=lambda e: True):
"""Iterates all events in this container, pre-filtered by two predicates.
Only events with a type matching event_type_predicate AND matching ... | [
"def",
"IterAllEvents",
"(",
"self",
",",
"recursive",
"=",
"True",
",",
"event_type_predicate",
"=",
"lambda",
"t",
":",
"True",
",",
"event_predicate",
"=",
"lambda",
"e",
":",
"True",
")",
":",
"if",
"not",
"recursive",
":",
"for",
"e",
"in",
"self",
... | https://github.com/hanpfei/chromium-net/blob/392cc1fa3a8f92f42e4071ab6e674d8e0482f83f/third_party/catapult/telemetry/telemetry/timeline/event_container.py#L51-L85 | ||
wlanjie/AndroidFFmpeg | 7baf9122f4b8e1c74e7baf4be5c422c7a5ba5aaf | tools/fdk-aac-build/armeabi-v7a/toolchain/lib/python2.7/logging/__init__.py | python | exception | (msg, *args, **kwargs) | Log a message with severity 'ERROR' on the root logger,
with exception information. | Log a message with severity 'ERROR' on the root logger,
with exception information. | [
"Log",
"a",
"message",
"with",
"severity",
"ERROR",
"on",
"the",
"root",
"logger",
"with",
"exception",
"information",
"."
] | def exception(msg, *args, **kwargs):
"""
Log a message with severity 'ERROR' on the root logger,
with exception information.
"""
kwargs['exc_info'] = 1
error(msg, *args, **kwargs) | [
"def",
"exception",
"(",
"msg",
",",
"*",
"args",
",",
"*",
"*",
"kwargs",
")",
":",
"kwargs",
"[",
"'exc_info'",
"]",
"=",
"1",
"error",
"(",
"msg",
",",
"*",
"args",
",",
"*",
"*",
"kwargs",
")"
] | https://github.com/wlanjie/AndroidFFmpeg/blob/7baf9122f4b8e1c74e7baf4be5c422c7a5ba5aaf/tools/fdk-aac-build/armeabi-v7a/toolchain/lib/python2.7/logging/__init__.py#L1587-L1593 | ||
mantidproject/mantid | 03deeb89254ec4289edb8771e0188c2090a02f32 | qt/python/mantidqtinterfaces/mantidqtinterfaces/Muon/GUI/ElementalAnalysis/LoadWidget/load_utils.py | python | get_detector_num_from_ws | (name) | return name[0] | Gets the detector number from the workspace name:
i.e the first character | Gets the detector number from the workspace name:
i.e the first character | [
"Gets",
"the",
"detector",
"number",
"from",
"the",
"workspace",
"name",
":",
"i",
".",
"e",
"the",
"first",
"character"
] | def get_detector_num_from_ws(name):
"""
Gets the detector number from the workspace name:
i.e the first character
"""
return name[0] | [
"def",
"get_detector_num_from_ws",
"(",
"name",
")",
":",
"return",
"name",
"[",
"0",
"]"
] | https://github.com/mantidproject/mantid/blob/03deeb89254ec4289edb8771e0188c2090a02f32/qt/python/mantidqtinterfaces/mantidqtinterfaces/Muon/GUI/ElementalAnalysis/LoadWidget/load_utils.py#L173-L178 | |
tensorflow/tensorflow | 419e3a6b650ea4bd1b0cba23c4348f8a69f3272e | tensorflow/python/keras/utils/conv_utils.py | python | squeeze_batch_dims | (inp, op, inner_rank) | Returns `unsqueeze_batch(op(squeeze_batch(inp)))`.
Where `squeeze_batch` reshapes `inp` to shape
`[prod(inp.shape[:-inner_rank])] + inp.shape[-inner_rank:]`
and `unsqueeze_batch` does the reverse reshape but on the output.
Args:
inp: A tensor with dims `batch_shape + inner_shape` where `inner_shape`
... | Returns `unsqueeze_batch(op(squeeze_batch(inp)))`. | [
"Returns",
"unsqueeze_batch",
"(",
"op",
"(",
"squeeze_batch",
"(",
"inp",
")))",
"."
] | def squeeze_batch_dims(inp, op, inner_rank):
"""Returns `unsqueeze_batch(op(squeeze_batch(inp)))`.
Where `squeeze_batch` reshapes `inp` to shape
`[prod(inp.shape[:-inner_rank])] + inp.shape[-inner_rank:]`
and `unsqueeze_batch` does the reverse reshape but on the output.
Args:
inp: A tensor with dims `ba... | [
"def",
"squeeze_batch_dims",
"(",
"inp",
",",
"op",
",",
"inner_rank",
")",
":",
"with",
"ops",
".",
"name_scope_v2",
"(",
"'squeeze_batch_dims'",
")",
":",
"shape",
"=",
"inp",
".",
"shape",
"inner_shape",
"=",
"shape",
"[",
"-",
"inner_rank",
":",
"]",
... | https://github.com/tensorflow/tensorflow/blob/419e3a6b650ea4bd1b0cba23c4348f8a69f3272e/tensorflow/python/keras/utils/conv_utils.py#L471-L515 | ||
Xilinx/Vitis-AI | fc74d404563d9951b57245443c73bef389f3657f | tools/Vitis-AI-Quantizer/vai_q_tensorflow1.x/tensorflow/contrib/timeseries/python/timeseries/estimators.py | python | LSTMAutoRegressor.__init__ | (self,
periodicities,
input_window_size,
output_window_size,
model_dir=None,
num_features=1,
extra_feature_columns=None,
num_timesteps=10,
loss=ar_model.ARModel.NORMAL_LIKELIHOOD_LOSS,
... | Initialize the Estimator.
Args:
periodicities: periodicities of the input data, in the same units as the
time feature (for example 24 if feeding hourly data with a daily
periodicity, or 60 * 24 if feeding minute-level data with daily
periodicity). Note this can be a single value or a ... | Initialize the Estimator. | [
"Initialize",
"the",
"Estimator",
"."
] | def __init__(self,
periodicities,
input_window_size,
output_window_size,
model_dir=None,
num_features=1,
extra_feature_columns=None,
num_timesteps=10,
loss=ar_model.ARModel.NORMAL_LIKELIHOOD_LOSS,
... | [
"def",
"__init__",
"(",
"self",
",",
"periodicities",
",",
"input_window_size",
",",
"output_window_size",
",",
"model_dir",
"=",
"None",
",",
"num_features",
"=",
"1",
",",
"extra_feature_columns",
"=",
"None",
",",
"num_timesteps",
"=",
"10",
",",
"loss",
"=... | https://github.com/Xilinx/Vitis-AI/blob/fc74d404563d9951b57245443c73bef389f3657f/tools/Vitis-AI-Quantizer/vai_q_tensorflow1.x/tensorflow/contrib/timeseries/python/timeseries/estimators.py#L499-L567 | ||
hughperkins/tf-coriander | 970d3df6c11400ad68405f22b0c42a52374e94ca | tensorflow/contrib/factorization/python/ops/gmm_ops.py | python | _covariance | (x, diag) | return cov | Defines the covariance operation of a matrix.
Args:
x: a matrix Tensor. Dimension 0 should contain the number of examples.
diag: if True, it computes the diagonal covariance.
Returns:
A Tensor representing the covariance of x. In the case of
diagonal matrix just the diagonal is returned. | Defines the covariance operation of a matrix. | [
"Defines",
"the",
"covariance",
"operation",
"of",
"a",
"matrix",
"."
] | def _covariance(x, diag):
"""Defines the covariance operation of a matrix.
Args:
x: a matrix Tensor. Dimension 0 should contain the number of examples.
diag: if True, it computes the diagonal covariance.
Returns:
A Tensor representing the covariance of x. In the case of
diagonal matrix just the di... | [
"def",
"_covariance",
"(",
"x",
",",
"diag",
")",
":",
"num_points",
"=",
"tf",
".",
"to_float",
"(",
"tf",
".",
"shape",
"(",
"x",
")",
"[",
"0",
"]",
")",
"x",
"-=",
"tf",
".",
"reduce_mean",
"(",
"x",
",",
"0",
",",
"keep_dims",
"=",
"True",... | https://github.com/hughperkins/tf-coriander/blob/970d3df6c11400ad68405f22b0c42a52374e94ca/tensorflow/contrib/factorization/python/ops/gmm_ops.py#L36-L54 | |
tensorflow/tensorflow | 419e3a6b650ea4bd1b0cba23c4348f8a69f3272e | tensorflow/python/ops/image_ops_impl.py | python | convert_image_dtype | (image, dtype, saturate=False, name=None) | Convert `image` to `dtype`, scaling its values if needed.
The operation supports data types (for `image` and `dtype`) of
`uint8`, `uint16`, `uint32`, `uint64`, `int8`, `int16`, `int32`, `int64`,
`float16`, `float32`, `float64`, `bfloat16`.
Images that are represented using floating point values are expected t... | Convert `image` to `dtype`, scaling its values if needed. | [
"Convert",
"image",
"to",
"dtype",
"scaling",
"its",
"values",
"if",
"needed",
"."
] | def convert_image_dtype(image, dtype, saturate=False, name=None):
"""Convert `image` to `dtype`, scaling its values if needed.
The operation supports data types (for `image` and `dtype`) of
`uint8`, `uint16`, `uint32`, `uint64`, `int8`, `int16`, `int32`, `int64`,
`float16`, `float32`, `float64`, `bfloat16`.
... | [
"def",
"convert_image_dtype",
"(",
"image",
",",
"dtype",
",",
"saturate",
"=",
"False",
",",
"name",
"=",
"None",
")",
":",
"image",
"=",
"ops",
".",
"convert_to_tensor",
"(",
"image",
",",
"name",
"=",
"'image'",
")",
"dtype",
"=",
"dtypes",
".",
"as... | https://github.com/tensorflow/tensorflow/blob/419e3a6b650ea4bd1b0cba23c4348f8a69f3272e/tensorflow/python/ops/image_ops_impl.py#L2304-L2481 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.