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 |
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
aws/lumberyard | f85344403c1c2e77ec8c75deb2c116e97b713217 | dev/Tools/AWSPythonSDK/1.5.8/dateutil/tz/_common.py | python | _tzinfo._fromutc | (self, dt) | return dt + dtdst | Given a timezone-aware datetime in a given timezone, calculates a
timezone-aware datetime in a new timezone.
Since this is the one time that we *know* we have an unambiguous
datetime object, we take this opportunity to determine whether the
datetime is ambiguous and in a "fold" state (e... | Given a timezone-aware datetime in a given timezone, calculates a
timezone-aware datetime in a new timezone. | [
"Given",
"a",
"timezone",
"-",
"aware",
"datetime",
"in",
"a",
"given",
"timezone",
"calculates",
"a",
"timezone",
"-",
"aware",
"datetime",
"in",
"a",
"new",
"timezone",
"."
] | def _fromutc(self, dt):
"""
Given a timezone-aware datetime in a given timezone, calculates a
timezone-aware datetime in a new timezone.
Since this is the one time that we *know* we have an unambiguous
datetime object, we take this opportunity to determine whether the
da... | [
"def",
"_fromutc",
"(",
"self",
",",
"dt",
")",
":",
"# Re-implement the algorithm from Python's datetime.py",
"dtoff",
"=",
"dt",
".",
"utcoffset",
"(",
")",
"if",
"dtoff",
"is",
"None",
":",
"raise",
"ValueError",
"(",
"\"fromutc() requires a non-None utcoffset() \"... | https://github.com/aws/lumberyard/blob/f85344403c1c2e77ec8c75deb2c116e97b713217/dev/Tools/AWSPythonSDK/1.5.8/dateutil/tz/_common.py#L173-L208 | |
qgis/QGIS | 15a77662d4bb712184f6aa60d0bd663010a76a75 | python/pyplugin_installer/installer.py | python | QgsPluginInstaller.deleteRepository | (self, reposName: str) | delete repository connection | delete repository connection | [
"delete",
"repository",
"connection"
] | def deleteRepository(self, reposName: str):
""" delete repository connection """
if not reposName:
return
settings = QgsSettings()
settings.beginGroup(reposGroup)
if settings.value(reposName + "/url", "", type=str) == officialRepo[1]:
iface.pluginManagerIn... | [
"def",
"deleteRepository",
"(",
"self",
",",
"reposName",
":",
"str",
")",
":",
"if",
"not",
"reposName",
":",
"return",
"settings",
"=",
"QgsSettings",
"(",
")",
"settings",
".",
"beginGroup",
"(",
"reposGroup",
")",
"if",
"settings",
".",
"value",
"(",
... | https://github.com/qgis/QGIS/blob/15a77662d4bb712184f6aa60d0bd663010a76a75/python/pyplugin_installer/installer.py#L527-L543 | ||
wxWidgets/wxPython-Classic | 19571e1ae65f1ac445f5491474121998c97a1bf0 | wx/tools/Editra/src/extern/aui/framemanager.py | python | AuiDockingGuideWindow.OnEraseBackground | (self, event) | Handles the ``wx.EVT_ERASE_BACKGROUND`` event for :class:`AuiDockingGuideWindow`.
:param `event`: a :class:`EraseEvent` to be processed.
:note: This is intentionally empty to reduce flickering while drawing. | Handles the ``wx.EVT_ERASE_BACKGROUND`` event for :class:`AuiDockingGuideWindow`. | [
"Handles",
"the",
"wx",
".",
"EVT_ERASE_BACKGROUND",
"event",
"for",
":",
"class",
":",
"AuiDockingGuideWindow",
"."
] | def OnEraseBackground(self, event):
"""
Handles the ``wx.EVT_ERASE_BACKGROUND`` event for :class:`AuiDockingGuideWindow`.
:param `event`: a :class:`EraseEvent` to be processed.
:note: This is intentionally empty to reduce flickering while drawing.
"""
pass | [
"def",
"OnEraseBackground",
"(",
"self",
",",
"event",
")",
":",
"pass"
] | https://github.com/wxWidgets/wxPython-Classic/blob/19571e1ae65f1ac445f5491474121998c97a1bf0/wx/tools/Editra/src/extern/aui/framemanager.py#L1971-L1980 | ||
openvinotoolkit/openvino | dedcbeafa8b84cccdc55ca64b8da516682b381c7 | cmake/developer_package/cpplint/cpplint.py | python | CheckTrailingSemicolon | (filename, clean_lines, linenum, error) | Looks for redundant trailing semicolon.
Args:
filename: The name of the current file.
clean_lines: A CleansedLines instance containing the file.
linenum: The number of the line to check.
error: The function to call with any errors found. | Looks for redundant trailing semicolon. | [
"Looks",
"for",
"redundant",
"trailing",
"semicolon",
"."
] | def CheckTrailingSemicolon(filename, clean_lines, linenum, error):
"""Looks for redundant trailing semicolon.
Args:
filename: The name of the current file.
clean_lines: A CleansedLines instance containing the file.
linenum: The number of the line to check.
error: The function to call with any err... | [
"def",
"CheckTrailingSemicolon",
"(",
"filename",
",",
"clean_lines",
",",
"linenum",
",",
"error",
")",
":",
"line",
"=",
"clean_lines",
".",
"elided",
"[",
"linenum",
"]",
"# Block bodies should not be followed by a semicolon. Due to C++11",
"# brace initialization, ther... | https://github.com/openvinotoolkit/openvino/blob/dedcbeafa8b84cccdc55ca64b8da516682b381c7/cmake/developer_package/cpplint/cpplint.py#L4091-L4235 | ||
wxWidgets/wxPython-Classic | 19571e1ae65f1ac445f5491474121998c97a1bf0 | src/osx_carbon/richtext.py | python | RichTextParagraphLayoutBox.GetParagraphText | (*args, **kwargs) | return _richtext.RichTextParagraphLayoutBox_GetParagraphText(*args, **kwargs) | GetParagraphText(self, long paragraphNumber) -> String | GetParagraphText(self, long paragraphNumber) -> String | [
"GetParagraphText",
"(",
"self",
"long",
"paragraphNumber",
")",
"-",
">",
"String"
] | def GetParagraphText(*args, **kwargs):
"""GetParagraphText(self, long paragraphNumber) -> String"""
return _richtext.RichTextParagraphLayoutBox_GetParagraphText(*args, **kwargs) | [
"def",
"GetParagraphText",
"(",
"*",
"args",
",",
"*",
"*",
"kwargs",
")",
":",
"return",
"_richtext",
".",
"RichTextParagraphLayoutBox_GetParagraphText",
"(",
"*",
"args",
",",
"*",
"*",
"kwargs",
")"
] | https://github.com/wxWidgets/wxPython-Classic/blob/19571e1ae65f1ac445f5491474121998c97a1bf0/src/osx_carbon/richtext.py#L1716-L1718 | |
catboost/catboost | 167f64f237114a4d10b2b4ee42adb4569137debe | contrib/python/scipy/py2/scipy/sparse/data.py | python | _data_matrix.power | (self, n, dtype=None) | return self._with_data(data ** n) | This function performs element-wise power.
Parameters
----------
n : n is a scalar
dtype : If dtype is not specified, the current dtype will be preserved. | This function performs element-wise power. | [
"This",
"function",
"performs",
"element",
"-",
"wise",
"power",
"."
] | def power(self, n, dtype=None):
"""
This function performs element-wise power.
Parameters
----------
n : n is a scalar
dtype : If dtype is not specified, the current dtype will be preserved.
"""
if not isscalarlike(n):
raise NotImplementedErr... | [
"def",
"power",
"(",
"self",
",",
"n",
",",
"dtype",
"=",
"None",
")",
":",
"if",
"not",
"isscalarlike",
"(",
"n",
")",
":",
"raise",
"NotImplementedError",
"(",
"\"input is not scalar\"",
")",
"data",
"=",
"self",
".",
"_deduped_data",
"(",
")",
"if",
... | https://github.com/catboost/catboost/blob/167f64f237114a4d10b2b4ee42adb4569137debe/contrib/python/scipy/py2/scipy/sparse/data.py#L100-L116 | |
ricardoquesada/Spidermonkey | 4a75ea2543408bd1b2c515aa95901523eeef7858 | toolkit/crashreporter/tools/unit-symbolstore.py | python | TestInstallManifest.testMakeFileMapping | (self) | Test that valid arguments are validated. | Test that valid arguments are validated. | [
"Test",
"that",
"valid",
"arguments",
"are",
"validated",
"."
] | def testMakeFileMapping(self):
'''
Test that valid arguments are validated.
'''
arg = '%s,%s' % (self.manifest_file, self.objdir)
ret = symbolstore.validate_install_manifests([arg])
self.assertEqual(len(ret), 1)
manifest, dest = ret[0]
self.assertTrue(isin... | [
"def",
"testMakeFileMapping",
"(",
"self",
")",
":",
"arg",
"=",
"'%s,%s'",
"%",
"(",
"self",
".",
"manifest_file",
",",
"self",
".",
"objdir",
")",
"ret",
"=",
"symbolstore",
".",
"validate_install_manifests",
"(",
"[",
"arg",
"]",
")",
"self",
".",
"as... | https://github.com/ricardoquesada/Spidermonkey/blob/4a75ea2543408bd1b2c515aa95901523eeef7858/toolkit/crashreporter/tools/unit-symbolstore.py#L316-L330 | ||
clancylian/retinaface | 0d21d2b2c7e164e1eb396eb5a464f24de72a9162 | MXNet2Caffe/check_results.py | python | softmax | (x) | return e_x / e_x.sum() | Compute softmax values for each sets of scores in x. | Compute softmax values for each sets of scores in x. | [
"Compute",
"softmax",
"values",
"for",
"each",
"sets",
"of",
"scores",
"in",
"x",
"."
] | def softmax(x):
"""Compute softmax values for each sets of scores in x."""
e_x = np.exp(x - np.max(x))
return e_x / e_x.sum() | [
"def",
"softmax",
"(",
"x",
")",
":",
"e_x",
"=",
"np",
".",
"exp",
"(",
"x",
"-",
"np",
".",
"max",
"(",
"x",
")",
")",
"return",
"e_x",
"/",
"e_x",
".",
"sum",
"(",
")"
] | https://github.com/clancylian/retinaface/blob/0d21d2b2c7e164e1eb396eb5a464f24de72a9162/MXNet2Caffe/check_results.py#L16-L19 | |
catboost/catboost | 167f64f237114a4d10b2b4ee42adb4569137debe | contrib/python/numpy/py3/numpy/matlib.py | python | eye | (n,M=None, k=0, dtype=float, order='C') | return asmatrix(np.eye(n, M=M, k=k, dtype=dtype, order=order)) | Return a matrix with ones on the diagonal and zeros elsewhere.
Parameters
----------
n : int
Number of rows in the output.
M : int, optional
Number of columns in the output, defaults to `n`.
k : int, optional
Index of the diagonal: 0 refers to the main diagonal,
a po... | Return a matrix with ones on the diagonal and zeros elsewhere. | [
"Return",
"a",
"matrix",
"with",
"ones",
"on",
"the",
"diagonal",
"and",
"zeros",
"elsewhere",
"."
] | def eye(n,M=None, k=0, dtype=float, order='C'):
"""
Return a matrix with ones on the diagonal and zeros elsewhere.
Parameters
----------
n : int
Number of rows in the output.
M : int, optional
Number of columns in the output, defaults to `n`.
k : int, optional
Index ... | [
"def",
"eye",
"(",
"n",
",",
"M",
"=",
"None",
",",
"k",
"=",
"0",
",",
"dtype",
"=",
"float",
",",
"order",
"=",
"'C'",
")",
":",
"return",
"asmatrix",
"(",
"np",
".",
"eye",
"(",
"n",
",",
"M",
"=",
"M",
",",
"k",
"=",
"k",
",",
"dtype"... | https://github.com/catboost/catboost/blob/167f64f237114a4d10b2b4ee42adb4569137debe/contrib/python/numpy/py3/numpy/matlib.py#L187-L229 | |
pskun/finance_news_analysis | 6ac13e32deede37a4cf57bba8b2897941ae3d80d | preprocess/guba_preprocess_handler.py | python | GubaPreprocessHandler.before_thread_start | (self) | 回调函数: 线程启动前调用 | 回调函数: 线程启动前调用 | [
"回调函数",
":",
"线程启动前调用"
] | def before_thread_start(self):
''' 回调函数: 线程启动前调用 '''
# 初始化数据库连接
self.db_session = MySQLPool().getConnection()
# 获取新闻表的行数
guba_id_counter = common_db_func.query_table_count(
self.db_session, self.guba_table_name) + 1
# 设置id的初始值
self.id_generator.set_ini... | [
"def",
"before_thread_start",
"(",
"self",
")",
":",
"# 初始化数据库连接",
"self",
".",
"db_session",
"=",
"MySQLPool",
"(",
")",
".",
"getConnection",
"(",
")",
"# 获取新闻表的行数",
"guba_id_counter",
"=",
"common_db_func",
".",
"query_table_count",
"(",
"self",
".",
"db_sess... | https://github.com/pskun/finance_news_analysis/blob/6ac13e32deede37a4cf57bba8b2897941ae3d80d/preprocess/guba_preprocess_handler.py#L33-L45 | ||
ApolloAuto/apollo-platform | 86d9dc6743b496ead18d597748ebabd34a513289 | ros/third_party/lib_x86_64/python2.7/dist-packages/numpy/ma/mrecords.py | python | MaskedRecords.__setitem__ | (self, indx, value) | Sets the given record to value. | Sets the given record to value. | [
"Sets",
"the",
"given",
"record",
"to",
"value",
"."
] | def __setitem__(self, indx, value):
"Sets the given record to value."
MaskedArray.__setitem__(self, indx, value)
if isinstance(indx, basestring):
self._mask[indx] = ma.getmaskarray(value) | [
"def",
"__setitem__",
"(",
"self",
",",
"indx",
",",
"value",
")",
":",
"MaskedArray",
".",
"__setitem__",
"(",
"self",
",",
"indx",
",",
"value",
")",
"if",
"isinstance",
"(",
"indx",
",",
"basestring",
")",
":",
"self",
".",
"_mask",
"[",
"indx",
"... | https://github.com/ApolloAuto/apollo-platform/blob/86d9dc6743b496ead18d597748ebabd34a513289/ros/third_party/lib_x86_64/python2.7/dist-packages/numpy/ma/mrecords.py#L323-L327 | ||
Illumina/strelka | d7377443b62319f7c7bd70c241c4b2df3459e29a | src/python/deNovoQualityScore/denovo.py | python | prob2score | (x, max_score=_max_score) | Converts probability to score, optimised for speed | Converts probability to score, optimised for speed | [
"Converts",
"probability",
"to",
"score",
"optimised",
"for",
"speed"
] | def prob2score(x, max_score=_max_score):
"""Converts probability to score, optimised for speed"""
if x > 0.0:
y = np.abs(-10.0 * np.log10(x))
if y > max_score:
return max_score
else:
return y
else:
return max_score | [
"def",
"prob2score",
"(",
"x",
",",
"max_score",
"=",
"_max_score",
")",
":",
"if",
"x",
">",
"0.0",
":",
"y",
"=",
"np",
".",
"abs",
"(",
"-",
"10.0",
"*",
"np",
".",
"log10",
"(",
"x",
")",
")",
"if",
"y",
">",
"max_score",
":",
"return",
"... | https://github.com/Illumina/strelka/blob/d7377443b62319f7c7bd70c241c4b2df3459e29a/src/python/deNovoQualityScore/denovo.py#L605-L615 | ||
wxWidgets/wxPython-Classic | 19571e1ae65f1ac445f5491474121998c97a1bf0 | src/osx_cocoa/richtext.py | python | RichTextCtrl.SetDragStartTime | (*args, **kwargs) | return _richtext.RichTextCtrl_SetDragStartTime(*args, **kwargs) | SetDragStartTime(self, DateTime st) | SetDragStartTime(self, DateTime st) | [
"SetDragStartTime",
"(",
"self",
"DateTime",
"st",
")"
] | def SetDragStartTime(*args, **kwargs):
"""SetDragStartTime(self, DateTime st)"""
return _richtext.RichTextCtrl_SetDragStartTime(*args, **kwargs) | [
"def",
"SetDragStartTime",
"(",
"*",
"args",
",",
"*",
"*",
"kwargs",
")",
":",
"return",
"_richtext",
".",
"RichTextCtrl_SetDragStartTime",
"(",
"*",
"args",
",",
"*",
"*",
"kwargs",
")"
] | https://github.com/wxWidgets/wxPython-Classic/blob/19571e1ae65f1ac445f5491474121998c97a1bf0/src/osx_cocoa/richtext.py#L3057-L3059 | |
nlohmann/json | eb2182414749825be086c825edb5229e5c28503d | third_party/cpplint/cpplint.py | python | NestingState.UpdatePreprocessor | (self, line) | Update preprocessor stack.
We need to handle preprocessors due to classes like this:
#ifdef SWIG
struct ResultDetailsPageElementExtensionPoint {
#else
struct ResultDetailsPageElementExtensionPoint : public Extension {
#endif
We make the following assumptions (good enough for most... | Update preprocessor stack. | [
"Update",
"preprocessor",
"stack",
"."
] | def UpdatePreprocessor(self, line):
"""Update preprocessor stack.
We need to handle preprocessors due to classes like this:
#ifdef SWIG
struct ResultDetailsPageElementExtensionPoint {
#else
struct ResultDetailsPageElementExtensionPoint : public Extension {
#endif
We make the ... | [
"def",
"UpdatePreprocessor",
"(",
"self",
",",
"line",
")",
":",
"if",
"Match",
"(",
"r'^\\s*#\\s*(if|ifdef|ifndef)\\b'",
",",
"line",
")",
":",
"# Beginning of #if block, save the nesting stack here. The saved",
"# stack will allow us to restore the parsing state in the #else cas... | https://github.com/nlohmann/json/blob/eb2182414749825be086c825edb5229e5c28503d/third_party/cpplint/cpplint.py#L3016-L3070 | ||
godlikepanos/anki-3d-engine | e2f65e5045624492571ea8527a4dbf3fad8d2c0a | Tools/Image/ConvertImage.py | python | create_etc_images | (mips_fnames, tmp_dir, fast, color_format, convert_path) | Create the etc files | Create the etc files | [
"Create",
"the",
"etc",
"files"
] | def create_etc_images(mips_fnames, tmp_dir, fast, color_format, convert_path):
""" Create the etc files """
printi("Creating ETC images")
# Copy the convert tool to the working dir so that etcpack will see it
shutil.copy2(convert_path, \
os.path.join(tmp_dir, os.path.basename(convert_path)))
... | [
"def",
"create_etc_images",
"(",
"mips_fnames",
",",
"tmp_dir",
",",
"fast",
",",
"color_format",
",",
"convert_path",
")",
":",
"printi",
"(",
"\"Creating ETC images\"",
")",
"# Copy the convert tool to the working dir so that etcpack will see it",
"shutil",
".",
"copy2",
... | https://github.com/godlikepanos/anki-3d-engine/blob/e2f65e5045624492571ea8527a4dbf3fad8d2c0a/Tools/Image/ConvertImage.py#L363-L395 | ||
PaddlePaddle/Anakin | 5fd68a6cc4c4620cd1a30794c1bf06eebd3f4730 | tools/external_converter_v2/parser/tensorflow/tf_trans_util.py | python | parse_Squeeze | (tf_node, graph) | convert squeeze to reshape
:param tf_node:
:param graph:
:return: | convert squeeze to reshape
:param tf_node:
:param graph:
:return: | [
"convert",
"squeeze",
"to",
"reshape",
":",
"param",
"tf_node",
":",
":",
"param",
"graph",
":",
":",
"return",
":"
] | def parse_Squeeze(tf_node, graph):
'''
convert squeeze to reshape
:param tf_node:
:param graph:
:return:
'''
tf_node['visted'] = True
tf_node['ak_type'] = 'Reshape'
tf_node['ak_attr']['shape'] = tf_node['output'][0]['shape']
tf_node['output'] = [i for i in tf_node['output'] if gr... | [
"def",
"parse_Squeeze",
"(",
"tf_node",
",",
"graph",
")",
":",
"tf_node",
"[",
"'visted'",
"]",
"=",
"True",
"tf_node",
"[",
"'ak_type'",
"]",
"=",
"'Reshape'",
"tf_node",
"[",
"'ak_attr'",
"]",
"[",
"'shape'",
"]",
"=",
"tf_node",
"[",
"'output'",
"]",... | https://github.com/PaddlePaddle/Anakin/blob/5fd68a6cc4c4620cd1a30794c1bf06eebd3f4730/tools/external_converter_v2/parser/tensorflow/tf_trans_util.py#L303-L313 | ||
ceph/ceph | 959663007321a369c83218414a29bd9dbc8bda3a | src/tools/rgw/parse-cr-dump.py | python | match_ops | (name, ops) | return False | return true if any op matches the given filter | return true if any op matches the given filter | [
"return",
"true",
"if",
"any",
"op",
"matches",
"the",
"given",
"filter"
] | def match_ops(name, ops):
""" return true if any op matches the given filter """
for op in ops:
if re.search(name, op):
return True
return False | [
"def",
"match_ops",
"(",
"name",
",",
"ops",
")",
":",
"for",
"op",
"in",
"ops",
":",
"if",
"re",
".",
"search",
"(",
"name",
",",
"op",
")",
":",
"return",
"True",
"return",
"False"
] | https://github.com/ceph/ceph/blob/959663007321a369c83218414a29bd9dbc8bda3a/src/tools/rgw/parse-cr-dump.py#L66-L71 | |
aws/lumberyard | f85344403c1c2e77ec8c75deb2c116e97b713217 | dev/Gems/CloudGemMetric/v1/AWS/python/windows/Lib/pandas/core/arrays/sparse/array.py | python | SparseArray.mean | (self, axis=0, *args, **kwargs) | Mean of non-NA/null values
Returns
-------
mean : float | Mean of non-NA/null values | [
"Mean",
"of",
"non",
"-",
"NA",
"/",
"null",
"values"
] | def mean(self, axis=0, *args, **kwargs):
"""
Mean of non-NA/null values
Returns
-------
mean : float
"""
nv.validate_mean(args, kwargs)
valid_vals = self._valid_sp_values
sp_sum = valid_vals.sum()
ct = len(valid_vals)
if self._nul... | [
"def",
"mean",
"(",
"self",
",",
"axis",
"=",
"0",
",",
"*",
"args",
",",
"*",
"*",
"kwargs",
")",
":",
"nv",
".",
"validate_mean",
"(",
"args",
",",
"kwargs",
")",
"valid_vals",
"=",
"self",
".",
"_valid_sp_values",
"sp_sum",
"=",
"valid_vals",
".",... | https://github.com/aws/lumberyard/blob/f85344403c1c2e77ec8c75deb2c116e97b713217/dev/Gems/CloudGemMetric/v1/AWS/python/windows/Lib/pandas/core/arrays/sparse/array.py#L1268-L1285 | ||
CRYTEK/CRYENGINE | 232227c59a220cbbd311576f0fbeba7bb53b2a8c | Code/Tools/waf-1.7.13/crywaflib/default_settings.py | python | use_incredibuild_win | (ctx, section_name, option_name, value) | return 'True' | IB uses Make && Build Tools also for MSVC Builds, hence we can skip a check here | IB uses Make && Build Tools also for MSVC Builds, hence we can skip a check here | [
"IB",
"uses",
"Make",
"&&",
"Build",
"Tools",
"also",
"for",
"MSVC",
"Builds",
"hence",
"we",
"can",
"skip",
"a",
"check",
"here"
] | def use_incredibuild_win(ctx, section_name, option_name, value):
""" IB uses Make && Build Tools also for MSVC Builds, hence we can skip a check here """
if LOADED_OPTIONS.get('use_incredibuild', 'False') == 'False':
return 'False'
return 'True' | [
"def",
"use_incredibuild_win",
"(",
"ctx",
",",
"section_name",
",",
"option_name",
",",
"value",
")",
":",
"if",
"LOADED_OPTIONS",
".",
"get",
"(",
"'use_incredibuild'",
",",
"'False'",
")",
"==",
"'False'",
":",
"return",
"'False'",
"return",
"'True'"
] | https://github.com/CRYTEK/CRYENGINE/blob/232227c59a220cbbd311576f0fbeba7bb53b2a8c/Code/Tools/waf-1.7.13/crywaflib/default_settings.py#L248-L253 | |
aws/lumberyard | f85344403c1c2e77ec8c75deb2c116e97b713217 | dev/Tools/Python/3.7.10/linux_x64/lib/python3.7/modulefinder.py | python | ModuleFinder.any_missing | (self) | return missing + maybe | Return a list of modules that appear to be missing. Use
any_missing_maybe() if you want to know which modules are
certain to be missing, and which *may* be missing. | Return a list of modules that appear to be missing. Use
any_missing_maybe() if you want to know which modules are
certain to be missing, and which *may* be missing. | [
"Return",
"a",
"list",
"of",
"modules",
"that",
"appear",
"to",
"be",
"missing",
".",
"Use",
"any_missing_maybe",
"()",
"if",
"you",
"want",
"to",
"know",
"which",
"modules",
"are",
"certain",
"to",
"be",
"missing",
"and",
"which",
"*",
"may",
"*",
"be",... | def any_missing(self):
"""Return a list of modules that appear to be missing. Use
any_missing_maybe() if you want to know which modules are
certain to be missing, and which *may* be missing.
"""
missing, maybe = self.any_missing_maybe()
return missing + maybe | [
"def",
"any_missing",
"(",
"self",
")",
":",
"missing",
",",
"maybe",
"=",
"self",
".",
"any_missing_maybe",
"(",
")",
"return",
"missing",
"+",
"maybe"
] | https://github.com/aws/lumberyard/blob/f85344403c1c2e77ec8c75deb2c116e97b713217/dev/Tools/Python/3.7.10/linux_x64/lib/python3.7/modulefinder.py#L487-L493 | |
catboost/catboost | 167f64f237114a4d10b2b4ee42adb4569137debe | contrib/python/scipy/scipy/interpolate/fitpack.py | python | insert | (x, tck, m=1, per=0) | Insert knots into a B-spline.
Given the knots and coefficients of a B-spline representation, create a
new B-spline with a knot inserted `m` times at point `x`.
This is a wrapper around the FORTRAN routine insert of FITPACK.
Parameters
----------
x (u) : array_like
A 1-D point at which ... | Insert knots into a B-spline. | [
"Insert",
"knots",
"into",
"a",
"B",
"-",
"spline",
"."
] | def insert(x, tck, m=1, per=0):
"""
Insert knots into a B-spline.
Given the knots and coefficients of a B-spline representation, create a
new B-spline with a knot inserted `m` times at point `x`.
This is a wrapper around the FORTRAN routine insert of FITPACK.
Parameters
----------
x (u... | [
"def",
"insert",
"(",
"x",
",",
"tck",
",",
"m",
"=",
"1",
",",
"per",
"=",
"0",
")",
":",
"t",
",",
"c",
",",
"k",
"=",
"tck",
"try",
":",
"c",
"[",
"0",
"]",
"[",
"0",
"]",
"parametric",
"=",
"True",
"except",
":",
"parametric",
"=",
"F... | https://github.com/catboost/catboost/blob/167f64f237114a4d10b2b4ee42adb4569137debe/contrib/python/scipy/scipy/interpolate/fitpack.py#L1082-L1145 | ||
aws/lumberyard | f85344403c1c2e77ec8c75deb2c116e97b713217 | dev/Tools/Python/3.7.10/linux_x64/lib/python3.7/multiprocessing/spawn.py | python | import_main_path | (main_path) | Set sys.modules['__main__'] to module at main_path | Set sys.modules['__main__'] to module at main_path | [
"Set",
"sys",
".",
"modules",
"[",
"__main__",
"]",
"to",
"module",
"at",
"main_path"
] | def import_main_path(main_path):
'''
Set sys.modules['__main__'] to module at main_path
'''
_fixup_main_from_path(main_path) | [
"def",
"import_main_path",
"(",
"main_path",
")",
":",
"_fixup_main_from_path",
"(",
"main_path",
")"
] | https://github.com/aws/lumberyard/blob/f85344403c1c2e77ec8c75deb2c116e97b713217/dev/Tools/Python/3.7.10/linux_x64/lib/python3.7/multiprocessing/spawn.py#L282-L286 | ||
ValveSoftware/source-sdk-2013 | 0d8dceea4310fde5706b3ce1c70609d72a38efdf | mp/src/thirdparty/protobuf-2.3.0/python/mox.py | python | Or.__init__ | (self, *args) | Initialize.
Args:
*args: One or more Mox comparators | Initialize. | [
"Initialize",
"."
] | def __init__(self, *args):
"""Initialize.
Args:
*args: One or more Mox comparators
"""
self._comparators = args | [
"def",
"__init__",
"(",
"self",
",",
"*",
"args",
")",
":",
"self",
".",
"_comparators",
"=",
"args"
] | https://github.com/ValveSoftware/source-sdk-2013/blob/0d8dceea4310fde5706b3ce1c70609d72a38efdf/mp/src/thirdparty/protobuf-2.3.0/python/mox.py#L1083-L1090 | ||
envoyproxy/envoy-wasm | ab5d9381fdf92a1efa0b87cff80036b5b3e81198 | source/extensions/filters/network/kafka/serialization/generator.py | python | get_field_counts | () | return range(1, 12) | Generate argument counts that should be processed by composite deserializers. | Generate argument counts that should be processed by composite deserializers. | [
"Generate",
"argument",
"counts",
"that",
"should",
"be",
"processed",
"by",
"composite",
"deserializers",
"."
] | def get_field_counts():
"""
Generate argument counts that should be processed by composite deserializers.
"""
return range(1, 12) | [
"def",
"get_field_counts",
"(",
")",
":",
"return",
"range",
"(",
"1",
",",
"12",
")"
] | https://github.com/envoyproxy/envoy-wasm/blob/ab5d9381fdf92a1efa0b87cff80036b5b3e81198/source/extensions/filters/network/kafka/serialization/generator.py#L36-L40 | |
miyosuda/TensorFlowAndroidDemo | 35903e0221aa5f109ea2dbef27f20b52e317f42d | jni-build/jni/include/tensorflow/python/framework/tensor_shape.py | python | Dimension.__ge__ | (self, other) | Returns True if `self` is known to be greater than or equal to `other`.
Dimensions are compared as follows:
Dimension(m) >= Dimension(n) == m >= n
Dimension(m) >= Dimension(None) == None
Dimension(None) >= Dimension(n) == None
Dimension(None) >= Dimension(None) == None
Arg... | Returns True if `self` is known to be greater than or equal to `other`. | [
"Returns",
"True",
"if",
"self",
"is",
"known",
"to",
"be",
"greater",
"than",
"or",
"equal",
"to",
"other",
"."
] | def __ge__(self, other):
"""Returns True if `self` is known to be greater than or equal to `other`.
Dimensions are compared as follows:
Dimension(m) >= Dimension(n) == m >= n
Dimension(m) >= Dimension(None) == None
Dimension(None) >= Dimension(n) == None
Dimension(None) >= ... | [
"def",
"__ge__",
"(",
"self",
",",
"other",
")",
":",
"other",
"=",
"as_dimension",
"(",
"other",
")",
"if",
"self",
".",
"_value",
"is",
"None",
"or",
"other",
".",
"value",
"is",
"None",
":",
"return",
"None",
"else",
":",
"return",
"self",
".",
... | https://github.com/miyosuda/TensorFlowAndroidDemo/blob/35903e0221aa5f109ea2dbef27f20b52e317f42d/jni-build/jni/include/tensorflow/python/framework/tensor_shape.py#L334-L355 | ||
rapidsai/cudf | d5b2448fc69f17509304d594f029d0df56984962 | python/dask_cudf/versioneer.py | python | get_root | () | return root | Get the project root directory.
We require that all commands are run from the project root, i.e. the
directory that contains setup.py, setup.cfg, and versioneer.py . | Get the project root directory. | [
"Get",
"the",
"project",
"root",
"directory",
"."
] | def get_root():
"""Get the project root directory.
We require that all commands are run from the project root, i.e. the
directory that contains setup.py, setup.cfg, and versioneer.py .
"""
root = os.path.realpath(os.path.abspath(os.getcwd()))
setup_py = os.path.join(root, "setup.py")
versio... | [
"def",
"get_root",
"(",
")",
":",
"root",
"=",
"os",
".",
"path",
".",
"realpath",
"(",
"os",
".",
"path",
".",
"abspath",
"(",
"os",
".",
"getcwd",
"(",
")",
")",
")",
"setup_py",
"=",
"os",
".",
"path",
".",
"join",
"(",
"root",
",",
"\"setup... | https://github.com/rapidsai/cudf/blob/d5b2448fc69f17509304d594f029d0df56984962/python/dask_cudf/versioneer.py#L297-L337 | |
hanpfei/chromium-net | 392cc1fa3a8f92f42e4071ab6e674d8e0482f83f | third_party/catapult/third_party/gsutil/third_party/rsa/rsa/transform.py | python | bytes_leading | (raw_bytes, needle=ZERO_BYTE) | return leading | Finds the number of prefixed byte occurrences in the haystack.
Useful when you want to deal with padding.
:param raw_bytes:
Raw bytes.
:param needle:
The byte to count. Default \000.
:returns:
The number of leading needle bytes. | Finds the number of prefixed byte occurrences in the haystack. | [
"Finds",
"the",
"number",
"of",
"prefixed",
"byte",
"occurrences",
"in",
"the",
"haystack",
"."
] | def bytes_leading(raw_bytes, needle=ZERO_BYTE):
'''
Finds the number of prefixed byte occurrences in the haystack.
Useful when you want to deal with padding.
:param raw_bytes:
Raw bytes.
:param needle:
The byte to count. Default \000.
:returns:
The number of leading nee... | [
"def",
"bytes_leading",
"(",
"raw_bytes",
",",
"needle",
"=",
"ZERO_BYTE",
")",
":",
"leading",
"=",
"0",
"# Indexing keeps compatibility between Python 2.x and Python 3.x",
"_byte",
"=",
"needle",
"[",
"0",
"]",
"for",
"x",
"in",
"raw_bytes",
":",
"if",
"x",
"=... | https://github.com/hanpfei/chromium-net/blob/392cc1fa3a8f92f42e4071ab6e674d8e0482f83f/third_party/catapult/third_party/gsutil/third_party/rsa/rsa/transform.py#L118-L139 | |
generalized-intelligence/GAAS | 29ab17d3e8a4ba18edef3a57c36d8db6329fac73 | deprecated/algorithms/sfm/OpenSfM/opensfm/transformations.py | python | orthogonalization_matrix | (lengths, angles) | return numpy.array([
[ a*sinb*math.sqrt(1.0-co*co), 0.0, 0.0, 0.0],
[-a*sinb*co, b*sina, 0.0, 0.0],
[ a*cosb, b*cosa, c, 0.0],
[ 0.0, 0.0, 0.0, 1.0]]) | Return orthogonalization matrix for crystallographic cell coordinates.
Angles are expected in degrees.
The de-orthogonalization matrix is the inverse.
>>> O = orthogonalization_matrix([10, 10, 10], [90, 90, 90])
>>> numpy.allclose(O[:3, :3], numpy.identity(3, float) * 10)
True
>>> O = orthogo... | Return orthogonalization matrix for crystallographic cell coordinates. | [
"Return",
"orthogonalization",
"matrix",
"for",
"crystallographic",
"cell",
"coordinates",
"."
] | def orthogonalization_matrix(lengths, angles):
"""Return orthogonalization matrix for crystallographic cell coordinates.
Angles are expected in degrees.
The de-orthogonalization matrix is the inverse.
>>> O = orthogonalization_matrix([10, 10, 10], [90, 90, 90])
>>> numpy.allclose(O[:3, :3], numpy... | [
"def",
"orthogonalization_matrix",
"(",
"lengths",
",",
"angles",
")",
":",
"a",
",",
"b",
",",
"c",
"=",
"lengths",
"angles",
"=",
"numpy",
".",
"radians",
"(",
"angles",
")",
"sina",
",",
"sinb",
",",
"_",
"=",
"numpy",
".",
"sin",
"(",
"angles",
... | https://github.com/generalized-intelligence/GAAS/blob/29ab17d3e8a4ba18edef3a57c36d8db6329fac73/deprecated/algorithms/sfm/OpenSfM/opensfm/transformations.py#L856-L880 | |
OpenGenus/cosmos | 1a94e8880068e51d571543be179c323936bd0936 | code/game_theory/src/grundy_numbers_kayle/grundy_numbers_kayle.py | python | main | () | Main Program for printing Grundy Numbers | Main Program for printing Grundy Numbers | [
"Main",
"Program",
"for",
"printing",
"Grundy",
"Numbers"
] | def main():
"""Main Program for printing Grundy Numbers"""
m = input("How Many Sprague Grundy Value do you want to know?")
n = m + 1
main_arr = [0 for i in range(n)]
main_arr[1] = 1
temp_arr = [0 for i in range(n)]
for i in range(2, n):
k = 0
l = 1
for j in range(((i ... | [
"def",
"main",
"(",
")",
":",
"m",
"=",
"input",
"(",
"\"How Many Sprague Grundy Value do you want to know?\"",
")",
"n",
"=",
"m",
"+",
"1",
"main_arr",
"=",
"[",
"0",
"for",
"i",
"in",
"range",
"(",
"n",
")",
"]",
"main_arr",
"[",
"1",
"]",
"=",
"1... | https://github.com/OpenGenus/cosmos/blob/1a94e8880068e51d571543be179c323936bd0936/code/game_theory/src/grundy_numbers_kayle/grundy_numbers_kayle.py#L41-L73 | ||
wxWidgets/wxPython-Classic | 19571e1ae65f1ac445f5491474121998c97a1bf0 | src/msw/_core.py | python | CommandEvent.GetExtraLong | (*args, **kwargs) | return _core_.CommandEvent_GetExtraLong(*args, **kwargs) | GetExtraLong(self) -> long
Returns extra information dependant on the event objects type. If the
event comes from a listbox selection, it is a boolean determining
whether the event was a selection (true) or a deselection (false). A
listbox deselection only occurs for multiple-selection ... | GetExtraLong(self) -> long | [
"GetExtraLong",
"(",
"self",
")",
"-",
">",
"long"
] | def GetExtraLong(*args, **kwargs):
"""
GetExtraLong(self) -> long
Returns extra information dependant on the event objects type. If the
event comes from a listbox selection, it is a boolean determining
whether the event was a selection (true) or a deselection (false). A
... | [
"def",
"GetExtraLong",
"(",
"*",
"args",
",",
"*",
"*",
"kwargs",
")",
":",
"return",
"_core_",
".",
"CommandEvent_GetExtraLong",
"(",
"*",
"args",
",",
"*",
"*",
"kwargs",
")"
] | https://github.com/wxWidgets/wxPython-Classic/blob/19571e1ae65f1ac445f5491474121998c97a1bf0/src/msw/_core.py#L5260-L5271 | |
baidu-research/tensorflow-allreduce | 66d5b855e90b0949e9fa5cca5599fd729a70e874 | tensorflow/contrib/keras/python/keras/applications/mobilenet.py | python | _depthwise_conv_block | (inputs,
pointwise_conv_filters,
alpha,
depth_multiplier=1,
strides=(1, 1),
block_id=1) | return Activation(relu6, name='conv_pw_%d_relu' % block_id)(x) | Adds a depthwise convolution block.
A depthwise convolution block consists of a depthwise conv,
batch normalization, relu6, pointwise convolution,
batch normalization and relu6 activation.
Arguments:
inputs: Input tensor of shape `(rows, cols, channels)`
(with `channels_last` data format) or
... | Adds a depthwise convolution block. | [
"Adds",
"a",
"depthwise",
"convolution",
"block",
"."
] | def _depthwise_conv_block(inputs,
pointwise_conv_filters,
alpha,
depth_multiplier=1,
strides=(1, 1),
block_id=1):
"""Adds a depthwise convolution block.
A depthwise convolution block co... | [
"def",
"_depthwise_conv_block",
"(",
"inputs",
",",
"pointwise_conv_filters",
",",
"alpha",
",",
"depth_multiplier",
"=",
"1",
",",
"strides",
"=",
"(",
"1",
",",
"1",
")",
",",
"block_id",
"=",
"1",
")",
":",
"channel_axis",
"=",
"1",
"if",
"K",
".",
... | https://github.com/baidu-research/tensorflow-allreduce/blob/66d5b855e90b0949e9fa5cca5599fd729a70e874/tensorflow/contrib/keras/python/keras/applications/mobilenet.py#L582-L655 | |
thalium/icebox | 99d147d5b9269222225443ce171b4fd46d8985d4 | src/icebox/icebox_py/__init__.py | python | attach | (name) | return Vm(name) | Attach to live VM by name. | Attach to live VM by name. | [
"Attach",
"to",
"live",
"VM",
"by",
"name",
"."
] | def attach(name):
"""Attach to live VM by name."""
return Vm(name) | [
"def",
"attach",
"(",
"name",
")",
":",
"return",
"Vm",
"(",
"name",
")"
] | https://github.com/thalium/icebox/blob/99d147d5b9269222225443ce171b4fd46d8985d4/src/icebox/icebox_py/__init__.py#L720-L722 | |
tensorflow/tensorflow | 419e3a6b650ea4bd1b0cba23c4348f8a69f3272e | tensorflow/python/framework/ops.py | python | OpStats.__init__ | (self, statistic_type, value=None) | Sets up the initial placeholders for the statistics. | Sets up the initial placeholders for the statistics. | [
"Sets",
"up",
"the",
"initial",
"placeholders",
"for",
"the",
"statistics",
"."
] | def __init__(self, statistic_type, value=None):
"""Sets up the initial placeholders for the statistics."""
self.statistic_type = statistic_type
self.value = value | [
"def",
"__init__",
"(",
"self",
",",
"statistic_type",
",",
"value",
"=",
"None",
")",
":",
"self",
".",
"statistic_type",
"=",
"statistic_type",
"self",
".",
"value",
"=",
"value"
] | https://github.com/tensorflow/tensorflow/blob/419e3a6b650ea4bd1b0cba23c4348f8a69f3272e/tensorflow/python/framework/ops.py#L2890-L2893 | ||
fossephate/JoyCon-Driver | 857e4e76e26f05d72400ae5d9f2a22cae88f3548 | joycon-driver/full/wxWidgets-3.0.3/build/tools/builder.py | python | Builder.isAvailable | (self) | return False | Run sanity checks before attempting to build with this format | Run sanity checks before attempting to build with this format | [
"Run",
"sanity",
"checks",
"before",
"attempting",
"to",
"build",
"with",
"this",
"format"
] | def isAvailable(self):
"""
Run sanity checks before attempting to build with this format
"""
# Make sure the builder program exists
programPath = self.getProgramPath()
if os.path.exists(programPath):
return True
else:
# check the PATH for t... | [
"def",
"isAvailable",
"(",
"self",
")",
":",
"# Make sure the builder program exists",
"programPath",
"=",
"self",
".",
"getProgramPath",
"(",
")",
"if",
"os",
".",
"path",
".",
"exists",
"(",
"programPath",
")",
":",
"return",
"True",
"else",
":",
"# check th... | https://github.com/fossephate/JoyCon-Driver/blob/857e4e76e26f05d72400ae5d9f2a22cae88f3548/joycon-driver/full/wxWidgets-3.0.3/build/tools/builder.py#L53-L80 | |
ricardoquesada/Spidermonkey | 4a75ea2543408bd1b2c515aa95901523eeef7858 | media/webrtc/trunk/build/android/pylib/valgrind_tools.py | python | BaseTool.CopyFiles | (self) | Copies tool-specific files to the device, create directories, etc. | Copies tool-specific files to the device, create directories, etc. | [
"Copies",
"tool",
"-",
"specific",
"files",
"to",
"the",
"device",
"create",
"directories",
"etc",
"."
] | def CopyFiles(self):
"""Copies tool-specific files to the device, create directories, etc."""
pass | [
"def",
"CopyFiles",
"(",
"self",
")",
":",
"pass"
] | https://github.com/ricardoquesada/Spidermonkey/blob/4a75ea2543408bd1b2c515aa95901523eeef7858/media/webrtc/trunk/build/android/pylib/valgrind_tools.py#L56-L58 | ||
krishauser/Klampt | 972cc83ea5befac3f653c1ba20f80155768ad519 | Python/klampt/math/geodesic.py | python | GeodesicSpace.difference | (self,a,b) | return vectorops.sub(a,b) | For Lie groups, returns a difference vector that, when integrated
would get to a from b. In Cartesian spaces it is a-b. In other spaces,
it should be d/du interpolate(b,a,u) at u=0. | For Lie groups, returns a difference vector that, when integrated
would get to a from b. In Cartesian spaces it is a-b. In other spaces,
it should be d/du interpolate(b,a,u) at u=0. | [
"For",
"Lie",
"groups",
"returns",
"a",
"difference",
"vector",
"that",
"when",
"integrated",
"would",
"get",
"to",
"a",
"from",
"b",
".",
"In",
"Cartesian",
"spaces",
"it",
"is",
"a",
"-",
"b",
".",
"In",
"other",
"spaces",
"it",
"should",
"be",
"d",
... | def difference(self,a,b):
"""For Lie groups, returns a difference vector that, when integrated
would get to a from b. In Cartesian spaces it is a-b. In other spaces,
it should be d/du interpolate(b,a,u) at u=0."""
return vectorops.sub(a,b) | [
"def",
"difference",
"(",
"self",
",",
"a",
",",
"b",
")",
":",
"return",
"vectorops",
".",
"sub",
"(",
"a",
",",
"b",
")"
] | https://github.com/krishauser/Klampt/blob/972cc83ea5befac3f653c1ba20f80155768ad519/Python/klampt/math/geodesic.py#L21-L25 | |
PlatformLab/RAMCloud | b1866af19124325a6dfd8cbc267e2e3ef1f965d1 | scripts/upload.py | python | ClientRedirectHandler.do_GET | (self) | Handle a GET request.
Parses and saves the query parameters and prints a message that the server
has completed its lone task (handling a redirect).
Note that we can't detect if an error occurred. | Handle a GET request. | [
"Handle",
"a",
"GET",
"request",
"."
] | def do_GET(self):
"""Handle a GET request.
Parses and saves the query parameters and prints a message that the server
has completed its lone task (handling a redirect).
Note that we can't detect if an error occurred.
"""
self.send_response(200)
self.send_header('Content-type', 'text/html')... | [
"def",
"do_GET",
"(",
"self",
")",
":",
"self",
".",
"send_response",
"(",
"200",
")",
"self",
".",
"send_header",
"(",
"'Content-type'",
",",
"'text/html'",
")",
"self",
".",
"end_headers",
"(",
")",
"self",
".",
"SetResponseValue",
"(",
")",
"self",
".... | https://github.com/PlatformLab/RAMCloud/blob/b1866af19124325a6dfd8cbc267e2e3ef1f965d1/scripts/upload.py#L743-L755 | ||
ideawu/ssdb-rocks | a3cbb322cafb2f493252829c608e2239df98c9ac | deps/cpy/antlr3/streams.py | python | CharStream.getLine | (self) | ANTLR tracks the line information automatically | ANTLR tracks the line information automatically | [
"ANTLR",
"tracks",
"the",
"line",
"information",
"automatically"
] | def getLine(self):
"""ANTLR tracks the line information automatically"""
raise NotImplementedError | [
"def",
"getLine",
"(",
"self",
")",
":",
"raise",
"NotImplementedError"
] | https://github.com/ideawu/ssdb-rocks/blob/a3cbb322cafb2f493252829c608e2239df98c9ac/deps/cpy/antlr3/streams.py#L217-L220 | ||
wxWidgets/wxPython-Classic | 19571e1ae65f1ac445f5491474121998c97a1bf0 | src/osx_carbon/_core.py | python | Image.ConvertToBitmap | (*args, **kwargs) | return _core_.Image_ConvertToBitmap(*args, **kwargs) | ConvertToBitmap(self, int depth=-1) -> Bitmap | ConvertToBitmap(self, int depth=-1) -> Bitmap | [
"ConvertToBitmap",
"(",
"self",
"int",
"depth",
"=",
"-",
"1",
")",
"-",
">",
"Bitmap"
] | def ConvertToBitmap(*args, **kwargs):
"""ConvertToBitmap(self, int depth=-1) -> Bitmap"""
return _core_.Image_ConvertToBitmap(*args, **kwargs) | [
"def",
"ConvertToBitmap",
"(",
"*",
"args",
",",
"*",
"*",
"kwargs",
")",
":",
"return",
"_core_",
".",
"Image_ConvertToBitmap",
"(",
"*",
"args",
",",
"*",
"*",
"kwargs",
")"
] | https://github.com/wxWidgets/wxPython-Classic/blob/19571e1ae65f1ac445f5491474121998c97a1bf0/src/osx_carbon/_core.py#L3644-L3646 | |
wxWidgets/wxPython-Classic | 19571e1ae65f1ac445f5491474121998c97a1bf0 | wx/tools/Editra/src/extern/aui/auibook.py | python | TabNavigatorWindow.PopulateListControl | (self, book) | Populates the :class:`TabNavigatorWindow` listbox with a list of tabs.
:param `book`: the actual :class:`AuiNotebook`. | Populates the :class:`TabNavigatorWindow` listbox with a list of tabs. | [
"Populates",
"the",
":",
"class",
":",
"TabNavigatorWindow",
"listbox",
"with",
"a",
"list",
"of",
"tabs",
"."
] | def PopulateListControl(self, book):
"""
Populates the :class:`TabNavigatorWindow` listbox with a list of tabs.
:param `book`: the actual :class:`AuiNotebook`.
"""
# Index of currently selected page
selection = book.GetSelection()
# Total number of pages
... | [
"def",
"PopulateListControl",
"(",
"self",
",",
"book",
")",
":",
"# Index of currently selected page",
"selection",
"=",
"book",
".",
"GetSelection",
"(",
")",
"# Total number of pages",
"count",
"=",
"book",
".",
"GetPageCount",
"(",
")",
"# List of (index, AuiNoteb... | https://github.com/wxWidgets/wxPython-Classic/blob/19571e1ae65f1ac445f5491474121998c97a1bf0/wx/tools/Editra/src/extern/aui/auibook.py#L703-L737 | ||
PlatformLab/RAMCloud | b1866af19124325a6dfd8cbc267e2e3ef1f965d1 | cpplint.py | python | _CppLintState.SetOutputFormat | (self, output_format) | Sets the output format for errors. | Sets the output format for errors. | [
"Sets",
"the",
"output",
"format",
"for",
"errors",
"."
] | def SetOutputFormat(self, output_format):
"""Sets the output format for errors."""
self.output_format = output_format | [
"def",
"SetOutputFormat",
"(",
"self",
",",
"output_format",
")",
":",
"self",
".",
"output_format",
"=",
"output_format"
] | https://github.com/PlatformLab/RAMCloud/blob/b1866af19124325a6dfd8cbc267e2e3ef1f965d1/cpplint.py#L458-L460 | ||
idaholab/moose | 9eeebc65e098b4c30f8205fb41591fd5b61eb6ff | python/moosesyntax/get_moose_syntax_tree.py | python | get_moose_syntax_tree | (exe, remove=None, alias=None, unregister=None) | return root | Creates a tree structure representing the MooseApp syntax for the given executable using --json.
Inputs:
ext[str|dict]: The executable to run or the parsed JSON tree structure
remove[list|dict]: Syntax to mark as removed. The input data structure can be a single list or
a dict ... | Creates a tree structure representing the MooseApp syntax for the given executable using --json. | [
"Creates",
"a",
"tree",
"structure",
"representing",
"the",
"MooseApp",
"syntax",
"for",
"the",
"given",
"executable",
"using",
"--",
"json",
"."
] | def get_moose_syntax_tree(exe, remove=None, alias=None, unregister=None):
"""
Creates a tree structure representing the MooseApp syntax for the given executable using --json.
Inputs:
ext[str|dict]: The executable to run or the parsed JSON tree structure
remove[list|dict]: Syntax to mark as remo... | [
"def",
"get_moose_syntax_tree",
"(",
"exe",
",",
"remove",
"=",
"None",
",",
"alias",
"=",
"None",
",",
"unregister",
"=",
"None",
")",
":",
"# Create the JSON tree, unless it is provided directly",
"if",
"isinstance",
"(",
"exe",
",",
"dict",
")",
":",
"tree",
... | https://github.com/idaholab/moose/blob/9eeebc65e098b4c30f8205fb41591fd5b61eb6ff/python/moosesyntax/get_moose_syntax_tree.py#L18-L76 | |
bh107/bohrium | 5b83e7117285fefc7779ed0e9acb0f8e74c7e068 | bridge/npbackend/bohrium/array_manipulation.py | python | broadcast_arrays | (*args) | return (ret, bcast.shape) | Broadcast any number of arrays against each other.
.. note:: This function is very similar to NumPy's `broadcast_arrays()`
Parameters
----------
`array_list` : array_likes
The arrays to broadcast.
Returns
-------
broadcasted : list of arrays
These arrays are views on the ... | Broadcast any number of arrays against each other. | [
"Broadcast",
"any",
"number",
"of",
"arrays",
"against",
"each",
"other",
"."
] | def broadcast_arrays(*args):
"""
Broadcast any number of arrays against each other.
.. note:: This function is very similar to NumPy's `broadcast_arrays()`
Parameters
----------
`array_list` : array_likes
The arrays to broadcast.
Returns
-------
broadcasted : list of arra... | [
"def",
"broadcast_arrays",
"(",
"*",
"args",
")",
":",
"try",
":",
"if",
"len",
"(",
"args",
")",
"==",
"0",
":",
"return",
"(",
"[",
"]",
",",
"[",
"]",
")",
"if",
"len",
"(",
"args",
")",
"==",
"1",
":",
"if",
"numpy",
".",
"isscalar",
"(",... | https://github.com/bh107/bohrium/blob/5b83e7117285fefc7779ed0e9acb0f8e74c7e068/bridge/npbackend/bohrium/array_manipulation.py#L443-L550 | |
Polidea/SiriusObfuscator | b0e590d8130e97856afe578869b83a209e2b19be | SymbolExtractorAndRenamer/swift/utils/bug_reducer/bug_reducer/random_bug_finder.py | python | add_parser_arguments | (parser) | Add parser arguments for random_bug_reducer | Add parser arguments for random_bug_reducer | [
"Add",
"parser",
"arguments",
"for",
"random_bug_reducer"
] | def add_parser_arguments(parser):
"""Add parser arguments for random_bug_reducer"""
parser.set_defaults(func=random_bug_finder)
parser.add_argument('input_file', help='The input file to optimize')
parser.add_argument('--module-cache', help='The module cache to use')
parser.add_argument('--sdk', help... | [
"def",
"add_parser_arguments",
"(",
"parser",
")",
":",
"parser",
".",
"set_defaults",
"(",
"func",
"=",
"random_bug_finder",
")",
"parser",
".",
"add_argument",
"(",
"'input_file'",
",",
"help",
"=",
"'The input file to optimize'",
")",
"parser",
".",
"add_argume... | https://github.com/Polidea/SiriusObfuscator/blob/b0e590d8130e97856afe578869b83a209e2b19be/SymbolExtractorAndRenamer/swift/utils/bug_reducer/bug_reducer/random_bug_finder.py#L53-L73 | ||
catboost/catboost | 167f64f237114a4d10b2b4ee42adb4569137debe | contrib/python/ipython/py2/IPython/lib/display.py | python | IFrame._repr_html_ | (self) | return self.iframe.format(src=self.src,
width=self.width,
height=self.height,
params=params) | return the embed iframe | return the embed iframe | [
"return",
"the",
"embed",
"iframe"
] | def _repr_html_(self):
"""return the embed iframe"""
if self.params:
try:
from urllib.parse import urlencode # Py 3
except ImportError:
from urllib import urlencode
params = "?" + urlencode(self.params)
else:
params ... | [
"def",
"_repr_html_",
"(",
"self",
")",
":",
"if",
"self",
".",
"params",
":",
"try",
":",
"from",
"urllib",
".",
"parse",
"import",
"urlencode",
"# Py 3",
"except",
"ImportError",
":",
"from",
"urllib",
"import",
"urlencode",
"params",
"=",
"\"?\"",
"+",
... | https://github.com/catboost/catboost/blob/167f64f237114a4d10b2b4ee42adb4569137debe/contrib/python/ipython/py2/IPython/lib/display.py#L219-L232 | |
wxWidgets/wxPython-Classic | 19571e1ae65f1ac445f5491474121998c97a1bf0 | src/osx_carbon/_misc.py | python | LogFatalError | (*args, **kwargs) | return _misc_.LogFatalError(*args, **kwargs) | LogFatalError(String msg) | LogFatalError(String msg) | [
"LogFatalError",
"(",
"String",
"msg",
")"
] | def LogFatalError(*args, **kwargs):
"""LogFatalError(String msg)"""
return _misc_.LogFatalError(*args, **kwargs) | [
"def",
"LogFatalError",
"(",
"*",
"args",
",",
"*",
"*",
"kwargs",
")",
":",
"return",
"_misc_",
".",
"LogFatalError",
"(",
"*",
"args",
",",
"*",
"*",
"kwargs",
")"
] | https://github.com/wxWidgets/wxPython-Classic/blob/19571e1ae65f1ac445f5491474121998c97a1bf0/src/osx_carbon/_misc.py#L1847-L1849 | |
asLody/whale | 6a661b27cc4cf83b7b5a3b02451597ee1ac7f264 | whale/cpplint.py | python | _GetTextInside | (text, start_pattern) | return text[start_position:position - 1] | r"""Retrieves all the text between matching open and close parentheses.
Given a string of lines and a regular expression string, retrieve all the text
following the expression and between opening punctuation symbols like
(, [, or {, and the matching close-punctuation symbol. This properly nested
occurrences of... | r"""Retrieves all the text between matching open and close parentheses. | [
"r",
"Retrieves",
"all",
"the",
"text",
"between",
"matching",
"open",
"and",
"close",
"parentheses",
"."
] | def _GetTextInside(text, start_pattern):
r"""Retrieves all the text between matching open and close parentheses.
Given a string of lines and a regular expression string, retrieve all the text
following the expression and between opening punctuation symbols like
(, [, or {, and the matching close-punctuation sy... | [
"def",
"_GetTextInside",
"(",
"text",
",",
"start_pattern",
")",
":",
"# TODO(unknown): Audit cpplint.py to see what places could be profitably",
"# rewritten to use _GetTextInside (and use inferior regexp matching today).",
"# Give opening punctuations to get the matching close-punctuations.",
... | https://github.com/asLody/whale/blob/6a661b27cc4cf83b7b5a3b02451597ee1ac7f264/whale/cpplint.py#L4600-L4653 | |
wxWidgets/wxPython-Classic | 19571e1ae65f1ac445f5491474121998c97a1bf0 | src/msw/stc.py | python | StyledTextCtrl.GetScrollWidth | (*args, **kwargs) | return _stc.StyledTextCtrl_GetScrollWidth(*args, **kwargs) | GetScrollWidth(self) -> int
Retrieve the document width assumed for scrolling. | GetScrollWidth(self) -> int | [
"GetScrollWidth",
"(",
"self",
")",
"-",
">",
"int"
] | def GetScrollWidth(*args, **kwargs):
"""
GetScrollWidth(self) -> int
Retrieve the document width assumed for scrolling.
"""
return _stc.StyledTextCtrl_GetScrollWidth(*args, **kwargs) | [
"def",
"GetScrollWidth",
"(",
"*",
"args",
",",
"*",
"*",
"kwargs",
")",
":",
"return",
"_stc",
".",
"StyledTextCtrl_GetScrollWidth",
"(",
"*",
"args",
",",
"*",
"*",
"kwargs",
")"
] | https://github.com/wxWidgets/wxPython-Classic/blob/19571e1ae65f1ac445f5491474121998c97a1bf0/src/msw/stc.py#L4175-L4181 | |
cvxpy/cvxpy | 5165b4fb750dfd237de8659383ef24b4b2e33aaf | cvxpy/problems/problem.py | python | Problem.unpack_results | (self, solution, chain: SolvingChain, inverse_data) | Updates the problem state given the solver results.
Updates problem.status, problem.value and value of
primal and dual variables.
Arguments
_________
solution : object
The solution returned by applying the chain to the problem
and invoking the solver on ... | Updates the problem state given the solver results. | [
"Updates",
"the",
"problem",
"state",
"given",
"the",
"solver",
"results",
"."
] | def unpack_results(self, solution, chain: SolvingChain, inverse_data) -> None:
"""Updates the problem state given the solver results.
Updates problem.status, problem.value and value of
primal and dual variables.
Arguments
_________
solution : object
The solu... | [
"def",
"unpack_results",
"(",
"self",
",",
"solution",
",",
"chain",
":",
"SolvingChain",
",",
"inverse_data",
")",
"->",
"None",
":",
"solution",
"=",
"chain",
".",
"invert",
"(",
"solution",
",",
"inverse_data",
")",
"if",
"solution",
".",
"status",
"in"... | https://github.com/cvxpy/cvxpy/blob/5165b4fb750dfd237de8659383ef24b4b2e33aaf/cvxpy/problems/problem.py#L1274-L1313 | ||
ApolloAuto/apollo-platform | 86d9dc6743b496ead18d597748ebabd34a513289 | ros/third_party/lib_x86_64/python2.7/dist-packages/numpy/matlib.py | python | randn | (*args) | return asmatrix(np.random.randn(*args)) | Return a random matrix with data from the "standard normal" distribution.
`randn` generates a matrix filled with random floats sampled from a
univariate "normal" (Gaussian) distribution of mean 0 and variance 1.
Parameters
----------
\\*args : Arguments
Shape of the output.
If give... | Return a random matrix with data from the "standard normal" distribution. | [
"Return",
"a",
"random",
"matrix",
"with",
"data",
"from",
"the",
"standard",
"normal",
"distribution",
"."
] | def randn(*args):
"""
Return a random matrix with data from the "standard normal" distribution.
`randn` generates a matrix filled with random floats sampled from a
univariate "normal" (Gaussian) distribution of mean 0 and variance 1.
Parameters
----------
\\*args : Arguments
Shape ... | [
"def",
"randn",
"(",
"*",
"args",
")",
":",
"if",
"isinstance",
"(",
"args",
"[",
"0",
"]",
",",
"tuple",
")",
":",
"args",
"=",
"args",
"[",
"0",
"]",
"return",
"asmatrix",
"(",
"np",
".",
"random",
".",
"randn",
"(",
"*",
"args",
")",
")"
] | https://github.com/ApolloAuto/apollo-platform/blob/86d9dc6743b496ead18d597748ebabd34a513289/ros/third_party/lib_x86_64/python2.7/dist-packages/numpy/matlib.py#L260-L308 | |
wxWidgets/wxPython-Classic | 19571e1ae65f1ac445f5491474121998c97a1bf0 | src/gtk/_windows.py | python | PrintDialogData.SetMinPage | (*args, **kwargs) | return _windows_.PrintDialogData_SetMinPage(*args, **kwargs) | SetMinPage(self, int v) | SetMinPage(self, int v) | [
"SetMinPage",
"(",
"self",
"int",
"v",
")"
] | def SetMinPage(*args, **kwargs):
"""SetMinPage(self, int v)"""
return _windows_.PrintDialogData_SetMinPage(*args, **kwargs) | [
"def",
"SetMinPage",
"(",
"*",
"args",
",",
"*",
"*",
"kwargs",
")",
":",
"return",
"_windows_",
".",
"PrintDialogData_SetMinPage",
"(",
"*",
"args",
",",
"*",
"*",
"kwargs",
")"
] | https://github.com/wxWidgets/wxPython-Classic/blob/19571e1ae65f1ac445f5491474121998c97a1bf0/src/gtk/_windows.py#L5086-L5088 | |
mindspore-ai/mindspore | fb8fd3338605bb34fa5cea054e535a8b1d753fab | mindspore/python/mindspore/ops/_op_impl/tbe/fused_mul_add.py | python | _fused_mul_add_tbe | () | return | FusedMulAdd TBE register | FusedMulAdd TBE register | [
"FusedMulAdd",
"TBE",
"register"
] | def _fused_mul_add_tbe():
"""FusedMulAdd TBE register"""
return | [
"def",
"_fused_mul_add_tbe",
"(",
")",
":",
"return"
] | https://github.com/mindspore-ai/mindspore/blob/fb8fd3338605bb34fa5cea054e535a8b1d753fab/mindspore/python/mindspore/ops/_op_impl/tbe/fused_mul_add.py#L36-L38 | |
HackWebRTC/webrtc | 7abfc990c00ab35090fff285fcf635d1d7892433 | tools_webrtc/android/build_aar.py | python | Build | (build_dir, arch, use_goma, extra_gn_args, extra_gn_switches,
extra_ninja_switches) | Generates target architecture using GN and builds it using ninja. | Generates target architecture using GN and builds it using ninja. | [
"Generates",
"target",
"architecture",
"using",
"GN",
"and",
"builds",
"it",
"using",
"ninja",
"."
] | def Build(build_dir, arch, use_goma, extra_gn_args, extra_gn_switches,
extra_ninja_switches):
"""Generates target architecture using GN and builds it using ninja."""
logging.info('Building: %s', arch)
output_directory = _GetOutputDirectory(build_dir, arch)
gn_args = {
'target_os': 'android',
'... | [
"def",
"Build",
"(",
"build_dir",
",",
"arch",
",",
"use_goma",
",",
"extra_gn_args",
",",
"extra_gn_switches",
",",
"extra_ninja_switches",
")",
":",
"logging",
".",
"info",
"(",
"'Building: %s'",
",",
"arch",
")",
"output_directory",
"=",
"_GetOutputDirectory",
... | https://github.com/HackWebRTC/webrtc/blob/7abfc990c00ab35090fff285fcf635d1d7892433/tools_webrtc/android/build_aar.py#L145-L172 | ||
epam/Indigo | 30e40b4b1eb9bae0207435a26cfcb81ddcc42be1 | api/python/indigo/ml/clustering.py | python | clustering | (
assay_values: List[List[Union[int, float]]],
method: Type[ClusterMixin] = SpectralClustering,
**kwargs,
) | return labels.tolist() | Clustering procedure for given list of assay values.
Args:
assay_values: Ordered list of lists of assay values.
method: clustering method, default: SpectralClustering.
Kwargs:
params for clustering method.
Returns:
ordered list of cluster labels. | Clustering procedure for given list of assay values. | [
"Clustering",
"procedure",
"for",
"given",
"list",
"of",
"assay",
"values",
"."
] | def clustering(
assay_values: List[List[Union[int, float]]],
method: Type[ClusterMixin] = SpectralClustering,
**kwargs,
) -> List[int]:
"""Clustering procedure for given list of assay values.
Args:
assay_values: Ordered list of lists of assay values.
method: clustering method, defau... | [
"def",
"clustering",
"(",
"assay_values",
":",
"List",
"[",
"List",
"[",
"Union",
"[",
"int",
",",
"float",
"]",
"]",
"]",
",",
"method",
":",
"Type",
"[",
"ClusterMixin",
"]",
"=",
"SpectralClustering",
",",
"*",
"*",
"kwargs",
",",
")",
"->",
"List... | https://github.com/epam/Indigo/blob/30e40b4b1eb9bae0207435a26cfcb81ddcc42be1/api/python/indigo/ml/clustering.py#L9-L26 | |
mantidproject/mantid | 03deeb89254ec4289edb8771e0188c2090a02f32 | qt/python/mantidqt/mantidqt/widgets/algorithmselector/algorithm_factory_observer.py | python | AlgorithmSelectorFactoryObserver.updateHandle | (self) | Called when the algorithm factory has been updated | Called when the algorithm factory has been updated | [
"Called",
"when",
"the",
"algorithm",
"factory",
"has",
"been",
"updated"
] | def updateHandle(self):
"""Called when the algorithm factory has been updated"""
self._refresh_widget() | [
"def",
"updateHandle",
"(",
"self",
")",
":",
"self",
".",
"_refresh_widget",
"(",
")"
] | https://github.com/mantidproject/mantid/blob/03deeb89254ec4289edb8771e0188c2090a02f32/qt/python/mantidqt/mantidqt/widgets/algorithmselector/algorithm_factory_observer.py#L26-L28 | ||
catboost/catboost | 167f64f237114a4d10b2b4ee42adb4569137debe | contrib/python/scikit-learn/py3/sklearn/covariance/_graph_lasso.py | python | GraphicalLasso.fit | (self, X, y=None) | return self | Fits the GraphicalLasso model to X.
Parameters
----------
X : ndarray, shape (n_samples, n_features)
Data from which to compute the covariance estimate
y : (ignored) | Fits the GraphicalLasso model to X. | [
"Fits",
"the",
"GraphicalLasso",
"model",
"to",
"X",
"."
] | def fit(self, X, y=None):
"""Fits the GraphicalLasso model to X.
Parameters
----------
X : ndarray, shape (n_samples, n_features)
Data from which to compute the covariance estimate
y : (ignored)
"""
# Covariance does not make sense for a single featur... | [
"def",
"fit",
"(",
"self",
",",
"X",
",",
"y",
"=",
"None",
")",
":",
"# Covariance does not make sense for a single feature",
"X",
"=",
"check_array",
"(",
"X",
",",
"ensure_min_features",
"=",
"2",
",",
"ensure_min_samples",
"=",
"2",
",",
"estimator",
"=",
... | https://github.com/catboost/catboost/blob/167f64f237114a4d10b2b4ee42adb4569137debe/contrib/python/scikit-learn/py3/sklearn/covariance/_graph_lasso.py#L370-L393 | |
google/syzygy | 8164b24ebde9c5649c9a09e88a7fc0b0fcbd1bc5 | third_party/numpy/files/numpy/distutils/command/scons.py | python | get_scons_configres_dir | () | return get_scons_configres_dir() | Return the top path where everything produced by scons will be put.
The path is relative to the top setup.py | Return the top path where everything produced by scons will be put. | [
"Return",
"the",
"top",
"path",
"where",
"everything",
"produced",
"by",
"scons",
"will",
"be",
"put",
"."
] | def get_scons_configres_dir():
"""Return the top path where everything produced by scons will be put.
The path is relative to the top setup.py"""
from numscons import get_scons_configres_dir
return get_scons_configres_dir() | [
"def",
"get_scons_configres_dir",
"(",
")",
":",
"from",
"numscons",
"import",
"get_scons_configres_dir",
"return",
"get_scons_configres_dir",
"(",
")"
] | https://github.com/google/syzygy/blob/8164b24ebde9c5649c9a09e88a7fc0b0fcbd1bc5/third_party/numpy/files/numpy/distutils/command/scons.py#L37-L42 | |
alibaba/graph-learn | 54cafee9db3054dc310a28b856be7f97c7d5aee9 | examples/tf/seal/induce_graph_cn_with_edge.py | python | induce_graph_cn_with_edge | (src_nodes, dst_nodes,
src_nbrs, dst_nbrs) | return subgraphs | induce SubGraphs using edge and it's neighbors and
do common neighbor node labeling.
Args:
src_nodes: A gl.Nodes instance with shape [batch_size].
dst_nodes: A gl.Nodes instance with shape [batch_size] or
[batch_size, 1] for negative sample.
src_nbrs: The src_nodes' full neighbors with 1D shap... | induce SubGraphs using edge and it's neighbors and
do common neighbor node labeling.
Args:
src_nodes: A gl.Nodes instance with shape [batch_size].
dst_nodes: A gl.Nodes instance with shape [batch_size] or
[batch_size, 1] for negative sample.
src_nbrs: The src_nodes' full neighbors with 1D shap... | [
"induce",
"SubGraphs",
"using",
"edge",
"and",
"it",
"s",
"neighbors",
"and",
"do",
"common",
"neighbor",
"node",
"labeling",
".",
"Args",
":",
"src_nodes",
":",
"A",
"gl",
".",
"Nodes",
"instance",
"with",
"shape",
"[",
"batch_size",
"]",
".",
"dst_nodes"... | def induce_graph_cn_with_edge(src_nodes, dst_nodes,
src_nbrs, dst_nbrs):
"""induce SubGraphs using edge and it's neighbors and
do common neighbor node labeling.
Args:
src_nodes: A gl.Nodes instance with shape [batch_size].
dst_nodes: A gl.Nodes instance with shape [batch_size] or
[batch_size,... | [
"def",
"induce_graph_cn_with_edge",
"(",
"src_nodes",
",",
"dst_nodes",
",",
"src_nbrs",
",",
"dst_nbrs",
")",
":",
"subgraphs",
"=",
"[",
"]",
"src_offset",
",",
"dst_offset",
"=",
"0",
",",
"0",
"for",
"i",
"in",
"range",
"(",
"src_nodes",
".",
"ids",
... | https://github.com/alibaba/graph-learn/blob/54cafee9db3054dc310a28b856be7f97c7d5aee9/examples/tf/seal/induce_graph_cn_with_edge.py#L21-L70 | |
wxWidgets/wxPython-Classic | 19571e1ae65f1ac445f5491474121998c97a1bf0 | wx/tools/Editra/src/ebmlib/txtutil.py | python | IsUnicode | (txt) | return isinstance(txt, types.UnicodeType) | Is the given string a unicode string
@param txt: object
@return: bool | Is the given string a unicode string
@param txt: object
@return: bool | [
"Is",
"the",
"given",
"string",
"a",
"unicode",
"string",
"@param",
"txt",
":",
"object",
"@return",
":",
"bool"
] | def IsUnicode(txt):
"""Is the given string a unicode string
@param txt: object
@return: bool
"""
return isinstance(txt, types.UnicodeType) | [
"def",
"IsUnicode",
"(",
"txt",
")",
":",
"return",
"isinstance",
"(",
"txt",
",",
"types",
".",
"UnicodeType",
")"
] | https://github.com/wxWidgets/wxPython-Classic/blob/19571e1ae65f1ac445f5491474121998c97a1bf0/wx/tools/Editra/src/ebmlib/txtutil.py#L28-L34 | |
catboost/catboost | 167f64f237114a4d10b2b4ee42adb4569137debe | contrib/tools/python3/src/Lib/_pydecimal.py | python | Context.create_decimal | (self, num='0') | return d._fix(self) | Creates a new Decimal instance but using self as context.
This method implements the to-number operation of the
IBM Decimal specification. | Creates a new Decimal instance but using self as context. | [
"Creates",
"a",
"new",
"Decimal",
"instance",
"but",
"using",
"self",
"as",
"context",
"."
] | def create_decimal(self, num='0'):
"""Creates a new Decimal instance but using self as context.
This method implements the to-number operation of the
IBM Decimal specification."""
if isinstance(num, str) and (num != num.strip() or '_' in num):
return self._raise_error(Conve... | [
"def",
"create_decimal",
"(",
"self",
",",
"num",
"=",
"'0'",
")",
":",
"if",
"isinstance",
"(",
"num",
",",
"str",
")",
"and",
"(",
"num",
"!=",
"num",
".",
"strip",
"(",
")",
"or",
"'_'",
"in",
"num",
")",
":",
"return",
"self",
".",
"_raise_er... | https://github.com/catboost/catboost/blob/167f64f237114a4d10b2b4ee42adb4569137debe/contrib/tools/python3/src/Lib/_pydecimal.py#L4094-L4109 | |
falkTX/Carla | 74a1ae82c90db85f20550ddcdc8a927b8fb7e414 | source/modules/lilv/lilv-0.24.0/bindings/python/lilv.py | python | World.get_all_plugins | (self) | return Plugins(self, _lib.lilv_world_get_all_plugins(self.world)) | Return a list of all found plugins.
The returned list contains just enough references to query
or instantiate plugins. The data for a particular plugin will not be
loaded into memory until a call to an lilv_plugin_* function results in
a query (at which time the data is cached with the... | Return a list of all found plugins. | [
"Return",
"a",
"list",
"of",
"all",
"found",
"plugins",
"."
] | def get_all_plugins(self):
"""Return a list of all found plugins.
The returned list contains just enough references to query
or instantiate plugins. The data for a particular plugin will not be
loaded into memory until a call to an lilv_plugin_* function results in
a query (at ... | [
"def",
"get_all_plugins",
"(",
"self",
")",
":",
"return",
"Plugins",
"(",
"self",
",",
"_lib",
".",
"lilv_world_get_all_plugins",
"(",
"self",
".",
"world",
")",
")"
] | https://github.com/falkTX/Carla/blob/74a1ae82c90db85f20550ddcdc8a927b8fb7e414/source/modules/lilv/lilv-0.24.0/bindings/python/lilv.py#L1107-L1119 | |
microsoft/ivy | 9f3c7ecc0b2383129fdd0953e10890d98d09a82d | ivy/ivy_cpp.py | python | add_member | (code) | Adds code to the current member context. | Adds code to the current member context. | [
"Adds",
"code",
"to",
"the",
"current",
"member",
"context",
"."
] | def add_member(code):
""" Adds code to the current member context. """
context.members.write(code) | [
"def",
"add_member",
"(",
"code",
")",
":",
"context",
".",
"members",
".",
"write",
"(",
"code",
")"
] | https://github.com/microsoft/ivy/blob/9f3c7ecc0b2383129fdd0953e10890d98d09a82d/ivy/ivy_cpp.py#L125-L127 | ||
catboost/catboost | 167f64f237114a4d10b2b4ee42adb4569137debe | contrib/tools/python3/src/Lib/lib2to3/refactor.py | python | RefactoringTool.refactor_file | (self, filename, write=False, doctests_only=False) | Refactors a file. | Refactors a file. | [
"Refactors",
"a",
"file",
"."
] | def refactor_file(self, filename, write=False, doctests_only=False):
"""Refactors a file."""
input, encoding = self._read_python_source(filename)
if input is None:
# Reading the file failed.
return
input += "\n" # Silence certain parse errors
if doctests_o... | [
"def",
"refactor_file",
"(",
"self",
",",
"filename",
",",
"write",
"=",
"False",
",",
"doctests_only",
"=",
"False",
")",
":",
"input",
",",
"encoding",
"=",
"self",
".",
"_read_python_source",
"(",
"filename",
")",
"if",
"input",
"is",
"None",
":",
"# ... | https://github.com/catboost/catboost/blob/167f64f237114a4d10b2b4ee42adb4569137debe/contrib/tools/python3/src/Lib/lib2to3/refactor.py#L324-L345 | ||
aws/lumberyard | f85344403c1c2e77ec8c75deb2c116e97b713217 | dev/Tools/Python/3.7.10/linux_x64/lib/python3.7/lib2to3/pgen2/driver.py | python | load_grammar | (gt="Grammar.txt", gp=None,
save=True, force=False, logger=None) | return g | Load the grammar (maybe from a pickle). | Load the grammar (maybe from a pickle). | [
"Load",
"the",
"grammar",
"(",
"maybe",
"from",
"a",
"pickle",
")",
"."
] | def load_grammar(gt="Grammar.txt", gp=None,
save=True, force=False, logger=None):
"""Load the grammar (maybe from a pickle)."""
if logger is None:
logger = logging.getLogger()
gp = _generate_pickle_name(gt) if gp is None else gp
if force or not _newer(gp, gt):
logger.inf... | [
"def",
"load_grammar",
"(",
"gt",
"=",
"\"Grammar.txt\"",
",",
"gp",
"=",
"None",
",",
"save",
"=",
"True",
",",
"force",
"=",
"False",
",",
"logger",
"=",
"None",
")",
":",
"if",
"logger",
"is",
"None",
":",
"logger",
"=",
"logging",
".",
"getLogger... | https://github.com/aws/lumberyard/blob/f85344403c1c2e77ec8c75deb2c116e97b713217/dev/Tools/Python/3.7.10/linux_x64/lib/python3.7/lib2to3/pgen2/driver.py#L114-L132 | |
aws/lumberyard | f85344403c1c2e77ec8c75deb2c116e97b713217 | dev/Tools/Python/3.7.10/windows/Lib/site-packages/botocore/handlers.py | python | validate_ascii_metadata | (params, **kwargs) | Verify S3 Metadata only contains ascii characters.
From: http://docs.aws.amazon.com/AmazonS3/latest/dev/UsingMetadata.html
"Amazon S3 stores user-defined metadata in lowercase. Each name, value pair
must conform to US-ASCII when using REST and UTF-8 when using SOAP or
browser-based uploads via POST." | Verify S3 Metadata only contains ascii characters. | [
"Verify",
"S3",
"Metadata",
"only",
"contains",
"ascii",
"characters",
"."
] | def validate_ascii_metadata(params, **kwargs):
"""Verify S3 Metadata only contains ascii characters.
From: http://docs.aws.amazon.com/AmazonS3/latest/dev/UsingMetadata.html
"Amazon S3 stores user-defined metadata in lowercase. Each name, value pair
must conform to US-ASCII when using REST and UTF-8 wh... | [
"def",
"validate_ascii_metadata",
"(",
"params",
",",
"*",
"*",
"kwargs",
")",
":",
"metadata",
"=",
"params",
".",
"get",
"(",
"'Metadata'",
")",
"if",
"not",
"metadata",
"or",
"not",
"isinstance",
"(",
"metadata",
",",
"dict",
")",
":",
"# We have to at ... | https://github.com/aws/lumberyard/blob/f85344403c1c2e77ec8c75deb2c116e97b713217/dev/Tools/Python/3.7.10/windows/Lib/site-packages/botocore/handlers.py#L517-L546 | ||
wxWidgets/wxPython-Classic | 19571e1ae65f1ac445f5491474121998c97a1bf0 | src/msw/html.py | python | HtmlCell.IsTerminalCell | (*args, **kwargs) | return _html.HtmlCell_IsTerminalCell(*args, **kwargs) | IsTerminalCell(self) -> bool | IsTerminalCell(self) -> bool | [
"IsTerminalCell",
"(",
"self",
")",
"-",
">",
"bool"
] | def IsTerminalCell(*args, **kwargs):
"""IsTerminalCell(self) -> bool"""
return _html.HtmlCell_IsTerminalCell(*args, **kwargs) | [
"def",
"IsTerminalCell",
"(",
"*",
"args",
",",
"*",
"*",
"kwargs",
")",
":",
"return",
"_html",
".",
"HtmlCell_IsTerminalCell",
"(",
"*",
"args",
",",
"*",
"*",
"kwargs",
")"
] | https://github.com/wxWidgets/wxPython-Classic/blob/19571e1ae65f1ac445f5491474121998c97a1bf0/src/msw/html.py#L710-L712 | |
google/iree | 1224bbdbe65b0d1fdf40e7324f60f68beeaf7c76 | integrations/tensorflow/python_projects/iree_tf/iree/tf/support/module_utils.py | python | TfCompiledModule.__init__ | (
self,
module_name: str,
backend_info: "BackendInfo",
constructor: Callable[[], tf.Module],
exported_names: Sequence[str],
) | Base constructor – Use one of the named constructors instead.
Args:
module_name: A name for this compiled module. In most cases this will be
the name of the tf.Module subclass or instance that is compiled.
backend_info: BackendInfo with the details about compiling this module.
constructor... | Base constructor – Use one of the named constructors instead. | [
"Base",
"constructor",
"–",
"Use",
"one",
"of",
"the",
"named",
"constructors",
"instead",
"."
] | def __init__(
self,
module_name: str,
backend_info: "BackendInfo",
constructor: Callable[[], tf.Module],
exported_names: Sequence[str],
):
"""Base constructor – Use one of the named constructors instead.
Args:
module_name: A name for this compiled module. In most cases thi... | [
"def",
"__init__",
"(",
"self",
",",
"module_name",
":",
"str",
",",
"backend_info",
":",
"\"BackendInfo\"",
",",
"constructor",
":",
"Callable",
"[",
"[",
"]",
",",
"tf",
".",
"Module",
"]",
",",
"exported_names",
":",
"Sequence",
"[",
"str",
"]",
",",
... | https://github.com/google/iree/blob/1224bbdbe65b0d1fdf40e7324f60f68beeaf7c76/integrations/tensorflow/python_projects/iree_tf/iree/tf/support/module_utils.py#L490-L512 | ||
catboost/catboost | 167f64f237114a4d10b2b4ee42adb4569137debe | contrib/python/pandas/py3/pandas/io/formats/info.py | python | TableBuilderAbstract.dtype_counts | (self) | return self.info.dtype_counts | Mapping dtype - number of counts. | Mapping dtype - number of counts. | [
"Mapping",
"dtype",
"-",
"number",
"of",
"counts",
"."
] | def dtype_counts(self) -> Mapping[str, int]:
"""Mapping dtype - number of counts."""
return self.info.dtype_counts | [
"def",
"dtype_counts",
"(",
"self",
")",
"->",
"Mapping",
"[",
"str",
",",
"int",
"]",
":",
"return",
"self",
".",
"info",
".",
"dtype_counts"
] | https://github.com/catboost/catboost/blob/167f64f237114a4d10b2b4ee42adb4569137debe/contrib/python/pandas/py3/pandas/io/formats/info.py#L425-L427 | |
aws/lumberyard | f85344403c1c2e77ec8c75deb2c116e97b713217 | dev/Gems/CloudGemMetric/v1/AWS/common-code/Lib/numba/dataflow.py | python | DataFlowAnalysis.op_WITH_CLEANUP | (self, info, inst) | Note: py2 only opcode | Note: py2 only opcode | [
"Note",
":",
"py2",
"only",
"opcode"
] | def op_WITH_CLEANUP(self, info, inst):
"""
Note: py2 only opcode
"""
# TOS is the return value of __exit__()
info.pop()
info.append(inst) | [
"def",
"op_WITH_CLEANUP",
"(",
"self",
",",
"info",
",",
"inst",
")",
":",
"# TOS is the return value of __exit__()",
"info",
".",
"pop",
"(",
")",
"info",
".",
"append",
"(",
"inst",
")"
] | https://github.com/aws/lumberyard/blob/f85344403c1c2e77ec8c75deb2c116e97b713217/dev/Gems/CloudGemMetric/v1/AWS/common-code/Lib/numba/dataflow.py#L692-L698 | ||
bundy-dns/bundy | 3d41934996b82b0cd2fe22dd74d2abc1daba835d | src/lib/python/bundy/bundy/component.py | python | BaseComponent.kill | (self, forceful=False) | Kills the component.
If forcefull is true, it should do it in more direct and aggressive way
(for example by using SIGKILL or some equivalent). If it is false, more
peaceful way should be used (SIGTERM or equivalent).
You need to provide this method in a concrete implementation. | Kills the component. | [
"Kills",
"the",
"component",
"."
] | def kill(self, forceful=False):
"""
Kills the component.
If forcefull is true, it should do it in more direct and aggressive way
(for example by using SIGKILL or some equivalent). If it is false, more
peaceful way should be used (SIGTERM or equivalent).
You need to prov... | [
"def",
"kill",
"(",
"self",
",",
"forceful",
"=",
"False",
")",
":",
"pass"
] | https://github.com/bundy-dns/bundy/blob/3d41934996b82b0cd2fe22dd74d2abc1daba835d/src/lib/python/bundy/bundy/component.py#L380-L390 | ||
bareos/bareos | 56a10bb368b0a81e977bb51304033fe49d59efb0 | restapi/bareos_restapi/__init__.py | python | read_director_version | (
*, response: Response, current_user: User = Depends(get_current_user)
) | Read director version. Command used: _version_ | Read director version. Command used: _version_ | [
"Read",
"director",
"version",
".",
"Command",
"used",
":",
"_version_"
] | def read_director_version(
*, response: Response, current_user: User = Depends(get_current_user)
):
"""
Read director version. Command used: _version_
"""
result = None
dirCommand = "version"
try:
result = current_user.jsonDirector.call(dirCommand)
except Exception as e:
... | [
"def",
"read_director_version",
"(",
"*",
",",
"response",
":",
"Response",
",",
"current_user",
":",
"User",
"=",
"Depends",
"(",
"get_current_user",
")",
")",
":",
"result",
"=",
"None",
"dirCommand",
"=",
"\"version\"",
"try",
":",
"result",
"=",
"current... | https://github.com/bareos/bareos/blob/56a10bb368b0a81e977bb51304033fe49d59efb0/restapi/bareos_restapi/__init__.py#L1945-L1963 | ||
hanpfei/chromium-net | 392cc1fa3a8f92f42e4071ab6e674d8e0482f83f | third_party/catapult/third_party/pyfakefs/pyfakefs/fake_filesystem.py | python | FakeOsModule.getcwd | (self) | return self.filesystem.cwd | Return current working directory. | Return current working directory. | [
"Return",
"current",
"working",
"directory",
"."
] | def getcwd(self):
"""Return current working directory."""
return self.filesystem.cwd | [
"def",
"getcwd",
"(",
"self",
")",
":",
"return",
"self",
".",
"filesystem",
".",
"cwd"
] | https://github.com/hanpfei/chromium-net/blob/392cc1fa3a8f92f42e4071ab6e674d8e0482f83f/third_party/catapult/third_party/pyfakefs/pyfakefs/fake_filesystem.py#L1388-L1390 | |
catboost/catboost | 167f64f237114a4d10b2b4ee42adb4569137debe | contrib/tools/python/src/Lib/cookielib.py | python | iso2time | (text) | return _str2time(day, mon, yr, hr, min, sec, tz) | As for http2time, but parses the ISO 8601 formats:
1994-02-03 14:15:29 -0100 -- ISO 8601 format
1994-02-03 14:15:29 -- zone is optional
1994-02-03 -- only date
1994-02-03T14:15:29 -- Use T as separator
19940203T141529Z -- ISO 8601 compact format
... | As for http2time, but parses the ISO 8601 formats: | [
"As",
"for",
"http2time",
"but",
"parses",
"the",
"ISO",
"8601",
"formats",
":"
] | def iso2time(text):
"""
As for http2time, but parses the ISO 8601 formats:
1994-02-03 14:15:29 -0100 -- ISO 8601 format
1994-02-03 14:15:29 -- zone is optional
1994-02-03 -- only date
1994-02-03T14:15:29 -- Use T as separator
19940203T141529Z ... | [
"def",
"iso2time",
"(",
"text",
")",
":",
"# clean up",
"text",
"=",
"text",
".",
"lstrip",
"(",
")",
"# tz is time zone specifier string",
"day",
",",
"mon",
",",
"yr",
",",
"hr",
",",
"min",
",",
"sec",
",",
"tz",
"=",
"[",
"None",
"]",
"*",
"7",
... | https://github.com/catboost/catboost/blob/167f64f237114a4d10b2b4ee42adb4569137debe/contrib/tools/python/src/Lib/cookielib.py#L284-L311 | |
devpack/android-python27 | d42dd67565e104cf7b0b50eb473f615db3e69901 | python-build-with-qt/sip-4.11.2/sipconfig.py | python | _UniqueList.__init__ | (self, value=None) | Initialise the instance.
value is the initial value of the list. | Initialise the instance. | [
"Initialise",
"the",
"instance",
"."
] | def __init__(self, value=None):
"""Initialise the instance.
value is the initial value of the list.
"""
if value is None:
self._list = []
else:
self._list = value | [
"def",
"__init__",
"(",
"self",
",",
"value",
"=",
"None",
")",
":",
"if",
"value",
"is",
"None",
":",
"self",
".",
"_list",
"=",
"[",
"]",
"else",
":",
"self",
".",
"_list",
"=",
"value"
] | https://github.com/devpack/android-python27/blob/d42dd67565e104cf7b0b50eb473f615db3e69901/python-build-with-qt/sip-4.11.2/sipconfig.py#L206-L214 | ||
wlanjie/AndroidFFmpeg | 7baf9122f4b8e1c74e7baf4be5c422c7a5ba5aaf | tools/fdk-aac-build/armeabi-v7a/toolchain/share/gdb/python/gdb/prompt.py | python | _prompt_object_attr | (func, what, attr, nattr) | Internal worker for fetching GDB attributes. | Internal worker for fetching GDB attributes. | [
"Internal",
"worker",
"for",
"fetching",
"GDB",
"attributes",
"."
] | def _prompt_object_attr(func, what, attr, nattr):
"""Internal worker for fetching GDB attributes."""
if attr is None:
attr = nattr
try:
obj = func()
except gdb.error:
return '<no %s>' % what
if hasattr(obj, attr):
result = getattr(obj, attr)
if callable(result... | [
"def",
"_prompt_object_attr",
"(",
"func",
",",
"what",
",",
"attr",
",",
"nattr",
")",
":",
"if",
"attr",
"is",
"None",
":",
"attr",
"=",
"nattr",
"try",
":",
"obj",
"=",
"func",
"(",
")",
"except",
"gdb",
".",
"error",
":",
"return",
"'<no %s>'",
... | https://github.com/wlanjie/AndroidFFmpeg/blob/7baf9122f4b8e1c74e7baf4be5c422c7a5ba5aaf/tools/fdk-aac-build/armeabi-v7a/toolchain/share/gdb/python/gdb/prompt.py#L26-L40 | ||
Xilinx/Vitis-AI | fc74d404563d9951b57245443c73bef389f3657f | tools/Vitis-AI-Quantizer/vai_q_tensorflow1.x/tensorflow/python/tpu/tpu_embedding.py | python | TPUEmbedding.batch_size_per_core | (self) | return self._batch_size_per_core | Batch size for each TPU core.
The sparse tensors in `sparse_features_list` to `generate_enqueue_ops`
must have batch dimension equal to this.
Returns:
Batch size for each TPU core. | Batch size for each TPU core. | [
"Batch",
"size",
"for",
"each",
"TPU",
"core",
"."
] | def batch_size_per_core(self):
"""Batch size for each TPU core.
The sparse tensors in `sparse_features_list` to `generate_enqueue_ops`
must have batch dimension equal to this.
Returns:
Batch size for each TPU core.
"""
return self._batch_size_per_core | [
"def",
"batch_size_per_core",
"(",
"self",
")",
":",
"return",
"self",
".",
"_batch_size_per_core"
] | https://github.com/Xilinx/Vitis-AI/blob/fc74d404563d9951b57245443c73bef389f3657f/tools/Vitis-AI-Quantizer/vai_q_tensorflow1.x/tensorflow/python/tpu/tpu_embedding.py#L647-L656 | |
kamyu104/LeetCode-Solutions | 77605708a927ea3b85aee5a479db733938c7c211 | Python/best-position-for-a-service-centre.py | python | Solution.getMinDistSum | (self, positions) | return sum(norm(median, p) for p in positions) | :type positions: List[List[int]]
:rtype: float | :type positions: List[List[int]]
:rtype: float | [
":",
"type",
"positions",
":",
"List",
"[",
"List",
"[",
"int",
"]]",
":",
"rtype",
":",
"float"
] | def getMinDistSum(self, positions):
"""
:type positions: List[List[int]]
:rtype: float
"""
EPS = 1e-6
def norm(p1, p2):
return ((p1[0]-p2[0])**2 + (p1[1]-p2[1])**2)**0.5
def geometry_median(positions, median):
numerator, denominato... | [
"def",
"getMinDistSum",
"(",
"self",
",",
"positions",
")",
":",
"EPS",
"=",
"1e-6",
"def",
"norm",
"(",
"p1",
",",
"p2",
")",
":",
"return",
"(",
"(",
"p1",
"[",
"0",
"]",
"-",
"p2",
"[",
"0",
"]",
")",
"**",
"2",
"+",
"(",
"p1",
"[",
"1",... | https://github.com/kamyu104/LeetCode-Solutions/blob/77605708a927ea3b85aee5a479db733938c7c211/Python/best-position-for-a-service-centre.py#L9-L39 | |
openvinotoolkit/openvino | dedcbeafa8b84cccdc55ca64b8da516682b381c7 | tools/mo/openvino/tools/mo/graph/graph.py | python | set_edge_attribute_between_nodes | (node1: Node, node2: Node, attr_name: str, new_value) | Sets edge attribute value between two nodes.
This method is introduced for implementation of manual replacing of nodes attributes
with tensor debug information. It is needed after removing of fake outputs.
Also there are cases when graph transformations lead to mismatch of tensor name
and input node, so... | Sets edge attribute value between two nodes.
This method is introduced for implementation of manual replacing of nodes attributes
with tensor debug information. It is needed after removing of fake outputs.
Also there are cases when graph transformations lead to mismatch of tensor name
and input node, so... | [
"Sets",
"edge",
"attribute",
"value",
"between",
"two",
"nodes",
".",
"This",
"method",
"is",
"introduced",
"for",
"implementation",
"of",
"manual",
"replacing",
"of",
"nodes",
"attributes",
"with",
"tensor",
"debug",
"information",
".",
"It",
"is",
"needed",
... | def set_edge_attribute_between_nodes(node1: Node, node2: Node, attr_name: str, new_value):
"""
Sets edge attribute value between two nodes.
This method is introduced for implementation of manual replacing of nodes attributes
with tensor debug information. It is needed after removing of fake outputs.
... | [
"def",
"set_edge_attribute_between_nodes",
"(",
"node1",
":",
"Node",
",",
"node2",
":",
"Node",
",",
"attr_name",
":",
"str",
",",
"new_value",
")",
":",
"for",
"edge_idx",
"in",
"node1",
".",
"out_edges",
"(",
")",
":",
"edge",
"=",
"node1",
".",
"out_... | https://github.com/openvinotoolkit/openvino/blob/dedcbeafa8b84cccdc55ca64b8da516682b381c7/tools/mo/openvino/tools/mo/graph/graph.py#L1179-L1194 | ||
apple/turicreate | cce55aa5311300e3ce6af93cb45ba791fd1bdf49 | deps/src/libxml2-2.9.1/python/libxml2.py | python | xmlDoc.nodeDumpOutput | (self, buf, cur, level, format, encoding) | Dump an XML node, recursive behaviour, children are printed
too. Note that @format = 1 provide node indenting only if
xmlIndentTreeOutput = 1 or xmlKeepBlanksDefault(0) was
called | Dump an XML node, recursive behaviour, children are printed
too. Note that | [
"Dump",
"an",
"XML",
"node",
"recursive",
"behaviour",
"children",
"are",
"printed",
"too",
".",
"Note",
"that"
] | def nodeDumpOutput(self, buf, cur, level, format, encoding):
"""Dump an XML node, recursive behaviour, children are printed
too. Note that @format = 1 provide node indenting only if
xmlIndentTreeOutput = 1 or xmlKeepBlanksDefault(0) was
called """
if buf is None: buf__o = ... | [
"def",
"nodeDumpOutput",
"(",
"self",
",",
"buf",
",",
"cur",
",",
"level",
",",
"format",
",",
"encoding",
")",
":",
"if",
"buf",
"is",
"None",
":",
"buf__o",
"=",
"None",
"else",
":",
"buf__o",
"=",
"buf",
".",
"_o",
"if",
"cur",
"is",
"None",
... | https://github.com/apple/turicreate/blob/cce55aa5311300e3ce6af93cb45ba791fd1bdf49/deps/src/libxml2-2.9.1/python/libxml2.py#L4418-L4427 | ||
openmm/openmm | cb293447c4fc8b03976dfe11399f107bab70f3d9 | wrappers/python/openmm/app/topology.py | python | Topology.createDisulfideBonds | (self, positions) | Identify disulfide bonds based on proximity and add them to the
Topology.
Parameters
----------
positions : list
The list of atomic positions based on which to identify bonded atoms | Identify disulfide bonds based on proximity and add them to the
Topology. | [
"Identify",
"disulfide",
"bonds",
"based",
"on",
"proximity",
"and",
"add",
"them",
"to",
"the",
"Topology",
"."
] | def createDisulfideBonds(self, positions):
"""Identify disulfide bonds based on proximity and add them to the
Topology.
Parameters
----------
positions : list
The list of atomic positions based on which to identify bonded atoms
"""
def isCyx(res):
... | [
"def",
"createDisulfideBonds",
"(",
"self",
",",
"positions",
")",
":",
"def",
"isCyx",
"(",
"res",
")",
":",
"names",
"=",
"[",
"atom",
".",
"name",
"for",
"atom",
"in",
"res",
".",
"_atoms",
"]",
"return",
"'SG'",
"in",
"names",
"and",
"'HG'",
"not... | https://github.com/openmm/openmm/blob/cb293447c4fc8b03976dfe11399f107bab70f3d9/wrappers/python/openmm/app/topology.py#L344-L382 | ||
catboost/catboost | 167f64f237114a4d10b2b4ee42adb4569137debe | contrib/python/pandas/py2/pandas/core/groupby/generic.py | python | SeriesGroupBy._transform_fast | (self, func, func_nm) | return Series(out, index=self.obj.index, name=self.obj.name) | fast version of transform, only applicable to
builtin/cythonizable functions | fast version of transform, only applicable to
builtin/cythonizable functions | [
"fast",
"version",
"of",
"transform",
"only",
"applicable",
"to",
"builtin",
"/",
"cythonizable",
"functions"
] | def _transform_fast(self, func, func_nm):
"""
fast version of transform, only applicable to
builtin/cythonizable functions
"""
if isinstance(func, compat.string_types):
func = getattr(self, func)
ids, _, ngroup = self.grouper.group_info
cast = self._t... | [
"def",
"_transform_fast",
"(",
"self",
",",
"func",
",",
"func_nm",
")",
":",
"if",
"isinstance",
"(",
"func",
",",
"compat",
".",
"string_types",
")",
":",
"func",
"=",
"getattr",
"(",
"self",
",",
"func",
")",
"ids",
",",
"_",
",",
"ngroup",
"=",
... | https://github.com/catboost/catboost/blob/167f64f237114a4d10b2b4ee42adb4569137debe/contrib/python/pandas/py2/pandas/core/groupby/generic.py#L958-L971 | |
philres/ngmlr | a2a31fb6a63547be29c5868a7747e0c6f6e9e41f | lib/Complete-Striped-Smith-Waterman-Library/src/pyssw.py | python | count_seq | (filename, seq_type="fasta", gziped=False) | Count the number of sequences in a fastq or a fastq file
@param filename Path to a valid readeable file
@param file_type Should be either fastq or fastq. Default fasta
@param gziped Boolean indicating if the file is gziped or not. Default False | Count the number of sequences in a fastq or a fastq file | [
"Count",
"the",
"number",
"of",
"sequences",
"in",
"a",
"fastq",
"or",
"a",
"fastq",
"file"
] | def count_seq (filename, seq_type="fasta", gziped=False):
"""
Count the number of sequences in a fastq or a fastq file
@param filename Path to a valid readeable file
@param file_type Should be either fastq or fastq. Default fasta
@param gziped Boolean indicating if the file is gziped or not. Default... | [
"def",
"count_seq",
"(",
"filename",
",",
"seq_type",
"=",
"\"fasta\"",
",",
"gziped",
"=",
"False",
")",
":",
"#Standard library import",
"import",
"gzip",
"from",
"mmap",
"import",
"mmap",
"# Verify if the file is fasta or fastq type",
"assert",
"seq_type",
"in",
... | https://github.com/philres/ngmlr/blob/a2a31fb6a63547be29c5868a7747e0c6f6e9e41f/lib/Complete-Striped-Smith-Waterman-Library/src/pyssw.py#L169-L204 | ||
raspberrypi/tools | 13474ee775d0c5ec8a7da4fb0a9fa84187abfc87 | arm-bcm2708/gcc-linaro-arm-linux-gnueabihf-raspbian-x64/share/gdb/python/gdb/types.py | python | make_enum_dict | (enum_type) | return enum_dict | Return a dictionary from a program's enum type.
Arguments:
enum_type: The enum to compute the dictionary for.
Returns:
The dictionary of the enum.
Raises:
TypeError: The type is not an enum. | Return a dictionary from a program's enum type. | [
"Return",
"a",
"dictionary",
"from",
"a",
"program",
"s",
"enum",
"type",
"."
] | def make_enum_dict(enum_type):
"""Return a dictionary from a program's enum type.
Arguments:
enum_type: The enum to compute the dictionary for.
Returns:
The dictionary of the enum.
Raises:
TypeError: The type is not an enum.
"""
if enum_type.code != gdb.TYPE_CODE_ENUM... | [
"def",
"make_enum_dict",
"(",
"enum_type",
")",
":",
"if",
"enum_type",
".",
"code",
"!=",
"gdb",
".",
"TYPE_CODE_ENUM",
":",
"raise",
"TypeError",
"(",
"\"not an enum type\"",
")",
"enum_dict",
"=",
"{",
"}",
"for",
"field",
"in",
"enum_type",
".",
"fields"... | https://github.com/raspberrypi/tools/blob/13474ee775d0c5ec8a7da4fb0a9fa84187abfc87/arm-bcm2708/gcc-linaro-arm-linux-gnueabihf-raspbian-x64/share/gdb/python/gdb/types.py#L72-L91 | |
gem5/gem5 | 141cc37c2d4b93959d4c249b8f7e6a8b2ef75338 | util/minorview/parse.py | python | parse_pairs_list | (pairString) | return ret | parse a string like 'name=value name2=value2' into a
list of pairs of ('name', 'value') ... | parse a string like 'name=value name2=value2' into a
list of pairs of ('name', 'value') ... | [
"parse",
"a",
"string",
"like",
"name",
"=",
"value",
"name2",
"=",
"value2",
"into",
"a",
"list",
"of",
"pairs",
"of",
"(",
"name",
"value",
")",
"..."
] | def parse_pairs_list(pairString):
"""parse a string like 'name=value name2=value2' into a
list of pairs of ('name', 'value') ..."""
ret = []
pairs = re.finditer('(\w+)(=("[^"]*"|[^\s]*))?', pairString)
for pair in pairs:
name, rest, value = pair.groups()
if value is not None:
... | [
"def",
"parse_pairs_list",
"(",
"pairString",
")",
":",
"ret",
"=",
"[",
"]",
"pairs",
"=",
"re",
".",
"finditer",
"(",
"'(\\w+)(=(\"[^\"]*\"|[^\\s]*))?'",
",",
"pairString",
")",
"for",
"pair",
"in",
"pairs",
":",
"name",
",",
"rest",
",",
"value",
"=",
... | https://github.com/gem5/gem5/blob/141cc37c2d4b93959d4c249b8f7e6a8b2ef75338/util/minorview/parse.py#L77-L89 | |
PixarAnimationStudios/USD | faed18ce62c8736b02413635b584a2f637156bad | pxr/usdImaging/usdviewq/appController.py | python | AppController._getGeomCounts | ( self, prim, frame ) | return self._geomCounts[(prim,frame)] | returns cached geom counts if available, or calls _calculateGeomCounts() | returns cached geom counts if available, or calls _calculateGeomCounts() | [
"returns",
"cached",
"geom",
"counts",
"if",
"available",
"or",
"calls",
"_calculateGeomCounts",
"()"
] | def _getGeomCounts( self, prim, frame ):
"""returns cached geom counts if available, or calls _calculateGeomCounts()"""
if (prim,frame) not in self._geomCounts:
self._calculateGeomCounts( prim, frame )
return self._geomCounts[(prim,frame)] | [
"def",
"_getGeomCounts",
"(",
"self",
",",
"prim",
",",
"frame",
")",
":",
"if",
"(",
"prim",
",",
"frame",
")",
"not",
"in",
"self",
".",
"_geomCounts",
":",
"self",
".",
"_calculateGeomCounts",
"(",
"prim",
",",
"frame",
")",
"return",
"self",
".",
... | https://github.com/PixarAnimationStudios/USD/blob/faed18ce62c8736b02413635b584a2f637156bad/pxr/usdImaging/usdviewq/appController.py#L4326-L4331 | |
aws/lumberyard | f85344403c1c2e77ec8c75deb2c116e97b713217 | dev/Tools/Python/3.7.10/linux_x64/lib/python3.7/site-packages/pip/_vendor/distlib/_backport/tarfile.py | python | _Stream.write | (self, s) | Write string s to the stream. | Write string s to the stream. | [
"Write",
"string",
"s",
"to",
"the",
"stream",
"."
] | def write(self, s):
"""Write string s to the stream.
"""
if self.comptype == "gz":
self.crc = self.zlib.crc32(s, self.crc)
self.pos += len(s)
if self.comptype != "tar":
s = self.cmp.compress(s)
self.__write(s) | [
"def",
"write",
"(",
"self",
",",
"s",
")",
":",
"if",
"self",
".",
"comptype",
"==",
"\"gz\"",
":",
"self",
".",
"crc",
"=",
"self",
".",
"zlib",
".",
"crc32",
"(",
"s",
",",
"self",
".",
"crc",
")",
"self",
".",
"pos",
"+=",
"len",
"(",
"s"... | https://github.com/aws/lumberyard/blob/f85344403c1c2e77ec8c75deb2c116e97b713217/dev/Tools/Python/3.7.10/linux_x64/lib/python3.7/site-packages/pip/_vendor/distlib/_backport/tarfile.py#L937-L953 | ||
wlanjie/AndroidFFmpeg | 7baf9122f4b8e1c74e7baf4be5c422c7a5ba5aaf | tools/fdk-aac-build/x86/toolchain/lib/python2.7/urllib2.py | python | HTTPPasswordMgr.reduce_uri | (self, uri, default_port=True) | return authority, path | Accept authority or URI and extract only the authority and path. | Accept authority or URI and extract only the authority and path. | [
"Accept",
"authority",
"or",
"URI",
"and",
"extract",
"only",
"the",
"authority",
"and",
"path",
"."
] | def reduce_uri(self, uri, default_port=True):
"""Accept authority or URI and extract only the authority and path."""
# note HTTP URLs do not have a userinfo component
parts = urlparse.urlsplit(uri)
if parts[1]:
# URI
scheme = parts[0]
authority = parts... | [
"def",
"reduce_uri",
"(",
"self",
",",
"uri",
",",
"default_port",
"=",
"True",
")",
":",
"# note HTTP URLs do not have a userinfo component",
"parts",
"=",
"urlparse",
".",
"urlsplit",
"(",
"uri",
")",
"if",
"parts",
"[",
"1",
"]",
":",
"# URI",
"scheme",
"... | https://github.com/wlanjie/AndroidFFmpeg/blob/7baf9122f4b8e1c74e7baf4be5c422c7a5ba5aaf/tools/fdk-aac-build/x86/toolchain/lib/python2.7/urllib2.py#L779-L800 | |
catboost/catboost | 167f64f237114a4d10b2b4ee42adb4569137debe | contrib/tools/python3/src/Lib/platform.py | python | node | () | return uname().node | Returns the computer's network name (which may not be fully
qualified)
An empty string is returned if the value cannot be determined. | Returns the computer's network name (which may not be fully
qualified) | [
"Returns",
"the",
"computer",
"s",
"network",
"name",
"(",
"which",
"may",
"not",
"be",
"fully",
"qualified",
")"
] | def node():
""" Returns the computer's network name (which may not be fully
qualified)
An empty string is returned if the value cannot be determined.
"""
return uname().node | [
"def",
"node",
"(",
")",
":",
"return",
"uname",
"(",
")",
".",
"node"
] | https://github.com/catboost/catboost/blob/167f64f237114a4d10b2b4ee42adb4569137debe/contrib/tools/python3/src/Lib/platform.py#L923-L931 | |
devsisters/libquic | 8954789a056d8e7d5fcb6452fd1572ca57eb5c4e | src/third_party/protobuf/python/mox.py | python | StrContains.__init__ | (self, search_string) | Initialize.
Args:
# search_string: the string you are searching for
search_string: str | Initialize. | [
"Initialize",
"."
] | def __init__(self, search_string):
"""Initialize.
Args:
# search_string: the string you are searching for
search_string: str
"""
self._search_string = search_string | [
"def",
"__init__",
"(",
"self",
",",
"search_string",
")",
":",
"self",
".",
"_search_string",
"=",
"search_string"
] | https://github.com/devsisters/libquic/blob/8954789a056d8e7d5fcb6452fd1572ca57eb5c4e/src/third_party/protobuf/python/mox.py#L874-L882 | ||
rdiankov/openrave | d1a23023fd4b58f077d2ca949ceaf1b91f3f13d7 | python/ikfast.py | python | IKFastSolver.SimplifyAtan2 | (self, eq, incos=False, insin=False, epsilon=None) | return neweq | simplifies equations like sin(atan2(y,x)) to y/sqrt(x**2+y**2)
Sometimes can get equations like
sin(-atan2(-r21, -r20))
cos(-atan2(-r21, -r20) + 3.14159265358979)
which means the operations internally have to be carried over | simplifies equations like sin(atan2(y,x)) to y/sqrt(x**2+y**2)
Sometimes can get equations like
sin(-atan2(-r21, -r20))
cos(-atan2(-r21, -r20) + 3.14159265358979)
which means the operations internally have to be carried over | [
"simplifies",
"equations",
"like",
"sin",
"(",
"atan2",
"(",
"y",
"x",
"))",
"to",
"y",
"/",
"sqrt",
"(",
"x",
"**",
"2",
"+",
"y",
"**",
"2",
")",
"Sometimes",
"can",
"get",
"equations",
"like",
"sin",
"(",
"-",
"atan2",
"(",
"-",
"r21",
"-",
... | def SimplifyAtan2(self, eq, incos=False, insin=False, epsilon=None):
"""simplifies equations like sin(atan2(y,x)) to y/sqrt(x**2+y**2)
Sometimes can get equations like
sin(-atan2(-r21, -r20))
cos(-atan2(-r21, -r20) + 3.14159265358979)
which means the operations ... | [
"def",
"SimplifyAtan2",
"(",
"self",
",",
"eq",
",",
"incos",
"=",
"False",
",",
"insin",
"=",
"False",
",",
"epsilon",
"=",
"None",
")",
":",
"processed",
"=",
"False",
"# if incos or insin set to True, then this flag specifies whether the function was already taking i... | https://github.com/rdiankov/openrave/blob/d1a23023fd4b58f077d2ca949ceaf1b91f3f13d7/python/ikfast.py#L1784-L1907 | |
aws/lumberyard | f85344403c1c2e77ec8c75deb2c116e97b713217 | dev/Gems/CloudGemMetric/v1/AWS/common-code/Lib/numba/npyufunc/deviceufunc.py | python | _multi_broadcast | (*shapelist) | Raises
------
ValueError if broadcast fails | Raises
------
ValueError if broadcast fails | [
"Raises",
"------",
"ValueError",
"if",
"broadcast",
"fails"
] | def _multi_broadcast(*shapelist):
"""
Raises
------
ValueError if broadcast fails
"""
assert shapelist
result = shapelist[0]
others = shapelist[1:]
try:
for i, each in enumerate(others, start=1):
result = _pairwise_broadcast(result, each)
except ValueError:
... | [
"def",
"_multi_broadcast",
"(",
"*",
"shapelist",
")",
":",
"assert",
"shapelist",
"result",
"=",
"shapelist",
"[",
"0",
"]",
"others",
"=",
"shapelist",
"[",
"1",
":",
"]",
"try",
":",
"for",
"i",
",",
"each",
"in",
"enumerate",
"(",
"others",
",",
... | https://github.com/aws/lumberyard/blob/f85344403c1c2e77ec8c75deb2c116e97b713217/dev/Gems/CloudGemMetric/v1/AWS/common-code/Lib/numba/npyufunc/deviceufunc.py#L55-L71 | ||
catboost/catboost | 167f64f237114a4d10b2b4ee42adb4569137debe | contrib/tools/python/src/Lib/decimal.py | python | Decimal._round_down | (self, prec) | Also known as round-towards-0, truncate. | Also known as round-towards-0, truncate. | [
"Also",
"known",
"as",
"round",
"-",
"towards",
"-",
"0",
"truncate",
"."
] | def _round_down(self, prec):
"""Also known as round-towards-0, truncate."""
if _all_zeros(self._int, prec):
return 0
else:
return -1 | [
"def",
"_round_down",
"(",
"self",
",",
"prec",
")",
":",
"if",
"_all_zeros",
"(",
"self",
".",
"_int",
",",
"prec",
")",
":",
"return",
"0",
"else",
":",
"return",
"-",
"1"
] | https://github.com/catboost/catboost/blob/167f64f237114a4d10b2b4ee42adb4569137debe/contrib/tools/python/src/Lib/decimal.py#L1740-L1745 | ||
aws/lumberyard | f85344403c1c2e77ec8c75deb2c116e97b713217 | dev/Tools/Python/3.7.10/mac/Python.framework/Versions/3.7/lib/python3.7/http/server.py | python | nobody_uid | () | return nobody | Internal routine to get nobody's uid | Internal routine to get nobody's uid | [
"Internal",
"routine",
"to",
"get",
"nobody",
"s",
"uid"
] | def nobody_uid():
"""Internal routine to get nobody's uid"""
global nobody
if nobody:
return nobody
try:
import pwd
except ImportError:
return -1
try:
nobody = pwd.getpwnam('nobody')[2]
except KeyError:
nobody = 1 + max(x[2] for x in pwd.getpwall())
... | [
"def",
"nobody_uid",
"(",
")",
":",
"global",
"nobody",
"if",
"nobody",
":",
"return",
"nobody",
"try",
":",
"import",
"pwd",
"except",
"ImportError",
":",
"return",
"-",
"1",
"try",
":",
"nobody",
"=",
"pwd",
".",
"getpwnam",
"(",
"'nobody'",
")",
"["... | https://github.com/aws/lumberyard/blob/f85344403c1c2e77ec8c75deb2c116e97b713217/dev/Tools/Python/3.7.10/mac/Python.framework/Versions/3.7/lib/python3.7/http/server.py#L933-L946 | |
mamedev/mame | 02cd26d37ee11191f3e311e19e805d872cb1e3a4 | scripts/build/png.py | python | Reader.undo_filter | (self, filter_type, scanline, previous) | return result | Undo the filter for a scanline. `scanline` is a sequence of
bytes that does not include the initial filter type byte.
`previous` is decoded previous scanline (for straightlaced
images this is the previous pixel row, but for interlaced
images, it is the previous scanline in the reduced i... | Undo the filter for a scanline. `scanline` is a sequence of
bytes that does not include the initial filter type byte.
`previous` is decoded previous scanline (for straightlaced
images this is the previous pixel row, but for interlaced
images, it is the previous scanline in the reduced i... | [
"Undo",
"the",
"filter",
"for",
"a",
"scanline",
".",
"scanline",
"is",
"a",
"sequence",
"of",
"bytes",
"that",
"does",
"not",
"include",
"the",
"initial",
"filter",
"type",
"byte",
".",
"previous",
"is",
"decoded",
"previous",
"scanline",
"(",
"for",
"str... | def undo_filter(self, filter_type, scanline, previous):
"""Undo the filter for a scanline. `scanline` is a sequence of
bytes that does not include the initial filter type byte.
`previous` is decoded previous scanline (for straightlaced
images this is the previous pixel row, but for inte... | [
"def",
"undo_filter",
"(",
"self",
",",
"filter_type",
",",
"scanline",
",",
"previous",
")",
":",
"# :todo: Would it be better to update scanline in place?",
"# Yes, with the Cython extension making the undo_filter fast,",
"# updating scanline inplace makes the code 3 times faster",
"... | https://github.com/mamedev/mame/blob/02cd26d37ee11191f3e311e19e805d872cb1e3a4/scripts/build/png.py#L1471-L1580 | |
esa/pagmo | 80281d549c8f1b470e1489a5d37c8f06b2e429c0 | PyGMO/problem/_gtop.py | python | _mga_incipit_cstrs_ctor | (
self, seq=[
gtoc6('io'), gtoc6('io'), gtoc6('europa')], t0=[
epoch(7305.0), epoch(11323.0)], tof=[
[
100, 200], [
3, 200], [
4, 100]], Tmax=300.00, Dmin=2.0) | USAGE: mga_incipit_cstrs(seq = [gtoc6('io'),gtoc6('io'),gtoc6('europa')], t0 = [epoch(6905.0),epoch(11323.0)], tof = [[100,200],[3,200],[4,100]], Tmax = 365.25, Dmin = 0.2)
* seq: list of jupiter moons defining the trajectory incipit
* t0: list of two epochs defining the launch window
* tof: list of n lis... | USAGE: mga_incipit_cstrs(seq = [gtoc6('io'),gtoc6('io'),gtoc6('europa')], t0 = [epoch(6905.0),epoch(11323.0)], tof = [[100,200],[3,200],[4,100]], Tmax = 365.25, Dmin = 0.2) | [
"USAGE",
":",
"mga_incipit_cstrs",
"(",
"seq",
"=",
"[",
"gtoc6",
"(",
"io",
")",
"gtoc6",
"(",
"io",
")",
"gtoc6",
"(",
"europa",
")",
"]",
"t0",
"=",
"[",
"epoch",
"(",
"6905",
".",
"0",
")",
"epoch",
"(",
"11323",
".",
"0",
")",
"]",
"tof",
... | def _mga_incipit_cstrs_ctor(
self, seq=[
gtoc6('io'), gtoc6('io'), gtoc6('europa')], t0=[
epoch(7305.0), epoch(11323.0)], tof=[
[
100, 200], [
3, 200], [
4, 100]], Tmax=300.00, Dmin=2.0):
"""
USAGE: mga_incipit_cstrs(seq = [gtoc6('io'),gtoc6('io'),... | [
"def",
"_mga_incipit_cstrs_ctor",
"(",
"self",
",",
"seq",
"=",
"[",
"gtoc6",
"(",
"'io'",
")",
",",
"gtoc6",
"(",
"'io'",
")",
",",
"gtoc6",
"(",
"'europa'",
")",
"]",
",",
"t0",
"=",
"[",
"epoch",
"(",
"7305.0",
")",
",",
"epoch",
"(",
"11323.0",... | https://github.com/esa/pagmo/blob/80281d549c8f1b470e1489a5d37c8f06b2e429c0/PyGMO/problem/_gtop.py#L316-L340 | ||
catboost/catboost | 167f64f237114a4d10b2b4ee42adb4569137debe | contrib/python/protobuf/py2/google/protobuf/service.py | python | RpcController.ErrorText | (self) | If Failed is true, returns a human-readable description of the error. | If Failed is true, returns a human-readable description of the error. | [
"If",
"Failed",
"is",
"true",
"returns",
"a",
"human",
"-",
"readable",
"description",
"of",
"the",
"error",
"."
] | def ErrorText(self):
"""If Failed is true, returns a human-readable description of the error."""
raise NotImplementedError | [
"def",
"ErrorText",
"(",
"self",
")",
":",
"raise",
"NotImplementedError"
] | https://github.com/catboost/catboost/blob/167f64f237114a4d10b2b4ee42adb4569137debe/contrib/python/protobuf/py2/google/protobuf/service.py#L152-L154 | ||
baidu-research/tensorflow-allreduce | 66d5b855e90b0949e9fa5cca5599fd729a70e874 | tensorflow/python/framework/ops.py | python | Graph.seed | (self) | return self._seed | The graph-level random seed of this graph. | The graph-level random seed of this graph. | [
"The",
"graph",
"-",
"level",
"random",
"seed",
"of",
"this",
"graph",
"."
] | def seed(self):
"""The graph-level random seed of this graph."""
return self._seed | [
"def",
"seed",
"(",
"self",
")",
":",
"return",
"self",
".",
"_seed"
] | https://github.com/baidu-research/tensorflow-allreduce/blob/66d5b855e90b0949e9fa5cca5599fd729a70e874/tensorflow/python/framework/ops.py#L2355-L2357 | |
baidu-research/tensorflow-allreduce | 66d5b855e90b0949e9fa5cca5599fd729a70e874 | tensorflow/python/ops/nn_impl.py | python | zero_fraction | (value, name=None) | Returns the fraction of zeros in `value`.
If `value` is empty, the result is `nan`.
This is useful in summaries to measure and report sparsity. For example,
```python
z = tf.nn.relu(...)
summ = tf.summary.scalar('sparsity', tf.nn.zero_fraction(z))
```
Args:
value: A tensor of numeric type... | Returns the fraction of zeros in `value`. | [
"Returns",
"the",
"fraction",
"of",
"zeros",
"in",
"value",
"."
] | def zero_fraction(value, name=None):
"""Returns the fraction of zeros in `value`.
If `value` is empty, the result is `nan`.
This is useful in summaries to measure and report sparsity. For example,
```python
z = tf.nn.relu(...)
summ = tf.summary.scalar('sparsity', tf.nn.zero_fraction(z))
```
... | [
"def",
"zero_fraction",
"(",
"value",
",",
"name",
"=",
"None",
")",
":",
"with",
"ops",
".",
"name_scope",
"(",
"name",
",",
"\"zero_fraction\"",
",",
"[",
"value",
"]",
")",
":",
"value",
"=",
"ops",
".",
"convert_to_tensor",
"(",
"value",
",",
"name... | https://github.com/baidu-research/tensorflow-allreduce/blob/66d5b855e90b0949e9fa5cca5599fd729a70e874/tensorflow/python/ops/nn_impl.py#L300-L323 | ||
tensorflow/tensorflow | 419e3a6b650ea4bd1b0cba23c4348f8a69f3272e | tensorflow/python/framework/type_spec.py | python | TypeSpecBatchEncoder.decode | (self, spec, encoded_value) | Decodes `value` from a batchable tensor encoding.
Args:
spec: The TypeSpec for the result value. If encoded values with spec `s`
were batched, then `spec` should be `s.batch(batch_size)`; or if encoded
values with spec `s` were unbatched, then `spec` should be
`s.unbatch()`.
en... | Decodes `value` from a batchable tensor encoding. | [
"Decodes",
"value",
"from",
"a",
"batchable",
"tensor",
"encoding",
"."
] | def decode(self, spec, encoded_value):
"""Decodes `value` from a batchable tensor encoding.
Args:
spec: The TypeSpec for the result value. If encoded values with spec `s`
were batched, then `spec` should be `s.batch(batch_size)`; or if encoded
values with spec `s` were unbatched, then `s... | [
"def",
"decode",
"(",
"self",
",",
"spec",
",",
"encoded_value",
")",
":",
"raise",
"NotImplementedError",
"(",
"f\"{type(self).__name__}.decode\"",
")"
] | https://github.com/tensorflow/tensorflow/blob/419e3a6b650ea4bd1b0cba23c4348f8a69f3272e/tensorflow/python/framework/type_spec.py#L636-L651 | ||
adobe/chromium | cfe5bf0b51b1f6b9fe239c2a3c2f2364da9967d7 | chrome/common/extensions/docs/build/directory.py | python | Sample._parse_description | (self) | return self._get_localized_manifest_value('description') | Returns a localized description of the extension.
Returns:
A localized version of the sample's description. | Returns a localized description of the extension. | [
"Returns",
"a",
"localized",
"description",
"of",
"the",
"extension",
"."
] | def _parse_description(self):
""" Returns a localized description of the extension.
Returns:
A localized version of the sample's description.
"""
return self._get_localized_manifest_value('description') | [
"def",
"_parse_description",
"(",
"self",
")",
":",
"return",
"self",
".",
"_get_localized_manifest_value",
"(",
"'description'",
")"
] | https://github.com/adobe/chromium/blob/cfe5bf0b51b1f6b9fe239c2a3c2f2364da9967d7/chrome/common/extensions/docs/build/directory.py#L564-L570 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.