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 |
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
y123456yz/reading-and-annotate-mongodb-3.6 | 93280293672ca7586dc24af18132aa61e4ed7fcf | mongo/src/third_party/scons-2.5.0/scons-local-2.5.0/SCons/Node/FS.py | python | FS.get_root | (self, drive) | Returns the root directory for the specified drive, creating
it if necessary. | Returns the root directory for the specified drive, creating
it if necessary. | [
"Returns",
"the",
"root",
"directory",
"for",
"the",
"specified",
"drive",
"creating",
"it",
"if",
"necessary",
"."
] | def get_root(self, drive):
"""
Returns the root directory for the specified drive, creating
it if necessary.
"""
drive = _my_normcase(drive)
try:
return self.Root[drive]
except KeyError:
root = RootDir(drive, self)
self.Root[dri... | [
"def",
"get_root",
"(",
"self",
",",
"drive",
")",
":",
"drive",
"=",
"_my_normcase",
"(",
"drive",
")",
"try",
":",
"return",
"self",
".",
"Root",
"[",
"drive",
"]",
"except",
"KeyError",
":",
"root",
"=",
"RootDir",
"(",
"drive",
",",
"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/Node/FS.py#L1241-L1256 | ||
cinder/Cinder | e83f5bb9c01a63eec20168d02953a0879e5100f7 | docs/generateDocs.py | python | process_dir | (in_path, out_path) | Iterates a directory and generates documentation for each xml file
in the directory as long as it is a class, struct or namespace
Args:
inPath: The directory to process
outPath: The directory to save the generated html file to | Iterates a directory and generates documentation for each xml file
in the directory as long as it is a class, struct or namespace | [
"Iterates",
"a",
"directory",
"and",
"generates",
"documentation",
"for",
"each",
"xml",
"file",
"in",
"the",
"directory",
"as",
"long",
"as",
"it",
"is",
"a",
"class",
"struct",
"or",
"namespace"
] | def process_dir(in_path, out_path):
""" Iterates a directory and generates documentation for each xml file
in the directory as long as it is a class, struct or namespace
Args:
inPath: The directory to process
outPath: The directory to save the generated html file to
"""
... | [
"def",
"process_dir",
"(",
"in_path",
",",
"out_path",
")",
":",
"for",
"file_path",
"in",
"os",
".",
"listdir",
"(",
"in_path",
")",
":",
"full_path",
"=",
"os",
".",
"path",
".",
"join",
"(",
"in_path",
",",
"file_path",
")",
"# if file_path.endswith(\".... | https://github.com/cinder/Cinder/blob/e83f5bb9c01a63eec20168d02953a0879e5100f7/docs/generateDocs.py#L3574-L3591 | ||
PaddlePaddle/Paddle | 1252f4bb3e574df80aa6d18c7ddae1b3a90bd81c | python/paddle/fluid/contrib/slim/quantization/imperative/ptq_registry.py | python | PTQRegistry.is_supported_layer | (cls, layer) | return layer in cls.supported_layers_map or \
isinstance(layer, tuple(cls.supported_layers_map.keys())) | Analyze whether the layer supports quantization.
Args:
layer(Layer): The input layer can be a python class or an instance.
Returns:
flag(bool): Whther the layer is supported. | Analyze whether the layer supports quantization.
Args:
layer(Layer): The input layer can be a python class or an instance.
Returns:
flag(bool): Whther the layer is supported. | [
"Analyze",
"whether",
"the",
"layer",
"supports",
"quantization",
".",
"Args",
":",
"layer",
"(",
"Layer",
")",
":",
"The",
"input",
"layer",
"can",
"be",
"a",
"python",
"class",
"or",
"an",
"instance",
".",
"Returns",
":",
"flag",
"(",
"bool",
")",
":... | def is_supported_layer(cls, layer):
"""
Analyze whether the layer supports quantization.
Args:
layer(Layer): The input layer can be a python class or an instance.
Returns:
flag(bool): Whther the layer is supported.
"""
cls._init()
return la... | [
"def",
"is_supported_layer",
"(",
"cls",
",",
"layer",
")",
":",
"cls",
".",
"_init",
"(",
")",
"return",
"layer",
"in",
"cls",
".",
"supported_layers_map",
"or",
"isinstance",
"(",
"layer",
",",
"tuple",
"(",
"cls",
".",
"supported_layers_map",
".",
"keys... | https://github.com/PaddlePaddle/Paddle/blob/1252f4bb3e574df80aa6d18c7ddae1b3a90bd81c/python/paddle/fluid/contrib/slim/quantization/imperative/ptq_registry.py#L83-L93 | |
google/syzygy | 8164b24ebde9c5649c9a09e88a7fc0b0fcbd1bc5 | third_party/numpy/files/numpy/lib/benchmarks/benchmark.py | python | Benchmark.__setitem__ | (self,module,(test_str,setup_str)) | Set the test code for modules. | Set the test code for modules. | [
"Set",
"the",
"test",
"code",
"for",
"modules",
"."
] | def __setitem__(self,module,(test_str,setup_str)):
"""Set the test code for modules."""
if module == 'all':
modules = self.module_test.keys()
else:
modules = [module]
for m in modules:
setup_str = 'import %s; import %s as np; ' % (m,m) \
... | [
"def",
"__setitem__",
"(",
"self",
",",
"module",
",",
"(",
"test_str",
",",
"setup_str",
")",
")",
":",
"if",
"module",
"==",
"'all'",
":",
"modules",
"=",
"self",
".",
"module_test",
".",
"keys",
"(",
")",
"else",
":",
"modules",
"=",
"[",
"module"... | https://github.com/google/syzygy/blob/8164b24ebde9c5649c9a09e88a7fc0b0fcbd1bc5/third_party/numpy/files/numpy/lib/benchmarks/benchmark.py#L12-L22 | ||
ChromiumWebApps/chromium | c7361d39be8abd1574e6ce8957c8dbddd4c6ccf7 | third_party/closure_linter/closure_linter/gjslint.py | python | _CheckPath | (path) | return map(make_error_record, error_accumulator.GetErrors()) | Check a path and return any errors.
Args:
path: paths to check.
Returns:
A list of errorrecord.ErrorRecords for any found errors. | Check a path and return any errors. | [
"Check",
"a",
"path",
"and",
"return",
"any",
"errors",
"."
] | def _CheckPath(path):
"""Check a path and return any errors.
Args:
path: paths to check.
Returns:
A list of errorrecord.ErrorRecords for any found errors.
"""
error_accumulator = erroraccumulator.ErrorAccumulator()
style_checker = checker.JavaScriptStyleChecker(error_accumulator)
style_checker.... | [
"def",
"_CheckPath",
"(",
"path",
")",
":",
"error_accumulator",
"=",
"erroraccumulator",
".",
"ErrorAccumulator",
"(",
")",
"style_checker",
"=",
"checker",
".",
"JavaScriptStyleChecker",
"(",
"error_accumulator",
")",
"style_checker",
".",
"Check",
"(",
"path",
... | https://github.com/ChromiumWebApps/chromium/blob/c7361d39be8abd1574e6ce8957c8dbddd4c6ccf7/third_party/closure_linter/closure_linter/gjslint.py#L119-L135 | |
rapidsai/cudf | d5b2448fc69f17509304d594f029d0df56984962 | python/cudf/cudf/_version.py | python | render_git_describe_long | (pieces) | return rendered | TAG-DISTANCE-gHEX[-dirty].
Like 'git describe --tags --dirty --always -long'.
The distance/hash is unconditional.
Exceptions:
1: no tags. HEX[-dirty] (note: no 'g' prefix) | TAG-DISTANCE-gHEX[-dirty]. | [
"TAG",
"-",
"DISTANCE",
"-",
"gHEX",
"[",
"-",
"dirty",
"]",
"."
] | def render_git_describe_long(pieces):
"""TAG-DISTANCE-gHEX[-dirty].
Like 'git describe --tags --dirty --always -long'.
The distance/hash is unconditional.
Exceptions:
1: no tags. HEX[-dirty] (note: no 'g' prefix)
"""
if pieces["closest-tag"]:
rendered = pieces["closest-tag"]
... | [
"def",
"render_git_describe_long",
"(",
"pieces",
")",
":",
"if",
"pieces",
"[",
"\"closest-tag\"",
"]",
":",
"rendered",
"=",
"pieces",
"[",
"\"closest-tag\"",
"]",
"rendered",
"+=",
"\"-%d-g%s\"",
"%",
"(",
"pieces",
"[",
"\"distance\"",
"]",
",",
"pieces",
... | https://github.com/rapidsai/cudf/blob/d5b2448fc69f17509304d594f029d0df56984962/python/cudf/cudf/_version.py#L456-L473 | |
idaholab/moose | 9eeebc65e098b4c30f8205fb41591fd5b61eb6ff | python/peacock/Input/BlockTree.py | python | BlockTree.indexOfItem | (self, item) | return self._getItemParent(item).indexOfChild(item) | Gets the index of the item in the child list
Input:
item[QTreeWidgetItem]: The item to get the index for
Return:
int: The current index | Gets the index of the item in the child list
Input:
item[QTreeWidgetItem]: The item to get the index for
Return:
int: The current index | [
"Gets",
"the",
"index",
"of",
"the",
"item",
"in",
"the",
"child",
"list",
"Input",
":",
"item",
"[",
"QTreeWidgetItem",
"]",
":",
"The",
"item",
"to",
"get",
"the",
"index",
"for",
"Return",
":",
"int",
":",
"The",
"current",
"index"
] | def indexOfItem(self, item):
"""
Gets the index of the item in the child list
Input:
item[QTreeWidgetItem]: The item to get the index for
Return:
int: The current index
"""
return self._getItemParent(item).indexOfChild(item) | [
"def",
"indexOfItem",
"(",
"self",
",",
"item",
")",
":",
"return",
"self",
".",
"_getItemParent",
"(",
"item",
")",
".",
"indexOfChild",
"(",
"item",
")"
] | https://github.com/idaholab/moose/blob/9eeebc65e098b4c30f8205fb41591fd5b61eb6ff/python/peacock/Input/BlockTree.py#L156-L164 | |
Yelp/MOE | 5b5a6a2c6c3cf47320126f7f5894e2a83e347f5c | moe/views/exceptions.py | python | general_error | (exception, request) | return response | Catch any Python ``Exception``.
:param exception: exception to be handled
:type exception: Exception
:param request: the pyramid request that lead to the exception being raised.
:type request: pyramid.request.Request
:return: the pyramid response to be rendered
:rtype: pyramid.response.Response | Catch any Python ``Exception``. | [
"Catch",
"any",
"Python",
"Exception",
"."
] | def general_error(exception, request):
"""Catch any Python ``Exception``.
:param exception: exception to be handled
:type exception: Exception
:param request: the pyramid request that lead to the exception being raised.
:type request: pyramid.request.Request
:return: the pyramid response to be ... | [
"def",
"general_error",
"(",
"exception",
",",
"request",
")",
":",
"status_int",
"=",
"500",
"body",
"=",
"'{0:d}: {1:s}\\n{2:s}'",
".",
"format",
"(",
"status_int",
",",
"request",
".",
"referrer",
",",
"exception",
")",
"response",
"=",
"Response",
"(",
"... | https://github.com/Yelp/MOE/blob/5b5a6a2c6c3cf47320126f7f5894e2a83e347f5c/moe/views/exceptions.py#L43-L57 | |
neopenx/Dragon | 0e639a7319035ddc81918bd3df059230436ee0a1 | Dragon/python/dragon/core/tensor.py | python | Tensor.shape | (self) | return self._shape | Return or Set the shape.
Returns
-------
list or None
The shape of this tensor. | Return or Set the shape. | [
"Return",
"or",
"Set",
"the",
"shape",
"."
] | def shape(self):
"""Return or Set the shape.
Returns
-------
list or None
The shape of this tensor.
"""
if not hasattr(self, '_shape'): self._shape = None
return self._shape | [
"def",
"shape",
"(",
"self",
")",
":",
"if",
"not",
"hasattr",
"(",
"self",
",",
"'_shape'",
")",
":",
"self",
".",
"_shape",
"=",
"None",
"return",
"self",
".",
"_shape"
] | https://github.com/neopenx/Dragon/blob/0e639a7319035ddc81918bd3df059230436ee0a1/Dragon/python/dragon/core/tensor.py#L280-L290 | |
microsoft/checkedc-clang | a173fefde5d7877b7750e7ce96dd08cf18baebf2 | compiler-rt/lib/sanitizer_common/scripts/cpplint.py | python | _Quiet | () | return _cpplint_state.quiet | Return's the module's quiet setting. | Return's the module's quiet setting. | [
"Return",
"s",
"the",
"module",
"s",
"quiet",
"setting",
"."
] | def _Quiet():
"""Return's the module's quiet setting."""
return _cpplint_state.quiet | [
"def",
"_Quiet",
"(",
")",
":",
"return",
"_cpplint_state",
".",
"quiet"
] | https://github.com/microsoft/checkedc-clang/blob/a173fefde5d7877b7750e7ce96dd08cf18baebf2/compiler-rt/lib/sanitizer_common/scripts/cpplint.py#L972-L974 | |
apiaryio/drafter | 4634ebd07f6c6f257cc656598ccd535492fdfb55 | tools/gyp/pylib/gyp/generator/msvs.py | python | _ConvertSourcesToFilterHierarchy | (sources, prefix=None, excluded=None,
list_excluded=True, msvs_version=None) | return result | Converts a list split source file paths into a vcproj folder hierarchy.
Arguments:
sources: A list of source file paths split.
prefix: A list of source file path layers meant to apply to each of sources.
excluded: A set of excluded files.
msvs_version: A MSVSVersion object.
Returns:
A hierarch... | Converts a list split source file paths into a vcproj folder hierarchy. | [
"Converts",
"a",
"list",
"split",
"source",
"file",
"paths",
"into",
"a",
"vcproj",
"folder",
"hierarchy",
"."
] | def _ConvertSourcesToFilterHierarchy(sources, prefix=None, excluded=None,
list_excluded=True, msvs_version=None):
"""Converts a list split source file paths into a vcproj folder hierarchy.
Arguments:
sources: A list of source file paths split.
prefix: A list of source f... | [
"def",
"_ConvertSourcesToFilterHierarchy",
"(",
"sources",
",",
"prefix",
"=",
"None",
",",
"excluded",
"=",
"None",
",",
"list_excluded",
"=",
"True",
",",
"msvs_version",
"=",
"None",
")",
":",
"if",
"not",
"prefix",
":",
"prefix",
"=",
"[",
"]",
"result... | https://github.com/apiaryio/drafter/blob/4634ebd07f6c6f257cc656598ccd535492fdfb55/tools/gyp/pylib/gyp/generator/msvs.py#L180-L242 | |
catboost/catboost | 167f64f237114a4d10b2b4ee42adb4569137debe | contrib/python/pandas/py3/pandas/core/indexes/base.py | python | Index.is_monotonic | (self) | return self.is_monotonic_increasing | Alias for is_monotonic_increasing. | Alias for is_monotonic_increasing. | [
"Alias",
"for",
"is_monotonic_increasing",
"."
] | def is_monotonic(self) -> bool:
"""
Alias for is_monotonic_increasing.
"""
return self.is_monotonic_increasing | [
"def",
"is_monotonic",
"(",
"self",
")",
"->",
"bool",
":",
"return",
"self",
".",
"is_monotonic_increasing"
] | https://github.com/catboost/catboost/blob/167f64f237114a4d10b2b4ee42adb4569137debe/contrib/python/pandas/py3/pandas/core/indexes/base.py#L1942-L1946 | |
catboost/catboost | 167f64f237114a4d10b2b4ee42adb4569137debe | contrib/python/pathlib2/pathlib2/__init__.py | python | Path.stat | (self) | return self._accessor.stat(self) | Return the result of the stat() system call on this path, like
os.stat() does. | Return the result of the stat() system call on this path, like
os.stat() does. | [
"Return",
"the",
"result",
"of",
"the",
"stat",
"()",
"system",
"call",
"on",
"this",
"path",
"like",
"os",
".",
"stat",
"()",
"does",
"."
] | def stat(self):
"""
Return the result of the stat() system call on this path, like
os.stat() does.
"""
return self._accessor.stat(self) | [
"def",
"stat",
"(",
"self",
")",
":",
"return",
"self",
".",
"_accessor",
".",
"stat",
"(",
"self",
")"
] | https://github.com/catboost/catboost/blob/167f64f237114a4d10b2b4ee42adb4569137debe/contrib/python/pathlib2/pathlib2/__init__.py#L1442-L1447 | |
wxWidgets/wxPython-Classic | 19571e1ae65f1ac445f5491474121998c97a1bf0 | src/msw/grid.py | python | Grid.SetSortingColumn | (*args, **kwargs) | return _grid.Grid_SetSortingColumn(*args, **kwargs) | SetSortingColumn(self, int col, bool ascending=True) | SetSortingColumn(self, int col, bool ascending=True) | [
"SetSortingColumn",
"(",
"self",
"int",
"col",
"bool",
"ascending",
"=",
"True",
")"
] | def SetSortingColumn(*args, **kwargs):
"""SetSortingColumn(self, int col, bool ascending=True)"""
return _grid.Grid_SetSortingColumn(*args, **kwargs) | [
"def",
"SetSortingColumn",
"(",
"*",
"args",
",",
"*",
"*",
"kwargs",
")",
":",
"return",
"_grid",
".",
"Grid_SetSortingColumn",
"(",
"*",
"args",
",",
"*",
"*",
"kwargs",
")"
] | https://github.com/wxWidgets/wxPython-Classic/blob/19571e1ae65f1ac445f5491474121998c97a1bf0/src/msw/grid.py#L2181-L2183 | |
pybox2d/pybox2d | 09643321fd363f0850087d1bde8af3f4afd82163 | library/Box2D/examples/backends/pyglet_framework.py | python | PygletFramework.Print | (self, str, color=(229, 153, 153, 255)) | Draw some text, str, at screen coordinates (x, y). | Draw some text, str, at screen coordinates (x, y). | [
"Draw",
"some",
"text",
"str",
"at",
"screen",
"coordinates",
"(",
"x",
"y",
")",
"."
] | def Print(self, str, color=(229, 153, 153, 255)):
"""
Draw some text, str, at screen coordinates (x, y).
"""
pyglet.text.Label(str, font_name=self.fontname,
font_size=self.fontsize, x=5, y=self.window.height -
self.textLine, color=color... | [
"def",
"Print",
"(",
"self",
",",
"str",
",",
"color",
"=",
"(",
"229",
",",
"153",
",",
"153",
",",
"255",
")",
")",
":",
"pyglet",
".",
"text",
".",
"Label",
"(",
"str",
",",
"font_name",
"=",
"self",
".",
"fontname",
",",
"font_size",
"=",
"... | https://github.com/pybox2d/pybox2d/blob/09643321fd363f0850087d1bde8af3f4afd82163/library/Box2D/examples/backends/pyglet_framework.py#L676-L684 | ||
strukturag/libheif | 0082fea96ee70a20c8906a0373bedec0c01777bc | scripts/cpplint.py | python | CheckGlobalStatic | (filename, clean_lines, linenum, error) | Check for unsafe global or static objects.
Args:
filename: The name of the current file.
clean_lines: A CleansedLines instance containing the file.
linenum: The number of the line to check.
error: The function to call with any errors found. | Check for unsafe global or static objects. | [
"Check",
"for",
"unsafe",
"global",
"or",
"static",
"objects",
"."
] | def CheckGlobalStatic(filename, clean_lines, linenum, error):
"""Check for unsafe global or static objects.
Args:
filename: The name of the current file.
clean_lines: A CleansedLines instance containing the file.
linenum: The number of the line to check.
error: The function to call with any errors ... | [
"def",
"CheckGlobalStatic",
"(",
"filename",
",",
"clean_lines",
",",
"linenum",
",",
"error",
")",
":",
"line",
"=",
"clean_lines",
".",
"elided",
"[",
"linenum",
"]",
"# Match two lines at a time to support multiline declarations",
"if",
"linenum",
"+",
"1",
"<",
... | https://github.com/strukturag/libheif/blob/0082fea96ee70a20c8906a0373bedec0c01777bc/scripts/cpplint.py#L4710-L4768 | ||
aws/lumberyard | f85344403c1c2e77ec8c75deb2c116e97b713217 | dev/Tools/Python/3.7.10/linux_x64/lib/python3.7/urllib/robotparser.py | python | RobotFileParser.modified | (self) | Sets the time the robots.txt file was last fetched to the
current time. | Sets the time the robots.txt file was last fetched to the
current time. | [
"Sets",
"the",
"time",
"the",
"robots",
".",
"txt",
"file",
"was",
"last",
"fetched",
"to",
"the",
"current",
"time",
"."
] | def modified(self):
"""Sets the time the robots.txt file was last fetched to the
current time.
"""
import time
self.last_checked = time.time() | [
"def",
"modified",
"(",
"self",
")",
":",
"import",
"time",
"self",
".",
"last_checked",
"=",
"time",
".",
"time",
"(",
")"
] | https://github.com/aws/lumberyard/blob/f85344403c1c2e77ec8c75deb2c116e97b713217/dev/Tools/Python/3.7.10/linux_x64/lib/python3.7/urllib/robotparser.py#L45-L51 | ||
Z3Prover/z3 | d745d03afdfdf638d66093e2bfbacaf87187f35b | src/api/python/z3/z3.py | python | ModelRef.__len__ | (self) | return num_consts + num_funcs | Return the number of constant and function declarations in the model `self`.
>>> f = Function('f', IntSort(), IntSort())
>>> x = Int('x')
>>> s = Solver()
>>> s.add(x > 0, f(x) != x)
>>> s.check()
sat
>>> m = s.model()
>>> len(m)
2 | Return the number of constant and function declarations in the model `self`. | [
"Return",
"the",
"number",
"of",
"constant",
"and",
"function",
"declarations",
"in",
"the",
"model",
"self",
"."
] | def __len__(self):
"""Return the number of constant and function declarations in the model `self`.
>>> f = Function('f', IntSort(), IntSort())
>>> x = Int('x')
>>> s = Solver()
>>> s.add(x > 0, f(x) != x)
>>> s.check()
sat
>>> m = s.model()
>>> le... | [
"def",
"__len__",
"(",
"self",
")",
":",
"num_consts",
"=",
"int",
"(",
"Z3_model_get_num_consts",
"(",
"self",
".",
"ctx",
".",
"ref",
"(",
")",
",",
"self",
".",
"model",
")",
")",
"num_funcs",
"=",
"int",
"(",
"Z3_model_get_num_funcs",
"(",
"self",
... | https://github.com/Z3Prover/z3/blob/d745d03afdfdf638d66093e2bfbacaf87187f35b/src/api/python/z3/z3.py#L6405-L6420 | |
feelpp/feelpp | 2d547ed701cc5adb01639185b4a8eb47940367c7 | feelpp/tools/scripts/ParaView/insitu.base.py | python | DoCoProcessing | (datadescription) | Callback to do co-processing for current timestep | Callback to do co-processing for current timestep | [
"Callback",
"to",
"do",
"co",
"-",
"processing",
"for",
"current",
"timestep"
] | def DoCoProcessing(datadescription):
"Callback to do co-processing for current timestep"
global coprocessor
hostname = "localhost"
port = 22222
userdata = datadescription.GetUserData()
if(userdata != None):
if( userdata.HasArray("hostname") ):
hostname = userdata.GetAbstrac... | [
"def",
"DoCoProcessing",
"(",
"datadescription",
")",
":",
"global",
"coprocessor",
"hostname",
"=",
"\"localhost\"",
"port",
"=",
"22222",
"userdata",
"=",
"datadescription",
".",
"GetUserData",
"(",
")",
"if",
"(",
"userdata",
"!=",
"None",
")",
":",
"if",
... | https://github.com/feelpp/feelpp/blob/2d547ed701cc5adb01639185b4a8eb47940367c7/feelpp/tools/scripts/ParaView/insitu.base.py#L68-L90 | ||
baidu-research/tensorflow-allreduce | 66d5b855e90b0949e9fa5cca5599fd729a70e874 | tensorflow/python/ops/nn_impl.py | python | log_poisson_loss | (targets, log_input, compute_full_loss=False, name=None) | Computes log Poisson loss given `log_input`.
Gives the log-likelihood loss between the prediction and the target under the
assumption that the target has a Poisson distribution.
Caveat: By default, this is not the exact loss, but the loss minus a
constant term [log(z!)]. That has no effect for optimization, ... | Computes log Poisson loss given `log_input`. | [
"Computes",
"log",
"Poisson",
"loss",
"given",
"log_input",
"."
] | def log_poisson_loss(targets, log_input, compute_full_loss=False, name=None):
"""Computes log Poisson loss given `log_input`.
Gives the log-likelihood loss between the prediction and the target under the
assumption that the target has a Poisson distribution.
Caveat: By default, this is not the exact loss, but ... | [
"def",
"log_poisson_loss",
"(",
"targets",
",",
"log_input",
",",
"compute_full_loss",
"=",
"False",
",",
"name",
"=",
"None",
")",
":",
"with",
"ops",
".",
"name_scope",
"(",
"name",
",",
"\"log_poisson_loss\"",
",",
"[",
"log_input",
",",
"targets",
"]",
... | https://github.com/baidu-research/tensorflow-allreduce/blob/66d5b855e90b0949e9fa5cca5599fd729a70e874/tensorflow/python/ops/nn_impl.py#L36-L97 | ||
llvm/llvm-project | ffa6262cb4e2a335d26416fad39a581b4f98c5f4 | llvm/examples/Kaleidoscope/MCJIT/lazy/genk-timing.py | python | generateKScript | (filename, numFuncs, elementsPerFunc, funcsBetweenExec, callWeighting, timingScript) | Generate a random Kaleidoscope script based on the given parameters | Generate a random Kaleidoscope script based on the given parameters | [
"Generate",
"a",
"random",
"Kaleidoscope",
"script",
"based",
"on",
"the",
"given",
"parameters"
] | def generateKScript(filename, numFuncs, elementsPerFunc, funcsBetweenExec, callWeighting, timingScript):
""" Generate a random Kaleidoscope script based on the given parameters """
print("Generating " + filename)
print(" %d functions, %d elements per function, %d functions between execution" %
(n... | [
"def",
"generateKScript",
"(",
"filename",
",",
"numFuncs",
",",
"elementsPerFunc",
",",
"funcsBetweenExec",
",",
"callWeighting",
",",
"timingScript",
")",
":",
"print",
"(",
"\"Generating \"",
"+",
"filename",
")",
"print",
"(",
"\" %d functions, %d elements per fu... | https://github.com/llvm/llvm-project/blob/ffa6262cb4e2a335d26416fad39a581b4f98c5f4/llvm/examples/Kaleidoscope/MCJIT/lazy/genk-timing.py#L176-L206 | ||
snap-stanford/snap-python | d53c51b0a26aa7e3e7400b014cdf728948fde80a | setup/snap.py | python | TSFlt.__lt__ | (self, *args) | return _snap.TSFlt___lt__(self, *args) | __lt__(TSFlt self, TSFlt SFlt) -> bool
Parameters:
SFlt: TSFlt const & | __lt__(TSFlt self, TSFlt SFlt) -> bool | [
"__lt__",
"(",
"TSFlt",
"self",
"TSFlt",
"SFlt",
")",
"-",
">",
"bool"
] | def __lt__(self, *args):
"""
__lt__(TSFlt self, TSFlt SFlt) -> bool
Parameters:
SFlt: TSFlt const &
"""
return _snap.TSFlt___lt__(self, *args) | [
"def",
"__lt__",
"(",
"self",
",",
"*",
"args",
")",
":",
"return",
"_snap",
".",
"TSFlt___lt__",
"(",
"self",
",",
"*",
"args",
")"
] | https://github.com/snap-stanford/snap-python/blob/d53c51b0a26aa7e3e7400b014cdf728948fde80a/setup/snap.py#L14860-L14868 | |
msracver/Deep-Image-Analogy | 632b9287b42552e32dad64922967c8c9ec7fc4d3 | python/caffe/net_spec.py | python | to_proto | (*tops) | return net | Generate a NetParameter that contains all layers needed to compute
all arguments. | Generate a NetParameter that contains all layers needed to compute
all arguments. | [
"Generate",
"a",
"NetParameter",
"that",
"contains",
"all",
"layers",
"needed",
"to",
"compute",
"all",
"arguments",
"."
] | def to_proto(*tops):
"""Generate a NetParameter that contains all layers needed to compute
all arguments."""
layers = OrderedDict()
autonames = Counter()
for top in tops:
top.fn._to_proto(layers, {}, autonames)
net = caffe_pb2.NetParameter()
net.layer.extend(layers.values())
ret... | [
"def",
"to_proto",
"(",
"*",
"tops",
")",
":",
"layers",
"=",
"OrderedDict",
"(",
")",
"autonames",
"=",
"Counter",
"(",
")",
"for",
"top",
"in",
"tops",
":",
"top",
".",
"fn",
".",
"_to_proto",
"(",
"layers",
",",
"{",
"}",
",",
"autonames",
")",
... | https://github.com/msracver/Deep-Image-Analogy/blob/632b9287b42552e32dad64922967c8c9ec7fc4d3/python/caffe/net_spec.py#L43-L53 | |
eldar/deepcut-cnn | 928bf2f224fce132f6e4404b4c95fb017297a5e0 | scripts/cpp_lint.py | python | FindEndOfExpressionInLine | (line, startpos, depth, startchar, endchar) | return (-1, depth) | Find the position just after the matching endchar.
Args:
line: a CleansedLines line.
startpos: start searching at this position.
depth: nesting level at startpos.
startchar: expression opening character.
endchar: expression closing character.
Returns:
On finding matching endchar: (index ju... | Find the position just after the matching endchar. | [
"Find",
"the",
"position",
"just",
"after",
"the",
"matching",
"endchar",
"."
] | def FindEndOfExpressionInLine(line, startpos, depth, startchar, endchar):
"""Find the position just after the matching endchar.
Args:
line: a CleansedLines line.
startpos: start searching at this position.
depth: nesting level at startpos.
startchar: expression opening character.
endchar: expre... | [
"def",
"FindEndOfExpressionInLine",
"(",
"line",
",",
"startpos",
",",
"depth",
",",
"startchar",
",",
"endchar",
")",
":",
"for",
"i",
"in",
"xrange",
"(",
"startpos",
",",
"len",
"(",
"line",
")",
")",
":",
"if",
"line",
"[",
"i",
"]",
"==",
"start... | https://github.com/eldar/deepcut-cnn/blob/928bf2f224fce132f6e4404b4c95fb017297a5e0/scripts/cpp_lint.py#L1230-L1251 | |
aws/lumberyard | f85344403c1c2e77ec8c75deb2c116e97b713217 | dev/Tools/Python/3.7.10/windows/Lib/site-packages/setuptools/_vendor/pyparsing.py | python | ParserElement.__or__ | (self, other ) | return MatchFirst( [ self, other ] ) | Implementation of | operator - returns C{L{MatchFirst}} | Implementation of | operator - returns C{L{MatchFirst}} | [
"Implementation",
"of",
"|",
"operator",
"-",
"returns",
"C",
"{",
"L",
"{",
"MatchFirst",
"}}"
] | def __or__(self, other ):
"""
Implementation of | operator - returns C{L{MatchFirst}}
"""
if isinstance( other, basestring ):
other = ParserElement._literalStringClass( other )
if not isinstance( other, ParserElement ):
warnings.warn("Cannot combine elemen... | [
"def",
"__or__",
"(",
"self",
",",
"other",
")",
":",
"if",
"isinstance",
"(",
"other",
",",
"basestring",
")",
":",
"other",
"=",
"ParserElement",
".",
"_literalStringClass",
"(",
"other",
")",
"if",
"not",
"isinstance",
"(",
"other",
",",
"ParserElement"... | https://github.com/aws/lumberyard/blob/f85344403c1c2e77ec8c75deb2c116e97b713217/dev/Tools/Python/3.7.10/windows/Lib/site-packages/setuptools/_vendor/pyparsing.py#L1948-L1958 | |
ChromiumWebApps/chromium | c7361d39be8abd1574e6ce8957c8dbddd4c6ccf7 | tools/checkdeps/rules.py | python | Rules.AsDependencyTuples | (self, include_general_rules, include_specific_rules) | return deps | Returns a list of tuples (allow, dependent dir, dependee dir) for the
specified rules (general/specific). Currently only general rules are
supported. | Returns a list of tuples (allow, dependent dir, dependee dir) for the
specified rules (general/specific). Currently only general rules are
supported. | [
"Returns",
"a",
"list",
"of",
"tuples",
"(",
"allow",
"dependent",
"dir",
"dependee",
"dir",
")",
"for",
"the",
"specified",
"rules",
"(",
"general",
"/",
"specific",
")",
".",
"Currently",
"only",
"general",
"rules",
"are",
"supported",
"."
] | def AsDependencyTuples(self, include_general_rules, include_specific_rules):
"""Returns a list of tuples (allow, dependent dir, dependee dir) for the
specified rules (general/specific). Currently only general rules are
supported."""
def AddDependencyTuplesImpl(deps, rules, extra_dependent_suffix=""):
... | [
"def",
"AsDependencyTuples",
"(",
"self",
",",
"include_general_rules",
",",
"include_specific_rules",
")",
":",
"def",
"AddDependencyTuplesImpl",
"(",
"deps",
",",
"rules",
",",
"extra_dependent_suffix",
"=",
"\"\"",
")",
":",
"for",
"rule",
"in",
"rules",
":",
... | https://github.com/ChromiumWebApps/chromium/blob/c7361d39be8abd1574e6ce8957c8dbddd4c6ccf7/tools/checkdeps/rules.py#L113-L129 | |
LLNL/lbann | 26083e6c86050302ce33148aea70f62e61cacb92 | python/lbann/core/operators.py | python | Operator.__init__ | (self,
input_type: DataType = DataType.FLOAT,
output_type: DataType = None,
device: DeviceAllocation = None) | Construct an operator.
Args:
input_type: The type expected as input.
output_type: The type expected as output.
device: The device allocation. | Construct an operator. | [
"Construct",
"an",
"operator",
"."
] | def __init__(self,
input_type: DataType = DataType.FLOAT,
output_type: DataType = None,
device: DeviceAllocation = None):
"""Construct an operator.
Args:
input_type: The type expected as input.
output_type: The type expected as ... | [
"def",
"__init__",
"(",
"self",
",",
"input_type",
":",
"DataType",
"=",
"DataType",
".",
"FLOAT",
",",
"output_type",
":",
"DataType",
"=",
"None",
",",
"device",
":",
"DeviceAllocation",
"=",
"None",
")",
":",
"if",
"output_type",
"is",
"None",
":",
"o... | https://github.com/LLNL/lbann/blob/26083e6c86050302ce33148aea70f62e61cacb92/python/lbann/core/operators.py#L15-L30 | ||
aws/lumberyard | f85344403c1c2e77ec8c75deb2c116e97b713217 | dev/Tools/Python/3.7.10/mac/Python.framework/Versions/3.7/lib/python3.7/site-packages/pip/_internal/req/req_file.py | python | handle_line | (
line, # type: ParsedLine
options=None, # type: Optional[optparse.Values]
finder=None, # type: Optional[PackageFinder]
session=None, # type: Optional[PipSession]
) | Handle a single parsed requirements line; This can result in
creating/yielding requirements, or updating the finder.
:param line: The parsed line to be processed.
:param options: CLI options.
:param finder: The finder - updated by non-requirement lines.
:param session: The sessi... | Handle a single parsed requirements line; This can result in
creating/yielding requirements, or updating the finder. | [
"Handle",
"a",
"single",
"parsed",
"requirements",
"line",
";",
"This",
"can",
"result",
"in",
"creating",
"/",
"yielding",
"requirements",
"or",
"updating",
"the",
"finder",
"."
] | def handle_line(
line, # type: ParsedLine
options=None, # type: Optional[optparse.Values]
finder=None, # type: Optional[PackageFinder]
session=None, # type: Optional[PipSession]
):
# type: (...) -> Optional[ParsedRequirement]
"""Handle a single parsed requirements line; This can result in
... | [
"def",
"handle_line",
"(",
"line",
",",
"# type: ParsedLine",
"options",
"=",
"None",
",",
"# type: Optional[optparse.Values]",
"finder",
"=",
"None",
",",
"# type: Optional[PackageFinder]",
"session",
"=",
"None",
",",
"# type: Optional[PipSession]",
")",
":",
"# type:... | https://github.com/aws/lumberyard/blob/f85344403c1c2e77ec8c75deb2c116e97b713217/dev/Tools/Python/3.7.10/mac/Python.framework/Versions/3.7/lib/python3.7/site-packages/pip/_internal/req/req_file.py#L278-L320 | ||
catboost/catboost | 167f64f237114a4d10b2b4ee42adb4569137debe | contrib/python/prompt-toolkit/py3/prompt_toolkit/key_binding/bindings/named_commands.py | python | next_history | (event: E) | Move `forward` through the history list, fetching the next command. | Move `forward` through the history list, fetching the next command. | [
"Move",
"forward",
"through",
"the",
"history",
"list",
"fetching",
"the",
"next",
"command",
"."
] | def next_history(event: E) -> None:
"""
Move `forward` through the history list, fetching the next command.
"""
event.current_buffer.history_forward(count=event.arg) | [
"def",
"next_history",
"(",
"event",
":",
"E",
")",
"->",
"None",
":",
"event",
".",
"current_buffer",
".",
"history_forward",
"(",
"count",
"=",
"event",
".",
"arg",
")"
] | https://github.com/catboost/catboost/blob/167f64f237114a4d10b2b4ee42adb4569137debe/contrib/python/prompt-toolkit/py3/prompt_toolkit/key_binding/bindings/named_commands.py#L188-L192 | ||
miyosuda/TensorFlowAndroidMNIST | 7b5a4603d2780a8a2834575706e9001977524007 | jni-build/jni/include/tensorflow/contrib/rnn/python/ops/rnn_cell.py | python | GridLSTMCell._make_tf_features | (self, input_feat) | return freq_inputs | Make the frequency features.
Args:
input_feat: input Tensor, 2D, batch x num_units.
Returns:
A list of frequency features, with each element containing:
- A 2D, batch x output_dim, Tensor representing the time-frequency feature
for that frequency index. Here output_dim is feature_siz... | Make the frequency features. | [
"Make",
"the",
"frequency",
"features",
"."
] | def _make_tf_features(self, input_feat):
"""Make the frequency features.
Args:
input_feat: input Tensor, 2D, batch x num_units.
Returns:
A list of frequency features, with each element containing:
- A 2D, batch x output_dim, Tensor representing the time-frequency feature
for that... | [
"def",
"_make_tf_features",
"(",
"self",
",",
"input_feat",
")",
":",
"input_size",
"=",
"input_feat",
".",
"get_shape",
"(",
")",
".",
"with_rank",
"(",
"2",
")",
"[",
"-",
"1",
"]",
".",
"value",
"if",
"input_size",
"is",
"None",
":",
"raise",
"Value... | https://github.com/miyosuda/TensorFlowAndroidMNIST/blob/7b5a4603d2780a8a2834575706e9001977524007/jni-build/jni/include/tensorflow/contrib/rnn/python/ops/rnn_cell.py#L639-L662 | |
hanpfei/chromium-net | 392cc1fa3a8f92f42e4071ab6e674d8e0482f83f | tools/perf/page_sets/polymer.py | python | PolymerPage.PerformPageInteractions | (self, action_runner) | Override this to perform actions after the page has navigated. | Override this to perform actions after the page has navigated. | [
"Override",
"this",
"to",
"perform",
"actions",
"after",
"the",
"page",
"has",
"navigated",
"."
] | def PerformPageInteractions(self, action_runner):
""" Override this to perform actions after the page has navigated. """
pass | [
"def",
"PerformPageInteractions",
"(",
"self",
",",
"action_runner",
")",
":",
"pass"
] | https://github.com/hanpfei/chromium-net/blob/392cc1fa3a8f92f42e4071ab6e674d8e0482f83f/tools/perf/page_sets/polymer.py#L36-L38 | ||
adobe/chromium | cfe5bf0b51b1f6b9fe239c2a3c2f2364da9967d7 | native_client_sdk/src/build_tools/nacl_sdk_scons/site_tools/nacl_tools.py | python | NaClStaticLibraries | (env, sources, lib_name, is_debug=False, lib_dir='') | return [
nacl_utils.MakeNaClStaticLibEnvironment(
env,
sources,
lib_name=lib_name,
arch_spec=nacl_utils.ARCH_SPECS['x86-32'],
is_debug=is_debug,
lib_dir=lib_dir),
nacl_utils.MakeNaClStaticLibEnvironment(
env,
sources,
... | Produce one static-lib construction Environment for each supported
instruction set architecture.
Args:
env: Environment to modify.
sources: The list of source files that are used to build the objects.
lib_name: The name of the static lib.
is_debug: Whether to set the option flags for debugging or n... | Produce one static-lib construction Environment for each supported
instruction set architecture. | [
"Produce",
"one",
"static",
"-",
"lib",
"construction",
"Environment",
"for",
"each",
"supported",
"instruction",
"set",
"architecture",
"."
] | def NaClStaticLibraries(env, sources, lib_name, is_debug=False, lib_dir=''):
'''Produce one static-lib construction Environment for each supported
instruction set architecture.
Args:
env: Environment to modify.
sources: The list of source files that are used to build the objects.
lib_name: The name o... | [
"def",
"NaClStaticLibraries",
"(",
"env",
",",
"sources",
",",
"lib_name",
",",
"is_debug",
"=",
"False",
",",
"lib_dir",
"=",
"''",
")",
":",
"return",
"[",
"nacl_utils",
".",
"MakeNaClStaticLibEnvironment",
"(",
"env",
",",
"sources",
",",
"lib_name",
"=",... | https://github.com/adobe/chromium/blob/cfe5bf0b51b1f6b9fe239c2a3c2f2364da9967d7/native_client_sdk/src/build_tools/nacl_sdk_scons/site_tools/nacl_tools.py#L301-L335 | |
strukturag/libheif | 0082fea96ee70a20c8906a0373bedec0c01777bc | scripts/cpplint.py | python | ProcessFile | (filename, vlevel, extra_check_functions=[]) | Does google-lint on a single file.
Args:
filename: The name of the file to parse.
vlevel: The level of errors to report. Every error of confidence
>= verbose_level will be reported. 0 is a good default.
extra_check_functions: An array of additional check functions that will be
... | Does google-lint on a single file. | [
"Does",
"google",
"-",
"lint",
"on",
"a",
"single",
"file",
"."
] | def ProcessFile(filename, vlevel, extra_check_functions=[]):
"""Does google-lint on a single file.
Args:
filename: The name of the file to parse.
vlevel: The level of errors to report. Every error of confidence
>= verbose_level will be reported. 0 is a good default.
extra_check_functions: An ar... | [
"def",
"ProcessFile",
"(",
"filename",
",",
"vlevel",
",",
"extra_check_functions",
"=",
"[",
"]",
")",
":",
"_SetVerboseLevel",
"(",
"vlevel",
")",
"_BackupFilters",
"(",
")",
"if",
"not",
"ProcessConfigOverrides",
"(",
"filename",
")",
":",
"_RestoreFilters",
... | https://github.com/strukturag/libheif/blob/0082fea96ee70a20c8906a0373bedec0c01777bc/scripts/cpplint.py#L5889-L5974 | ||
catboost/catboost | 167f64f237114a4d10b2b4ee42adb4569137debe | contrib/python/setuptools/py3/pkg_resources/_vendor/pyparsing.py | python | ParserElement.suppress | ( self ) | return Suppress( self ) | Suppresses the output of this C{ParserElement}; useful to keep punctuation from
cluttering up returned output. | Suppresses the output of this C{ParserElement}; useful to keep punctuation from
cluttering up returned output. | [
"Suppresses",
"the",
"output",
"of",
"this",
"C",
"{",
"ParserElement",
"}",
";",
"useful",
"to",
"keep",
"punctuation",
"from",
"cluttering",
"up",
"returned",
"output",
"."
] | def suppress( self ):
"""
Suppresses the output of this C{ParserElement}; useful to keep punctuation from
cluttering up returned output.
"""
return Suppress( self ) | [
"def",
"suppress",
"(",
"self",
")",
":",
"return",
"Suppress",
"(",
"self",
")"
] | https://github.com/catboost/catboost/blob/167f64f237114a4d10b2b4ee42adb4569137debe/contrib/python/setuptools/py3/pkg_resources/_vendor/pyparsing.py#L2045-L2050 | |
llvm/llvm-project | ffa6262cb4e2a335d26416fad39a581b4f98c5f4 | clang/docs/tools/dump_ast_matchers.py | python | extract_result_types | (comment) | Extracts a list of result types from the given comment.
We allow annotations in the comment of the matcher to specify what
nodes a matcher can match on. Those comments have the form:
Usable as: Any Matcher | (Matcher<T1>[, Matcher<t2>[, ...]])
Returns ['*'] in case of 'Any Matcher', or ['T1', 'T... | Extracts a list of result types from the given comment. | [
"Extracts",
"a",
"list",
"of",
"result",
"types",
"from",
"the",
"given",
"comment",
"."
] | def extract_result_types(comment):
"""Extracts a list of result types from the given comment.
We allow annotations in the comment of the matcher to specify what
nodes a matcher can match on. Those comments have the form:
Usable as: Any Matcher | (Matcher<T1>[, Matcher<t2>[, ...]])
Returns ['*'... | [
"def",
"extract_result_types",
"(",
"comment",
")",
":",
"result_types",
"=",
"[",
"]",
"m",
"=",
"re",
".",
"search",
"(",
"r'Usable as: Any Matcher[\\s\\n]*$'",
",",
"comment",
",",
"re",
".",
"S",
")",
"if",
"m",
":",
"return",
"[",
"'*'",
"]",
"while... | https://github.com/llvm/llvm-project/blob/ffa6262cb4e2a335d26416fad39a581b4f98c5f4/clang/docs/tools/dump_ast_matchers.py#L69-L92 | ||
hanpfei/chromium-net | 392cc1fa3a8f92f42e4071ab6e674d8e0482f83f | third_party/catapult/telemetry/third_party/web-page-replay/third_party/ipaddr/ipaddr.py | python | _BaseV6.is_multicast | (self) | return self in IPv6Network('ff00::/8') | Test if the address is reserved for multicast use.
Returns:
A boolean, True if the address is a multicast address.
See RFC 2373 2.7 for details. | Test if the address is reserved for multicast use. | [
"Test",
"if",
"the",
"address",
"is",
"reserved",
"for",
"multicast",
"use",
"."
] | def is_multicast(self):
"""Test if the address is reserved for multicast use.
Returns:
A boolean, True if the address is a multicast address.
See RFC 2373 2.7 for details.
"""
return self in IPv6Network('ff00::/8') | [
"def",
"is_multicast",
"(",
"self",
")",
":",
"return",
"self",
"in",
"IPv6Network",
"(",
"'ff00::/8'",
")"
] | https://github.com/hanpfei/chromium-net/blob/392cc1fa3a8f92f42e4071ab6e674d8e0482f83f/third_party/catapult/telemetry/third_party/web-page-replay/third_party/ipaddr/ipaddr.py#L1611-L1619 | |
catboost/catboost | 167f64f237114a4d10b2b4ee42adb4569137debe | contrib/python/scipy/py3/scipy/signal/ltisys.py | python | ZerosPolesGain.to_zpk | (self) | return copy.deepcopy(self) | Return a copy of the current 'ZerosPolesGain' system.
Returns
-------
sys : instance of `ZerosPolesGain`
The current system (copy) | Return a copy of the current 'ZerosPolesGain' system. | [
"Return",
"a",
"copy",
"of",
"the",
"current",
"ZerosPolesGain",
"system",
"."
] | def to_zpk(self):
"""
Return a copy of the current 'ZerosPolesGain' system.
Returns
-------
sys : instance of `ZerosPolesGain`
The current system (copy)
"""
return copy.deepcopy(self) | [
"def",
"to_zpk",
"(",
"self",
")",
":",
"return",
"copy",
".",
"deepcopy",
"(",
"self",
")"
] | https://github.com/catboost/catboost/blob/167f64f237114a4d10b2b4ee42adb4569137debe/contrib/python/scipy/py3/scipy/signal/ltisys.py#L1045-L1055 | |
sphinxsearch/sphinx | 409f2c2b5b2ff70b04e38f92b6b1a890326bad65 | api/sphinxapi.py | python | SphinxClient.SetFilter | ( self, attribute, values, exclude=0 ) | Set values set filter.
Only match records where 'attribute' value is in given 'values' set. | Set values set filter.
Only match records where 'attribute' value is in given 'values' set. | [
"Set",
"values",
"set",
"filter",
".",
"Only",
"match",
"records",
"where",
"attribute",
"value",
"is",
"in",
"given",
"values",
"set",
"."
] | def SetFilter ( self, attribute, values, exclude=0 ):
"""
Set values set filter.
Only match records where 'attribute' value is in given 'values' set.
"""
assert(isinstance(attribute, str))
assert iter(values)
for value in values:
AssertInt32 ( value )
self._filters.append ( { 'type':SPH_FILTER_VALU... | [
"def",
"SetFilter",
"(",
"self",
",",
"attribute",
",",
"values",
",",
"exclude",
"=",
"0",
")",
":",
"assert",
"(",
"isinstance",
"(",
"attribute",
",",
"str",
")",
")",
"assert",
"iter",
"(",
"values",
")",
"for",
"value",
"in",
"values",
":",
"Ass... | https://github.com/sphinxsearch/sphinx/blob/409f2c2b5b2ff70b04e38f92b6b1a890326bad65/api/sphinxapi.py#L427-L438 | ||
hanpfei/chromium-net | 392cc1fa3a8f92f42e4071ab6e674d8e0482f83f | third_party/catapult/third_party/gsutil/third_party/apitools/apitools/base/py/encoding.py | python | JsonToMessage | (message_type, message) | return _ProtoJsonApiTools.Get().decode_message(message_type, message) | Convert the given JSON to a message of type message_type. | Convert the given JSON to a message of type message_type. | [
"Convert",
"the",
"given",
"JSON",
"to",
"a",
"message",
"of",
"type",
"message_type",
"."
] | def JsonToMessage(message_type, message):
"""Convert the given JSON to a message of type message_type."""
return _ProtoJsonApiTools.Get().decode_message(message_type, message) | [
"def",
"JsonToMessage",
"(",
"message_type",
",",
"message",
")",
":",
"return",
"_ProtoJsonApiTools",
".",
"Get",
"(",
")",
".",
"decode_message",
"(",
"message_type",
",",
"message",
")"
] | https://github.com/hanpfei/chromium-net/blob/392cc1fa3a8f92f42e4071ab6e674d8e0482f83f/third_party/catapult/third_party/gsutil/third_party/apitools/apitools/base/py/encoding.py#L91-L93 | |
pytorch/pytorch | 7176c92687d3cc847cc046bf002269c6949a21c2 | torch/storage.py | python | _StorageBase.clone | (self) | Returns a copy of this storage | Returns a copy of this storage | [
"Returns",
"a",
"copy",
"of",
"this",
"storage"
] | def clone(self):
"""Returns a copy of this storage"""
device = self.get_device() if self.is_cuda else -1
with torch.cuda.device(device):
return type(self)(self.nbytes()).copy_(self) | [
"def",
"clone",
"(",
"self",
")",
":",
"device",
"=",
"self",
".",
"get_device",
"(",
")",
"if",
"self",
".",
"is_cuda",
"else",
"-",
"1",
"with",
"torch",
".",
"cuda",
".",
"device",
"(",
"device",
")",
":",
"return",
"type",
"(",
"self",
")",
"... | https://github.com/pytorch/pytorch/blob/7176c92687d3cc847cc046bf002269c6949a21c2/torch/storage.py#L71-L75 | ||
tensorflow/tensorflow | 419e3a6b650ea4bd1b0cba23c4348f8a69f3272e | tensorflow/python/layers/utils.py | python | normalize_tuple | (value, n, name) | Transforms a single integer or iterable of integers into an integer tuple.
Args:
value: The value to validate and convert. Could an int, or any iterable
of ints.
n: The size of the tuple to be returned.
name: The name of the argument being validated, e.g. "strides" or
"kernel_size". This is o... | Transforms a single integer or iterable of integers into an integer tuple. | [
"Transforms",
"a",
"single",
"integer",
"or",
"iterable",
"of",
"integers",
"into",
"an",
"integer",
"tuple",
"."
] | def normalize_tuple(value, n, name):
"""Transforms a single integer or iterable of integers into an integer tuple.
Args:
value: The value to validate and convert. Could an int, or any iterable
of ints.
n: The size of the tuple to be returned.
name: The name of the argument being validated, e.g. "... | [
"def",
"normalize_tuple",
"(",
"value",
",",
"n",
",",
"name",
")",
":",
"if",
"isinstance",
"(",
"value",
",",
"int",
")",
":",
"return",
"(",
"value",
",",
")",
"*",
"n",
"else",
":",
"try",
":",
"value_tuple",
"=",
"tuple",
"(",
"value",
")",
... | https://github.com/tensorflow/tensorflow/blob/419e3a6b650ea4bd1b0cba23c4348f8a69f3272e/tensorflow/python/layers/utils.py#L48-L84 | ||
hpi-xnor/BMXNet | ed0b201da6667887222b8e4b5f997c4f6b61943d | python/mxnet/image/image.py | python | HueJitterAug.__call__ | (self, src) | return src | Augmenter body.
Using approximate linear transfomation described in:
https://beesbuzz.biz/code/hsv_color_transforms.php | Augmenter body.
Using approximate linear transfomation described in:
https://beesbuzz.biz/code/hsv_color_transforms.php | [
"Augmenter",
"body",
".",
"Using",
"approximate",
"linear",
"transfomation",
"described",
"in",
":",
"https",
":",
"//",
"beesbuzz",
".",
"biz",
"/",
"code",
"/",
"hsv_color_transforms",
".",
"php"
] | def __call__(self, src):
"""Augmenter body.
Using approximate linear transfomation described in:
https://beesbuzz.biz/code/hsv_color_transforms.php
"""
alpha = random.uniform(-self.hue, self.hue)
u = np.cos(alpha * np.pi)
w = np.sin(alpha * np.pi)
bt = np.... | [
"def",
"__call__",
"(",
"self",
",",
"src",
")",
":",
"alpha",
"=",
"random",
".",
"uniform",
"(",
"-",
"self",
".",
"hue",
",",
"self",
".",
"hue",
")",
"u",
"=",
"np",
".",
"cos",
"(",
"alpha",
"*",
"np",
".",
"pi",
")",
"w",
"=",
"np",
"... | https://github.com/hpi-xnor/BMXNet/blob/ed0b201da6667887222b8e4b5f997c4f6b61943d/python/mxnet/image/image.py#L747-L760 | |
JavierIH/zowi | 830c1284154b8167c9131deb9c45189fd9e67b54 | code/python-client/Oscillator.py | python | Oscillator.__init__ | (self, sp, dir) | Arguments: serial port and servo id | Arguments: serial port and servo id | [
"Arguments",
":",
"serial",
"port",
"and",
"servo",
"id"
] | def __init__(self, sp, dir):
"""Arguments: serial port and servo id"""
self.sp = sp #--- Serial device
self.dir = dir #--- Servo id
self._A = 45 #--- default amplitude
self._O = 0 #--- default offset
self._T = 2000 #--- default period
self._Ph = 0 | [
"def",
"__init__",
"(",
"self",
",",
"sp",
",",
"dir",
")",
":",
"self",
".",
"sp",
"=",
"sp",
"#--- Serial device",
"self",
".",
"dir",
"=",
"dir",
"#--- Servo id",
"self",
".",
"_A",
"=",
"45",
"#--- default amplitude",
"self",
".",
"_O",
"=",
"0",
... | https://github.com/JavierIH/zowi/blob/830c1284154b8167c9131deb9c45189fd9e67b54/code/python-client/Oscillator.py#L28-L36 | ||
blitzpp/blitz | 39f885951a9b8b11f931f917935a16066a945056 | blitz/generate/makeloops.py | python | genf90 | (loop) | Generate the fortran code from loop data. | Generate the fortran code from loop data. | [
"Generate",
"the",
"fortran",
"code",
"from",
"loop",
"data",
"."
] | def genf90(loop):
"""Generate the fortran code from loop data."""
subs=[
("loopname",loopname(loop)),
("f77args", cc([", %s"%n for n in looparrays(loop)])+
cc([", %s"%n for n in loopscalars(loop)])),
("f77decls", "%s(N)"%looparrays(loop)[0] +
cc([", %s(N)"%n for n in l... | [
"def",
"genf90",
"(",
"loop",
")",
":",
"subs",
"=",
"[",
"(",
"\"loopname\"",
",",
"loopname",
"(",
"loop",
")",
")",
",",
"(",
"\"f77args\"",
",",
"cc",
"(",
"[",
"\", %s\"",
"%",
"n",
"for",
"n",
"in",
"looparrays",
"(",
"loop",
")",
"]",
")",... | https://github.com/blitzpp/blitz/blob/39f885951a9b8b11f931f917935a16066a945056/blitz/generate/makeloops.py#L240-L256 | ||
aws/lumberyard | f85344403c1c2e77ec8c75deb2c116e97b713217 | dev/Tools/Python/3.7.10/mac/Python.framework/Versions/3.7/lib/python3.7/importlib/_bootstrap.py | python | _lock_unlock_module | (name) | Acquires then releases the module lock for a given module name.
This is used to ensure a module is completely initialized, in the
event it is being imported by another thread. | Acquires then releases the module lock for a given module name. | [
"Acquires",
"then",
"releases",
"the",
"module",
"lock",
"for",
"a",
"given",
"module",
"name",
"."
] | def _lock_unlock_module(name):
"""Acquires then releases the module lock for a given module name.
This is used to ensure a module is completely initialized, in the
event it is being imported by another thread.
"""
lock = _get_module_lock(name)
try:
lock.acquire()
except _DeadlockErr... | [
"def",
"_lock_unlock_module",
"(",
"name",
")",
":",
"lock",
"=",
"_get_module_lock",
"(",
"name",
")",
"try",
":",
"lock",
".",
"acquire",
"(",
")",
"except",
"_DeadlockError",
":",
"# Concurrent circular import, we'll accept a partially initialized",
"# module object.... | https://github.com/aws/lumberyard/blob/f85344403c1c2e77ec8c75deb2c116e97b713217/dev/Tools/Python/3.7.10/mac/Python.framework/Versions/3.7/lib/python3.7/importlib/_bootstrap.py#L194-L208 | ||
mhammond/pywin32 | 44afd86ba8485194df93234639243252deeb40d5 | isapi/install.py | python | MergeStandardOptions | (options, params) | Take an options object generated by the command line and merge
the values into the IISParameters object. | Take an options object generated by the command line and merge
the values into the IISParameters object. | [
"Take",
"an",
"options",
"object",
"generated",
"by",
"the",
"command",
"line",
"and",
"merge",
"the",
"values",
"into",
"the",
"IISParameters",
"object",
"."
] | def MergeStandardOptions(options, params):
"""
Take an options object generated by the command line and merge
the values into the IISParameters object.
"""
pass | [
"def",
"MergeStandardOptions",
"(",
"options",
",",
"params",
")",
":",
"pass"
] | https://github.com/mhammond/pywin32/blob/44afd86ba8485194df93234639243252deeb40d5/isapi/install.py#L700-L705 | ||
cvxpy/cvxpy | 5165b4fb750dfd237de8659383ef24b4b2e33aaf | cvxpy/constraints/nonpos.py | python | NonNeg.is_dcp | (self, dpp: bool = False) | return self.args[0].is_concave() | A non-negative constraint is DCP if its argument is concave. | A non-negative constraint is DCP if its argument is concave. | [
"A",
"non",
"-",
"negative",
"constraint",
"is",
"DCP",
"if",
"its",
"argument",
"is",
"concave",
"."
] | def is_dcp(self, dpp: bool = False) -> bool:
"""A non-negative constraint is DCP if its argument is concave."""
if dpp:
with scopes.dpp_scope():
return self.args[0].is_concave()
return self.args[0].is_concave() | [
"def",
"is_dcp",
"(",
"self",
",",
"dpp",
":",
"bool",
"=",
"False",
")",
"->",
"bool",
":",
"if",
"dpp",
":",
"with",
"scopes",
".",
"dpp_scope",
"(",
")",
":",
"return",
"self",
".",
"args",
"[",
"0",
"]",
".",
"is_concave",
"(",
")",
"return",... | https://github.com/cvxpy/cvxpy/blob/5165b4fb750dfd237de8659383ef24b4b2e33aaf/cvxpy/constraints/nonpos.py#L107-L112 | |
KratosMultiphysics/Kratos | 0000833054ed0503424eb28205d6508d9ca6cbbc | applications/MultilevelMonteCarloApplication/external_libraries/XMC/xmc/sampleGenerator.py | python | SampleGenerator.rawSolutions | (self, randomEvent) | return solutions, times | Return the array of raw solutions and computation time produced by the solvers.
Input argument: random event, as expect by the solve method of the solvers.
Output argument:
- solutions: list of solver outputs; solutions[j] is the solution returned by self.solvers[j].
- times: list of c... | Return the array of raw solutions and computation time produced by the solvers. | [
"Return",
"the",
"array",
"of",
"raw",
"solutions",
"and",
"computation",
"time",
"produced",
"by",
"the",
"solvers",
"."
] | def rawSolutions(self, randomEvent):
"""
Return the array of raw solutions and computation time produced by the solvers.
Input argument: random event, as expect by the solve method of the solvers.
Output argument:
- solutions: list of solver outputs; solutions[j] is the solutio... | [
"def",
"rawSolutions",
"(",
"self",
",",
"randomEvent",
")",
":",
"solutions",
"=",
"[",
"]",
"times",
"=",
"[",
"]",
"for",
"solver",
"in",
"self",
".",
"solvers",
":",
"solution",
",",
"resolution_time",
"=",
"solver",
".",
"solve",
"(",
"randomEvent",... | https://github.com/KratosMultiphysics/Kratos/blob/0000833054ed0503424eb28205d6508d9ca6cbbc/applications/MultilevelMonteCarloApplication/external_libraries/XMC/xmc/sampleGenerator.py#L45-L66 | |
facebookincubator/fizz | bd0ba1b80f72023cb7ede671a4caa85f6664d3f6 | build/fbcode_builder/getdeps/dyndeps.py | python | WinDeps.compute_dependency_paths_fast | (self, build_dir) | return sorted(dep_dirs) | Similar to compute_dependency_paths(), but rather than actually scanning
binaries, just add all library paths from the specified installation
directories. This is much faster than scanning the binaries, but may result in
more paths being returned than actually necessary. | Similar to compute_dependency_paths(), but rather than actually scanning
binaries, just add all library paths from the specified installation
directories. This is much faster than scanning the binaries, but may result in
more paths being returned than actually necessary. | [
"Similar",
"to",
"compute_dependency_paths",
"()",
"but",
"rather",
"than",
"actually",
"scanning",
"binaries",
"just",
"add",
"all",
"library",
"paths",
"from",
"the",
"specified",
"installation",
"directories",
".",
"This",
"is",
"much",
"faster",
"than",
"scann... | def compute_dependency_paths_fast(self, build_dir):
"""Similar to compute_dependency_paths(), but rather than actually scanning
binaries, just add all library paths from the specified installation
directories. This is much faster than scanning the binaries, but may result in
more paths ... | [
"def",
"compute_dependency_paths_fast",
"(",
"self",
",",
"build_dir",
")",
":",
"dep_dirs",
"=",
"set",
"(",
")",
"for",
"inst_dir",
"in",
"self",
".",
"install_dirs",
":",
"for",
"subdir",
"in",
"OBJECT_SUBDIRS",
":",
"path",
"=",
"os",
".",
"path",
".",... | https://github.com/facebookincubator/fizz/blob/bd0ba1b80f72023cb7ede671a4caa85f6664d3f6/build/fbcode_builder/getdeps/dyndeps.py#L265-L279 | |
kamyu104/LeetCode-Solutions | 77605708a927ea3b85aee5a479db733938c7c211 | Python/insert-delete-getrandom-o1-duplicates-allowed.py | python | RandomizedCollection.getRandom | (self) | return self.__list[randint(0, len(self.__list)-1)][0] | Get a random element from the collection.
:rtype: int | Get a random element from the collection.
:rtype: int | [
"Get",
"a",
"random",
"element",
"from",
"the",
"collection",
".",
":",
"rtype",
":",
"int"
] | def getRandom(self):
"""
Get a random element from the collection.
:rtype: int
"""
return self.__list[randint(0, len(self.__list)-1)][0] | [
"def",
"getRandom",
"(",
"self",
")",
":",
"return",
"self",
".",
"__list",
"[",
"randint",
"(",
"0",
",",
"len",
"(",
"self",
".",
"__list",
")",
"-",
"1",
")",
"]",
"[",
"0",
"]"
] | https://github.com/kamyu104/LeetCode-Solutions/blob/77605708a927ea3b85aee5a479db733938c7c211/Python/insert-delete-getrandom-o1-duplicates-allowed.py#L50-L55 | |
windystrife/UnrealEngine_NVIDIAGameWorks | b50e6338a7c5b26374d66306ebc7807541ff815e | Engine/Extras/ThirdPartyNotUE/emsdk/Win64/python/2.7.5.3_64bit/Lib/site-packages/isapi/simple.py | python | SimpleFilter.HttpFilterProc | (self, fc) | Called by the ISAPI framework for each filter request.
sub-classes must provide an implementation for this method. | Called by the ISAPI framework for each filter request.
sub-classes must provide an implementation for this method. | [
"Called",
"by",
"the",
"ISAPI",
"framework",
"for",
"each",
"filter",
"request",
".",
"sub",
"-",
"classes",
"must",
"provide",
"an",
"implementation",
"for",
"this",
"method",
"."
] | def HttpFilterProc(self, fc):
"""Called by the ISAPI framework for each filter request.
sub-classes must provide an implementation for this method.
"""
raise NotImplementedError("sub-classes should override HttpExtensionProc") | [
"def",
"HttpFilterProc",
"(",
"self",
",",
"fc",
")",
":",
"raise",
"NotImplementedError",
"(",
"\"sub-classes should override HttpExtensionProc\"",
")"
] | https://github.com/windystrife/UnrealEngine_NVIDIAGameWorks/blob/b50e6338a7c5b26374d66306ebc7807541ff815e/Engine/Extras/ThirdPartyNotUE/emsdk/Win64/python/2.7.5.3_64bit/Lib/site-packages/isapi/simple.py#L58-L63 | ||
wxWidgets/wxPython-Classic | 19571e1ae65f1ac445f5491474121998c97a1bf0 | src/msw/_core.py | python | GBSizerItemWindow | (*args, **kwargs) | return val | GBSizerItemWindow(Window window, GBPosition pos, GBSpan span=DefaultSpan,
int flag=0, int border=0, PyObject userData=None) -> GBSizerItem
Construct a `wx.GBSizerItem` for a window. | GBSizerItemWindow(Window window, GBPosition pos, GBSpan span=DefaultSpan,
int flag=0, int border=0, PyObject userData=None) -> GBSizerItem | [
"GBSizerItemWindow",
"(",
"Window",
"window",
"GBPosition",
"pos",
"GBSpan",
"span",
"=",
"DefaultSpan",
"int",
"flag",
"=",
"0",
"int",
"border",
"=",
"0",
"PyObject",
"userData",
"=",
"None",
")",
"-",
">",
"GBSizerItem"
] | def GBSizerItemWindow(*args, **kwargs):
"""
GBSizerItemWindow(Window window, GBPosition pos, GBSpan span=DefaultSpan,
int flag=0, int border=0, PyObject userData=None) -> GBSizerItem
Construct a `wx.GBSizerItem` for a window.
"""
val = _core_.new_GBSizerItemWindow(*args, **kwargs)
retu... | [
"def",
"GBSizerItemWindow",
"(",
"*",
"args",
",",
"*",
"*",
"kwargs",
")",
":",
"val",
"=",
"_core_",
".",
"new_GBSizerItemWindow",
"(",
"*",
"args",
",",
"*",
"*",
"kwargs",
")",
"return",
"val"
] | https://github.com/wxWidgets/wxPython-Classic/blob/19571e1ae65f1ac445f5491474121998c97a1bf0/src/msw/_core.py#L15825-L15833 | |
benoitsteiner/tensorflow-opencl | cb7cb40a57fde5cfd4731bc551e82a1e2fef43a5 | tensorflow/contrib/factorization/python/ops/gmm_ops.py | python | GmmAlgorithm.init_ops | (self) | return control_flow_ops.group(*self._init_ops) | Returns the initialization operation. | Returns the initialization operation. | [
"Returns",
"the",
"initialization",
"operation",
"."
] | def init_ops(self):
"""Returns the initialization operation."""
return control_flow_ops.group(*self._init_ops) | [
"def",
"init_ops",
"(",
"self",
")",
":",
"return",
"control_flow_ops",
".",
"group",
"(",
"*",
"self",
".",
"_init_ops",
")"
] | https://github.com/benoitsteiner/tensorflow-opencl/blob/cb7cb40a57fde5cfd4731bc551e82a1e2fef43a5/tensorflow/contrib/factorization/python/ops/gmm_ops.py#L225-L227 | |
Samsung/veles | 95ed733c2e49bc011ad98ccf2416ecec23fbf352 | libVeles/cpplint.py | python | _OutputFormat | () | return _cpplint_state.output_format | Gets the module's output format. | Gets the module's output format. | [
"Gets",
"the",
"module",
"s",
"output",
"format",
"."
] | def _OutputFormat():
"""Gets the module's output format."""
return _cpplint_state.output_format | [
"def",
"_OutputFormat",
"(",
")",
":",
"return",
"_cpplint_state",
".",
"output_format"
] | https://github.com/Samsung/veles/blob/95ed733c2e49bc011ad98ccf2416ecec23fbf352/libVeles/cpplint.py#L631-L633 | |
cornell-zhang/heterocl | 6d9e4b4acc2ee2707b2d25b27298c0335bccedfd | python/heterocl/tvm/ndarray.py | python | ext_dev | (dev_id=0) | return TVMContext(12, dev_id) | Construct a extension device
Parameters
----------
dev_id : int, optional
The integer device id
Returns
-------
ctx : TVMContext
The created context
Note
----
This API is reserved for quick testing of new
device by plugin device API as ext_dev. | Construct a extension device | [
"Construct",
"a",
"extension",
"device"
] | def ext_dev(dev_id=0):
"""Construct a extension device
Parameters
----------
dev_id : int, optional
The integer device id
Returns
-------
ctx : TVMContext
The created context
Note
----
This API is reserved for quick testing of new
device by plugin device AP... | [
"def",
"ext_dev",
"(",
"dev_id",
"=",
"0",
")",
":",
"return",
"TVMContext",
"(",
"12",
",",
"dev_id",
")"
] | https://github.com/cornell-zhang/heterocl/blob/6d9e4b4acc2ee2707b2d25b27298c0335bccedfd/python/heterocl/tvm/ndarray.py#L156-L174 | |
microsoft/ivy | 9f3c7ecc0b2383129fdd0953e10890d98d09a82d | ivy/ivy_graph.py | python | Graph.edge_cy_id | (self,edge) | return self.cy_elements.edge_id[tuple(self.id_from_concept(c) for c in edge)] | Get the cy_elements id of an edge | Get the cy_elements id of an edge | [
"Get",
"the",
"cy_elements",
"id",
"of",
"an",
"edge"
] | def edge_cy_id(self,edge):
"""Get the cy_elements id of an edge """
return self.cy_elements.edge_id[tuple(self.id_from_concept(c) for c in edge)] | [
"def",
"edge_cy_id",
"(",
"self",
",",
"edge",
")",
":",
"return",
"self",
".",
"cy_elements",
".",
"edge_id",
"[",
"tuple",
"(",
"self",
".",
"id_from_concept",
"(",
"c",
")",
"for",
"c",
"in",
"edge",
")",
"]"
] | https://github.com/microsoft/ivy/blob/9f3c7ecc0b2383129fdd0953e10890d98d09a82d/ivy/ivy_graph.py#L480-L482 | |
carla-simulator/carla | 8854804f4d7748e14d937ec763a2912823a7e5f5 | PythonAPI/examples/no_rendering_mode.py | python | InputControl._parse_mouse | (self) | Parses mouse input | Parses mouse input | [
"Parses",
"mouse",
"input"
] | def _parse_mouse(self):
"""Parses mouse input"""
if pygame.mouse.get_pressed()[0]:
x, y = pygame.mouse.get_pos()
self.mouse_offset[0] += (1.0 / self.wheel_offset) * (x - self.mouse_pos[0])
self.mouse_offset[1] += (1.0 / self.wheel_offset) * (y - self.mouse_pos[1])
... | [
"def",
"_parse_mouse",
"(",
"self",
")",
":",
"if",
"pygame",
".",
"mouse",
".",
"get_pressed",
"(",
")",
"[",
"0",
"]",
":",
"x",
",",
"y",
"=",
"pygame",
".",
"mouse",
".",
"get_pos",
"(",
")",
"self",
".",
"mouse_offset",
"[",
"0",
"]",
"+=",
... | https://github.com/carla-simulator/carla/blob/8854804f4d7748e14d937ec763a2912823a7e5f5/PythonAPI/examples/no_rendering_mode.py#L1475-L1481 | ||
aws/lumberyard | f85344403c1c2e77ec8c75deb2c116e97b713217 | dev/Gems/CloudGemFramework/v1/AWS/common-code/lib/pycparser/c_ast.py | python | Node.children | (self) | A sequence of all children that are Nodes | A sequence of all children that are Nodes | [
"A",
"sequence",
"of",
"all",
"children",
"that",
"are",
"Nodes"
] | def children(self):
""" A sequence of all children that are Nodes
"""
pass | [
"def",
"children",
"(",
"self",
")",
":",
"pass"
] | https://github.com/aws/lumberyard/blob/f85344403c1c2e77ec8c75deb2c116e97b713217/dev/Gems/CloudGemFramework/v1/AWS/common-code/lib/pycparser/c_ast.py#L53-L56 | ||
bairdzhang/smallhardface | 76fa1d87a9602d9b13d7a7fe693fc7aec91cab80 | caffe/python/caffe/io.py | python | Transformer.set_input_scale | (self, in_, scale) | Set the scale of preprocessed inputs s.t. the blob = blob * scale.
N.B. input_scale is done AFTER mean subtraction and other preprocessing
while raw_scale is done BEFORE.
Parameters
----------
in_ : which input to assign this scale factor
scale : scale coefficient | Set the scale of preprocessed inputs s.t. the blob = blob * scale.
N.B. input_scale is done AFTER mean subtraction and other preprocessing
while raw_scale is done BEFORE. | [
"Set",
"the",
"scale",
"of",
"preprocessed",
"inputs",
"s",
".",
"t",
".",
"the",
"blob",
"=",
"blob",
"*",
"scale",
".",
"N",
".",
"B",
".",
"input_scale",
"is",
"done",
"AFTER",
"mean",
"subtraction",
"and",
"other",
"preprocessing",
"while",
"raw_scal... | def set_input_scale(self, in_, scale):
"""
Set the scale of preprocessed inputs s.t. the blob = blob * scale.
N.B. input_scale is done AFTER mean subtraction and other preprocessing
while raw_scale is done BEFORE.
Parameters
----------
in_ : which input to assign... | [
"def",
"set_input_scale",
"(",
"self",
",",
"in_",
",",
"scale",
")",
":",
"self",
".",
"__check_input",
"(",
"in_",
")",
"self",
".",
"input_scale",
"[",
"in_",
"]",
"=",
"scale"
] | https://github.com/bairdzhang/smallhardface/blob/76fa1d87a9602d9b13d7a7fe693fc7aec91cab80/caffe/python/caffe/io.py#L262-L274 | ||
msitt/blpapi-python | bebcf43668c9e5f5467b1f685f9baebbfc45bc87 | src/blpapi/element.py | python | Element.getValueAsElement | (self, index=0) | return Element(res[1], self._getDataHolder()) | Args:
index (int): Index of the value in the element
Returns:
Element: ``index``\ th entry in the :class:`Element` as a Element.
Raises:
InvalidConversionException: If the data type of this
:class:`Element` cannot be converted to an :class:`Element`.... | Args:
index (int): Index of the value in the element | [
"Args",
":",
"index",
"(",
"int",
")",
":",
"Index",
"of",
"the",
"value",
"in",
"the",
"element"
] | def getValueAsElement(self, index=0):
"""
Args:
index (int): Index of the value in the element
Returns:
Element: ``index``\ th entry in the :class:`Element` as a Element.
Raises:
InvalidConversionException: If the data type of this
:c... | [
"def",
"getValueAsElement",
"(",
"self",
",",
"index",
"=",
"0",
")",
":",
"self",
".",
"__assertIsValid",
"(",
")",
"res",
"=",
"internals",
".",
"blpapi_Element_getValueAsElement",
"(",
"self",
".",
"__handle",
",",
"index",
")",
"_ExceptionUtil",
".",
"ra... | https://github.com/msitt/blpapi-python/blob/bebcf43668c9e5f5467b1f685f9baebbfc45bc87/src/blpapi/element.py#L767-L784 | |
aws/lumberyard | f85344403c1c2e77ec8c75deb2c116e97b713217 | dev/Gems/CloudGemMetric/v1/AWS/common-code/Lib/numba/unicode_support.py | python | _Py_ISALNUM | (ch) | return _Py_ctype_table[_Py_CHARMASK(ch)] & _PY_CTF.ALNUM | Equivalent to the CPython macro `Py_ISALNUM()` | Equivalent to the CPython macro `Py_ISALNUM()` | [
"Equivalent",
"to",
"the",
"CPython",
"macro",
"Py_ISALNUM",
"()"
] | def _Py_ISALNUM(ch):
"""
Equivalent to the CPython macro `Py_ISALNUM()`
"""
return _Py_ctype_table[_Py_CHARMASK(ch)] & _PY_CTF.ALNUM | [
"def",
"_Py_ISALNUM",
"(",
"ch",
")",
":",
"return",
"_Py_ctype_table",
"[",
"_Py_CHARMASK",
"(",
"ch",
")",
"]",
"&",
"_PY_CTF",
".",
"ALNUM"
] | https://github.com/aws/lumberyard/blob/f85344403c1c2e77ec8c75deb2c116e97b713217/dev/Gems/CloudGemMetric/v1/AWS/common-code/Lib/numba/unicode_support.py#L725-L729 | |
facebook/mysql-5.6 | 65a650660ec7b4d627d1b738f397252ff4706207 | arcanist/lint/cpp_linter/cpplint.py | python | CheckAltTokens | (filename, clean_lines, linenum, error) | Check alternative keywords being used in boolean expressions.
Args:
filename: The name of the current file.
clean_lines: A CleansedLines instance containing the file.
linenum: The number of the line to check.
error: The function to call with any errors found. | Check alternative keywords being used in boolean expressions. | [
"Check",
"alternative",
"keywords",
"being",
"used",
"in",
"boolean",
"expressions",
"."
] | def CheckAltTokens(filename, clean_lines, linenum, error):
"""Check alternative keywords being used in boolean expressions.
Args:
filename: The name of the current file.
clean_lines: A CleansedLines instance containing the file.
linenum: The number of the line to check.
error: The function to call ... | [
"def",
"CheckAltTokens",
"(",
"filename",
",",
"clean_lines",
",",
"linenum",
",",
"error",
")",
":",
"line",
"=",
"clean_lines",
".",
"elided",
"[",
"linenum",
"]",
"# Avoid preprocessor lines",
"if",
"Match",
"(",
"r'^\\s*#'",
",",
"line",
")",
":",
"retur... | https://github.com/facebook/mysql-5.6/blob/65a650660ec7b4d627d1b738f397252ff4706207/arcanist/lint/cpp_linter/cpplint.py#L3310-L3339 | ||
tkn-tub/ns3-gym | 19bfe0a583e641142609939a090a09dfc63a095f | utils/grid.py | python | Timeline.get_range | (self, name) | return timeline | ! Get range
@param self this object
@param name name
@return the range | ! Get range | [
"!",
"Get",
"range"
] | def get_range(self, name):
"""! Get range
@param self this object
@param name name
@return the range
"""
for range in self.ranges:
if range.name == name:
return range
timeline = TimelineDataRange(name)
self.ranges.append(timelin... | [
"def",
"get_range",
"(",
"self",
",",
"name",
")",
":",
"for",
"range",
"in",
"self",
".",
"ranges",
":",
"if",
"range",
".",
"name",
"==",
"name",
":",
"return",
"range",
"timeline",
"=",
"TimelineDataRange",
"(",
"name",
")",
"self",
".",
"ranges",
... | https://github.com/tkn-tub/ns3-gym/blob/19bfe0a583e641142609939a090a09dfc63a095f/utils/grid.py#L284-L295 | |
wxWidgets/wxPython-Classic | 19571e1ae65f1ac445f5491474121998c97a1bf0 | src/osx_carbon/_core.py | python | MenuBar.Check | (*args, **kwargs) | return _core_.MenuBar_Check(*args, **kwargs) | Check(self, int id, bool check) | Check(self, int id, bool check) | [
"Check",
"(",
"self",
"int",
"id",
"bool",
"check",
")"
] | def Check(*args, **kwargs):
"""Check(self, int id, bool check)"""
return _core_.MenuBar_Check(*args, **kwargs) | [
"def",
"Check",
"(",
"*",
"args",
",",
"*",
"*",
"kwargs",
")",
":",
"return",
"_core_",
".",
"MenuBar_Check",
"(",
"*",
"args",
",",
"*",
"*",
"kwargs",
")"
] | https://github.com/wxWidgets/wxPython-Classic/blob/19571e1ae65f1ac445f5491474121998c97a1bf0/src/osx_carbon/_core.py#L12335-L12337 | |
NicknineTheEagle/TF2-Base | 20459c5a7fbc995b6bf54fa85c2f62a101e9fb64 | src/thirdparty/protobuf-2.3.0/python/google/protobuf/internal/encoder.py | python | _StructPackEncoder | (wire_type, format) | return SpecificEncoder | Return a constructor for an encoder for a fixed-width field.
Args:
wire_type: The field's wire type, for encoding tags.
format: The format string to pass to struct.pack(). | Return a constructor for an encoder for a fixed-width field. | [
"Return",
"a",
"constructor",
"for",
"an",
"encoder",
"for",
"a",
"fixed",
"-",
"width",
"field",
"."
] | def _StructPackEncoder(wire_type, format):
"""Return a constructor for an encoder for a fixed-width field.
Args:
wire_type: The field's wire type, for encoding tags.
format: The format string to pass to struct.pack().
"""
value_size = struct.calcsize(format)
def SpecificEncoder(field_number, ... | [
"def",
"_StructPackEncoder",
"(",
"wire_type",
",",
"format",
")",
":",
"value_size",
"=",
"struct",
".",
"calcsize",
"(",
"format",
")",
"def",
"SpecificEncoder",
"(",
"field_number",
",",
"is_repeated",
",",
"is_packed",
")",
":",
"local_struct_pack",
"=",
"... | https://github.com/NicknineTheEagle/TF2-Base/blob/20459c5a7fbc995b6bf54fa85c2f62a101e9fb64/src/thirdparty/protobuf-2.3.0/python/google/protobuf/internal/encoder.py#L467-L502 | |
aws/lumberyard | f85344403c1c2e77ec8c75deb2c116e97b713217 | dev/Gems/CloudGemMetric/v1/AWS/python/windows/Lib/numpy/lib/type_check.py | python | asscalar | (a) | return a.item() | Convert an array of size 1 to its scalar equivalent.
.. deprecated:: 1.16
Deprecated, use `numpy.ndarray.item()` instead.
Parameters
----------
a : ndarray
Input array of size 1.
Returns
-------
out : scalar
Scalar representation of `a`. The output data type is th... | Convert an array of size 1 to its scalar equivalent. | [
"Convert",
"an",
"array",
"of",
"size",
"1",
"to",
"its",
"scalar",
"equivalent",
"."
] | def asscalar(a):
"""
Convert an array of size 1 to its scalar equivalent.
.. deprecated:: 1.16
Deprecated, use `numpy.ndarray.item()` instead.
Parameters
----------
a : ndarray
Input array of size 1.
Returns
-------
out : scalar
Scalar representation of `a... | [
"def",
"asscalar",
"(",
"a",
")",
":",
"return",
"a",
".",
"item",
"(",
")"
] | https://github.com/aws/lumberyard/blob/f85344403c1c2e77ec8c75deb2c116e97b713217/dev/Gems/CloudGemMetric/v1/AWS/python/windows/Lib/numpy/lib/type_check.py#L557-L581 | |
SFTtech/openage | d6a08c53c48dc1e157807471df92197f6ca9e04d | openage/convert/entity_object/export/formats/nyan_file.py | python | NyanFile.set_import_tree | (self, import_tree) | Sets the import tree of the file. | Sets the import tree of the file. | [
"Sets",
"the",
"import",
"tree",
"of",
"the",
"file",
"."
] | def set_import_tree(self, import_tree):
"""
Sets the import tree of the file.
"""
self.import_tree = import_tree | [
"def",
"set_import_tree",
"(",
"self",
",",
"import_tree",
")",
":",
"self",
".",
"import_tree",
"=",
"import_tree"
] | https://github.com/SFTtech/openage/blob/d6a08c53c48dc1e157807471df92197f6ca9e04d/openage/convert/entity_object/export/formats/nyan_file.py#L92-L96 | ||
mantidproject/mantid | 03deeb89254ec4289edb8771e0188c2090a02f32 | qt/python/mantidqtinterfaces/mantidqtinterfaces/Muon/GUI/Common/fitting_widgets/general_fitting/general_fitting_view.py | python | GeneralFittingView.simultaneous_fit_by | (self) | return self.general_fitting_options.simultaneous_fit_by | Returns what you are simultaneously fitting by (Run or Group/Pair). | Returns what you are simultaneously fitting by (Run or Group/Pair). | [
"Returns",
"what",
"you",
"are",
"simultaneously",
"fitting",
"by",
"(",
"Run",
"or",
"Group",
"/",
"Pair",
")",
"."
] | def simultaneous_fit_by(self) -> str:
"""Returns what you are simultaneously fitting by (Run or Group/Pair)."""
return self.general_fitting_options.simultaneous_fit_by | [
"def",
"simultaneous_fit_by",
"(",
"self",
")",
"->",
"str",
":",
"return",
"self",
".",
"general_fitting_options",
".",
"simultaneous_fit_by"
] | https://github.com/mantidproject/mantid/blob/03deeb89254ec4289edb8771e0188c2090a02f32/qt/python/mantidqtinterfaces/mantidqtinterfaces/Muon/GUI/Common/fitting_widgets/general_fitting/general_fitting_view.py#L56-L58 | |
swift/swift | 12d031cf8177fdec0137f9aa7e2912fa23c4416b | 3rdParty/SCons/scons-3.0.1/engine/SCons/Node/__init__.py | python | Walker.get_next | (self) | return None | Return the next node for this walk of the tree.
This function is intentionally iterative, not recursive,
to sidestep any issues of stack size limitations. | Return the next node for this walk of the tree. | [
"Return",
"the",
"next",
"node",
"for",
"this",
"walk",
"of",
"the",
"tree",
"."
] | def get_next(self):
"""Return the next node for this walk of the tree.
This function is intentionally iterative, not recursive,
to sidestep any issues of stack size limitations.
"""
while self.stack:
if self.stack[-1].wkids:
node = self.stack[-1].wki... | [
"def",
"get_next",
"(",
"self",
")",
":",
"while",
"self",
".",
"stack",
":",
"if",
"self",
".",
"stack",
"[",
"-",
"1",
"]",
".",
"wkids",
":",
"node",
"=",
"self",
".",
"stack",
"[",
"-",
"1",
"]",
".",
"wkids",
".",
"pop",
"(",
"0",
")",
... | https://github.com/swift/swift/blob/12d031cf8177fdec0137f9aa7e2912fa23c4416b/3rdParty/SCons/scons-3.0.1/engine/SCons/Node/__init__.py#L1694-L1722 | |
Xilinx/Vitis-AI | fc74d404563d9951b57245443c73bef389f3657f | tools/Vitis-AI-Quantizer/vai_q_tensorflow1.x/tensorflow/python/training/saving/saveable_object.py | python | SaveableObject.optional_restore | (self) | return False | A hint to restore assertions that this object is optional. | A hint to restore assertions that this object is optional. | [
"A",
"hint",
"to",
"restore",
"assertions",
"that",
"this",
"object",
"is",
"optional",
"."
] | def optional_restore(self):
"""A hint to restore assertions that this object is optional."""
return False | [
"def",
"optional_restore",
"(",
"self",
")",
":",
"return",
"False"
] | https://github.com/Xilinx/Vitis-AI/blob/fc74d404563d9951b57245443c73bef389f3657f/tools/Vitis-AI-Quantizer/vai_q_tensorflow1.x/tensorflow/python/training/saving/saveable_object.py#L73-L75 | |
Xilinx/Vitis-AI | fc74d404563d9951b57245443c73bef389f3657f | tools/Vitis-AI-Quantizer/vai_q_tensorflow1.x/tensorflow/python/ops/linalg_ops.py | python | matrix_solve_ls | (matrix, rhs, l2_regularizer=0.0, fast=True, name=None) | r"""Solves one or more linear least-squares problems.
`matrix` is a tensor of shape `[..., M, N]` whose inner-most 2 dimensions
form `M`-by-`N` matrices. Rhs is a tensor of shape `[..., M, K]` whose
inner-most 2 dimensions form `M`-by-`K` matrices. The computed output is a
`Tensor` of shape `[..., N, K]` whos... | r"""Solves one or more linear least-squares problems. | [
"r",
"Solves",
"one",
"or",
"more",
"linear",
"least",
"-",
"squares",
"problems",
"."
] | def matrix_solve_ls(matrix, rhs, l2_regularizer=0.0, fast=True, name=None):
r"""Solves one or more linear least-squares problems.
`matrix` is a tensor of shape `[..., M, N]` whose inner-most 2 dimensions
form `M`-by-`N` matrices. Rhs is a tensor of shape `[..., M, K]` whose
inner-most 2 dimensions form `M`-by-... | [
"def",
"matrix_solve_ls",
"(",
"matrix",
",",
"rhs",
",",
"l2_regularizer",
"=",
"0.0",
",",
"fast",
"=",
"True",
",",
"name",
"=",
"None",
")",
":",
"# pylint: disable=long-lambda",
"def",
"_use_composite_impl",
"(",
"fast",
",",
"tensor_shape",
")",
":",
"... | https://github.com/Xilinx/Vitis-AI/blob/fc74d404563d9951b57245443c73bef389f3657f/tools/Vitis-AI-Quantizer/vai_q_tensorflow1.x/tensorflow/python/ops/linalg_ops.py#L174-L306 | ||
Xilinx/Vitis-AI | fc74d404563d9951b57245443c73bef389f3657f | tools/Vitis-AI-Quantizer/vai_q_tensorflow1.x/tensorflow/python/debug/cli/curses_ui.py | python | CursesUI._toast | (self, message, color=None, line_index=None) | Display a one-line message on the screen.
By default, the toast is displayed in the line right above the scroll bar.
But the line location can be overridden with the line_index arg.
Args:
message: (str) the message to display.
color: (str) optional color attribute for the message.
line_i... | Display a one-line message on the screen. | [
"Display",
"a",
"one",
"-",
"line",
"message",
"on",
"the",
"screen",
"."
] | def _toast(self, message, color=None, line_index=None):
"""Display a one-line message on the screen.
By default, the toast is displayed in the line right above the scroll bar.
But the line location can be overridden with the line_index arg.
Args:
message: (str) the message to display.
colo... | [
"def",
"_toast",
"(",
"self",
",",
"message",
",",
"color",
"=",
"None",
",",
"line_index",
"=",
"None",
")",
":",
"pad",
",",
"_",
",",
"_",
"=",
"self",
".",
"_display_lines",
"(",
"debugger_cli_common",
".",
"RichTextLines",
"(",
"message",
",",
"fo... | https://github.com/Xilinx/Vitis-AI/blob/fc74d404563d9951b57245443c73bef389f3657f/tools/Vitis-AI-Quantizer/vai_q_tensorflow1.x/tensorflow/python/debug/cli/curses_ui.py#L1608-L1632 | ||
wxWidgets/wxPython-Classic | 19571e1ae65f1ac445f5491474121998c97a1bf0 | src/msw/propgrid.py | python | PropertyGrid.SetSplitterPosition | (*args, **kwargs) | return _propgrid.PropertyGrid_SetSplitterPosition(*args, **kwargs) | SetSplitterPosition(self, int newXPos, int col=0) | SetSplitterPosition(self, int newXPos, int col=0) | [
"SetSplitterPosition",
"(",
"self",
"int",
"newXPos",
"int",
"col",
"=",
"0",
")"
] | def SetSplitterPosition(*args, **kwargs):
"""SetSplitterPosition(self, int newXPos, int col=0)"""
return _propgrid.PropertyGrid_SetSplitterPosition(*args, **kwargs) | [
"def",
"SetSplitterPosition",
"(",
"*",
"args",
",",
"*",
"*",
"kwargs",
")",
":",
"return",
"_propgrid",
".",
"PropertyGrid_SetSplitterPosition",
"(",
"*",
"args",
",",
"*",
"*",
"kwargs",
")"
] | https://github.com/wxWidgets/wxPython-Classic/blob/19571e1ae65f1ac445f5491474121998c97a1bf0/src/msw/propgrid.py#L2275-L2277 | |
turi-code/SFrame | 796b9bdfb2fa1b881d82080754643c7e68629cd2 | oss_src/unity/python/sframe/data_structures/sarray.py | python | SArray.hash | (self, seed=0) | Returns an SArray with a hash of each element. seed can be used
to change the hash function to allow this method to be used for
random number generation.
Parameters
----------
seed : int
Defaults to 0. Can be changed to different values to get
different ... | Returns an SArray with a hash of each element. seed can be used
to change the hash function to allow this method to be used for
random number generation. | [
"Returns",
"an",
"SArray",
"with",
"a",
"hash",
"of",
"each",
"element",
".",
"seed",
"can",
"be",
"used",
"to",
"change",
"the",
"hash",
"function",
"to",
"allow",
"this",
"method",
"to",
"be",
"used",
"for",
"random",
"number",
"generation",
"."
] | def hash(self, seed=0):
"""
Returns an SArray with a hash of each element. seed can be used
to change the hash function to allow this method to be used for
random number generation.
Parameters
----------
seed : int
Defaults to 0. Can be changed to dif... | [
"def",
"hash",
"(",
"self",
",",
"seed",
"=",
"0",
")",
":",
"with",
"cython_context",
"(",
")",
":",
"return",
"SArray",
"(",
"_proxy",
"=",
"self",
".",
"__proxy__",
".",
"hash",
"(",
"seed",
")",
")"
] | https://github.com/turi-code/SFrame/blob/796b9bdfb2fa1b881d82080754643c7e68629cd2/oss_src/unity/python/sframe/data_structures/sarray.py#L1976-L1995 | ||
aws/lumberyard | f85344403c1c2e77ec8c75deb2c116e97b713217 | dev/Tools/Python/3.7.10/windows/Lib/smtplib.py | python | SMTP.send | (self, s) | Send `s' to the server. | Send `s' to the server. | [
"Send",
"s",
"to",
"the",
"server",
"."
] | def send(self, s):
"""Send `s' to the server."""
if self.debuglevel > 0:
self._print_debug('send:', repr(s))
if hasattr(self, 'sock') and self.sock:
if isinstance(s, str):
# send is used by the 'data' command, where command_encoding
# shoul... | [
"def",
"send",
"(",
"self",
",",
"s",
")",
":",
"if",
"self",
".",
"debuglevel",
">",
"0",
":",
"self",
".",
"_print_debug",
"(",
"'send:'",
",",
"repr",
"(",
"s",
")",
")",
"if",
"hasattr",
"(",
"self",
",",
"'sock'",
")",
"and",
"self",
".",
... | https://github.com/aws/lumberyard/blob/f85344403c1c2e77ec8c75deb2c116e97b713217/dev/Tools/Python/3.7.10/windows/Lib/smtplib.py#L343-L359 | ||
aws/lumberyard | f85344403c1c2e77ec8c75deb2c116e97b713217 | dev/Gems/CloudGemDefectReporter/v1/AWS/common-code/Lib/pkg_resources/__init__.py | python | EntryPoint.parse_map | (cls, data, dist=None) | return maps | Parse a map of entry point groups | Parse a map of entry point groups | [
"Parse",
"a",
"map",
"of",
"entry",
"point",
"groups"
] | def parse_map(cls, data, dist=None):
"""Parse a map of entry point groups"""
if isinstance(data, dict):
data = data.items()
else:
data = split_sections(data)
maps = {}
for group, lines in data:
if group is None:
if not lines:
... | [
"def",
"parse_map",
"(",
"cls",
",",
"data",
",",
"dist",
"=",
"None",
")",
":",
"if",
"isinstance",
"(",
"data",
",",
"dict",
")",
":",
"data",
"=",
"data",
".",
"items",
"(",
")",
"else",
":",
"data",
"=",
"split_sections",
"(",
"data",
")",
"m... | https://github.com/aws/lumberyard/blob/f85344403c1c2e77ec8c75deb2c116e97b713217/dev/Gems/CloudGemDefectReporter/v1/AWS/common-code/Lib/pkg_resources/__init__.py#L2485-L2501 | |
apache/qpid-proton | 6bcdfebb55ea3554bc29b1901422532db331a591 | python/proton/_handlers.py | python | MessagingHandler.on_rejected | (self, event: Event) | Called when the remote peer rejects an outgoing message.
:param event: The underlying event object. Use this to obtain further
information on the event. | Called when the remote peer rejects an outgoing message. | [
"Called",
"when",
"the",
"remote",
"peer",
"rejects",
"an",
"outgoing",
"message",
"."
] | def on_rejected(self, event: Event) -> None:
"""
Called when the remote peer rejects an outgoing message.
:param event: The underlying event object. Use this to obtain further
information on the event.
"""
pass | [
"def",
"on_rejected",
"(",
"self",
",",
"event",
":",
"Event",
")",
"->",
"None",
":",
"pass"
] | https://github.com/apache/qpid-proton/blob/6bcdfebb55ea3554bc29b1901422532db331a591/python/proton/_handlers.py#L844-L851 | ||
stan-dev/math | 5fd79f89933269a4ca4d8dd1fde2a36d53d4768c | lib/cpplint_1.4.5/cpplint.py | python | Match | (pattern, s) | return _regexp_compile_cache[pattern].match(s) | Matches the string with the pattern, caching the compiled regexp. | Matches the string with the pattern, caching the compiled regexp. | [
"Matches",
"the",
"string",
"with",
"the",
"pattern",
"caching",
"the",
"compiled",
"regexp",
"."
] | def Match(pattern, s):
"""Matches the string with the pattern, caching the compiled regexp."""
# The regexp compilation caching is inlined in both Match and Search for
# performance reasons; factoring it out into a separate function turns out
# to be noticeably expensive.
if pattern not in _regexp_compile_cac... | [
"def",
"Match",
"(",
"pattern",
",",
"s",
")",
":",
"# The regexp compilation caching is inlined in both Match and Search for",
"# performance reasons; factoring it out into a separate function turns out",
"# to be noticeably expensive.",
"if",
"pattern",
"not",
"in",
"_regexp_compile_... | https://github.com/stan-dev/math/blob/5fd79f89933269a4ca4d8dd1fde2a36d53d4768c/lib/cpplint_1.4.5/cpplint.py#L797-L804 | |
arangodb/arangodb | 0d658689c7d1b721b314fa3ca27d38303e1570c8 | 3rdParty/V8/v7.9.317/third_party/jinja2/compiler.py | python | CodeGenerator.fail | (self, msg, lineno) | Fail with a :exc:`TemplateAssertionError`. | Fail with a :exc:`TemplateAssertionError`. | [
"Fail",
"with",
"a",
":",
"exc",
":",
"TemplateAssertionError",
"."
] | def fail(self, msg, lineno):
"""Fail with a :exc:`TemplateAssertionError`."""
raise TemplateAssertionError(msg, lineno, self.name, self.filename) | [
"def",
"fail",
"(",
"self",
",",
"msg",
",",
"lineno",
")",
":",
"raise",
"TemplateAssertionError",
"(",
"msg",
",",
"lineno",
",",
"self",
".",
"name",
",",
"self",
".",
"filename",
")"
] | https://github.com/arangodb/arangodb/blob/0d658689c7d1b721b314fa3ca27d38303e1570c8/3rdParty/V8/v7.9.317/third_party/jinja2/compiler.py#L313-L315 | ||
aws/lumberyard | f85344403c1c2e77ec8c75deb2c116e97b713217 | dev/Gems/CloudGemMetric/v1/AWS/common-code/Lib/psutil/_pslinux.py | python | net_io_counters | () | return retdict | Return network I/O statistics for every network interface
installed on the system as a dict of raw tuples. | Return network I/O statistics for every network interface
installed on the system as a dict of raw tuples. | [
"Return",
"network",
"I",
"/",
"O",
"statistics",
"for",
"every",
"network",
"interface",
"installed",
"on",
"the",
"system",
"as",
"a",
"dict",
"of",
"raw",
"tuples",
"."
] | def net_io_counters():
"""Return network I/O statistics for every network interface
installed on the system as a dict of raw tuples.
"""
with open_text("%s/net/dev" % get_procfs_path()) as f:
lines = f.readlines()
retdict = {}
for line in lines[2:]:
colon = line.rfind(':')
... | [
"def",
"net_io_counters",
"(",
")",
":",
"with",
"open_text",
"(",
"\"%s/net/dev\"",
"%",
"get_procfs_path",
"(",
")",
")",
"as",
"f",
":",
"lines",
"=",
"f",
".",
"readlines",
"(",
")",
"retdict",
"=",
"{",
"}",
"for",
"line",
"in",
"lines",
"[",
"2... | https://github.com/aws/lumberyard/blob/f85344403c1c2e77ec8c75deb2c116e97b713217/dev/Gems/CloudGemMetric/v1/AWS/common-code/Lib/psutil/_pslinux.py#L988-L1022 | |
bundy-dns/bundy | 3d41934996b82b0cd2fe22dd74d2abc1daba835d | tools/query_cmp/src/lib/compare_rrset.py | python | rr_cmp | (rra, rrb) | return(cmp_flag) | Compare two rrsets: rra and rrb | Compare two rrsets: rra and rrb | [
"Compare",
"two",
"rrsets",
":",
"rra",
"and",
"rrb"
] | def rr_cmp(rra, rrb):
""" Compare two rrsets: rra and rrb """
if rra.get_name() != rrb.get_name(): return(False)
if rra.get_class() != rrb.get_class(): return(False)
if rra.get_type() != rrb.get_type(): return(False)
if rra.get_ttl() != rrb.get_ttl(): return(False)
rdata_a = rra.get_rdata()
rdata_b = rrb.get_rd... | [
"def",
"rr_cmp",
"(",
"rra",
",",
"rrb",
")",
":",
"if",
"rra",
".",
"get_name",
"(",
")",
"!=",
"rrb",
".",
"get_name",
"(",
")",
":",
"return",
"(",
"False",
")",
"if",
"rra",
".",
"get_class",
"(",
")",
"!=",
"rrb",
".",
"get_class",
"(",
")... | https://github.com/bundy-dns/bundy/blob/3d41934996b82b0cd2fe22dd74d2abc1daba835d/tools/query_cmp/src/lib/compare_rrset.py#L187-L212 | |
alibaba/graph-learn | 54cafee9db3054dc310a28b856be7f97c7d5aee9 | graphlearn/python/nn/data.py | python | Data.apply | (self, func) | return self | Applies the function `func` to all attributes. | Applies the function `func` to all attributes. | [
"Applies",
"the",
"function",
"func",
"to",
"all",
"attributes",
"."
] | def apply(self, func):
"""Applies the function `func` to all attributes.
"""
for k, v in self.__dict__.items():
if v is not None and k[:2] != '__' and k[-2:] != '__':
self.__dict__[k] = func(v)
return self | [
"def",
"apply",
"(",
"self",
",",
"func",
")",
":",
"for",
"k",
",",
"v",
"in",
"self",
".",
"__dict__",
".",
"items",
"(",
")",
":",
"if",
"v",
"is",
"not",
"None",
"and",
"k",
"[",
":",
"2",
"]",
"!=",
"'__'",
"and",
"k",
"[",
"-",
"2",
... | https://github.com/alibaba/graph-learn/blob/54cafee9db3054dc310a28b856be7f97c7d5aee9/graphlearn/python/nn/data.py#L55-L61 | |
ValveSoftware/source-sdk-2013 | 0d8dceea4310fde5706b3ce1c70609d72a38efdf | mp/src/thirdparty/protobuf-2.3.0/python/mox.py | python | MockMethod.__ne__ | (self, rhs) | return not self == rhs | Test whether this MockMethod is not equivalent to another MockMethod.
Args:
# rhs: the right hand side of the test
rhs: MockMethod | Test whether this MockMethod is not equivalent to another MockMethod. | [
"Test",
"whether",
"this",
"MockMethod",
"is",
"not",
"equivalent",
"to",
"another",
"MockMethod",
"."
] | def __ne__(self, rhs):
"""Test whether this MockMethod is not equivalent to another MockMethod.
Args:
# rhs: the right hand side of the test
rhs: MockMethod
"""
return not self == rhs | [
"def",
"__ne__",
"(",
"self",
",",
"rhs",
")",
":",
"return",
"not",
"self",
"==",
"rhs"
] | https://github.com/ValveSoftware/source-sdk-2013/blob/0d8dceea4310fde5706b3ce1c70609d72a38efdf/mp/src/thirdparty/protobuf-2.3.0/python/mox.py#L635-L643 | |
epam/Indigo | 30e40b4b1eb9bae0207435a26cfcb81ddcc42be1 | api/python/indigo/__init__.py | python | IndigoObject.setImplicitHCount | (self, impl_h) | return self.dispatcher._checkResult(
Indigo._lib.indigoSetImplicitHCount(self.id, impl_h)
) | Atom method sets implicit hydrogen count
Args:
name (int): implicit hydrogen count
Returns:
int: 1 if there are no errors | Atom method sets implicit hydrogen count | [
"Atom",
"method",
"sets",
"implicit",
"hydrogen",
"count"
] | def setImplicitHCount(self, impl_h):
"""Atom method sets implicit hydrogen count
Args:
name (int): implicit hydrogen count
Returns:
int: 1 if there are no errors
"""
self.dispatcher._setSessionId()
return self.dispatcher._checkResult(
... | [
"def",
"setImplicitHCount",
"(",
"self",
",",
"impl_h",
")",
":",
"self",
".",
"dispatcher",
".",
"_setSessionId",
"(",
")",
"return",
"self",
".",
"dispatcher",
".",
"_checkResult",
"(",
"Indigo",
".",
"_lib",
".",
"indigoSetImplicitHCount",
"(",
"self",
".... | https://github.com/epam/Indigo/blob/30e40b4b1eb9bae0207435a26cfcb81ddcc42be1/api/python/indigo/__init__.py#L2855-L2867 | |
pmq20/node-packer | 12c46c6e44fbc14d9ee645ebd17d5296b324f7e0 | current/tools/gyp/pylib/gyp/xcodeproj_file.py | python | XCObject._XCKVPrint | (self, file, tabs, key, value) | Prints a key and value, members of an XCObject's _properties dictionary,
to file.
tabs is an int identifying the indentation level. If the class'
_should_print_single_line variable is True, tabs is ignored and the
key-value pair will be followed by a space insead of a newline. | Prints a key and value, members of an XCObject's _properties dictionary,
to file. | [
"Prints",
"a",
"key",
"and",
"value",
"members",
"of",
"an",
"XCObject",
"s",
"_properties",
"dictionary",
"to",
"file",
"."
] | def _XCKVPrint(self, file, tabs, key, value):
"""Prints a key and value, members of an XCObject's _properties dictionary,
to file.
tabs is an int identifying the indentation level. If the class'
_should_print_single_line variable is True, tabs is ignored and the
key-value pair will be followed by ... | [
"def",
"_XCKVPrint",
"(",
"self",
",",
"file",
",",
"tabs",
",",
"key",
",",
"value",
")",
":",
"if",
"self",
".",
"_should_print_single_line",
":",
"printable",
"=",
"''",
"after_kv",
"=",
"' '",
"else",
":",
"printable",
"=",
"'\\t'",
"*",
"tabs",
"a... | https://github.com/pmq20/node-packer/blob/12c46c6e44fbc14d9ee645ebd17d5296b324f7e0/current/tools/gyp/pylib/gyp/xcodeproj_file.py#L635-L695 | ||
aws/lumberyard | f85344403c1c2e77ec8c75deb2c116e97b713217 | dev/Tools/Python/3.7.10/mac/Python.framework/Versions/3.7/lib/python3.7/site-packages/pip/_internal/utils/misc.py | python | _search_distribution | (req_name) | return pkg_dict.get(req_name) | Find a distribution matching the ``req_name`` in the environment.
This searches from *all* distributions available in the environment, to
match the behavior of ``pkg_resources.get_distribution()``. | Find a distribution matching the ``req_name`` in the environment. | [
"Find",
"a",
"distribution",
"matching",
"the",
"req_name",
"in",
"the",
"environment",
"."
] | def _search_distribution(req_name):
# type: (str) -> Optional[Distribution]
"""Find a distribution matching the ``req_name`` in the environment.
This searches from *all* distributions available in the environment, to
match the behavior of ``pkg_resources.get_distribution()``.
"""
# Canonicalize... | [
"def",
"_search_distribution",
"(",
"req_name",
")",
":",
"# type: (str) -> Optional[Distribution]",
"# Canonicalize the name before searching in the list of",
"# installed distributions and also while creating the package",
"# dictionary to get the Distribution object",
"req_name",
"=",
"ca... | https://github.com/aws/lumberyard/blob/f85344403c1c2e77ec8c75deb2c116e97b713217/dev/Tools/Python/3.7.10/mac/Python.framework/Versions/3.7/lib/python3.7/site-packages/pip/_internal/utils/misc.py#L481-L501 | |
wxWidgets/wxPython-Classic | 19571e1ae65f1ac445f5491474121998c97a1bf0 | wx/lib/agw/aui/auibook.py | python | AuiNotebook.SetPageTextColour | (self, page_idx, colour) | return True | Sets the tab text colour for the page.
:param integer `page_idx`: the page index;
:param Colour `colour`: the new tab label text colour. | Sets the tab text colour for the page. | [
"Sets",
"the",
"tab",
"text",
"colour",
"for",
"the",
"page",
"."
] | def SetPageTextColour(self, page_idx, colour):
"""
Sets the tab text colour for the page.
:param integer `page_idx`: the page index;
:param Colour `colour`: the new tab label text colour.
"""
if page_idx >= self._tabs.GetPageCount():
return False
# ... | [
"def",
"SetPageTextColour",
"(",
"self",
",",
"page_idx",
",",
"colour",
")",
":",
"if",
"page_idx",
">=",
"self",
".",
"_tabs",
".",
"GetPageCount",
"(",
")",
":",
"return",
"False",
"# update our own tab catalog",
"page_info",
"=",
"self",
".",
"_tabs",
".... | https://github.com/wxWidgets/wxPython-Classic/blob/19571e1ae65f1ac445f5491474121998c97a1bf0/wx/lib/agw/aui/auibook.py#L3933-L3962 | |
windystrife/UnrealEngine_NVIDIAGameWorks | b50e6338a7c5b26374d66306ebc7807541ff815e | Engine/Extras/ThirdPartyNotUE/emsdk/Win64/python/2.7.5.3_64bit/Lib/_pyio.py | python | BytesIO.getvalue | (self) | return bytes(self._buffer) | Return the bytes value (contents) of the buffer | Return the bytes value (contents) of the buffer | [
"Return",
"the",
"bytes",
"value",
"(",
"contents",
")",
"of",
"the",
"buffer"
] | def getvalue(self):
"""Return the bytes value (contents) of the buffer
"""
if self.closed:
raise ValueError("getvalue on closed file")
return bytes(self._buffer) | [
"def",
"getvalue",
"(",
"self",
")",
":",
"if",
"self",
".",
"closed",
":",
"raise",
"ValueError",
"(",
"\"getvalue on closed file\"",
")",
"return",
"bytes",
"(",
"self",
".",
"_buffer",
")"
] | https://github.com/windystrife/UnrealEngine_NVIDIAGameWorks/blob/b50e6338a7c5b26374d66306ebc7807541ff815e/Engine/Extras/ThirdPartyNotUE/emsdk/Win64/python/2.7.5.3_64bit/Lib/_pyio.py#L801-L806 | |
papyrussolution/OpenPapyrus | bbfb5ec2ea2109b8e2f125edd838e12eaf7b8b91 | Src/OSF/protobuf-3.19.1/python/google/protobuf/descriptor_pool.py | python | DescriptorPool._MakeEnumValueDescriptor | (self, value_proto, index) | return descriptor.EnumValueDescriptor(
name=value_proto.name,
index=index,
number=value_proto.number,
options=_OptionsOrNone(value_proto),
type=None,
# pylint: disable=protected-access
create_key=descriptor._internal_create_key) | Creates a enum value descriptor object from a enum value proto.
Args:
value_proto: The proto describing the enum value.
index: The index of the enum value.
Returns:
An initialized EnumValueDescriptor object. | Creates a enum value descriptor object from a enum value proto. | [
"Creates",
"a",
"enum",
"value",
"descriptor",
"object",
"from",
"a",
"enum",
"value",
"proto",
"."
] | def _MakeEnumValueDescriptor(self, value_proto, index):
"""Creates a enum value descriptor object from a enum value proto.
Args:
value_proto: The proto describing the enum value.
index: The index of the enum value.
Returns:
An initialized EnumValueDescriptor object.
"""
return d... | [
"def",
"_MakeEnumValueDescriptor",
"(",
"self",
",",
"value_proto",
",",
"index",
")",
":",
"return",
"descriptor",
".",
"EnumValueDescriptor",
"(",
"name",
"=",
"value_proto",
".",
"name",
",",
"index",
"=",
"index",
",",
"number",
"=",
"value_proto",
".",
... | https://github.com/papyrussolution/OpenPapyrus/blob/bbfb5ec2ea2109b8e2f125edd838e12eaf7b8b91/Src/OSF/protobuf-3.19.1/python/google/protobuf/descriptor_pool.py#L1134-L1152 | |
mongodb/mongo | d8ff665343ad29cf286ee2cf4a1960d29371937b | buildscripts/gdb/mongo_printers.py | python | BSONObjPrinter.to_string | (self) | return "%s BSONObj %s bytes @ %s%s" % (ownership, size, self.ptr, suffix) | Return BSONObj for printing. | Return BSONObj for printing. | [
"Return",
"BSONObj",
"for",
"printing",
"."
] | def to_string(self):
"""Return BSONObj for printing."""
# The value has been optimized out.
if self.size == -1:
return "BSONObj @ %s - optimized out" % (self.ptr)
ownership = "owned" if self.val['_ownedBuffer']['_buffer']['_holder']['px'] else "unowned"
size = self.... | [
"def",
"to_string",
"(",
"self",
")",
":",
"# The value has been optimized out.",
"if",
"self",
".",
"size",
"==",
"-",
"1",
":",
"return",
"\"BSONObj @ %s - optimized out\"",
"%",
"(",
"self",
".",
"ptr",
")",
"ownership",
"=",
"\"owned\"",
"if",
"self",
".",... | https://github.com/mongodb/mongo/blob/d8ff665343ad29cf286ee2cf4a1960d29371937b/buildscripts/gdb/mongo_printers.py#L141-L169 | |
openmm/openmm | cb293447c4fc8b03976dfe11399f107bab70f3d9 | wrappers/python/openmm/app/desmonddmsfile.py | python | DesmondDMSFile._prefixsum | (self, values) | return sum | exclusive prefix sum of 'values' | exclusive prefix sum of 'values' | [
"exclusive",
"prefix",
"sum",
"of",
"values"
] | def _prefixsum(self, values):
""" exclusive prefix sum of 'values' """
total =0
sum = [total]
for v in values:
total += v
sum.append(total)
return sum | [
"def",
"_prefixsum",
"(",
"self",
",",
"values",
")",
":",
"total",
"=",
"0",
"sum",
"=",
"[",
"total",
"]",
"for",
"v",
"in",
"values",
":",
"total",
"+=",
"v",
"sum",
".",
"append",
"(",
"total",
")",
"return",
"sum"
] | https://github.com/openmm/openmm/blob/cb293447c4fc8b03976dfe11399f107bab70f3d9/wrappers/python/openmm/app/desmonddmsfile.py#L937-L944 | |
wxWidgets/wxPython-Classic | 19571e1ae65f1ac445f5491474121998c97a1bf0 | src/gtk/animate.py | python | AnimationCtrl.DrawCurrentFrame | (*args, **kwargs) | return _animate.AnimationCtrl_DrawCurrentFrame(*args, **kwargs) | DrawCurrentFrame(self, DC dc) | DrawCurrentFrame(self, DC dc) | [
"DrawCurrentFrame",
"(",
"self",
"DC",
"dc",
")"
] | def DrawCurrentFrame(*args, **kwargs):
"""DrawCurrentFrame(self, DC dc)"""
return _animate.AnimationCtrl_DrawCurrentFrame(*args, **kwargs) | [
"def",
"DrawCurrentFrame",
"(",
"*",
"args",
",",
"*",
"*",
"kwargs",
")",
":",
"return",
"_animate",
".",
"AnimationCtrl_DrawCurrentFrame",
"(",
"*",
"args",
",",
"*",
"*",
"kwargs",
")"
] | https://github.com/wxWidgets/wxPython-Classic/blob/19571e1ae65f1ac445f5491474121998c97a1bf0/src/gtk/animate.py#L218-L220 | |
miyosuda/TensorFlowAndroidMNIST | 7b5a4603d2780a8a2834575706e9001977524007 | jni-build/jni/include/tensorflow/python/training/saver.py | python | BaseSaverBuilder.restore_op | (self, filename_tensor, var_to_save, preferred_shard) | return io_ops._restore_slice(
filename_tensor,
var_to_save.name,
var_to_save.slice_spec,
var_to_save.var.dtype,
preferred_shard=preferred_shard) | Create an Op to read the variable 'var_to_save'.
This is intended to be overridden by subclasses that want to generate
different Ops.
Args:
filename_tensor: String Tensor.
var_to_save: A BaseSaverBuilder.VarToSave object.
preferred_shard: Int. Shard to open first when loading a sharded ... | Create an Op to read the variable 'var_to_save'. | [
"Create",
"an",
"Op",
"to",
"read",
"the",
"variable",
"var_to_save",
"."
] | def restore_op(self, filename_tensor, var_to_save, preferred_shard):
"""Create an Op to read the variable 'var_to_save'.
This is intended to be overridden by subclasses that want to generate
different Ops.
Args:
filename_tensor: String Tensor.
var_to_save: A BaseSaverBuilder.VarToSave obje... | [
"def",
"restore_op",
"(",
"self",
",",
"filename_tensor",
",",
"var_to_save",
",",
"preferred_shard",
")",
":",
"# pylint: disable=protected-access",
"return",
"io_ops",
".",
"_restore_slice",
"(",
"filename_tensor",
",",
"var_to_save",
".",
"name",
",",
"var_to_save"... | https://github.com/miyosuda/TensorFlowAndroidMNIST/blob/7b5a4603d2780a8a2834575706e9001977524007/jni-build/jni/include/tensorflow/python/training/saver.py#L167-L187 | |
mindspore-ai/mindspore | fb8fd3338605bb34fa5cea054e535a8b1d753fab | mindspore/python/mindspore/ops/_op_impl/akg/ascend/sqrt.py | python | _sqrt_akg | () | return | Sqrt Akg register | Sqrt Akg register | [
"Sqrt",
"Akg",
"register"
] | def _sqrt_akg():
"""Sqrt Akg register"""
return | [
"def",
"_sqrt_akg",
"(",
")",
":",
"return"
] | https://github.com/mindspore-ai/mindspore/blob/fb8fd3338605bb34fa5cea054e535a8b1d753fab/mindspore/python/mindspore/ops/_op_impl/akg/ascend/sqrt.py#L33-L35 | |
hanpfei/chromium-net | 392cc1fa3a8f92f42e4071ab6e674d8e0482f83f | third_party/catapult/third_party/gsutil/gslib/cloud_api.py | python | CloudApi.ComposeObject | (self, src_objs_metadata, dst_obj_metadata,
preconditions=None, provider=None, fields=None) | Composes an object in the cloud.
Args:
src_objs_metadata: List of ComposeRequest.SourceObjectsValueListEntries
specifying the objects to compose.
dst_obj_metadata: Metadata for the destination object including bucket
and object name.
preconditions:... | Composes an object in the cloud. | [
"Composes",
"an",
"object",
"in",
"the",
"cloud",
"."
] | def ComposeObject(self, src_objs_metadata, dst_obj_metadata,
preconditions=None, provider=None, fields=None):
"""Composes an object in the cloud.
Args:
src_objs_metadata: List of ComposeRequest.SourceObjectsValueListEntries
specifying the objects to compose.
... | [
"def",
"ComposeObject",
"(",
"self",
",",
"src_objs_metadata",
",",
"dst_obj_metadata",
",",
"preconditions",
"=",
"None",
",",
"provider",
"=",
"None",
",",
"fields",
"=",
"None",
")",
":",
"raise",
"NotImplementedError",
"(",
"'ComposeObject must be overloaded'",
... | https://github.com/hanpfei/chromium-net/blob/392cc1fa3a8f92f42e4071ab6e674d8e0482f83f/third_party/catapult/third_party/gsutil/gslib/cloud_api.py#L429-L450 | ||
scylladb/seastar | 0cdd2329beb1cc4c0af8828598c26114397ffa9c | scripts/dpdk_nic_bind.py | python | parse_args | () | Parses the command-line arguments given by the user and takes the
appropriate action for each | Parses the command-line arguments given by the user and takes the
appropriate action for each | [
"Parses",
"the",
"command",
"-",
"line",
"arguments",
"given",
"by",
"the",
"user",
"and",
"takes",
"the",
"appropriate",
"action",
"for",
"each"
] | def parse_args():
'''Parses the command-line arguments given by the user and takes the
appropriate action for each'''
global b_flag
global status_flag
global force_flag
global args
if len(sys.argv) <= 1:
usage()
sys.exit(0)
try:
opts, args = getopt.getopt(sys.arg... | [
"def",
"parse_args",
"(",
")",
":",
"global",
"b_flag",
"global",
"status_flag",
"global",
"force_flag",
"global",
"args",
"if",
"len",
"(",
"sys",
".",
"argv",
")",
"<=",
"1",
":",
"usage",
"(",
")",
"sys",
".",
"exit",
"(",
"0",
")",
"try",
":",
... | https://github.com/scylladb/seastar/blob/0cdd2329beb1cc4c0af8828598c26114397ffa9c/scripts/dpdk_nic_bind.py#L468-L503 | ||
windystrife/UnrealEngine_NVIDIAGameWorks | b50e6338a7c5b26374d66306ebc7807541ff815e | Engine/Extras/ThirdPartyNotUE/emsdk/Win64/python/2.7.5.3_64bit/Lib/optparse.py | python | OptionParser._process_args | (self, largs, rargs, values) | _process_args(largs : [string],
rargs : [string],
values : Values)
Process command-line arguments and populate 'values', consuming
options and arguments from 'rargs'. If 'allow_interspersed_args' is
false, stop at the first non-option argument.... | _process_args(largs : [string],
rargs : [string],
values : Values) | [
"_process_args",
"(",
"largs",
":",
"[",
"string",
"]",
"rargs",
":",
"[",
"string",
"]",
"values",
":",
"Values",
")"
] | def _process_args(self, largs, rargs, values):
"""_process_args(largs : [string],
rargs : [string],
values : Values)
Process command-line arguments and populate 'values', consuming
options and arguments from 'rargs'. If 'allow_interspersed_args... | [
"def",
"_process_args",
"(",
"self",
",",
"largs",
",",
"rargs",
",",
"values",
")",
":",
"while",
"rargs",
":",
"arg",
"=",
"rargs",
"[",
"0",
"]",
"# We handle bare \"--\" explicitly, and bare \"-\" is handled by the",
"# standard arg handler since the short arg case en... | https://github.com/windystrife/UnrealEngine_NVIDIAGameWorks/blob/b50e6338a7c5b26374d66306ebc7807541ff815e/Engine/Extras/ThirdPartyNotUE/emsdk/Win64/python/2.7.5.3_64bit/Lib/optparse.py#L1419-L1448 | ||
y123456yz/reading-and-annotate-mongodb-3.6 | 93280293672ca7586dc24af18132aa61e4ed7fcf | mongo/buildscripts/resmokelib/core/programs.py | python | _format_test_data_set_parameters | (set_parameters) | return ",".join(params) | Converts key-value pairs from 'set_parameters' into the comma
delimited list format expected by the parser in servers.js.
WARNING: the parsing logic in servers.js is very primitive.
Non-scalar options such as logComponentVerbosity will not work
correctly. | Converts key-value pairs from 'set_parameters' into the comma
delimited list format expected by the parser in servers.js. | [
"Converts",
"key",
"-",
"value",
"pairs",
"from",
"set_parameters",
"into",
"the",
"comma",
"delimited",
"list",
"format",
"expected",
"by",
"the",
"parser",
"in",
"servers",
".",
"js",
"."
] | def _format_test_data_set_parameters(set_parameters):
"""
Converts key-value pairs from 'set_parameters' into the comma
delimited list format expected by the parser in servers.js.
WARNING: the parsing logic in servers.js is very primitive.
Non-scalar options such as logComponentVerbosity will not w... | [
"def",
"_format_test_data_set_parameters",
"(",
"set_parameters",
")",
":",
"params",
"=",
"[",
"]",
"for",
"param_name",
"in",
"set_parameters",
":",
"param_value",
"=",
"set_parameters",
"[",
"param_name",
"]",
"if",
"isinstance",
"(",
"param_value",
",",
"bool"... | https://github.com/y123456yz/reading-and-annotate-mongodb-3.6/blob/93280293672ca7586dc24af18132aa61e4ed7fcf/mongo/buildscripts/resmokelib/core/programs.py#L313-L331 | |
catboost/catboost | 167f64f237114a4d10b2b4ee42adb4569137debe | contrib/python/traitlets/py3/traitlets/config/application.py | python | boolean_flag | (name, configurable, set_help='', unset_help='') | return {name : (setter, set_help), 'no-'+name : (unsetter, unset_help)} | Helper for building basic --trait, --no-trait flags.
Parameters
----------
name : str
The name of the flag.
configurable : str
The 'Class.trait' string of the trait to be set/unset with the flag
set_help : unicode
help string for --name flag
unset_help : unicode
... | Helper for building basic --trait, --no-trait flags. | [
"Helper",
"for",
"building",
"basic",
"--",
"trait",
"--",
"no",
"-",
"trait",
"flags",
"."
] | def boolean_flag(name, configurable, set_help='', unset_help=''):
"""Helper for building basic --trait, --no-trait flags.
Parameters
----------
name : str
The name of the flag.
configurable : str
The 'Class.trait' string of the trait to be set/unset with the flag
set_help : unic... | [
"def",
"boolean_flag",
"(",
"name",
",",
"configurable",
",",
"set_help",
"=",
"''",
",",
"unset_help",
"=",
"''",
")",
":",
"# default helpstrings",
"set_help",
"=",
"set_help",
"or",
"\"set %s=True\"",
"%",
"configurable",
"unset_help",
"=",
"unset_help",
"or"... | https://github.com/catboost/catboost/blob/167f64f237114a4d10b2b4ee42adb4569137debe/contrib/python/traitlets/py3/traitlets/config/application.py#L855-L883 | |
catboost/catboost | 167f64f237114a4d10b2b4ee42adb4569137debe | contrib/tools/python3/src/Lib/pickletools.py | python | read_bytes8 | (f) | r"""
>>> import io, struct, sys
>>> read_bytes8(io.BytesIO(b"\x00\x00\x00\x00\x00\x00\x00\x00abc"))
b''
>>> read_bytes8(io.BytesIO(b"\x03\x00\x00\x00\x00\x00\x00\x00abcdef"))
b'abc'
>>> bigsize8 = struct.pack("<Q", sys.maxsize//3)
>>> read_bytes8(io.BytesIO(bigsize8 + b"abcdef")) #doctest: ... | r"""
>>> import io, struct, sys
>>> read_bytes8(io.BytesIO(b"\x00\x00\x00\x00\x00\x00\x00\x00abc"))
b''
>>> read_bytes8(io.BytesIO(b"\x03\x00\x00\x00\x00\x00\x00\x00abcdef"))
b'abc'
>>> bigsize8 = struct.pack("<Q", sys.maxsize//3)
>>> read_bytes8(io.BytesIO(bigsize8 + b"abcdef")) #doctest: ... | [
"r",
">>>",
"import",
"io",
"struct",
"sys",
">>>",
"read_bytes8",
"(",
"io",
".",
"BytesIO",
"(",
"b",
"\\",
"x00",
"\\",
"x00",
"\\",
"x00",
"\\",
"x00",
"\\",
"x00",
"\\",
"x00",
"\\",
"x00",
"\\",
"x00abc",
"))",
"b",
">>>",
"read_bytes8",
"(",... | def read_bytes8(f):
r"""
>>> import io, struct, sys
>>> read_bytes8(io.BytesIO(b"\x00\x00\x00\x00\x00\x00\x00\x00abc"))
b''
>>> read_bytes8(io.BytesIO(b"\x03\x00\x00\x00\x00\x00\x00\x00abcdef"))
b'abc'
>>> bigsize8 = struct.pack("<Q", sys.maxsize//3)
>>> read_bytes8(io.BytesIO(bigsize8 +... | [
"def",
"read_bytes8",
"(",
"f",
")",
":",
"n",
"=",
"read_uint8",
"(",
"f",
")",
"assert",
"n",
">=",
"0",
"if",
"n",
">",
"sys",
".",
"maxsize",
":",
"raise",
"ValueError",
"(",
"\"bytes8 byte count > sys.maxsize: %d\"",
"%",
"n",
")",
"data",
"=",
"f... | https://github.com/catboost/catboost/blob/167f64f237114a4d10b2b4ee42adb4569137debe/contrib/tools/python3/src/Lib/pickletools.py#L534-L556 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.