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 |
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
wanderine/BROCCOLI | ff7613de40d97429ba76ee2948cb5e1d7dd991d0 | code/bids/fslinstaller.py | python | check_fsl_install | (folder) | return False | Check if this folder contains FSL install | Check if this folder contains FSL install | [
"Check",
"if",
"this",
"folder",
"contains",
"FSL",
"install"
] | def check_fsl_install(folder):
'''Check if this folder contains FSL install'''
from os import path
fsldir = '/'.join((folder,'fsl'))
if path.isdir(fsldir):
return True
return False | [
"def",
"check_fsl_install",
"(",
"folder",
")",
":",
"from",
"os",
"import",
"path",
"fsldir",
"=",
"'/'",
".",
"join",
"(",
"(",
"folder",
",",
"'fsl'",
")",
")",
"if",
"path",
".",
"isdir",
"(",
"fsldir",
")",
":",
"return",
"True",
"return",
"Fals... | https://github.com/wanderine/BROCCOLI/blob/ff7613de40d97429ba76ee2948cb5e1d7dd991d0/code/bids/fslinstaller.py#L1595-L1601 | |
rrwick/Unicycler | 96ffea71e3a78d63ade19d6124946773e65cf129 | unicycler/assembly_graph.py | python | build_reverse_links | (links) | return reverse_links | This function builds a dictionary of links going the other way. I.e. if given a dictionary
of start to end links, it will return a dictionary of end to start links. | This function builds a dictionary of links going the other way. I.e. if given a dictionary
of start to end links, it will return a dictionary of end to start links. | [
"This",
"function",
"builds",
"a",
"dictionary",
"of",
"links",
"going",
"the",
"other",
"way",
".",
"I",
".",
"e",
".",
"if",
"given",
"a",
"dictionary",
"of",
"start",
"to",
"end",
"links",
"it",
"will",
"return",
"a",
"dictionary",
"of",
"end",
"to"... | def build_reverse_links(links):
"""
This function builds a dictionary of links going the other way. I.e. if given a dictionary
of start to end links, it will return a dictionary of end to start links.
"""
reverse_links = {}
for start, ends in links.items():
for end in ends:
... | [
"def",
"build_reverse_links",
"(",
"links",
")",
":",
"reverse_links",
"=",
"{",
"}",
"for",
"start",
",",
"ends",
"in",
"links",
".",
"items",
"(",
")",
":",
"for",
"end",
"in",
"ends",
":",
"if",
"end",
"not",
"in",
"reverse_links",
":",
"reverse_lin... | https://github.com/rrwick/Unicycler/blob/96ffea71e3a78d63ade19d6124946773e65cf129/unicycler/assembly_graph.py#L2483-L2494 | |
alexgkendall/caffe-posenet | 62aafbd7c45df91acdba14f5d1406d8295c2bc6f | scripts/cpp_lint.py | python | RemoveMultiLineComments | (filename, lines, error) | Removes multiline (c-style) comments from lines. | Removes multiline (c-style) comments from lines. | [
"Removes",
"multiline",
"(",
"c",
"-",
"style",
")",
"comments",
"from",
"lines",
"."
] | def RemoveMultiLineComments(filename, lines, error):
"""Removes multiline (c-style) comments from lines."""
lineix = 0
while lineix < len(lines):
lineix_begin = FindNextMultiLineCommentStart(lines, lineix)
if lineix_begin >= len(lines):
return
lineix_end = FindNextMultiLineCommentEnd(lines, line... | [
"def",
"RemoveMultiLineComments",
"(",
"filename",
",",
"lines",
",",
"error",
")",
":",
"lineix",
"=",
"0",
"while",
"lineix",
"<",
"len",
"(",
"lines",
")",
":",
"lineix_begin",
"=",
"FindNextMultiLineCommentStart",
"(",
"lines",
",",
"lineix",
")",
"if",
... | https://github.com/alexgkendall/caffe-posenet/blob/62aafbd7c45df91acdba14f5d1406d8295c2bc6f/scripts/cpp_lint.py#L1151-L1164 | ||
openvinotoolkit/openvino | dedcbeafa8b84cccdc55ca64b8da516682b381c7 | tools/pot/openvino/tools/pot/configs/config.py | python | Config.validate_algo_config | (self) | Validates the correctness of algorithm parameters in config | Validates the correctness of algorithm parameters in config | [
"Validates",
"the",
"correctness",
"of",
"algorithm",
"parameters",
"in",
"config"
] | def validate_algo_config(self):
"""
Validates the correctness of algorithm parameters in config
"""
range_estimator_parameters = {
'preset': None,
'min': {
'type': None,
'outlier_prob': None,
'granularity': None,
... | [
"def",
"validate_algo_config",
"(",
"self",
")",
":",
"range_estimator_parameters",
"=",
"{",
"'preset'",
":",
"None",
",",
"'min'",
":",
"{",
"'type'",
":",
"None",
",",
"'outlier_prob'",
":",
"None",
",",
"'granularity'",
":",
"None",
",",
"'clipping_value'"... | https://github.com/openvinotoolkit/openvino/blob/dedcbeafa8b84cccdc55ca64b8da516682b381c7/tools/pot/openvino/tools/pot/configs/config.py#L123-L303 | ||
baidu/bigflow | 449245016c0df7d1252e85581e588bfc60cefad3 | bigflow_python/python/bigflow/pcollection.py | python | PCollection.aggregate | (self, zero, aggregate_fn, combine_fn, *side_inputs, **options) | return transforms.aggregate(self, zero, aggregate_fn, combine_fn, *side_inputs, **options) | 等同于
:func:`bigflow.transforms.aggregate(self, aggregate_fn, combine_fn, *side_inputs, **options)
<bigflow.transforms.aggregate>`
Args:
pcollection (PCollection): 输入PCollection
zero (value or function): 初始值,或是一个返回初始值的方法
accumulate_fn (function): 聚合方法
*s... | 等同于
:func:`bigflow.transforms.aggregate(self, aggregate_fn, combine_fn, *side_inputs, **options)
<bigflow.transforms.aggregate>` | [
"等同于",
":",
"func",
":",
"bigflow",
".",
"transforms",
".",
"aggregate",
"(",
"self",
"aggregate_fn",
"combine_fn",
"*",
"side_inputs",
"**",
"options",
")",
"<bigflow",
".",
"transforms",
".",
"aggregate",
">"
] | def aggregate(self, zero, aggregate_fn, combine_fn, *side_inputs, **options):
"""
等同于
:func:`bigflow.transforms.aggregate(self, aggregate_fn, combine_fn, *side_inputs, **options)
<bigflow.transforms.aggregate>`
Args:
pcollection (PCollection): 输入PCollection
... | [
"def",
"aggregate",
"(",
"self",
",",
"zero",
",",
"aggregate_fn",
",",
"combine_fn",
",",
"*",
"side_inputs",
",",
"*",
"*",
"options",
")",
":",
"return",
"transforms",
".",
"aggregate",
"(",
"self",
",",
"zero",
",",
"aggregate_fn",
",",
"combine_fn",
... | https://github.com/baidu/bigflow/blob/449245016c0df7d1252e85581e588bfc60cefad3/bigflow_python/python/bigflow/pcollection.py#L64-L82 | |
domino-team/openwrt-cc | 8b181297c34d14d3ca521cc9f31430d561dbc688 | package/gli-pub/openwrt-node-packages-master/node/node-v6.9.1/deps/npm/node_modules/node-gyp/gyp/pylib/gyp/MSVSVersion.py | python | _RegistryQuery | (key, value=None) | return text | r"""Use reg.exe to read a particular key through _RegistryQueryBase.
First tries to launch from %WinDir%\Sysnative to avoid WoW64 redirection. If
that fails, it falls back to System32. Sysnative is available on Vista and
up and available on Windows Server 2003 and XP through KB patch 942589. Note
that Sysnati... | r"""Use reg.exe to read a particular key through _RegistryQueryBase. | [
"r",
"Use",
"reg",
".",
"exe",
"to",
"read",
"a",
"particular",
"key",
"through",
"_RegistryQueryBase",
"."
] | def _RegistryQuery(key, value=None):
r"""Use reg.exe to read a particular key through _RegistryQueryBase.
First tries to launch from %WinDir%\Sysnative to avoid WoW64 redirection. If
that fails, it falls back to System32. Sysnative is available on Vista and
up and available on Windows Server 2003 and XP throu... | [
"def",
"_RegistryQuery",
"(",
"key",
",",
"value",
"=",
"None",
")",
":",
"text",
"=",
"None",
"try",
":",
"text",
"=",
"_RegistryQueryBase",
"(",
"'Sysnative'",
",",
"key",
",",
"value",
")",
"except",
"OSError",
",",
"e",
":",
"if",
"e",
".",
"errn... | https://github.com/domino-team/openwrt-cc/blob/8b181297c34d14d3ca521cc9f31430d561dbc688/package/gli-pub/openwrt-node-packages-master/node/node-v6.9.1/deps/npm/node_modules/node-gyp/gyp/pylib/gyp/MSVSVersion.py#L141-L166 | |
windystrife/UnrealEngine_NVIDIAGameWorks | b50e6338a7c5b26374d66306ebc7807541ff815e | Engine/Extras/ThirdPartyNotUE/emsdk/Win64/python/2.7.5.3_64bit/Lib/pipes.py | python | Template.open_r | (self, file) | return os.popen(cmd, 'r') | t.open_r(file) and t.open_w(file) implement
t.open(file, 'r') and t.open(file, 'w') respectively. | t.open_r(file) and t.open_w(file) implement
t.open(file, 'r') and t.open(file, 'w') respectively. | [
"t",
".",
"open_r",
"(",
"file",
")",
"and",
"t",
".",
"open_w",
"(",
"file",
")",
"implement",
"t",
".",
"open",
"(",
"file",
"r",
")",
"and",
"t",
".",
"open",
"(",
"file",
"w",
")",
"respectively",
"."
] | def open_r(self, file):
"""t.open_r(file) and t.open_w(file) implement
t.open(file, 'r') and t.open(file, 'w') respectively."""
if not self.steps:
return open(file, 'r')
if self.steps[-1][1] == SINK:
raise ValueError, \
'Template.open_r: pipeline... | [
"def",
"open_r",
"(",
"self",
",",
"file",
")",
":",
"if",
"not",
"self",
".",
"steps",
":",
"return",
"open",
"(",
"file",
",",
"'r'",
")",
"if",
"self",
".",
"steps",
"[",
"-",
"1",
"]",
"[",
"1",
"]",
"==",
"SINK",
":",
"raise",
"ValueError"... | https://github.com/windystrife/UnrealEngine_NVIDIAGameWorks/blob/b50e6338a7c5b26374d66306ebc7807541ff815e/Engine/Extras/ThirdPartyNotUE/emsdk/Win64/python/2.7.5.3_64bit/Lib/pipes.py#L162-L171 | |
Z3Prover/z3 | d745d03afdfdf638d66093e2bfbacaf87187f35b | src/api/python/z3/z3.py | python | Optimize.statistics | (self) | return Statistics(Z3_optimize_get_statistics(self.ctx.ref(), self.optimize), self.ctx) | Return statistics for the last check`. | Return statistics for the last check`. | [
"Return",
"statistics",
"for",
"the",
"last",
"check",
"."
] | def statistics(self):
"""Return statistics for the last check`.
"""
return Statistics(Z3_optimize_get_statistics(self.ctx.ref(), self.optimize), self.ctx) | [
"def",
"statistics",
"(",
"self",
")",
":",
"return",
"Statistics",
"(",
"Z3_optimize_get_statistics",
"(",
"self",
".",
"ctx",
".",
"ref",
"(",
")",
",",
"self",
".",
"optimize",
")",
",",
"self",
".",
"ctx",
")"
] | https://github.com/Z3Prover/z3/blob/d745d03afdfdf638d66093e2bfbacaf87187f35b/src/api/python/z3/z3.py#L7979-L7982 | |
Xilinx/Vitis-AI | fc74d404563d9951b57245443c73bef389f3657f | tools/Vitis-AI-Quantizer/vai_q_tensorflow1.x/tensorflow/contrib/cudnn_rnn/python/ops/cudnn_rnn_ops.py | python | cudnn_rnn_opaque_params_size | (rnn_mode,
num_layers,
num_units,
input_size,
input_mode=CUDNN_INPUT_LINEAR_MODE,
direction=CUDNN_RNN_UNIDIRECTION,
dtype=... | return gen_cudnn_rnn_ops.cudnn_rnn_params_size(
rnn_mode=rnn_mode,
num_layers=num_layers,
num_units=num_units,
input_size=input_size,
num_proj=num_proj,
T=dtype,
S=dtypes.int32,
dropout=dropout,
seed=seed,
seed2=seed2,
input_mode=input_mode,
direct... | Returns opaque params size for specific Cudnn config.
Args:
rnn_mode: a string specifies the mode, under which this RNN model runs.
Could be either 'lstm', 'gru', 'rnn_tanh' or 'rnn_relu'.
num_layers: the number of layers for the RNN model.
num_units: the number of units within the RNN model.
i... | Returns opaque params size for specific Cudnn config. | [
"Returns",
"opaque",
"params",
"size",
"for",
"specific",
"Cudnn",
"config",
"."
] | def cudnn_rnn_opaque_params_size(rnn_mode,
num_layers,
num_units,
input_size,
input_mode=CUDNN_INPUT_LINEAR_MODE,
direction=CUDNN_RNN_UNIDIRECTION,
... | [
"def",
"cudnn_rnn_opaque_params_size",
"(",
"rnn_mode",
",",
"num_layers",
",",
"num_units",
",",
"input_size",
",",
"input_mode",
"=",
"CUDNN_INPUT_LINEAR_MODE",
",",
"direction",
"=",
"CUDNN_RNN_UNIDIRECTION",
",",
"dtype",
"=",
"dtypes",
".",
"float32",
",",
"dro... | https://github.com/Xilinx/Vitis-AI/blob/fc74d404563d9951b57245443c73bef389f3657f/tools/Vitis-AI-Quantizer/vai_q_tensorflow1.x/tensorflow/contrib/cudnn_rnn/python/ops/cudnn_rnn_ops.py#L1585-L1643 | |
wxWidgets/wxPython-Classic | 19571e1ae65f1ac445f5491474121998c97a1bf0 | src/gtk/propgrid.py | python | PropertyGridInterface.SetPropertyHelpString | (*args, **kwargs) | return _propgrid.PropertyGridInterface_SetPropertyHelpString(*args, **kwargs) | SetPropertyHelpString(self, PGPropArg id, String helpString) | SetPropertyHelpString(self, PGPropArg id, String helpString) | [
"SetPropertyHelpString",
"(",
"self",
"PGPropArg",
"id",
"String",
"helpString",
")"
] | def SetPropertyHelpString(*args, **kwargs):
"""SetPropertyHelpString(self, PGPropArg id, String helpString)"""
return _propgrid.PropertyGridInterface_SetPropertyHelpString(*args, **kwargs) | [
"def",
"SetPropertyHelpString",
"(",
"*",
"args",
",",
"*",
"*",
"kwargs",
")",
":",
"return",
"_propgrid",
".",
"PropertyGridInterface_SetPropertyHelpString",
"(",
"*",
"args",
",",
"*",
"*",
"kwargs",
")"
] | https://github.com/wxWidgets/wxPython-Classic/blob/19571e1ae65f1ac445f5491474121998c97a1bf0/src/gtk/propgrid.py#L1433-L1435 | |
catboost/catboost | 167f64f237114a4d10b2b4ee42adb4569137debe | contrib/tools/python3/src/Lib/_pydecimal.py | python | Decimal._round_05up | (self, prec) | Round down unless digit prec-1 is 0 or 5. | Round down unless digit prec-1 is 0 or 5. | [
"Round",
"down",
"unless",
"digit",
"prec",
"-",
"1",
"is",
"0",
"or",
"5",
"."
] | def _round_05up(self, prec):
"""Round down unless digit prec-1 is 0 or 5."""
if prec and self._int[prec-1] not in '05':
return self._round_down(prec)
else:
return -self._round_down(prec) | [
"def",
"_round_05up",
"(",
"self",
",",
"prec",
")",
":",
"if",
"prec",
"and",
"self",
".",
"_int",
"[",
"prec",
"-",
"1",
"]",
"not",
"in",
"'05'",
":",
"return",
"self",
".",
"_round_down",
"(",
"prec",
")",
"else",
":",
"return",
"-",
"self",
... | https://github.com/catboost/catboost/blob/167f64f237114a4d10b2b4ee42adb4569137debe/contrib/tools/python3/src/Lib/_pydecimal.py#L1812-L1817 | ||
microsoft/TSS.MSR | 0f2516fca2cd9929c31d5450e39301c9bde43688 | TSS.Py/src/TpmTypes.py | python | TPMS_SIGNATURE_ECSCHNORR.fromTpm | (buf) | return buf.createObj(TPMS_SIGNATURE_ECSCHNORR) | Returns new TPMS_SIGNATURE_ECSCHNORR object constructed from its
marshaled representation in the given TpmBuffer buffer | Returns new TPMS_SIGNATURE_ECSCHNORR object constructed from its
marshaled representation in the given TpmBuffer buffer | [
"Returns",
"new",
"TPMS_SIGNATURE_ECSCHNORR",
"object",
"constructed",
"from",
"its",
"marshaled",
"representation",
"in",
"the",
"given",
"TpmBuffer",
"buffer"
] | def fromTpm(buf):
""" Returns new TPMS_SIGNATURE_ECSCHNORR object constructed from its
marshaled representation in the given TpmBuffer buffer
"""
return buf.createObj(TPMS_SIGNATURE_ECSCHNORR) | [
"def",
"fromTpm",
"(",
"buf",
")",
":",
"return",
"buf",
".",
"createObj",
"(",
"TPMS_SIGNATURE_ECSCHNORR",
")"
] | https://github.com/microsoft/TSS.MSR/blob/0f2516fca2cd9929c31d5450e39301c9bde43688/TSS.Py/src/TpmTypes.py#L7721-L7725 | |
hanpfei/chromium-net | 392cc1fa3a8f92f42e4071ab6e674d8e0482f83f | third_party/catapult/third_party/gsutil/third_party/boto/boto/cloudhsm/layer1.py | python | CloudHSMConnection.list_available_zones | (self) | return self.make_request(action='ListAvailableZones',
body=json.dumps(params)) | Lists the Availability Zones that have available AWS CloudHSM
capacity. | Lists the Availability Zones that have available AWS CloudHSM
capacity. | [
"Lists",
"the",
"Availability",
"Zones",
"that",
"have",
"available",
"AWS",
"CloudHSM",
"capacity",
"."
] | def list_available_zones(self):
"""
Lists the Availability Zones that have available AWS CloudHSM
capacity.
"""
params = {}
return self.make_request(action='ListAvailableZones',
body=json.dumps(params)) | [
"def",
"list_available_zones",
"(",
"self",
")",
":",
"params",
"=",
"{",
"}",
"return",
"self",
".",
"make_request",
"(",
"action",
"=",
"'ListAvailableZones'",
",",
"body",
"=",
"json",
".",
"dumps",
"(",
"params",
")",
")"
] | https://github.com/hanpfei/chromium-net/blob/392cc1fa3a8f92f42e4071ab6e674d8e0482f83f/third_party/catapult/third_party/gsutil/third_party/boto/boto/cloudhsm/layer1.py#L268-L277 | |
hanpfei/chromium-net | 392cc1fa3a8f92f42e4071ab6e674d8e0482f83f | tools/generate_stubs/generate_stubs.py | python | CreateWindowsDefForSigFiles | (sig_files, out_dir, module_name) | For all signature files, create a single windows def file.
Args:
sig_files: Array of strings with the paths to each signature file.
out_dir: String holding path to directory where the generated def goes.
module_name: Name of the output DLL or LIB which will link in the def file. | For all signature files, create a single windows def file. | [
"For",
"all",
"signature",
"files",
"create",
"a",
"single",
"windows",
"def",
"file",
"."
] | def CreateWindowsDefForSigFiles(sig_files, out_dir, module_name):
"""For all signature files, create a single windows def file.
Args:
sig_files: Array of strings with the paths to each signature file.
out_dir: String holding path to directory where the generated def goes.
module_name: Name of the outpu... | [
"def",
"CreateWindowsDefForSigFiles",
"(",
"sig_files",
",",
"out_dir",
",",
"module_name",
")",
":",
"signatures",
"=",
"[",
"]",
"for",
"input_path",
"in",
"sig_files",
":",
"infile",
"=",
"open",
"(",
"input_path",
",",
"'r'",
")",
"try",
":",
"signatures... | https://github.com/hanpfei/chromium-net/blob/392cc1fa3a8f92f42e4071ab6e674d8e0482f83f/tools/generate_stubs/generate_stubs.py#L1043-L1066 | ||
Yijunmaverick/GenerativeFaceCompletion | f72dea0fa27c779fef7b65d2f01e82bcc23a0eb2 | python/caffe/io.py | python | Transformer.set_mean | (self, in_, mean) | Set the mean to subtract for centering the data.
Parameters
----------
in_ : which input to assign this mean.
mean : mean ndarray (input dimensional or broadcastable) | Set the mean to subtract for centering the data. | [
"Set",
"the",
"mean",
"to",
"subtract",
"for",
"centering",
"the",
"data",
"."
] | def set_mean(self, in_, mean):
"""
Set the mean to subtract for centering the data.
Parameters
----------
in_ : which input to assign this mean.
mean : mean ndarray (input dimensional or broadcastable)
"""
self.__check_input(in_)
ms = mean.shape
... | [
"def",
"set_mean",
"(",
"self",
",",
"in_",
",",
"mean",
")",
":",
"self",
".",
"__check_input",
"(",
"in_",
")",
"ms",
"=",
"mean",
".",
"shape",
"if",
"mean",
".",
"ndim",
"==",
"1",
":",
"# broadcast channels",
"if",
"ms",
"[",
"0",
"]",
"!=",
... | https://github.com/Yijunmaverick/GenerativeFaceCompletion/blob/f72dea0fa27c779fef7b65d2f01e82bcc23a0eb2/python/caffe/io.py#L235-L259 | ||
espressomd/espresso | 7e29f9052e710fe1ebf0f5d2a8076b32921fbc6a | doc/tutorials/convert.py | python | split_matplotlib_cells | (nb) | If a cell imports matplotlib, split the cell to keep the
import statement separate from the code that uses matplotlib.
This prevents a known bug in the Jupyter backend which causes
the plot object to be represented as a string instead of a canvas
when created in the cell where matplotlib is imported for... | If a cell imports matplotlib, split the cell to keep the
import statement separate from the code that uses matplotlib.
This prevents a known bug in the Jupyter backend which causes
the plot object to be represented as a string instead of a canvas
when created in the cell where matplotlib is imported for... | [
"If",
"a",
"cell",
"imports",
"matplotlib",
"split",
"the",
"cell",
"to",
"keep",
"the",
"import",
"statement",
"separate",
"from",
"the",
"code",
"that",
"uses",
"matplotlib",
".",
"This",
"prevents",
"a",
"known",
"bug",
"in",
"the",
"Jupyter",
"backend",
... | def split_matplotlib_cells(nb):
"""
If a cell imports matplotlib, split the cell to keep the
import statement separate from the code that uses matplotlib.
This prevents a known bug in the Jupyter backend which causes
the plot object to be represented as a string instead of a canvas
when created ... | [
"def",
"split_matplotlib_cells",
"(",
"nb",
")",
":",
"for",
"i",
"in",
"range",
"(",
"len",
"(",
"nb",
"[",
"'cells'",
"]",
")",
"-",
"1",
",",
"-",
"1",
",",
"-",
"1",
")",
":",
"cell",
"=",
"nb",
"[",
"'cells'",
"]",
"[",
"i",
"]",
"if",
... | https://github.com/espressomd/espresso/blob/7e29f9052e710fe1ebf0f5d2a8076b32921fbc6a/doc/tutorials/convert.py#L94-L121 | ||
ChromiumWebApps/chromium | c7361d39be8abd1574e6ce8957c8dbddd4c6ccf7 | gpu/command_buffer/build_gles2_cmd_buffer.py | python | PUTnHandler.WriteImmediateCmdSetHeader | (self, func, file) | Overrriden from TypeHandler. | Overrriden from TypeHandler. | [
"Overrriden",
"from",
"TypeHandler",
"."
] | def WriteImmediateCmdSetHeader(self, func, file):
"""Overrriden from TypeHandler."""
file.Write(" void SetHeader(GLsizei count) {\n")
file.Write(
" header.SetCmdByTotalSize<ValueType>(ComputeSize(count));\n")
file.Write(" }\n")
file.Write("\n") | [
"def",
"WriteImmediateCmdSetHeader",
"(",
"self",
",",
"func",
",",
"file",
")",
":",
"file",
".",
"Write",
"(",
"\" void SetHeader(GLsizei count) {\\n\"",
")",
"file",
".",
"Write",
"(",
"\" header.SetCmdByTotalSize<ValueType>(ComputeSize(count));\\n\"",
")",
"file",... | https://github.com/ChromiumWebApps/chromium/blob/c7361d39be8abd1574e6ce8957c8dbddd4c6ccf7/gpu/command_buffer/build_gles2_cmd_buffer.py#L5142-L5148 | ||
thalium/icebox | 99d147d5b9269222225443ce171b4fd46d8985d4 | third_party/virtualbox/src/libs/libxml2-2.9.4/python/libxml2.py | python | registerHTTPPostCallbacks | () | By default, libxml submits HTTP output requests using the
"PUT" method. Calling this method changes the HTTP output
method to use the "POST" method instead. | By default, libxml submits HTTP output requests using the
"PUT" method. Calling this method changes the HTTP output
method to use the "POST" method instead. | [
"By",
"default",
"libxml",
"submits",
"HTTP",
"output",
"requests",
"using",
"the",
"PUT",
"method",
".",
"Calling",
"this",
"method",
"changes",
"the",
"HTTP",
"output",
"method",
"to",
"use",
"the",
"POST",
"method",
"instead",
"."
] | def registerHTTPPostCallbacks():
"""By default, libxml submits HTTP output requests using the
"PUT" method. Calling this method changes the HTTP output
method to use the "POST" method instead. """
libxml2mod.xmlRegisterHTTPPostCallbacks() | [
"def",
"registerHTTPPostCallbacks",
"(",
")",
":",
"libxml2mod",
".",
"xmlRegisterHTTPPostCallbacks",
"(",
")"
] | https://github.com/thalium/icebox/blob/99d147d5b9269222225443ce171b4fd46d8985d4/third_party/virtualbox/src/libs/libxml2-2.9.4/python/libxml2.py#L1917-L1921 | ||
LLNL/Caliper | 60e06980fc65057e1da01296e6eebbbed30f59c8 | examples/scripts/topdown/topdown.py | python | determine_boundedness | (row) | return boundedness | Determine the boundedness of a single row with topdown metrics | Determine the boundedness of a single row with topdown metrics | [
"Determine",
"the",
"boundedness",
"of",
"a",
"single",
"row",
"with",
"topdown",
"metrics"
] | def determine_boundedness(row):
""" Determine the boundedness of a single row with topdown metrics """
boundedness = []
level_1 = max_column(row, ['retiring',
'bad_speculation',
'frontend_bound',
'backend_bound'])... | [
"def",
"determine_boundedness",
"(",
"row",
")",
":",
"boundedness",
"=",
"[",
"]",
"level_1",
"=",
"max_column",
"(",
"row",
",",
"[",
"'retiring'",
",",
"'bad_speculation'",
",",
"'frontend_bound'",
",",
"'backend_bound'",
"]",
")",
"if",
"str",
"(",
"row"... | https://github.com/LLNL/Caliper/blob/60e06980fc65057e1da01296e6eebbbed30f59c8/examples/scripts/topdown/topdown.py#L136-L171 | |
yuxng/DA-RNN | 77fbb50b4272514588a10a9f90b7d5f8d46974fb | lib/datasets/rgbd_scene.py | python | rgbd_scene.gt_roidb | (self) | return gt_roidb | Return the database of ground-truth regions of interest.
This function loads/saves from/to a cache file to speed up future calls. | Return the database of ground-truth regions of interest. | [
"Return",
"the",
"database",
"of",
"ground",
"-",
"truth",
"regions",
"of",
"interest",
"."
] | def gt_roidb(self):
"""
Return the database of ground-truth regions of interest.
This function loads/saves from/to a cache file to speed up future calls.
"""
cache_file = os.path.join(self.cache_path, self.name + '_gt_roidb.pkl')
if os.path.exists(cache_file):
... | [
"def",
"gt_roidb",
"(",
"self",
")",
":",
"cache_file",
"=",
"os",
".",
"path",
".",
"join",
"(",
"self",
".",
"cache_path",
",",
"self",
".",
"name",
"+",
"'_gt_roidb.pkl'",
")",
"if",
"os",
".",
"path",
".",
"exists",
"(",
"cache_file",
")",
":",
... | https://github.com/yuxng/DA-RNN/blob/77fbb50b4272514588a10a9f90b7d5f8d46974fb/lib/datasets/rgbd_scene.py#L115-L136 | |
benoitsteiner/tensorflow-opencl | cb7cb40a57fde5cfd4731bc551e82a1e2fef43a5 | tensorflow/python/ops/losses/losses_impl.py | python | mean_squared_error | (
labels, predictions, weights=1.0, scope=None,
loss_collection=ops.GraphKeys.LOSSES,
reduction=Reduction.SUM_BY_NONZERO_WEIGHTS) | Adds a Sum-of-Squares loss to the training procedure.
`weights` acts as a coefficient for the loss. If a scalar is provided, then
the loss is simply scaled by the given value. If `weights` is a tensor of size
[batch_size], then the total loss for each sample of the batch is rescaled
by the corresponding elemen... | Adds a Sum-of-Squares loss to the training procedure. | [
"Adds",
"a",
"Sum",
"-",
"of",
"-",
"Squares",
"loss",
"to",
"the",
"training",
"procedure",
"."
] | def mean_squared_error(
labels, predictions, weights=1.0, scope=None,
loss_collection=ops.GraphKeys.LOSSES,
reduction=Reduction.SUM_BY_NONZERO_WEIGHTS):
"""Adds a Sum-of-Squares loss to the training procedure.
`weights` acts as a coefficient for the loss. If a scalar is provided, then
the loss is sim... | [
"def",
"mean_squared_error",
"(",
"labels",
",",
"predictions",
",",
"weights",
"=",
"1.0",
",",
"scope",
"=",
"None",
",",
"loss_collection",
"=",
"ops",
".",
"GraphKeys",
".",
"LOSSES",
",",
"reduction",
"=",
"Reduction",
".",
"SUM_BY_NONZERO_WEIGHTS",
")",
... | https://github.com/benoitsteiner/tensorflow-opencl/blob/cb7cb40a57fde5cfd4731bc551e82a1e2fef43a5/tensorflow/python/ops/losses/losses_impl.py#L533-L577 | ||
osquery/osquery | fd529718e48348853f708d56990720c3c84c7152 | tools/formatting/git-clang-format.py | python | compute_diff | (commit, files) | return p | Return a subprocess object producing the diff from `commit`.
The return value's `stdin` file object will produce a patch with the
differences between the working directory and `commit`, filtered on `files`
(if non-empty). Zero context lines are used in the patch. | Return a subprocess object producing the diff from `commit`. | [
"Return",
"a",
"subprocess",
"object",
"producing",
"the",
"diff",
"from",
"commit",
"."
] | def compute_diff(commit, files):
"""Return a subprocess object producing the diff from `commit`.
The return value's `stdin` file object will produce a patch with the
differences between the working directory and `commit`, filtered on `files`
(if non-empty). Zero context lines are used in the patch."""... | [
"def",
"compute_diff",
"(",
"commit",
",",
"files",
")",
":",
"cmd",
"=",
"[",
"'git'",
",",
"'diff-index'",
",",
"'-p'",
",",
"'-U0'",
",",
"commit",
",",
"'--'",
"]",
"cmd",
".",
"extend",
"(",
"files",
")",
"p",
"=",
"subprocess",
".",
"Popen",
... | https://github.com/osquery/osquery/blob/fd529718e48348853f708d56990720c3c84c7152/tools/formatting/git-clang-format.py#L272-L285 | |
catboost/catboost | 167f64f237114a4d10b2b4ee42adb4569137debe | contrib/tools/python/src/Lib/plat-mac/findertools.py | python | _getwindowposition | (folder_alias) | Get the size of a Finder window for folder, Specify by path. | Get the size of a Finder window for folder, Specify by path. | [
"Get",
"the",
"size",
"of",
"a",
"Finder",
"window",
"for",
"folder",
"Specify",
"by",
"path",
"."
] | def _getwindowposition(folder_alias):
"""Get the size of a Finder window for folder, Specify by path."""
finder = _getfinder()
args = {}
attrs = {}
aeobj_0 = aetypes.ObjectSpecifier(want=aetypes.Type('cfol'),
form="alis", seld=folder_alias, fr=None)
aeobj_1 = aetypes.ObjectSpecifier(... | [
"def",
"_getwindowposition",
"(",
"folder_alias",
")",
":",
"finder",
"=",
"_getfinder",
"(",
")",
"args",
"=",
"{",
"}",
"attrs",
"=",
"{",
"}",
"aeobj_0",
"=",
"aetypes",
".",
"ObjectSpecifier",
"(",
"want",
"=",
"aetypes",
".",
"Type",
"(",
"'cfol'",
... | https://github.com/catboost/catboost/blob/167f64f237114a4d10b2b4ee42adb4569137debe/contrib/tools/python/src/Lib/plat-mac/findertools.py#L515-L531 | ||
MegEngine/MegEngine | ce9ad07a27ec909fb8db4dd67943d24ba98fb93a | imperative/python/megengine/hub/hub.py | python | load_serialized_obj_from_url | (url: str, model_dir=None) | return state_dict | Loads MegEngine serialized object from the given URL.
If the object is already present in ``model_dir``, it's deserialized and
returned. If no ``model_dir`` is specified, it will be ``MGE_HOME/serialized``.
Args:
url: url to serialized object.
model_dir: dir to cache target serialized file... | Loads MegEngine serialized object from the given URL. | [
"Loads",
"MegEngine",
"serialized",
"object",
"from",
"the",
"given",
"URL",
"."
] | def load_serialized_obj_from_url(url: str, model_dir=None) -> Any:
"""Loads MegEngine serialized object from the given URL.
If the object is already present in ``model_dir``, it's deserialized and
returned. If no ``model_dir`` is specified, it will be ``MGE_HOME/serialized``.
Args:
url: url to... | [
"def",
"load_serialized_obj_from_url",
"(",
"url",
":",
"str",
",",
"model_dir",
"=",
"None",
")",
"->",
"Any",
":",
"if",
"model_dir",
"is",
"None",
":",
"model_dir",
"=",
"os",
".",
"path",
".",
"join",
"(",
"_get_megengine_home",
"(",
")",
",",
"\"ser... | https://github.com/MegEngine/MegEngine/blob/ce9ad07a27ec909fb8db4dd67943d24ba98fb93a/imperative/python/megengine/hub/hub.py#L228-L268 | |
gv22ga/dlib-face-recognition-android | 42d6305cbd85833f2b85bb79b70ab9ab004153c9 | tools/lint/cpplint.py | python | FindNextMultiLineCommentEnd | (lines, lineix) | return len(lines) | We are inside a comment, find the end marker. | We are inside a comment, find the end marker. | [
"We",
"are",
"inside",
"a",
"comment",
"find",
"the",
"end",
"marker",
"."
] | def FindNextMultiLineCommentEnd(lines, lineix):
"""We are inside a comment, find the end marker."""
while lineix < len(lines):
if lines[lineix].strip().endswith('*/'):
return lineix
lineix += 1
return len(lines) | [
"def",
"FindNextMultiLineCommentEnd",
"(",
"lines",
",",
"lineix",
")",
":",
"while",
"lineix",
"<",
"len",
"(",
"lines",
")",
":",
"if",
"lines",
"[",
"lineix",
"]",
".",
"strip",
"(",
")",
".",
"endswith",
"(",
"'*/'",
")",
":",
"return",
"lineix",
... | https://github.com/gv22ga/dlib-face-recognition-android/blob/42d6305cbd85833f2b85bb79b70ab9ab004153c9/tools/lint/cpplint.py#L1270-L1276 | |
aws/lumberyard | f85344403c1c2e77ec8c75deb2c116e97b713217 | dev/Gems/CloudGemDefectReporter/v1/AWS/common-code/Lib/PIL/TiffImagePlugin.py | python | TiffImageFile._load_libtiff | (self) | return Image.Image.load(self) | Overload method triggered when we detect a compressed tiff
Calls out to libtiff | Overload method triggered when we detect a compressed tiff
Calls out to libtiff | [
"Overload",
"method",
"triggered",
"when",
"we",
"detect",
"a",
"compressed",
"tiff",
"Calls",
"out",
"to",
"libtiff"
] | def _load_libtiff(self):
""" Overload method triggered when we detect a compressed tiff
Calls out to libtiff """
pixel = Image.Image.load(self)
if self.tile is None:
raise OSError("cannot load this image")
if not self.tile:
return pixel
self... | [
"def",
"_load_libtiff",
"(",
"self",
")",
":",
"pixel",
"=",
"Image",
".",
"Image",
".",
"load",
"(",
"self",
")",
"if",
"self",
".",
"tile",
"is",
"None",
":",
"raise",
"OSError",
"(",
"\"cannot load this image\"",
")",
"if",
"not",
"self",
".",
"tile... | https://github.com/aws/lumberyard/blob/f85344403c1c2e77ec8c75deb2c116e97b713217/dev/Gems/CloudGemDefectReporter/v1/AWS/common-code/Lib/PIL/TiffImagePlugin.py#L1093-L1184 | |
wxWidgets/wxPython-Classic | 19571e1ae65f1ac445f5491474121998c97a1bf0 | src/msw/richtext.py | python | TextBoxAttr.SetVerticalAlignment | (*args, **kwargs) | return _richtext.TextBoxAttr_SetVerticalAlignment(*args, **kwargs) | SetVerticalAlignment(self, int verticalAlignment) | SetVerticalAlignment(self, int verticalAlignment) | [
"SetVerticalAlignment",
"(",
"self",
"int",
"verticalAlignment",
")"
] | def SetVerticalAlignment(*args, **kwargs):
"""SetVerticalAlignment(self, int verticalAlignment)"""
return _richtext.TextBoxAttr_SetVerticalAlignment(*args, **kwargs) | [
"def",
"SetVerticalAlignment",
"(",
"*",
"args",
",",
"*",
"*",
"kwargs",
")",
":",
"return",
"_richtext",
".",
"TextBoxAttr_SetVerticalAlignment",
"(",
"*",
"args",
",",
"*",
"*",
"kwargs",
")"
] | https://github.com/wxWidgets/wxPython-Classic/blob/19571e1ae65f1ac445f5491474121998c97a1bf0/src/msw/richtext.py#L620-L622 | |
raspberrypi/tools | 13474ee775d0c5ec8a7da4fb0a9fa84187abfc87 | arm-bcm2708/arm-rpi-4.9.3-linux-gnueabihf/share/gdb/python/gdb/command/explore.py | python | Explorer.return_to_enclosing_type_prompt | () | A utility function which prompts the user to press the 'enter' key
so that the exploration session can shift back to the enclosing type.
Useful when exploring types. | A utility function which prompts the user to press the 'enter' key
so that the exploration session can shift back to the enclosing type.
Useful when exploring types. | [
"A",
"utility",
"function",
"which",
"prompts",
"the",
"user",
"to",
"press",
"the",
"enter",
"key",
"so",
"that",
"the",
"exploration",
"session",
"can",
"shift",
"back",
"to",
"the",
"enclosing",
"type",
".",
"Useful",
"when",
"exploring",
"types",
"."
] | def return_to_enclosing_type_prompt():
"""A utility function which prompts the user to press the 'enter' key
so that the exploration session can shift back to the enclosing type.
Useful when exploring types.
"""
raw_input("\nPress enter to return to enclosing type: ") | [
"def",
"return_to_enclosing_type_prompt",
"(",
")",
":",
"raw_input",
"(",
"\"\\nPress enter to return to enclosing type: \"",
")"
] | https://github.com/raspberrypi/tools/blob/13474ee775d0c5ec8a7da4fb0a9fa84187abfc87/arm-bcm2708/arm-rpi-4.9.3-linux-gnueabihf/share/gdb/python/gdb/command/explore.py#L181-L186 | ||
catboost/catboost | 167f64f237114a4d10b2b4ee42adb4569137debe | contrib/python/pandas/py2/pandas/core/sorting.py | python | decons_obs_group_ids | (comp_ids, obs_ids, shape, labels, xnull) | return [i8copy(lab[i]) for lab in labels] | reconstruct labels from observed group ids
Parameters
----------
xnull: boolean,
if nulls are excluded; i.e. -1 labels are passed through | reconstruct labels from observed group ids | [
"reconstruct",
"labels",
"from",
"observed",
"group",
"ids"
] | def decons_obs_group_ids(comp_ids, obs_ids, shape, labels, xnull):
"""
reconstruct labels from observed group ids
Parameters
----------
xnull: boolean,
if nulls are excluded; i.e. -1 labels are passed through
"""
if not xnull:
lift = np.fromiter(((a == -1).any() for a in la... | [
"def",
"decons_obs_group_ids",
"(",
"comp_ids",
",",
"obs_ids",
",",
"shape",
",",
"labels",
",",
"xnull",
")",
":",
"if",
"not",
"xnull",
":",
"lift",
"=",
"np",
".",
"fromiter",
"(",
"(",
"(",
"a",
"==",
"-",
"1",
")",
".",
"any",
"(",
")",
"fo... | https://github.com/catboost/catboost/blob/167f64f237114a4d10b2b4ee42adb4569137debe/contrib/python/pandas/py2/pandas/core/sorting.py#L152-L174 | |
benoitsteiner/tensorflow-opencl | cb7cb40a57fde5cfd4731bc551e82a1e2fef43a5 | tensorflow/python/keras/_impl/keras/engine/training.py | python | Model._test_loop | (self, f, ins, batch_size=None, verbose=0, steps=None) | return outs | Abstract method to loop over some data in batches.
Arguments:
f: Keras function returning a list of tensors.
ins: list of tensors to be fed to `f`.
batch_size: integer batch size or `None`.
verbose: verbosity mode.
steps: Total number of steps (batches of samples)
... | Abstract method to loop over some data in batches. | [
"Abstract",
"method",
"to",
"loop",
"over",
"some",
"data",
"in",
"batches",
"."
] | def _test_loop(self, f, ins, batch_size=None, verbose=0, steps=None):
"""Abstract method to loop over some data in batches.
Arguments:
f: Keras function returning a list of tensors.
ins: list of tensors to be fed to `f`.
batch_size: integer batch size or `None`.
verbose: verbosi... | [
"def",
"_test_loop",
"(",
"self",
",",
"f",
",",
"ins",
",",
"batch_size",
"=",
"None",
",",
"verbose",
"=",
"0",
",",
"steps",
"=",
"None",
")",
":",
"num_samples",
"=",
"self",
".",
"_check_num_samples",
"(",
"ins",
",",
"batch_size",
",",
"steps",
... | https://github.com/benoitsteiner/tensorflow-opencl/blob/cb7cb40a57fde5cfd4731bc551e82a1e2fef43a5/tensorflow/python/keras/_impl/keras/engine/training.py#L1296-L1366 | |
SFTtech/openage | d6a08c53c48dc1e157807471df92197f6ca9e04d | openage/convert/entity_object/conversion/aoc/genie_unit.py | python | GenieGameEntityGroup.get_head_unit_id | (self) | return head_unit["id0"].get_value() | Return the obj_id of the first unit in the line. | Return the obj_id of the first unit in the line. | [
"Return",
"the",
"obj_id",
"of",
"the",
"first",
"unit",
"in",
"the",
"line",
"."
] | def get_head_unit_id(self):
"""
Return the obj_id of the first unit in the line.
"""
head_unit = self.get_head_unit()
return head_unit["id0"].get_value() | [
"def",
"get_head_unit_id",
"(",
"self",
")",
":",
"head_unit",
"=",
"self",
".",
"get_head_unit",
"(",
")",
"return",
"head_unit",
"[",
"\"id0\"",
"]",
".",
"get_value",
"(",
")"
] | https://github.com/SFTtech/openage/blob/d6a08c53c48dc1e157807471df92197f6ca9e04d/openage/convert/entity_object/conversion/aoc/genie_unit.py#L508-L513 | |
aws/lumberyard | f85344403c1c2e77ec8c75deb2c116e97b713217 | dev/Gems/CloudGemFramework/v1/AWS/resource-manager-code/lib/swagger_spec_validator/validator20.py | python | validate_property_default | (property_spec, deref) | Validates that default values for definitions are of the property type.
Enforces presence of "type" in case of "default" presence.
:param property_spec: schema object (#/definitions/<def_name>/properties/<property_name>
:param deref: callable that dereferences $refs
:raises: :py:class:`swagger_spec_va... | Validates that default values for definitions are of the property type.
Enforces presence of "type" in case of "default" presence. | [
"Validates",
"that",
"default",
"values",
"for",
"definitions",
"are",
"of",
"the",
"property",
"type",
".",
"Enforces",
"presence",
"of",
"type",
"in",
"case",
"of",
"default",
"presence",
"."
] | def validate_property_default(property_spec, deref):
"""
Validates that default values for definitions are of the property type.
Enforces presence of "type" in case of "default" presence.
:param property_spec: schema object (#/definitions/<def_name>/properties/<property_name>
:param deref: callable... | [
"def",
"validate_property_default",
"(",
"property_spec",
",",
"deref",
")",
":",
"deref_property_spec",
"=",
"deref",
"(",
"property_spec",
")",
"if",
"'default'",
"in",
"deref_property_spec",
":",
"if",
"deref_property_spec",
"[",
"'default'",
"]",
"is",
"None",
... | https://github.com/aws/lumberyard/blob/f85344403c1c2e77ec8c75deb2c116e97b713217/dev/Gems/CloudGemFramework/v1/AWS/resource-manager-code/lib/swagger_spec_validator/validator20.py#L423-L439 | ||
raspberrypi/tools | 13474ee775d0c5ec8a7da4fb0a9fa84187abfc87 | arm-bcm2708/arm-rpi-4.9.3-linux-gnueabihf/share/gdb/python/gdb/command/explore.py | python | Explorer.is_scalar_type | (type) | return type.code in Explorer._SCALAR_TYPE_LIST | Checks whether a type is a scalar type.
A type is a scalar type of its type is
gdb.TYPE_CODE_CHAR or
gdb.TYPE_CODE_INT or
gdb.TYPE_CODE_BOOL or
gdb.TYPE_CODE_FLT or
gdb.TYPE_CODE_VOID or
gdb.TYPE_CODE_ENUM.
Arguments:
t... | Checks whether a type is a scalar type.
A type is a scalar type of its type is
gdb.TYPE_CODE_CHAR or
gdb.TYPE_CODE_INT or
gdb.TYPE_CODE_BOOL or
gdb.TYPE_CODE_FLT or
gdb.TYPE_CODE_VOID or
gdb.TYPE_CODE_ENUM. | [
"Checks",
"whether",
"a",
"type",
"is",
"a",
"scalar",
"type",
".",
"A",
"type",
"is",
"a",
"scalar",
"type",
"of",
"its",
"type",
"is",
"gdb",
".",
"TYPE_CODE_CHAR",
"or",
"gdb",
".",
"TYPE_CODE_INT",
"or",
"gdb",
".",
"TYPE_CODE_BOOL",
"or",
"gdb",
"... | def is_scalar_type(type):
"""Checks whether a type is a scalar type.
A type is a scalar type of its type is
gdb.TYPE_CODE_CHAR or
gdb.TYPE_CODE_INT or
gdb.TYPE_CODE_BOOL or
gdb.TYPE_CODE_FLT or
gdb.TYPE_CODE_VOID or
gdb.TYPE_CODE_EN... | [
"def",
"is_scalar_type",
"(",
"type",
")",
":",
"return",
"type",
".",
"code",
"in",
"Explorer",
".",
"_SCALAR_TYPE_LIST"
] | https://github.com/raspberrypi/tools/blob/13474ee775d0c5ec8a7da4fb0a9fa84187abfc87/arm-bcm2708/arm-rpi-4.9.3-linux-gnueabihf/share/gdb/python/gdb/command/explore.py#L140-L156 | |
Xilinx/Vitis-AI | fc74d404563d9951b57245443c73bef389f3657f | tools/Vitis-AI-Quantizer/vai_q_tensorflow1.x/tensorflow/python/ops/resource_variable_ops.py | python | BaseResourceVariable.scatter_nd_update | (self, indices, updates, name=None) | return self._lazy_read(gen_state_ops.resource_scatter_nd_update(
self.handle, indices, ops.convert_to_tensor(updates, self.dtype),
name=name)) | Applies sparse assignment to individual values or slices in a Variable.
`ref` is a `Tensor` with rank `P` and `indices` is a `Tensor` of rank `Q`.
`indices` must be integer tensor, containing indices into `ref`.
It must be shape `[d_0, ..., d_{Q-2}, K]` where `0 < K <= P`.
The innermost dimension of ... | Applies sparse assignment to individual values or slices in a Variable. | [
"Applies",
"sparse",
"assignment",
"to",
"individual",
"values",
"or",
"slices",
"in",
"a",
"Variable",
"."
] | def scatter_nd_update(self, indices, updates, name=None):
"""Applies sparse assignment to individual values or slices in a Variable.
`ref` is a `Tensor` with rank `P` and `indices` is a `Tensor` of rank `Q`.
`indices` must be integer tensor, containing indices into `ref`.
It must be shape `[d_0, ..., ... | [
"def",
"scatter_nd_update",
"(",
"self",
",",
"indices",
",",
"updates",
",",
"name",
"=",
"None",
")",
":",
"return",
"self",
".",
"_lazy_read",
"(",
"gen_state_ops",
".",
"resource_scatter_nd_update",
"(",
"self",
".",
"handle",
",",
"indices",
",",
"ops",... | https://github.com/Xilinx/Vitis-AI/blob/fc74d404563d9951b57245443c73bef389f3657f/tools/Vitis-AI-Quantizer/vai_q_tensorflow1.x/tensorflow/python/ops/resource_variable_ops.py#L1132-L1180 | |
snap-stanford/snap-python | d53c51b0a26aa7e3e7400b014cdf728948fde80a | setup/snap.py | python | TNEANetAFltI.IsDeleted | (self) | return _snap.TNEANetAFltI_IsDeleted(self) | IsDeleted(TNEANetAFltI self) -> bool
Parameters:
self: TNEANetAFltI const * | IsDeleted(TNEANetAFltI self) -> bool | [
"IsDeleted",
"(",
"TNEANetAFltI",
"self",
")",
"-",
">",
"bool"
] | def IsDeleted(self):
"""
IsDeleted(TNEANetAFltI self) -> bool
Parameters:
self: TNEANetAFltI const *
"""
return _snap.TNEANetAFltI_IsDeleted(self) | [
"def",
"IsDeleted",
"(",
"self",
")",
":",
"return",
"_snap",
".",
"TNEANetAFltI_IsDeleted",
"(",
"self",
")"
] | https://github.com/snap-stanford/snap-python/blob/d53c51b0a26aa7e3e7400b014cdf728948fde80a/setup/snap.py#L21183-L21191 | |
y123456yz/reading-and-annotate-mongodb-3.6 | 93280293672ca7586dc24af18132aa61e4ed7fcf | mongo/buildscripts/linter/git.py | python | get_files_to_check_working_tree | (filter_function) | return valid_files | Get a list of files to check from the working tree.
This will pick up files not managed by git. | Get a list of files to check from the working tree. | [
"Get",
"a",
"list",
"of",
"files",
"to",
"check",
"from",
"the",
"working",
"tree",
"."
] | def get_files_to_check_working_tree(filter_function):
# type: (Callable[[str], bool]) -> List[str]
"""
Get a list of files to check from the working tree.
This will pick up files not managed by git.
"""
repos = get_repos()
valid_files = list(
itertools.chain.from_iterable(
... | [
"def",
"get_files_to_check_working_tree",
"(",
"filter_function",
")",
":",
"# type: (Callable[[str], bool]) -> List[str]",
"repos",
"=",
"get_repos",
"(",
")",
"valid_files",
"=",
"list",
"(",
"itertools",
".",
"chain",
".",
"from_iterable",
"(",
"[",
"r",
".",
"ge... | https://github.com/y123456yz/reading-and-annotate-mongodb-3.6/blob/93280293672ca7586dc24af18132aa61e4ed7fcf/mongo/buildscripts/linter/git.py#L130-L143 | |
catboost/catboost | 167f64f237114a4d10b2b4ee42adb4569137debe | contrib/python/more-itertools/py3/more_itertools/more.py | python | difference | (iterable, func=sub, *, initial=None) | return chain(first, starmap(func, zip(b, a))) | This function is the inverse of :func:`itertools.accumulate`. By default
it will compute the first difference of *iterable* using
:func:`operator.sub`:
>>> from itertools import accumulate
>>> iterable = accumulate([0, 1, 2, 3, 4]) # produces 0, 1, 3, 6, 10
>>> list(difference(iterable... | This function is the inverse of :func:`itertools.accumulate`. By default
it will compute the first difference of *iterable* using
:func:`operator.sub`: | [
"This",
"function",
"is",
"the",
"inverse",
"of",
":",
"func",
":",
"itertools",
".",
"accumulate",
".",
"By",
"default",
"it",
"will",
"compute",
"the",
"first",
"difference",
"of",
"*",
"iterable",
"*",
"using",
":",
"func",
":",
"operator",
".",
"sub"... | def difference(iterable, func=sub, *, initial=None):
"""This function is the inverse of :func:`itertools.accumulate`. By default
it will compute the first difference of *iterable* using
:func:`operator.sub`:
>>> from itertools import accumulate
>>> iterable = accumulate([0, 1, 2, 3, 4]) # ... | [
"def",
"difference",
"(",
"iterable",
",",
"func",
"=",
"sub",
",",
"*",
",",
"initial",
"=",
"None",
")",
":",
"a",
",",
"b",
"=",
"tee",
"(",
"iterable",
")",
"try",
":",
"first",
"=",
"[",
"next",
"(",
"b",
")",
"]",
"except",
"StopIteration",... | https://github.com/catboost/catboost/blob/167f64f237114a4d10b2b4ee42adb4569137debe/contrib/python/more-itertools/py3/more_itertools/more.py#L2648-L2687 | |
yrnkrn/zapcc | c6a8aa30006d997eff0d60fd37b0e62b8aa0ea50 | tools/clang/bindings/python/clang/cindex.py | python | Cursor.get_field_offsetof | (self) | return conf.lib.clang_Cursor_getOffsetOfField(self) | Returns the offsetof the FIELD_DECL pointed by this Cursor. | Returns the offsetof the FIELD_DECL pointed by this Cursor. | [
"Returns",
"the",
"offsetof",
"the",
"FIELD_DECL",
"pointed",
"by",
"this",
"Cursor",
"."
] | def get_field_offsetof(self):
"""Returns the offsetof the FIELD_DECL pointed by this Cursor."""
return conf.lib.clang_Cursor_getOffsetOfField(self) | [
"def",
"get_field_offsetof",
"(",
"self",
")",
":",
"return",
"conf",
".",
"lib",
".",
"clang_Cursor_getOffsetOfField",
"(",
"self",
")"
] | https://github.com/yrnkrn/zapcc/blob/c6a8aa30006d997eff0d60fd37b0e62b8aa0ea50/tools/clang/bindings/python/clang/cindex.py#L1839-L1841 | |
aws/lumberyard | f85344403c1c2e77ec8c75deb2c116e97b713217 | dev/Tools/Python/3.7.10/mac/Python.framework/Versions/3.7/lib/python3.7/site-packages/pip/_vendor/urllib3/contrib/_appengine_environ.py | python | is_appengine_sandbox | () | return is_appengine() and os.environ["APPENGINE_RUNTIME"] == "python27" | Reports if the app is running in the first generation sandbox.
The second generation runtimes are technically still in a sandbox, but it
is much less restrictive, so generally you shouldn't need to check for it.
see https://cloud.google.com/appengine/docs/standard/runtimes | Reports if the app is running in the first generation sandbox. | [
"Reports",
"if",
"the",
"app",
"is",
"running",
"in",
"the",
"first",
"generation",
"sandbox",
"."
] | def is_appengine_sandbox():
"""Reports if the app is running in the first generation sandbox.
The second generation runtimes are technically still in a sandbox, but it
is much less restrictive, so generally you shouldn't need to check for it.
see https://cloud.google.com/appengine/docs/standard/runtime... | [
"def",
"is_appengine_sandbox",
"(",
")",
":",
"return",
"is_appengine",
"(",
")",
"and",
"os",
".",
"environ",
"[",
"\"APPENGINE_RUNTIME\"",
"]",
"==",
"\"python27\""
] | https://github.com/aws/lumberyard/blob/f85344403c1c2e77ec8c75deb2c116e97b713217/dev/Tools/Python/3.7.10/mac/Python.framework/Versions/3.7/lib/python3.7/site-packages/pip/_vendor/urllib3/contrib/_appengine_environ.py#L12-L19 | |
microsoft/CNTK | e9396480025b9ca457d26b6f33dd07c474c6aa04 | bindings/python/cntk/ops/sequence/__init__.py | python | input_variable | (shape, dtype=default_override_or(np.float32), needs_gradient=False, is_sparse=False,
sequence_axis=Axis.default_dynamic_axis(), name='') | return input_variable(shape=shape, dtype=dtype, needs_gradient=needs_gradient, is_sparse=is_sparse, dynamic_axes=[Axis.default_batch_axis(), sequence_axis], name=name) | input_variable(shape, dtype=np.float32, needs_gradient=False, is_sparse=False, sequence_axis=Axis.default_dynamic_axis(), name='')
It creates an input in the network: a place where data,
such as features and labels, should be provided.
Args:
shape (tuple or int): the shape of the input tensor
... | input_variable(shape, dtype=np.float32, needs_gradient=False, is_sparse=False, sequence_axis=Axis.default_dynamic_axis(), name='') | [
"input_variable",
"(",
"shape",
"dtype",
"=",
"np",
".",
"float32",
"needs_gradient",
"=",
"False",
"is_sparse",
"=",
"False",
"sequence_axis",
"=",
"Axis",
".",
"default_dynamic_axis",
"()",
"name",
"=",
")"
] | def input_variable(shape, dtype=default_override_or(np.float32), needs_gradient=False, is_sparse=False,
sequence_axis=Axis.default_dynamic_axis(), name=''):
'''input_variable(shape, dtype=np.float32, needs_gradient=False, is_sparse=False, sequence_axis=Axis.default_dynamic_axis(), name='')
I... | [
"def",
"input_variable",
"(",
"shape",
",",
"dtype",
"=",
"default_override_or",
"(",
"np",
".",
"float32",
")",
",",
"needs_gradient",
"=",
"False",
",",
"is_sparse",
"=",
"False",
",",
"sequence_axis",
"=",
"Axis",
".",
"default_dynamic_axis",
"(",
")",
",... | https://github.com/microsoft/CNTK/blob/e9396480025b9ca457d26b6f33dd07c474c6aa04/bindings/python/cntk/ops/sequence/__init__.py#L47-L66 | |
Xilinx/Vitis-AI | fc74d404563d9951b57245443c73bef389f3657f | tools/Vitis-AI-Quantizer/vai_q_tensorflow1.x/tensorflow/contrib/learn/python/learn/estimators/dnn.py | python | DNNRegressor.predict | (self, x=None, input_fn=None, batch_size=None, outputs=None,
as_iterable=True) | return super(DNNRegressor, self).predict(
x=x,
input_fn=input_fn,
batch_size=batch_size,
outputs=outputs,
as_iterable=as_iterable) | Returns predictions for given features.
By default, returns predicted scores. But this default will be dropped
soon. Users should either pass `outputs`, or call `predict_scores` method.
Args:
x: features.
input_fn: Input function. If set, x must be None.
batch_size: Override default batc... | Returns predictions for given features. | [
"Returns",
"predictions",
"for",
"given",
"features",
"."
] | def predict(self, x=None, input_fn=None, batch_size=None, outputs=None,
as_iterable=True):
"""Returns predictions for given features.
By default, returns predicted scores. But this default will be dropped
soon. Users should either pass `outputs`, or call `predict_scores` method.
Args:
... | [
"def",
"predict",
"(",
"self",
",",
"x",
"=",
"None",
",",
"input_fn",
"=",
"None",
",",
"batch_size",
"=",
"None",
",",
"outputs",
"=",
"None",
",",
"as_iterable",
"=",
"True",
")",
":",
"if",
"not",
"outputs",
":",
"return",
"self",
".",
"predict_s... | https://github.com/Xilinx/Vitis-AI/blob/fc74d404563d9951b57245443c73bef389f3657f/tools/Vitis-AI-Quantizer/vai_q_tensorflow1.x/tensorflow/contrib/learn/python/learn/estimators/dnn.py#L714-L749 | |
google/llvm-propeller | 45c226984fe8377ebfb2ad7713c680d652ba678d | llvm/utils/benchmark/mingw.py | python | find_in_path | (file, path=None) | return list(filter(os.path.exists,
map(lambda dir, file=file: os.path.join(dir, file), path))) | Attempts to find an executable in the path | Attempts to find an executable in the path | [
"Attempts",
"to",
"find",
"an",
"executable",
"in",
"the",
"path"
] | def find_in_path(file, path=None):
'''
Attempts to find an executable in the path
'''
if platform.system() == 'Windows':
file += '.exe'
if path is None:
path = os.environ.get('PATH', '')
if type(path) is type(''):
path = path.split(os.pathsep)
return list(filter(os.pa... | [
"def",
"find_in_path",
"(",
"file",
",",
"path",
"=",
"None",
")",
":",
"if",
"platform",
".",
"system",
"(",
")",
"==",
"'Windows'",
":",
"file",
"+=",
"'.exe'",
"if",
"path",
"is",
"None",
":",
"path",
"=",
"os",
".",
"environ",
".",
"get",
"(",
... | https://github.com/google/llvm-propeller/blob/45c226984fe8377ebfb2ad7713c680d652ba678d/llvm/utils/benchmark/mingw.py#L86-L97 | |
yushroom/FishEngine | a4b9fb9b0a6dc202f7990e75f4b7d8d5163209d9 | Script/reflect/clang/cindex.py | python | CursorKind.is_expression | (self) | return conf.lib.clang_isExpression(self) | Test if this is an expression kind. | Test if this is an expression kind. | [
"Test",
"if",
"this",
"is",
"an",
"expression",
"kind",
"."
] | def is_expression(self):
"""Test if this is an expression kind."""
return conf.lib.clang_isExpression(self) | [
"def",
"is_expression",
"(",
"self",
")",
":",
"return",
"conf",
".",
"lib",
".",
"clang_isExpression",
"(",
"self",
")"
] | https://github.com/yushroom/FishEngine/blob/a4b9fb9b0a6dc202f7990e75f4b7d8d5163209d9/Script/reflect/clang/cindex.py#L609-L611 | |
include-what-you-use/include-what-you-use | 208fbfffa5d69364b9f78e427caa443441279283 | iwyu-check-license-header.py | python | main | (filenames, add_if_missing) | return len(errors) | Entry point.
Checks license header of all filenames provided.
Returns zero if all license headers are OK, non-zero otherwise. | Entry point. | [
"Entry",
"point",
"."
] | def main(filenames, add_if_missing):
""" Entry point.
Checks license header of all filenames provided.
Returns zero if all license headers are OK, non-zero otherwise.
"""
errors = []
for filename in filenames:
if os.path.isdir(filename):
continue
checker = File.pars... | [
"def",
"main",
"(",
"filenames",
",",
"add_if_missing",
")",
":",
"errors",
"=",
"[",
"]",
"for",
"filename",
"in",
"filenames",
":",
"if",
"os",
".",
"path",
".",
"isdir",
"(",
"filename",
")",
":",
"continue",
"checker",
"=",
"File",
".",
"parse",
... | https://github.com/include-what-you-use/include-what-you-use/blob/208fbfffa5d69364b9f78e427caa443441279283/iwyu-check-license-header.py#L244-L269 | |
wxWidgets/wxPython-Classic | 19571e1ae65f1ac445f5491474121998c97a1bf0 | src/gtk/aui.py | python | AuiMDIClientWindow.SetActiveChild | (*args, **kwargs) | return _aui.AuiMDIClientWindow_SetActiveChild(*args, **kwargs) | SetActiveChild(self, AuiMDIChildFrame pChildFrame) | SetActiveChild(self, AuiMDIChildFrame pChildFrame) | [
"SetActiveChild",
"(",
"self",
"AuiMDIChildFrame",
"pChildFrame",
")"
] | def SetActiveChild(*args, **kwargs):
"""SetActiveChild(self, AuiMDIChildFrame pChildFrame)"""
return _aui.AuiMDIClientWindow_SetActiveChild(*args, **kwargs) | [
"def",
"SetActiveChild",
"(",
"*",
"args",
",",
"*",
"*",
"kwargs",
")",
":",
"return",
"_aui",
".",
"AuiMDIClientWindow_SetActiveChild",
"(",
"*",
"args",
",",
"*",
"*",
"kwargs",
")"
] | https://github.com/wxWidgets/wxPython-Classic/blob/19571e1ae65f1ac445f5491474121998c97a1bf0/src/gtk/aui.py#L1643-L1645 | |
acbull/Unbiased_LambdaMart | 7c39abe5caa18ca07df2d23c2db392916d92956c | Unbias_LightGBM/python-package/lightgbm/basic.py | python | _InnerPredictor.__pred_for_np2d | (self, mat, num_iteration, predict_type) | return preds, mat.shape[0] | Predict for a 2-D numpy matrix. | Predict for a 2-D numpy matrix. | [
"Predict",
"for",
"a",
"2",
"-",
"D",
"numpy",
"matrix",
"."
] | def __pred_for_np2d(self, mat, num_iteration, predict_type):
"""
Predict for a 2-D numpy matrix.
"""
if len(mat.shape) != 2:
raise ValueError('Input numpy.ndarray or list must be 2 dimensional')
if mat.dtype == np.float32 or mat.dtype == np.float64:
data ... | [
"def",
"__pred_for_np2d",
"(",
"self",
",",
"mat",
",",
"num_iteration",
",",
"predict_type",
")",
":",
"if",
"len",
"(",
"mat",
".",
"shape",
")",
"!=",
"2",
":",
"raise",
"ValueError",
"(",
"'Input numpy.ndarray or list must be 2 dimensional'",
")",
"if",
"m... | https://github.com/acbull/Unbiased_LambdaMart/blob/7c39abe5caa18ca07df2d23c2db392916d92956c/Unbias_LightGBM/python-package/lightgbm/basic.py#L477-L508 | |
thalium/icebox | 99d147d5b9269222225443ce171b4fd46d8985d4 | third_party/virtualbox/src/libs/libxml2-2.9.4/python/libxml2.py | python | xmlDoc.htmlSaveFile | (self, filename) | return ret | Dump an HTML document to a file. If @filename is "-" the
stdout file is used. | Dump an HTML document to a file. If | [
"Dump",
"an",
"HTML",
"document",
"to",
"a",
"file",
".",
"If"
] | def htmlSaveFile(self, filename):
"""Dump an HTML document to a file. If @filename is "-" the
stdout file is used. """
ret = libxml2mod.htmlSaveFile(filename, self._o)
return ret | [
"def",
"htmlSaveFile",
"(",
"self",
",",
"filename",
")",
":",
"ret",
"=",
"libxml2mod",
".",
"htmlSaveFile",
"(",
"filename",
",",
"self",
".",
"_o",
")",
"return",
"ret"
] | https://github.com/thalium/icebox/blob/99d147d5b9269222225443ce171b4fd46d8985d4/third_party/virtualbox/src/libs/libxml2-2.9.4/python/libxml2.py#L4051-L4055 | |
mindspore-ai/mindspore | fb8fd3338605bb34fa5cea054e535a8b1d753fab | mindspore/python/mindspore/dataset/vision/py_transforms.py | python | CenterCrop.__call__ | (self, img) | return util.center_crop(img, self.size) | Call method.
Args:
img (PIL Image): Image to be center cropped.
Returns:
PIL Image, cropped image. | Call method. | [
"Call",
"method",
"."
] | def __call__(self, img):
"""
Call method.
Args:
img (PIL Image): Image to be center cropped.
Returns:
PIL Image, cropped image.
"""
return util.center_crop(img, self.size) | [
"def",
"__call__",
"(",
"self",
",",
"img",
")",
":",
"return",
"util",
".",
"center_crop",
"(",
"img",
",",
"self",
".",
"size",
")"
] | https://github.com/mindspore-ai/mindspore/blob/fb8fd3338605bb34fa5cea054e535a8b1d753fab/mindspore/python/mindspore/dataset/vision/py_transforms.py#L711-L721 | |
indutny/candor | 48e7260618f5091c80a3416828e2808cad3ea22e | tools/gyp/pylib/gyp/generator/android.py | python | AndroidMkWriter.ComputeAndroidModule | (self, spec) | return make.StringToMakefileVariable(name) | Return the Android module name used for a gyp spec.
We use the complete qualified target name to avoid collisions between
duplicate targets in different directories. We also add a suffix to
distinguish gyp-generated module names. | Return the Android module name used for a gyp spec. | [
"Return",
"the",
"Android",
"module",
"name",
"used",
"for",
"a",
"gyp",
"spec",
"."
] | def ComputeAndroidModule(self, spec):
"""Return the Android module name used for a gyp spec.
We use the complete qualified target name to avoid collisions between
duplicate targets in different directories. We also add a suffix to
distinguish gyp-generated module names.
"""
if self.type == 'sh... | [
"def",
"ComputeAndroidModule",
"(",
"self",
",",
"spec",
")",
":",
"if",
"self",
".",
"type",
"==",
"'shared_library'",
":",
"# For reasons of convention, the Android build system requires that all",
"# shared library modules are named 'libfoo' when generating -l flags.",
"prefix",... | https://github.com/indutny/candor/blob/48e7260618f5091c80a3416828e2808cad3ea22e/tools/gyp/pylib/gyp/generator/android.py#L571-L596 | |
Dobiasd/frugally-deep | 99d9378c6ef537a209bcb2a102e953899a6ab0e3 | keras_export/convert_model.py | python | singleton_list_to_value | (value_or_values) | return value_or_values | Leaves non-list values untouched.
Raises an Exception in case the input list does not have exactly one element. | Leaves non-list values untouched.
Raises an Exception in case the input list does not have exactly one element. | [
"Leaves",
"non",
"-",
"list",
"values",
"untouched",
".",
"Raises",
"an",
"Exception",
"in",
"case",
"the",
"input",
"list",
"does",
"not",
"have",
"exactly",
"one",
"element",
"."
] | def singleton_list_to_value(value_or_values):
"""
Leaves non-list values untouched.
Raises an Exception in case the input list does not have exactly one element.
"""
if isinstance(value_or_values, list):
assert len(value_or_values) == 1
return value_or_values[0]
return value_or_v... | [
"def",
"singleton_list_to_value",
"(",
"value_or_values",
")",
":",
"if",
"isinstance",
"(",
"value_or_values",
",",
"list",
")",
":",
"assert",
"len",
"(",
"value_or_values",
")",
"==",
"1",
"return",
"value_or_values",
"[",
"0",
"]",
"return",
"value_or_values... | https://github.com/Dobiasd/frugally-deep/blob/99d9378c6ef537a209bcb2a102e953899a6ab0e3/keras_export/convert_model.py#L755-L763 | |
PaddlePaddle/Paddle | 1252f4bb3e574df80aa6d18c7ddae1b3a90bd81c | python/paddle/fluid/layers/sequence_lod.py | python | sequence_unpad | (x, length, name=None) | return out | :api_attr: Static Graph
**Note**:
**The input of the OP is Tensor and the output is LoDTensor. For padding operation, See:** :ref:`api_fluid_layers_sequence_pad`
The OP removes the padding data from the input based on the length information and returns a LoDTensor.
.. code-block:: text
... | :api_attr: Static Graph | [
":",
"api_attr",
":",
"Static",
"Graph"
] | def sequence_unpad(x, length, name=None):
"""
:api_attr: Static Graph
**Note**:
**The input of the OP is Tensor and the output is LoDTensor. For padding operation, See:** :ref:`api_fluid_layers_sequence_pad`
The OP removes the padding data from the input based on the length information ... | [
"def",
"sequence_unpad",
"(",
"x",
",",
"length",
",",
"name",
"=",
"None",
")",
":",
"assert",
"not",
"in_dygraph_mode",
"(",
")",
",",
"(",
"\"sequence layer is not supported in dygraph mode yet.\"",
")",
"helper",
"=",
"LayerHelper",
"(",
"'sequence_unpad'",
",... | https://github.com/PaddlePaddle/Paddle/blob/1252f4bb3e574df80aa6d18c7ddae1b3a90bd81c/python/paddle/fluid/layers/sequence_lod.py#L1023-L1097 | |
aws/lumberyard | f85344403c1c2e77ec8c75deb2c116e97b713217 | dev/Gems/CloudGemMetric/v1/AWS/python/windows/Lib/psutil/_pssunos.py | python | cpu_times | () | return scputimes(*[sum(x) for x in zip(*ret)]) | Return system-wide CPU times as a named tuple | Return system-wide CPU times as a named tuple | [
"Return",
"system",
"-",
"wide",
"CPU",
"times",
"as",
"a",
"named",
"tuple"
] | def cpu_times():
"""Return system-wide CPU times as a named tuple"""
ret = cext.per_cpu_times()
return scputimes(*[sum(x) for x in zip(*ret)]) | [
"def",
"cpu_times",
"(",
")",
":",
"ret",
"=",
"cext",
".",
"per_cpu_times",
"(",
")",
"return",
"scputimes",
"(",
"*",
"[",
"sum",
"(",
"x",
")",
"for",
"x",
"in",
"zip",
"(",
"*",
"ret",
")",
"]",
")"
] | https://github.com/aws/lumberyard/blob/f85344403c1c2e77ec8c75deb2c116e97b713217/dev/Gems/CloudGemMetric/v1/AWS/python/windows/Lib/psutil/_pssunos.py#L172-L175 | |
zlgopen/awtk | 2c49e854a78749d9092907c027a7fba9062be549 | 3rd/mbedtls/scripts/assemble_changelog.py | python | ChangeLog.write | (self, filename) | Write the changelog to the specified file. | Write the changelog to the specified file. | [
"Write",
"the",
"changelog",
"to",
"the",
"specified",
"file",
"."
] | def write(self, filename):
"""Write the changelog to the specified file.
"""
with open(filename, 'wb') as out:
out.write(self.header)
out.write(self.top_version_title)
for title, body in self.categories.items():
if not body:
... | [
"def",
"write",
"(",
"self",
",",
"filename",
")",
":",
"with",
"open",
"(",
"filename",
",",
"'wb'",
")",
"as",
"out",
":",
"out",
".",
"write",
"(",
"self",
".",
"header",
")",
"out",
".",
"write",
"(",
"self",
".",
"top_version_title",
")",
"for... | https://github.com/zlgopen/awtk/blob/2c49e854a78749d9092907c027a7fba9062be549/3rd/mbedtls/scripts/assemble_changelog.py#L244-L254 | ||
ycm-core/ycmd | fc0fb7e5e15176cc5a2a30c80956335988c6b59a | ycmd/completers/cs/cs_completer.py | python | CsharpCompleter.ServerIsReady | ( self ) | return self._CheckAllRunning( lambda i: i.ServerIsReady() ) | Check if our OmniSharp server is ready (loaded solution file). | Check if our OmniSharp server is ready (loaded solution file). | [
"Check",
"if",
"our",
"OmniSharp",
"server",
"is",
"ready",
"(",
"loaded",
"solution",
"file",
")",
"."
] | def ServerIsReady( self ):
""" Check if our OmniSharp server is ready (loaded solution file)."""
return self._CheckAllRunning( lambda i: i.ServerIsReady() ) | [
"def",
"ServerIsReady",
"(",
"self",
")",
":",
"return",
"self",
".",
"_CheckAllRunning",
"(",
"lambda",
"i",
":",
"i",
".",
"ServerIsReady",
"(",
")",
")"
] | https://github.com/ycm-core/ycmd/blob/fc0fb7e5e15176cc5a2a30c80956335988c6b59a/ycmd/completers/cs/cs_completer.py#L367-L369 | |
catboost/catboost | 167f64f237114a4d10b2b4ee42adb4569137debe | contrib/python/pandas/py2/pandas/io/pytables.py | python | Table.read_coordinates | (self, where=None, start=None, stop=None, **kwargs) | return Index(coords) | select coordinates (row numbers) from a table; return the
coordinates object | select coordinates (row numbers) from a table; return the
coordinates object | [
"select",
"coordinates",
"(",
"row",
"numbers",
")",
"from",
"a",
"table",
";",
"return",
"the",
"coordinates",
"object"
] | def read_coordinates(self, where=None, start=None, stop=None, **kwargs):
"""select coordinates (row numbers) from a table; return the
coordinates object
"""
# validate the version
self.validate_version(where)
# infer the data kind
if not self.infer_axes():
... | [
"def",
"read_coordinates",
"(",
"self",
",",
"where",
"=",
"None",
",",
"start",
"=",
"None",
",",
"stop",
"=",
"None",
",",
"*",
"*",
"kwargs",
")",
":",
"# validate the version",
"self",
".",
"validate_version",
"(",
"where",
")",
"# infer the data kind",
... | https://github.com/catboost/catboost/blob/167f64f237114a4d10b2b4ee42adb4569137debe/contrib/python/pandas/py2/pandas/io/pytables.py#L3791-L3814 | |
bh107/bohrium | 5b83e7117285fefc7779ed0e9acb0f8e74c7e068 | bridge/py_api/bohrium_api/messaging.py | python | gpu_disable | () | return msg("GPU: disable") | Disable the GPU backend in the current runtime stack | Disable the GPU backend in the current runtime stack | [
"Disable",
"the",
"GPU",
"backend",
"in",
"the",
"current",
"runtime",
"stack"
] | def gpu_disable():
"""Disable the GPU backend in the current runtime stack"""
return msg("GPU: disable") | [
"def",
"gpu_disable",
"(",
")",
":",
"return",
"msg",
"(",
"\"GPU: disable\"",
")"
] | https://github.com/bh107/bohrium/blob/5b83e7117285fefc7779ed0e9acb0f8e74c7e068/bridge/py_api/bohrium_api/messaging.py#L19-L21 | |
tensorflow/io | 92b44e180674a8af0e12e405530f7343e3e693e4 | tensorflow_io/python/experimental/serialization_ops.py | python | process_entry | (data, name) | return process_primitive(data["type"], name) | process_entry | process_entry | [
"process_entry"
] | def process_entry(data, name):
"""process_entry"""
if data["type"] == "record":
return process_record(data, name)
if data["type"] == "enum":
assert False
if data["type"] == "array":
assert False
if data["type"] == "map":
assert False
if data["type"] == "fixed":
... | [
"def",
"process_entry",
"(",
"data",
",",
"name",
")",
":",
"if",
"data",
"[",
"\"type\"",
"]",
"==",
"\"record\"",
":",
"return",
"process_record",
"(",
"data",
",",
"name",
")",
"if",
"data",
"[",
"\"type\"",
"]",
"==",
"\"enum\"",
":",
"assert",
"Fa... | https://github.com/tensorflow/io/blob/92b44e180674a8af0e12e405530f7343e3e693e4/tensorflow_io/python/experimental/serialization_ops.py#L111-L125 | |
aws/lumberyard | f85344403c1c2e77ec8c75deb2c116e97b713217 | dev/Gems/CloudGemMetric/v1/AWS/python/windows/Lib/numpy/core/_internal.py | python | _ctypes.strides | (self) | return self.strides_as(_getintp_ctype()) | (c_intp*self.ndim): A ctypes array of length self.ndim where
the basetype is the same as for the shape attribute. This ctypes array
contains the strides information from the underlying array. This strides
information is important for showing how many bytes must be jumped to
get to the ne... | (c_intp*self.ndim): A ctypes array of length self.ndim where
the basetype is the same as for the shape attribute. This ctypes array
contains the strides information from the underlying array. This strides
information is important for showing how many bytes must be jumped to
get to the ne... | [
"(",
"c_intp",
"*",
"self",
".",
"ndim",
")",
":",
"A",
"ctypes",
"array",
"of",
"length",
"self",
".",
"ndim",
"where",
"the",
"basetype",
"is",
"the",
"same",
"as",
"for",
"the",
"shape",
"attribute",
".",
"This",
"ctypes",
"array",
"contains",
"the"... | def strides(self):
"""
(c_intp*self.ndim): A ctypes array of length self.ndim where
the basetype is the same as for the shape attribute. This ctypes array
contains the strides information from the underlying array. This strides
information is important for showing how many bytes ... | [
"def",
"strides",
"(",
"self",
")",
":",
"return",
"self",
".",
"strides_as",
"(",
"_getintp_ctype",
"(",
")",
")"
] | https://github.com/aws/lumberyard/blob/f85344403c1c2e77ec8c75deb2c116e97b713217/dev/Gems/CloudGemMetric/v1/AWS/python/windows/Lib/numpy/core/_internal.py#L336-L344 | |
OKCoin/websocket | 50c806cf1e9a84984c6cf2efd94a937738cfc35c | python/websocket/_core.py | python | WebSocket.getsubprotocol | (self) | get subprotocol | get subprotocol | [
"get",
"subprotocol"
] | def getsubprotocol(self):
"""
get subprotocol
"""
if self.handshake_response:
return self.handshake_response.subprotocol
else:
return None | [
"def",
"getsubprotocol",
"(",
"self",
")",
":",
"if",
"self",
".",
"handshake_response",
":",
"return",
"self",
".",
"handshake_response",
".",
"subprotocol",
"else",
":",
"return",
"None"
] | https://github.com/OKCoin/websocket/blob/50c806cf1e9a84984c6cf2efd94a937738cfc35c/python/websocket/_core.py#L203-L210 | ||
scribusproject/scribus | 41ec7c775a060912cf251682a8b1437f753f80f4 | codegen/cheetah/Cheetah/Templates/_SkeletonPage.py | python | _SkeletonPage.formHTMLTag | (self, tagName, attributes={}) | return ''.join(tagTxt) | returns a string containing an HTML <tag> | returns a string containing an HTML <tag> | [
"returns",
"a",
"string",
"containing",
"an",
"HTML",
"<tag",
">"
] | def formHTMLTag(self, tagName, attributes={}):
"""returns a string containing an HTML <tag> """
tagTxt = ['<', tagName.lower()]
for name, val in attributes.items():
tagTxt += [' ', name.lower(), '="', str(val), '"']
tagTxt.append('>')
return ''.join(tagTxt) | [
"def",
"formHTMLTag",
"(",
"self",
",",
"tagName",
",",
"attributes",
"=",
"{",
"}",
")",
":",
"tagTxt",
"=",
"[",
"'<'",
",",
"tagName",
".",
"lower",
"(",
")",
"]",
"for",
"name",
",",
"val",
"in",
"attributes",
".",
"items",
"(",
")",
":",
"ta... | https://github.com/scribusproject/scribus/blob/41ec7c775a060912cf251682a8b1437f753f80f4/codegen/cheetah/Cheetah/Templates/_SkeletonPage.py#L194-L200 | |
wxWidgets/wxPython-Classic | 19571e1ae65f1ac445f5491474121998c97a1bf0 | src/osx_cocoa/dataview.py | python | PreDataViewListCtrl | (*args, **kwargs) | return val | PreDataViewListCtrl() -> DataViewListCtrl | PreDataViewListCtrl() -> DataViewListCtrl | [
"PreDataViewListCtrl",
"()",
"-",
">",
"DataViewListCtrl"
] | def PreDataViewListCtrl(*args, **kwargs):
"""PreDataViewListCtrl() -> DataViewListCtrl"""
val = _dataview.new_PreDataViewListCtrl(*args, **kwargs)
return val | [
"def",
"PreDataViewListCtrl",
"(",
"*",
"args",
",",
"*",
"*",
"kwargs",
")",
":",
"val",
"=",
"_dataview",
".",
"new_PreDataViewListCtrl",
"(",
"*",
"args",
",",
"*",
"*",
"kwargs",
")",
"return",
"val"
] | https://github.com/wxWidgets/wxPython-Classic/blob/19571e1ae65f1ac445f5491474121998c97a1bf0/src/osx_cocoa/dataview.py#L2211-L2214 | |
aws/lumberyard | f85344403c1c2e77ec8c75deb2c116e97b713217 | dev/Tools/AWSPythonSDK/1.5.8/botocore/paginate.py | python | PageIterator._convert_deprecated_starting_token | (self, deprecated_token) | return dict(zip(self._input_token, deprecated_token)) | This attempts to convert a deprecated starting token into the new
style. | This attempts to convert a deprecated starting token into the new
style. | [
"This",
"attempts",
"to",
"convert",
"a",
"deprecated",
"starting",
"token",
"into",
"the",
"new",
"style",
"."
] | def _convert_deprecated_starting_token(self, deprecated_token):
"""
This attempts to convert a deprecated starting token into the new
style.
"""
len_deprecated_token = len(deprecated_token)
len_input_token = len(self._input_token)
if len_deprecated_token > len_inp... | [
"def",
"_convert_deprecated_starting_token",
"(",
"self",
",",
"deprecated_token",
")",
":",
"len_deprecated_token",
"=",
"len",
"(",
"deprecated_token",
")",
"len_input_token",
"=",
"len",
"(",
"self",
".",
"_input_token",
")",
"if",
"len_deprecated_token",
">",
"l... | https://github.com/aws/lumberyard/blob/f85344403c1c2e77ec8c75deb2c116e97b713217/dev/Tools/AWSPythonSDK/1.5.8/botocore/paginate.py#L534-L548 | |
aws/lumberyard | f85344403c1c2e77ec8c75deb2c116e97b713217 | dev/Gems/CloudGemMetric/v1/AWS/common-code/Lib/pandas/core/generic.py | python | NDFrame.tshift | (
self: FrameOrSeries, periods: int = 1, freq=None, axis=0
) | return self._constructor(new_data).__finalize__(self) | Shift the time index, using the index's frequency if available.
Parameters
----------
periods : int
Number of periods to move, can be positive or negative.
freq : DateOffset, timedelta, or str, default None
Increment to use from the tseries module
or ... | Shift the time index, using the index's frequency if available. | [
"Shift",
"the",
"time",
"index",
"using",
"the",
"index",
"s",
"frequency",
"if",
"available",
"."
] | def tshift(
self: FrameOrSeries, periods: int = 1, freq=None, axis=0
) -> FrameOrSeries:
"""
Shift the time index, using the index's frequency if available.
Parameters
----------
periods : int
Number of periods to move, can be positive or negative.
... | [
"def",
"tshift",
"(",
"self",
":",
"FrameOrSeries",
",",
"periods",
":",
"int",
"=",
"1",
",",
"freq",
"=",
"None",
",",
"axis",
"=",
"0",
")",
"->",
"FrameOrSeries",
":",
"index",
"=",
"self",
".",
"_get_axis",
"(",
"axis",
")",
"if",
"freq",
"is"... | https://github.com/aws/lumberyard/blob/f85344403c1c2e77ec8c75deb2c116e97b713217/dev/Gems/CloudGemMetric/v1/AWS/common-code/Lib/pandas/core/generic.py#L9088-L9148 | |
trailofbits/llvm-sanitizer-tutorial | d29dfeec7f51fbf234fd0080f28f2b30cd0b6e99 | llvm/tools/clang/bindings/python/clang/cindex.py | python | Type.get_declaration | (self) | return conf.lib.clang_getTypeDeclaration(self) | Return the cursor for the declaration of the given type. | Return the cursor for the declaration of the given type. | [
"Return",
"the",
"cursor",
"for",
"the",
"declaration",
"of",
"the",
"given",
"type",
"."
] | def get_declaration(self):
"""
Return the cursor for the declaration of the given type.
"""
return conf.lib.clang_getTypeDeclaration(self) | [
"def",
"get_declaration",
"(",
"self",
")",
":",
"return",
"conf",
".",
"lib",
".",
"clang_getTypeDeclaration",
"(",
"self",
")"
] | https://github.com/trailofbits/llvm-sanitizer-tutorial/blob/d29dfeec7f51fbf234fd0080f28f2b30cd0b6e99/llvm/tools/clang/bindings/python/clang/cindex.py#L2336-L2340 | |
H-uru/Plasma | c2140ea046e82e9c199e257a7f2e7edb42602871 | Scripts/Python/islmPodMap.py | python | islmPodMap.__del__ | (self) | unload the dialog that we loaded | unload the dialog that we loaded | [
"unload",
"the",
"dialog",
"that",
"we",
"loaded"
] | def __del__(self):
"unload the dialog that we loaded"
PtUnloadDialog(Vignette.value) | [
"def",
"__del__",
"(",
"self",
")",
":",
"PtUnloadDialog",
"(",
"Vignette",
".",
"value",
")"
] | https://github.com/H-uru/Plasma/blob/c2140ea046e82e9c199e257a7f2e7edb42602871/Scripts/Python/islmPodMap.py#L94-L96 | ||
wxWidgets/wxPython-Classic | 19571e1ae65f1ac445f5491474121998c97a1bf0 | src/msw/stc.py | python | StyledTextCtrl.ScrollToColumn | (*args, **kwargs) | return _stc.StyledTextCtrl_ScrollToColumn(*args, **kwargs) | ScrollToColumn(self, int column)
Scroll enough to make the given column visible | ScrollToColumn(self, int column) | [
"ScrollToColumn",
"(",
"self",
"int",
"column",
")"
] | def ScrollToColumn(*args, **kwargs):
"""
ScrollToColumn(self, int column)
Scroll enough to make the given column visible
"""
return _stc.StyledTextCtrl_ScrollToColumn(*args, **kwargs) | [
"def",
"ScrollToColumn",
"(",
"*",
"args",
",",
"*",
"*",
"kwargs",
")",
":",
"return",
"_stc",
".",
"StyledTextCtrl_ScrollToColumn",
"(",
"*",
"args",
",",
"*",
"*",
"kwargs",
")"
] | https://github.com/wxWidgets/wxPython-Classic/blob/19571e1ae65f1ac445f5491474121998c97a1bf0/src/msw/stc.py#L6613-L6619 | |
Kitware/ParaView | f760af9124ff4634b23ebbeab95a4f56e0261955 | ThirdParty/cinema/paraview/tpl/cinema_python/adaptors/paraview/cinemareader.py | python | layer2img | (layer) | return img | converts a layer to vtkImageData. | converts a layer to vtkImageData. | [
"converts",
"a",
"layer",
"to",
"vtkImageData",
"."
] | def layer2img(layer):
"""converts a layer to vtkImageData."""
if not layer:
return None
img = vtk.vtkImageData()
dims = [0, 0, 0]
if layer.hasValueArray():
nvalues = layer.getValueArray()
# now, the numpy array's shape matches the 2D image
dims[0] = nvalues.shape[1]
... | [
"def",
"layer2img",
"(",
"layer",
")",
":",
"if",
"not",
"layer",
":",
"return",
"None",
"img",
"=",
"vtk",
".",
"vtkImageData",
"(",
")",
"dims",
"=",
"[",
"0",
",",
"0",
",",
"0",
"]",
"if",
"layer",
".",
"hasValueArray",
"(",
")",
":",
"nvalue... | https://github.com/Kitware/ParaView/blob/f760af9124ff4634b23ebbeab95a4f56e0261955/ThirdParty/cinema/paraview/tpl/cinema_python/adaptors/paraview/cinemareader.py#L16-L63 | |
Polidea/SiriusObfuscator | b0e590d8130e97856afe578869b83a209e2b19be | SymbolExtractorAndRenamer/lldb/scripts/Python/static-binding/lldb.py | python | SBBreakpoint.GetHitCount | (self) | return _lldb.SBBreakpoint_GetHitCount(self) | GetHitCount(self) -> uint32_t | GetHitCount(self) -> uint32_t | [
"GetHitCount",
"(",
"self",
")",
"-",
">",
"uint32_t"
] | def GetHitCount(self):
"""GetHitCount(self) -> uint32_t"""
return _lldb.SBBreakpoint_GetHitCount(self) | [
"def",
"GetHitCount",
"(",
"self",
")",
":",
"return",
"_lldb",
".",
"SBBreakpoint_GetHitCount",
"(",
"self",
")"
] | https://github.com/Polidea/SiriusObfuscator/blob/b0e590d8130e97856afe578869b83a209e2b19be/SymbolExtractorAndRenamer/lldb/scripts/Python/static-binding/lldb.py#L1494-L1496 | |
intel/caffe | 3f494b442ee3f9d17a07b09ecbd5fa2bbda00836 | scripts/cpp_lint.py | python | ProcessFileData | (filename, file_extension, lines, error,
extra_check_functions=[]) | Performs lint checks and reports any errors to the given error function.
Args:
filename: Filename of the file that is being processed.
file_extension: The extension (dot not included) of the file.
lines: An array of strings, each representing a line of the file, with the
last element being emp... | Performs lint checks and reports any errors to the given error function. | [
"Performs",
"lint",
"checks",
"and",
"reports",
"any",
"errors",
"to",
"the",
"given",
"error",
"function",
"."
] | def ProcessFileData(filename, file_extension, lines, error,
extra_check_functions=[]):
"""Performs lint checks and reports any errors to the given error function.
Args:
filename: Filename of the file that is being processed.
file_extension: The extension (dot not included) of the file.
... | [
"def",
"ProcessFileData",
"(",
"filename",
",",
"file_extension",
",",
"lines",
",",
"error",
",",
"extra_check_functions",
"=",
"[",
"]",
")",
":",
"lines",
"=",
"(",
"[",
"'// marker so line numbers and indices both start at 1'",
"]",
"+",
"lines",
"+",
"[",
"... | https://github.com/intel/caffe/blob/3f494b442ee3f9d17a07b09ecbd5fa2bbda00836/scripts/cpp_lint.py#L4648-L4691 | ||
catboost/catboost | 167f64f237114a4d10b2b4ee42adb4569137debe | contrib/python/protobuf/py3/google/protobuf/internal/containers.py | python | RepeatedScalarFieldContainer.__init__ | (self, message_listener, type_checker) | Args:
message_listener: A MessageListener implementation. The
RepeatedScalarFieldContainer will call this object's Modified() method
when it is modified.
type_checker: A type_checkers.ValueChecker instance to run on elements
inserted into this container. | Args: | [
"Args",
":"
] | def __init__(self, message_listener, type_checker):
"""Args:
message_listener: A MessageListener implementation. The
RepeatedScalarFieldContainer will call this object's Modified() method
when it is modified.
type_checker: A type_checkers.ValueChecker instance to run on elements
inser... | [
"def",
"__init__",
"(",
"self",
",",
"message_listener",
",",
"type_checker",
")",
":",
"super",
"(",
"RepeatedScalarFieldContainer",
",",
"self",
")",
".",
"__init__",
"(",
"message_listener",
")",
"self",
".",
"_type_checker",
"=",
"type_checker"
] | https://github.com/catboost/catboost/blob/167f64f237114a4d10b2b4ee42adb4569137debe/contrib/python/protobuf/py3/google/protobuf/internal/containers.py#L247-L257 | ||
martinmoene/span-lite | 8f7935ff4e502ee023990d356d6578b8293eda74 | script/create-vcpkg.py | python | to_ref | ( version ) | return cfg_ref_prefix + version | Add prefix to version/tag, like v1.2.3 | Add prefix to version/tag, like v1.2.3 | [
"Add",
"prefix",
"to",
"version",
"/",
"tag",
"like",
"v1",
".",
"2",
".",
"3"
] | def to_ref( version ):
"""Add prefix to version/tag, like v1.2.3"""
return cfg_ref_prefix + version | [
"def",
"to_ref",
"(",
"version",
")",
":",
"return",
"cfg_ref_prefix",
"+",
"version"
] | https://github.com/martinmoene/span-lite/blob/8f7935ff4e502ee023990d356d6578b8293eda74/script/create-vcpkg.py#L110-L112 | |
catboost/catboost | 167f64f237114a4d10b2b4ee42adb4569137debe | contrib/python/jedi/jedi/evaluate/context/iterable.py | python | SequenceLiteralContext.exact_key_items | (self) | Returns a generator of tuples like dict.items(), where the key is
resolved (as a string) and the values are still lazy contexts. | Returns a generator of tuples like dict.items(), where the key is
resolved (as a string) and the values are still lazy contexts. | [
"Returns",
"a",
"generator",
"of",
"tuples",
"like",
"dict",
".",
"items",
"()",
"where",
"the",
"key",
"is",
"resolved",
"(",
"as",
"a",
"string",
")",
"and",
"the",
"values",
"are",
"still",
"lazy",
"contexts",
"."
] | def exact_key_items(self):
"""
Returns a generator of tuples like dict.items(), where the key is
resolved (as a string) and the values are still lazy contexts.
"""
for key_node, value in self._items():
for key in self._defining_context.eval_node(key_node):
... | [
"def",
"exact_key_items",
"(",
"self",
")",
":",
"for",
"key_node",
",",
"value",
"in",
"self",
".",
"_items",
"(",
")",
":",
"for",
"key",
"in",
"self",
".",
"_defining_context",
".",
"eval_node",
"(",
"key_node",
")",
":",
"if",
"is_string",
"(",
"ke... | https://github.com/catboost/catboost/blob/167f64f237114a4d10b2b4ee42adb4569137debe/contrib/python/jedi/jedi/evaluate/context/iterable.py#L388-L396 | ||
wxWidgets/wxPython-Classic | 19571e1ae65f1ac445f5491474121998c97a1bf0 | wx/tools/Editra/plugins/PyShell/PyShell/__init__.py | python | PyShell.CreateItem | (self, parent) | return EdPyShellBox(parent) | Returns a PyShell Panel | Returns a PyShell Panel | [
"Returns",
"a",
"PyShell",
"Panel"
] | def CreateItem(self, parent):
"""Returns a PyShell Panel"""
util.Log("[PyShell][info] Creating PyShell instance for Shelf")
return EdPyShellBox(parent) | [
"def",
"CreateItem",
"(",
"self",
",",
"parent",
")",
":",
"util",
".",
"Log",
"(",
"\"[PyShell][info] Creating PyShell instance for Shelf\"",
")",
"return",
"EdPyShellBox",
"(",
"parent",
")"
] | https://github.com/wxWidgets/wxPython-Classic/blob/19571e1ae65f1ac445f5491474121998c97a1bf0/wx/tools/Editra/plugins/PyShell/PyShell/__init__.py#L50-L53 | |
LiquidPlayer/LiquidCore | 9405979363f2353ac9a71ad8ab59685dd7f919c9 | deps/boost_1_66_0/libs/metaparse/tools/benchmark/benchmark.py | python | byte_to_gb | (byte) | return byte / (1024.0 * 1024 * 1024) | Convert bytes to GB | Convert bytes to GB | [
"Convert",
"bytes",
"to",
"GB"
] | def byte_to_gb(byte):
"""Convert bytes to GB"""
return byte / (1024.0 * 1024 * 1024) | [
"def",
"byte_to_gb",
"(",
"byte",
")",
":",
"return",
"byte",
"/",
"(",
"1024.0",
"*",
"1024",
"*",
"1024",
")"
] | https://github.com/LiquidPlayer/LiquidCore/blob/9405979363f2353ac9a71ad8ab59685dd7f919c9/deps/boost_1_66_0/libs/metaparse/tools/benchmark/benchmark.py#L210-L212 | |
livecode/livecode | 4606a10ea10b16d5071d0f9f263ccdd7ede8b31d | gyp/pylib/gyp/win_tool.py | python | WinTool.ExecClCompile | (self, project_dir, selected_files) | return subprocess.call(cmd, shell=True, cwd=BASE_DIR) | Executed by msvs-ninja projects when the 'ClCompile' target is used to
build selected C/C++ files. | Executed by msvs-ninja projects when the 'ClCompile' target is used to
build selected C/C++ files. | [
"Executed",
"by",
"msvs",
"-",
"ninja",
"projects",
"when",
"the",
"ClCompile",
"target",
"is",
"used",
"to",
"build",
"selected",
"C",
"/",
"C",
"++",
"files",
"."
] | def ExecClCompile(self, project_dir, selected_files):
"""Executed by msvs-ninja projects when the 'ClCompile' target is used to
build selected C/C++ files."""
project_dir = os.path.relpath(project_dir, BASE_DIR)
selected_files = selected_files.split(';')
ninja_targets = [os.path.join(project_dir, fi... | [
"def",
"ExecClCompile",
"(",
"self",
",",
"project_dir",
",",
"selected_files",
")",
":",
"project_dir",
"=",
"os",
".",
"path",
".",
"relpath",
"(",
"project_dir",
",",
"BASE_DIR",
")",
"selected_files",
"=",
"selected_files",
".",
"split",
"(",
"';'",
")",... | https://github.com/livecode/livecode/blob/4606a10ea10b16d5071d0f9f263ccdd7ede8b31d/gyp/pylib/gyp/win_tool.py#L300-L309 | |
BlzFans/wke | b0fa21158312e40c5fbd84682d643022b6c34a93 | cygwin/lib/python2.6/logging/handlers.py | python | SocketHandler.__init__ | (self, host, port) | Initializes the handler with a specific host address and port.
The attribute 'closeOnError' is set to 1 - which means that if
a socket error occurs, the socket is silently closed and then
reopened on the next logging call. | Initializes the handler with a specific host address and port. | [
"Initializes",
"the",
"handler",
"with",
"a",
"specific",
"host",
"address",
"and",
"port",
"."
] | def __init__(self, host, port):
"""
Initializes the handler with a specific host address and port.
The attribute 'closeOnError' is set to 1 - which means that if
a socket error occurs, the socket is silently closed and then
reopened on the next logging call.
"""
... | [
"def",
"__init__",
"(",
"self",
",",
"host",
",",
"port",
")",
":",
"logging",
".",
"Handler",
".",
"__init__",
"(",
"self",
")",
"self",
".",
"host",
"=",
"host",
"self",
".",
"port",
"=",
"port",
"self",
".",
"sock",
"=",
"None",
"self",
".",
"... | https://github.com/BlzFans/wke/blob/b0fa21158312e40c5fbd84682d643022b6c34a93/cygwin/lib/python2.6/logging/handlers.py#L415-L434 | ||
miyosuda/TensorFlowAndroidDemo | 35903e0221aa5f109ea2dbef27f20b52e317f42d | jni-build/jni/include/tensorflow/contrib/layers/python/layers/regularizers.py | python | l1_l2_regularizer | (scale_l1=1.0, scale_l2=1.0, scope=None) | return sum_regularizer([l1_regularizer(scale_l1),
l2_regularizer(scale_l2)],
scope=scope) | Returns a function that can be used to apply L1 L2 regularizations.
Args:
scale_l1: A scalar multiplier `Tensor` for L1 regularization.
scale_l2: A scalar multiplier `Tensor` for L2 regularization.
scope: An optional op_scope name.
Returns:
A function with signature `l1_l2(weights)` that applies a... | Returns a function that can be used to apply L1 L2 regularizations. | [
"Returns",
"a",
"function",
"that",
"can",
"be",
"used",
"to",
"apply",
"L1",
"L2",
"regularizations",
"."
] | def l1_l2_regularizer(scale_l1=1.0, scale_l2=1.0, scope=None):
"""Returns a function that can be used to apply L1 L2 regularizations.
Args:
scale_l1: A scalar multiplier `Tensor` for L1 regularization.
scale_l2: A scalar multiplier `Tensor` for L2 regularization.
scope: An optional op_scope name.
Re... | [
"def",
"l1_l2_regularizer",
"(",
"scale_l1",
"=",
"1.0",
",",
"scale_l2",
"=",
"1.0",
",",
"scope",
"=",
"None",
")",
":",
"scope",
"=",
"scope",
"or",
"'l1_l2_regularizer'",
"return",
"sum_regularizer",
"(",
"[",
"l1_regularizer",
"(",
"scale_l1",
")",
",",... | https://github.com/miyosuda/TensorFlowAndroidDemo/blob/35903e0221aa5f109ea2dbef27f20b52e317f42d/jni-build/jni/include/tensorflow/contrib/layers/python/layers/regularizers.py#L111-L129 | |
tensorflow/minigo | 6d89c202cdceaf449aefc3149ab2110d44f1a6a4 | strategies.py | python | MCTSPlayer.suggest_move | (self, position) | return self.pick_move() | Used for playing a single game.
For parallel play, use initialize_move, select_leaf,
incorporate_results, and pick_move | Used for playing a single game. | [
"Used",
"for",
"playing",
"a",
"single",
"game",
"."
] | def suggest_move(self, position):
"""Used for playing a single game.
For parallel play, use initialize_move, select_leaf,
incorporate_results, and pick_move
"""
start = time.time()
if self.timed_match:
while time.time() - start < self.seconds_per_move:
... | [
"def",
"suggest_move",
"(",
"self",
",",
"position",
")",
":",
"start",
"=",
"time",
".",
"time",
"(",
")",
"if",
"self",
".",
"timed_match",
":",
"while",
"time",
".",
"time",
"(",
")",
"-",
"start",
"<",
"self",
".",
"seconds_per_move",
":",
"self"... | https://github.com/tensorflow/minigo/blob/6d89c202cdceaf449aefc3149ab2110d44f1a6a4/strategies.py#L123-L149 | |
eclipse/sumo | 7132a9b8b6eea734bdec38479026b4d8c4336d03 | tools/sumolib/net/__init__.py | python | Net.getBBoxXY | (self) | return [(self._ranges[0][0], self._ranges[1][0]),
(self._ranges[0][1], self._ranges[1][1])] | Get the bounding box (bottom left and top right coordinates) for a net;
Coordinates are in X and Y (not Lat and Lon)
:return [(bottom_left_X, bottom_left_Y), (top_right_X, top_right_Y)] | Get the bounding box (bottom left and top right coordinates) for a net;
Coordinates are in X and Y (not Lat and Lon) | [
"Get",
"the",
"bounding",
"box",
"(",
"bottom",
"left",
"and",
"top",
"right",
"coordinates",
")",
"for",
"a",
"net",
";",
"Coordinates",
"are",
"in",
"X",
"and",
"Y",
"(",
"not",
"Lat",
"and",
"Lon",
")"
] | def getBBoxXY(self):
"""
Get the bounding box (bottom left and top right coordinates) for a net;
Coordinates are in X and Y (not Lat and Lon)
:return [(bottom_left_X, bottom_left_Y), (top_right_X, top_right_Y)]
"""
return [(self._ranges[0][0], self._ranges[1][0]),
... | [
"def",
"getBBoxXY",
"(",
"self",
")",
":",
"return",
"[",
"(",
"self",
".",
"_ranges",
"[",
"0",
"]",
"[",
"0",
"]",
",",
"self",
".",
"_ranges",
"[",
"1",
"]",
"[",
"0",
"]",
")",
",",
"(",
"self",
".",
"_ranges",
"[",
"0",
"]",
"[",
"1",
... | https://github.com/eclipse/sumo/blob/7132a9b8b6eea734bdec38479026b4d8c4336d03/tools/sumolib/net/__init__.py#L432-L440 | |
wlanjie/AndroidFFmpeg | 7baf9122f4b8e1c74e7baf4be5c422c7a5ba5aaf | tools/fdk-aac-build/armeabi-v7a/toolchain/lib/python2.7/distutils/command/config.py | python | config.search_cpp | (self, pattern, body=None, headers=None, include_dirs=None,
lang="c") | return match | Construct a source file (just like 'try_cpp()'), run it through
the preprocessor, and return true if any line of the output matches
'pattern'. 'pattern' should either be a compiled regex object or a
string containing a regex. If both 'body' and 'headers' are None,
preprocesses an empty... | Construct a source file (just like 'try_cpp()'), run it through
the preprocessor, and return true if any line of the output matches
'pattern'. 'pattern' should either be a compiled regex object or a
string containing a regex. If both 'body' and 'headers' are None,
preprocesses an empty... | [
"Construct",
"a",
"source",
"file",
"(",
"just",
"like",
"try_cpp",
"()",
")",
"run",
"it",
"through",
"the",
"preprocessor",
"and",
"return",
"true",
"if",
"any",
"line",
"of",
"the",
"output",
"matches",
"pattern",
".",
"pattern",
"should",
"either",
"be... | def search_cpp(self, pattern, body=None, headers=None, include_dirs=None,
lang="c"):
"""Construct a source file (just like 'try_cpp()'), run it through
the preprocessor, and return true if any line of the output matches
'pattern'. 'pattern' should either be a compiled regex o... | [
"def",
"search_cpp",
"(",
"self",
",",
"pattern",
",",
"body",
"=",
"None",
",",
"headers",
"=",
"None",
",",
"include_dirs",
"=",
"None",
",",
"lang",
"=",
"\"c\"",
")",
":",
"self",
".",
"_check_compiler",
"(",
")",
"src",
",",
"out",
"=",
"self",
... | https://github.com/wlanjie/AndroidFFmpeg/blob/7baf9122f4b8e1c74e7baf4be5c422c7a5ba5aaf/tools/fdk-aac-build/armeabi-v7a/toolchain/lib/python2.7/distutils/command/config.py#L196-L223 | |
wxWidgets/wxPython-Classic | 19571e1ae65f1ac445f5491474121998c97a1bf0 | wx/lib/agw/customtreectrl.py | python | CustomTreeCtrl.FillArray | (self, item, array=[]) | return array | Internal function. Used to populate an array of selected items when
the style ``TR_MULTIPLE`` is used.
:param `item`: an instance of :class:`GenericTreeItem`;
:param list `array`: a Python list containing the selected items.
:return: A Python list containing the selected items. | Internal function. Used to populate an array of selected items when
the style ``TR_MULTIPLE`` is used. | [
"Internal",
"function",
".",
"Used",
"to",
"populate",
"an",
"array",
"of",
"selected",
"items",
"when",
"the",
"style",
"TR_MULTIPLE",
"is",
"used",
"."
] | def FillArray(self, item, array=[]):
"""
Internal function. Used to populate an array of selected items when
the style ``TR_MULTIPLE`` is used.
:param `item`: an instance of :class:`GenericTreeItem`;
:param list `array`: a Python list containing the selected items.
:ret... | [
"def",
"FillArray",
"(",
"self",
",",
"item",
",",
"array",
"=",
"[",
"]",
")",
":",
"if",
"not",
"array",
":",
"array",
"=",
"[",
"]",
"if",
"item",
".",
"IsSelected",
"(",
")",
":",
"array",
".",
"append",
"(",
"item",
")",
"if",
"item",
".",... | https://github.com/wxWidgets/wxPython-Classic/blob/19571e1ae65f1ac445f5491474121998c97a1bf0/wx/lib/agw/customtreectrl.py#L5768-L5789 | |
wxWidgets/wxPython-Classic | 19571e1ae65f1ac445f5491474121998c97a1bf0 | src/msw/_core.py | python | MouseState.SetMiddleDown | (*args, **kwargs) | return _core_.MouseState_SetMiddleDown(*args, **kwargs) | SetMiddleDown(self, bool down) | SetMiddleDown(self, bool down) | [
"SetMiddleDown",
"(",
"self",
"bool",
"down",
")"
] | def SetMiddleDown(*args, **kwargs):
"""SetMiddleDown(self, bool down)"""
return _core_.MouseState_SetMiddleDown(*args, **kwargs) | [
"def",
"SetMiddleDown",
"(",
"*",
"args",
",",
"*",
"*",
"kwargs",
")",
":",
"return",
"_core_",
".",
"MouseState_SetMiddleDown",
"(",
"*",
"args",
",",
"*",
"*",
"kwargs",
")"
] | https://github.com/wxWidgets/wxPython-Classic/blob/19571e1ae65f1ac445f5491474121998c97a1bf0/src/msw/_core.py#L4498-L4500 | |
y123456yz/reading-and-annotate-mongodb-3.6 | 93280293672ca7586dc24af18132aa61e4ed7fcf | mongo/src/third_party/scons-2.5.0/scons-local-2.5.0/SCons/Environment.py | python | SubstitutionEnvironment.subst | (self, string, raw=0, target=None, source=None, conv=None, executor=None) | return SCons.Subst.scons_subst(string, self, raw, target, source, gvars, lvars, conv) | Recursively interpolates construction variables from the
Environment into the specified string, returning the expanded
result. Construction variables are specified by a $ prefix
in the string and begin with an initial underscore or
alphabetic character followed by any number of undersco... | Recursively interpolates construction variables from the
Environment into the specified string, returning the expanded
result. Construction variables are specified by a $ prefix
in the string and begin with an initial underscore or
alphabetic character followed by any number of undersco... | [
"Recursively",
"interpolates",
"construction",
"variables",
"from",
"the",
"Environment",
"into",
"the",
"specified",
"string",
"returning",
"the",
"expanded",
"result",
".",
"Construction",
"variables",
"are",
"specified",
"by",
"a",
"$",
"prefix",
"in",
"the",
"... | def subst(self, string, raw=0, target=None, source=None, conv=None, executor=None):
"""Recursively interpolates construction variables from the
Environment into the specified string, returning the expanded
result. Construction variables are specified by a $ prefix
in the string and begi... | [
"def",
"subst",
"(",
"self",
",",
"string",
",",
"raw",
"=",
"0",
",",
"target",
"=",
"None",
",",
"source",
"=",
"None",
",",
"conv",
"=",
"None",
",",
"executor",
"=",
"None",
")",
":",
"gvars",
"=",
"self",
".",
"gvars",
"(",
")",
"lvars",
"... | https://github.com/y123456yz/reading-and-annotate-mongodb-3.6/blob/93280293672ca7586dc24af18132aa61e4ed7fcf/mongo/src/third_party/scons-2.5.0/scons-local-2.5.0/SCons/Environment.py#L499-L514 | |
google/fhir | d77f57706c1a168529b0b87ca7ccb1c0113e83c2 | py/google/fhir/utils/fhir_types.py | python | is_type_or_profile_of_patient | (
message_or_descriptor: annotation_utils.MessageOrDescriptorBase) | return is_type_or_profile_of(_PATIENT_STRUCTURE_DEFINITION_URL,
message_or_descriptor) | Returns True if message_or_descriptor is type or a profile of Patient. | Returns True if message_or_descriptor is type or a profile of Patient. | [
"Returns",
"True",
"if",
"message_or_descriptor",
"is",
"type",
"or",
"a",
"profile",
"of",
"Patient",
"."
] | def is_type_or_profile_of_patient(
message_or_descriptor: annotation_utils.MessageOrDescriptorBase) -> bool:
"""Returns True if message_or_descriptor is type or a profile of Patient."""
return is_type_or_profile_of(_PATIENT_STRUCTURE_DEFINITION_URL,
message_or_descriptor) | [
"def",
"is_type_or_profile_of_patient",
"(",
"message_or_descriptor",
":",
"annotation_utils",
".",
"MessageOrDescriptorBase",
")",
"->",
"bool",
":",
"return",
"is_type_or_profile_of",
"(",
"_PATIENT_STRUCTURE_DEFINITION_URL",
",",
"message_or_descriptor",
")"
] | https://github.com/google/fhir/blob/d77f57706c1a168529b0b87ca7ccb1c0113e83c2/py/google/fhir/utils/fhir_types.py#L151-L155 | |
tensorflow/tensorflow | 419e3a6b650ea4bd1b0cba23c4348f8a69f3272e | tensorflow/python/distribute/sharded_variable.py | python | ShardedVariableMixin.scatter_mul | (self, sparse_delta, use_locking=False, name=None) | return self | Implements tf.Variable.scatter_mul. | Implements tf.Variable.scatter_mul. | [
"Implements",
"tf",
".",
"Variable",
".",
"scatter_mul",
"."
] | def scatter_mul(self, sparse_delta, use_locking=False, name=None):
"""Implements tf.Variable.scatter_mul."""
per_var_sparse_delta = self._decompose_indexed_slices(sparse_delta)
for i, v in enumerate(self._variables):
new_name = None
if name is not None:
new_name = '{}/part_{}'.format(nam... | [
"def",
"scatter_mul",
"(",
"self",
",",
"sparse_delta",
",",
"use_locking",
"=",
"False",
",",
"name",
"=",
"None",
")",
":",
"per_var_sparse_delta",
"=",
"self",
".",
"_decompose_indexed_slices",
"(",
"sparse_delta",
")",
"for",
"i",
",",
"v",
"in",
"enumer... | https://github.com/tensorflow/tensorflow/blob/419e3a6b650ea4bd1b0cba23c4348f8a69f3272e/tensorflow/python/distribute/sharded_variable.py#L647-L655 | |
herbstluftwm/herbstluftwm | 23ef0274bd4d317208eae5fea72b21478a71431b | doc/gendoc.py | python | TokTreeInfoExtrator.inside_class_definition | (self, toktreelist, classname) | go on parsing inside the body of a class | go on parsing inside the body of a class | [
"go",
"on",
"parsing",
"inside",
"the",
"body",
"of",
"a",
"class"
] | def inside_class_definition(self, toktreelist, classname):
"""
go on parsing inside the body of a class
"""
pub_priv_prot_re = re.compile('public|private|protected')
stream = TokenStream(toktreelist)
attr_cls_re = re.compile('^(Dyn|)Attribute(Proxy|)_$')
attribute... | [
"def",
"inside_class_definition",
"(",
"self",
",",
"toktreelist",
",",
"classname",
")",
":",
"pub_priv_prot_re",
"=",
"re",
".",
"compile",
"(",
"'public|private|protected'",
")",
"stream",
"=",
"TokenStream",
"(",
"toktreelist",
")",
"attr_cls_re",
"=",
"re",
... | https://github.com/herbstluftwm/herbstluftwm/blob/23ef0274bd4d317208eae5fea72b21478a71431b/doc/gendoc.py#L668-L731 | ||
wxWidgets/wxPython-Classic | 19571e1ae65f1ac445f5491474121998c97a1bf0 | src/gtk/_gdi.py | python | GraphicsRenderer.CreatePen | (*args, **kwargs) | return _gdi_.GraphicsRenderer_CreatePen(*args, **kwargs) | CreatePen(self, Pen pen) -> GraphicsPen | CreatePen(self, Pen pen) -> GraphicsPen | [
"CreatePen",
"(",
"self",
"Pen",
"pen",
")",
"-",
">",
"GraphicsPen"
] | def CreatePen(*args, **kwargs):
"""CreatePen(self, Pen pen) -> GraphicsPen"""
return _gdi_.GraphicsRenderer_CreatePen(*args, **kwargs) | [
"def",
"CreatePen",
"(",
"*",
"args",
",",
"*",
"*",
"kwargs",
")",
":",
"return",
"_gdi_",
".",
"GraphicsRenderer_CreatePen",
"(",
"*",
"args",
",",
"*",
"*",
"kwargs",
")"
] | https://github.com/wxWidgets/wxPython-Classic/blob/19571e1ae65f1ac445f5491474121998c97a1bf0/src/gtk/_gdi.py#L6600-L6602 | |
KhronosGroup/SPIRV-LLVM | 1eb85593f3fe2c39379b9a9b088d51eda4f42b8b | utils/llvm-build/llvmbuild/main.py | python | cmake_quote_path | (value) | return value | cmake_quote_path(value) -> str
Return a quoted form of the given value that is suitable for use in CMake
language files. | cmake_quote_path(value) -> str | [
"cmake_quote_path",
"(",
"value",
")",
"-",
">",
"str"
] | def cmake_quote_path(value):
"""
cmake_quote_path(value) -> str
Return a quoted form of the given value that is suitable for use in CMake
language files.
"""
# CMake has a bug in it's Makefile generator that doesn't properly quote
# strings it generates. So instead of using proper quoting,... | [
"def",
"cmake_quote_path",
"(",
"value",
")",
":",
"# CMake has a bug in it's Makefile generator that doesn't properly quote",
"# strings it generates. So instead of using proper quoting, we just use \"/\"",
"# style paths. Currently, we only handle escaping backslashes.",
"value",
"=",
"valu... | https://github.com/KhronosGroup/SPIRV-LLVM/blob/1eb85593f3fe2c39379b9a9b088d51eda4f42b8b/utils/llvm-build/llvmbuild/main.py#L26-L39 | |
mindspore-ai/mindspore | fb8fd3338605bb34fa5cea054e535a8b1d753fab | mindspore/python/mindspore/numpy/math_ops.py | python | _get_strides | (dims, order='C') | return P.Concat(0)(tup) | Generates strides (1-D tensor) according to `dims` (1-D tensor). | Generates strides (1-D tensor) according to `dims` (1-D tensor). | [
"Generates",
"strides",
"(",
"1",
"-",
"D",
"tensor",
")",
"according",
"to",
"dims",
"(",
"1",
"-",
"D",
"tensor",
")",
"."
] | def _get_strides(dims, order='C'):
"""Generates strides (1-D tensor) according to `dims` (1-D tensor)."""
if order not in ['C', 'F']:
_raise_value_error("invalid order. Expected 'C' or 'F'")
tup = (_to_tensor([1]),)
dims = dims[1:][::-1] if order == 'C' else dims[:-1]
for d in dims:
... | [
"def",
"_get_strides",
"(",
"dims",
",",
"order",
"=",
"'C'",
")",
":",
"if",
"order",
"not",
"in",
"[",
"'C'",
",",
"'F'",
"]",
":",
"_raise_value_error",
"(",
"\"invalid order. Expected 'C' or 'F'\"",
")",
"tup",
"=",
"(",
"_to_tensor",
"(",
"[",
"1",
... | https://github.com/mindspore-ai/mindspore/blob/fb8fd3338605bb34fa5cea054e535a8b1d753fab/mindspore/python/mindspore/numpy/math_ops.py#L5440-L5452 | |
adobe/chromium | cfe5bf0b51b1f6b9fe239c2a3c2f2364da9967d7 | chrome/tools/build/version.py | python | write_if_changed | (file_name, contents) | Writes the specified contents to the specified file_name
iff the contents are different than the current contents. | Writes the specified contents to the specified file_name
iff the contents are different than the current contents. | [
"Writes",
"the",
"specified",
"contents",
"to",
"the",
"specified",
"file_name",
"iff",
"the",
"contents",
"are",
"different",
"than",
"the",
"current",
"contents",
"."
] | def write_if_changed(file_name, contents):
"""
Writes the specified contents to the specified file_name
iff the contents are different than the current contents.
"""
try:
old_contents = open(file_name, 'r').read()
except EnvironmentError:
pass
else:
if contents == old_contents:
return
... | [
"def",
"write_if_changed",
"(",
"file_name",
",",
"contents",
")",
":",
"try",
":",
"old_contents",
"=",
"open",
"(",
"file_name",
",",
"'r'",
")",
".",
"read",
"(",
")",
"except",
"EnvironmentError",
":",
"pass",
"else",
":",
"if",
"contents",
"==",
"ol... | https://github.com/adobe/chromium/blob/cfe5bf0b51b1f6b9fe239c2a3c2f2364da9967d7/chrome/tools/build/version.py#L91-L104 | ||
google/iree | 1224bbdbe65b0d1fdf40e7324f60f68beeaf7c76 | build_tools/benchmarks/post_benchmarks_as_pr_comment.py | python | get_previous_comment_on_pr | (pr_number: str,
verbose: bool = False) | return None | Gets the previous comment's ID from GitHub. | Gets the previous comment's ID from GitHub. | [
"Gets",
"the",
"previous",
"comment",
"s",
"ID",
"from",
"GitHub",
"."
] | def get_previous_comment_on_pr(pr_number: str,
verbose: bool = False) -> Optional[int]:
"""Gets the previous comment's ID from GitHub."""
# Increasing per_page limit requires user authentication.
api_token = get_required_env_var('GITHUB_TOKEN')
headers = {
"Accept": "applica... | [
"def",
"get_previous_comment_on_pr",
"(",
"pr_number",
":",
"str",
",",
"verbose",
":",
"bool",
"=",
"False",
")",
"->",
"Optional",
"[",
"int",
"]",
":",
"# Increasing per_page limit requires user authentication.",
"api_token",
"=",
"get_required_env_var",
"(",
"'GIT... | https://github.com/google/iree/blob/1224bbdbe65b0d1fdf40e7324f60f68beeaf7c76/build_tools/benchmarks/post_benchmarks_as_pr_comment.py#L222-L250 | |
wxWidgets/wxPython-Classic | 19571e1ae65f1ac445f5491474121998c97a1bf0 | wx/lib/agw/aui/auibar.py | python | AuiDefaultToolBarArt.GetOrientation | (self) | return self._orientation | Returns the toolbar orientation. | Returns the toolbar orientation. | [
"Returns",
"the",
"toolbar",
"orientation",
"."
] | def GetOrientation(self):
""" Returns the toolbar orientation. """
return self._orientation | [
"def",
"GetOrientation",
"(",
"self",
")",
":",
"return",
"self",
".",
"_orientation"
] | https://github.com/wxWidgets/wxPython-Classic/blob/19571e1ae65f1ac445f5491474121998c97a1bf0/wx/lib/agw/aui/auibar.py#L883-L886 | |
aws/lumberyard | f85344403c1c2e77ec8c75deb2c116e97b713217 | dev/Tools/Python/3.7.10/linux_x64/lib/python3.7/_pydecimal.py | python | Context.divide | (self, a, b) | Decimal division in a specified context.
>>> ExtendedContext.divide(Decimal('1'), Decimal('3'))
Decimal('0.333333333')
>>> ExtendedContext.divide(Decimal('2'), Decimal('3'))
Decimal('0.666666667')
>>> ExtendedContext.divide(Decimal('5'), Decimal('2'))
Decimal('2.5')
... | Decimal division in a specified context. | [
"Decimal",
"division",
"in",
"a",
"specified",
"context",
"."
] | def divide(self, a, b):
"""Decimal division in a specified context.
>>> ExtendedContext.divide(Decimal('1'), Decimal('3'))
Decimal('0.333333333')
>>> ExtendedContext.divide(Decimal('2'), Decimal('3'))
Decimal('0.666666667')
>>> ExtendedContext.divide(Decimal('5'), Decima... | [
"def",
"divide",
"(",
"self",
",",
"a",
",",
"b",
")",
":",
"a",
"=",
"_convert_other",
"(",
"a",
",",
"raiseit",
"=",
"True",
")",
"r",
"=",
"a",
".",
"__truediv__",
"(",
"b",
",",
"context",
"=",
"self",
")",
"if",
"r",
"is",
"NotImplemented",
... | https://github.com/aws/lumberyard/blob/f85344403c1c2e77ec8c75deb2c116e97b713217/dev/Tools/Python/3.7.10/linux_x64/lib/python3.7/_pydecimal.py#L4358-L4393 | ||
apache/openoffice | 97289b2620590d8b431bcc408f87252db6203818 | main/pyuno/source/module/uno.py | python | absolutize | ( path, relativeUrl ) | return pyuno.absolutize( path, relativeUrl ) | returns an absolute file url from the given urls | returns an absolute file url from the given urls | [
"returns",
"an",
"absolute",
"file",
"url",
"from",
"the",
"given",
"urls"
] | def absolutize( path, relativeUrl ):
"returns an absolute file url from the given urls"
return pyuno.absolutize( path, relativeUrl ) | [
"def",
"absolutize",
"(",
"path",
",",
"relativeUrl",
")",
":",
"return",
"pyuno",
".",
"absolutize",
"(",
"path",
",",
"relativeUrl",
")"
] | https://github.com/apache/openoffice/blob/97289b2620590d8b431bcc408f87252db6203818/main/pyuno/source/module/uno.py#L94-L96 | |
y123456yz/reading-and-annotate-mongodb-3.6 | 93280293672ca7586dc24af18132aa61e4ed7fcf | mongo/buildscripts/idl/idl/parser.py | python | _parse_chained_type | (ctxt, name, node) | return chain | Parse a chained type in a struct in the IDL file. | Parse a chained type in a struct in the IDL file. | [
"Parse",
"a",
"chained",
"type",
"in",
"a",
"struct",
"in",
"the",
"IDL",
"file",
"."
] | def _parse_chained_type(ctxt, name, node):
# type: (errors.ParserContext, str, yaml.nodes.MappingNode) -> syntax.ChainedType
"""Parse a chained type in a struct in the IDL file."""
chain = syntax.ChainedType(ctxt.file_name, node.start_mark.line, node.start_mark.column)
chain.name = name
_generic_pa... | [
"def",
"_parse_chained_type",
"(",
"ctxt",
",",
"name",
",",
"node",
")",
":",
"# type: (errors.ParserContext, str, yaml.nodes.MappingNode) -> syntax.ChainedType",
"chain",
"=",
"syntax",
".",
"ChainedType",
"(",
"ctxt",
".",
"file_name",
",",
"node",
".",
"start_mark",... | https://github.com/y123456yz/reading-and-annotate-mongodb-3.6/blob/93280293672ca7586dc24af18132aa61e4ed7fcf/mongo/buildscripts/idl/idl/parser.py#L236-L246 | |
catboost/catboost | 167f64f237114a4d10b2b4ee42adb4569137debe | contrib/tools/python/src/Lib/lib2to3/refactor.py | python | RefactoringTool.traverse_by | (self, fixers, traversal) | Traverse an AST, applying a set of fixers to each node.
This is a helper method for refactor_tree().
Args:
fixers: a list of fixer instances.
traversal: a generator that yields AST nodes.
Returns:
None | Traverse an AST, applying a set of fixers to each node. | [
"Traverse",
"an",
"AST",
"applying",
"a",
"set",
"of",
"fixers",
"to",
"each",
"node",
"."
] | def traverse_by(self, fixers, traversal):
"""Traverse an AST, applying a set of fixers to each node.
This is a helper method for refactor_tree().
Args:
fixers: a list of fixer instances.
traversal: a generator that yields AST nodes.
Returns:
None
... | [
"def",
"traverse_by",
"(",
"self",
",",
"fixers",
",",
"traversal",
")",
":",
"if",
"not",
"fixers",
":",
"return",
"for",
"node",
"in",
"traversal",
":",
"for",
"fixer",
"in",
"fixers",
"[",
"node",
".",
"type",
"]",
":",
"results",
"=",
"fixer",
".... | https://github.com/catboost/catboost/blob/167f64f237114a4d10b2b4ee42adb4569137debe/contrib/tools/python/src/Lib/lib2to3/refactor.py#L484-L505 | ||
catboost/catboost | 167f64f237114a4d10b2b4ee42adb4569137debe | catboost/python-package/catboost/core.py | python | CatBoost.fit | (self, X, y=None, cat_features=None, text_features=None, embedding_features=None, pairs=None, sample_weight=None, group_id=None,
group_weight=None, subgroup_id=None, pairs_weight=None, baseline=None, use_best_model=None,
eval_set=None, verbose=None, logging_level=None, plot=False, column_descrip... | return self._fit(X, y, cat_features, text_features, embedding_features, pairs, sample_weight, group_id, group_weight, subgroup_id,
pairs_weight, baseline, use_best_model, eval_set, verbose, logging_level, plot,
column_description, verbose_eval, metric_period, silent, ea... | Fit the CatBoost model.
Parameters
----------
X : catboost.Pool or list or numpy.ndarray or pandas.DataFrame or pandas.Series
or string.
If not catboost.Pool or catboost.FeaturesData it must be 2 dimensional Feature matrix
or string - file with dataset.
... | Fit the CatBoost model. | [
"Fit",
"the",
"CatBoost",
"model",
"."
] | def fit(self, X, y=None, cat_features=None, text_features=None, embedding_features=None, pairs=None, sample_weight=None, group_id=None,
group_weight=None, subgroup_id=None, pairs_weight=None, baseline=None, use_best_model=None,
eval_set=None, verbose=None, logging_level=None, plot=False, column_... | [
"def",
"fit",
"(",
"self",
",",
"X",
",",
"y",
"=",
"None",
",",
"cat_features",
"=",
"None",
",",
"text_features",
"=",
"None",
",",
"embedding_features",
"=",
"None",
",",
"pairs",
"=",
"None",
",",
"sample_weight",
"=",
"None",
",",
"group_id",
"=",... | https://github.com/catboost/catboost/blob/167f64f237114a4d10b2b4ee42adb4569137debe/catboost/python-package/catboost/core.py#L2216-L2344 | |
google/llvm-propeller | 45c226984fe8377ebfb2ad7713c680d652ba678d | libcxx/utils/libcxx/sym_check/extract.py | python | extract_symbols | (lib_file, static_lib=None) | return extractor.extract(lib_file) | Extract and return a list of symbols extracted from a static or dynamic
library. The symbols are extracted using NM or readelf. They are then
filtered and formated. Finally they symbols are made unique. | Extract and return a list of symbols extracted from a static or dynamic
library. The symbols are extracted using NM or readelf. They are then
filtered and formated. Finally they symbols are made unique. | [
"Extract",
"and",
"return",
"a",
"list",
"of",
"symbols",
"extracted",
"from",
"a",
"static",
"or",
"dynamic",
"library",
".",
"The",
"symbols",
"are",
"extracted",
"using",
"NM",
"or",
"readelf",
".",
"They",
"are",
"then",
"filtered",
"and",
"formated",
... | def extract_symbols(lib_file, static_lib=None):
"""
Extract and return a list of symbols extracted from a static or dynamic
library. The symbols are extracted using NM or readelf. They are then
filtered and formated. Finally they symbols are made unique.
"""
if static_lib is None:
_, ext... | [
"def",
"extract_symbols",
"(",
"lib_file",
",",
"static_lib",
"=",
"None",
")",
":",
"if",
"static_lib",
"is",
"None",
":",
"_",
",",
"ext",
"=",
"os",
".",
"path",
".",
"splitext",
"(",
"lib_file",
")",
"static_lib",
"=",
"True",
"if",
"ext",
"in",
... | https://github.com/google/llvm-propeller/blob/45c226984fe8377ebfb2ad7713c680d652ba678d/libcxx/utils/libcxx/sym_check/extract.py#L188-L201 | |
wenwei202/caffe | f54a74abaf6951d8485cbdcfa1d74a4c37839466 | scripts/cpp_lint.py | python | CheckSpacing | (filename, clean_lines, linenum, nesting_state, error) | Checks for the correctness of various spacing issues in the code.
Things we check for: spaces around operators, spaces after
if/for/while/switch, no spaces around parens in function calls, two
spaces between code and comment, don't start a block with a blank
line, don't end a function with a blank line, don't ... | Checks for the correctness of various spacing issues in the code. | [
"Checks",
"for",
"the",
"correctness",
"of",
"various",
"spacing",
"issues",
"in",
"the",
"code",
"."
] | def CheckSpacing(filename, clean_lines, linenum, nesting_state, error):
"""Checks for the correctness of various spacing issues in the code.
Things we check for: spaces around operators, spaces after
if/for/while/switch, no spaces around parens in function calls, two
spaces between code and comment, don't star... | [
"def",
"CheckSpacing",
"(",
"filename",
",",
"clean_lines",
",",
"linenum",
",",
"nesting_state",
",",
"error",
")",
":",
"# Don't use \"elided\" lines here, otherwise we can't check commented lines.",
"# Don't want to use \"raw\" either, because we don't want to check inside C++11",
... | https://github.com/wenwei202/caffe/blob/f54a74abaf6951d8485cbdcfa1d74a4c37839466/scripts/cpp_lint.py#L2643-L2988 | ||
wlanjie/AndroidFFmpeg | 7baf9122f4b8e1c74e7baf4be5c422c7a5ba5aaf | tools/fdk-aac-build/x86/toolchain/lib/python2.7/fractions.py | python | Fraction.__gt__ | (a, b) | return a._richcmp(b, operator.gt) | a > b | a > b | [
"a",
">",
"b"
] | def __gt__(a, b):
"""a > b"""
return a._richcmp(b, operator.gt) | [
"def",
"__gt__",
"(",
"a",
",",
"b",
")",
":",
"return",
"a",
".",
"_richcmp",
"(",
"b",
",",
"operator",
".",
"gt",
")"
] | https://github.com/wlanjie/AndroidFFmpeg/blob/7baf9122f4b8e1c74e7baf4be5c422c7a5ba5aaf/tools/fdk-aac-build/x86/toolchain/lib/python2.7/fractions.py#L576-L578 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.