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 |
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
glotzerlab/hoomd-blue | f7f97abfa3fcc2522fa8d458d65d0aeca7ba781a | hoomd/communicator.py | python | Communicator.barrier | (self) | Perform a barrier synchronization across all ranks in the partition.
Note:
Does nothing in builds with ENABLE_MPI=off. | Perform a barrier synchronization across all ranks in the partition. | [
"Perform",
"a",
"barrier",
"synchronization",
"across",
"all",
"ranks",
"in",
"the",
"partition",
"."
] | def barrier(self):
"""Perform a barrier synchronization across all ranks in the partition.
Note:
Does nothing in builds with ENABLE_MPI=off.
"""
if hoomd.version.mpi_enabled:
self.cpp_mpi_conf.barrier() | [
"def",
"barrier",
"(",
"self",
")",
":",
"if",
"hoomd",
".",
"version",
".",
"mpi_enabled",
":",
"self",
".",
"cpp_mpi_conf",
".",
"barrier",
"(",
")"
] | https://github.com/glotzerlab/hoomd-blue/blob/f7f97abfa3fcc2522fa8d458d65d0aeca7ba781a/hoomd/communicator.py#L154-L161 | ||
tensorflow/tensorflow | 419e3a6b650ea4bd1b0cba23c4348f8a69f3272e | tensorflow/python/distribute/values_util.py | python | is_saving_non_distributed | () | return (options.experimental_variable_policy !=
save_options.VariablePolicy.EXPAND_DISTRIBUTED_VARIABLES) | Returns whether we're saving a non-distributed version of the model.
It returns True iff we are in saving context and are saving a non-distributed
version of the model. That is, SaveOptions.experimental_variable_policy is
NONE.
Returns:
A boolean. | Returns whether we're saving a non-distributed version of the model. | [
"Returns",
"whether",
"we",
"re",
"saving",
"a",
"non",
"-",
"distributed",
"version",
"of",
"the",
"model",
"."
] | def is_saving_non_distributed():
"""Returns whether we're saving a non-distributed version of the model.
It returns True iff we are in saving context and are saving a non-distributed
version of the model. That is, SaveOptions.experimental_variable_policy is
NONE.
Returns:
A boolean.
"""
if not save_... | [
"def",
"is_saving_non_distributed",
"(",
")",
":",
"if",
"not",
"save_context",
".",
"in_save_context",
"(",
")",
":",
"return",
"False",
"options",
"=",
"save_context",
".",
"get_save_options",
"(",
")",
"return",
"(",
"options",
".",
"experimental_variable_polic... | https://github.com/tensorflow/tensorflow/blob/419e3a6b650ea4bd1b0cba23c4348f8a69f3272e/tensorflow/python/distribute/values_util.py#L355-L369 | |
OpenChemistry/tomviz | 0a903679318f191cb7dd3eb5ff5bc3a7d3320d9a | acquisition/tomviz/acquisition/__init__.py | python | AbstractSource.disconnect | (self, **params) | Disconnect from the source.
:param params: The disconnect parameters.
:type params: dict | Disconnect from the source. | [
"Disconnect",
"from",
"the",
"source",
"."
] | def disconnect(self, **params):
"""
Disconnect from the source.
:param params: The disconnect parameters.
:type params: dict
""" | [
"def",
"disconnect",
"(",
"self",
",",
"*",
"*",
"params",
")",
":"
] | https://github.com/OpenChemistry/tomviz/blob/0a903679318f191cb7dd3eb5ff5bc3a7d3320d9a/acquisition/tomviz/acquisition/__init__.py#L25-L31 | ||
simsong/bulk_extractor | 738911df22b7066ca9e1662f4131fb44090a4196 | python/dfxml.py | python | safe_b64decode | (b64data) | This function takes care of the logistics of base64 decoding XML data in Python 2 and 3.
Recall that Python3 requires b64decode operate on bytes, not a string.
Ref: <http://bugs.python.org/issue4769#msg115690>
A forum post that noted several encoding differences between Python 2 and 3:
<http://s... | This function takes care of the logistics of base64 decoding XML data in Python 2 and 3.
Recall that Python3 requires b64decode operate on bytes, not a string.
Ref: <http://bugs.python.org/issue4769#msg115690>
A forum post that noted several encoding differences between Python 2 and 3:
<http://s... | [
"This",
"function",
"takes",
"care",
"of",
"the",
"logistics",
"of",
"base64",
"decoding",
"XML",
"data",
"in",
"Python",
"2",
"and",
"3",
".",
"Recall",
"that",
"Python3",
"requires",
"b64decode",
"operate",
"on",
"bytes",
"not",
"a",
"string",
".",
"Ref"... | def safe_b64decode(b64data):
"""
This function takes care of the logistics of base64 decoding XML data in Python 2 and 3.
Recall that Python3 requires b64decode operate on bytes, not a string.
Ref: <http://bugs.python.org/issue4769#msg115690>
A forum post that noted several encoding differences ... | [
"def",
"safe_b64decode",
"(",
"b64data",
")",
":",
"if",
"sys",
".",
"version_info",
".",
"major",
"==",
"2",
":",
"return",
"base64",
".",
"b64decode",
"(",
"b64data",
")",
".",
"decode",
"(",
"\"unicode_escape\"",
")",
"elif",
"sys",
".",
"version_info",... | https://github.com/simsong/bulk_extractor/blob/738911df22b7066ca9e1662f4131fb44090a4196/python/dfxml.py#L1005-L1024 | ||
PaddlePaddle/Paddle | 1252f4bb3e574df80aa6d18c7ddae1b3a90bd81c | python/paddle/nn/functional/pooling.py | python | adaptive_avg_pool2d | (x, output_size, data_format='NCHW', name=None) | return pool_out | This API implements adaptive average pooling 2d operation.
See more details in :ref:`api_nn_pooling_AdaptiveAvgPool2d` .
Args:
x (Tensor): The input tensor of adaptive avg pool2d operator, which is a 4-D tensor.
The data type can be float32 or float64.
output_size (int... | This API implements adaptive average pooling 2d operation.
See more details in :ref:`api_nn_pooling_AdaptiveAvgPool2d` . | [
"This",
"API",
"implements",
"adaptive",
"average",
"pooling",
"2d",
"operation",
".",
"See",
"more",
"details",
"in",
":",
"ref",
":",
"api_nn_pooling_AdaptiveAvgPool2d",
"."
] | def adaptive_avg_pool2d(x, output_size, data_format='NCHW', name=None):
"""
This API implements adaptive average pooling 2d operation.
See more details in :ref:`api_nn_pooling_AdaptiveAvgPool2d` .
Args:
x (Tensor): The input tensor of adaptive avg pool2d operator, which is a 4-D tensor.
... | [
"def",
"adaptive_avg_pool2d",
"(",
"x",
",",
"output_size",
",",
"data_format",
"=",
"'NCHW'",
",",
"name",
"=",
"None",
")",
":",
"if",
"not",
"in_dygraph_mode",
"(",
")",
":",
"check_variable_and_dtype",
"(",
"x",
",",
"'x'",
",",
"[",
"'float16'",
",",
... | https://github.com/PaddlePaddle/Paddle/blob/1252f4bb3e574df80aa6d18c7ddae1b3a90bd81c/python/paddle/nn/functional/pooling.py#L1286-L1385 | |
OSGeo/gdal | 3748fc4ba4fba727492774b2b908a2130c864a83 | swig/python/osgeo/ogr.py | python | FeatureDefn.GetGeomFieldIndex | (self, *args) | return _ogr.FeatureDefn_GetGeomFieldIndex(self, *args) | r"""
GetGeomFieldIndex(FeatureDefn self, char const * field_name) -> int
int
OGR_FD_GetGeomFieldIndex(OGRFeatureDefnH hDefn, const char
*pszGeomFieldName)
Find geometry field by name.
The geometry field index of the first geometry field matching the
passed field... | r"""
GetGeomFieldIndex(FeatureDefn self, char const * field_name) -> int
int
OGR_FD_GetGeomFieldIndex(OGRFeatureDefnH hDefn, const char
*pszGeomFieldName) | [
"r",
"GetGeomFieldIndex",
"(",
"FeatureDefn",
"self",
"char",
"const",
"*",
"field_name",
")",
"-",
">",
"int",
"int",
"OGR_FD_GetGeomFieldIndex",
"(",
"OGRFeatureDefnH",
"hDefn",
"const",
"char",
"*",
"pszGeomFieldName",
")"
] | def GetGeomFieldIndex(self, *args):
r"""
GetGeomFieldIndex(FeatureDefn self, char const * field_name) -> int
int
OGR_FD_GetGeomFieldIndex(OGRFeatureDefnH hDefn, const char
*pszGeomFieldName)
Find geometry field by name.
The geometry field index of the first geom... | [
"def",
"GetGeomFieldIndex",
"(",
"self",
",",
"*",
"args",
")",
":",
"return",
"_ogr",
".",
"FeatureDefn_GetGeomFieldIndex",
"(",
"self",
",",
"*",
"args",
")"
] | https://github.com/OSGeo/gdal/blob/3748fc4ba4fba727492774b2b908a2130c864a83/swig/python/osgeo/ogr.py#L4658-L4682 | |
wxWidgets/wxPython-Classic | 19571e1ae65f1ac445f5491474121998c97a1bf0 | src/osx_carbon/_core.py | python | BookCtrlBase.ChangeSelection | (*args, **kwargs) | return _core_.BookCtrlBase_ChangeSelection(*args, **kwargs) | ChangeSelection(self, size_t n) -> int | ChangeSelection(self, size_t n) -> int | [
"ChangeSelection",
"(",
"self",
"size_t",
"n",
")",
"-",
">",
"int"
] | def ChangeSelection(*args, **kwargs):
"""ChangeSelection(self, size_t n) -> int"""
return _core_.BookCtrlBase_ChangeSelection(*args, **kwargs) | [
"def",
"ChangeSelection",
"(",
"*",
"args",
",",
"*",
"*",
"kwargs",
")",
":",
"return",
"_core_",
".",
"BookCtrlBase_ChangeSelection",
"(",
"*",
"args",
",",
"*",
"*",
"kwargs",
")"
] | https://github.com/wxWidgets/wxPython-Classic/blob/19571e1ae65f1ac445f5491474121998c97a1bf0/src/osx_carbon/_core.py#L13637-L13639 | |
windystrife/UnrealEngine_NVIDIAGameWorks | b50e6338a7c5b26374d66306ebc7807541ff815e | Engine/Extras/ThirdPartyNotUE/emsdk/Win64/python/2.7.5.3_64bit/Lib/codecs.py | python | StreamWriter.writelines | (self, list) | Writes the concatenated list of strings to the stream
using .write(). | Writes the concatenated list of strings to the stream
using .write(). | [
"Writes",
"the",
"concatenated",
"list",
"of",
"strings",
"to",
"the",
"stream",
"using",
".",
"write",
"()",
"."
] | def writelines(self, list):
""" Writes the concatenated list of strings to the stream
using .write().
"""
self.write(''.join(list)) | [
"def",
"writelines",
"(",
"self",
",",
"list",
")",
":",
"self",
".",
"write",
"(",
"''",
".",
"join",
"(",
"list",
")",
")"
] | https://github.com/windystrife/UnrealEngine_NVIDIAGameWorks/blob/b50e6338a7c5b26374d66306ebc7807541ff815e/Engine/Extras/ThirdPartyNotUE/emsdk/Win64/python/2.7.5.3_64bit/Lib/codecs.py#L354-L359 | ||
catboost/catboost | 167f64f237114a4d10b2b4ee42adb4569137debe | contrib/python/scipy/py3/scipy/sparse/base.py | python | spmatrix.setdiag | (self, values, k=0) | Set diagonal or off-diagonal elements of the array.
Parameters
----------
values : array_like
New values of the diagonal elements.
Values may have any length. If the diagonal is longer than values,
then the remaining diagonal entries will not be set. If va... | Set diagonal or off-diagonal elements of the array. | [
"Set",
"diagonal",
"or",
"off",
"-",
"diagonal",
"elements",
"of",
"the",
"array",
"."
] | def setdiag(self, values, k=0):
"""
Set diagonal or off-diagonal elements of the array.
Parameters
----------
values : array_like
New values of the diagonal elements.
Values may have any length. If the diagonal is longer than values,
then th... | [
"def",
"setdiag",
"(",
"self",
",",
"values",
",",
"k",
"=",
"0",
")",
":",
"M",
",",
"N",
"=",
"self",
".",
"shape",
"if",
"(",
"k",
">",
"0",
"and",
"k",
">=",
"N",
")",
"or",
"(",
"k",
"<",
"0",
"and",
"-",
"k",
">=",
"M",
")",
":",
... | https://github.com/catboost/catboost/blob/167f64f237114a4d10b2b4ee42adb4569137debe/contrib/python/scipy/py3/scipy/sparse/base.py#L1122-L1145 | ||
hanpfei/chromium-net | 392cc1fa3a8f92f42e4071ab6e674d8e0482f83f | third_party/catapult/telemetry/third_party/pyfakefs/pyfakefs/fake_filesystem.py | python | FakeOsModule.lstat | (self, entry_path) | Returns the os.stat-like tuple for entry_path, not following symlinks.
Args:
entry_path: path to filesystem object to retrieve
Returns:
the os.stat_result object corresponding to entry_path
Raises:
OSError: if the filesystem object doesn't exist. | Returns the os.stat-like tuple for entry_path, not following symlinks. | [
"Returns",
"the",
"os",
".",
"stat",
"-",
"like",
"tuple",
"for",
"entry_path",
"not",
"following",
"symlinks",
"."
] | def lstat(self, entry_path):
"""Returns the os.stat-like tuple for entry_path, not following symlinks.
Args:
entry_path: path to filesystem object to retrieve
Returns:
the os.stat_result object corresponding to entry_path
Raises:
OSError: if the filesystem object doesn't exist.
... | [
"def",
"lstat",
"(",
"self",
",",
"entry_path",
")",
":",
"# stat should return the tuple representing return value of os.stat",
"try",
":",
"stats",
"=",
"self",
".",
"filesystem",
".",
"LResolveObject",
"(",
"entry_path",
")",
"st_obj",
"=",
"os",
".",
"stat_resul... | https://github.com/hanpfei/chromium-net/blob/392cc1fa3a8f92f42e4071ab6e674d8e0482f83f/third_party/catapult/telemetry/third_party/pyfakefs/pyfakefs/fake_filesystem.py#L1505-L1526 | ||
miyosuda/TensorFlowAndroidDemo | 35903e0221aa5f109ea2dbef27f20b52e317f42d | jni-build/jni/include/tensorflow/python/ops/control_flow_ops.py | python | _MergeShape | (op) | Shape function for the Merge op.
The Merge op takes many inputs of arbitrary shapes, and produces a
first output that is one of those inputs, and a second scalar
output.
If all input shapes are known and have the same rank, the output
shape must have that rank, otherwise the output shape is unknown.
Each ... | Shape function for the Merge op. | [
"Shape",
"function",
"for",
"the",
"Merge",
"op",
"."
] | def _MergeShape(op):
"""Shape function for the Merge op.
The Merge op takes many inputs of arbitrary shapes, and produces a
first output that is one of those inputs, and a second scalar
output.
If all input shapes are known and have the same rank, the output
shape must have that rank, otherwise the output... | [
"def",
"_MergeShape",
"(",
"op",
")",
":",
"output_shape",
"=",
"op",
".",
"inputs",
"[",
"0",
"]",
".",
"get_shape",
"(",
")",
"if",
"output_shape",
".",
"dims",
"is",
"None",
":",
"return",
"[",
"tensor_shape",
".",
"unknown_shape",
"(",
")",
",",
... | https://github.com/miyosuda/TensorFlowAndroidDemo/blob/35903e0221aa5f109ea2dbef27f20b52e317f42d/jni-build/jni/include/tensorflow/python/ops/control_flow_ops.py#L2395-L2427 | ||
hfinkel/llvm-project-cxxjit | 91084ef018240bbb8e24235ff5cd8c355a9c1a1e | llvm/utils/benchmark/mingw.py | python | main | () | Invoked when the script is run directly by the python interpreter | Invoked when the script is run directly by the python interpreter | [
"Invoked",
"when",
"the",
"script",
"is",
"run",
"directly",
"by",
"the",
"python",
"interpreter"
] | def main():
'''
Invoked when the script is run directly by the python interpreter
'''
parser = argparse.ArgumentParser(
description = 'Downloads a specific version of MinGW',
formatter_class = argparse.ArgumentDefaultsHelpFormatter
)
parser.add_argument('--location',
help... | [
"def",
"main",
"(",
")",
":",
"parser",
"=",
"argparse",
".",
"ArgumentParser",
"(",
"description",
"=",
"'Downloads a specific version of MinGW'",
",",
"formatter_class",
"=",
"argparse",
".",
"ArgumentDefaultsHelpFormatter",
")",
"parser",
".",
"add_argument",
"(",
... | https://github.com/hfinkel/llvm-project-cxxjit/blob/91084ef018240bbb8e24235ff5cd8c355a9c1a1e/llvm/utils/benchmark/mingw.py#L261-L307 | ||
adobe/chromium | cfe5bf0b51b1f6b9fe239c2a3c2f2364da9967d7 | third_party/closure_linter/closure_linter/statetracker.py | python | StateTracker.InBlock | (self) | return bool(self._block_depth) | Returns true if the current token is within a block.
Returns:
True if the current token is within a block. | Returns true if the current token is within a block. | [
"Returns",
"true",
"if",
"the",
"current",
"token",
"is",
"within",
"a",
"block",
"."
] | def InBlock(self):
"""Returns true if the current token is within a block.
Returns:
True if the current token is within a block.
"""
return bool(self._block_depth) | [
"def",
"InBlock",
"(",
"self",
")",
":",
"return",
"bool",
"(",
"self",
".",
"_block_depth",
")"
] | https://github.com/adobe/chromium/blob/cfe5bf0b51b1f6b9fe239c2a3c2f2364da9967d7/third_party/closure_linter/closure_linter/statetracker.py#L661-L667 | |
catboost/catboost | 167f64f237114a4d10b2b4ee42adb4569137debe | contrib/python/tornado/tornado-6/tornado/queues.py | python | Queue.qsize | (self) | return len(self._queue) | Number of items in the queue. | Number of items in the queue. | [
"Number",
"of",
"items",
"in",
"the",
"queue",
"."
] | def qsize(self) -> int:
"""Number of items in the queue."""
return len(self._queue) | [
"def",
"qsize",
"(",
"self",
")",
"->",
"int",
":",
"return",
"len",
"(",
"self",
".",
"_queue",
")"
] | https://github.com/catboost/catboost/blob/167f64f237114a4d10b2b4ee42adb4569137debe/contrib/python/tornado/tornado-6/tornado/queues.py#L173-L175 | |
thalium/icebox | 99d147d5b9269222225443ce171b4fd46d8985d4 | src/icebox/icebox_py/__init__.py | python | Vm.break_on_physical_process | (self, dtb, where, callback, name="") | return BreakpointId(bp, callback) | Return breakpoint on physical address filtered by DTB. | Return breakpoint on physical address filtered by DTB. | [
"Return",
"breakpoint",
"on",
"physical",
"address",
"filtered",
"by",
"DTB",
"."
] | def break_on_physical_process(self, dtb, where, callback, name=""):
"""Return breakpoint on physical address filtered by DTB."""
where = self._to_physical(where, self.processes.current())
bp = libicebox.break_on_physical_process(name, dtb, where, callback)
return BreakpointId(bp, callbac... | [
"def",
"break_on_physical_process",
"(",
"self",
",",
"dtb",
",",
"where",
",",
"callback",
",",
"name",
"=",
"\"\"",
")",
":",
"where",
"=",
"self",
".",
"_to_physical",
"(",
"where",
",",
"self",
".",
"processes",
".",
"current",
"(",
")",
")",
"bp",... | https://github.com/thalium/icebox/blob/99d147d5b9269222225443ce171b4fd46d8985d4/src/icebox/icebox_py/__init__.py#L713-L717 | |
SFTtech/openage | d6a08c53c48dc1e157807471df92197f6ca9e04d | openage/convert/processor/conversion/aoc/effect_subprocessor.py | python | AoCEffectSubprocessor.get_construct_effects | (line, location_ref) | return effects | Creates effects that are used for construction (unit command: 101)
:param line: Unit/Building line that gets the ability.
:type line: ...dataformat.converter_object.ConverterObjectGroup
:param location_ref: Reference to API object the effects are added to.
:type location_ref: str
... | Creates effects that are used for construction (unit command: 101) | [
"Creates",
"effects",
"that",
"are",
"used",
"for",
"construction",
"(",
"unit",
"command",
":",
"101",
")"
] | def get_construct_effects(line, location_ref):
"""
Creates effects that are used for construction (unit command: 101)
:param line: Unit/Building line that gets the ability.
:type line: ...dataformat.converter_object.ConverterObjectGroup
:param location_ref: Reference to API obje... | [
"def",
"get_construct_effects",
"(",
"line",
",",
"location_ref",
")",
":",
"dataset",
"=",
"line",
".",
"data",
"name_lookup_dict",
"=",
"internal_name_lookups",
".",
"get_entity_lookups",
"(",
"dataset",
".",
"game_version",
")",
"effects",
"=",
"[",
"]",
"pro... | https://github.com/SFTtech/openage/blob/d6a08c53c48dc1e157807471df92197f6ca9e04d/openage/convert/processor/conversion/aoc/effect_subprocessor.py#L459-L546 | |
wlanjie/AndroidFFmpeg | 7baf9122f4b8e1c74e7baf4be5c422c7a5ba5aaf | tools/fdk-aac-build/armeabi-v7a/toolchain/lib/python2.7/idlelib/macosxSupport.py | python | isCarbonAquaTk | (root) | return _carbonaquatk | Returns True if IDLE is using a Carbon Aqua Tk (instead of the
newer Cocoa Aqua Tk). | Returns True if IDLE is using a Carbon Aqua Tk (instead of the
newer Cocoa Aqua Tk). | [
"Returns",
"True",
"if",
"IDLE",
"is",
"using",
"a",
"Carbon",
"Aqua",
"Tk",
"(",
"instead",
"of",
"the",
"newer",
"Cocoa",
"Aqua",
"Tk",
")",
"."
] | def isCarbonAquaTk(root):
"""
Returns True if IDLE is using a Carbon Aqua Tk (instead of the
newer Cocoa Aqua Tk).
"""
global _carbonaquatk
if _carbonaquatk is None:
_carbonaquatk = (runningAsOSXApp() and
'aqua' in root.tk.call('tk', 'windowingsystem') and
... | [
"def",
"isCarbonAquaTk",
"(",
"root",
")",
":",
"global",
"_carbonaquatk",
"if",
"_carbonaquatk",
"is",
"None",
":",
"_carbonaquatk",
"=",
"(",
"runningAsOSXApp",
"(",
")",
"and",
"'aqua'",
"in",
"root",
".",
"tk",
".",
"call",
"(",
"'tk'",
",",
"'windowin... | https://github.com/wlanjie/AndroidFFmpeg/blob/7baf9122f4b8e1c74e7baf4be5c422c7a5ba5aaf/tools/fdk-aac-build/armeabi-v7a/toolchain/lib/python2.7/idlelib/macosxSupport.py#L25-L35 | |
wxWidgets/wxPython-Classic | 19571e1ae65f1ac445f5491474121998c97a1bf0 | src/osx_cocoa/_misc.py | python | Log_SetRepetitionCounting | (*args, **kwargs) | return _misc_.Log_SetRepetitionCounting(*args, **kwargs) | Log_SetRepetitionCounting(bool bRepetCounting=True) | Log_SetRepetitionCounting(bool bRepetCounting=True) | [
"Log_SetRepetitionCounting",
"(",
"bool",
"bRepetCounting",
"=",
"True",
")"
] | def Log_SetRepetitionCounting(*args, **kwargs):
"""Log_SetRepetitionCounting(bool bRepetCounting=True)"""
return _misc_.Log_SetRepetitionCounting(*args, **kwargs) | [
"def",
"Log_SetRepetitionCounting",
"(",
"*",
"args",
",",
"*",
"*",
"kwargs",
")",
":",
"return",
"_misc_",
".",
"Log_SetRepetitionCounting",
"(",
"*",
"args",
",",
"*",
"*",
"kwargs",
")"
] | https://github.com/wxWidgets/wxPython-Classic/blob/19571e1ae65f1ac445f5491474121998c97a1bf0/src/osx_cocoa/_misc.py#L1688-L1690 | |
OSGeo/gdal | 3748fc4ba4fba727492774b2b908a2130c864a83 | swig/python/osgeo/ogr.py | python | Feature.GetFieldCount | (self, *args) | return _ogr.Feature_GetFieldCount(self, *args) | r"""
GetFieldCount(Feature self) -> int
int
OGR_F_GetFieldCount(OGRFeatureH hFeat)
Fetch number of fields on this feature This will always be the same as
the field count for the OGRFeatureDefn.
This function is the same as the C++ method
OGRFeature::GetFieldCoun... | r"""
GetFieldCount(Feature self) -> int
int
OGR_F_GetFieldCount(OGRFeatureH hFeat) | [
"r",
"GetFieldCount",
"(",
"Feature",
"self",
")",
"-",
">",
"int",
"int",
"OGR_F_GetFieldCount",
"(",
"OGRFeatureH",
"hFeat",
")"
] | def GetFieldCount(self, *args):
r"""
GetFieldCount(Feature self) -> int
int
OGR_F_GetFieldCount(OGRFeatureH hFeat)
Fetch number of fields on this feature This will always be the same as
the field count for the OGRFeatureDefn.
This function is the same as the C++... | [
"def",
"GetFieldCount",
"(",
"self",
",",
"*",
"args",
")",
":",
"return",
"_ogr",
".",
"Feature_GetFieldCount",
"(",
"self",
",",
"*",
"args",
")"
] | https://github.com/OSGeo/gdal/blob/3748fc4ba4fba727492774b2b908a2130c864a83/swig/python/osgeo/ogr.py#L3034-L3053 | |
borglab/gtsam | a5bee157efce6a0563704bce6a5d188c29817f39 | python/gtsam/__init__.py | python | _init | () | This function is to add shims for the long-gone Point2 and Point3 types | This function is to add shims for the long-gone Point2 and Point3 types | [
"This",
"function",
"is",
"to",
"add",
"shims",
"for",
"the",
"long",
"-",
"gone",
"Point2",
"and",
"Point3",
"types"
] | def _init():
"""This function is to add shims for the long-gone Point2 and Point3 types"""
import numpy as np
global Point2 # export function
def Point2(x=np.nan, y=np.nan):
"""Shim for the deleted Point2 type."""
if isinstance(x, np.ndarray):
assert x.shape == (2, ), "Po... | [
"def",
"_init",
"(",
")",
":",
"import",
"numpy",
"as",
"np",
"global",
"Point2",
"# export function",
"def",
"Point2",
"(",
"x",
"=",
"np",
".",
"nan",
",",
"y",
"=",
"np",
".",
"nan",
")",
":",
"\"\"\"Shim for the deleted Point2 type.\"\"\"",
"if",
"isin... | https://github.com/borglab/gtsam/blob/a5bee157efce6a0563704bce6a5d188c29817f39/python/gtsam/__init__.py#L12-L38 | ||
benoitsteiner/tensorflow-opencl | cb7cb40a57fde5cfd4731bc551e82a1e2fef43a5 | tensorflow/python/client/timeline.py | python | _ChromeTraceFormatter.emit_flow_start | (self, name, timestamp, pid, tid, flow_id) | Adds a flow start event to the trace.
When matched with a flow end event (with the same 'flow_id') this will
cause the trace viewer to draw an arrow between the start and end events.
Args:
name: The event name as a string.
timestamp: The timestamp of this event as a long integer.
pid: ... | Adds a flow start event to the trace. | [
"Adds",
"a",
"flow",
"start",
"event",
"to",
"the",
"trace",
"."
] | def emit_flow_start(self, name, timestamp, pid, tid, flow_id):
"""Adds a flow start event to the trace.
When matched with a flow end event (with the same 'flow_id') this will
cause the trace viewer to draw an arrow between the start and end events.
Args:
name: The event name as a string.
... | [
"def",
"emit_flow_start",
"(",
"self",
",",
"name",
",",
"timestamp",
",",
"pid",
",",
"tid",
",",
"flow_id",
")",
":",
"event",
"=",
"self",
".",
"_create_event",
"(",
"'s'",
",",
"'DataFlow'",
",",
"name",
",",
"pid",
",",
"tid",
",",
"timestamp",
... | https://github.com/benoitsteiner/tensorflow-opencl/blob/cb7cb40a57fde5cfd4731bc551e82a1e2fef43a5/tensorflow/python/client/timeline.py#L185-L200 | ||
aws/lumberyard | f85344403c1c2e77ec8c75deb2c116e97b713217 | dev/Gems/CloudGemMetric/v1/AWS/python/windows/Lib/numba/roc/hlc/common.py | python | rename_label | (llvmir) | return _re_labelname.sub(repl, llvmir) | HLC does not like a label with '.' prefix. | HLC does not like a label with '.' prefix. | [
"HLC",
"does",
"not",
"like",
"a",
"label",
"with",
".",
"prefix",
"."
] | def rename_label(llvmir):
"""
HLC does not like a label with '.' prefix.
"""
def repl(mat):
return '_dot_.{0}:'.format(mat.group(1))
return _re_labelname.sub(repl, llvmir) | [
"def",
"rename_label",
"(",
"llvmir",
")",
":",
"def",
"repl",
"(",
"mat",
")",
":",
"return",
"'_dot_.{0}:'",
".",
"format",
"(",
"mat",
".",
"group",
"(",
"1",
")",
")",
"return",
"_re_labelname",
".",
"sub",
"(",
"repl",
",",
"llvmir",
")"
] | https://github.com/aws/lumberyard/blob/f85344403c1c2e77ec8c75deb2c116e97b713217/dev/Gems/CloudGemMetric/v1/AWS/python/windows/Lib/numba/roc/hlc/common.py#L55-L62 | |
krishauser/Klampt | 972cc83ea5befac3f653c1ba20f80155768ad519 | Python/klampt/src/robotsim.py | python | RobotModelDriver.getLimits | (self) | return _robotsim.RobotModelDriver_getLimits(self) | r"""
getLimits(RobotModelDriver self)
Returns value limits [xmin,xmax]. | r"""
getLimits(RobotModelDriver self) | [
"r",
"getLimits",
"(",
"RobotModelDriver",
"self",
")"
] | def getLimits(self) -> "void":
r"""
getLimits(RobotModelDriver self)
Returns value limits [xmin,xmax].
"""
return _robotsim.RobotModelDriver_getLimits(self) | [
"def",
"getLimits",
"(",
"self",
")",
"->",
"\"void\"",
":",
"return",
"_robotsim",
".",
"RobotModelDriver_getLimits",
"(",
"self",
")"
] | https://github.com/krishauser/Klampt/blob/972cc83ea5befac3f653c1ba20f80155768ad519/Python/klampt/src/robotsim.py#L4707-L4715 | |
wlanjie/AndroidFFmpeg | 7baf9122f4b8e1c74e7baf4be5c422c7a5ba5aaf | tools/fdk-aac-build/armeabi-v7a/toolchain/lib/python2.7/rfc822.py | python | AddrlistClass.gotonext | (self) | Parse up to the start of the next address. | Parse up to the start of the next address. | [
"Parse",
"up",
"to",
"the",
"start",
"of",
"the",
"next",
"address",
"."
] | def gotonext(self):
"""Parse up to the start of the next address."""
while self.pos < len(self.field):
if self.field[self.pos] in self.LWS + '\n\r':
self.pos = self.pos + 1
elif self.field[self.pos] == '(':
self.commentlist.append(self.getcomment()... | [
"def",
"gotonext",
"(",
"self",
")",
":",
"while",
"self",
".",
"pos",
"<",
"len",
"(",
"self",
".",
"field",
")",
":",
"if",
"self",
".",
"field",
"[",
"self",
".",
"pos",
"]",
"in",
"self",
".",
"LWS",
"+",
"'\\n\\r'",
":",
"self",
".",
"pos"... | https://github.com/wlanjie/AndroidFFmpeg/blob/7baf9122f4b8e1c74e7baf4be5c422c7a5ba5aaf/tools/fdk-aac-build/armeabi-v7a/toolchain/lib/python2.7/rfc822.py#L526-L533 | ||
qgis/QGIS | 15a77662d4bb712184f6aa60d0bd663010a76a75 | python/plugins/db_manager/db_plugins/oracle/connector.py | python | OracleDBConnector.createTableIndex | (self, table, name, column) | Creates index on one column using default options. | Creates index on one column using default options. | [
"Creates",
"index",
"on",
"one",
"column",
"using",
"default",
"options",
"."
] | def createTableIndex(self, table, name, column):
"""Creates index on one column using default options."""
sql = u"CREATE INDEX {0} ON {1} ({2})".format(
self.quoteId(name), self.quoteId(table),
self.quoteId(column))
self._execute_and_commit(sql) | [
"def",
"createTableIndex",
"(",
"self",
",",
"table",
",",
"name",
",",
"column",
")",
":",
"sql",
"=",
"u\"CREATE INDEX {0} ON {1} ({2})\"",
".",
"format",
"(",
"self",
".",
"quoteId",
"(",
"name",
")",
",",
"self",
".",
"quoteId",
"(",
"table",
")",
",... | https://github.com/qgis/QGIS/blob/15a77662d4bb712184f6aa60d0bd663010a76a75/python/plugins/db_manager/db_plugins/oracle/connector.py#L1590-L1595 | ||
catboost/catboost | 167f64f237114a4d10b2b4ee42adb4569137debe | contrib/python/scikit-learn/py3/sklearn/feature_selection/_base.py | python | SelectorMixin.get_support | (self, indices=False) | return mask if not indices else np.where(mask)[0] | Get a mask, or integer index, of the features selected
Parameters
----------
indices : boolean (default False)
If True, the return value will be an array of integers, rather
than a boolean mask.
Returns
-------
support : array
An inde... | Get a mask, or integer index, of the features selected | [
"Get",
"a",
"mask",
"or",
"integer",
"index",
"of",
"the",
"features",
"selected"
] | def get_support(self, indices=False):
"""
Get a mask, or integer index, of the features selected
Parameters
----------
indices : boolean (default False)
If True, the return value will be an array of integers, rather
than a boolean mask.
Returns
... | [
"def",
"get_support",
"(",
"self",
",",
"indices",
"=",
"False",
")",
":",
"mask",
"=",
"self",
".",
"_get_support_mask",
"(",
")",
"return",
"mask",
"if",
"not",
"indices",
"else",
"np",
".",
"where",
"(",
"mask",
")",
"[",
"0",
"]"
] | https://github.com/catboost/catboost/blob/167f64f237114a4d10b2b4ee42adb4569137debe/contrib/python/scikit-learn/py3/sklearn/feature_selection/_base.py#L26-L47 | |
runtimejs/runtime | 0a6e84c30823d35a4548d6634166784260ae7b74 | deps/v8/tools/stats-viewer.py | python | UiCounter.__init__ | (self, var, format) | Creates a new ui counter.
Args:
var: the Tkinter string variable for updating the ui
format: the format string used to format this counter | Creates a new ui counter. | [
"Creates",
"a",
"new",
"ui",
"counter",
"."
] | def __init__(self, var, format):
"""Creates a new ui counter.
Args:
var: the Tkinter string variable for updating the ui
format: the format string used to format this counter
"""
self.var = var
self.format = format
self.last_value = None | [
"def",
"__init__",
"(",
"self",
",",
"var",
",",
"format",
")",
":",
"self",
".",
"var",
"=",
"var",
"self",
".",
"format",
"=",
"format",
"self",
".",
"last_value",
"=",
"None"
] | https://github.com/runtimejs/runtime/blob/0a6e84c30823d35a4548d6634166784260ae7b74/deps/v8/tools/stats-viewer.py#L271-L280 | ||
tensorflow/tensorflow | 419e3a6b650ea4bd1b0cba23c4348f8a69f3272e | tensorflow/python/ops/distributions/transformed_distribution.py | python | _ones_like | (x) | return array_ops.ones_like(x) | Convenience function attempts to statically construct `ones_like`. | Convenience function attempts to statically construct `ones_like`. | [
"Convenience",
"function",
"attempts",
"to",
"statically",
"construct",
"ones_like",
"."
] | def _ones_like(x):
"""Convenience function attempts to statically construct `ones_like`."""
# Should only be used for small vectors.
if x.get_shape().is_fully_defined():
return array_ops.ones(x.get_shape().as_list(), dtype=x.dtype)
return array_ops.ones_like(x) | [
"def",
"_ones_like",
"(",
"x",
")",
":",
"# Should only be used for small vectors.",
"if",
"x",
".",
"get_shape",
"(",
")",
".",
"is_fully_defined",
"(",
")",
":",
"return",
"array_ops",
".",
"ones",
"(",
"x",
".",
"get_shape",
"(",
")",
".",
"as_list",
"(... | https://github.com/tensorflow/tensorflow/blob/419e3a6b650ea4bd1b0cba23c4348f8a69f3272e/tensorflow/python/ops/distributions/transformed_distribution.py#L94-L99 | |
aws/lumberyard | f85344403c1c2e77ec8c75deb2c116e97b713217 | dev/Tools/Python/3.7.10/mac/Python.framework/Versions/3.7/lib/python3.7/_dummy_thread.py | python | exit | () | Dummy implementation of _thread.exit(). | Dummy implementation of _thread.exit(). | [
"Dummy",
"implementation",
"of",
"_thread",
".",
"exit",
"()",
"."
] | def exit():
"""Dummy implementation of _thread.exit()."""
raise SystemExit | [
"def",
"exit",
"(",
")",
":",
"raise",
"SystemExit"
] | https://github.com/aws/lumberyard/blob/f85344403c1c2e77ec8c75deb2c116e97b713217/dev/Tools/Python/3.7.10/mac/Python.framework/Versions/3.7/lib/python3.7/_dummy_thread.py#L61-L63 | ||
facebookresearch/ELF | 1f790173095cd910976d9f651b80beb872ec5d12 | vendor/pybind11/tools/clang/cindex.py | python | Cursor.hash | (self) | return self._hash | Returns a hash of the cursor as an int. | Returns a hash of the cursor as an int. | [
"Returns",
"a",
"hash",
"of",
"the",
"cursor",
"as",
"an",
"int",
"."
] | def hash(self):
"""Returns a hash of the cursor as an int."""
if not hasattr(self, '_hash'):
self._hash = conf.lib.clang_hashCursor(self)
return self._hash | [
"def",
"hash",
"(",
"self",
")",
":",
"if",
"not",
"hasattr",
"(",
"self",
",",
"'_hash'",
")",
":",
"self",
".",
"_hash",
"=",
"conf",
".",
"lib",
".",
"clang_hashCursor",
"(",
"self",
")",
"return",
"self",
".",
"_hash"
] | https://github.com/facebookresearch/ELF/blob/1f790173095cd910976d9f651b80beb872ec5d12/vendor/pybind11/tools/clang/cindex.py#L1565-L1570 | |
wxWidgets/wxPython-Classic | 19571e1ae65f1ac445f5491474121998c97a1bf0 | wx/lib/agw/cubecolourdialog.py | python | HSVWheel.OnLeftUp | (self, event) | Handles the ``wx.EVT_LEFT_UP`` for :class:`HSVWheel`.
:param `event`: a :class:`MouseEvent` event to be processed. | Handles the ``wx.EVT_LEFT_UP`` for :class:`HSVWheel`. | [
"Handles",
"the",
"wx",
".",
"EVT_LEFT_UP",
"for",
":",
"class",
":",
"HSVWheel",
"."
] | def OnLeftUp(self, event):
"""
Handles the ``wx.EVT_LEFT_UP`` for :class:`HSVWheel`.
:param `event`: a :class:`MouseEvent` event to be processed.
"""
if self.GetCapture():
self.ReleaseMouse()
self._mouseIn = False | [
"def",
"OnLeftUp",
"(",
"self",
",",
"event",
")",
":",
"if",
"self",
".",
"GetCapture",
"(",
")",
":",
"self",
".",
"ReleaseMouse",
"(",
")",
"self",
".",
"_mouseIn",
"=",
"False"
] | https://github.com/wxWidgets/wxPython-Classic/blob/19571e1ae65f1ac445f5491474121998c97a1bf0/wx/lib/agw/cubecolourdialog.py#L2056-L2065 | ||
catboost/catboost | 167f64f237114a4d10b2b4ee42adb4569137debe | contrib/python/ipython/py3/IPython/lib/backgroundjobs.py | python | BackgroundJobManager.flush | (self) | Flush all finished jobs (completed and dead) from lists.
Running jobs are never flushed.
It first calls _status_new(), to update info. If any jobs have
completed since the last _status_new() call, the flush operation
aborts. | Flush all finished jobs (completed and dead) from lists. | [
"Flush",
"all",
"finished",
"jobs",
"(",
"completed",
"and",
"dead",
")",
"from",
"lists",
"."
] | def flush(self):
"""Flush all finished jobs (completed and dead) from lists.
Running jobs are never flushed.
It first calls _status_new(), to update info. If any jobs have
completed since the last _status_new() call, the flush operation
aborts."""
# Remove the finished... | [
"def",
"flush",
"(",
"self",
")",
":",
"# Remove the finished jobs from the master dict",
"alljobs",
"=",
"self",
".",
"all",
"for",
"job",
"in",
"self",
".",
"completed",
"+",
"self",
".",
"dead",
":",
"del",
"(",
"alljobs",
"[",
"job",
".",
"num",
"]",
... | https://github.com/catboost/catboost/blob/167f64f237114a4d10b2b4ee42adb4569137debe/contrib/python/ipython/py3/IPython/lib/backgroundjobs.py#L312-L330 | ||
klzgrad/naiveproxy | ed2c513637c77b18721fe428d7ed395b4d284c83 | src/third_party/depot_tools/cpplint.py | python | IsBlockInNameSpace | (nesting_state, is_forward_declaration) | return (len(nesting_state.stack) > 1 and
nesting_state.stack[-1].check_namespace_indentation and
isinstance(nesting_state.stack[-2], _NamespaceInfo)) | Checks that the new block is directly in a namespace.
Args:
nesting_state: The _NestingState object that contains info about our state.
is_forward_declaration: If the class is a forward declared class.
Returns:
Whether or not the new block is directly in a namespace. | Checks that the new block is directly in a namespace. | [
"Checks",
"that",
"the",
"new",
"block",
"is",
"directly",
"in",
"a",
"namespace",
"."
] | def IsBlockInNameSpace(nesting_state, is_forward_declaration):
"""Checks that the new block is directly in a namespace.
Args:
nesting_state: The _NestingState object that contains info about our state.
is_forward_declaration: If the class is a forward declared class.
Returns:
Whether or not the new b... | [
"def",
"IsBlockInNameSpace",
"(",
"nesting_state",
",",
"is_forward_declaration",
")",
":",
"if",
"is_forward_declaration",
":",
"if",
"len",
"(",
"nesting_state",
".",
"stack",
")",
">=",
"1",
"and",
"(",
"isinstance",
"(",
"nesting_state",
".",
"stack",
"[",
... | https://github.com/klzgrad/naiveproxy/blob/ed2c513637c77b18721fe428d7ed395b4d284c83/src/third_party/depot_tools/cpplint.py#L5585-L5603 | |
catboost/catboost | 167f64f237114a4d10b2b4ee42adb4569137debe | contrib/python/scipy/py2/scipy/signal/ltisys.py | python | StateSpace.__truediv__ | (self, other) | return self.__mul__(1/other) | Divide by a scalar | Divide by a scalar | [
"Divide",
"by",
"a",
"scalar"
] | def __truediv__(self, other):
"""
Divide by a scalar
"""
# Division by non-StateSpace scalars
if not self._check_binop_other(other) or isinstance(other, StateSpace):
return NotImplemented
if isinstance(other, np.ndarray) and other.ndim > 0:
# It's... | [
"def",
"__truediv__",
"(",
"self",
",",
"other",
")",
":",
"# Division by non-StateSpace scalars",
"if",
"not",
"self",
".",
"_check_binop_other",
"(",
"other",
")",
"or",
"isinstance",
"(",
"other",
",",
"StateSpace",
")",
":",
"return",
"NotImplemented",
"if",... | https://github.com/catboost/catboost/blob/167f64f237114a4d10b2b4ee42adb4569137debe/contrib/python/scipy/py2/scipy/signal/ltisys.py#L1496-L1508 | |
aws/lumberyard | f85344403c1c2e77ec8c75deb2c116e97b713217 | dev/Tools/AWSPythonSDK/1.5.8/concurrent/futures/_base.py | python | Future.running | (self) | Return True if the future is currently executing. | Return True if the future is currently executing. | [
"Return",
"True",
"if",
"the",
"future",
"is",
"currently",
"executing",
"."
] | def running(self):
"""Return True if the future is currently executing."""
with self._condition:
return self._state == RUNNING | [
"def",
"running",
"(",
"self",
")",
":",
"with",
"self",
".",
"_condition",
":",
"return",
"self",
".",
"_state",
"==",
"RUNNING"
] | https://github.com/aws/lumberyard/blob/f85344403c1c2e77ec8c75deb2c116e97b713217/dev/Tools/AWSPythonSDK/1.5.8/concurrent/futures/_base.py#L362-L365 | ||
wxWidgets/wxPython-Classic | 19571e1ae65f1ac445f5491474121998c97a1bf0 | src/osx_carbon/_core.py | python | ThreadEvent.__init__ | (self, *args, **kwargs) | __init__(self, EventType eventType=wxEVT_THREAD, int id=ID_ANY) -> ThreadEvent | __init__(self, EventType eventType=wxEVT_THREAD, int id=ID_ANY) -> ThreadEvent | [
"__init__",
"(",
"self",
"EventType",
"eventType",
"=",
"wxEVT_THREAD",
"int",
"id",
"=",
"ID_ANY",
")",
"-",
">",
"ThreadEvent"
] | def __init__(self, *args, **kwargs):
"""__init__(self, EventType eventType=wxEVT_THREAD, int id=ID_ANY) -> ThreadEvent"""
_core_.ThreadEvent_swiginit(self,_core_.new_ThreadEvent(*args, **kwargs)) | [
"def",
"__init__",
"(",
"self",
",",
"*",
"args",
",",
"*",
"*",
"kwargs",
")",
":",
"_core_",
".",
"ThreadEvent_swiginit",
"(",
"self",
",",
"_core_",
".",
"new_ThreadEvent",
"(",
"*",
"args",
",",
"*",
"*",
"kwargs",
")",
")"
] | https://github.com/wxWidgets/wxPython-Classic/blob/19571e1ae65f1ac445f5491474121998c97a1bf0/src/osx_carbon/_core.py#L5379-L5381 | ||
aws/lumberyard | f85344403c1c2e77ec8c75deb2c116e97b713217 | dev/Tools/Python/3.7.10/windows/Lib/http/cookiejar.py | python | is_HDN | (text) | return True | Return True if text is a host domain name. | Return True if text is a host domain name. | [
"Return",
"True",
"if",
"text",
"is",
"a",
"host",
"domain",
"name",
"."
] | def is_HDN(text):
"""Return True if text is a host domain name."""
# XXX
# This may well be wrong. Which RFC is HDN defined in, if any (for
# the purposes of RFC 2965)?
# For the current implementation, what about IPv6? Remember to look
# at other uses of IPV4_RE also, if change this.
if... | [
"def",
"is_HDN",
"(",
"text",
")",
":",
"# XXX",
"# This may well be wrong. Which RFC is HDN defined in, if any (for",
"# the purposes of RFC 2965)?",
"# For the current implementation, what about IPv6? Remember to look",
"# at other uses of IPV4_RE also, if change this.",
"if",
"IPV4_RE... | https://github.com/aws/lumberyard/blob/f85344403c1c2e77ec8c75deb2c116e97b713217/dev/Tools/Python/3.7.10/windows/Lib/http/cookiejar.py#L527-L540 | |
deepmind/open_spiel | 4ca53bea32bb2875c7385d215424048ae92f78c8 | open_spiel/python/algorithms/adidas_utils/solvers/nonsymmetric/ate.py | python | Solver.mirror_descent_step | (self, params, grads, t) | return (new_dist, new_y) | Entropic mirror descent on exploitability.
Args:
params: tuple of variables to be updated (dist, y)
grads: tuple of variable gradients (grad_dist, grad_y)
t: int, solver iteration (unused)
Returns:
new_params: tuple of update params (new_dist, new_y) | Entropic mirror descent on exploitability. | [
"Entropic",
"mirror",
"descent",
"on",
"exploitability",
"."
] | def mirror_descent_step(self, params, grads, t):
"""Entropic mirror descent on exploitability.
Args:
params: tuple of variables to be updated (dist, y)
grads: tuple of variable gradients (grad_dist, grad_y)
t: int, solver iteration (unused)
Returns:
new_params: tuple of update param... | [
"def",
"mirror_descent_step",
"(",
"self",
",",
"params",
",",
"grads",
",",
"t",
")",
":",
"lr_dist",
",",
"lr_y",
"=",
"self",
".",
"lrs",
"new_dist",
"=",
"[",
"]",
"for",
"dist_i",
",",
"dist_grad_i",
"in",
"zip",
"(",
"params",
"[",
"0",
"]",
... | https://github.com/deepmind/open_spiel/blob/4ca53bea32bb2875c7385d215424048ae92f78c8/open_spiel/python/algorithms/adidas_utils/solvers/nonsymmetric/ate.py#L131-L153 | |
catboost/catboost | 167f64f237114a4d10b2b4ee42adb4569137debe | contrib/python/ipython/py3/IPython/utils/ipstruct.py | python | Struct.__init__ | (self, *args, **kw) | Initialize with a dictionary, another Struct, or data.
Parameters
----------
args : dict, Struct
Initialize with one dict or Struct
kw : dict
Initialize with key, value pairs.
Examples
--------
>>> s = Struct(a=10,b=30)
>>> s.a
... | Initialize with a dictionary, another Struct, or data. | [
"Initialize",
"with",
"a",
"dictionary",
"another",
"Struct",
"or",
"data",
"."
] | def __init__(self, *args, **kw):
"""Initialize with a dictionary, another Struct, or data.
Parameters
----------
args : dict, Struct
Initialize with one dict or Struct
kw : dict
Initialize with key, value pairs.
Examples
--------
... | [
"def",
"__init__",
"(",
"self",
",",
"*",
"args",
",",
"*",
"*",
"kw",
")",
":",
"object",
".",
"__setattr__",
"(",
"self",
",",
"'_allownew'",
",",
"True",
")",
"dict",
".",
"__init__",
"(",
"self",
",",
"*",
"args",
",",
"*",
"*",
"kw",
")"
] | https://github.com/catboost/catboost/blob/167f64f237114a4d10b2b4ee42adb4569137debe/contrib/python/ipython/py3/IPython/utils/ipstruct.py#L41-L64 | ||
aws/lumberyard | f85344403c1c2e77ec8c75deb2c116e97b713217 | dev/Tools/Python/3.7.10/mac/Python.framework/Versions/3.7/lib/python3.7/pathlib.py | python | Path.iterdir | (self) | Iterate over the files in this directory. Does not yield any
result for the special paths '.' and '..'. | Iterate over the files in this directory. Does not yield any
result for the special paths '.' and '..'. | [
"Iterate",
"over",
"the",
"files",
"in",
"this",
"directory",
".",
"Does",
"not",
"yield",
"any",
"result",
"for",
"the",
"special",
"paths",
".",
"and",
"..",
"."
] | def iterdir(self):
"""Iterate over the files in this directory. Does not yield any
result for the special paths '.' and '..'.
"""
if self._closed:
self._raise_closed()
for name in self._accessor.listdir(self):
if name in {'.', '..'}:
# Yie... | [
"def",
"iterdir",
"(",
"self",
")",
":",
"if",
"self",
".",
"_closed",
":",
"self",
".",
"_raise_closed",
"(",
")",
"for",
"name",
"in",
"self",
".",
"_accessor",
".",
"listdir",
"(",
"self",
")",
":",
"if",
"name",
"in",
"{",
"'.'",
",",
"'..'",
... | https://github.com/aws/lumberyard/blob/f85344403c1c2e77ec8c75deb2c116e97b713217/dev/Tools/Python/3.7.10/mac/Python.framework/Versions/3.7/lib/python3.7/pathlib.py#L1101-L1113 | ||
hanpfei/chromium-net | 392cc1fa3a8f92f42e4071ab6e674d8e0482f83f | net/data/ssl/scripts/crlsetutil.py | python | ASN1Iterator.step_into | (self) | Begins processing the inner contents of the next ASN.1 element | Begins processing the inner contents of the next ASN.1 element | [
"Begins",
"processing",
"the",
"inner",
"contents",
"of",
"the",
"next",
"ASN",
".",
"1",
"element"
] | def step_into(self):
"""Begins processing the inner contents of the next ASN.1 element"""
(self._tag, self._header_length, self._contents, self._rest) = (
_parse_asn1_element(self._contents[self._header_length:])) | [
"def",
"step_into",
"(",
"self",
")",
":",
"(",
"self",
".",
"_tag",
",",
"self",
".",
"_header_length",
",",
"self",
".",
"_contents",
",",
"self",
".",
"_rest",
")",
"=",
"(",
"_parse_asn1_element",
"(",
"self",
".",
"_contents",
"[",
"self",
".",
... | https://github.com/hanpfei/chromium-net/blob/392cc1fa3a8f92f42e4071ab6e674d8e0482f83f/net/data/ssl/scripts/crlsetutil.py#L101-L104 | ||
tensorflow/tensorflow | 419e3a6b650ea4bd1b0cba23c4348f8a69f3272e | tensorflow/python/tools/saved_model_cli.py | python | _print_tensor_info | (tensor_info, indent=0) | Prints details of the given tensor_info.
Args:
tensor_info: TensorInfo object to be printed.
indent: How far (in increments of 2 spaces) to indent each line output | Prints details of the given tensor_info. | [
"Prints",
"details",
"of",
"the",
"given",
"tensor_info",
"."
] | def _print_tensor_info(tensor_info, indent=0):
"""Prints details of the given tensor_info.
Args:
tensor_info: TensorInfo object to be printed.
indent: How far (in increments of 2 spaces) to indent each line output
"""
indent_str = ' ' * indent
def in_print(s):
print(indent_str + s)
in_print('... | [
"def",
"_print_tensor_info",
"(",
"tensor_info",
",",
"indent",
"=",
"0",
")",
":",
"indent_str",
"=",
"' '",
"*",
"indent",
"def",
"in_print",
"(",
"s",
")",
":",
"print",
"(",
"indent_str",
"+",
"s",
")",
"in_print",
"(",
"' dtype: '",
"+",
"{",
... | https://github.com/tensorflow/tensorflow/blob/419e3a6b650ea4bd1b0cba23c4348f8a69f3272e/tensorflow/python/tools/saved_model_cli.py#L268-L290 | ||
Genius-x/genius-x | 9fc9f194e6d1fb92dd0e33d43db19ddb67cda7b0 | cocos2d/tools/bindings-generator/clang/cindex.py | python | Type.is_volatile_qualified | (self) | return conf.lib.clang_isVolatileQualifiedType(self) | Determine whether a Type has the "volatile" qualifier set.
This does not look through typedefs that may have added "volatile"
at a different level. | Determine whether a Type has the "volatile" qualifier set. | [
"Determine",
"whether",
"a",
"Type",
"has",
"the",
"volatile",
"qualifier",
"set",
"."
] | def is_volatile_qualified(self):
"""Determine whether a Type has the "volatile" qualifier set.
This does not look through typedefs that may have added "volatile"
at a different level.
"""
return conf.lib.clang_isVolatileQualifiedType(self) | [
"def",
"is_volatile_qualified",
"(",
"self",
")",
":",
"return",
"conf",
".",
"lib",
".",
"clang_isVolatileQualifiedType",
"(",
"self",
")"
] | https://github.com/Genius-x/genius-x/blob/9fc9f194e6d1fb92dd0e33d43db19ddb67cda7b0/cocos2d/tools/bindings-generator/clang/cindex.py#L1744-L1750 | |
RapidsAtHKUST/CommunityDetectionCodes | 23dbafd2e57ab0f5f0528b1322c4a409f21e5892 | Prensentation/algorithms/link_partition/visualization/dendrogram/radial_support.py | python | from_polar | (p) | return _a(cos(p[0])* p[1], sin(p[0])* p[1]) | (theta, radius) to (x, y). | (theta, radius) to (x, y). | [
"(",
"theta",
"radius",
")",
"to",
"(",
"x",
"y",
")",
"."
] | def from_polar(p):
"""(theta, radius) to (x, y)."""
return _a(cos(p[0])* p[1], sin(p[0])* p[1]) | [
"def",
"from_polar",
"(",
"p",
")",
":",
"return",
"_a",
"(",
"cos",
"(",
"p",
"[",
"0",
"]",
")",
"*",
"p",
"[",
"1",
"]",
",",
"sin",
"(",
"p",
"[",
"0",
"]",
")",
"*",
"p",
"[",
"1",
"]",
")"
] | https://github.com/RapidsAtHKUST/CommunityDetectionCodes/blob/23dbafd2e57ab0f5f0528b1322c4a409f21e5892/Prensentation/algorithms/link_partition/visualization/dendrogram/radial_support.py#L9-L11 | |
hughperkins/tf-coriander | 970d3df6c11400ad68405f22b0c42a52374e94ca | tensorflow/python/ops/gradients.py | python | _GetGrads | (grads, op) | Gets all gradients for op. | Gets all gradients for op. | [
"Gets",
"all",
"gradients",
"for",
"op",
"."
] | def _GetGrads(grads, op):
"""Gets all gradients for op."""
if op in grads:
return grads[op]
else:
return [[] for _ in xrange(len(op.outputs))] | [
"def",
"_GetGrads",
"(",
"grads",
",",
"op",
")",
":",
"if",
"op",
"in",
"grads",
":",
"return",
"grads",
"[",
"op",
"]",
"else",
":",
"return",
"[",
"[",
"]",
"for",
"_",
"in",
"xrange",
"(",
"len",
"(",
"op",
".",
"outputs",
")",
")",
"]"
] | https://github.com/hughperkins/tf-coriander/blob/970d3df6c11400ad68405f22b0c42a52374e94ca/tensorflow/python/ops/gradients.py#L583-L588 | ||
google/certificate-transparency | 2588562fd306a447958471b6f06c1069619c1641 | python/ct/client/monitor.py | python | Monitor._set_pending_sth | (self, new_sth) | return True | Set pending_sth from new_sth, or just verified_sth if not bigger. | Set pending_sth from new_sth, or just verified_sth if not bigger. | [
"Set",
"pending_sth",
"from",
"new_sth",
"or",
"just",
"verified_sth",
"if",
"not",
"bigger",
"."
] | def _set_pending_sth(self, new_sth):
"""Set pending_sth from new_sth, or just verified_sth if not bigger."""
logging.info("STH verified, updating state.")
if new_sth.tree_size < self.__state.verified_sth.tree_size:
raise ValueError("pending size must be >= verified size")
if ... | [
"def",
"_set_pending_sth",
"(",
"self",
",",
"new_sth",
")",
":",
"logging",
".",
"info",
"(",
"\"STH verified, updating state.\"",
")",
"if",
"new_sth",
".",
"tree_size",
"<",
"self",
".",
"__state",
".",
"verified_sth",
".",
"tree_size",
":",
"raise",
"Value... | https://github.com/google/certificate-transparency/blob/2588562fd306a447958471b6f06c1069619c1641/python/ct/client/monitor.py#L87-L101 | |
aws/lumberyard | f85344403c1c2e77ec8c75deb2c116e97b713217 | dev/Gems/CloudGemDefectReporter/v1/AWS/common-code/Lib/oauthlib/oauth2/rfc6749/grant_types/refresh_token.py | python | RefreshTokenGrant.create_token_response | (self, request, token_handler) | return headers, json.dumps(token), 200 | Create a new access token from a refresh_token.
If valid and authorized, the authorization server issues an access
token as described in `Section 5.1`_. If the request failed
verification or is invalid, the authorization server returns an error
response as described in `Section 5.2`_.
... | Create a new access token from a refresh_token. | [
"Create",
"a",
"new",
"access",
"token",
"from",
"a",
"refresh_token",
"."
] | def create_token_response(self, request, token_handler):
"""Create a new access token from a refresh_token.
If valid and authorized, the authorization server issues an access
token as described in `Section 5.1`_. If the request failed
verification or is invalid, the authorization server... | [
"def",
"create_token_response",
"(",
"self",
",",
"request",
",",
"token_handler",
")",
":",
"headers",
"=",
"{",
"'Content-Type'",
":",
"'application/json'",
",",
"'Cache-Control'",
":",
"'no-store'",
",",
"'Pragma'",
":",
"'no-cache'",
",",
"}",
"try",
":",
... | https://github.com/aws/lumberyard/blob/f85344403c1c2e77ec8c75deb2c116e97b713217/dev/Gems/CloudGemDefectReporter/v1/AWS/common-code/Lib/oauthlib/oauth2/rfc6749/grant_types/refresh_token.py#L33-L72 | |
hanpfei/chromium-net | 392cc1fa3a8f92f42e4071ab6e674d8e0482f83f | tools/roll_webrtc.py | python | _PosixPath | (path) | return path.replace(os.sep, '/') | Convert a possibly-Windows path to a posix-style path. | Convert a possibly-Windows path to a posix-style path. | [
"Convert",
"a",
"possibly",
"-",
"Windows",
"path",
"to",
"a",
"posix",
"-",
"style",
"path",
"."
] | def _PosixPath(path):
"""Convert a possibly-Windows path to a posix-style path."""
(_, path) = os.path.splitdrive(path)
return path.replace(os.sep, '/') | [
"def",
"_PosixPath",
"(",
"path",
")",
":",
"(",
"_",
",",
"path",
")",
"=",
"os",
".",
"path",
".",
"splitdrive",
"(",
"path",
")",
"return",
"path",
".",
"replace",
"(",
"os",
".",
"sep",
",",
"'/'",
")"
] | https://github.com/hanpfei/chromium-net/blob/392cc1fa3a8f92f42e4071ab6e674d8e0482f83f/tools/roll_webrtc.py#L65-L68 | |
HyeonwooNoh/caffe | d9e8494a2832d67b25dee37194c7bcb9d52d0e42 | tools/extra/parse_log.py | python | save_csv_files | (logfile_path, output_dir, train_dict_list, train_dict_names,
test_dict_list, test_dict_names, verbose=False) | Save CSV files to output_dir
If the input log file is, e.g., caffe.INFO, the names will be
caffe.INFO.train and caffe.INFO.test | Save CSV files to output_dir | [
"Save",
"CSV",
"files",
"to",
"output_dir"
] | def save_csv_files(logfile_path, output_dir, train_dict_list, train_dict_names,
test_dict_list, test_dict_names, verbose=False):
"""Save CSV files to output_dir
If the input log file is, e.g., caffe.INFO, the names will be
caffe.INFO.train and caffe.INFO.test
"""
log_basename = ... | [
"def",
"save_csv_files",
"(",
"logfile_path",
",",
"output_dir",
",",
"train_dict_list",
",",
"train_dict_names",
",",
"test_dict_list",
",",
"test_dict_names",
",",
"verbose",
"=",
"False",
")",
":",
"log_basename",
"=",
"os",
".",
"path",
".",
"basename",
"(",... | https://github.com/HyeonwooNoh/caffe/blob/d9e8494a2832d67b25dee37194c7bcb9d52d0e42/tools/extra/parse_log.py#L101-L114 | ||
oracle/graaljs | 36a56e8e993d45fc40939a3a4d9c0c24990720f1 | graal-nodejs/deps/v8/third_party/jinja2/utils.py | python | htmlsafe_json_dumps | (obj, dumper=None, **kwargs) | return Markup(rv) | Works exactly like :func:`dumps` but is safe for use in ``<script>``
tags. It accepts the same arguments and returns a JSON string. Note that
this is available in templates through the ``|tojson`` filter which will
also mark the result as safe. Due to how this function escapes certain
characters this... | Works exactly like :func:`dumps` but is safe for use in ``<script>``
tags. It accepts the same arguments and returns a JSON string. Note that
this is available in templates through the ``|tojson`` filter which will
also mark the result as safe. Due to how this function escapes certain
characters this... | [
"Works",
"exactly",
"like",
":",
"func",
":",
"dumps",
"but",
"is",
"safe",
"for",
"use",
"in",
"<script",
">",
"tags",
".",
"It",
"accepts",
"the",
"same",
"arguments",
"and",
"returns",
"a",
"JSON",
"string",
".",
"Note",
"that",
"this",
"is",
"avail... | def htmlsafe_json_dumps(obj, dumper=None, **kwargs):
"""Works exactly like :func:`dumps` but is safe for use in ``<script>``
tags. It accepts the same arguments and returns a JSON string. Note that
this is available in templates through the ``|tojson`` filter which will
also mark the result as safe. ... | [
"def",
"htmlsafe_json_dumps",
"(",
"obj",
",",
"dumper",
"=",
"None",
",",
"*",
"*",
"kwargs",
")",
":",
"if",
"dumper",
"is",
"None",
":",
"dumper",
"=",
"json",
".",
"dumps",
"rv",
"=",
"dumper",
"(",
"obj",
",",
"*",
"*",
"kwargs",
")",
".",
"... | https://github.com/oracle/graaljs/blob/36a56e8e993d45fc40939a3a4d9c0c24990720f1/graal-nodejs/deps/v8/third_party/jinja2/utils.py#L545-L570 | |
krishauser/Klampt | 972cc83ea5befac3f653c1ba20f80155768ad519 | Python/python2_version/klampt/src/robotsim.py | python | GeometricPrimitive.setSegment | (self, a, b) | return _robotsim.GeometricPrimitive_setSegment(self, a, b) | setSegment(GeometricPrimitive self, double const [3] a, double const [3] b) | setSegment(GeometricPrimitive self, double const [3] a, double const [3] b) | [
"setSegment",
"(",
"GeometricPrimitive",
"self",
"double",
"const",
"[",
"3",
"]",
"a",
"double",
"const",
"[",
"3",
"]",
"b",
")"
] | def setSegment(self, a, b):
"""
setSegment(GeometricPrimitive self, double const [3] a, double const [3] b)
"""
return _robotsim.GeometricPrimitive_setSegment(self, a, b) | [
"def",
"setSegment",
"(",
"self",
",",
"a",
",",
"b",
")",
":",
"return",
"_robotsim",
".",
"GeometricPrimitive_setSegment",
"(",
"self",
",",
"a",
",",
"b",
")"
] | https://github.com/krishauser/Klampt/blob/972cc83ea5befac3f653c1ba20f80155768ad519/Python/python2_version/klampt/src/robotsim.py#L1374-L1381 | |
yrnkrn/zapcc | c6a8aa30006d997eff0d60fd37b0e62b8aa0ea50 | tools/clang/tools/scan-build-py/libear/__init__.py | python | execute | (cmd, *args, **kwargs) | return subprocess.check_call(cmd, *args, **kwargs) | Make subprocess execution silent. | Make subprocess execution silent. | [
"Make",
"subprocess",
"execution",
"silent",
"."
] | def execute(cmd, *args, **kwargs):
""" Make subprocess execution silent. """
import subprocess
kwargs.update({'stdout': subprocess.PIPE, 'stderr': subprocess.STDOUT})
return subprocess.check_call(cmd, *args, **kwargs) | [
"def",
"execute",
"(",
"cmd",
",",
"*",
"args",
",",
"*",
"*",
"kwargs",
")",
":",
"import",
"subprocess",
"kwargs",
".",
"update",
"(",
"{",
"'stdout'",
":",
"subprocess",
".",
"PIPE",
",",
"'stderr'",
":",
"subprocess",
".",
"STDOUT",
"}",
")",
"re... | https://github.com/yrnkrn/zapcc/blob/c6a8aa30006d997eff0d60fd37b0e62b8aa0ea50/tools/clang/tools/scan-build-py/libear/__init__.py#L62-L67 | |
ChromiumWebApps/chromium | c7361d39be8abd1574e6ce8957c8dbddd4c6ccf7 | build/android/lighttpd_server.py | python | LighttpdServer.ShutdownHttpServer | (self) | Shuts down our lighttpd processes. | Shuts down our lighttpd processes. | [
"Shuts",
"down",
"our",
"lighttpd",
"processes",
"."
] | def ShutdownHttpServer(self):
"""Shuts down our lighttpd processes."""
if self.process:
self.process.terminate()
shutil.rmtree(self.temp_dir, ignore_errors=True) | [
"def",
"ShutdownHttpServer",
"(",
"self",
")",
":",
"if",
"self",
".",
"process",
":",
"self",
".",
"process",
".",
"terminate",
"(",
")",
"shutil",
".",
"rmtree",
"(",
"self",
".",
"temp_dir",
",",
"ignore_errors",
"=",
"True",
")"
] | https://github.com/ChromiumWebApps/chromium/blob/c7361d39be8abd1574e6ce8957c8dbddd4c6ccf7/build/android/lighttpd_server.py#L112-L116 | ||
wxWidgets/wxPython-Classic | 19571e1ae65f1ac445f5491474121998c97a1bf0 | wx/py/filling.py | python | FillingTree.objHasChildren | (self, obj) | Return true if object has children. | Return true if object has children. | [
"Return",
"true",
"if",
"object",
"has",
"children",
"."
] | def objHasChildren(self, obj):
"""Return true if object has children."""
if self.objGetChildren(obj):
return True
else:
return False | [
"def",
"objHasChildren",
"(",
"self",
",",
"obj",
")",
":",
"if",
"self",
".",
"objGetChildren",
"(",
"obj",
")",
":",
"return",
"True",
"else",
":",
"return",
"False"
] | https://github.com/wxWidgets/wxPython-Classic/blob/19571e1ae65f1ac445f5491474121998c97a1bf0/wx/py/filling.py#L107-L112 | ||
mapnik/mapnik | f3da900c355e1d15059c4a91b00203dcc9d9f0ef | scons/scons-local-4.1.0/SCons/Taskmaster.py | python | Taskmaster._validate_pending_children | (self) | Validate the content of the pending_children set. Assert if an
internal error is found.
This function is used strictly for debugging the taskmaster by
checking that no invariants are violated. It is not used in
normal operation.
The pending_children set is used to detect cycles... | Validate the content of the pending_children set. Assert if an
internal error is found. | [
"Validate",
"the",
"content",
"of",
"the",
"pending_children",
"set",
".",
"Assert",
"if",
"an",
"internal",
"error",
"is",
"found",
"."
] | def _validate_pending_children(self):
"""
Validate the content of the pending_children set. Assert if an
internal error is found.
This function is used strictly for debugging the taskmaster by
checking that no invariants are violated. It is not used in
normal operation.
... | [
"def",
"_validate_pending_children",
"(",
"self",
")",
":",
"for",
"n",
"in",
"self",
".",
"pending_children",
":",
"assert",
"n",
".",
"state",
"in",
"(",
"NODE_PENDING",
",",
"NODE_EXECUTING",
")",
",",
"(",
"str",
"(",
"n",
")",
",",
"StateString",
"[... | https://github.com/mapnik/mapnik/blob/f3da900c355e1d15059c4a91b00203dcc9d9f0ef/scons/scons-local-4.1.0/SCons/Taskmaster.py#L661-L736 | ||
idaholab/moose | 9eeebc65e098b4c30f8205fb41591fd5b61eb6ff | python/chigger/utils/__init__.py | python | animate | (pattern, output, delay=20, restart_delay=500, loop=True) | Runs ImageMagic convert to create an animate gif from a series of images. | Runs ImageMagic convert to create an animate gif from a series of images. | [
"Runs",
"ImageMagic",
"convert",
"to",
"create",
"an",
"animate",
"gif",
"from",
"a",
"series",
"of",
"images",
"."
] | def animate(pattern, output, delay=20, restart_delay=500, loop=True):
"""
Runs ImageMagic convert to create an animate gif from a series of images.
"""
filenames = sorted(glob.glob(pattern))
delay = [delay]*len(filenames)
delay[-1] = restart_delay
cmd = ['convert']
for d, f in zip(delay,... | [
"def",
"animate",
"(",
"pattern",
",",
"output",
",",
"delay",
"=",
"20",
",",
"restart_delay",
"=",
"500",
",",
"loop",
"=",
"True",
")",
":",
"filenames",
"=",
"sorted",
"(",
"glob",
".",
"glob",
"(",
"pattern",
")",
")",
"delay",
"=",
"[",
"dela... | https://github.com/idaholab/moose/blob/9eeebc65e098b4c30f8205fb41591fd5b61eb6ff/python/chigger/utils/__init__.py#L136-L149 | ||
FreeCAD/FreeCAD | ba42231b9c6889b89e064d6d563448ed81e376ec | src/Mod/Arch/ArchBuildingPart.py | python | BuildingPart.getShapes | (self,obj) | return shapes,materialstable | recursively get the shapes of objects inside this BuildingPart | recursively get the shapes of objects inside this BuildingPart | [
"recursively",
"get",
"the",
"shapes",
"of",
"objects",
"inside",
"this",
"BuildingPart"
] | def getShapes(self,obj):
"recursively get the shapes of objects inside this BuildingPart"
shapes = []
solidindex = 0
materialstable = {}
for child in Draft.get_group_contents(obj):
if not Draft.get_type(child) in ["Space"]:
if hasattr(child,'Shape') ... | [
"def",
"getShapes",
"(",
"self",
",",
"obj",
")",
":",
"shapes",
"=",
"[",
"]",
"solidindex",
"=",
"0",
"materialstable",
"=",
"{",
"}",
"for",
"child",
"in",
"Draft",
".",
"get_group_contents",
"(",
"obj",
")",
":",
"if",
"not",
"Draft",
".",
"get_t... | https://github.com/FreeCAD/FreeCAD/blob/ba42231b9c6889b89e064d6d563448ed81e376ec/src/Mod/Arch/ArchBuildingPart.py#L453-L473 | |
miyosuda/TensorFlowAndroidDemo | 35903e0221aa5f109ea2dbef27f20b52e317f42d | jni-build/jni/include/tensorflow/python/ops/ctc_ops.py | python | _CTCLossShape | (op) | return [tensor_shape.vector(batch_size), inputs_shape] | Shape function for the CTCLoss op. | Shape function for the CTCLoss op. | [
"Shape",
"function",
"for",
"the",
"CTCLoss",
"op",
"."
] | def _CTCLossShape(op):
"""Shape function for the CTCLoss op."""
# inputs, label_indices, label_values, sequence_length
inputs_shape = op.inputs[0].get_shape().with_rank(3)
sequence_length_shape = op.inputs[3].get_shape().with_rank(1)
# merge batch_size
sequence_length_shape[0].merge_with(inputs_shape[1])
... | [
"def",
"_CTCLossShape",
"(",
"op",
")",
":",
"# inputs, label_indices, label_values, sequence_length",
"inputs_shape",
"=",
"op",
".",
"inputs",
"[",
"0",
"]",
".",
"get_shape",
"(",
")",
".",
"with_rank",
"(",
"3",
")",
"sequence_length_shape",
"=",
"op",
".",
... | https://github.com/miyosuda/TensorFlowAndroidDemo/blob/35903e0221aa5f109ea2dbef27f20b52e317f42d/jni-build/jni/include/tensorflow/python/ops/ctc_ops.py#L139-L152 | |
smilehao/xlua-framework | a03801538be2b0e92d39332d445b22caca1ef61f | ConfigData/trunk/tools/protobuf-2.5.0/protobuf-2.5.0/python/google/protobuf/internal/encoder.py | python | GroupEncoder | (field_number, is_repeated, is_packed) | Returns an encoder for a group field. | Returns an encoder for a group field. | [
"Returns",
"an",
"encoder",
"for",
"a",
"group",
"field",
"."
] | def GroupEncoder(field_number, is_repeated, is_packed):
"""Returns an encoder for a group field."""
start_tag = TagBytes(field_number, wire_format.WIRETYPE_START_GROUP)
end_tag = TagBytes(field_number, wire_format.WIRETYPE_END_GROUP)
assert not is_packed
if is_repeated:
def EncodeRepeatedField(write, val... | [
"def",
"GroupEncoder",
"(",
"field_number",
",",
"is_repeated",
",",
"is_packed",
")",
":",
"start_tag",
"=",
"TagBytes",
"(",
"field_number",
",",
"wire_format",
".",
"WIRETYPE_START_GROUP",
")",
"end_tag",
"=",
"TagBytes",
"(",
"field_number",
",",
"wire_format"... | https://github.com/smilehao/xlua-framework/blob/a03801538be2b0e92d39332d445b22caca1ef61f/ConfigData/trunk/tools/protobuf-2.5.0/protobuf-2.5.0/python/google/protobuf/internal/encoder.py#L698-L716 | ||
aws/lumberyard | f85344403c1c2e77ec8c75deb2c116e97b713217 | dev/Tools/build/waf-1.7.13/waflib/Tools/glib2.py | python | add_enums_from_template | (self, source='', target='', template='', comments='') | Add a file to the list of enum files to process. Store them in the attribute *enums_list*.
:param source: enum file to process
:type source: string
:param target: target file
:type target: string
:param template: template file
:type template: string
:param comments: comments
:type comments: string | Add a file to the list of enum files to process. Store them in the attribute *enums_list*. | [
"Add",
"a",
"file",
"to",
"the",
"list",
"of",
"enum",
"files",
"to",
"process",
".",
"Store",
"them",
"in",
"the",
"attribute",
"*",
"enums_list",
"*",
"."
] | def add_enums_from_template(self, source='', target='', template='', comments=''):
"""
Add a file to the list of enum files to process. Store them in the attribute *enums_list*.
:param source: enum file to process
:type source: string
:param target: target file
:type target: string
:param template: template fil... | [
"def",
"add_enums_from_template",
"(",
"self",
",",
"source",
"=",
"''",
",",
"target",
"=",
"''",
",",
"template",
"=",
"''",
",",
"comments",
"=",
"''",
")",
":",
"if",
"not",
"hasattr",
"(",
"self",
",",
"'enums_list'",
")",
":",
"self",
".",
"enu... | https://github.com/aws/lumberyard/blob/f85344403c1c2e77ec8c75deb2c116e97b713217/dev/Tools/build/waf-1.7.13/waflib/Tools/glib2.py#L90-L116 | ||
pytorch/pytorch | 7176c92687d3cc847cc046bf002269c6949a21c2 | torch/jit/mobile/__init__.py | python | _get_model_bytecode_version | (f_input) | r"""
Args:
f_input: a file-like object (has to implement read, readline, tell, and seek),
or a string containing a file name
Returns:
version: An integer. If the integer is -1, the version is invalid. A warning
will show in the log.
Example:
.. testcode::
... | r"""
Args:
f_input: a file-like object (has to implement read, readline, tell, and seek),
or a string containing a file name | [
"r",
"Args",
":",
"f_input",
":",
"a",
"file",
"-",
"like",
"object",
"(",
"has",
"to",
"implement",
"read",
"readline",
"tell",
"and",
"seek",
")",
"or",
"a",
"string",
"containing",
"a",
"file",
"name"
] | def _get_model_bytecode_version(f_input) -> int:
r"""
Args:
f_input: a file-like object (has to implement read, readline, tell, and seek),
or a string containing a file name
Returns:
version: An integer. If the integer is -1, the version is invalid. A warning
will sh... | [
"def",
"_get_model_bytecode_version",
"(",
"f_input",
")",
"->",
"int",
":",
"if",
"isinstance",
"(",
"f_input",
",",
"str",
")",
":",
"if",
"not",
"os",
".",
"path",
".",
"exists",
"(",
"f_input",
")",
":",
"raise",
"ValueError",
"(",
"f\"The provided fil... | https://github.com/pytorch/pytorch/blob/7176c92687d3cc847cc046bf002269c6949a21c2/torch/jit/mobile/__init__.py#L78-L107 | ||
Kitware/ParaView | f760af9124ff4634b23ebbeab95a4f56e0261955 | ThirdParty/cinema/paraview/tpl/cinema_python/database/store.py | python | make_field | (name, _values, **kwargs) | return properties | specialization of make_parameters for parameters that define fields
(aka color inputs). In this case the values is a list of name, type pairs
where types must be one of 'rgb', 'lut', 'depth', 'value', or 'luminance'
May also be given an set of valueRanges, which have min and max values for
named 'value'... | specialization of make_parameters for parameters that define fields
(aka color inputs). In this case the values is a list of name, type pairs
where types must be one of 'rgb', 'lut', 'depth', 'value', or 'luminance'
May also be given an set of valueRanges, which have min and max values for
named 'value'... | [
"specialization",
"of",
"make_parameters",
"for",
"parameters",
"that",
"define",
"fields",
"(",
"aka",
"color",
"inputs",
")",
".",
"In",
"this",
"case",
"the",
"values",
"is",
"a",
"list",
"of",
"name",
"type",
"pairs",
"where",
"types",
"must",
"be",
"o... | def make_field(name, _values, **kwargs):
"""
specialization of make_parameters for parameters that define fields
(aka color inputs). In this case the values is a list of name, type pairs
where types must be one of 'rgb', 'lut', 'depth', 'value', or 'luminance'
May also be given an set of valueRanges... | [
"def",
"make_field",
"(",
"name",
",",
"_values",
",",
"*",
"*",
"kwargs",
")",
":",
"values",
"=",
"list",
"(",
"_values",
".",
"keys",
"(",
")",
")",
"img_types",
"=",
"list",
"(",
"_values",
".",
"values",
"(",
")",
")",
"valid_itypes",
"=",
"["... | https://github.com/Kitware/ParaView/blob/f760af9124ff4634b23ebbeab95a4f56e0261955/ThirdParty/cinema/paraview/tpl/cinema_python/database/store.py#L655-L690 | |
hanpfei/chromium-net | 392cc1fa3a8f92f42e4071ab6e674d8e0482f83f | third_party/catapult/third_party/webapp2/webapp2_extras/routes.py | python | PathPrefixRoute.__init__ | (self, prefix, routes) | Initializes a URL route.
:param prefix:
The prefix to be prepended. It must start with a slash but not
end with a slash.
:param routes:
A list of :class:`webapp2.Route` instances. | Initializes a URL route. | [
"Initializes",
"a",
"URL",
"route",
"."
] | def __init__(self, prefix, routes):
"""Initializes a URL route.
:param prefix:
The prefix to be prepended. It must start with a slash but not
end with a slash.
:param routes:
A list of :class:`webapp2.Route` instances.
"""
assert prefix.starts... | [
"def",
"__init__",
"(",
"self",
",",
"prefix",
",",
"routes",
")",
":",
"assert",
"prefix",
".",
"startswith",
"(",
"'/'",
")",
"and",
"not",
"prefix",
".",
"endswith",
"(",
"'/'",
")",
",",
"'Path prefixes must start with a slash but not end with a slash.'",
"s... | https://github.com/hanpfei/chromium-net/blob/392cc1fa3a8f92f42e4071ab6e674d8e0482f83f/third_party/catapult/third_party/webapp2/webapp2_extras/routes.py#L196-L207 | ||
aws/lumberyard | f85344403c1c2e77ec8c75deb2c116e97b713217 | dev/Tools/Python/3.7.10/linux_x64/lib/python3.7/site-packages/s3transfer/delete.py | python | DeleteObjectTask._main | (self, client, bucket, key, extra_args) | :param client: The S3 client to use when calling DeleteObject
:type bucket: str
:param bucket: The name of the bucket.
:type key: str
:param key: The name of the object to delete.
:type extra_args: dict
:param extra_args: Extra arguments to pass to the DeleteObject cal... | [] | def _main(self, client, bucket, key, extra_args):
"""
:param client: The S3 client to use when calling DeleteObject
:type bucket: str
:param bucket: The name of the bucket.
:type key: str
:param key: The name of the object to delete.
:type extra_args: dict
... | [
"def",
"_main",
"(",
"self",
",",
"client",
",",
"bucket",
",",
"key",
",",
"extra_args",
")",
":",
"client",
".",
"delete_object",
"(",
"Bucket",
"=",
"bucket",
",",
"Key",
"=",
"key",
",",
"*",
"*",
"extra_args",
")"
] | https://github.com/aws/lumberyard/blob/f85344403c1c2e77ec8c75deb2c116e97b713217/dev/Tools/Python/3.7.10/linux_x64/lib/python3.7/site-packages/s3transfer/delete.py#L57-L72 | |||
wxWidgets/wxPython-Classic | 19571e1ae65f1ac445f5491474121998c97a1bf0 | src/msw/aui.py | python | AuiToolBarItem.GetId | (*args, **kwargs) | return _aui.AuiToolBarItem_GetId(*args, **kwargs) | GetId(self) -> int | GetId(self) -> int | [
"GetId",
"(",
"self",
")",
"-",
">",
"int"
] | def GetId(*args, **kwargs):
"""GetId(self) -> int"""
return _aui.AuiToolBarItem_GetId(*args, **kwargs) | [
"def",
"GetId",
"(",
"*",
"args",
",",
"*",
"*",
"kwargs",
")",
":",
"return",
"_aui",
".",
"AuiToolBarItem_GetId",
"(",
"*",
"args",
",",
"*",
"*",
"kwargs",
")"
] | https://github.com/wxWidgets/wxPython-Classic/blob/19571e1ae65f1ac445f5491474121998c97a1bf0/src/msw/aui.py#L1741-L1743 | |
mantidproject/mantid | 03deeb89254ec4289edb8771e0188c2090a02f32 | scripts/abins/abinsalgorithm.py | python | AbinsAlgorithm._validate_gaussian_input_file | (cls, filename_full_path: str) | return cls._validate_ab_initio_file_extension(ab_initio_program="GAUSSIAN",
filename_full_path=filename_full_path,
expected_file_extension=".log") | Method to validate input file for GAUSSIAN ab initio program.
:param filename_full_path: full path of a file to check.
:returns: True if file is valid otherwise false. | Method to validate input file for GAUSSIAN ab initio program.
:param filename_full_path: full path of a file to check.
:returns: True if file is valid otherwise false. | [
"Method",
"to",
"validate",
"input",
"file",
"for",
"GAUSSIAN",
"ab",
"initio",
"program",
".",
":",
"param",
"filename_full_path",
":",
"full",
"path",
"of",
"a",
"file",
"to",
"check",
".",
":",
"returns",
":",
"True",
"if",
"file",
"is",
"valid",
"oth... | def _validate_gaussian_input_file(cls, filename_full_path: str) -> dict:
"""
Method to validate input file for GAUSSIAN ab initio program.
:param filename_full_path: full path of a file to check.
:returns: True if file is valid otherwise false.
"""
logger.information("Val... | [
"def",
"_validate_gaussian_input_file",
"(",
"cls",
",",
"filename_full_path",
":",
"str",
")",
"->",
"dict",
":",
"logger",
".",
"information",
"(",
"\"Validate GAUSSIAN file with vibration data.\"",
")",
"return",
"cls",
".",
"_validate_ab_initio_file_extension",
"(",
... | https://github.com/mantidproject/mantid/blob/03deeb89254ec4289edb8771e0188c2090a02f32/scripts/abins/abinsalgorithm.py#L658-L667 | |
aws/lumberyard | f85344403c1c2e77ec8c75deb2c116e97b713217 | dev/Gems/CloudGemMetric/v1/AWS/python/windows/Lib/pandas/core/util/hashing.py | python | _combine_hash_arrays | (arrays, num_items: int) | return out | Parameters
----------
arrays : generator
num_items : int
Should be the same as CPython's tupleobject.c | Parameters
----------
arrays : generator
num_items : int | [
"Parameters",
"----------",
"arrays",
":",
"generator",
"num_items",
":",
"int"
] | def _combine_hash_arrays(arrays, num_items: int):
"""
Parameters
----------
arrays : generator
num_items : int
Should be the same as CPython's tupleobject.c
"""
try:
first = next(arrays)
except StopIteration:
return np.array([], dtype=np.uint64)
arrays = itertoo... | [
"def",
"_combine_hash_arrays",
"(",
"arrays",
",",
"num_items",
":",
"int",
")",
":",
"try",
":",
"first",
"=",
"next",
"(",
"arrays",
")",
"except",
"StopIteration",
":",
"return",
"np",
".",
"array",
"(",
"[",
"]",
",",
"dtype",
"=",
"np",
".",
"ui... | https://github.com/aws/lumberyard/blob/f85344403c1c2e77ec8c75deb2c116e97b713217/dev/Gems/CloudGemMetric/v1/AWS/python/windows/Lib/pandas/core/util/hashing.py#L30-L55 | |
natanielruiz/android-yolo | 1ebb54f96a67a20ff83ddfc823ed83a13dc3a47f | jni-build/jni/include/external/bazel_tools/tools/build_defs/docker/create_image_config.py | python | DeepCopySkipNull | (data) | return copy.deepcopy(data) | Do a deep copy, skipping null entry. | Do a deep copy, skipping null entry. | [
"Do",
"a",
"deep",
"copy",
"skipping",
"null",
"entry",
"."
] | def DeepCopySkipNull(data):
"""Do a deep copy, skipping null entry."""
if isinstance(data, dict):
return dict((DeepCopySkipNull(k), DeepCopySkipNull(v))
for k, v in data.iteritems() if v is not None)
return copy.deepcopy(data) | [
"def",
"DeepCopySkipNull",
"(",
"data",
")",
":",
"if",
"isinstance",
"(",
"data",
",",
"dict",
")",
":",
"return",
"dict",
"(",
"(",
"DeepCopySkipNull",
"(",
"k",
")",
",",
"DeepCopySkipNull",
"(",
"v",
")",
")",
"for",
"k",
",",
"v",
"in",
"data",
... | https://github.com/natanielruiz/android-yolo/blob/1ebb54f96a67a20ff83ddfc823ed83a13dc3a47f/jni-build/jni/include/external/bazel_tools/tools/build_defs/docker/create_image_config.py#L99-L104 | |
namecoin/namecoin-legacy | b043fba28018721b68c90edfc81b9eacb070b47d | client/DNS/lazy.py | python | revlookup | (name) | convenience routine for doing a reverse lookup of an address | convenience routine for doing a reverse lookup of an address | [
"convenience",
"routine",
"for",
"doing",
"a",
"reverse",
"lookup",
"of",
"an",
"address"
] | def revlookup(name):
"convenience routine for doing a reverse lookup of an address"
if Base.defaults['server'] == []: Base.DiscoverNameServers()
a = string.split(name, '.')
a.reverse()
b = string.join(a, '.')+'.in-addr.arpa'
# this will only return one of any records returned.
result = Base.... | [
"def",
"revlookup",
"(",
"name",
")",
":",
"if",
"Base",
".",
"defaults",
"[",
"'server'",
"]",
"==",
"[",
"]",
":",
"Base",
".",
"DiscoverNameServers",
"(",
")",
"a",
"=",
"string",
".",
"split",
"(",
"name",
",",
"'.'",
")",
"a",
".",
"reverse",
... | https://github.com/namecoin/namecoin-legacy/blob/b043fba28018721b68c90edfc81b9eacb070b47d/client/DNS/lazy.py#L16-L29 | ||
nasa/fprime | 595cf3682d8365943d86c1a6fe7c78f0a116acf0 | Autocoders/Python/src/fprime_ac/generators/DictStart.py | python | DictStart.addVisitor | (self, visitor) | Add a visitor to the list of visitors.
@param visitor: the visitor to add, must be derived from AbstractVisitor. | Add a visitor to the list of visitors. | [
"Add",
"a",
"visitor",
"to",
"the",
"list",
"of",
"visitors",
"."
] | def addVisitor(self, visitor):
"""
Add a visitor to the list of visitors.
@param visitor: the visitor to add, must be derived from AbstractVisitor.
"""
if issubclass(visitor.__class__, AbstractVisitor.AbstractVisitor):
self.__visitor_list.append(visitor)
else:... | [
"def",
"addVisitor",
"(",
"self",
",",
"visitor",
")",
":",
"if",
"issubclass",
"(",
"visitor",
".",
"__class__",
",",
"AbstractVisitor",
".",
"AbstractVisitor",
")",
":",
"self",
".",
"__visitor_list",
".",
"append",
"(",
"visitor",
")",
"else",
":",
"DEB... | https://github.com/nasa/fprime/blob/595cf3682d8365943d86c1a6fe7c78f0a116acf0/Autocoders/Python/src/fprime_ac/generators/DictStart.py#L86-L99 | ||
google/syzygy | 8164b24ebde9c5649c9a09e88a7fc0b0fcbd1bc5 | third_party/numpy/files/numpy/oldnumeric/ma.py | python | MaskedArray.__xor__ | (self, other) | return bitwise_xor(self, other) | Return bitwise_xor | Return bitwise_xor | [
"Return",
"bitwise_xor"
] | def __xor__(self, other):
"Return bitwise_xor"
return bitwise_xor(self, other) | [
"def",
"__xor__",
"(",
"self",
",",
"other",
")",
":",
"return",
"bitwise_xor",
"(",
"self",
",",
"other",
")"
] | https://github.com/google/syzygy/blob/8164b24ebde9c5649c9a09e88a7fc0b0fcbd1bc5/third_party/numpy/files/numpy/oldnumeric/ma.py#L879-L881 | |
y123456yz/reading-and-annotate-mongodb-3.6 | 93280293672ca7586dc24af18132aa61e4ed7fcf | mongo/buildscripts/clang_format.py | python | ClangFormat._validate_version | (self) | return False | Validate clang-format is the expected version | Validate clang-format is the expected version | [
"Validate",
"clang",
"-",
"format",
"is",
"the",
"expected",
"version"
] | def _validate_version(self):
"""Validate clang-format is the expected version
"""
cf_version = callo([self.path, "--version"])
if CLANG_FORMAT_VERSION in cf_version:
return True
print("WARNING: clang-format found in path, but incorrect version found at " +
... | [
"def",
"_validate_version",
"(",
"self",
")",
":",
"cf_version",
"=",
"callo",
"(",
"[",
"self",
".",
"path",
",",
"\"--version\"",
"]",
")",
"if",
"CLANG_FORMAT_VERSION",
"in",
"cf_version",
":",
"return",
"True",
"print",
"(",
"\"WARNING: clang-format found in... | https://github.com/y123456yz/reading-and-annotate-mongodb-3.6/blob/93280293672ca7586dc24af18132aa61e4ed7fcf/mongo/buildscripts/clang_format.py#L215-L226 | |
wlanjie/AndroidFFmpeg | 7baf9122f4b8e1c74e7baf4be5c422c7a5ba5aaf | tools/fdk-aac-build/x86/toolchain/lib/python2.7/lib2to3/refactor.py | python | RefactoringTool._read_python_source | (self, filename) | Do our best to decode a Python source file correctly. | Do our best to decode a Python source file correctly. | [
"Do",
"our",
"best",
"to",
"decode",
"a",
"Python",
"source",
"file",
"correctly",
"."
] | def _read_python_source(self, filename):
"""
Do our best to decode a Python source file correctly.
"""
try:
f = open(filename, "rb")
except IOError as err:
self.log_error("Can't open %s: %s", filename, err)
return None, None
try:
... | [
"def",
"_read_python_source",
"(",
"self",
",",
"filename",
")",
":",
"try",
":",
"f",
"=",
"open",
"(",
"filename",
",",
"\"rb\"",
")",
"except",
"IOError",
"as",
"err",
":",
"self",
".",
"log_error",
"(",
"\"Can't open %s: %s\"",
",",
"filename",
",",
... | https://github.com/wlanjie/AndroidFFmpeg/blob/7baf9122f4b8e1c74e7baf4be5c422c7a5ba5aaf/tools/fdk-aac-build/x86/toolchain/lib/python2.7/lib2to3/refactor.py#L323-L337 | ||
miyosuda/TensorFlowAndroidMNIST | 7b5a4603d2780a8a2834575706e9001977524007 | jni-build/jni/include/tensorflow/models/image/imagenet/classify_image.py | python | maybe_download_and_extract | () | Download and extract model tar file. | Download and extract model tar file. | [
"Download",
"and",
"extract",
"model",
"tar",
"file",
"."
] | def maybe_download_and_extract():
"""Download and extract model tar file."""
dest_directory = FLAGS.model_dir
if not os.path.exists(dest_directory):
os.makedirs(dest_directory)
filename = DATA_URL.split('/')[-1]
filepath = os.path.join(dest_directory, filename)
if not os.path.exists(filepath):
def _... | [
"def",
"maybe_download_and_extract",
"(",
")",
":",
"dest_directory",
"=",
"FLAGS",
".",
"model_dir",
"if",
"not",
"os",
".",
"path",
".",
"exists",
"(",
"dest_directory",
")",
":",
"os",
".",
"makedirs",
"(",
"dest_directory",
")",
"filename",
"=",
"DATA_UR... | https://github.com/miyosuda/TensorFlowAndroidMNIST/blob/7b5a4603d2780a8a2834575706e9001977524007/jni-build/jni/include/tensorflow/models/image/imagenet/classify_image.py#L185-L201 | ||
intel-iot-devkit/how-to-code-samples | b4ea616f36bbfa2e042beb1698f968cfd651d79f | fire-alarm/python/iot_fire_alarm/hardware/board.py | python | Board.trigger_hardware_event | (self, event, *args, **kwargs) | Signal hardware event. | Signal hardware event. | [
"Signal",
"hardware",
"event",
"."
] | def trigger_hardware_event(self, event, *args, **kwargs):
"""
Signal hardware event.
"""
self.emitter.emit(event, *args, **kwargs) | [
"def",
"trigger_hardware_event",
"(",
"self",
",",
"event",
",",
"*",
"args",
",",
"*",
"*",
"kwargs",
")",
":",
"self",
".",
"emitter",
".",
"emit",
"(",
"event",
",",
"*",
"args",
",",
"*",
"*",
"kwargs",
")"
] | https://github.com/intel-iot-devkit/how-to-code-samples/blob/b4ea616f36bbfa2e042beb1698f968cfd651d79f/fire-alarm/python/iot_fire_alarm/hardware/board.py#L67-L73 | ||
mantidproject/mantid | 03deeb89254ec4289edb8771e0188c2090a02f32 | qt/python/mantidqtinterfaces/mantidqtinterfaces/PyChop/ISISDisk.py | python | ISISDisk.getResFlux | (self, Etrans=None, Ei_in=None, frequency=None) | return self.getResolution(Etrans, Ei_in, frequency), self.getFlux(Ei_in, frequency) | Returns the resolution and flux at a given Ei as a tuple | Returns the resolution and flux at a given Ei as a tuple | [
"Returns",
"the",
"resolution",
"and",
"flux",
"at",
"a",
"given",
"Ei",
"as",
"a",
"tuple"
] | def getResFlux(self, Etrans=None, Ei_in=None, frequency=None):
"""
Returns the resolution and flux at a given Ei as a tuple
"""
return self.getResolution(Etrans, Ei_in, frequency), self.getFlux(Ei_in, frequency) | [
"def",
"getResFlux",
"(",
"self",
",",
"Etrans",
"=",
"None",
",",
"Ei_in",
"=",
"None",
",",
"frequency",
"=",
"None",
")",
":",
"return",
"self",
".",
"getResolution",
"(",
"Etrans",
",",
"Ei_in",
",",
"frequency",
")",
",",
"self",
".",
"getFlux",
... | https://github.com/mantidproject/mantid/blob/03deeb89254ec4289edb8771e0188c2090a02f32/qt/python/mantidqtinterfaces/mantidqtinterfaces/PyChop/ISISDisk.py#L372-L376 | |
kamyu104/LeetCode-Solutions | 77605708a927ea3b85aee5a479db733938c7c211 | Python/find-unique-binary-string.py | python | Solution2.findDifferentBinaryString | (self, nums) | return next(bin(i)[2:].zfill(len(nums[0])) for i in xrange(2**len(nums[0])) if i not in lookup) | :type nums: List[str]
:rtype: str | :type nums: List[str]
:rtype: str | [
":",
"type",
"nums",
":",
"List",
"[",
"str",
"]",
":",
"rtype",
":",
"str"
] | def findDifferentBinaryString(self, nums):
"""
:type nums: List[str]
:rtype: str
"""
lookup = set(map(lambda x: int(x, 2), nums)) # Time: O(k * n) = O(n^2)
return next(bin(i)[2:].zfill(len(nums[0])) for i in xrange(2**len(nums[0])) if i not in lookup) | [
"def",
"findDifferentBinaryString",
"(",
"self",
",",
"nums",
")",
":",
"lookup",
"=",
"set",
"(",
"map",
"(",
"lambda",
"x",
":",
"int",
"(",
"x",
",",
"2",
")",
",",
"nums",
")",
")",
"# Time: O(k * n) = O(n^2)",
"return",
"next",
"(",
"bin",
"(",
... | https://github.com/kamyu104/LeetCode-Solutions/blob/77605708a927ea3b85aee5a479db733938c7c211/Python/find-unique-binary-string.py#L17-L23 | |
mongodb/mongo | d8ff665343ad29cf286ee2cf4a1960d29371937b | buildscripts/resmokelib/symbolizer/__init__.py | python | SymbolizerPlugin.add_subcommand | (self, subparsers) | Add 'symbolize' subcommand.
:param subparsers: argparse parser to add to
:return: None | Add 'symbolize' subcommand. | [
"Add",
"symbolize",
"subcommand",
"."
] | def add_subcommand(self, subparsers):
"""
Add 'symbolize' subcommand.
:param subparsers: argparse parser to add to
:return: None
"""
parser = subparsers.add_parser(_COMMAND, help=_HELP)
parser.add_argument(
"--task-id", '-t', action="store", type=str,... | [
"def",
"add_subcommand",
"(",
"self",
",",
"subparsers",
")",
":",
"parser",
"=",
"subparsers",
".",
"add_parser",
"(",
"_COMMAND",
",",
"help",
"=",
"_HELP",
")",
"parser",
".",
"add_argument",
"(",
"\"--task-id\"",
",",
"'-t'",
",",
"action",
"=",
"\"sto... | https://github.com/mongodb/mongo/blob/d8ff665343ad29cf286ee2cf4a1960d29371937b/buildscripts/resmokelib/symbolizer/__init__.py#L208-L233 | ||
ChromiumWebApps/chromium | c7361d39be8abd1574e6ce8957c8dbddd4c6ccf7 | tools/perf/metrics/v8_object_stats.py | python | V8ObjectStatsMetric.Stop | (self, page, tab) | Get the values in the stats table after the page is loaded. | Get the values in the stats table after the page is loaded. | [
"Get",
"the",
"values",
"in",
"the",
"stats",
"table",
"after",
"the",
"page",
"is",
"loaded",
"."
] | def Stop(self, page, tab):
"""Get the values in the stats table after the page is loaded."""
self._results = V8ObjectStatsMetric.GetV8StatsTable(tab, self._counters)
if not self._results:
logging.warning('No V8 object stats from website: ' + page.display_name) | [
"def",
"Stop",
"(",
"self",
",",
"page",
",",
"tab",
")",
":",
"self",
".",
"_results",
"=",
"V8ObjectStatsMetric",
".",
"GetV8StatsTable",
"(",
"tab",
",",
"self",
".",
"_counters",
")",
"if",
"not",
"self",
".",
"_results",
":",
"logging",
".",
"warn... | https://github.com/ChromiumWebApps/chromium/blob/c7361d39be8abd1574e6ce8957c8dbddd4c6ccf7/tools/perf/metrics/v8_object_stats.py#L205-L209 | ||
hanpfei/chromium-net | 392cc1fa3a8f92f42e4071ab6e674d8e0482f83f | third_party/protobuf/python/google/protobuf/text_format.py | python | _Tokenizer.Consume | (self, token) | Consumes a piece of text.
Args:
token: Text to consume.
Raises:
ParseError: If the text couldn't be consumed. | Consumes a piece of text. | [
"Consumes",
"a",
"piece",
"of",
"text",
"."
] | def Consume(self, token):
"""Consumes a piece of text.
Args:
token: Text to consume.
Raises:
ParseError: If the text couldn't be consumed.
"""
if not self.TryConsume(token):
raise self._ParseError('Expected "%s".' % token) | [
"def",
"Consume",
"(",
"self",
",",
"token",
")",
":",
"if",
"not",
"self",
".",
"TryConsume",
"(",
"token",
")",
":",
"raise",
"self",
".",
"_ParseError",
"(",
"'Expected \"%s\".'",
"%",
"token",
")"
] | https://github.com/hanpfei/chromium-net/blob/392cc1fa3a8f92f42e4071ab6e674d8e0482f83f/third_party/protobuf/python/google/protobuf/text_format.py#L841-L851 | ||
apache/incubator-mxnet | f03fb23f1d103fec9541b5ae59ee06b1734a51d9 | python/mxnet/ndarray/ndarray.py | python | NDArray.__div__ | (self, other) | return divide(self, other) | x.__div__(y) <=> x/y <=> mx.nd.divide(x, y) | x.__div__(y) <=> x/y <=> mx.nd.divide(x, y) | [
"x",
".",
"__div__",
"(",
"y",
")",
"<",
"=",
">",
"x",
"/",
"y",
"<",
"=",
">",
"mx",
".",
"nd",
".",
"divide",
"(",
"x",
"y",
")"
] | def __div__(self, other):
"""x.__div__(y) <=> x/y <=> mx.nd.divide(x, y) """
return divide(self, other) | [
"def",
"__div__",
"(",
"self",
",",
"other",
")",
":",
"return",
"divide",
"(",
"self",
",",
"other",
")"
] | https://github.com/apache/incubator-mxnet/blob/f03fb23f1d103fec9541b5ae59ee06b1734a51d9/python/mxnet/ndarray/ndarray.py#L366-L368 | |
aws/lumberyard | f85344403c1c2e77ec8c75deb2c116e97b713217 | dev/Tools/Python/3.7.10/windows/Lib/site-packages/pip/_internal/index/package_finder.py | python | PackageFinder.find_all_candidates | (self, project_name) | return file_versions + find_links_versions + page_versions | Find all available InstallationCandidate for project_name
This checks index_urls and find_links.
All versions found are returned as an InstallationCandidate list.
See LinkEvaluator.evaluate_link() for details on which files
are accepted. | Find all available InstallationCandidate for project_name | [
"Find",
"all",
"available",
"InstallationCandidate",
"for",
"project_name"
] | def find_all_candidates(self, project_name):
# type: (str) -> List[InstallationCandidate]
"""Find all available InstallationCandidate for project_name
This checks index_urls and find_links.
All versions found are returned as an InstallationCandidate list.
See LinkEvaluator.eval... | [
"def",
"find_all_candidates",
"(",
"self",
",",
"project_name",
")",
":",
"# type: (str) -> List[InstallationCandidate]",
"collected_links",
"=",
"self",
".",
"_link_collector",
".",
"collect_links",
"(",
"project_name",
")",
"link_evaluator",
"=",
"self",
".",
"make_li... | https://github.com/aws/lumberyard/blob/f85344403c1c2e77ec8c75deb2c116e97b713217/dev/Tools/Python/3.7.10/windows/Lib/site-packages/pip/_internal/index/package_finder.py#L794-L835 | |
mongodb/mongo | d8ff665343ad29cf286ee2cf4a1960d29371937b | buildscripts/idl/idl_compatibility_errors.py | python | IDLCompatibilityContext.add_new_command_or_param_type_bson_any_error | (self, command_name: str, new_type: str,
file: str, field_name: Optional[str],
is_command_parameter: bool) | Add an error about BSON serialization type.
Add an error about the new command or command parameter type's
bson serialization type being of type 'any' when the old type is non-any or
when it is not explicitly allowed. | Add an error about BSON serialization type. | [
"Add",
"an",
"error",
"about",
"BSON",
"serialization",
"type",
"."
] | def add_new_command_or_param_type_bson_any_error(self, command_name: str, new_type: str,
file: str, field_name: Optional[str],
is_command_parameter: bool) -> None:
# pylint: disable=too-many-arguments
... | [
"def",
"add_new_command_or_param_type_bson_any_error",
"(",
"self",
",",
"command_name",
":",
"str",
",",
"new_type",
":",
"str",
",",
"file",
":",
"str",
",",
"field_name",
":",
"Optional",
"[",
"str",
"]",
",",
"is_command_parameter",
":",
"bool",
")",
"->",... | https://github.com/mongodb/mongo/blob/d8ff665343ad29cf286ee2cf4a1960d29371937b/buildscripts/idl/idl_compatibility_errors.py#L373-L394 | ||
tensorflow/tensorflow | 419e3a6b650ea4bd1b0cba23c4348f8a69f3272e | tensorflow/python/ops/ragged/ragged_math_ops.py | python | _infer_matching_dtype | (tensors, dtype_hierarchy) | return [math_ops.cast(t, inferred_dtype) for t in tensors] | Infers a matching dtype for tensors, and casts them to that dtype. | Infers a matching dtype for tensors, and casts them to that dtype. | [
"Infers",
"a",
"matching",
"dtype",
"for",
"tensors",
"and",
"casts",
"them",
"to",
"that",
"dtype",
"."
] | def _infer_matching_dtype(tensors, dtype_hierarchy):
"""Infers a matching dtype for tensors, and casts them to that dtype."""
assert all(t.dtype in dtype_hierarchy for t in tensors)
inferred_dtype = max([t.dtype for t in tensors], key=dtype_hierarchy.index)
return [math_ops.cast(t, inferred_dtype) for t in tens... | [
"def",
"_infer_matching_dtype",
"(",
"tensors",
",",
"dtype_hierarchy",
")",
":",
"assert",
"all",
"(",
"t",
".",
"dtype",
"in",
"dtype_hierarchy",
"for",
"t",
"in",
"tensors",
")",
"inferred_dtype",
"=",
"max",
"(",
"[",
"t",
".",
"dtype",
"for",
"t",
"... | https://github.com/tensorflow/tensorflow/blob/419e3a6b650ea4bd1b0cba23c4348f8a69f3272e/tensorflow/python/ops/ragged/ragged_math_ops.py#L115-L119 | |
miyosuda/TensorFlowAndroidMNIST | 7b5a4603d2780a8a2834575706e9001977524007 | jni-build/jni/include/tensorflow/python/ops/math_grad.py | python | _MeanGrad | (op, grad) | return sum_grad / math_ops.cast(factor, sum_grad.dtype), None | Gradient for Mean. | Gradient for Mean. | [
"Gradient",
"for",
"Mean",
"."
] | def _MeanGrad(op, grad):
"""Gradient for Mean."""
sum_grad = _SumGrad(op, grad)[0]
input_shape = array_ops.shape(op.inputs[0])
output_shape = array_ops.shape(op.outputs[0])
factor = _safe_shape_div(math_ops.reduce_prod(input_shape),
math_ops.reduce_prod(output_shape))
return sum_g... | [
"def",
"_MeanGrad",
"(",
"op",
",",
"grad",
")",
":",
"sum_grad",
"=",
"_SumGrad",
"(",
"op",
",",
"grad",
")",
"[",
"0",
"]",
"input_shape",
"=",
"array_ops",
".",
"shape",
"(",
"op",
".",
"inputs",
"[",
"0",
"]",
")",
"output_shape",
"=",
"array_... | https://github.com/miyosuda/TensorFlowAndroidMNIST/blob/7b5a4603d2780a8a2834575706e9001977524007/jni-build/jni/include/tensorflow/python/ops/math_grad.py#L99-L106 | |
wxWidgets/wxPython-Classic | 19571e1ae65f1ac445f5491474121998c97a1bf0 | src/gtk/dataview.py | python | DataViewRenderer.DisableEllipsize | (*args, **kwargs) | return _dataview.DataViewRenderer_DisableEllipsize(*args, **kwargs) | DisableEllipsize(self) | DisableEllipsize(self) | [
"DisableEllipsize",
"(",
"self",
")"
] | def DisableEllipsize(*args, **kwargs):
"""DisableEllipsize(self)"""
return _dataview.DataViewRenderer_DisableEllipsize(*args, **kwargs) | [
"def",
"DisableEllipsize",
"(",
"*",
"args",
",",
"*",
"*",
"kwargs",
")",
":",
"return",
"_dataview",
".",
"DataViewRenderer_DisableEllipsize",
"(",
"*",
"args",
",",
"*",
"*",
"kwargs",
")"
] | https://github.com/wxWidgets/wxPython-Classic/blob/19571e1ae65f1ac445f5491474121998c97a1bf0/src/gtk/dataview.py#L1188-L1190 | |
apache/trafodion | 8455c839ad6b6d7b6e04edda5715053095b78046 | core/sqf/src/seatrans/hbase-trx/src/main/python/thrift1/gen-py/hbase/Hbase.py | python | Iface.scannerClose | (self, id) | Closes the server-state associated with an open scanner.
@throws IllegalArgument if ScannerID is invalid
Parameters:
- id: id of a scanner returned by scannerOpen | Closes the server-state associated with an open scanner. | [
"Closes",
"the",
"server",
"-",
"state",
"associated",
"with",
"an",
"open",
"scanner",
"."
] | def scannerClose(self, id):
"""
Closes the server-state associated with an open scanner.
@throws IllegalArgument if ScannerID is invalid
Parameters:
- id: id of a scanner returned by scannerOpen
"""
pass | [
"def",
"scannerClose",
"(",
"self",
",",
"id",
")",
":",
"pass"
] | https://github.com/apache/trafodion/blob/8455c839ad6b6d7b6e04edda5715053095b78046/core/sqf/src/seatrans/hbase-trx/src/main/python/thrift1/gen-py/hbase/Hbase.py#L578-L587 | ||
google/earthenterprise | 0fe84e29be470cd857e3a0e52e5d0afd5bb8cee9 | earth_enterprise/src/server/wsgi/wms/ogc/common/tiles.py | python | _PasteTile | (im_dest, im_src, box) | Copy the image.
Args:
im_dest: Destination of the image to be copied.
im_src: Source image to be copied.
box: the dimentions of the image. | Copy the image. | [
"Copy",
"the",
"image",
"."
] | def _PasteTile(im_dest, im_src, box):
"""Copy the image.
Args:
im_dest: Destination of the image to be copied.
im_src: Source image to be copied.
box: the dimentions of the image.
"""
try:
im_dest.paste(im_src, box)
except ValueError, e:
logger.error("Failed to paste:%s", str(e.args... | [
"def",
"_PasteTile",
"(",
"im_dest",
",",
"im_src",
",",
"box",
")",
":",
"try",
":",
"im_dest",
".",
"paste",
"(",
"im_src",
",",
"box",
")",
"except",
"ValueError",
",",
"e",
":",
"logger",
".",
"error",
"(",
"\"Failed to paste:%s\"",
",",
"str",
"("... | https://github.com/google/earthenterprise/blob/0fe84e29be470cd857e3a0e52e5d0afd5bb8cee9/earth_enterprise/src/server/wsgi/wms/ogc/common/tiles.py#L357-L371 | ||
bumptop/BumpTop | 466d23597a07ae738f4265262fa01087fc6e257c | trunk/win/Source/bin/jinja2/filters.py | python | do_replace | (environment, s, old, new, count=None) | return s.replace(soft_unicode(old), soft_unicode(new), count) | Return a copy of the value with all occurrences of a substring
replaced with a new one. The first argument is the substring
that should be replaced, the second is the replacement string.
If the optional third argument ``count`` is given, only the first
``count`` occurrences are replaced:
.. sourcec... | Return a copy of the value with all occurrences of a substring
replaced with a new one. The first argument is the substring
that should be replaced, the second is the replacement string.
If the optional third argument ``count`` is given, only the first
``count`` occurrences are replaced: | [
"Return",
"a",
"copy",
"of",
"the",
"value",
"with",
"all",
"occurrences",
"of",
"a",
"substring",
"replaced",
"with",
"a",
"new",
"one",
".",
"The",
"first",
"argument",
"is",
"the",
"substring",
"that",
"should",
"be",
"replaced",
"the",
"second",
"is",
... | def do_replace(environment, s, old, new, count=None):
"""Return a copy of the value with all occurrences of a substring
replaced with a new one. The first argument is the substring
that should be replaced, the second is the replacement string.
If the optional third argument ``count`` is given, only the ... | [
"def",
"do_replace",
"(",
"environment",
",",
"s",
",",
"old",
",",
"new",
",",
"count",
"=",
"None",
")",
":",
"if",
"count",
"is",
"None",
":",
"count",
"=",
"-",
"1",
"if",
"not",
"environment",
".",
"autoescape",
":",
"return",
"unicode",
"(",
... | https://github.com/bumptop/BumpTop/blob/466d23597a07ae738f4265262fa01087fc6e257c/trunk/win/Source/bin/jinja2/filters.py#L52-L76 | |
eclipse/sumo | 7132a9b8b6eea734bdec38479026b4d8c4336d03 | tools/contributed/sumopy/agilepy/lib_wx/wxmisc.py | python | AgileStatusbar.set_fields | (self, fields) | Sets basic data of fields in status bar.
Argument field is a list with the following format:
[(name1,width1),(name2,width2),...] | Sets basic data of fields in status bar.
Argument field is a list with the following format:
[(name1,width1),(name2,width2),...] | [
"Sets",
"basic",
"data",
"of",
"fields",
"in",
"status",
"bar",
".",
"Argument",
"field",
"is",
"a",
"list",
"with",
"the",
"following",
"format",
":",
"[",
"(",
"name1",
"width1",
")",
"(",
"name2",
"width2",
")",
"...",
"]"
] | def set_fields(self, fields):
"""
Sets basic data of fields in status bar.
Argument field is a list with the following format:
[(name1,width1),(name2,width2),...]
"""
self._ind_fields = {}
widths = []
ind = 0
for name, width in fields:
... | [
"def",
"set_fields",
"(",
"self",
",",
"fields",
")",
":",
"self",
".",
"_ind_fields",
"=",
"{",
"}",
"widths",
"=",
"[",
"]",
"ind",
"=",
"0",
"for",
"name",
",",
"width",
"in",
"fields",
":",
"widths",
".",
"append",
"(",
"width",
")",
"self",
... | https://github.com/eclipse/sumo/blob/7132a9b8b6eea734bdec38479026b4d8c4336d03/tools/contributed/sumopy/agilepy/lib_wx/wxmisc.py#L810-L824 | ||
PaddlePaddle/Paddle | 1252f4bb3e574df80aa6d18c7ddae1b3a90bd81c | python/paddle/fluid/incubate/fleet/collective/__init__.py | python | Collective.save_inference_model | (self,
executor,
dirname,
feeded_var_names=None,
target_vars=None,
main_program=None,
export_for_deployment=True) | Prune the given `main_program` to build a new program especially for
inference, and then save it and all related parameters to given
`dirname` by the `executor`. | Prune the given `main_program` to build a new program especially for
inference, and then save it and all related parameters to given
`dirname` by the `executor`. | [
"Prune",
"the",
"given",
"main_program",
"to",
"build",
"a",
"new",
"program",
"especially",
"for",
"inference",
"and",
"then",
"save",
"it",
"and",
"all",
"related",
"parameters",
"to",
"given",
"dirname",
"by",
"the",
"executor",
"."
] | def save_inference_model(self,
executor,
dirname,
feeded_var_names=None,
target_vars=None,
main_program=None,
export_for_deployment=True):
... | [
"def",
"save_inference_model",
"(",
"self",
",",
"executor",
",",
"dirname",
",",
"feeded_var_names",
"=",
"None",
",",
"target_vars",
"=",
"None",
",",
"main_program",
"=",
"None",
",",
"export_for_deployment",
"=",
"True",
")",
":",
"assert",
"isinstance",
"... | https://github.com/PaddlePaddle/Paddle/blob/1252f4bb3e574df80aa6d18c7ddae1b3a90bd81c/python/paddle/fluid/incubate/fleet/collective/__init__.py#L88-L112 | ||
grpc/grpc | 27bc6fe7797e43298dc931b96dc57322d0852a9f | tools/buildgen/plugins/expand_version.py | python | Version.php | (self) | return s | Version string for PHP PECL package | Version string for PHP PECL package | [
"Version",
"string",
"for",
"PHP",
"PECL",
"package"
] | def php(self):
"""Version string for PHP PECL package"""
s = '%d.%d.%d' % (self.major, self.minor, self.patch)
if self.tag:
if self.tag == 'dev':
s += 'dev'
elif len(self.tag) >= 3 and self.tag[0:3] == 'pre':
s += 'RC%d' % int(self.tag[3:])... | [
"def",
"php",
"(",
"self",
")",
":",
"s",
"=",
"'%d.%d.%d'",
"%",
"(",
"self",
".",
"major",
",",
"self",
".",
"minor",
",",
"self",
".",
"patch",
")",
"if",
"self",
".",
"tag",
":",
"if",
"self",
".",
"tag",
"==",
"'dev'",
":",
"s",
"+=",
"'... | https://github.com/grpc/grpc/blob/27bc6fe7797e43298dc931b96dc57322d0852a9f/tools/buildgen/plugins/expand_version.py#L78-L90 | |
seqan/seqan | f5f658343c366c9c3d44ba358ffc9317e78a09ed | util/py_lib/seqan/auto_build.py | python | MinisculeGitWrapper.lsRemote | (self, url) | return res | Execute 'git ls-remote ${url} --tags'. | Execute 'git ls-remote ${url} --tags'. | [
"Execute",
"git",
"ls",
"-",
"remote",
"$",
"{",
"url",
"}",
"--",
"tags",
"."
] | def lsRemote(self, url):
"""Execute 'git ls-remote ${url} --tags'."""
# Execute ls-remote command.
print('Executing "%s %s %s"' % (GIT_BINARY, 'ls-remote --tags', url), file=sys.stderr)
popen = subprocess.Popen([GIT_BINARY, 'ls-remote', '--tags', url],
st... | [
"def",
"lsRemote",
"(",
"self",
",",
"url",
")",
":",
"# Execute ls-remote command.",
"print",
"(",
"'Executing \"%s %s %s\"'",
"%",
"(",
"GIT_BINARY",
",",
"'ls-remote --tags'",
",",
"url",
")",
",",
"file",
"=",
"sys",
".",
"stderr",
")",
"popen",
"=",
"su... | https://github.com/seqan/seqan/blob/f5f658343c366c9c3d44ba358ffc9317e78a09ed/util/py_lib/seqan/auto_build.py#L32-L52 | |
wxWidgets/wxPython-Classic | 19571e1ae65f1ac445f5491474121998c97a1bf0 | src/msw/_gdi.py | python | Font.SetWeight | (*args, **kwargs) | return _gdi_.Font_SetWeight(*args, **kwargs) | SetWeight(self, int weight)
Sets the font weight. | SetWeight(self, int weight) | [
"SetWeight",
"(",
"self",
"int",
"weight",
")"
] | def SetWeight(*args, **kwargs):
"""
SetWeight(self, int weight)
Sets the font weight.
"""
return _gdi_.Font_SetWeight(*args, **kwargs) | [
"def",
"SetWeight",
"(",
"*",
"args",
",",
"*",
"*",
"kwargs",
")",
":",
"return",
"_gdi_",
".",
"Font_SetWeight",
"(",
"*",
"args",
",",
"*",
"*",
"kwargs",
")"
] | https://github.com/wxWidgets/wxPython-Classic/blob/19571e1ae65f1ac445f5491474121998c97a1bf0/src/msw/_gdi.py#L2420-L2426 | |
aws/lumberyard | f85344403c1c2e77ec8c75deb2c116e97b713217 | dev/Tools/Python/3.7.10/mac/Python.framework/Versions/3.7/lib/python3.7/site-packages/setuptools/_vendor/pyparsing.py | python | makeXMLTags | (tagStr) | return _makeTags( tagStr, True ) | Helper to construct opening and closing tag expressions for XML, given a tag name. Matches
tags only in the given upper/lower case.
Example: similar to L{makeHTMLTags} | Helper to construct opening and closing tag expressions for XML, given a tag name. Matches
tags only in the given upper/lower case. | [
"Helper",
"to",
"construct",
"opening",
"and",
"closing",
"tag",
"expressions",
"for",
"XML",
"given",
"a",
"tag",
"name",
".",
"Matches",
"tags",
"only",
"in",
"the",
"given",
"upper",
"/",
"lower",
"case",
"."
] | def makeXMLTags(tagStr):
"""
Helper to construct opening and closing tag expressions for XML, given a tag name. Matches
tags only in the given upper/lower case.
Example: similar to L{makeHTMLTags}
"""
return _makeTags( tagStr, True ) | [
"def",
"makeXMLTags",
"(",
"tagStr",
")",
":",
"return",
"_makeTags",
"(",
"tagStr",
",",
"True",
")"
] | https://github.com/aws/lumberyard/blob/f85344403c1c2e77ec8c75deb2c116e97b713217/dev/Tools/Python/3.7.10/mac/Python.framework/Versions/3.7/lib/python3.7/site-packages/setuptools/_vendor/pyparsing.py#L4923-L4930 | |
vslavik/poedit | f7a9daa0a10037e090aa0a86f5ce0f24ececdf6a | deps/boost/libs/metaparse/tools/benchmark/char_stat.py | python | generate_statistics | (root) | return out | Generate the statistics from all files in root (recursively) | Generate the statistics from all files in root (recursively) | [
"Generate",
"the",
"statistics",
"from",
"all",
"files",
"in",
"root",
"(",
"recursively",
")"
] | def generate_statistics(root):
"""Generate the statistics from all files in root (recursively)"""
out = dict()
count_characters(root, out)
return out | [
"def",
"generate_statistics",
"(",
"root",
")",
":",
"out",
"=",
"dict",
"(",
")",
"count_characters",
"(",
"root",
",",
"out",
")",
"return",
"out"
] | https://github.com/vslavik/poedit/blob/f7a9daa0a10037e090aa0a86f5ce0f24ececdf6a/deps/boost/libs/metaparse/tools/benchmark/char_stat.py#L27-L31 | |
hanpfei/chromium-net | 392cc1fa3a8f92f42e4071ab6e674d8e0482f83f | tools/grit/grit/grit_runner.py | python | Options.ReadOptions | (self, args) | return args | Reads options from the start of args and returns the remainder. | Reads options from the start of args and returns the remainder. | [
"Reads",
"options",
"from",
"the",
"start",
"of",
"args",
"and",
"returns",
"the",
"remainder",
"."
] | def ReadOptions(self, args):
"""Reads options from the start of args and returns the remainder."""
(opts, args) = getopt.getopt(args, 'g:qdvxc:i:p:h:', ('psyco',))
for (key, val) in opts:
if key == '-d': self.disconnected = True
elif key == '-c': self.client = val
elif key == '-h': self.ha... | [
"def",
"ReadOptions",
"(",
"self",
",",
"args",
")",
":",
"(",
"opts",
",",
"args",
")",
"=",
"getopt",
".",
"getopt",
"(",
"args",
",",
"'g:qdvxc:i:p:h:'",
",",
"(",
"'psyco'",
",",
")",
")",
"for",
"(",
"key",
",",
"val",
")",
"in",
"opts",
":"... | https://github.com/hanpfei/chromium-net/blob/392cc1fa3a8f92f42e4071ab6e674d8e0482f83f/tools/grit/grit/grit_runner.py#L165-L190 | |
wxWidgets/wxPython-Classic | 19571e1ae65f1ac445f5491474121998c97a1bf0 | wx/lib/agw/aui/aui_utilities.py | python | GetBaseColour | () | return base_colour | Returns the face shading colour on push buttons/backgrounds,
mimicking as closely as possible the platform UI colours. | Returns the face shading colour on push buttons/backgrounds,
mimicking as closely as possible the platform UI colours. | [
"Returns",
"the",
"face",
"shading",
"colour",
"on",
"push",
"buttons",
"/",
"backgrounds",
"mimicking",
"as",
"closely",
"as",
"possible",
"the",
"platform",
"UI",
"colours",
"."
] | def GetBaseColour():
"""
Returns the face shading colour on push buttons/backgrounds,
mimicking as closely as possible the platform UI colours.
"""
if wx.Platform == "__WXMAC__":
if hasattr(wx, 'MacThemeColour'):
base_colour = wx.MacThemeColour(Carbon.Appearance.kThemeBrushTool... | [
"def",
"GetBaseColour",
"(",
")",
":",
"if",
"wx",
".",
"Platform",
"==",
"\"__WXMAC__\"",
":",
"if",
"hasattr",
"(",
"wx",
",",
"'MacThemeColour'",
")",
":",
"base_colour",
"=",
"wx",
".",
"MacThemeColour",
"(",
"Carbon",
".",
"Appearance",
".",
"kThemeBr... | https://github.com/wxWidgets/wxPython-Classic/blob/19571e1ae65f1ac445f5491474121998c97a1bf0/wx/lib/agw/aui/aui_utilities.py#L162-L189 | |
BlzFans/wke | b0fa21158312e40c5fbd84682d643022b6c34a93 | cygwin/lib/python2.6/mailbox.py | python | Maildir.__setitem__ | (self, key, message) | Replace the keyed message; raise KeyError if it doesn't exist. | Replace the keyed message; raise KeyError if it doesn't exist. | [
"Replace",
"the",
"keyed",
"message",
";",
"raise",
"KeyError",
"if",
"it",
"doesn",
"t",
"exist",
"."
] | def __setitem__(self, key, message):
"""Replace the keyed message; raise KeyError if it doesn't exist."""
old_subpath = self._lookup(key)
temp_key = self.add(message)
temp_subpath = self._lookup(temp_key)
if isinstance(message, MaildirMessage):
# temp's subdir and suf... | [
"def",
"__setitem__",
"(",
"self",
",",
"key",
",",
"message",
")",
":",
"old_subpath",
"=",
"self",
".",
"_lookup",
"(",
"key",
")",
"temp_key",
"=",
"self",
".",
"add",
"(",
"message",
")",
"temp_subpath",
"=",
"self",
".",
"_lookup",
"(",
"temp_key"... | https://github.com/BlzFans/wke/blob/b0fa21158312e40c5fbd84682d643022b6c34a93/cygwin/lib/python2.6/mailbox.py#L290-L311 | ||
y123456yz/reading-and-annotate-mongodb-3.6 | 93280293672ca7586dc24af18132aa61e4ed7fcf | mongo/src/third_party/scons-2.5.0/scons-local-2.5.0/SCons/Scanner/__init__.py | python | Base.__call__ | (self, node, env, path = ()) | return nodes | This method scans a single object. 'node' is the node
that will be passed to the scanner function, and 'env' is the
environment that will be passed to the scanner function. A list of
direct dependency nodes for the specified node will be returned. | This method scans a single object. 'node' is the node
that will be passed to the scanner function, and 'env' is the
environment that will be passed to the scanner function. A list of
direct dependency nodes for the specified node will be returned. | [
"This",
"method",
"scans",
"a",
"single",
"object",
".",
"node",
"is",
"the",
"node",
"that",
"will",
"be",
"passed",
"to",
"the",
"scanner",
"function",
"and",
"env",
"is",
"the",
"environment",
"that",
"will",
"be",
"passed",
"to",
"the",
"scanner",
"f... | def __call__(self, node, env, path = ()):
"""
This method scans a single object. 'node' is the node
that will be passed to the scanner function, and 'env' is the
environment that will be passed to the scanner function. A list of
direct dependency nodes for the specified node will... | [
"def",
"__call__",
"(",
"self",
",",
"node",
",",
"env",
",",
"path",
"=",
"(",
")",
")",
":",
"if",
"self",
".",
"scan_check",
"and",
"not",
"self",
".",
"scan_check",
"(",
"node",
",",
"env",
")",
":",
"return",
"[",
"]",
"self",
"=",
"self",
... | 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/Scanner/__init__.py#L196-L222 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.