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 |
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
CRYTEK/CRYENGINE | 232227c59a220cbbd311576f0fbeba7bb53b2a8c | Code/Tools/waf-1.7.13/waflib/ConfigSet.py | python | ConfigSet.prepend_value | (self, var, val) | Prepends a value to the specified item::
def configure(conf):
conf.env.prepend_value('CFLAGS', ['-O2'])
The value must be a list or a tuple | Prepends a value to the specified item:: | [
"Prepends",
"a",
"value",
"to",
"the",
"specified",
"item",
"::"
] | def prepend_value(self, var, val):
"""
Prepends a value to the specified item::
def configure(conf):
conf.env.prepend_value('CFLAGS', ['-O2'])
The value must be a list or a tuple
"""
if isinstance(val, str):
val = [val]
self.table[var] = val + self._get_list_value_for_modification(var) | [
"def",
"prepend_value",
"(",
"self",
",",
"var",
",",
"val",
")",
":",
"if",
"isinstance",
"(",
"val",
",",
"str",
")",
":",
"val",
"=",
"[",
"val",
"]",
"self",
".",
"table",
"[",
"var",
"]",
"=",
"val",
"+",
"self",
".",
"_get_list_value_for_modi... | https://github.com/CRYTEK/CRYENGINE/blob/232227c59a220cbbd311576f0fbeba7bb53b2a8c/Code/Tools/waf-1.7.13/waflib/ConfigSet.py#L219-L230 | ||
catboost/catboost | 167f64f237114a4d10b2b4ee42adb4569137debe | contrib/python/pandas/py3/pandas/core/ops/common.py | python | get_op_result_name | (left, right) | return name | Find the appropriate name to pin to an operation result. This result
should always be either an Index or a Series.
Parameters
----------
left : {Series, Index}
right : object
Returns
-------
name : object
Usually a string | Find the appropriate name to pin to an operation result. This result
should always be either an Index or a Series. | [
"Find",
"the",
"appropriate",
"name",
"to",
"pin",
"to",
"an",
"operation",
"result",
".",
"This",
"result",
"should",
"always",
"be",
"either",
"an",
"Index",
"or",
"a",
"Series",
"."
] | def get_op_result_name(left, right):
"""
Find the appropriate name to pin to an operation result. This result
should always be either an Index or a Series.
Parameters
----------
left : {Series, Index}
right : object
Returns
-------
name : object
Usually a string
""... | [
"def",
"get_op_result_name",
"(",
"left",
",",
"right",
")",
":",
"if",
"isinstance",
"(",
"right",
",",
"(",
"ABCSeries",
",",
"ABCIndex",
")",
")",
":",
"name",
"=",
"_maybe_match_name",
"(",
"left",
",",
"right",
")",
"else",
":",
"name",
"=",
"left... | https://github.com/catboost/catboost/blob/167f64f237114a4d10b2b4ee42adb4569137debe/contrib/python/pandas/py3/pandas/core/ops/common.py#L74-L93 | |
tensorflow/tensorflow | 419e3a6b650ea4bd1b0cba23c4348f8a69f3272e | tensorflow/python/ops/control_flow_util_v2.py | python | unique_fn_name | (scope, name) | return ("%s%s_%s" % (scope, name, ops.uid())).replace("/", "_") | Returns a unique name to use for a control flow function.
Args:
scope: A name scope string.
name: An identifier for this function (e.g. "true", "body").
Returns:
A string, the name to use for the function. | Returns a unique name to use for a control flow function. | [
"Returns",
"a",
"unique",
"name",
"to",
"use",
"for",
"a",
"control",
"flow",
"function",
"."
] | def unique_fn_name(scope, name):
"""Returns a unique name to use for a control flow function.
Args:
scope: A name scope string.
name: An identifier for this function (e.g. "true", "body").
Returns:
A string, the name to use for the function.
"""
return ("%s%s_%s" % (scope, name, ops.uid())).repl... | [
"def",
"unique_fn_name",
"(",
"scope",
",",
"name",
")",
":",
"return",
"(",
"\"%s%s_%s\"",
"%",
"(",
"scope",
",",
"name",
",",
"ops",
".",
"uid",
"(",
")",
")",
")",
".",
"replace",
"(",
"\"/\"",
",",
"\"_\"",
")"
] | https://github.com/tensorflow/tensorflow/blob/419e3a6b650ea4bd1b0cba23c4348f8a69f3272e/tensorflow/python/ops/control_flow_util_v2.py#L75-L85 | |
catboost/catboost | 167f64f237114a4d10b2b4ee42adb4569137debe | contrib/python/pandas/py2/pandas/core/arrays/timedeltas.py | python | ints_to_td64ns | (data, unit="ns") | return data, copy_made | Convert an ndarray with integer-dtype to timedelta64[ns] dtype, treating
the integers as multiples of the given timedelta unit.
Parameters
----------
data : numpy.ndarray with integer-dtype
unit : str, default "ns"
The timedelta unit to treat integers as multiples of.
Returns
-----... | Convert an ndarray with integer-dtype to timedelta64[ns] dtype, treating
the integers as multiples of the given timedelta unit. | [
"Convert",
"an",
"ndarray",
"with",
"integer",
"-",
"dtype",
"to",
"timedelta64",
"[",
"ns",
"]",
"dtype",
"treating",
"the",
"integers",
"as",
"multiples",
"of",
"the",
"given",
"timedelta",
"unit",
"."
] | def ints_to_td64ns(data, unit="ns"):
"""
Convert an ndarray with integer-dtype to timedelta64[ns] dtype, treating
the integers as multiples of the given timedelta unit.
Parameters
----------
data : numpy.ndarray with integer-dtype
unit : str, default "ns"
The timedelta unit to treat... | [
"def",
"ints_to_td64ns",
"(",
"data",
",",
"unit",
"=",
"\"ns\"",
")",
":",
"copy_made",
"=",
"False",
"unit",
"=",
"unit",
"if",
"unit",
"is",
"not",
"None",
"else",
"\"ns\"",
"if",
"data",
".",
"dtype",
"!=",
"np",
".",
"int64",
":",
"# converting to... | https://github.com/catboost/catboost/blob/167f64f237114a4d10b2b4ee42adb4569137debe/contrib/python/pandas/py2/pandas/core/arrays/timedeltas.py#L960-L997 | |
francinexue/xuefu | b6ff79747a42e020588c0c0a921048e08fe4680c | cnx/bar.py | python | Bars.getBar | (self, instrument) | return self.__barDict.get(instrument, None) | Returns the :class:`pyalgotrade.bar.Bar` for the given instrument or None if the instrument is not found. | Returns the :class:`pyalgotrade.bar.Bar` for the given instrument or None if the instrument is not found. | [
"Returns",
"the",
":",
"class",
":",
"pyalgotrade",
".",
"bar",
".",
"Bar",
"for",
"the",
"given",
"instrument",
"or",
"None",
"if",
"the",
"instrument",
"is",
"not",
"found",
"."
] | def getBar(self, instrument):
"""Returns the :class:`pyalgotrade.bar.Bar` for the given instrument or None if the instrument is not found."""
return self.__barDict.get(instrument, None) | [
"def",
"getBar",
"(",
"self",
",",
"instrument",
")",
":",
"return",
"self",
".",
"__barDict",
".",
"get",
"(",
"instrument",
",",
"None",
")"
] | https://github.com/francinexue/xuefu/blob/b6ff79747a42e020588c0c0a921048e08fe4680c/cnx/bar.py#L298-L300 | |
BitMEX/api-connectors | 37a3a5b806ad5d0e0fc975ab86d9ed43c3bcd812 | auto-generated/python/swagger_client/models/api_key.py | python | APIKey.id | (self) | return self._id | Gets the id of this APIKey. # noqa: E501
:return: The id of this APIKey. # noqa: E501
:rtype: str | Gets the id of this APIKey. # noqa: E501 | [
"Gets",
"the",
"id",
"of",
"this",
"APIKey",
".",
"#",
"noqa",
":",
"E501"
] | def id(self):
"""Gets the id of this APIKey. # noqa: E501
:return: The id of this APIKey. # noqa: E501
:rtype: str
"""
return self._id | [
"def",
"id",
"(",
"self",
")",
":",
"return",
"self",
".",
"_id"
] | https://github.com/BitMEX/api-connectors/blob/37a3a5b806ad5d0e0fc975ab86d9ed43c3bcd812/auto-generated/python/swagger_client/models/api_key.py#L86-L93 | |
aws/lumberyard | f85344403c1c2e77ec8c75deb2c116e97b713217 | dev/Gems/CloudGemWebCommunicator/AWS/common-code/lib/AWSIoTPythonSDK/MQTTLib.py | python | AWSIoTMQTTClient.onMessage | (self, message) | **Description**
Callback that gets called when the client receives a new message. The callback registration should happen before
calling connect/connectAsync. This callback, if present, will always be triggered regardless of whether there is
any message callback registered upon subscribe API ca... | **Description** | [
"**",
"Description",
"**"
] | def onMessage(self, message):
"""
**Description**
Callback that gets called when the client receives a new message. The callback registration should happen before
calling connect/connectAsync. This callback, if present, will always be triggered regardless of whether there is
any... | [
"def",
"onMessage",
"(",
"self",
",",
"message",
")",
":",
"pass"
] | https://github.com/aws/lumberyard/blob/f85344403c1c2e77ec8c75deb2c116e97b713217/dev/Gems/CloudGemWebCommunicator/AWS/common-code/lib/AWSIoTPythonSDK/MQTTLib.py#L835-L861 | ||
wlanjie/AndroidFFmpeg | 7baf9122f4b8e1c74e7baf4be5c422c7a5ba5aaf | tools/fdk-aac-build/armeabi/toolchain/lib/python2.7/plat-mac/videoreader.py | python | _Reader._getpixmapcontent | (self) | return ''.join(rv) | Shuffle the offscreen PixMap data, because it may have funny stride values | Shuffle the offscreen PixMap data, because it may have funny stride values | [
"Shuffle",
"the",
"offscreen",
"PixMap",
"data",
"because",
"it",
"may",
"have",
"funny",
"stride",
"values"
] | def _getpixmapcontent(self):
"""Shuffle the offscreen PixMap data, because it may have funny stride values"""
rowbytes = Qdoffs.GetPixRowBytes(self.pixmap)
width = self.videodescr['width']
height = self.videodescr['height']
start = 0
rv = []
for i in range(height)... | [
"def",
"_getpixmapcontent",
"(",
"self",
")",
":",
"rowbytes",
"=",
"Qdoffs",
".",
"GetPixRowBytes",
"(",
"self",
".",
"pixmap",
")",
"width",
"=",
"self",
".",
"videodescr",
"[",
"'width'",
"]",
"height",
"=",
"self",
".",
"videodescr",
"[",
"'height'",
... | https://github.com/wlanjie/AndroidFFmpeg/blob/7baf9122f4b8e1c74e7baf4be5c422c7a5ba5aaf/tools/fdk-aac-build/armeabi/toolchain/lib/python2.7/plat-mac/videoreader.py#L235-L246 | |
mantidproject/mantid | 03deeb89254ec4289edb8771e0188c2090a02f32 | qt/python/mantidqtinterfaces/mantidqtinterfaces/HFIR_4Circle_Reduction/fourcircle_utility.py | python | get_spice_group_name | (exp_number) | return 'HB3A_Exp{0}_SPICES'.format(exp_number) | get SPICE TableWorkspaces group name
:param exp_number:
:param scan_number:
:return: | get SPICE TableWorkspaces group name
:param exp_number:
:param scan_number:
:return: | [
"get",
"SPICE",
"TableWorkspaces",
"group",
"name",
":",
"param",
"exp_number",
":",
":",
"param",
"scan_number",
":",
":",
"return",
":"
] | def get_spice_group_name(exp_number):
"""
get SPICE TableWorkspaces group name
:param exp_number:
:param scan_number:
:return:
"""
return 'HB3A_Exp{0}_SPICES'.format(exp_number) | [
"def",
"get_spice_group_name",
"(",
"exp_number",
")",
":",
"return",
"'HB3A_Exp{0}_SPICES'",
".",
"format",
"(",
"exp_number",
")"
] | https://github.com/mantidproject/mantid/blob/03deeb89254ec4289edb8771e0188c2090a02f32/qt/python/mantidqtinterfaces/mantidqtinterfaces/HFIR_4Circle_Reduction/fourcircle_utility.py#L443-L450 | |
catboost/catboost | 167f64f237114a4d10b2b4ee42adb4569137debe | contrib/python/setuptools/py3/setuptools/_distutils/command/sdist.py | python | sdist.make_distribution | (self) | Create the source distribution(s). First, we create the release
tree with 'make_release_tree()'; then, we create all required
archive files (according to 'self.formats') from the release tree.
Finally, we clean up by blowing away the release tree (unless
'self.keep_temp' is true). The ... | Create the source distribution(s). First, we create the release
tree with 'make_release_tree()'; then, we create all required
archive files (according to 'self.formats') from the release tree.
Finally, we clean up by blowing away the release tree (unless
'self.keep_temp' is true). The ... | [
"Create",
"the",
"source",
"distribution",
"(",
"s",
")",
".",
"First",
"we",
"create",
"the",
"release",
"tree",
"with",
"make_release_tree",
"()",
";",
"then",
"we",
"create",
"all",
"required",
"archive",
"files",
"(",
"according",
"to",
"self",
".",
"f... | def make_distribution(self):
"""Create the source distribution(s). First, we create the release
tree with 'make_release_tree()'; then, we create all required
archive files (according to 'self.formats') from the release tree.
Finally, we clean up by blowing away the release tree (unless
... | [
"def",
"make_distribution",
"(",
"self",
")",
":",
"# Don't warn about missing meta-data here -- should be (and is!)",
"# done elsewhere.",
"base_dir",
"=",
"self",
".",
"distribution",
".",
"get_fullname",
"(",
")",
"base_name",
"=",
"os",
".",
"path",
".",
"join",
"... | https://github.com/catboost/catboost/blob/167f64f237114a4d10b2b4ee42adb4569137debe/contrib/python/setuptools/py3/setuptools/_distutils/command/sdist.py#L460-L488 | ||
wxWidgets/wxPython-Classic | 19571e1ae65f1ac445f5491474121998c97a1bf0 | src/gtk/dataview.py | python | DataViewTreeCtrl.GetChildCount | (*args, **kwargs) | return _dataview.DataViewTreeCtrl_GetChildCount(*args, **kwargs) | GetChildCount(self, DataViewItem parent) -> int | GetChildCount(self, DataViewItem parent) -> int | [
"GetChildCount",
"(",
"self",
"DataViewItem",
"parent",
")",
"-",
">",
"int"
] | def GetChildCount(*args, **kwargs):
"""GetChildCount(self, DataViewItem parent) -> int"""
return _dataview.DataViewTreeCtrl_GetChildCount(*args, **kwargs) | [
"def",
"GetChildCount",
"(",
"*",
"args",
",",
"*",
"*",
"kwargs",
")",
":",
"return",
"_dataview",
".",
"DataViewTreeCtrl_GetChildCount",
"(",
"*",
"args",
",",
"*",
"*",
"kwargs",
")"
] | https://github.com/wxWidgets/wxPython-Classic/blob/19571e1ae65f1ac445f5491474121998c97a1bf0/src/gtk/dataview.py#L2528-L2530 | |
Slicer/SlicerGitSVNArchive | 65e92bb16c2b32ea47a1a66bee71f238891ee1ca | Base/Python/slicer/util.py | python | loadNodeFromFile | (filename, filetype, properties={}, returnNode=False) | return loadedNode | Load node into the scene from a file.
:param filename: full path of the file to load.
:param filetype: specifies the file type, which determines which IO class will load the file.
:param properties: map containing additional parameters for the loading.
:param returnNode: Deprecated. If set to true then the meth... | Load node into the scene from a file.
:param filename: full path of the file to load.
:param filetype: specifies the file type, which determines which IO class will load the file.
:param properties: map containing additional parameters for the loading.
:param returnNode: Deprecated. If set to true then the meth... | [
"Load",
"node",
"into",
"the",
"scene",
"from",
"a",
"file",
".",
":",
"param",
"filename",
":",
"full",
"path",
"of",
"the",
"file",
"to",
"load",
".",
":",
"param",
"filetype",
":",
"specifies",
"the",
"file",
"type",
"which",
"determines",
"which",
... | def loadNodeFromFile(filename, filetype, properties={}, returnNode=False):
"""Load node into the scene from a file.
:param filename: full path of the file to load.
:param filetype: specifies the file type, which determines which IO class will load the file.
:param properties: map containing additional parameter... | [
"def",
"loadNodeFromFile",
"(",
"filename",
",",
"filetype",
",",
"properties",
"=",
"{",
"}",
",",
"returnNode",
"=",
"False",
")",
":",
"from",
"slicer",
"import",
"app",
"from",
"vtk",
"import",
"vtkCollection",
"properties",
"[",
"'fileName'",
"]",
"=",
... | https://github.com/Slicer/SlicerGitSVNArchive/blob/65e92bb16c2b32ea47a1a66bee71f238891ee1ca/Base/Python/slicer/util.py#L367-L395 | |
PixarAnimationStudios/USD | faed18ce62c8736b02413635b584a2f637156bad | pxr/usd/usdUtils/complianceChecker.py | python | BaseRuleChecker.CheckLayer | (self, layer) | Check the given SdfLayer. | Check the given SdfLayer. | [
"Check",
"the",
"given",
"SdfLayer",
"."
] | def CheckLayer(self, layer):
""" Check the given SdfLayer. """
pass | [
"def",
"CheckLayer",
"(",
"self",
",",
"layer",
")",
":",
"pass"
] | https://github.com/PixarAnimationStudios/USD/blob/faed18ce62c8736b02413635b584a2f637156bad/pxr/usd/usdUtils/complianceChecker.py#L115-L117 | ||
NVIDIA/TensorRT | 42805f078052daad1a98bc5965974fcffaad0960 | demo/BERT/helpers/tokenization.py | python | BasicTokenizer._run_strip_accents | (self, text) | return "".join(output) | Strips accents from a piece of text. | Strips accents from a piece of text. | [
"Strips",
"accents",
"from",
"a",
"piece",
"of",
"text",
"."
] | def _run_strip_accents(self, text):
"""Strips accents from a piece of text."""
text = unicodedata.normalize("NFD", text)
output = []
for char in text:
cat = unicodedata.category(char)
if cat == "Mn":
continue
output.append(char)
return "".join(output) | [
"def",
"_run_strip_accents",
"(",
"self",
",",
"text",
")",
":",
"text",
"=",
"unicodedata",
".",
"normalize",
"(",
"\"NFD\"",
",",
"text",
")",
"output",
"=",
"[",
"]",
"for",
"char",
"in",
"text",
":",
"cat",
"=",
"unicodedata",
".",
"category",
"(",... | https://github.com/NVIDIA/TensorRT/blob/42805f078052daad1a98bc5965974fcffaad0960/demo/BERT/helpers/tokenization.py#L250-L259 | |
wlanjie/AndroidFFmpeg | 7baf9122f4b8e1c74e7baf4be5c422c7a5ba5aaf | tools/fdk-aac-build/armeabi-v7a/toolchain/lib/python2.7/lib2to3/pytree.py | python | Node._prefix_getter | (self) | return self.children[0].prefix | The whitespace and comments preceding this node in the input. | The whitespace and comments preceding this node in the input. | [
"The",
"whitespace",
"and",
"comments",
"preceding",
"this",
"node",
"in",
"the",
"input",
"."
] | def _prefix_getter(self):
"""
The whitespace and comments preceding this node in the input.
"""
if not self.children:
return ""
return self.children[0].prefix | [
"def",
"_prefix_getter",
"(",
"self",
")",
":",
"if",
"not",
"self",
".",
"children",
":",
"return",
"\"\"",
"return",
"self",
".",
"children",
"[",
"0",
"]",
".",
"prefix"
] | https://github.com/wlanjie/AndroidFFmpeg/blob/7baf9122f4b8e1c74e7baf4be5c422c7a5ba5aaf/tools/fdk-aac-build/armeabi-v7a/toolchain/lib/python2.7/lib2to3/pytree.py#L308-L314 | |
GoSSIP-SJTU/TripleDoggy | 03648d6b19c812504b14e8b98c8c7b3f443f4e54 | examples/Kaleidoscope/MCJIT/lazy/genk-timing.py | python | KScriptGenerator.updateFunctionCallMap | (self, caller, callee) | Maintains a map of functions that are called from other functions | Maintains a map of functions that are called from other functions | [
"Maintains",
"a",
"map",
"of",
"functions",
"that",
"are",
"called",
"from",
"other",
"functions"
] | def updateFunctionCallMap(self, caller, callee):
"""Maintains a map of functions that are called from other functions"""
if not caller in self.calledFunctionTable:
self.calledFunctionTable[caller] = []
if not callee in self.calledFunctionTable[caller]:
self.calledFunction... | [
"def",
"updateFunctionCallMap",
"(",
"self",
",",
"caller",
",",
"callee",
")",
":",
"if",
"not",
"caller",
"in",
"self",
".",
"calledFunctionTable",
":",
"self",
".",
"calledFunctionTable",
"[",
"caller",
"]",
"=",
"[",
"]",
"if",
"not",
"callee",
"in",
... | https://github.com/GoSSIP-SJTU/TripleDoggy/blob/03648d6b19c812504b14e8b98c8c7b3f443f4e54/examples/Kaleidoscope/MCJIT/lazy/genk-timing.py#L56-L64 | ||
wxWidgets/wxPython-Classic | 19571e1ae65f1ac445f5491474121998c97a1bf0 | wx/lib/agw/supertooltip.py | python | SuperToolTip.OnWidgetEnter | (self, event) | Starts the :class:`SuperToolTip` timer for creation, handles the ``wx.EVT_ENTER_WINDOW`` event.
:param `event`: a :class:`MouseEvent` event to be processed. | Starts the :class:`SuperToolTip` timer for creation, handles the ``wx.EVT_ENTER_WINDOW`` event. | [
"Starts",
"the",
":",
"class",
":",
"SuperToolTip",
"timer",
"for",
"creation",
"handles",
"the",
"wx",
".",
"EVT_ENTER_WINDOW",
"event",
"."
] | def OnWidgetEnter(self, event):
"""
Starts the :class:`SuperToolTip` timer for creation, handles the ``wx.EVT_ENTER_WINDOW`` event.
:param `event`: a :class:`MouseEvent` event to be processed.
"""
if self._superToolTip:
# Not yet created
return
... | [
"def",
"OnWidgetEnter",
"(",
"self",
",",
"event",
")",
":",
"if",
"self",
".",
"_superToolTip",
":",
"# Not yet created",
"return",
"if",
"not",
"self",
".",
"_runningApp",
".",
"__superToolTip",
":",
"# The running app doesn't want tooltips...",
"return",
"if",
... | https://github.com/wxWidgets/wxPython-Classic/blob/19571e1ae65f1ac445f5491474121998c97a1bf0/wx/lib/agw/supertooltip.py#L840-L864 | ||
benoitsteiner/tensorflow-opencl | cb7cb40a57fde5cfd4731bc551e82a1e2fef43a5 | tensorflow/python/ops/transpose_benchmark.py | python | TransposeBenchmark._run_graph | (self, device, input_shape, perm, num_iters, datatype) | return duration | runs the graph and print its execution time.
Args:
device: String, the device to run on.
input_shape: Shape of the input tensor.
perm: A list of ints with the same length as input tensor's dimension.
num_iters: Number of iterations to run the benchmark.
datatype: numpy data type of th... | runs the graph and print its execution time. | [
"runs",
"the",
"graph",
"and",
"print",
"its",
"execution",
"time",
"."
] | def _run_graph(self, device, input_shape, perm, num_iters, datatype):
"""runs the graph and print its execution time.
Args:
device: String, the device to run on.
input_shape: Shape of the input tensor.
perm: A list of ints with the same length as input tensor's dimension.
num_iters: Num... | [
"def",
"_run_graph",
"(",
"self",
",",
"device",
",",
"input_shape",
",",
"perm",
",",
"num_iters",
",",
"datatype",
")",
":",
"graph",
"=",
"ops",
".",
"Graph",
"(",
")",
"with",
"graph",
".",
"as_default",
"(",
")",
":",
"outputs",
"=",
"build_graph"... | https://github.com/benoitsteiner/tensorflow-opencl/blob/cb7cb40a57fde5cfd4731bc551e82a1e2fef43a5/tensorflow/python/ops/transpose_benchmark.py#L65-L108 | |
Constellation/iv | 64c3a9c7c517063f29d90d449180ea8f6f4d946f | tools/cpplint.py | python | FileInfo.IsSource | (self) | return self.Extension()[1:] in ('c', 'cc', 'cpp', 'cxx') | File has a source file extension. | File has a source file extension. | [
"File",
"has",
"a",
"source",
"file",
"extension",
"."
] | def IsSource(self):
"""File has a source file extension."""
return self.Extension()[1:] in ('c', 'cc', 'cpp', 'cxx') | [
"def",
"IsSource",
"(",
"self",
")",
":",
"return",
"self",
".",
"Extension",
"(",
")",
"[",
"1",
":",
"]",
"in",
"(",
"'c'",
",",
"'cc'",
",",
"'cpp'",
",",
"'cxx'",
")"
] | https://github.com/Constellation/iv/blob/64c3a9c7c517063f29d90d449180ea8f6f4d946f/tools/cpplint.py#L944-L946 | |
apache/incubator-mxnet | f03fb23f1d103fec9541b5ae59ee06b1734a51d9 | python/mxnet/onnx/mx2onnx/_op_translations/_op_translations_opset12.py | python | convert_contrib_box_nms | (node, **kwargs) | return nodes | Map MXNet's _contrib_box_nms operator to ONNX | Map MXNet's _contrib_box_nms operator to ONNX | [
"Map",
"MXNet",
"s",
"_contrib_box_nms",
"operator",
"to",
"ONNX"
] | def convert_contrib_box_nms(node, **kwargs):
"""Map MXNet's _contrib_box_nms operator to ONNX
"""
from onnx.helper import make_node
name, input_nodes, attrs = get_inputs(node, kwargs)
input_dtypes = get_input_dtypes(node, kwargs)
dtype = input_dtypes[0]
#dtype_t = onnx.mapping.NP_TYPE_TO_TE... | [
"def",
"convert_contrib_box_nms",
"(",
"node",
",",
"*",
"*",
"kwargs",
")",
":",
"from",
"onnx",
".",
"helper",
"import",
"make_node",
"name",
",",
"input_nodes",
",",
"attrs",
"=",
"get_inputs",
"(",
"node",
",",
"kwargs",
")",
"input_dtypes",
"=",
"get_... | https://github.com/apache/incubator-mxnet/blob/f03fb23f1d103fec9541b5ae59ee06b1734a51d9/python/mxnet/onnx/mx2onnx/_op_translations/_op_translations_opset12.py#L3596-L3693 | |
aws/lumberyard | f85344403c1c2e77ec8c75deb2c116e97b713217 | dev/Gems/CloudGemMetric/v1/AWS/python/windows/Lib/dateutil/parser/isoparser.py | python | isoparser.parse_isodate | (self, datestr) | return date(*components) | Parse the date portion of an ISO string.
:param datestr:
The string portion of an ISO string, without a separator
:return:
Returns a :class:`datetime.date` object | Parse the date portion of an ISO string. | [
"Parse",
"the",
"date",
"portion",
"of",
"an",
"ISO",
"string",
"."
] | def parse_isodate(self, datestr):
"""
Parse the date portion of an ISO string.
:param datestr:
The string portion of an ISO string, without a separator
:return:
Returns a :class:`datetime.date` object
"""
components, pos = self._parse_isodate(dat... | [
"def",
"parse_isodate",
"(",
"self",
",",
"datestr",
")",
":",
"components",
",",
"pos",
"=",
"self",
".",
"_parse_isodate",
"(",
"datestr",
")",
"if",
"pos",
"<",
"len",
"(",
"datestr",
")",
":",
"raise",
"ValueError",
"(",
"'String contains unknown ISO '",... | https://github.com/aws/lumberyard/blob/f85344403c1c2e77ec8c75deb2c116e97b713217/dev/Gems/CloudGemMetric/v1/AWS/python/windows/Lib/dateutil/parser/isoparser.py#L149-L163 | |
lmb-freiburg/flownet2 | b92e198b56b0e52e1ba0a5a98dc0e39fa5ae70cc | python/caffe/io.py | python | blobprotovector_str_to_arraylist | (str) | return [blobproto_to_array(blob) for blob in vec.blobs] | Converts a serialized blobprotovec to a list of arrays. | Converts a serialized blobprotovec to a list of arrays. | [
"Converts",
"a",
"serialized",
"blobprotovec",
"to",
"a",
"list",
"of",
"arrays",
"."
] | def blobprotovector_str_to_arraylist(str):
"""Converts a serialized blobprotovec to a list of arrays.
"""
vec = caffe_pb2.BlobProtoVector()
vec.ParseFromString(str)
return [blobproto_to_array(blob) for blob in vec.blobs] | [
"def",
"blobprotovector_str_to_arraylist",
"(",
"str",
")",
":",
"vec",
"=",
"caffe_pb2",
".",
"BlobProtoVector",
"(",
")",
"vec",
".",
"ParseFromString",
"(",
"str",
")",
"return",
"[",
"blobproto_to_array",
"(",
"blob",
")",
"for",
"blob",
"in",
"vec",
"."... | https://github.com/lmb-freiburg/flownet2/blob/b92e198b56b0e52e1ba0a5a98dc0e39fa5ae70cc/python/caffe/io.py#L58-L63 | |
adobe/chromium | cfe5bf0b51b1f6b9fe239c2a3c2f2364da9967d7 | ppapi/generators/idl_gen_pnacl.py | python | PnaclGen.TypeNeedsWrapping | (self, type_node, array_dims) | return is_aggregate and not is_reference | Return true if a parameter type needs wrapping.
Currently, this is true for byval aggregates. | Return true if a parameter type needs wrapping.
Currently, this is true for byval aggregates. | [
"Return",
"true",
"if",
"a",
"parameter",
"type",
"needs",
"wrapping",
".",
"Currently",
"this",
"is",
"true",
"for",
"byval",
"aggregates",
"."
] | def TypeNeedsWrapping(self, type_node, array_dims):
"""Return true if a parameter type needs wrapping.
Currently, this is true for byval aggregates.
"""
is_aggregate = type_node.startswith('struct') or \
type_node.startswith('union')
is_reference = (type_node.find('*') != -1 or array_dims !=... | [
"def",
"TypeNeedsWrapping",
"(",
"self",
",",
"type_node",
",",
"array_dims",
")",
":",
"is_aggregate",
"=",
"type_node",
".",
"startswith",
"(",
"'struct'",
")",
"or",
"type_node",
".",
"startswith",
"(",
"'union'",
")",
"is_reference",
"=",
"(",
"type_node",... | https://github.com/adobe/chromium/blob/cfe5bf0b51b1f6b9fe239c2a3c2f2364da9967d7/ppapi/generators/idl_gen_pnacl.py#L103-L110 | |
hanpfei/chromium-net | 392cc1fa3a8f92f42e4071ab6e674d8e0482f83f | third_party/catapult/third_party/closure_linter/closure_linter/ecmametadatapass.py | python | EcmaMetaDataPass._GetOperatorType | (self, token) | return EcmaMetaData.BINARY_OPERATOR | Returns the operator type of the given operator token.
Args:
token: The token to get arity for.
Returns:
The type of the operator. One of the *_OPERATOR constants defined in
EcmaMetaData. | Returns the operator type of the given operator token. | [
"Returns",
"the",
"operator",
"type",
"of",
"the",
"given",
"operator",
"token",
"."
] | def _GetOperatorType(self, token):
"""Returns the operator type of the given operator token.
Args:
token: The token to get arity for.
Returns:
The type of the operator. One of the *_OPERATOR constants defined in
EcmaMetaData.
"""
if token.string == '?':
return EcmaMetaData... | [
"def",
"_GetOperatorType",
"(",
"self",
",",
"token",
")",
":",
"if",
"token",
".",
"string",
"==",
"'?'",
":",
"return",
"EcmaMetaData",
".",
"TERNARY_OPERATOR",
"if",
"token",
".",
"string",
"in",
"TokenType",
".",
"UNARY_OPERATORS",
":",
"return",
"EcmaMe... | https://github.com/hanpfei/chromium-net/blob/392cc1fa3a8f92f42e4071ab6e674d8e0482f83f/third_party/catapult/third_party/closure_linter/closure_linter/ecmametadatapass.py#L545-L574 | |
wlanjie/AndroidFFmpeg | 7baf9122f4b8e1c74e7baf4be5c422c7a5ba5aaf | tools/fdk-aac-build/armeabi/toolchain/lib/python2.7/decimal.py | python | Context.__repr__ | (self) | return ', '.join(s) + ')' | Show the current context. | Show the current context. | [
"Show",
"the",
"current",
"context",
"."
] | def __repr__(self):
"""Show the current context."""
s = []
s.append('Context(prec=%(prec)d, rounding=%(rounding)s, '
'Emin=%(Emin)d, Emax=%(Emax)d, capitals=%(capitals)d'
% vars(self))
names = [f.__name__ for f, v in self.flags.items() if v]
s.ap... | [
"def",
"__repr__",
"(",
"self",
")",
":",
"s",
"=",
"[",
"]",
"s",
".",
"append",
"(",
"'Context(prec=%(prec)d, rounding=%(rounding)s, '",
"'Emin=%(Emin)d, Emax=%(Emax)d, capitals=%(capitals)d'",
"%",
"vars",
"(",
"self",
")",
")",
"names",
"=",
"[",
"f",
".",
"... | https://github.com/wlanjie/AndroidFFmpeg/blob/7baf9122f4b8e1c74e7baf4be5c422c7a5ba5aaf/tools/fdk-aac-build/armeabi/toolchain/lib/python2.7/decimal.py#L3820-L3830 | |
tensorflow/tensorflow | 419e3a6b650ea4bd1b0cba23c4348f8a69f3272e | tensorflow/python/tpu/feature_column.py | python | split_sequence_columns | (feature_columns) | return sequence_columns, non_sequence_columns | Split a list of _TPUEmbeddingColumn into sequence and non-sequence columns.
For use in a TPUEstimator model_fn function. E.g.
def model_fn(features):
sequence_columns, feature_columns = (
tf.tpu.feature_column.split_sequence_columns(feature_columns))
input = tf.feature_column.input_layer(
... | Split a list of _TPUEmbeddingColumn into sequence and non-sequence columns. | [
"Split",
"a",
"list",
"of",
"_TPUEmbeddingColumn",
"into",
"sequence",
"and",
"non",
"-",
"sequence",
"columns",
"."
] | def split_sequence_columns(feature_columns):
"""Split a list of _TPUEmbeddingColumn into sequence and non-sequence columns.
For use in a TPUEstimator model_fn function. E.g.
def model_fn(features):
sequence_columns, feature_columns = (
tf.tpu.feature_column.split_sequence_columns(feature_columns))
... | [
"def",
"split_sequence_columns",
"(",
"feature_columns",
")",
":",
"sequence_columns",
"=",
"[",
"]",
"non_sequence_columns",
"=",
"[",
"]",
"for",
"column",
"in",
"feature_columns",
":",
"if",
"not",
"isinstance",
"(",
"column",
",",
"(",
"_TPUEmbeddingColumn",
... | https://github.com/tensorflow/tensorflow/blob/419e3a6b650ea4bd1b0cba23c4348f8a69f3272e/tensorflow/python/tpu/feature_column.py#L687-L719 | |
tfwu/FaceDetection-ConvNet-3D | f9251c48eb40c5aec8fba7455115c355466555be | python/build/lib.linux-x86_64-2.7/mxnet/context.py | python | cpu | (device_id=0) | return Context('cpu', device_id) | Return a CPU context.
This function is a short cut for Context('cpu', device_id)
Parameters
----------
device_id : int, optional
The device id of the device. device_id is not needed for CPU.
This is included to make interface compatible with GPU.
Returns
-------
context : ... | Return a CPU context. | [
"Return",
"a",
"CPU",
"context",
"."
] | def cpu(device_id=0):
"""Return a CPU context.
This function is a short cut for Context('cpu', device_id)
Parameters
----------
device_id : int, optional
The device id of the device. device_id is not needed for CPU.
This is included to make interface compatible with GPU.
Retur... | [
"def",
"cpu",
"(",
"device_id",
"=",
"0",
")",
":",
"return",
"Context",
"(",
"'cpu'",
",",
"device_id",
")"
] | https://github.com/tfwu/FaceDetection-ConvNet-3D/blob/f9251c48eb40c5aec8fba7455115c355466555be/python/build/lib.linux-x86_64-2.7/mxnet/context.py#L71-L87 | |
Xilinx/Vitis-AI | fc74d404563d9951b57245443c73bef389f3657f | tools/Vitis-AI-Quantizer/vai_q_tensorflow2.x/tensorflow_model_optimization/python/core/internal/tensor_encoding/core/gather_encoder.py | python | GatherEncoder.__init__ | (self, tensorspec, commuting_structure,
state_update_aggregation_modes, initial_state_fn, get_params_fn,
encode_fn, decode_before_sum_fn, decode_after_sum_fn,
update_state_fn) | Creates a `GatherEncoder` for encoding `tensorspec`-like values.
This class should not be instantiated directly. Instead, use the
provided `@classmethod`.
Args:
tensorspec: A `tf.TensorSpec`. The created `GatherEncoder` will be
constrained to only encode input values compatible with `tensors... | Creates a `GatherEncoder` for encoding `tensorspec`-like values. | [
"Creates",
"a",
"GatherEncoder",
"for",
"encoding",
"tensorspec",
"-",
"like",
"values",
"."
] | def __init__(self, tensorspec, commuting_structure,
state_update_aggregation_modes, initial_state_fn, get_params_fn,
encode_fn, decode_before_sum_fn, decode_after_sum_fn,
update_state_fn):
"""Creates a `GatherEncoder` for encoding `tensorspec`-like values.
This clas... | [
"def",
"__init__",
"(",
"self",
",",
"tensorspec",
",",
"commuting_structure",
",",
"state_update_aggregation_modes",
",",
"initial_state_fn",
",",
"get_params_fn",
",",
"encode_fn",
",",
"decode_before_sum_fn",
",",
"decode_after_sum_fn",
",",
"update_state_fn",
")",
"... | https://github.com/Xilinx/Vitis-AI/blob/fc74d404563d9951b57245443c73bef389f3657f/tools/Vitis-AI-Quantizer/vai_q_tensorflow2.x/tensorflow_model_optimization/python/core/internal/tensor_encoding/core/gather_encoder.py#L85-L119 | ||
rdkit/rdkit | ede860ae316d12d8568daf5ee800921c3389c84e | rdkit/ML/KNN/KNNRegressionModel.py | python | KNNRegressionModel.PredictExample | (self, example, appendExamples=0, weightedAverage=0, neighborList=None) | return accum | Generates a prediction for an example by looking at its closest neighbors
**Arguments**
- examples: the example to be classified
- appendExamples: if this is nonzero then the example will be stored on this model
- weightedAverage: if provided, the neighbors' contributions to the value will be
... | Generates a prediction for an example by looking at its closest neighbors | [
"Generates",
"a",
"prediction",
"for",
"an",
"example",
"by",
"looking",
"at",
"its",
"closest",
"neighbors"
] | def PredictExample(self, example, appendExamples=0, weightedAverage=0, neighborList=None):
""" Generates a prediction for an example by looking at its closest neighbors
**Arguments**
- examples: the example to be classified
- appendExamples: if this is nonzero then the example will be stored on t... | [
"def",
"PredictExample",
"(",
"self",
",",
"example",
",",
"appendExamples",
"=",
"0",
",",
"weightedAverage",
"=",
"0",
",",
"neighborList",
"=",
"None",
")",
":",
"if",
"appendExamples",
":",
"self",
".",
"_examples",
".",
"append",
"(",
"example",
")",
... | https://github.com/rdkit/rdkit/blob/ede860ae316d12d8568daf5ee800921c3389c84e/rdkit/ML/KNN/KNNRegressionModel.py#L37-L81 | |
bareos/bareos | 56a10bb368b0a81e977bb51304033fe49d59efb0 | restapi/bareos_restapi/__init__.py | python | import_volume | (
*,
response: Response,
current_user: User = Depends(get_current_user),
importParams: volumeImport = Body(..., title="Volume import parameters"),
) | return responseDict | import volumes the _import_ command | import volumes the _import_ command | [
"import",
"volumes",
"the",
"_import_",
"command"
] | def import_volume(
*,
response: Response,
current_user: User = Depends(get_current_user),
importParams: volumeImport = Body(..., title="Volume import parameters"),
):
"""
import volumes the _import_ command
"""
responseDict = {}
updateCommand = "import"
updateCommand += parseComm... | [
"def",
"import_volume",
"(",
"*",
",",
"response",
":",
"Response",
",",
"current_user",
":",
"User",
"=",
"Depends",
"(",
"get_current_user",
")",
",",
"importParams",
":",
"volumeImport",
"=",
"Body",
"(",
"...",
",",
"title",
"=",
"\"Volume import parameter... | https://github.com/bareos/bareos/blob/56a10bb368b0a81e977bb51304033fe49d59efb0/restapi/bareos_restapi/__init__.py#L1376-L1399 | |
wlanjie/AndroidFFmpeg | 7baf9122f4b8e1c74e7baf4be5c422c7a5ba5aaf | tools/fdk-aac-build/armeabi-v7a/toolchain/lib/python2.7/lib-tk/turtle.py | python | RawTurtle.clearstamp | (self, stampid) | Delete stamp with given stampid
Argument:
stampid - an integer, must be return value of previous stamp() call.
Example (for a Turtle instance named turtle):
>>> turtle.color("blue")
>>> astamp = turtle.stamp()
>>> turtle.fd(50)
>>> turtle.clearstamp(astamp) | Delete stamp with given stampid | [
"Delete",
"stamp",
"with",
"given",
"stampid"
] | def clearstamp(self, stampid):
"""Delete stamp with given stampid
Argument:
stampid - an integer, must be return value of previous stamp() call.
Example (for a Turtle instance named turtle):
>>> turtle.color("blue")
>>> astamp = turtle.stamp()
>>> turtle.fd(50)
... | [
"def",
"clearstamp",
"(",
"self",
",",
"stampid",
")",
":",
"self",
".",
"_clearstamp",
"(",
"stampid",
")",
"self",
".",
"_update",
"(",
")"
] | https://github.com/wlanjie/AndroidFFmpeg/blob/7baf9122f4b8e1c74e7baf4be5c422c7a5ba5aaf/tools/fdk-aac-build/armeabi-v7a/toolchain/lib/python2.7/lib-tk/turtle.py#L2933-L2946 | ||
oracle/graaljs | 36a56e8e993d45fc40939a3a4d9c0c24990720f1 | graal-nodejs/tools/inspector_protocol/jinja2/filters.py | python | do_rejectattr | (*args, **kwargs) | return select_or_reject(args, kwargs, lambda x: not x, True) | Filters a sequence of objects by applying a test to the specified
attribute of each object, and rejecting the objects with the test
succeeding.
If no test is specified, the attribute's value will be evaluated as
a boolean.
.. sourcecode:: jinja
{{ users|rejectattr("is_active") }}
... | Filters a sequence of objects by applying a test to the specified
attribute of each object, and rejecting the objects with the test
succeeding. | [
"Filters",
"a",
"sequence",
"of",
"objects",
"by",
"applying",
"a",
"test",
"to",
"the",
"specified",
"attribute",
"of",
"each",
"object",
"and",
"rejecting",
"the",
"objects",
"with",
"the",
"test",
"succeeding",
"."
] | def do_rejectattr(*args, **kwargs):
"""Filters a sequence of objects by applying a test to the specified
attribute of each object, and rejecting the objects with the test
succeeding.
If no test is specified, the attribute's value will be evaluated as
a boolean.
.. sourcecode:: jinja
{... | [
"def",
"do_rejectattr",
"(",
"*",
"args",
",",
"*",
"*",
"kwargs",
")",
":",
"return",
"select_or_reject",
"(",
"args",
",",
"kwargs",
",",
"lambda",
"x",
":",
"not",
"x",
",",
"True",
")"
] | https://github.com/oracle/graaljs/blob/36a56e8e993d45fc40939a3a4d9c0c24990720f1/graal-nodejs/tools/inspector_protocol/jinja2/filters.py#L1028-L1043 | |
catboost/catboost | 167f64f237114a4d10b2b4ee42adb4569137debe | contrib/tools/python/src/Lib/plat-mac/macostools.py | python | copytree | (src, dst, copydates=1) | Copy a complete file tree to a new destination | Copy a complete file tree to a new destination | [
"Copy",
"a",
"complete",
"file",
"tree",
"to",
"a",
"new",
"destination"
] | def copytree(src, dst, copydates=1):
"""Copy a complete file tree to a new destination"""
if os.path.isdir(src):
mkdirs(dst)
files = os.listdir(src)
for f in files:
copytree(os.path.join(src, f), os.path.join(dst, f), copydates)
else:
copy(src, dst, 1, copydates) | [
"def",
"copytree",
"(",
"src",
",",
"dst",
",",
"copydates",
"=",
"1",
")",
":",
"if",
"os",
".",
"path",
".",
"isdir",
"(",
"src",
")",
":",
"mkdirs",
"(",
"dst",
")",
"files",
"=",
"os",
".",
"listdir",
"(",
"src",
")",
"for",
"f",
"in",
"f... | https://github.com/catboost/catboost/blob/167f64f237114a4d10b2b4ee42adb4569137debe/contrib/tools/python/src/Lib/plat-mac/macostools.py#L130-L138 | ||
tensorflow/tensorflow | 419e3a6b650ea4bd1b0cba23c4348f8a69f3272e | tensorflow/python/framework/op_callbacks.py | python | should_invoke_op_callbacks | () | return ctx.op_callbacks and not ctx.invoking_op_callbacks | Determine if op callbacks are present and should be invoked.
Returns:
A thread-local result (boolean) indicating whether any op callback(s) exist
and should be invoked. | Determine if op callbacks are present and should be invoked. | [
"Determine",
"if",
"op",
"callbacks",
"are",
"present",
"and",
"should",
"be",
"invoked",
"."
] | def should_invoke_op_callbacks():
"""Determine if op callbacks are present and should be invoked.
Returns:
A thread-local result (boolean) indicating whether any op callback(s) exist
and should be invoked.
"""
ctx = context.context()
return ctx.op_callbacks and not ctx.invoking_op_callbacks | [
"def",
"should_invoke_op_callbacks",
"(",
")",
":",
"ctx",
"=",
"context",
".",
"context",
"(",
")",
"return",
"ctx",
".",
"op_callbacks",
"and",
"not",
"ctx",
".",
"invoking_op_callbacks"
] | https://github.com/tensorflow/tensorflow/blob/419e3a6b650ea4bd1b0cba23c4348f8a69f3272e/tensorflow/python/framework/op_callbacks.py#L114-L122 | |
google/syzygy | 8164b24ebde9c5649c9a09e88a7fc0b0fcbd1bc5 | third_party/numpy/files/numpy/ma/mrecords.py | python | MaskedRecords.__getitem__ | (self, indx) | return obj | Returns all the fields sharing the same fieldname base.
The fieldname base is either `_data` or `_mask`. | Returns all the fields sharing the same fieldname base.
The fieldname base is either `_data` or `_mask`. | [
"Returns",
"all",
"the",
"fields",
"sharing",
"the",
"same",
"fieldname",
"base",
".",
"The",
"fieldname",
"base",
"is",
"either",
"_data",
"or",
"_mask",
"."
] | def __getitem__(self, indx):
"""Returns all the fields sharing the same fieldname base.
The fieldname base is either `_data` or `_mask`."""
_localdict = self.__dict__
_mask = ndarray.__getattribute__(self, '_mask')
_data = ndarray.view(self, _localdict['_baseclass'])
# We want a ... | [
"def",
"__getitem__",
"(",
"self",
",",
"indx",
")",
":",
"_localdict",
"=",
"self",
".",
"__dict__",
"_mask",
"=",
"ndarray",
".",
"__getattribute__",
"(",
"self",
",",
"'_mask'",
")",
"_data",
"=",
"ndarray",
".",
"view",
"(",
"self",
",",
"_localdict"... | https://github.com/google/syzygy/blob/8164b24ebde9c5649c9a09e88a7fc0b0fcbd1bc5/third_party/numpy/files/numpy/ma/mrecords.py#L289-L315 | |
facebookincubator/BOLT | 88c70afe9d388ad430cc150cc158641701397f70 | llvm/utils/lit/lit/discovery.py | python | find_tests_for_inputs | (lit_config, inputs, indirectlyRunCheck) | return tests | find_tests_for_inputs(lit_config, inputs) -> [Test]
Given a configuration object and a list of input specifiers, find all the
tests to execute. | find_tests_for_inputs(lit_config, inputs) -> [Test] | [
"find_tests_for_inputs",
"(",
"lit_config",
"inputs",
")",
"-",
">",
"[",
"Test",
"]"
] | def find_tests_for_inputs(lit_config, inputs, indirectlyRunCheck):
"""
find_tests_for_inputs(lit_config, inputs) -> [Test]
Given a configuration object and a list of input specifiers, find all the
tests to execute.
"""
# Expand '@...' form in inputs.
actual_inputs = []
for input in inp... | [
"def",
"find_tests_for_inputs",
"(",
"lit_config",
",",
"inputs",
",",
"indirectlyRunCheck",
")",
":",
"# Expand '@...' form in inputs.",
"actual_inputs",
"=",
"[",
"]",
"for",
"input",
"in",
"inputs",
":",
"if",
"input",
".",
"startswith",
"(",
"'@'",
")",
":",... | https://github.com/facebookincubator/BOLT/blob/88c70afe9d388ad430cc150cc158641701397f70/llvm/utils/lit/lit/discovery.py#L249-L294 | |
baidu-research/tensorflow-allreduce | 66d5b855e90b0949e9fa5cca5599fd729a70e874 | tensorflow/contrib/learn/python/learn/estimators/run_config.py | python | _count_worker | (cluster_spec) | return len(cluster_spec.as_dict().get('worker', [])) if cluster_spec else 0 | Counts the number of workers in cluster_spec. | Counts the number of workers in cluster_spec. | [
"Counts",
"the",
"number",
"of",
"workers",
"in",
"cluster_spec",
"."
] | def _count_worker(cluster_spec):
"""Counts the number of workers in cluster_spec."""
return len(cluster_spec.as_dict().get('worker', [])) if cluster_spec else 0 | [
"def",
"_count_worker",
"(",
"cluster_spec",
")",
":",
"return",
"len",
"(",
"cluster_spec",
".",
"as_dict",
"(",
")",
".",
"get",
"(",
"'worker'",
",",
"[",
"]",
")",
")",
"if",
"cluster_spec",
"else",
"0"
] | https://github.com/baidu-research/tensorflow-allreduce/blob/66d5b855e90b0949e9fa5cca5599fd729a70e874/tensorflow/contrib/learn/python/learn/estimators/run_config.py#L385-L387 | |
albertz/openlierox | d316c14a8eb57848ef56e9bfa7b23a56f694a51b | tools/DedicatedServerVideo/gdata/Crypto/PublicKey/RSA.py | python | RSAobj.has_private | (self) | has_private() : bool
Return a Boolean denoting whether the object contains
private components. | has_private() : bool
Return a Boolean denoting whether the object contains
private components. | [
"has_private",
"()",
":",
"bool",
"Return",
"a",
"Boolean",
"denoting",
"whether",
"the",
"object",
"contains",
"private",
"components",
"."
] | def has_private(self):
"""has_private() : bool
Return a Boolean denoting whether the object contains
private components.
"""
if hasattr(self, 'd'):
return 1
else: return 0 | [
"def",
"has_private",
"(",
"self",
")",
":",
"if",
"hasattr",
"(",
"self",
",",
"'d'",
")",
":",
"return",
"1",
"else",
":",
"return",
"0"
] | https://github.com/albertz/openlierox/blob/d316c14a8eb57848ef56e9bfa7b23a56f694a51b/tools/DedicatedServerVideo/gdata/Crypto/PublicKey/RSA.py#L131-L138 | ||
microsoft/CNTK | e9396480025b9ca457d26b6f33dd07c474c6aa04 | bindings/python/cntk/logging/graph.py | python | find_by_name | (node, node_name, depth=0) | return result[0] | Finds a function in the graph starting from ``node`` and doing a depth-first
search. It assumes that the name occurs only once.
Args:
node (:class:`~cntk.ops.functions.Function` or :class:`~cntk.variables.Variable`): the node to start the journey from
node_name (`str`): name for which we are se... | Finds a function in the graph starting from ``node`` and doing a depth-first
search. It assumes that the name occurs only once. | [
"Finds",
"a",
"function",
"in",
"the",
"graph",
"starting",
"from",
"node",
"and",
"doing",
"a",
"depth",
"-",
"first",
"search",
".",
"It",
"assumes",
"that",
"the",
"name",
"occurs",
"only",
"once",
"."
] | def find_by_name(node, node_name, depth=0):
'''
Finds a function in the graph starting from ``node`` and doing a depth-first
search. It assumes that the name occurs only once.
Args:
node (:class:`~cntk.ops.functions.Function` or :class:`~cntk.variables.Variable`): the node to start the journey ... | [
"def",
"find_by_name",
"(",
"node",
",",
"node_name",
",",
"depth",
"=",
"0",
")",
":",
"if",
"not",
"isinstance",
"(",
"node_name",
",",
"str",
")",
":",
"raise",
"ValueError",
"(",
"'node name has to be a string. You gave '",
"'a %s'",
"%",
"type",
"(",
"n... | https://github.com/microsoft/CNTK/blob/e9396480025b9ca457d26b6f33dd07c474c6aa04/bindings/python/cntk/logging/graph.py#L99-L132 | |
catboost/catboost | 167f64f237114a4d10b2b4ee42adb4569137debe | contrib/python/numpy/py3/numpy/core/fromnumeric.py | python | round_ | (a, decimals=0, out=None) | return around(a, decimals=decimals, out=out) | Round an array to the given number of decimals.
See Also
--------
around : equivalent function; see for details. | Round an array to the given number of decimals. | [
"Round",
"an",
"array",
"to",
"the",
"given",
"number",
"of",
"decimals",
"."
] | def round_(a, decimals=0, out=None):
"""
Round an array to the given number of decimals.
See Also
--------
around : equivalent function; see for details.
"""
return around(a, decimals=decimals, out=out) | [
"def",
"round_",
"(",
"a",
",",
"decimals",
"=",
"0",
",",
"out",
"=",
"None",
")",
":",
"return",
"around",
"(",
"a",
",",
"decimals",
"=",
"decimals",
",",
"out",
"=",
"out",
")"
] | https://github.com/catboost/catboost/blob/167f64f237114a4d10b2b4ee42adb4569137debe/contrib/python/numpy/py3/numpy/core/fromnumeric.py#L3731-L3739 | |
catboost/catboost | 167f64f237114a4d10b2b4ee42adb4569137debe | contrib/python/numpy/py2/numpy/core/_internal.py | python | _ctypes._as_parameter_ | (self) | return self.data_as(ctypes.c_void_p) | Overrides the ctypes semi-magic method
Enables `c_func(some_array.ctypes)` | Overrides the ctypes semi-magic method | [
"Overrides",
"the",
"ctypes",
"semi",
"-",
"magic",
"method"
] | def _as_parameter_(self):
"""
Overrides the ctypes semi-magic method
Enables `c_func(some_array.ctypes)`
"""
return self.data_as(ctypes.c_void_p) | [
"def",
"_as_parameter_",
"(",
"self",
")",
":",
"return",
"self",
".",
"data_as",
"(",
"ctypes",
".",
"c_void_p",
")"
] | https://github.com/catboost/catboost/blob/167f64f237114a4d10b2b4ee42adb4569137debe/contrib/python/numpy/py2/numpy/core/_internal.py#L348-L354 | |
gem5/gem5 | 141cc37c2d4b93959d4c249b8f7e6a8b2ef75338 | src/python/m5/ext/pyfdt/pyfdt.py | python | FdtProperty.new_raw_property | (name, raw_value) | Instantiate property with raw value type | Instantiate property with raw value type | [
"Instantiate",
"property",
"with",
"raw",
"value",
"type"
] | def new_raw_property(name, raw_value):
"""Instantiate property with raw value type"""
if FdtProperty.__check_prop_strings(raw_value):
return FdtPropertyStrings.init_raw(name, raw_value)
elif len(raw_value) and len(raw_value) % 4 == 0:
return FdtPropertyWords.init_raw(name... | [
"def",
"new_raw_property",
"(",
"name",
",",
"raw_value",
")",
":",
"if",
"FdtProperty",
".",
"__check_prop_strings",
"(",
"raw_value",
")",
":",
"return",
"FdtPropertyStrings",
".",
"init_raw",
"(",
"name",
",",
"raw_value",
")",
"elif",
"len",
"(",
"raw_valu... | https://github.com/gem5/gem5/blob/141cc37c2d4b93959d4c249b8f7e6a8b2ef75338/src/python/m5/ext/pyfdt/pyfdt.py#L147-L156 | ||
musescore/MuseScore | a817fea23e3c2be30847b7fde5b01746222c252e | tools/crashdump/win/generate_breakpad_symbols.py | python | GenerateSymbols | (options, binaries) | Dumps the symbols of binary and places them in the given directory. | Dumps the symbols of binary and places them in the given directory. | [
"Dumps",
"the",
"symbols",
"of",
"binary",
"and",
"places",
"them",
"in",
"the",
"given",
"directory",
"."
] | def GenerateSymbols(options, binaries):
"""Dumps the symbols of binary and places them in the given directory."""
q = queue.Queue()
print_lock = threading.Lock()
def _Worker():
dump_syms = options.dumpsyms_bin
while True:
binary = q.get()
if options.verbose:
with print_lock:
... | [
"def",
"GenerateSymbols",
"(",
"options",
",",
"binaries",
")",
":",
"q",
"=",
"queue",
".",
"Queue",
"(",
")",
"print_lock",
"=",
"threading",
".",
"Lock",
"(",
")",
"def",
"_Worker",
"(",
")",
":",
"dump_syms",
"=",
"options",
".",
"dumpsyms_bin",
"w... | https://github.com/musescore/MuseScore/blob/a817fea23e3c2be30847b7fde5b01746222c252e/tools/crashdump/win/generate_breakpad_symbols.py#L56-L97 | ||
hanpfei/chromium-net | 392cc1fa3a8f92f42e4071ab6e674d8e0482f83f | third_party/catapult/telemetry/third_party/web-page-replay/third_party/dns/rdtypes/ANY/LOC.py | python | LOC.__init__ | (self, rdclass, rdtype, latitude, longitude, altitude,
size=1.0, hprec=10000.0, vprec=10.0) | Initialize a LOC record instance.
The parameters I{latitude} and I{longitude} may be either a 4-tuple
of integers specifying (degrees, minutes, seconds, milliseconds),
or they may be floating point values specifying the number of
degrees. The other parameters are floats. | Initialize a LOC record instance. | [
"Initialize",
"a",
"LOC",
"record",
"instance",
"."
] | def __init__(self, rdclass, rdtype, latitude, longitude, altitude,
size=1.0, hprec=10000.0, vprec=10.0):
"""Initialize a LOC record instance.
The parameters I{latitude} and I{longitude} may be either a 4-tuple
of integers specifying (degrees, minutes, seconds, milliseconds),
... | [
"def",
"__init__",
"(",
"self",
",",
"rdclass",
",",
"rdtype",
",",
"latitude",
",",
"longitude",
",",
"altitude",
",",
"size",
"=",
"1.0",
",",
"hprec",
"=",
"10000.0",
",",
"vprec",
"=",
"10.0",
")",
":",
"super",
"(",
"LOC",
",",
"self",
")",
".... | https://github.com/hanpfei/chromium-net/blob/392cc1fa3a8f92f42e4071ab6e674d8e0482f83f/third_party/catapult/telemetry/third_party/web-page-replay/third_party/dns/rdtypes/ANY/LOC.py#L100-L123 | ||
catboost/catboost | 167f64f237114a4d10b2b4ee42adb4569137debe | contrib/python/more-itertools/py2/more_itertools/more.py | python | split_into | (iterable, sizes) | Yield a list of sequential items from *iterable* of length 'n' for each
integer 'n' in *sizes*.
>>> list(split_into([1,2,3,4,5,6], [1,2,3]))
[[1], [2, 3], [4, 5, 6]]
If the sum of *sizes* is smaller than the length of *iterable*, then the
remaining items of *iterable* will not be returned.... | Yield a list of sequential items from *iterable* of length 'n' for each
integer 'n' in *sizes*. | [
"Yield",
"a",
"list",
"of",
"sequential",
"items",
"from",
"*",
"iterable",
"*",
"of",
"length",
"n",
"for",
"each",
"integer",
"n",
"in",
"*",
"sizes",
"*",
"."
] | def split_into(iterable, sizes):
"""Yield a list of sequential items from *iterable* of length 'n' for each
integer 'n' in *sizes*.
>>> list(split_into([1,2,3,4,5,6], [1,2,3]))
[[1], [2, 3], [4, 5, 6]]
If the sum of *sizes* is smaller than the length of *iterable*, then the
remaining i... | [
"def",
"split_into",
"(",
"iterable",
",",
"sizes",
")",
":",
"# convert the iterable argument into an iterator so its contents can",
"# be consumed by islice in case it is a generator",
"it",
"=",
"iter",
"(",
"iterable",
")",
"for",
"size",
"in",
"sizes",
":",
"if",
"si... | https://github.com/catboost/catboost/blob/167f64f237114a4d10b2b4ee42adb4569137debe/contrib/python/more-itertools/py2/more_itertools/more.py#L1074-L1116 | ||
vesoft-inc/nebula | 25a06217ebaf169e1f0e5ff6a797ba6f0c41fc35 | .linters/cpp/cpplint.py | python | ProcessGlobalSuppressions | (lines) | Updates the list of global error suppressions.
Parses any lint directives in the file that have global effect.
Args:
lines: An array of strings, each representing a line of the file, with the
last element being empty if the file is terminated with a newline. | Updates the list of global error suppressions. | [
"Updates",
"the",
"list",
"of",
"global",
"error",
"suppressions",
"."
] | def ProcessGlobalSuppressions(lines):
"""Updates the list of global error suppressions.
Parses any lint directives in the file that have global effect.
Args:
lines: An array of strings, each representing a line of the file, with the
last element being empty if the file is terminated with a newlin... | [
"def",
"ProcessGlobalSuppressions",
"(",
"lines",
")",
":",
"for",
"line",
"in",
"lines",
":",
"if",
"_SEARCH_C_FILE",
".",
"search",
"(",
"line",
")",
":",
"for",
"category",
"in",
"_DEFAULT_C_SUPPRESSED_CATEGORIES",
":",
"_global_error_suppressions",
"[",
"categ... | https://github.com/vesoft-inc/nebula/blob/25a06217ebaf169e1f0e5ff6a797ba6f0c41fc35/.linters/cpp/cpplint.py#L755-L770 | ||
panda3d/panda3d | 833ad89ebad58395d0af0b7ec08538e5e4308265 | direct/src/distributed/ClockDelta.py | python | ClockDelta.__resetClock | (self, timeDelta) | this is called when the global clock gets adjusted
timeDelta is equal to the amount of time, in seconds,
that has been added to the global clock | this is called when the global clock gets adjusted
timeDelta is equal to the amount of time, in seconds,
that has been added to the global clock | [
"this",
"is",
"called",
"when",
"the",
"global",
"clock",
"gets",
"adjusted",
"timeDelta",
"is",
"equal",
"to",
"the",
"amount",
"of",
"time",
"in",
"seconds",
"that",
"has",
"been",
"added",
"to",
"the",
"global",
"clock"
] | def __resetClock(self, timeDelta):
"""
this is called when the global clock gets adjusted
timeDelta is equal to the amount of time, in seconds,
that has been added to the global clock
"""
assert self.notify.debug(
"adjusting timebase by %f seconds" % timeDelta... | [
"def",
"__resetClock",
"(",
"self",
",",
"timeDelta",
")",
":",
"assert",
"self",
".",
"notify",
".",
"debug",
"(",
"\"adjusting timebase by %f seconds\"",
"%",
"timeDelta",
")",
"# adjust our timebase by the same amount",
"self",
".",
"delta",
"+=",
"timeDelta"
] | https://github.com/panda3d/panda3d/blob/833ad89ebad58395d0af0b7ec08538e5e4308265/direct/src/distributed/ClockDelta.py#L93-L102 | ||
eventql/eventql | 7ca0dbb2e683b525620ea30dc40540a22d5eb227 | deps/3rdparty/spidermonkey/mozjs/python/mozbuild/mozbuild/makeutil.py | python | Rule.targets | (self) | return iter(self._targets) | Return an iterator on the rule targets. | Return an iterator on the rule targets. | [
"Return",
"an",
"iterator",
"on",
"the",
"rule",
"targets",
"."
] | def targets(self):
'''Return an iterator on the rule targets.'''
# Ensure the returned iterator is actually just that, an iterator.
# Avoids caller fiddling with the set itself.
return iter(self._targets) | [
"def",
"targets",
"(",
"self",
")",
":",
"# Ensure the returned iterator is actually just that, an iterator.",
"# Avoids caller fiddling with the set itself.",
"return",
"iter",
"(",
"self",
".",
"_targets",
")"
] | https://github.com/eventql/eventql/blob/7ca0dbb2e683b525620ea30dc40540a22d5eb227/deps/3rdparty/spidermonkey/mozjs/python/mozbuild/mozbuild/makeutil.py#L120-L124 | |
windystrife/UnrealEngine_NVIDIAGameWorks | b50e6338a7c5b26374d66306ebc7807541ff815e | Engine/Extras/ThirdPartyNotUE/emsdk/Win64/python/2.7.5.3_64bit/Lib/traceback.py | python | extract_stack | (f=None, limit = None) | return list | Extract the raw traceback from the current stack frame.
The return value has the same format as for extract_tb(). The
optional 'f' and 'limit' arguments have the same meaning as for
print_stack(). Each item in the list is a quadruple (filename,
line number, function name, text), and the entries are i... | Extract the raw traceback from the current stack frame. | [
"Extract",
"the",
"raw",
"traceback",
"from",
"the",
"current",
"stack",
"frame",
"."
] | def extract_stack(f=None, limit = None):
"""Extract the raw traceback from the current stack frame.
The return value has the same format as for extract_tb(). The
optional 'f' and 'limit' arguments have the same meaning as for
print_stack(). Each item in the list is a quadruple (filename,
line num... | [
"def",
"extract_stack",
"(",
"f",
"=",
"None",
",",
"limit",
"=",
"None",
")",
":",
"if",
"f",
"is",
"None",
":",
"try",
":",
"raise",
"ZeroDivisionError",
"except",
"ZeroDivisionError",
":",
"f",
"=",
"sys",
".",
"exc_info",
"(",
")",
"[",
"2",
"]",... | https://github.com/windystrife/UnrealEngine_NVIDIAGameWorks/blob/b50e6338a7c5b26374d66306ebc7807541ff815e/Engine/Extras/ThirdPartyNotUE/emsdk/Win64/python/2.7.5.3_64bit/Lib/traceback.py#L280-L312 | |
HKUST-Aerial-Robotics/Fast-Planner | 2ddd7793eecd573dbb5b47e2c985aa06606df3cf | uav_simulator/Utils/quadrotor_msgs/src/quadrotor_msgs/msg/_OutputData.py | python | OutputData.serialize_numpy | (self, buff, numpy) | serialize message with numpy array types into buffer
:param buff: buffer, ``StringIO``
:param numpy: numpy python module | serialize message with numpy array types into buffer
:param buff: buffer, ``StringIO``
:param numpy: numpy python module | [
"serialize",
"message",
"with",
"numpy",
"array",
"types",
"into",
"buffer",
":",
"param",
"buff",
":",
"buffer",
"StringIO",
":",
"param",
"numpy",
":",
"numpy",
"python",
"module"
] | def serialize_numpy(self, buff, numpy):
"""
serialize message with numpy array types into buffer
:param buff: buffer, ``StringIO``
:param numpy: numpy python module
"""
try:
_x = self
buff.write(_struct_3I.pack(_x.header.seq, _x.header.stamp.secs, _x.header.stamp.nsecs))
_x = s... | [
"def",
"serialize_numpy",
"(",
"self",
",",
"buff",
",",
"numpy",
")",
":",
"try",
":",
"_x",
"=",
"self",
"buff",
".",
"write",
"(",
"_struct_3I",
".",
"pack",
"(",
"_x",
".",
"header",
".",
"seq",
",",
"_x",
".",
"header",
".",
"stamp",
".",
"s... | https://github.com/HKUST-Aerial-Robotics/Fast-Planner/blob/2ddd7793eecd573dbb5b47e2c985aa06606df3cf/uav_simulator/Utils/quadrotor_msgs/src/quadrotor_msgs/msg/_OutputData.py#L197-L225 | ||
mindspore-ai/mindspore | fb8fd3338605bb34fa5cea054e535a8b1d753fab | mindspore/python/mindspore/ops/op_info_register.py | python | TBERegOp.compute_cost | (self, compute_cost=10) | return self | Define the calculation efficiency of operator, which refers to the value of the cost model
in the tiling module.
Args:
compute_cost (int): Value of compute cost. Default: 10. | Define the calculation efficiency of operator, which refers to the value of the cost model
in the tiling module. | [
"Define",
"the",
"calculation",
"efficiency",
"of",
"operator",
"which",
"refers",
"to",
"the",
"value",
"of",
"the",
"cost",
"model",
"in",
"the",
"tiling",
"module",
"."
] | def compute_cost(self, compute_cost=10):
"""
Define the calculation efficiency of operator, which refers to the value of the cost model
in the tiling module.
Args:
compute_cost (int): Value of compute cost. Default: 10.
"""
self._is_int(compute_cost)
... | [
"def",
"compute_cost",
"(",
"self",
",",
"compute_cost",
"=",
"10",
")",
":",
"self",
".",
"_is_int",
"(",
"compute_cost",
")",
"self",
".",
"compute_cost_",
"=",
"compute_cost",
"return",
"self"
] | https://github.com/mindspore-ai/mindspore/blob/fb8fd3338605bb34fa5cea054e535a8b1d753fab/mindspore/python/mindspore/ops/op_info_register.py#L511-L521 | |
etternagame/etterna | 8775f74ac9c353320128609d4b4150672e9a6d04 | extern/crashpad/crashpad/third_party/mini_chromium/mini_chromium/build/win_helper.py | python | _GenerateEnvironmentFiles | (install_dir, out_dir, script_path) | return result | It's not sufficient to have the absolute path to the compiler, linker, etc.
on Windows, as those tools rely on .dlls being in the PATH. We also need to
support both x86 and x64 compilers. Different architectures require a
different compiler binary, and different supporting environment variables
(INCLUDE, LIB, L... | It's not sufficient to have the absolute path to the compiler, linker, etc.
on Windows, as those tools rely on .dlls being in the PATH. We also need to
support both x86 and x64 compilers. Different architectures require a
different compiler binary, and different supporting environment variables
(INCLUDE, LIB, L... | [
"It",
"s",
"not",
"sufficient",
"to",
"have",
"the",
"absolute",
"path",
"to",
"the",
"compiler",
"linker",
"etc",
".",
"on",
"Windows",
"as",
"those",
"tools",
"rely",
"on",
".",
"dlls",
"being",
"in",
"the",
"PATH",
".",
"We",
"also",
"need",
"to",
... | def _GenerateEnvironmentFiles(install_dir, out_dir, script_path):
"""It's not sufficient to have the absolute path to the compiler, linker, etc.
on Windows, as those tools rely on .dlls being in the PATH. We also need to
support both x86 and x64 compilers. Different architectures require a
different compiler bi... | [
"def",
"_GenerateEnvironmentFiles",
"(",
"install_dir",
",",
"out_dir",
",",
"script_path",
")",
":",
"archs",
"=",
"(",
"'x86'",
",",
"'amd64'",
",",
"'arm64'",
")",
"result",
"=",
"[",
"]",
"for",
"arch",
"in",
"archs",
":",
"# Extract environment variables ... | https://github.com/etternagame/etterna/blob/8775f74ac9c353320128609d4b4150672e9a6d04/extern/crashpad/crashpad/third_party/mini_chromium/mini_chromium/build/win_helper.py#L71-L104 | |
freeorion/freeorion | c266a40eccd3a99a17de8fe57c36ef6ba3771665 | default/python/AI/ShipDesignAI.py | python | ShipDesignCache._check_cache_for_consistency | (self) | Check if the persistent cache is consistent with the gamestate and fix it if not.
This function should be called once at the beginning of the turn (before update_shipdesign_cache()).
Especially (only?) in multiplayer games, the shipDesignIDs may sometimes change across turns. | Check if the persistent cache is consistent with the gamestate and fix it if not. | [
"Check",
"if",
"the",
"persistent",
"cache",
"is",
"consistent",
"with",
"the",
"gamestate",
"and",
"fix",
"it",
"if",
"not",
"."
] | def _check_cache_for_consistency(self):
"""Check if the persistent cache is consistent with the gamestate and fix it if not.
This function should be called once at the beginning of the turn (before update_shipdesign_cache()).
Especially (only?) in multiplayer games, the shipDesignIDs may someti... | [
"def",
"_check_cache_for_consistency",
"(",
"self",
")",
":",
"debug",
"(",
"\"Checking persistent cache for consistency...\"",
")",
"try",
":",
"for",
"partname",
"in",
"self",
".",
"part_by_partname",
":",
"cached_name",
"=",
"self",
".",
"part_by_partname",
"[",
... | https://github.com/freeorion/freeorion/blob/c266a40eccd3a99a17de8fe57c36ef6ba3771665/default/python/AI/ShipDesignAI.py#L329-L393 | ||
wlanjie/AndroidFFmpeg | 7baf9122f4b8e1c74e7baf4be5c422c7a5ba5aaf | tools/fdk-aac-build/armeabi-v7a/toolchain/lib/python2.7/logging/__init__.py | python | LoggerAdapter.info | (self, msg, *args, **kwargs) | Delegate an info call to the underlying logger, after adding
contextual information from this adapter instance. | Delegate an info call to the underlying logger, after adding
contextual information from this adapter instance. | [
"Delegate",
"an",
"info",
"call",
"to",
"the",
"underlying",
"logger",
"after",
"adding",
"contextual",
"information",
"from",
"this",
"adapter",
"instance",
"."
] | def info(self, msg, *args, **kwargs):
"""
Delegate an info call to the underlying logger, after adding
contextual information from this adapter instance.
"""
msg, kwargs = self.process(msg, kwargs)
self.logger.info(msg, *args, **kwargs) | [
"def",
"info",
"(",
"self",
",",
"msg",
",",
"*",
"args",
",",
"*",
"*",
"kwargs",
")",
":",
"msg",
",",
"kwargs",
"=",
"self",
".",
"process",
"(",
"msg",
",",
"kwargs",
")",
"self",
".",
"logger",
".",
"info",
"(",
"msg",
",",
"*",
"args",
... | https://github.com/wlanjie/AndroidFFmpeg/blob/7baf9122f4b8e1c74e7baf4be5c422c7a5ba5aaf/tools/fdk-aac-build/armeabi-v7a/toolchain/lib/python2.7/logging/__init__.py#L1424-L1430 | ||
mantidproject/mantid | 03deeb89254ec4289edb8771e0188c2090a02f32 | scripts/SANS/isis_reduction_steps.py | python | DarkRunSubtraction._get_dark_run_name_and_path | (self, setting) | return dark_run_ws_name, dark_run_file_path | @param settings: a dark run settings tuple
@returns a dark run workspace name and the dark run path
@raises RuntimeError: if there is an issue with loading the workspace | [] | def _get_dark_run_name_and_path(self, setting):
'''
@param settings: a dark run settings tuple
@returns a dark run workspace name and the dark run path
@raises RuntimeError: if there is an issue with loading the workspace
'''
dark_run_ws_name = None
dark_run_file_... | [
"def",
"_get_dark_run_name_and_path",
"(",
"self",
",",
"setting",
")",
":",
"dark_run_ws_name",
"=",
"None",
"dark_run_file_path",
"=",
"None",
"try",
":",
"dark_run_file_path",
",",
"dark_run_ws_name",
"=",
"getFileAndName",
"(",
"setting",
".",
"run_number",
")",... | https://github.com/mantidproject/mantid/blob/03deeb89254ec4289edb8771e0188c2090a02f32/scripts/SANS/isis_reduction_steps.py#L1533-L1547 | ||
mindspore-ai/mindspore | fb8fd3338605bb34fa5cea054e535a8b1d753fab | mindspore/lite/tools/dataset/cropper/cropper_configure.py | python | get_all_dependencies_of_file | (headers_flag, filename) | return list(processed_cc), "".join(errors) | Create dependency list for a file (incl. all source files needed).
:param headers_flag: string containing headers include paths with -I prepended to them.
:param filename: a string containing path of a file.
:return: all dependencies of that file and the error string | Create dependency list for a file (incl. all source files needed). | [
"Create",
"dependency",
"list",
"for",
"a",
"file",
"(",
"incl",
".",
"all",
"source",
"files",
"needed",
")",
"."
] | def get_all_dependencies_of_file(headers_flag, filename):
"""
Create dependency list for a file (incl. all source files needed).
:param headers_flag: string containing headers include paths with -I prepended to them.
:param filename: a string containing path of a file.
:return: all dependencies of ... | [
"def",
"get_all_dependencies_of_file",
"(",
"headers_flag",
",",
"filename",
")",
":",
"errors",
"=",
"[",
"]",
"# a queue to process files",
"queue_cc",
"=",
"queue",
".",
"SimpleQueue",
"(",
")",
"# a set of items that have ever been in queue_cc (faster access time)",
"qu... | https://github.com/mindspore-ai/mindspore/blob/fb8fd3338605bb34fa5cea054e535a8b1d753fab/mindspore/lite/tools/dataset/cropper/cropper_configure.py#L241-L280 | |
aws/lumberyard | f85344403c1c2e77ec8c75deb2c116e97b713217 | dev/Tools/Python/3.7.10/linux_x64/lib/python3.7/site-packages/pip/_vendor/urllib3/packages/six.py | python | ensure_binary | (s, encoding="utf-8", errors="strict") | Coerce **s** to six.binary_type.
For Python 2:
- `unicode` -> encoded to `str`
- `str` -> `str`
For Python 3:
- `str` -> encoded to `bytes`
- `bytes` -> `bytes` | Coerce **s** to six.binary_type. | [
"Coerce",
"**",
"s",
"**",
"to",
"six",
".",
"binary_type",
"."
] | def ensure_binary(s, encoding="utf-8", errors="strict"):
"""Coerce **s** to six.binary_type.
For Python 2:
- `unicode` -> encoded to `str`
- `str` -> `str`
For Python 3:
- `str` -> encoded to `bytes`
- `bytes` -> `bytes`
"""
if isinstance(s, text_type):
... | [
"def",
"ensure_binary",
"(",
"s",
",",
"encoding",
"=",
"\"utf-8\"",
",",
"errors",
"=",
"\"strict\"",
")",
":",
"if",
"isinstance",
"(",
"s",
",",
"text_type",
")",
":",
"return",
"s",
".",
"encode",
"(",
"encoding",
",",
"errors",
")",
"elif",
"isins... | https://github.com/aws/lumberyard/blob/f85344403c1c2e77ec8c75deb2c116e97b713217/dev/Tools/Python/3.7.10/linux_x64/lib/python3.7/site-packages/pip/_vendor/urllib3/packages/six.py#L1839-L1871 | ||
root-project/root | fcd3583bb14852bf2e8cd2415717cbaac0e75896 | bindings/experimental/distrdf/python/DistRDF/Operation.py | python | Operation._classify_operation | (self, name) | return op_type | Classifies the given operation as action or transformation and
returns the type. | Classifies the given operation as action or transformation and
returns the type. | [
"Classifies",
"the",
"given",
"operation",
"as",
"action",
"or",
"transformation",
"and",
"returns",
"the",
"type",
"."
] | def _classify_operation(self, name):
"""
Classifies the given operation as action or transformation and
returns the type.
"""
operations_dict = {
"Define": Operation.TRANSFORMATION,
"DefinePerSample": Operation.TRANSFORMATION,
"Filter": Operat... | [
"def",
"_classify_operation",
"(",
"self",
",",
"name",
")",
":",
"operations_dict",
"=",
"{",
"\"Define\"",
":",
"Operation",
".",
"TRANSFORMATION",
",",
"\"DefinePerSample\"",
":",
"Operation",
".",
"TRANSFORMATION",
",",
"\"Filter\"",
":",
"Operation",
".",
"... | https://github.com/root-project/root/blob/fcd3583bb14852bf2e8cd2415717cbaac0e75896/bindings/experimental/distrdf/python/DistRDF/Operation.py#L57-L96 | |
musescore/MuseScore | a817fea23e3c2be30847b7fde5b01746222c252e | tools/crashdump/posix/generate_breakpad_symbols.py | python | GetSharedLibraryDependenciesChromeOS | (binary) | return _GetSharedLibraryDependenciesAndroidOrChromeOS(binary) | Return absolute paths to all shared library dependencies of the binary.
This implementation assumes that we're running on a Linux system, but
compiled for ChromeOS. | Return absolute paths to all shared library dependencies of the binary. | [
"Return",
"absolute",
"paths",
"to",
"all",
"shared",
"library",
"dependencies",
"of",
"the",
"binary",
"."
] | def GetSharedLibraryDependenciesChromeOS(binary):
"""Return absolute paths to all shared library dependencies of the binary.
This implementation assumes that we're running on a Linux system, but
compiled for ChromeOS."""
return _GetSharedLibraryDependenciesAndroidOrChromeOS(binary) | [
"def",
"GetSharedLibraryDependenciesChromeOS",
"(",
"binary",
")",
":",
"return",
"_GetSharedLibraryDependenciesAndroidOrChromeOS",
"(",
"binary",
")"
] | https://github.com/musescore/MuseScore/blob/a817fea23e3c2be30847b7fde5b01746222c252e/tools/crashdump/posix/generate_breakpad_symbols.py#L209-L214 | |
ceph/ceph | 959663007321a369c83218414a29bd9dbc8bda3a | qa/tasks/keycloak.py | python | download_conf | (ctx, config) | Downloads confi.py used in run_admin_cmds | Downloads confi.py used in run_admin_cmds | [
"Downloads",
"confi",
".",
"py",
"used",
"in",
"run_admin_cmds"
] | def download_conf(ctx, config):
"""
Downloads confi.py used in run_admin_cmds
"""
assert isinstance(config, dict)
log.info('Downloading conf...')
testdir = teuthology.get_testdir(ctx)
conf_branch = 'main'
conf_repo = 'https://github.com/TRYTOBE8TME/scripts.git'
for (client, _) in con... | [
"def",
"download_conf",
"(",
"ctx",
",",
"config",
")",
":",
"assert",
"isinstance",
"(",
"config",
",",
"dict",
")",
"log",
".",
"info",
"(",
"'Downloading conf...'",
")",
"testdir",
"=",
"teuthology",
".",
"get_testdir",
"(",
"ctx",
")",
"conf_branch",
"... | https://github.com/ceph/ceph/blob/959663007321a369c83218414a29bd9dbc8bda3a/qa/tasks/keycloak.py#L80-L110 | ||
aws/lumberyard | f85344403c1c2e77ec8c75deb2c116e97b713217 | dev/Tools/Python/3.7.10/mac/Python.framework/Versions/3.7/lib/python3.7/bdb.py | python | Bdb.runctx | (self, cmd, globals, locals) | For backwards-compatibility. Defers to run(). | For backwards-compatibility. Defers to run(). | [
"For",
"backwards",
"-",
"compatibility",
".",
"Defers",
"to",
"run",
"()",
"."
] | def runctx(self, cmd, globals, locals):
"""For backwards-compatibility. Defers to run()."""
# B/W compatibility
self.run(cmd, globals, locals) | [
"def",
"runctx",
"(",
"self",
",",
"cmd",
",",
"globals",
",",
"locals",
")",
":",
"# B/W compatibility",
"self",
".",
"run",
"(",
"cmd",
",",
"globals",
",",
"locals",
")"
] | https://github.com/aws/lumberyard/blob/f85344403c1c2e77ec8c75deb2c116e97b713217/dev/Tools/Python/3.7.10/mac/Python.framework/Versions/3.7/lib/python3.7/bdb.py#L605-L608 | ||
pytorch/pytorch | 7176c92687d3cc847cc046bf002269c6949a21c2 | caffe2/python/task.py | python | Cluster.nodes | (self) | return self._nodes | Returns the list of unique node names used within this context. | Returns the list of unique node names used within this context. | [
"Returns",
"the",
"list",
"of",
"unique",
"node",
"names",
"used",
"within",
"this",
"context",
"."
] | def nodes(self):
"""
Returns the list of unique node names used within this context.
"""
return self._nodes | [
"def",
"nodes",
"(",
"self",
")",
":",
"return",
"self",
".",
"_nodes"
] | https://github.com/pytorch/pytorch/blob/7176c92687d3cc847cc046bf002269c6949a21c2/caffe2/python/task.py#L41-L45 | |
google/earthenterprise | 0fe84e29be470cd857e3a0e52e5d0afd5bb8cee9 | earth_enterprise/src/server/wsgi/serve/publish/publish_manager_helper.py | python | PublishManagerHelper._WritePublishContentToHtaccessFile | (self, htaccess_file,
target_paths_list) | Writes publish content into htaccess-file.
Args:
htaccess_file: file descriptor for writing to.
target_paths_list: target paths list.
Raises:
psycopg2.Error/Warning, PublishServeException. | Writes publish content into htaccess-file. | [
"Writes",
"publish",
"content",
"into",
"htaccess",
"-",
"file",
"."
] | def _WritePublishContentToHtaccessFile(self, htaccess_file,
target_paths_list):
"""Writes publish content into htaccess-file.
Args:
htaccess_file: file descriptor for writing to.
target_paths_list: target paths list.
Raises:
psycopg2.Error/Warning,... | [
"def",
"_WritePublishContentToHtaccessFile",
"(",
"self",
",",
"htaccess_file",
",",
"target_paths_list",
")",
":",
"default_target_path",
"=",
"self",
".",
"_GetEcDefaultDbTargetPath",
"(",
")",
"# Write publish header to file.",
"htaccess_file",
".",
"write",
"(",
"\"%s... | https://github.com/google/earthenterprise/blob/0fe84e29be470cd857e3a0e52e5d0afd5bb8cee9/earth_enterprise/src/server/wsgi/serve/publish/publish_manager_helper.py#L1369-L1471 | ||
mindspore-ai/mindspore | fb8fd3338605bb34fa5cea054e535a8b1d753fab | mindspore/python/mindspore/ops/operations/_quant_ops.py | python | FakeQuantPerChannelGrad.__init__ | (self,
num_bits=8,
quant_delay=0,
symmetric=False,
narrow_range=False,
channel_axis=1) | Initialize FakeQuantPerChannelGrad Fill | Initialize FakeQuantPerChannelGrad Fill | [
"Initialize",
"FakeQuantPerChannelGrad",
"Fill"
] | def __init__(self,
num_bits=8,
quant_delay=0,
symmetric=False,
narrow_range=False,
channel_axis=1):
"""Initialize FakeQuantPerChannelGrad Fill"""
if context.get_context('device_target') == "Ascend":
from min... | [
"def",
"__init__",
"(",
"self",
",",
"num_bits",
"=",
"8",
",",
"quant_delay",
"=",
"0",
",",
"symmetric",
"=",
"False",
",",
"narrow_range",
"=",
"False",
",",
"channel_axis",
"=",
"1",
")",
":",
"if",
"context",
".",
"get_context",
"(",
"'device_target... | https://github.com/mindspore-ai/mindspore/blob/fb8fd3338605bb34fa5cea054e535a8b1d753fab/mindspore/python/mindspore/ops/operations/_quant_ops.py#L975-L997 | ||
eventql/eventql | 7ca0dbb2e683b525620ea30dc40540a22d5eb227 | deps/3rdparty/spidermonkey/mozjs/build/pymake/pymake/data.py | python | Target.searchinlocs | (self, makefile, locs) | return None | Look in the given locations relative to the makefile working directory
for a file. Return a pair of the target and the mtime if found, None
if not. | Look in the given locations relative to the makefile working directory
for a file. Return a pair of the target and the mtime if found, None
if not. | [
"Look",
"in",
"the",
"given",
"locations",
"relative",
"to",
"the",
"makefile",
"working",
"directory",
"for",
"a",
"file",
".",
"Return",
"a",
"pair",
"of",
"the",
"target",
"and",
"the",
"mtime",
"if",
"found",
"None",
"if",
"not",
"."
] | def searchinlocs(self, makefile, locs):
"""
Look in the given locations relative to the makefile working directory
for a file. Return a pair of the target and the mtime if found, None
if not.
"""
for t in locs:
fspath = util.normaljoin(makefile.workdir, t).rep... | [
"def",
"searchinlocs",
"(",
"self",
",",
"makefile",
",",
"locs",
")",
":",
"for",
"t",
"in",
"locs",
":",
"fspath",
"=",
"util",
".",
"normaljoin",
"(",
"makefile",
".",
"workdir",
",",
"t",
")",
".",
"replace",
"(",
"'\\\\'",
",",
"'/'",
")",
"mt... | https://github.com/eventql/eventql/blob/7ca0dbb2e683b525620ea30dc40540a22d5eb227/deps/3rdparty/spidermonkey/mozjs/build/pymake/pymake/data.py#L1207-L1220 | |
aws/lumberyard | f85344403c1c2e77ec8c75deb2c116e97b713217 | dev/Gems/CloudGemMetric/v1/AWS/python/windows/Lib/pandas/core/frame.py | python | DataFrame.axes | (self) | return [self.index, self.columns] | Return a list representing the axes of the DataFrame.
It has the row axis labels and column axis labels as the only members.
They are returned in that order.
Examples
--------
>>> df = pd.DataFrame({'col1': [1, 2], 'col2': [3, 4]})
>>> df.axes
[RangeIndex(start=... | Return a list representing the axes of the DataFrame. | [
"Return",
"a",
"list",
"representing",
"the",
"axes",
"of",
"the",
"DataFrame",
"."
] | def axes(self) -> List[Index]:
"""
Return a list representing the axes of the DataFrame.
It has the row axis labels and column axis labels as the only members.
They are returned in that order.
Examples
--------
>>> df = pd.DataFrame({'col1': [1, 2], 'col2': [3, ... | [
"def",
"axes",
"(",
"self",
")",
"->",
"List",
"[",
"Index",
"]",
":",
"return",
"[",
"self",
".",
"index",
",",
"self",
".",
"columns",
"]"
] | https://github.com/aws/lumberyard/blob/f85344403c1c2e77ec8c75deb2c116e97b713217/dev/Gems/CloudGemMetric/v1/AWS/python/windows/Lib/pandas/core/frame.py#L516-L530 | |
raspberrypi/tools | 13474ee775d0c5ec8a7da4fb0a9fa84187abfc87 | arm-bcm2708/arm-bcm2708hardfp-linux-gnueabi/share/gdb/python/gdb/printing.py | python | register_pretty_printer | (obj, printer) | Register pretty-printer PRINTER with OBJ.
The printer is added to the front of the search list, thus one can override
an existing printer if one needs to.
Arguments:
obj: Either an objfile, progspace, or None (in which case the printer
is registered globally).
printer: Either ... | Register pretty-printer PRINTER with OBJ. | [
"Register",
"pretty",
"-",
"printer",
"PRINTER",
"with",
"OBJ",
"."
] | def register_pretty_printer(obj, printer):
"""Register pretty-printer PRINTER with OBJ.
The printer is added to the front of the search list, thus one can override
an existing printer if one needs to.
Arguments:
obj: Either an objfile, progspace, or None (in which case the printer
... | [
"def",
"register_pretty_printer",
"(",
"obj",
",",
"printer",
")",
":",
"# Watch for both __name__ and name.",
"# Functions get the former for free, but we don't want to use an",
"# attribute named __foo__ for pretty-printers-as-objects.",
"# If printer has both, we use `name'.",
"if",
"no... | https://github.com/raspberrypi/tools/blob/13474ee775d0c5ec8a7da4fb0a9fa84187abfc87/arm-bcm2708/arm-bcm2708hardfp-linux-gnueabi/share/gdb/python/gdb/printing.py#L71-L133 | ||
aws/lumberyard | f85344403c1c2e77ec8c75deb2c116e97b713217 | dev/Gems/CloudGemMetric/v1/AWS/common-code/Lib/pandas/core/dtypes/common.py | python | is_extension_type | (arr) | return False | Check whether an array-like is of a pandas extension class instance.
.. deprecated:: 1.0.0
Use ``is_extension_array_dtype`` instead.
Extension classes include categoricals, pandas sparse objects (i.e.
classes represented within the pandas library and not ones external
to it like scipy sparse m... | Check whether an array-like is of a pandas extension class instance. | [
"Check",
"whether",
"an",
"array",
"-",
"like",
"is",
"of",
"a",
"pandas",
"extension",
"class",
"instance",
"."
] | def is_extension_type(arr) -> bool:
"""
Check whether an array-like is of a pandas extension class instance.
.. deprecated:: 1.0.0
Use ``is_extension_array_dtype`` instead.
Extension classes include categoricals, pandas sparse objects (i.e.
classes represented within the pandas library and... | [
"def",
"is_extension_type",
"(",
"arr",
")",
"->",
"bool",
":",
"warnings",
".",
"warn",
"(",
"\"'is_extension_type' is deprecated and will be removed in a future \"",
"\"version. Use 'is_extension_array_dtype' instead.\"",
",",
"FutureWarning",
",",
"stacklevel",
"=",
"2",
... | https://github.com/aws/lumberyard/blob/f85344403c1c2e77ec8c75deb2c116e97b713217/dev/Gems/CloudGemMetric/v1/AWS/common-code/Lib/pandas/core/dtypes/common.py#L1500-L1562 | |
wxWidgets/wxPython-Classic | 19571e1ae65f1ac445f5491474121998c97a1bf0 | src/msw/richtext.py | python | RichTextParagraph.Copy | (*args, **kwargs) | return _richtext.RichTextParagraph_Copy(*args, **kwargs) | Copy(self, RichTextParagraph obj) | Copy(self, RichTextParagraph obj) | [
"Copy",
"(",
"self",
"RichTextParagraph",
"obj",
")"
] | def Copy(*args, **kwargs):
"""Copy(self, RichTextParagraph obj)"""
return _richtext.RichTextParagraph_Copy(*args, **kwargs) | [
"def",
"Copy",
"(",
"*",
"args",
",",
"*",
"*",
"kwargs",
")",
":",
"return",
"_richtext",
".",
"RichTextParagraph_Copy",
"(",
"*",
"args",
",",
"*",
"*",
"kwargs",
")"
] | https://github.com/wxWidgets/wxPython-Classic/blob/19571e1ae65f1ac445f5491474121998c97a1bf0/src/msw/richtext.py#L1987-L1989 | |
aws/lumberyard | f85344403c1c2e77ec8c75deb2c116e97b713217 | dev/Tools/Python/3.7.10/mac/Python.framework/Versions/3.7/lib/python3.7/pickletools.py | python | read_uint2 | (f) | r"""
>>> import io
>>> read_uint2(io.BytesIO(b'\xff\x00'))
255
>>> read_uint2(io.BytesIO(b'\xff\xff'))
65535 | r"""
>>> import io
>>> read_uint2(io.BytesIO(b'\xff\x00'))
255
>>> read_uint2(io.BytesIO(b'\xff\xff'))
65535 | [
"r",
">>>",
"import",
"io",
">>>",
"read_uint2",
"(",
"io",
".",
"BytesIO",
"(",
"b",
"\\",
"xff",
"\\",
"x00",
"))",
"255",
">>>",
"read_uint2",
"(",
"io",
".",
"BytesIO",
"(",
"b",
"\\",
"xff",
"\\",
"xff",
"))",
"65535"
] | def read_uint2(f):
r"""
>>> import io
>>> read_uint2(io.BytesIO(b'\xff\x00'))
255
>>> read_uint2(io.BytesIO(b'\xff\xff'))
65535
"""
data = f.read(2)
if len(data) == 2:
return _unpack("<H", data)[0]
raise ValueError("not enough data in stream to read uint2") | [
"def",
"read_uint2",
"(",
"f",
")",
":",
"data",
"=",
"f",
".",
"read",
"(",
"2",
")",
"if",
"len",
"(",
"data",
")",
"==",
"2",
":",
"return",
"_unpack",
"(",
"\"<H\"",
",",
"data",
")",
"[",
"0",
"]",
"raise",
"ValueError",
"(",
"\"not enough d... | https://github.com/aws/lumberyard/blob/f85344403c1c2e77ec8c75deb2c116e97b713217/dev/Tools/Python/3.7.10/mac/Python.framework/Versions/3.7/lib/python3.7/pickletools.py#L231-L243 | ||
aws/lumberyard | f85344403c1c2e77ec8c75deb2c116e97b713217 | dev/Gems/CloudGemMetric/v1/AWS/python/windows/Lib/numba/ir_utils.py | python | remove_args | (blocks) | return | remove ir.Arg nodes | remove ir.Arg nodes | [
"remove",
"ir",
".",
"Arg",
"nodes"
] | def remove_args(blocks):
"""remove ir.Arg nodes"""
for block in blocks.values():
new_body = []
for stmt in block.body:
if isinstance(stmt, ir.Assign) and isinstance(stmt.value, ir.Arg):
continue
new_body.append(stmt)
block.body = new_body
retur... | [
"def",
"remove_args",
"(",
"blocks",
")",
":",
"for",
"block",
"in",
"blocks",
".",
"values",
"(",
")",
":",
"new_body",
"=",
"[",
"]",
"for",
"stmt",
"in",
"block",
".",
"body",
":",
"if",
"isinstance",
"(",
"stmt",
",",
"ir",
".",
"Assign",
")",
... | https://github.com/aws/lumberyard/blob/f85344403c1c2e77ec8c75deb2c116e97b713217/dev/Gems/CloudGemMetric/v1/AWS/python/windows/Lib/numba/ir_utils.py#L499-L508 | |
abforce/xposed_art_n | ec3fbe417d74d4664cec053d91dd4e3881176374 | tools/cpplint.py | python | _IncludeState.CanonicalizeAlphabeticalOrder | (self, header_path) | return header_path.replace('-inl.h', '.h').replace('-', '_').lower() | Returns a path canonicalized for alphabetical comparison.
- replaces "-" with "_" so they both cmp the same.
- removes '-inl' since we don't require them to be after the main header.
- lowercase everything, just in case.
Args:
header_path: Path to be canonicalized.
Returns:
Canonicali... | Returns a path canonicalized for alphabetical comparison. | [
"Returns",
"a",
"path",
"canonicalized",
"for",
"alphabetical",
"comparison",
"."
] | def CanonicalizeAlphabeticalOrder(self, header_path):
"""Returns a path canonicalized for alphabetical comparison.
- replaces "-" with "_" so they both cmp the same.
- removes '-inl' since we don't require them to be after the main header.
- lowercase everything, just in case.
Args:
header_p... | [
"def",
"CanonicalizeAlphabeticalOrder",
"(",
"self",
",",
"header_path",
")",
":",
"return",
"header_path",
".",
"replace",
"(",
"'-inl.h'",
",",
"'.h'",
")",
".",
"replace",
"(",
"'-'",
",",
"'_'",
")",
".",
"lower",
"(",
")"
] | https://github.com/abforce/xposed_art_n/blob/ec3fbe417d74d4664cec053d91dd4e3881176374/tools/cpplint.py#L471-L484 | |
catboost/catboost | 167f64f237114a4d10b2b4ee42adb4569137debe | contrib/python/scipy/py3/scipy/interpolate/fitpack2.py | python | UnivariateSpline.roots | (self) | Return the zeros of the spline.
Restriction: only cubic splines are supported by fitpack. | Return the zeros of the spline. | [
"Return",
"the",
"zeros",
"of",
"the",
"spline",
"."
] | def roots(self):
""" Return the zeros of the spline.
Restriction: only cubic splines are supported by fitpack.
"""
k = self._data[5]
if k == 3:
z, m, ier = dfitpack.sproot(*self._eval_args[:2])
if not ier == 0:
raise ValueError("Error code... | [
"def",
"roots",
"(",
"self",
")",
":",
"k",
"=",
"self",
".",
"_data",
"[",
"5",
"]",
"if",
"k",
"==",
"3",
":",
"z",
",",
"m",
",",
"ier",
"=",
"dfitpack",
".",
"sproot",
"(",
"*",
"self",
".",
"_eval_args",
"[",
":",
"2",
"]",
")",
"if",
... | https://github.com/catboost/catboost/blob/167f64f237114a4d10b2b4ee42adb4569137debe/contrib/python/scipy/py3/scipy/interpolate/fitpack2.py#L405-L417 | ||
aws/lumberyard | f85344403c1c2e77ec8c75deb2c116e97b713217 | dev/Gems/CloudGemFramework/v1/AWS/resource-manager-code/lib/pkg_resources/_vendor/pyparsing.py | python | pyparsing_common.convertToDate | (fmt="%Y-%m-%d") | return cvt_fn | Helper to create a parse action for converting parsed date string to Python datetime.date
Params -
- fmt - format to be passed to datetime.strptime (default=C{"%Y-%m-%d"})
Example::
date_expr = pyparsing_common.iso8601_date.copy()
date_expr.setParseAction(pyparsing_com... | Helper to create a parse action for converting parsed date string to Python datetime.date | [
"Helper",
"to",
"create",
"a",
"parse",
"action",
"for",
"converting",
"parsed",
"date",
"string",
"to",
"Python",
"datetime",
".",
"date"
] | def convertToDate(fmt="%Y-%m-%d"):
"""
Helper to create a parse action for converting parsed date string to Python datetime.date
Params -
- fmt - format to be passed to datetime.strptime (default=C{"%Y-%m-%d"})
Example::
date_expr = pyparsing_common.iso8601_date.co... | [
"def",
"convertToDate",
"(",
"fmt",
"=",
"\"%Y-%m-%d\"",
")",
":",
"def",
"cvt_fn",
"(",
"s",
",",
"l",
",",
"t",
")",
":",
"try",
":",
"return",
"datetime",
".",
"strptime",
"(",
"t",
"[",
"0",
"]",
",",
"fmt",
")",
".",
"date",
"(",
")",
"exc... | https://github.com/aws/lumberyard/blob/f85344403c1c2e77ec8c75deb2c116e97b713217/dev/Gems/CloudGemFramework/v1/AWS/resource-manager-code/lib/pkg_resources/_vendor/pyparsing.py#L5593-L5612 | |
wxWidgets/wxPython-Classic | 19571e1ae65f1ac445f5491474121998c97a1bf0 | wx/lib/agw/ultimatelistctrl.py | python | UltimateListMainWindow.EnableSelectionGradient | (self, enable=True) | Globally enables/disables drawing of gradient selections.
:param `enable`: ``True`` to enable gradient-style selections, ``False``
to disable it.
:note: Calling this method disables any Vista-style selection previously
enabled. | Globally enables/disables drawing of gradient selections. | [
"Globally",
"enables",
"/",
"disables",
"drawing",
"of",
"gradient",
"selections",
"."
] | def EnableSelectionGradient(self, enable=True):
"""
Globally enables/disables drawing of gradient selections.
:param `enable`: ``True`` to enable gradient-style selections, ``False``
to disable it.
:note: Calling this method disables any Vista-style selection previously
... | [
"def",
"EnableSelectionGradient",
"(",
"self",
",",
"enable",
"=",
"True",
")",
":",
"self",
".",
"_usegradients",
"=",
"enable",
"self",
".",
"_vistaselection",
"=",
"False",
"self",
".",
"RefreshSelected",
"(",
")"
] | https://github.com/wxWidgets/wxPython-Classic/blob/19571e1ae65f1ac445f5491474121998c97a1bf0/wx/lib/agw/ultimatelistctrl.py#L10643-L10656 | ||
ceph/ceph | 959663007321a369c83218414a29bd9dbc8bda3a | src/pybind/mgr/dashboard/services/access_control.py | python | ac_user_create_cmd | (_, username: str, inbuf: str,
rolename: Optional[str] = None,
name: Optional[str] = None,
email: Optional[str] = None,
enabled: bool = True,
force_password: bool = False,
pwd_expira... | return 0, json.dumps(user.to_dict()), '' | Create a user. Password read from -i <file> | Create a user. Password read from -i <file> | [
"Create",
"a",
"user",
".",
"Password",
"read",
"from",
"-",
"i",
"<file",
">"
] | def ac_user_create_cmd(_, username: str, inbuf: str,
rolename: Optional[str] = None,
name: Optional[str] = None,
email: Optional[str] = None,
enabled: bool = True,
force_password: bool = False,
... | [
"def",
"ac_user_create_cmd",
"(",
"_",
",",
"username",
":",
"str",
",",
"inbuf",
":",
"str",
",",
"rolename",
":",
"Optional",
"[",
"str",
"]",
"=",
"None",
",",
"name",
":",
"Optional",
"[",
"str",
"]",
"=",
"None",
",",
"email",
":",
"Optional",
... | https://github.com/ceph/ceph/blob/959663007321a369c83218414a29bd9dbc8bda3a/src/pybind/mgr/dashboard/services/access_control.py#L718-L752 | |
tensor-compiler/taco | d0654a84137169883973c40a951dfdb89883fd9c | python_bindings/pytaco/pytensor/taco_tensor.py | python | tensor_log10 | (t1, out_format, dtype=None) | return _compute_unary_elt_eise_op(f, t1, out_format, dtype) | Takes the log base 10 of each input in the tensor.
Note that this is applied to all elements in the tensor not just non-zeros.
Warnings
---------
The log10 of 0 is undefined and is performed on every element in the tensor regardless of sparsity.
Parameters
------------... | Takes the log base 10 of each input in the tensor. | [
"Takes",
"the",
"log",
"base",
"10",
"of",
"each",
"input",
"in",
"the",
"tensor",
"."
] | def tensor_log10(t1, out_format, dtype=None):
"""
Takes the log base 10 of each input in the tensor.
Note that this is applied to all elements in the tensor not just non-zeros.
Warnings
---------
The log10 of 0 is undefined and is performed on every element in the tensor re... | [
"def",
"tensor_log10",
"(",
"t1",
",",
"out_format",
",",
"dtype",
"=",
"None",
")",
":",
"t1",
"=",
"as_tensor",
"(",
"t1",
",",
"copy",
"=",
"False",
")",
"cast_val",
"=",
"_cm",
".",
"max_type",
"(",
"_cm",
".",
"float32",
",",
"t1",
".",
"dtype... | https://github.com/tensor-compiler/taco/blob/d0654a84137169883973c40a951dfdb89883fd9c/python_bindings/pytaco/pytensor/taco_tensor.py#L1793-L1832 | |
jackaudio/jack2 | 21b293dbc37d42446141a08922cdec0d2550c6a0 | waflib/ConfigSet.py | python | ConfigSet.prepend_value | (self, var, val) | Prepends a value to the specified item::
def configure(conf):
conf.env.prepend_value('CFLAGS', ['-O2'])
The value must be a list or a tuple | Prepends a value to the specified item:: | [
"Prepends",
"a",
"value",
"to",
"the",
"specified",
"item",
"::"
] | def prepend_value(self, var, val):
"""
Prepends a value to the specified item::
def configure(conf):
conf.env.prepend_value('CFLAGS', ['-O2'])
The value must be a list or a tuple
"""
if isinstance(val, str):
val = [val]
self.table[var] = val + self._get_list_value_for_modification(var) | [
"def",
"prepend_value",
"(",
"self",
",",
"var",
",",
"val",
")",
":",
"if",
"isinstance",
"(",
"val",
",",
"str",
")",
":",
"val",
"=",
"[",
"val",
"]",
"self",
".",
"table",
"[",
"var",
"]",
"=",
"val",
"+",
"self",
".",
"_get_list_value_for_modi... | https://github.com/jackaudio/jack2/blob/21b293dbc37d42446141a08922cdec0d2550c6a0/waflib/ConfigSet.py#L231-L242 | ||
miyosuda/TensorFlowAndroidMNIST | 7b5a4603d2780a8a2834575706e9001977524007 | jni-build/jni/include/tensorflow/contrib/distributions/python/ops/beta.py | python | Beta.variance | (self, name="variance") | Variance of the distribution. | Variance of the distribution. | [
"Variance",
"of",
"the",
"distribution",
"."
] | def variance(self, name="variance"):
"""Variance of the distribution."""
with ops.name_scope(self.name):
with ops.op_scope([self._a, self._b, self._a_b_sum], name):
return (self._a * self._b) / (
self._a_b_sum **2 * (self._a_b_sum + 1)) | [
"def",
"variance",
"(",
"self",
",",
"name",
"=",
"\"variance\"",
")",
":",
"with",
"ops",
".",
"name_scope",
"(",
"self",
".",
"name",
")",
":",
"with",
"ops",
".",
"op_scope",
"(",
"[",
"self",
".",
"_a",
",",
"self",
".",
"_b",
",",
"self",
".... | https://github.com/miyosuda/TensorFlowAndroidMNIST/blob/7b5a4603d2780a8a2834575706e9001977524007/jni-build/jni/include/tensorflow/contrib/distributions/python/ops/beta.py#L238-L243 | ||
wxWidgets/wxPython-Classic | 19571e1ae65f1ac445f5491474121998c97a1bf0 | contrib/gizmos/gtk/gizmos.py | python | PreEditableListBox | (*args, **kwargs) | return val | PreEditableListBox() -> EditableListBox | PreEditableListBox() -> EditableListBox | [
"PreEditableListBox",
"()",
"-",
">",
"EditableListBox"
] | def PreEditableListBox(*args, **kwargs):
"""PreEditableListBox() -> EditableListBox"""
val = _gizmos.new_PreEditableListBox(*args, **kwargs)
return val | [
"def",
"PreEditableListBox",
"(",
"*",
"args",
",",
"*",
"*",
"kwargs",
")",
":",
"val",
"=",
"_gizmos",
".",
"new_PreEditableListBox",
"(",
"*",
"args",
",",
"*",
"*",
"kwargs",
")",
"return",
"val"
] | https://github.com/wxWidgets/wxPython-Classic/blob/19571e1ae65f1ac445f5491474121998c97a1bf0/contrib/gizmos/gtk/gizmos.py#L196-L199 | |
intel-iot-devkit/how-to-code-samples | b4ea616f36bbfa2e042beb1698f968cfd651d79f | robot-arm/python/iot_robot_arm/hardware/grove.py | python | GroveBoard.update_hardware_state | (self) | Update hardware state. | Update hardware state. | [
"Update",
"hardware",
"state",
"."
] | def update_hardware_state(self):
"""
Update hardware state.
"""
joystick_reading = self.read_joystick()
self.trigger_hardware_event(JOYSTICK_READING, joystick_reading) | [
"def",
"update_hardware_state",
"(",
"self",
")",
":",
"joystick_reading",
"=",
"self",
".",
"read_joystick",
"(",
")",
"self",
".",
"trigger_hardware_event",
"(",
"JOYSTICK_READING",
",",
"joystick_reading",
")"
] | https://github.com/intel-iot-devkit/how-to-code-samples/blob/b4ea616f36bbfa2e042beb1698f968cfd651d79f/robot-arm/python/iot_robot_arm/hardware/grove.py#L92-L99 | ||
crosswalk-project/crosswalk | 1b9b80835e83e77390bd6cdbc03beb63f2a6f550 | build/android/merge_jars.py | python | IsMergeableJar | (jar_path) | return True | Returns True if a certain JAR does not have any classes outside the
allowed namespaces. | Returns True if a certain JAR does not have any classes outside the
allowed namespaces. | [
"Returns",
"True",
"if",
"a",
"certain",
"JAR",
"does",
"not",
"have",
"any",
"classes",
"outside",
"the",
"allowed",
"namespaces",
"."
] | def IsMergeableJar(jar_path):
"""
Returns True if a certain JAR does not have any classes outside the
allowed namespaces.
"""
with zipfile.ZipFile(jar_path) as zip_file:
for entry_name in zip_file.namelist():
if entry_name.endswith('/'): # Directories are irrelevant.
continue
if any(f... | [
"def",
"IsMergeableJar",
"(",
"jar_path",
")",
":",
"with",
"zipfile",
".",
"ZipFile",
"(",
"jar_path",
")",
"as",
"zip_file",
":",
"for",
"entry_name",
"in",
"zip_file",
".",
"namelist",
"(",
")",
":",
"if",
"entry_name",
".",
"endswith",
"(",
"'/'",
")... | https://github.com/crosswalk-project/crosswalk/blob/1b9b80835e83e77390bd6cdbc03beb63f2a6f550/build/android/merge_jars.py#L70-L82 | |
gromacs/gromacs | 7dec3a3f99993cf5687a122de3e12de31c21c399 | admin/copyright.py | python | select_comment_handler | (override, filename) | Select comment handler for a file based on file name and input options. | Select comment handler for a file based on file name and input options. | [
"Select",
"comment",
"handler",
"for",
"a",
"file",
"based",
"on",
"file",
"name",
"and",
"input",
"options",
"."
] | def select_comment_handler(override, filename):
"""Select comment handler for a file based on file name and input options."""
filetype = override
if not filetype and filename != '-':
basename = os.path.basename(filename)
root, ext = os.path.splitext(basename)
if ext == '.cmakein':
... | [
"def",
"select_comment_handler",
"(",
"override",
",",
"filename",
")",
":",
"filetype",
"=",
"override",
"if",
"not",
"filetype",
"and",
"filename",
"!=",
"'-'",
":",
"basename",
"=",
"os",
".",
"path",
".",
"basename",
"(",
"filename",
")",
"root",
",",
... | https://github.com/gromacs/gromacs/blob/7dec3a3f99993cf5687a122de3e12de31c21c399/admin/copyright.py#L297-L322 | ||
aws/lumberyard | f85344403c1c2e77ec8c75deb2c116e97b713217 | dev/Gems/CloudGemMetric/v1/AWS/common-code/Lib/numba/types/npytypes.py | python | Record.members | (self) | return [(k, v.type) for k, v in ordered] | An ordered list of (name, type) for the fields. | An ordered list of (name, type) for the fields. | [
"An",
"ordered",
"list",
"of",
"(",
"name",
"type",
")",
"for",
"the",
"fields",
"."
] | def members(self):
"""An ordered list of (name, type) for the fields.
"""
ordered = sorted(self.fields.items(), key=lambda x: x[1].offset)
return [(k, v.type) for k, v in ordered] | [
"def",
"members",
"(",
"self",
")",
":",
"ordered",
"=",
"sorted",
"(",
"self",
".",
"fields",
".",
"items",
"(",
")",
",",
"key",
"=",
"lambda",
"x",
":",
"x",
"[",
"1",
"]",
".",
"offset",
")",
"return",
"[",
"(",
"k",
",",
"v",
".",
"type"... | https://github.com/aws/lumberyard/blob/f85344403c1c2e77ec8c75deb2c116e97b713217/dev/Gems/CloudGemMetric/v1/AWS/common-code/Lib/numba/types/npytypes.py#L196-L200 | |
wxWidgets/wxPython-Classic | 19571e1ae65f1ac445f5491474121998c97a1bf0 | src/osx_carbon/_misc.py | python | TipProvider.GetTip | (*args, **kwargs) | return _misc_.TipProvider_GetTip(*args, **kwargs) | GetTip(self) -> String | GetTip(self) -> String | [
"GetTip",
"(",
"self",
")",
"-",
">",
"String"
] | def GetTip(*args, **kwargs):
"""GetTip(self) -> String"""
return _misc_.TipProvider_GetTip(*args, **kwargs) | [
"def",
"GetTip",
"(",
"*",
"args",
",",
"*",
"*",
"kwargs",
")",
":",
"return",
"_misc_",
".",
"TipProvider_GetTip",
"(",
"*",
"args",
",",
"*",
"*",
"kwargs",
")"
] | https://github.com/wxWidgets/wxPython-Classic/blob/19571e1ae65f1ac445f5491474121998c97a1bf0/src/osx_carbon/_misc.py#L1255-L1257 | |
windystrife/UnrealEngine_NVIDIAGameWorks | b50e6338a7c5b26374d66306ebc7807541ff815e | Engine/Extras/ThirdPartyNotUE/emsdk/Win64/python/2.7.5.3_64bit/Lib/stringold.py | python | strip | (s) | return s.strip() | strip(s) -> string
Return a copy of the string s with leading and trailing
whitespace removed. | strip(s) -> string | [
"strip",
"(",
"s",
")",
"-",
">",
"string"
] | def strip(s):
"""strip(s) -> string
Return a copy of the string s with leading and trailing
whitespace removed.
"""
return s.strip() | [
"def",
"strip",
"(",
"s",
")",
":",
"return",
"s",
".",
"strip",
"(",
")"
] | https://github.com/windystrife/UnrealEngine_NVIDIAGameWorks/blob/b50e6338a7c5b26374d66306ebc7807541ff815e/Engine/Extras/ThirdPartyNotUE/emsdk/Win64/python/2.7.5.3_64bit/Lib/stringold.py#L74-L81 | |
catboost/catboost | 167f64f237114a4d10b2b4ee42adb4569137debe | contrib/python/scipy/py2/scipy/signal/filter_design.py | python | ellipap | (N, rp, rs) | return z, p, k | Return (z,p,k) of Nth-order elliptic analog lowpass filter.
The filter is a normalized prototype that has `rp` decibels of ripple
in the passband and a stopband `rs` decibels down.
The filter's angular (e.g. rad/s) cutoff frequency is normalized to 1,
defined as the point at which the gain first drops... | Return (z,p,k) of Nth-order elliptic analog lowpass filter. | [
"Return",
"(",
"z",
"p",
"k",
")",
"of",
"Nth",
"-",
"order",
"elliptic",
"analog",
"lowpass",
"filter",
"."
] | def ellipap(N, rp, rs):
"""Return (z,p,k) of Nth-order elliptic analog lowpass filter.
The filter is a normalized prototype that has `rp` decibels of ripple
in the passband and a stopband `rs` decibels down.
The filter's angular (e.g. rad/s) cutoff frequency is normalized to 1,
defined as the poin... | [
"def",
"ellipap",
"(",
"N",
",",
"rp",
",",
"rs",
")",
":",
"if",
"abs",
"(",
"int",
"(",
"N",
")",
")",
"!=",
"N",
":",
"raise",
"ValueError",
"(",
"\"Filter order must be a nonnegative integer\"",
")",
"elif",
"N",
"==",
"0",
":",
"# Avoid divide-by-ze... | https://github.com/catboost/catboost/blob/167f64f237114a4d10b2b4ee42adb4569137debe/contrib/python/scipy/py2/scipy/signal/filter_design.py#L3903-L3984 | |
wxWidgets/wxPython-Classic | 19571e1ae65f1ac445f5491474121998c97a1bf0 | wx/lib/agw/aui/auibar.py | python | AuiToolBar.DoSetSize | (self, x, y, width, height, sizeFlags=wx.SIZE_AUTO) | Sets the position and size of the window in pixels. The `sizeFlags`
parameter indicates the interpretation of the other params if they are
equal to -1.
:param integer `x`: the window `x` position;
:param integer `y`: the window `y` position;
:param integer `width`: the window wi... | Sets the position and size of the window in pixels. The `sizeFlags`
parameter indicates the interpretation of the other params if they are
equal to -1. | [
"Sets",
"the",
"position",
"and",
"size",
"of",
"the",
"window",
"in",
"pixels",
".",
"The",
"sizeFlags",
"parameter",
"indicates",
"the",
"interpretation",
"of",
"the",
"other",
"params",
"if",
"they",
"are",
"equal",
"to",
"-",
"1",
"."
] | def DoSetSize(self, x, y, width, height, sizeFlags=wx.SIZE_AUTO):
"""
Sets the position and size of the window in pixels. The `sizeFlags`
parameter indicates the interpretation of the other params if they are
equal to -1.
:param integer `x`: the window `x` position;
... | [
"def",
"DoSetSize",
"(",
"self",
",",
"x",
",",
"y",
",",
"width",
",",
"height",
",",
"sizeFlags",
"=",
"wx",
".",
"SIZE_AUTO",
")",
":",
"parent_size",
"=",
"self",
".",
"GetParent",
"(",
")",
".",
"GetClientSize",
"(",
")",
"if",
"x",
"+",
"widt... | https://github.com/wxWidgets/wxPython-Classic/blob/19571e1ae65f1ac445f5491474121998c97a1bf0/wx/lib/agw/aui/auibar.py#L3352-L3387 | ||
BitMEX/api-connectors | 37a3a5b806ad5d0e0fc975ab86d9ed43c3bcd812 | auto-generated/python/swagger_client/models/x_any.py | python | XAny.to_str | (self) | return pprint.pformat(self.to_dict()) | Returns the string representation of the model | Returns the string representation of the model | [
"Returns",
"the",
"string",
"representation",
"of",
"the",
"model"
] | def to_str(self):
"""Returns the string representation of the model"""
return pprint.pformat(self.to_dict()) | [
"def",
"to_str",
"(",
"self",
")",
":",
"return",
"pprint",
".",
"pformat",
"(",
"self",
".",
"to_dict",
"(",
")",
")"
] | https://github.com/BitMEX/api-connectors/blob/37a3a5b806ad5d0e0fc975ab86d9ed43c3bcd812/auto-generated/python/swagger_client/models/x_any.py#L70-L72 | |
NREL/EnergyPlus | fadc5973b85c70e8cc923efb69c144e808a26078 | cmake/ReverseDDPostProcess.py | python | main | () | return 1 | Handles the main entry point into this script | Handles the main entry point into this script | [
"Handles",
"the",
"main",
"entry",
"point",
"into",
"this",
"script"
] | def main():
"""Handles the main entry point into this script"""
# validate and get command line arguments
reverse_dd_test_dir = process_command_arguments()
# configure up all the paths
base_dir, reversed_dir = configure_root_dirs(reverse_dd_test_dir)
# configure paths for both csv and mtr out... | [
"def",
"main",
"(",
")",
":",
"# validate and get command line arguments",
"reverse_dd_test_dir",
"=",
"process_command_arguments",
"(",
")",
"# configure up all the paths",
"base_dir",
",",
"reversed_dir",
"=",
"configure_root_dirs",
"(",
"reverse_dd_test_dir",
")",
"# confi... | https://github.com/NREL/EnergyPlus/blob/fadc5973b85c70e8cc923efb69c144e808a26078/cmake/ReverseDDPostProcess.py#L146-L169 | |
choasup/caffe-yolo9000 | e8a476c4c23d756632f7a26c681a96e3ab672544 | scripts/cpp_lint.py | python | CheckAccess | (filename, clean_lines, linenum, nesting_state, error) | Checks for improper use of DISALLOW* macros.
Args:
filename: The name of the current file.
clean_lines: A CleansedLines instance containing the file.
linenum: The number of the line to check.
nesting_state: A _NestingState instance which maintains information about
the current stac... | Checks for improper use of DISALLOW* macros. | [
"Checks",
"for",
"improper",
"use",
"of",
"DISALLOW",
"*",
"macros",
"."
] | def CheckAccess(filename, clean_lines, linenum, nesting_state, error):
"""Checks for improper use of DISALLOW* macros.
Args:
filename: The name of the current file.
clean_lines: A CleansedLines instance containing the file.
linenum: The number of the line to check.
nesting_state: A _NestingState in... | [
"def",
"CheckAccess",
"(",
"filename",
",",
"clean_lines",
",",
"linenum",
",",
"nesting_state",
",",
"error",
")",
":",
"line",
"=",
"clean_lines",
".",
"elided",
"[",
"linenum",
"]",
"# get rid of comments and strings",
"matched",
"=",
"Match",
"(",
"(",
"r'... | https://github.com/choasup/caffe-yolo9000/blob/e8a476c4c23d756632f7a26c681a96e3ab672544/scripts/cpp_lint.py#L2490-L2518 | ||
apple/turicreate | cce55aa5311300e3ce6af93cb45ba791fd1bdf49 | src/external/coremltools_wrap/coremltools/coremltools/models/model.py | python | MLModel.__init__ | (self, model, useCPUOnly=False) | Construct an MLModel from a .mlmodel
Parameters
----------
model: str or Model_pb2
If a string is given it should be the location of the .mlmodel to load.
useCPUOnly: bool
Set to true to restrict loading of model on CPU Only. Defaults to False.
Examples... | Construct an MLModel from a .mlmodel | [
"Construct",
"an",
"MLModel",
"from",
"a",
".",
"mlmodel"
] | def __init__(self, model, useCPUOnly=False):
"""
Construct an MLModel from a .mlmodel
Parameters
----------
model: str or Model_pb2
If a string is given it should be the location of the .mlmodel to load.
useCPUOnly: bool
Set to true to restrict l... | [
"def",
"__init__",
"(",
"self",
",",
"model",
",",
"useCPUOnly",
"=",
"False",
")",
":",
"if",
"isinstance",
"(",
"model",
",",
"_string_types",
")",
":",
"self",
".",
"__proxy__",
",",
"self",
".",
"_spec",
",",
"self",
".",
"_framework_error",
"=",
"... | https://github.com/apple/turicreate/blob/cce55aa5311300e3ce6af93cb45ba791fd1bdf49/src/external/coremltools_wrap/coremltools/coremltools/models/model.py#L177-L214 | ||
Xilinx/Vitis-AI | fc74d404563d9951b57245443c73bef389f3657f | tools/Vitis-AI-Quantizer/vai_q_tensorflow1.x/tensorflow/python/training/tracking/base.py | python | Trackable._gather_saveables_for_checkpoint | (self) | return {} | Returns a dictionary of values to checkpoint with this object.
Keys in the returned dictionary are local to this object and in a separate
namespace from dependencies. Values may either be `SaveableObject` factories
or variables easily converted to `SaveableObject`s (as in
`tf.compat.v1.train.Saver`'s
... | Returns a dictionary of values to checkpoint with this object. | [
"Returns",
"a",
"dictionary",
"of",
"values",
"to",
"checkpoint",
"with",
"this",
"object",
"."
] | def _gather_saveables_for_checkpoint(self):
"""Returns a dictionary of values to checkpoint with this object.
Keys in the returned dictionary are local to this object and in a separate
namespace from dependencies. Values may either be `SaveableObject` factories
or variables easily converted to `Saveabl... | [
"def",
"_gather_saveables_for_checkpoint",
"(",
"self",
")",
":",
"return",
"{",
"}"
] | https://github.com/Xilinx/Vitis-AI/blob/fc74d404563d9951b57245443c73bef389f3657f/tools/Vitis-AI-Quantizer/vai_q_tensorflow1.x/tensorflow/python/training/tracking/base.py#L911-L942 | |
hanpfei/chromium-net | 392cc1fa3a8f92f42e4071ab6e674d8e0482f83f | third_party/catapult/third_party/python_gflags/gflags.py | python | FlagValues.MainModuleHelp | (self) | return self.ModuleHelp(_GetMainModule()) | Describe the key flags of the main module.
Returns:
string describing the key flags of a module. | Describe the key flags of the main module. | [
"Describe",
"the",
"key",
"flags",
"of",
"the",
"main",
"module",
"."
] | def MainModuleHelp(self):
"""Describe the key flags of the main module.
Returns:
string describing the key flags of a module.
"""
return self.ModuleHelp(_GetMainModule()) | [
"def",
"MainModuleHelp",
"(",
"self",
")",
":",
"return",
"self",
".",
"ModuleHelp",
"(",
"_GetMainModule",
"(",
")",
")"
] | https://github.com/hanpfei/chromium-net/blob/392cc1fa3a8f92f42e4071ab6e674d8e0482f83f/third_party/catapult/third_party/python_gflags/gflags.py#L1428-L1434 | |
windystrife/UnrealEngine_NVIDIAGameWorks | b50e6338a7c5b26374d66306ebc7807541ff815e | Engine/Extras/ThirdPartyNotUE/emsdk/Win64/python/2.7.5.3_64bit/Lib/site-packages/adodbapi/adodbapi.py | python | TimeConverter.COMDate | (self,obj) | Returns a ComDate from a datetime in inputformat | Returns a ComDate from a datetime in inputformat | [
"Returns",
"a",
"ComDate",
"from",
"a",
"datetime",
"in",
"inputformat"
] | def COMDate(self,obj):
'Returns a ComDate from a datetime in inputformat'
raise NotImplementedError #"Abstract class" | [
"def",
"COMDate",
"(",
"self",
",",
"obj",
")",
":",
"raise",
"NotImplementedError",
"#\"Abstract class\""
] | https://github.com/windystrife/UnrealEngine_NVIDIAGameWorks/blob/b50e6338a7c5b26374d66306ebc7807541ff815e/Engine/Extras/ThirdPartyNotUE/emsdk/Win64/python/2.7.5.3_64bit/Lib/site-packages/adodbapi/adodbapi.py#L126-L128 | ||
LiquidPlayer/LiquidCore | 9405979363f2353ac9a71ad8ab59685dd7f919c9 | deps/node-10.15.3/deps/v8/tools/run_perf.py | python | RunnableConfig.Run | (self, runner, trybot) | return (
AccumulateResults(
self.graphs,
self._children,
iter_output=self.PostProcess(stdout),
perform_measurement=True,
calc_total=self.total,
),
AccumulateResults(
self.graphs,
self._children,
iter_... | Iterates over several runs and handles the output for all traces. | Iterates over several runs and handles the output for all traces. | [
"Iterates",
"over",
"several",
"runs",
"and",
"handles",
"the",
"output",
"for",
"all",
"traces",
"."
] | def Run(self, runner, trybot):
"""Iterates over several runs and handles the output for all traces."""
stdout, stdout_secondary = Unzip(runner())
return (
AccumulateResults(
self.graphs,
self._children,
iter_output=self.PostProcess(stdout),
perform_mea... | [
"def",
"Run",
"(",
"self",
",",
"runner",
",",
"trybot",
")",
":",
"stdout",
",",
"stdout_secondary",
"=",
"Unzip",
"(",
"runner",
"(",
")",
")",
"return",
"(",
"AccumulateResults",
"(",
"self",
".",
"graphs",
",",
"self",
".",
"_children",
",",
"iter_... | https://github.com/LiquidPlayer/LiquidCore/blob/9405979363f2353ac9a71ad8ab59685dd7f919c9/deps/node-10.15.3/deps/v8/tools/run_perf.py#L521-L539 | |
swift/swift | 12d031cf8177fdec0137f9aa7e2912fa23c4416b | 3rdParty/SCons/scons-3.0.1/engine/SCons/Tool/GettextCommon.py | python | RPaths.__init__ | (self, env) | Initialize `RPaths` callable object.
**Arguments**:
- *env* - a `SCons.Environment.Environment` object, defines *current
working dir*. | Initialize `RPaths` callable object.
**Arguments**:
- *env* - a `SCons.Environment.Environment` object, defines *current
working dir*. | [
"Initialize",
"RPaths",
"callable",
"object",
".",
"**",
"Arguments",
"**",
":",
"-",
"*",
"env",
"*",
"-",
"a",
"SCons",
".",
"Environment",
".",
"Environment",
"object",
"defines",
"*",
"current",
"working",
"dir",
"*",
"."
] | def __init__(self, env):
""" Initialize `RPaths` callable object.
**Arguments**:
- *env* - a `SCons.Environment.Environment` object, defines *current
working dir*.
"""
self.env = env | [
"def",
"__init__",
"(",
"self",
",",
"env",
")",
":",
"self",
".",
"env",
"=",
"env"
] | https://github.com/swift/swift/blob/12d031cf8177fdec0137f9aa7e2912fa23c4416b/3rdParty/SCons/scons-3.0.1/engine/SCons/Tool/GettextCommon.py#L319-L327 | ||
SpaceNetChallenge/BuildingDetectors | 3def3c44b5847c744cd2f3356182892d92496579 | qinhaifang/src/caffe-mnc/scripts/cpp_lint.py | python | _IncludeState.CheckNextIncludeOrder | (self, header_type) | return '' | Returns a non-empty error message if the next header is out of order.
This function also updates the internal state to be ready to check
the next include.
Args:
header_type: One of the _XXX_HEADER constants defined above.
Returns:
The empty string if the header is in the right order, or a... | Returns a non-empty error message if the next header is out of order. | [
"Returns",
"a",
"non",
"-",
"empty",
"error",
"message",
"if",
"the",
"next",
"header",
"is",
"out",
"of",
"order",
"."
] | def CheckNextIncludeOrder(self, header_type):
"""Returns a non-empty error message if the next header is out of order.
This function also updates the internal state to be ready to check
the next include.
Args:
header_type: One of the _XXX_HEADER constants defined above.
Returns:
The e... | [
"def",
"CheckNextIncludeOrder",
"(",
"self",
",",
"header_type",
")",
":",
"error_message",
"=",
"(",
"'Found %s after %s'",
"%",
"(",
"self",
".",
"_TYPE_NAMES",
"[",
"header_type",
"]",
",",
"self",
".",
"_SECTION_NAMES",
"[",
"self",
".",
"_section",
"]",
... | https://github.com/SpaceNetChallenge/BuildingDetectors/blob/3def3c44b5847c744cd2f3356182892d92496579/qinhaifang/src/caffe-mnc/scripts/cpp_lint.py#L633-L684 | |
wlanjie/AndroidFFmpeg | 7baf9122f4b8e1c74e7baf4be5c422c7a5ba5aaf | tools/fdk-aac-build/armeabi/toolchain/lib/python2.7/zipfile.py | python | PyZipFile.writepy | (self, pathname, basename = "") | Add all files from "pathname" to the ZIP archive.
If pathname is a package directory, search the directory and
all package subdirectories recursively for all *.py and enter
the modules into the archive. If pathname is a plain
directory, listdir *.py and enter all modules. Else, pathna... | Add all files from "pathname" to the ZIP archive. | [
"Add",
"all",
"files",
"from",
"pathname",
"to",
"the",
"ZIP",
"archive",
"."
] | def writepy(self, pathname, basename = ""):
"""Add all files from "pathname" to the ZIP archive.
If pathname is a package directory, search the directory and
all package subdirectories recursively for all *.py and enter
the modules into the archive. If pathname is a plain
direc... | [
"def",
"writepy",
"(",
"self",
",",
"pathname",
",",
"basename",
"=",
"\"\"",
")",
":",
"dir",
",",
"name",
"=",
"os",
".",
"path",
".",
"split",
"(",
"pathname",
")",
"if",
"os",
".",
"path",
".",
"isdir",
"(",
"pathname",
")",
":",
"initname",
... | https://github.com/wlanjie/AndroidFFmpeg/blob/7baf9122f4b8e1c74e7baf4be5c422c7a5ba5aaf/tools/fdk-aac-build/armeabi/toolchain/lib/python2.7/zipfile.py#L1356-L1419 | ||
MythTV/mythtv | d282a209cb8be85d036f85a62a8ec971b67d45f4 | mythtv/bindings/python/MythTV/utility/dicttoxml.py | python | make_attrstring | (attr) | return '%s%s' % (' ' if attrstring != '' else '', attrstring) | Returns an attribute string in the form key="val" | Returns an attribute string in the form key="val" | [
"Returns",
"an",
"attribute",
"string",
"in",
"the",
"form",
"key",
"=",
"val"
] | def make_attrstring(attr):
"""Returns an attribute string in the form key="val" """
attrstring = ' '.join(['%s="%s"' % (k, v) for k, v in attr.items()])
return '%s%s' % (' ' if attrstring != '' else '', attrstring) | [
"def",
"make_attrstring",
"(",
"attr",
")",
":",
"attrstring",
"=",
"' '",
".",
"join",
"(",
"[",
"'%s=\"%s\"'",
"%",
"(",
"k",
",",
"v",
")",
"for",
"k",
",",
"v",
"in",
"attr",
".",
"items",
"(",
")",
"]",
")",
"return",
"'%s%s'",
"%",
"(",
"... | https://github.com/MythTV/mythtv/blob/d282a209cb8be85d036f85a62a8ec971b67d45f4/mythtv/bindings/python/MythTV/utility/dicttoxml.py#L117-L120 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.