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
mantidproject/mantid
03deeb89254ec4289edb8771e0188c2090a02f32
Framework/PythonInterface/plugins/algorithms/WorkflowAlgorithms/PaalmanPingsMonteCarloAbsorption.py
python
PaalmanPingsMonteCarloAbsorption._set_algorithm_properties
(algorithm, properties)
Sets the specified algorithm's properties using the given properties. :param algorithm: The algorithm whose properties to set. :param properties: The dictionary of properties to set.
Sets the specified algorithm's properties using the given properties.
[ "Sets", "the", "specified", "algorithm", "s", "properties", "using", "the", "given", "properties", "." ]
def _set_algorithm_properties(algorithm, properties): """ Sets the specified algorithm's properties using the given properties. :param algorithm: The algorithm whose properties to set. :param properties: The dictionary of properties to set. """ for key, value in prope...
[ "def", "_set_algorithm_properties", "(", "algorithm", ",", "properties", ")", ":", "for", "key", ",", "value", "in", "properties", ".", "items", "(", ")", ":", "algorithm", ".", "setProperty", "(", "key", ",", "value", ")" ]
https://github.com/mantidproject/mantid/blob/03deeb89254ec4289edb8771e0188c2090a02f32/Framework/PythonInterface/plugins/algorithms/WorkflowAlgorithms/PaalmanPingsMonteCarloAbsorption.py#L894-L902
Xilinx/Vitis-AI
fc74d404563d9951b57245443c73bef389f3657f
tools/Vitis-AI-Quantizer/vai_q_tensorflow1.x/tensorflow/contrib/metrics/python/ops/metric_ops.py
python
aggregate_metric_map
(names_to_tuples)
return dict(zip(metric_names, value_ops)), dict(zip(metric_names, update_ops))
Aggregates the metric names to tuple dictionary. This function is useful for pairing metric names with their associated value and update ops when the list of metrics is long. For example: ```python metrics_to_values, metrics_to_updates = slim.metrics.aggregate_metric_map({ 'Mean Absolute Error': new...
Aggregates the metric names to tuple dictionary.
[ "Aggregates", "the", "metric", "names", "to", "tuple", "dictionary", "." ]
def aggregate_metric_map(names_to_tuples): """Aggregates the metric names to tuple dictionary. This function is useful for pairing metric names with their associated value and update ops when the list of metrics is long. For example: ```python metrics_to_values, metrics_to_updates = slim.metrics.aggregate...
[ "def", "aggregate_metric_map", "(", "names_to_tuples", ")", ":", "metric_names", "=", "names_to_tuples", ".", "keys", "(", ")", "value_ops", ",", "update_ops", "=", "zip", "(", "*", "names_to_tuples", ".", "values", "(", ")", ")", "return", "dict", "(", "zip...
https://github.com/Xilinx/Vitis-AI/blob/fc74d404563d9951b57245443c73bef389f3657f/tools/Vitis-AI-Quantizer/vai_q_tensorflow1.x/tensorflow/contrib/metrics/python/ops/metric_ops.py#L3691-L3720
fatih/subvim
241b6d170597857105da219c9b7d36059e9f11fb
vim/base/YouCompleteMe/third_party/requests/requests/utils.py
python
parse_dict_header
(value)
return result
Parse lists of key, value pairs as described by RFC 2068 Section 2 and convert them into a python dict: >>> d = parse_dict_header('foo="is a fish", bar="as well"') >>> type(d) is dict True >>> sorted(d.items()) [('bar', 'as well'), ('foo', 'is a fish')] If there is no value for a key it wi...
Parse lists of key, value pairs as described by RFC 2068 Section 2 and convert them into a python dict:
[ "Parse", "lists", "of", "key", "value", "pairs", "as", "described", "by", "RFC", "2068", "Section", "2", "and", "convert", "them", "into", "a", "python", "dict", ":" ]
def parse_dict_header(value): """Parse lists of key, value pairs as described by RFC 2068 Section 2 and convert them into a python dict: >>> d = parse_dict_header('foo="is a fish", bar="as well"') >>> type(d) is dict True >>> sorted(d.items()) [('bar', 'as well'), ('foo', 'is a fish')] ...
[ "def", "parse_dict_header", "(", "value", ")", ":", "result", "=", "{", "}", "for", "item", "in", "_parse_list_header", "(", "value", ")", ":", "if", "'='", "not", "in", "item", ":", "result", "[", "item", "]", "=", "None", "continue", "name", ",", "...
https://github.com/fatih/subvim/blob/241b6d170597857105da219c9b7d36059e9f11fb/vim/base/YouCompleteMe/third_party/requests/requests/utils.py#L178-L208
eerolanguage/clang
91360bee004a1cbdb95fe5eb605ef243152da41b
bindings/python/clang/cindex.py
python
register_functions
(lib, ignore_errors)
Register function prototypes with a libclang library instance. This must be called as part of library instantiation so Python knows how to call out to the shared library.
Register function prototypes with a libclang library instance.
[ "Register", "function", "prototypes", "with", "a", "libclang", "library", "instance", "." ]
def register_functions(lib, ignore_errors): """Register function prototypes with a libclang library instance. This must be called as part of library instantiation so Python knows how to call out to the shared library. """ def register(item): return register_function(lib, item, ignore_error...
[ "def", "register_functions", "(", "lib", ",", "ignore_errors", ")", ":", "def", "register", "(", "item", ")", ":", "return", "register_function", "(", "lib", ",", "item", ",", "ignore_errors", ")", "map", "(", "register", ",", "functionList", ")" ]
https://github.com/eerolanguage/clang/blob/91360bee004a1cbdb95fe5eb605ef243152da41b/bindings/python/clang/cindex.py#L3282-L3292
aimerykong/Low-Rank-Bilinear-Pooling
487eb2c857fd9c95357a5166b0c15ad0fe135b28
caffe-20160312/scripts/cpp_lint.py
python
FindStartOfExpressionInLine
(line, endpos, depth, startchar, endchar)
return (-1, depth)
Find position at the matching startchar. This is almost the reverse of FindEndOfExpressionInLine, but note that the input position and returned position differs by 1. Args: line: a CleansedLines line. endpos: start searching at this position. depth: nesting level at endpos. startchar: expression...
Find position at the matching startchar.
[ "Find", "position", "at", "the", "matching", "startchar", "." ]
def FindStartOfExpressionInLine(line, endpos, depth, startchar, endchar): """Find position at the matching startchar. This is almost the reverse of FindEndOfExpressionInLine, but note that the input position and returned position differs by 1. Args: line: a CleansedLines line. endpos: start searching ...
[ "def", "FindStartOfExpressionInLine", "(", "line", ",", "endpos", ",", "depth", ",", "startchar", ",", "endchar", ")", ":", "for", "i", "in", "xrange", "(", "endpos", ",", "-", "1", ",", "-", "1", ")", ":", "if", "line", "[", "i", "]", "==", "endch...
https://github.com/aimerykong/Low-Rank-Bilinear-Pooling/blob/487eb2c857fd9c95357a5166b0c15ad0fe135b28/caffe-20160312/scripts/cpp_lint.py#L1300-L1324
windystrife/UnrealEngine_NVIDIAGameWorks
b50e6338a7c5b26374d66306ebc7807541ff815e
Engine/Extras/ThirdPartyNotUE/emsdk/Win64/python/2.7.5.3_64bit/Lib/logging/__init__.py
python
RootLogger.__init__
(self, level)
Initialize the logger with the name "root".
Initialize the logger with the name "root".
[ "Initialize", "the", "logger", "with", "the", "name", "root", "." ]
def __init__(self, level): """ Initialize the logger with the name "root". """ Logger.__init__(self, "root", level)
[ "def", "__init__", "(", "self", ",", "level", ")", ":", "Logger", ".", "__init__", "(", "self", ",", "\"root\"", ",", "level", ")" ]
https://github.com/windystrife/UnrealEngine_NVIDIAGameWorks/blob/b50e6338a7c5b26374d66306ebc7807541ff815e/Engine/Extras/ThirdPartyNotUE/emsdk/Win64/python/2.7.5.3_64bit/Lib/logging/__init__.py#L1375-L1379
opencv/opencv_contrib
7882aea9c9694c921e82812a0b2971f77819b832
samples/python2/video.py
python
create_capture
(source = 0, fallback = presets['chess'])
return cap
source: <int> or '<int>|<filename>|synth [:<param_name>=<value> [:...]]'
source: <int> or '<int>|<filename>|synth [:<param_name>=<value> [:...]]'
[ "source", ":", "<int", ">", "or", "<int", ">", "|<filename", ">", "|synth", "[", ":", "<param_name", ">", "=", "<value", ">", "[", ":", "...", "]]" ]
def create_capture(source = 0, fallback = presets['chess']): '''source: <int> or '<int>|<filename>|synth [:<param_name>=<value> [:...]]' ''' source = str(source).strip() chunks = source.split(':') # handle drive letter ('c:', ...) if len(chunks) > 1 and len(chunks[0]) == 1 and chunks[0].isalpha(...
[ "def", "create_capture", "(", "source", "=", "0", ",", "fallback", "=", "presets", "[", "'chess'", "]", ")", ":", "source", "=", "str", "(", "source", ")", ".", "strip", "(", ")", "chunks", "=", "source", ".", "split", "(", "':'", ")", "# handle driv...
https://github.com/opencv/opencv_contrib/blob/7882aea9c9694c921e82812a0b2971f77819b832/samples/python2/video.py#L138-L168
catboost/catboost
167f64f237114a4d10b2b4ee42adb4569137debe
contrib/tools/python/src/Lib/lib-tk/turtle.py
python
RawTurtle.getturtle
(self)
return self
Return the Turtleobject itself. No argument. Only reasonable use: as a function to return the 'anonymous turtle': Example: >>> pet = getturtle() >>> pet.fd(50) >>> pet <turtle.Turtle object at 0x0187D810> >>> turtles() [<turtle.Turtle object at ...
Return the Turtleobject itself.
[ "Return", "the", "Turtleobject", "itself", "." ]
def getturtle(self): """Return the Turtleobject itself. No argument. Only reasonable use: as a function to return the 'anonymous turtle': Example: >>> pet = getturtle() >>> pet.fd(50) >>> pet <turtle.Turtle object at 0x0187D810> >>> turtles() ...
[ "def", "getturtle", "(", "self", ")", ":", "return", "self" ]
https://github.com/catboost/catboost/blob/167f64f237114a4d10b2b4ee42adb4569137debe/contrib/tools/python/src/Lib/lib-tk/turtle.py#L3362-L3377
apple/turicreate
cce55aa5311300e3ce6af93cb45ba791fd1bdf49
src/python/turicreate/data_structures/sarray.py
python
SArray.__bool__
(self)
Raises a ValueError exception. The truth value of an array with more than one element is ambiguous. Use a.any() or a.all().
Raises a ValueError exception. The truth value of an array with more than one element is ambiguous. Use a.any() or a.all().
[ "Raises", "a", "ValueError", "exception", ".", "The", "truth", "value", "of", "an", "array", "with", "more", "than", "one", "element", "is", "ambiguous", ".", "Use", "a", ".", "any", "()", "or", "a", ".", "all", "()", "." ]
def __bool__(self): """ Raises a ValueError exception. The truth value of an array with more than one element is ambiguous. Use a.any() or a.all(). """ # message copied from Numpy raise ValueError( "The truth value of an array with more than one element is amb...
[ "def", "__bool__", "(", "self", ")", ":", "# message copied from Numpy", "raise", "ValueError", "(", "\"The truth value of an array with more than one element is ambiguous. Use a.any() or a.all()\"", ")" ]
https://github.com/apple/turicreate/blob/cce55aa5311300e3ce6af93cb45ba791fd1bdf49/src/python/turicreate/data_structures/sarray.py#L888-L896
microsoft/TSS.MSR
0f2516fca2cd9929c31d5450e39301c9bde43688
TSS.Py/src/TpmTypes.py
python
TPM2_FieldUpgradeStart_REQUEST.fromBytes
(buffer)
return TpmBuffer(buffer).createObj(TPM2_FieldUpgradeStart_REQUEST)
Returns new TPM2_FieldUpgradeStart_REQUEST object constructed from its marshaled representation in the given byte buffer
Returns new TPM2_FieldUpgradeStart_REQUEST object constructed from its marshaled representation in the given byte buffer
[ "Returns", "new", "TPM2_FieldUpgradeStart_REQUEST", "object", "constructed", "from", "its", "marshaled", "representation", "in", "the", "given", "byte", "buffer" ]
def fromBytes(buffer): """ Returns new TPM2_FieldUpgradeStart_REQUEST object constructed from its marshaled representation in the given byte buffer """ return TpmBuffer(buffer).createObj(TPM2_FieldUpgradeStart_REQUEST)
[ "def", "fromBytes", "(", "buffer", ")", ":", "return", "TpmBuffer", "(", "buffer", ")", ".", "createObj", "(", "TPM2_FieldUpgradeStart_REQUEST", ")" ]
https://github.com/microsoft/TSS.MSR/blob/0f2516fca2cd9929c31d5450e39301c9bde43688/TSS.Py/src/TpmTypes.py#L15902-L15906
FreeCAD/FreeCAD
ba42231b9c6889b89e064d6d563448ed81e376ec
src/Mod/Fem/femsolver/run.py
python
run_fem_solver
(solver, working_dir=None)
Execute *solver* of the solver framework. Uses :meth:`getMachine <femsolver.solverbase.Proxy.getMachine>` to obtain a :class:`Machine` instance of the solver. It than executes the Machine with using the ``RESULTS`` target (see :class:`Machine` for infos about different targets). This method is blocking...
Execute *solver* of the solver framework.
[ "Execute", "*", "solver", "*", "of", "the", "solver", "framework", "." ]
def run_fem_solver(solver, working_dir=None): """ Execute *solver* of the solver framework. Uses :meth:`getMachine <femsolver.solverbase.Proxy.getMachine>` to obtain a :class:`Machine` instance of the solver. It than executes the Machine with using the ``RESULTS`` target (see :class:`Machine` for infos...
[ "def", "run_fem_solver", "(", "solver", ",", "working_dir", "=", "None", ")", ":", "if", "solver", ".", "Proxy", ".", "Type", "==", "\"Fem::SolverCcxTools\"", ":", "from", "femtools", ".", "ccxtools", "import", "CcxTools", "as", "ccx", "App", ".", "Console",...
https://github.com/FreeCAD/FreeCAD/blob/ba42231b9c6889b89e064d6d563448ed81e376ec/src/Mod/Fem/femsolver/run.py#L71-L168
tinyobjloader/tinyobjloader
8322e00ae685ea623ab6ac5a6cebcfa2d22fbf93
deps/cpplint.py
python
CheckCStyleCast
(filename, clean_lines, linenum, cast_type, pattern, error)
return True
Checks for a C-style cast by looking for the pattern. Args: filename: The name of the current file. clean_lines: A CleansedLines instance containing the file. linenum: The number of the line to check. cast_type: The string for the C++ cast to recommend. This is either reinterpret_cast, static_...
Checks for a C-style cast by looking for the pattern.
[ "Checks", "for", "a", "C", "-", "style", "cast", "by", "looking", "for", "the", "pattern", "." ]
def CheckCStyleCast(filename, clean_lines, linenum, cast_type, pattern, error): """Checks for a C-style cast by looking for the pattern. Args: filename: The name of the current file. clean_lines: A CleansedLines instance containing the file. linenum: The number of the line to check. cast_type: The ...
[ "def", "CheckCStyleCast", "(", "filename", ",", "clean_lines", ",", "linenum", ",", "cast_type", ",", "pattern", ",", "error", ")", ":", "line", "=", "clean_lines", ".", "elided", "[", "linenum", "]", "match", "=", "Search", "(", "pattern", ",", "line", ...
https://github.com/tinyobjloader/tinyobjloader/blob/8322e00ae685ea623ab6ac5a6cebcfa2d22fbf93/deps/cpplint.py#L5337-L5438
LiquidPlayer/LiquidCore
9405979363f2353ac9a71ad8ab59685dd7f919c9
deps/node-10.15.3/deps/npm/node_modules/node-gyp/gyp/pylib/gyp/generator/cmake.py
python
Compilable
(filename)
return any(filename.endswith(e) for e in COMPILABLE_EXTENSIONS)
Return true if the file is compilable (should be in OBJS).
Return true if the file is compilable (should be in OBJS).
[ "Return", "true", "if", "the", "file", "is", "compilable", "(", "should", "be", "in", "OBJS", ")", "." ]
def Compilable(filename): """Return true if the file is compilable (should be in OBJS).""" return any(filename.endswith(e) for e in COMPILABLE_EXTENSIONS)
[ "def", "Compilable", "(", "filename", ")", ":", "return", "any", "(", "filename", ".", "endswith", "(", "e", ")", "for", "e", "in", "COMPILABLE_EXTENSIONS", ")" ]
https://github.com/LiquidPlayer/LiquidCore/blob/9405979363f2353ac9a71ad8ab59685dd7f919c9/deps/node-10.15.3/deps/npm/node_modules/node-gyp/gyp/pylib/gyp/generator/cmake.py#L83-L85
windystrife/UnrealEngine_NVIDIAGameWorks
b50e6338a7c5b26374d66306ebc7807541ff815e
Engine/Extras/ThirdPartyNotUE/emsdk/Win64/python/2.7.5.3_64bit/Lib/idlelib/configHandler.py
python
IdleConfParser.GetOptionList
(self,section)
Get an option list for given section
Get an option list for given section
[ "Get", "an", "option", "list", "for", "given", "section" ]
def GetOptionList(self,section): """ Get an option list for given section """ if self.has_section(section): return self.options(section) else: #return a default value return []
[ "def", "GetOptionList", "(", "self", ",", "section", ")", ":", "if", "self", ".", "has_section", "(", "section", ")", ":", "return", "self", ".", "options", "(", "section", ")", "else", ":", "#return a default value", "return", "[", "]" ]
https://github.com/windystrife/UnrealEngine_NVIDIAGameWorks/blob/b50e6338a7c5b26374d66306ebc7807541ff815e/Engine/Extras/ThirdPartyNotUE/emsdk/Win64/python/2.7.5.3_64bit/Lib/idlelib/configHandler.py#L56-L63
scribusproject/scribus
41ec7c775a060912cf251682a8b1437f753f80f4
scribus/plugins/scriptplugin_py2x/scripts/ColorChart.py
python
drawHeaderFooter
(pagetitle)
draw some info on the pages
draw some info on the pages
[ "draw", "some", "info", "on", "the", "pages" ]
def drawHeaderFooter(pagetitle): """draw some info on the pages""" # get page size pageSize=scribus.getPageSize() pageWidth=pageSize[0] pageHeight=pageSize[1] #pageMargins pageMargins=scribus.getPageMargins() topMargin=pageMargins[0] leftMargin=pageMargins[1] rightMargin=pageMarg...
[ "def", "drawHeaderFooter", "(", "pagetitle", ")", ":", "# get page size", "pageSize", "=", "scribus", ".", "getPageSize", "(", ")", "pageWidth", "=", "pageSize", "[", "0", "]", "pageHeight", "=", "pageSize", "[", "1", "]", "#pageMargins", "pageMargins", "=", ...
https://github.com/scribusproject/scribus/blob/41ec7c775a060912cf251682a8b1437f753f80f4/scribus/plugins/scriptplugin_py2x/scripts/ColorChart.py#L70-L101
okex/V3-Open-API-SDK
c5abb0db7e2287718e0055e17e57672ce0ec7fd9
okex-python-sdk-api/venv/Lib/site-packages/pip-19.0.3-py3.8.egg/pip/_internal/pep425tags.py
python
get_impl_ver
()
return impl_ver
Return implementation version.
Return implementation version.
[ "Return", "implementation", "version", "." ]
def get_impl_ver(): # type: () -> str """Return implementation version.""" impl_ver = get_config_var("py_version_nodot") if not impl_ver or get_abbr_impl() == 'pp': impl_ver = ''.join(map(str, get_impl_version_info())) return impl_ver
[ "def", "get_impl_ver", "(", ")", ":", "# type: () -> str", "impl_ver", "=", "get_config_var", "(", "\"py_version_nodot\"", ")", "if", "not", "impl_ver", "or", "get_abbr_impl", "(", ")", "==", "'pp'", ":", "impl_ver", "=", "''", ".", "join", "(", "map", "(", ...
https://github.com/okex/V3-Open-API-SDK/blob/c5abb0db7e2287718e0055e17e57672ce0ec7fd9/okex-python-sdk-api/venv/Lib/site-packages/pip-19.0.3-py3.8.egg/pip/_internal/pep425tags.py#L52-L58
mantidproject/mantid
03deeb89254ec4289edb8771e0188c2090a02f32
docs/sphinxext/mantiddoc/directives/base.py
python
AlgorithmBaseDirective.skip
(self)
return msg
Override and return a string depending on whether the directive should be skipped. If empty then the directive should be processed otherwise the string should contain the error message The default is to skip (and warn) if the algorithm is not known. Returns: str: Return error ...
Override and return a string depending on whether the directive should be skipped. If empty then the directive should be processed otherwise the string should contain the error message The default is to skip (and warn) if the algorithm is not known.
[ "Override", "and", "return", "a", "string", "depending", "on", "whether", "the", "directive", "should", "be", "skipped", ".", "If", "empty", "then", "the", "directive", "should", "be", "processed", "otherwise", "the", "string", "should", "contain", "the", "err...
def skip(self): """ Override and return a string depending on whether the directive should be skipped. If empty then the directive should be processed otherwise the string should contain the error message The default is to skip (and warn) if the algorithm is not known. R...
[ "def", "skip", "(", "self", ")", ":", "from", "mantid", ".", "api", "import", "FunctionFactory", "name", ",", "version", "=", "self", ".", "algorithm_name", "(", ")", ",", "self", ".", "algorithm_version", "(", ")", "msg", "=", "\"\"", "if", "version", ...
https://github.com/mantidproject/mantid/blob/03deeb89254ec4289edb8771e0188c2090a02f32/docs/sphinxext/mantiddoc/directives/base.py#L171-L200
wxWidgets/wxPython-Classic
19571e1ae65f1ac445f5491474121998c97a1bf0
src/osx_carbon/media.py
python
MediaEvent.__init__
(self, *args, **kwargs)
__init__(self, EventType commandType=wxEVT_NULL, int id=0) -> MediaEvent
__init__(self, EventType commandType=wxEVT_NULL, int id=0) -> MediaEvent
[ "__init__", "(", "self", "EventType", "commandType", "=", "wxEVT_NULL", "int", "id", "=", "0", ")", "-", ">", "MediaEvent" ]
def __init__(self, *args, **kwargs): """__init__(self, EventType commandType=wxEVT_NULL, int id=0) -> MediaEvent""" _media.MediaEvent_swiginit(self,_media.new_MediaEvent(*args, **kwargs))
[ "def", "__init__", "(", "self", ",", "*", "args", ",", "*", "*", "kwargs", ")", ":", "_media", ".", "MediaEvent_swiginit", "(", "self", ",", "_media", ".", "new_MediaEvent", "(", "*", "args", ",", "*", "*", "kwargs", ")", ")" ]
https://github.com/wxWidgets/wxPython-Classic/blob/19571e1ae65f1ac445f5491474121998c97a1bf0/src/osx_carbon/media.py#L72-L74
wlanjie/AndroidFFmpeg
7baf9122f4b8e1c74e7baf4be5c422c7a5ba5aaf
tools/fdk-aac-build/armeabi-v7a/toolchain/lib/python2.7/base64.py
python
b64encode
(s, altchars=None)
return encoded
Encode a string using Base64. s is the string to encode. Optional altchars must be a string of at least length 2 (additional characters are ignored) which specifies an alternative alphabet for the '+' and '/' characters. This allows an application to e.g. generate url or filesystem safe Base64 string...
Encode a string using Base64.
[ "Encode", "a", "string", "using", "Base64", "." ]
def b64encode(s, altchars=None): """Encode a string using Base64. s is the string to encode. Optional altchars must be a string of at least length 2 (additional characters are ignored) which specifies an alternative alphabet for the '+' and '/' characters. This allows an application to e.g. gener...
[ "def", "b64encode", "(", "s", ",", "altchars", "=", "None", ")", ":", "# Strip off the trailing newline", "encoded", "=", "binascii", ".", "b2a_base64", "(", "s", ")", "[", ":", "-", "1", "]", "if", "altchars", "is", "not", "None", ":", "return", "_trans...
https://github.com/wlanjie/AndroidFFmpeg/blob/7baf9122f4b8e1c74e7baf4be5c422c7a5ba5aaf/tools/fdk-aac-build/armeabi-v7a/toolchain/lib/python2.7/base64.py#L42-L56
aws/lumberyard
f85344403c1c2e77ec8c75deb2c116e97b713217
dev/Tools/Python/3.7.10/linux_x64/lib/python3.7/numbers.py
python
Integral.__pow__
(self, exponent, modulus=None)
self ** exponent % modulus, but maybe faster. Accept the modulus argument if you want to support the 3-argument version of pow(). Raise a TypeError if exponent < 0 or any argument isn't Integral. Otherwise, just implement the 2-argument version described in Complex.
self ** exponent % modulus, but maybe faster.
[ "self", "**", "exponent", "%", "modulus", "but", "maybe", "faster", "." ]
def __pow__(self, exponent, modulus=None): """self ** exponent % modulus, but maybe faster. Accept the modulus argument if you want to support the 3-argument version of pow(). Raise a TypeError if exponent < 0 or any argument isn't Integral. Otherwise, just implement the 2-argum...
[ "def", "__pow__", "(", "self", ",", "exponent", ",", "modulus", "=", "None", ")", ":", "raise", "NotImplementedError" ]
https://github.com/aws/lumberyard/blob/f85344403c1c2e77ec8c75deb2c116e97b713217/dev/Tools/Python/3.7.10/linux_x64/lib/python3.7/numbers.py#L309-L317
catboost/catboost
167f64f237114a4d10b2b4ee42adb4569137debe
contrib/python/scipy/scipy/io/idl.py
python
_read_structure
(f, array_desc, struct_desc)
return structure
Read a structure, with the array and structure descriptors given as `array_desc` and `structure_desc` respectively.
Read a structure, with the array and structure descriptors given as `array_desc` and `structure_desc` respectively.
[ "Read", "a", "structure", "with", "the", "array", "and", "structure", "descriptors", "given", "as", "array_desc", "and", "structure_desc", "respectively", "." ]
def _read_structure(f, array_desc, struct_desc): ''' Read a structure, with the array and structure descriptors given as `array_desc` and `structure_desc` respectively. ''' nrows = array_desc['nelements'] columns = struct_desc['tagtable'] dtype = [] for col in columns: if col['...
[ "def", "_read_structure", "(", "f", ",", "array_desc", ",", "struct_desc", ")", ":", "nrows", "=", "array_desc", "[", "'nelements'", "]", "columns", "=", "struct_desc", "[", "'tagtable'", "]", "dtype", "=", "[", "]", "for", "col", "in", "columns", ":", "...
https://github.com/catboost/catboost/blob/167f64f237114a4d10b2b4ee42adb4569137debe/contrib/python/scipy/scipy/io/idl.py#L225-L267
rib/gputop
01d2fd4fad3eba5939df85a0a5849a818efa6a23
server/registry/reg.py
python
Registry.parseTree
(self)
Parse the registry Element, once created
Parse the registry Element, once created
[ "Parse", "the", "registry", "Element", "once", "created" ]
def parseTree(self): """Parse the registry Element, once created""" # This must be the Element for the root <registry> self.reg = self.tree.getroot() # # Create dictionary of registry types from toplevel <types> tags # and add 'name' attribute to each <type> tag (where mi...
[ "def", "parseTree", "(", "self", ")", ":", "# This must be the Element for the root <registry>", "self", ".", "reg", "=", "self", ".", "tree", ".", "getroot", "(", ")", "#", "# Create dictionary of registry types from toplevel <types> tags", "# and add 'name' attribute to eac...
https://github.com/rib/gputop/blob/01d2fd4fad3eba5939df85a0a5849a818efa6a23/server/registry/reg.py#L736-L799
CRYTEK/CRYENGINE
232227c59a220cbbd311576f0fbeba7bb53b2a8c
Code/Tools/waf-1.7.13/waflib/Tools/ccroot.py
python
apply_incpaths
(self)
Task generator method that processes the attribute *includes*:: tg = bld(features='includes', includes='.') The folders only need to be relative to the current directory, the equivalent build directory is added automatically (for headers created in the build directory). This enable using a build directory or not...
Task generator method that processes the attribute *includes*::
[ "Task", "generator", "method", "that", "processes", "the", "attribute", "*", "includes", "*", "::" ]
def apply_incpaths(self): """ Task generator method that processes the attribute *includes*:: tg = bld(features='includes', includes='.') The folders only need to be relative to the current directory, the equivalent build directory is added automatically (for headers created in the build directory). This enable...
[ "def", "apply_incpaths", "(", "self", ")", ":", "lst", "=", "self", ".", "to_incnodes", "(", "self", ".", "to_list", "(", "getattr", "(", "self", ",", "'includes'", ",", "[", "]", ")", ")", "+", "self", ".", "env", "[", "'INCLUDES'", "]", ")", "sel...
https://github.com/CRYTEK/CRYENGINE/blob/232227c59a220cbbd311576f0fbeba7bb53b2a8c/Code/Tools/waf-1.7.13/waflib/Tools/ccroot.py#L111-L131
ZhouWeikuan/DouDiZhu
0d84ff6c0bc54dba6ae37955de9ae9307513dc99
code/frameworks/cocos2d-x/tools/bindings-generator/clang/cindex.py
python
Cursor.get_definition
(self)
return conf.lib.clang_getCursorDefinition(self)
If the cursor is a reference to a declaration or a declaration of some entity, return a cursor that points to the definition of that entity.
If the cursor is a reference to a declaration or a declaration of some entity, return a cursor that points to the definition of that entity.
[ "If", "the", "cursor", "is", "a", "reference", "to", "a", "declaration", "or", "a", "declaration", "of", "some", "entity", "return", "a", "cursor", "that", "points", "to", "the", "definition", "of", "that", "entity", "." ]
def get_definition(self): """ If the cursor is a reference to a declaration or a declaration of some entity, return a cursor that points to the definition of that entity. """ # TODO: Should probably check that this is either a reference or # declaration prior to i...
[ "def", "get_definition", "(", "self", ")", ":", "# TODO: Should probably check that this is either a reference or", "# declaration prior to issuing the lookup.", "return", "conf", ".", "lib", ".", "clang_getCursorDefinition", "(", "self", ")" ]
https://github.com/ZhouWeikuan/DouDiZhu/blob/0d84ff6c0bc54dba6ae37955de9ae9307513dc99/code/frameworks/cocos2d-x/tools/bindings-generator/clang/cindex.py#L1225-L1233
mindspore-ai/mindspore
fb8fd3338605bb34fa5cea054e535a8b1d753fab
mindspore/python/mindspore/ops/_op_impl/tbe/conv2d_backprop_filter_ds.py
python
_conv2d_backprop_filter_ds_tbe
()
return
Conv2DBackpropFilter TBE register
Conv2DBackpropFilter TBE register
[ "Conv2DBackpropFilter", "TBE", "register" ]
def _conv2d_backprop_filter_ds_tbe(): """Conv2DBackpropFilter TBE register""" return
[ "def", "_conv2d_backprop_filter_ds_tbe", "(", ")", ":", "return" ]
https://github.com/mindspore-ai/mindspore/blob/fb8fd3338605bb34fa5cea054e535a8b1d753fab/mindspore/python/mindspore/ops/_op_impl/tbe/conv2d_backprop_filter_ds.py#L41-L43
benoitsteiner/tensorflow-opencl
cb7cb40a57fde5cfd4731bc551e82a1e2fef43a5
tensorflow/python/debug/cli/debugger_cli_common.py
python
RichTextLines.prepend
(self, line, font_attr_segs=None)
Prepend (i.e., add to the front) a single line of text. Args: line: (str) The text to be added to the front. font_attr_segs: (list of tuples) Font attribute segments of the appended line.
Prepend (i.e., add to the front) a single line of text.
[ "Prepend", "(", "i", ".", "e", ".", "add", "to", "the", "front", ")", "a", "single", "line", "of", "text", "." ]
def prepend(self, line, font_attr_segs=None): """Prepend (i.e., add to the front) a single line of text. Args: line: (str) The text to be added to the front. font_attr_segs: (list of tuples) Font attribute segments of the appended line. """ other = RichTextLines(line) if font_a...
[ "def", "prepend", "(", "self", ",", "line", ",", "font_attr_segs", "=", "None", ")", ":", "other", "=", "RichTextLines", "(", "line", ")", "if", "font_attr_segs", ":", "other", ".", "font_attr_segs", "[", "0", "]", "=", "font_attr_segs", "self", ".", "_e...
https://github.com/benoitsteiner/tensorflow-opencl/blob/cb7cb40a57fde5cfd4731bc551e82a1e2fef43a5/tensorflow/python/debug/cli/debugger_cli_common.py#L330-L342
google/llvm-propeller
45c226984fe8377ebfb2ad7713c680d652ba678d
lldb/third_party/Python/module/pexpect-4.6/pexpect/fdpexpect.py
python
fdspawn.terminate
(self, force=False)
Deprecated and invalid. Just raises an exception.
Deprecated and invalid. Just raises an exception.
[ "Deprecated", "and", "invalid", ".", "Just", "raises", "an", "exception", "." ]
def terminate (self, force=False): # pragma: no cover '''Deprecated and invalid. Just raises an exception.''' raise ExceptionPexpect('This method is not valid for file descriptors.')
[ "def", "terminate", "(", "self", ",", "force", "=", "False", ")", ":", "# pragma: no cover", "raise", "ExceptionPexpect", "(", "'This method is not valid for file descriptors.'", ")" ]
https://github.com/google/llvm-propeller/blob/45c226984fe8377ebfb2ad7713c680d652ba678d/lldb/third_party/Python/module/pexpect-4.6/pexpect/fdpexpect.py#L89-L91
usdot-fhwa-stol/carma-platform
d9d9b93f9689b2c7dd607cf5432d5296fc1000f5
guidance_plugin_validator/src/guidance_plugin_validator/guidance_plugin_validator.py
python
GuidancePluginValidator.log_final_results_for_each_plugin
(self)
return
Calls appropriate function for each plugin's 'results' object in order to write all final validation results to the log file for this node.
Calls appropriate function for each plugin's 'results' object in order to write all final validation results to the log file for this node.
[ "Calls", "appropriate", "function", "for", "each", "plugin", "s", "results", "object", "in", "order", "to", "write", "all", "final", "validation", "results", "to", "the", "log", "file", "for", "this", "node", "." ]
def log_final_results_for_each_plugin(self): """ Calls appropriate function for each plugin's 'results' object in order to write all final validation results to the log file for this node. """ rospy.loginfo("**********************************************************") r...
[ "def", "log_final_results_for_each_plugin", "(", "self", ")", ":", "rospy", ".", "loginfo", "(", "\"**********************************************************\"", ")", "rospy", ".", "loginfo", "(", "\"******Final Validation Results for Strategic Plugins******\"", ")", "rospy", ...
https://github.com/usdot-fhwa-stol/carma-platform/blob/d9d9b93f9689b2c7dd607cf5432d5296fc1000f5/guidance_plugin_validator/src/guidance_plugin_validator/guidance_plugin_validator.py#L113-L144
Cisco-Talos/moflow
ed71dfb0540d9e0d7a4c72f0881b58958d573728
BAP-0.7-moflow/libtracewrap/libtrace/protobuf/python/ez_setup.py
python
main
(argv, version=DEFAULT_VERSION)
Install or upgrade setuptools and EasyInstall
Install or upgrade setuptools and EasyInstall
[ "Install", "or", "upgrade", "setuptools", "and", "EasyInstall" ]
def main(argv, version=DEFAULT_VERSION): """Install or upgrade setuptools and EasyInstall""" try: import setuptools except ImportError: egg = None try: egg = download_setuptools(version, delay=0) sys.path.insert(0,egg) from setuptools.command.easy_...
[ "def", "main", "(", "argv", ",", "version", "=", "DEFAULT_VERSION", ")", ":", "try", ":", "import", "setuptools", "except", "ImportError", ":", "egg", "=", "None", "try", ":", "egg", "=", "download_setuptools", "(", "version", ",", "delay", "=", "0", ")"...
https://github.com/Cisco-Talos/moflow/blob/ed71dfb0540d9e0d7a4c72f0881b58958d573728/BAP-0.7-moflow/libtracewrap/libtrace/protobuf/python/ez_setup.py#L208-L247
ucla-vision/xivo
1b97bf5a3124e62bf4920429af5bb91c7a6de876
scripts/tum_rgbd_benchmark_tools/evaluate_ate.py
python
align
(model,data)
return rot,trans,trans_error
Align two trajectories using the method of Horn (closed-form). Input: model -- first trajectory (3xn) data -- second trajectory (3xn) Output: rot -- rotation matrix (3x3) trans -- translation vector (3x1) trans_error -- translational error per point (1xn)
Align two trajectories using the method of Horn (closed-form).
[ "Align", "two", "trajectories", "using", "the", "method", "of", "Horn", "(", "closed", "-", "form", ")", "." ]
def align(model,data): """Align two trajectories using the method of Horn (closed-form). Input: model -- first trajectory (3xn) data -- second trajectory (3xn) Output: rot -- rotation matrix (3x3) trans -- translation vector (3x1) trans_error -- translational error per point (1xn) ...
[ "def", "align", "(", "model", ",", "data", ")", ":", "numpy", ".", "set_printoptions", "(", "precision", "=", "3", ",", "suppress", "=", "True", ")", "model_zerocentered", "=", "model", "-", "model", ".", "mean", "(", "1", ")", "data_zerocentered", "=", ...
https://github.com/ucla-vision/xivo/blob/1b97bf5a3124e62bf4920429af5bb91c7a6de876/scripts/tum_rgbd_benchmark_tools/evaluate_ate.py#L51-L83
microsoft/TSS.MSR
0f2516fca2cd9929c31d5450e39301c9bde43688
TSS.Py/src/TpmTypes.py
python
LoadResponse.initFromTpm
(self, buf)
TpmMarshaller method
TpmMarshaller method
[ "TpmMarshaller", "method" ]
def initFromTpm(self, buf): """ TpmMarshaller method """ self.name = buf.readSizedByteBuf()
[ "def", "initFromTpm", "(", "self", ",", "buf", ")", ":", "self", ".", "name", "=", "buf", ".", "readSizedByteBuf", "(", ")" ]
https://github.com/microsoft/TSS.MSR/blob/0f2516fca2cd9929c31d5450e39301c9bde43688/TSS.Py/src/TpmTypes.py#L9636-L9638
perilouswithadollarsign/cstrike15_src
f82112a2388b841d72cb62ca48ab1846dfcc11c8
thirdparty/protobuf-2.5.0/python/google/protobuf/text_format.py
python
_Tokenizer.AtEnd
(self)
return self.token == ''
Checks the end of the text was reached. Returns: True iff the end was reached.
Checks the end of the text was reached.
[ "Checks", "the", "end", "of", "the", "text", "was", "reached", "." ]
def AtEnd(self): """Checks the end of the text was reached. Returns: True iff the end was reached. """ return self.token == ''
[ "def", "AtEnd", "(", "self", ")", ":", "return", "self", ".", "token", "==", "''" ]
https://github.com/perilouswithadollarsign/cstrike15_src/blob/f82112a2388b841d72cb62ca48ab1846dfcc11c8/thirdparty/protobuf-2.5.0/python/google/protobuf/text_format.py#L328-L334
aws/lumberyard
f85344403c1c2e77ec8c75deb2c116e97b713217
dev/Tools/Python/3.7.10/mac/Python.framework/Versions/3.7/lib/python3.7/tarfile.py
python
TarInfo.create_ustar_header
(self, info, encoding, errors)
return self._create_header(info, USTAR_FORMAT, encoding, errors)
Return the object as a ustar header block.
Return the object as a ustar header block.
[ "Return", "the", "object", "as", "a", "ustar", "header", "block", "." ]
def create_ustar_header(self, info, encoding, errors): """Return the object as a ustar header block. """ info["magic"] = POSIX_MAGIC if len(info["linkname"].encode(encoding, errors)) > LENGTH_LINK: raise ValueError("linkname is too long") if len(info["name"].encode(...
[ "def", "create_ustar_header", "(", "self", ",", "info", ",", "encoding", ",", "errors", ")", ":", "info", "[", "\"magic\"", "]", "=", "POSIX_MAGIC", "if", "len", "(", "info", "[", "\"linkname\"", "]", ".", "encode", "(", "encoding", ",", "errors", ")", ...
https://github.com/aws/lumberyard/blob/f85344403c1c2e77ec8c75deb2c116e97b713217/dev/Tools/Python/3.7.10/mac/Python.framework/Versions/3.7/lib/python3.7/tarfile.py#L822-L833
SIPp/sipp
f44d0cf5dec0013eff8fd7b4da885d455aa82e0e
cpplint.py
python
CheckStyle
(filename, clean_lines, linenum, file_extension, nesting_state, error)
Checks rules from the 'C++ style rules' section of cppguide.html. Most of these rules are hard to test (naming, comment style), but we do what we can. In particular we check for 2-space indents, line lengths, tab usage, spaces inside code, etc. Args: filename: The name of the current file. clean_line...
Checks rules from the 'C++ style rules' section of cppguide.html.
[ "Checks", "rules", "from", "the", "C", "++", "style", "rules", "section", "of", "cppguide", ".", "html", "." ]
def CheckStyle(filename, clean_lines, linenum, file_extension, nesting_state, error): """Checks rules from the 'C++ style rules' section of cppguide.html. Most of these rules are hard to test (naming, comment style), but we do what we can. In particular we check for 2-space indents, line lengths,...
[ "def", "CheckStyle", "(", "filename", ",", "clean_lines", ",", "linenum", ",", "file_extension", ",", "nesting_state", ",", "error", ")", ":", "raw_lines", "=", "clean_lines", ".", "raw_lines", "line", "=", "raw_lines", "[", "linenum", "]", "if", "line", "."...
https://github.com/SIPp/sipp/blob/f44d0cf5dec0013eff8fd7b4da885d455aa82e0e/cpplint.py#L2792-L2900
msftguy/ssh-rd
a5f3a79daeac5844edebf01916c9613563f1c390
_3rd/boost_1_48_0/tools/build/v2/build/property.py
python
refine
(properties, requirements)
return sequence.unique(list(result) + requirements)
Refines 'properties' by overriding any non-free properties for which a different value is specified in 'requirements'. Conditional requirements are just added without modification. Returns the resulting list of properties.
Refines 'properties' by overriding any non-free properties for which a different value is specified in 'requirements'. Conditional requirements are just added without modification. Returns the resulting list of properties.
[ "Refines", "properties", "by", "overriding", "any", "non", "-", "free", "properties", "for", "which", "a", "different", "value", "is", "specified", "in", "requirements", ".", "Conditional", "requirements", "are", "just", "added", "without", "modification", ".", ...
def refine (properties, requirements): """ Refines 'properties' by overriding any non-free properties for which a different value is specified in 'requirements'. Conditional requirements are just added without modification. Returns the resulting list of properties. """ # The result...
[ "def", "refine", "(", "properties", ",", "requirements", ")", ":", "# The result has no duplicates, so we store it in a set", "result", "=", "set", "(", ")", "# Records all requirements.", "required", "=", "{", "}", "# All the elements of requirements should be present in the r...
https://github.com/msftguy/ssh-rd/blob/a5f3a79daeac5844edebf01916c9613563f1c390/_3rd/boost_1_48_0/tools/build/v2/build/property.py#L152-L184
windystrife/UnrealEngine_NVIDIAGameWorks
b50e6338a7c5b26374d66306ebc7807541ff815e
Engine/Extras/ThirdPartyNotUE/emsdk/Win64/python/2.7.5.3_64bit/Lib/lib-tk/Tkinter.py
python
Spinbox.__init__
(self, master=None, cnf={}, **kw)
Construct a spinbox widget with the parent MASTER. STANDARD OPTIONS activebackground, background, borderwidth, cursor, exportselection, font, foreground, highlightbackground, highlightcolor, highlightthickness, insertbackground, insertborderwidth, in...
Construct a spinbox widget with the parent MASTER.
[ "Construct", "a", "spinbox", "widget", "with", "the", "parent", "MASTER", "." ]
def __init__(self, master=None, cnf={}, **kw): """Construct a spinbox widget with the parent MASTER. STANDARD OPTIONS activebackground, background, borderwidth, cursor, exportselection, font, foreground, highlightbackground, highlightcolor, highlightthic...
[ "def", "__init__", "(", "self", ",", "master", "=", "None", ",", "cnf", "=", "{", "}", ",", "*", "*", "kw", ")", ":", "Widget", ".", "__init__", "(", "self", ",", "master", ",", "'spinbox'", ",", "cnf", ",", "kw", ")" ]
https://github.com/windystrife/UnrealEngine_NVIDIAGameWorks/blob/b50e6338a7c5b26374d66306ebc7807541ff815e/Engine/Extras/ThirdPartyNotUE/emsdk/Win64/python/2.7.5.3_64bit/Lib/lib-tk/Tkinter.py#L3373-L3400
domino-team/openwrt-cc
8b181297c34d14d3ca521cc9f31430d561dbc688
package/gli-pub/openwrt-node-packages-master/node/node-v6.9.1/deps/v8_inspector/third_party/jinja2/jinja2/utils.py
python
LRUCache.iteritems
(self)
return iter(self.items())
Iterate over all items.
Iterate over all items.
[ "Iterate", "over", "all", "items", "." ]
def iteritems(self): """Iterate over all items.""" return iter(self.items())
[ "def", "iteritems", "(", "self", ")", ":", "return", "iter", "(", "self", ".", "items", "(", ")", ")" ]
https://github.com/domino-team/openwrt-cc/blob/8b181297c34d14d3ca521cc9f31430d561dbc688/package/gli-pub/openwrt-node-packages-master/node/node-v6.9.1/deps/v8_inspector/third_party/jinja2/jinja2/utils.py#L449-L451
aws/lumberyard
f85344403c1c2e77ec8c75deb2c116e97b713217
dev/Tools/Python/3.7.10/mac/Python.framework/Versions/3.7/lib/python3.7/_collections_abc.py
python
Generator.throw
(self, typ, val=None, tb=None)
Raise an exception in the generator. Return next yielded value or raise StopIteration.
Raise an exception in the generator. Return next yielded value or raise StopIteration.
[ "Raise", "an", "exception", "in", "the", "generator", ".", "Return", "next", "yielded", "value", "or", "raise", "StopIteration", "." ]
def throw(self, typ, val=None, tb=None): """Raise an exception in the generator. Return next yielded value or raise StopIteration. """ if val is None: if tb is None: raise typ val = typ() if tb is not None: val = val.with_traceb...
[ "def", "throw", "(", "self", ",", "typ", ",", "val", "=", "None", ",", "tb", "=", "None", ")", ":", "if", "val", "is", "None", ":", "if", "tb", "is", "None", ":", "raise", "typ", "val", "=", "typ", "(", ")", "if", "tb", "is", "not", "None", ...
https://github.com/aws/lumberyard/blob/f85344403c1c2e77ec8c75deb2c116e97b713217/dev/Tools/Python/3.7.10/mac/Python.framework/Versions/3.7/lib/python3.7/_collections_abc.py#L327-L337
gnuradio/gnuradio
09c3c4fa4bfb1a02caac74cb5334dfe065391e3b
gr-utils/modtool/cli/base.py
python
common_params
(func)
return wrapper
Common parameters for various modules
Common parameters for various modules
[ "Common", "parameters", "for", "various", "modules" ]
def common_params(func): """ Common parameters for various modules""" @click.option('-d', '--directory', default='.', help="Base directory of the module. Defaults to the cwd.") @click.option('--skip-lib', is_flag=True, help="Don't do anything in the lib/ subdirectory.") ...
[ "def", "common_params", "(", "func", ")", ":", "@", "click", ".", "option", "(", "'-d'", ",", "'--directory'", ",", "default", "=", "'.'", ",", "help", "=", "\"Base directory of the module. Defaults to the cwd.\"", ")", "@", "click", ".", "option", "(", "'--sk...
https://github.com/gnuradio/gnuradio/blob/09c3c4fa4bfb1a02caac74cb5334dfe065391e3b/gr-utils/modtool/cli/base.py#L114-L136
adobe/chromium
cfe5bf0b51b1f6b9fe239c2a3c2f2364da9967d7
tools/python/google/gethash_timer.py
python
LogResponse
(sample_count, response_code, elapsed_time)
Output the response for one GetHash query. Args: sample_count: The current sample number. response_code: The HTTP response code for the GetHash request. elapsed_time: The round-trip time (in milliseconds) for the GetHash request. Returns: None.
Output the response for one GetHash query. Args: sample_count: The current sample number. response_code: The HTTP response code for the GetHash request. elapsed_time: The round-trip time (in milliseconds) for the GetHash request. Returns: None.
[ "Output", "the", "response", "for", "one", "GetHash", "query", ".", "Args", ":", "sample_count", ":", "The", "current", "sample", "number", ".", "response_code", ":", "The", "HTTP", "response", "code", "for", "the", "GetHash", "request", ".", "elapsed_time", ...
def LogResponse(sample_count, response_code, elapsed_time): '''Output the response for one GetHash query. Args: sample_count: The current sample number. response_code: The HTTP response code for the GetHash request. elapsed_time: The round-trip time (in milliseconds) for the GetHash...
[ "def", "LogResponse", "(", "sample_count", ",", "response_code", ",", "elapsed_time", ")", ":", "global", "g_file_handle", "output_list", "=", "(", "sample_count", ",", "response_code", ",", "elapsed_time", ")", "print", "'Request: %d, status: %d, elapsed time: %f ms'", ...
https://github.com/adobe/chromium/blob/cfe5bf0b51b1f6b9fe239c2a3c2f2364da9967d7/tools/python/google/gethash_timer.py#L91-L106
hfinkel/llvm-project-cxxjit
91084ef018240bbb8e24235ff5cd8c355a9c1a1e
clang/utils/check_cfc/check_cfc.py
python
get_main_dir
()
return os.path.dirname(sys.argv[0])
Get the directory that the script or executable is located in.
Get the directory that the script or executable is located in.
[ "Get", "the", "directory", "that", "the", "script", "or", "executable", "is", "located", "in", "." ]
def get_main_dir(): """Get the directory that the script or executable is located in.""" if main_is_frozen(): return os.path.dirname(sys.executable) return os.path.dirname(sys.argv[0])
[ "def", "get_main_dir", "(", ")", ":", "if", "main_is_frozen", "(", ")", ":", "return", "os", ".", "path", ".", "dirname", "(", "sys", ".", "executable", ")", "return", "os", ".", "path", ".", "dirname", "(", "sys", ".", "argv", "[", "0", "]", ")" ]
https://github.com/hfinkel/llvm-project-cxxjit/blob/91084ef018240bbb8e24235ff5cd8c355a9c1a1e/clang/utils/check_cfc/check_cfc.py#L90-L94
wlanjie/AndroidFFmpeg
7baf9122f4b8e1c74e7baf4be5c422c7a5ba5aaf
tools/fdk-aac-build/x86/toolchain/lib/python2.7/ftplib.py
python
FTP.retrbinary
(self, cmd, callback, blocksize=8192, rest=None)
return self.voidresp()
Retrieve data in binary mode. A new port is created for you. Args: cmd: A RETR command. callback: A single parameter callable to be called on each block of data read. blocksize: The maximum number of bytes to read from the socket at one ti...
Retrieve data in binary mode. A new port is created for you.
[ "Retrieve", "data", "in", "binary", "mode", ".", "A", "new", "port", "is", "created", "for", "you", "." ]
def retrbinary(self, cmd, callback, blocksize=8192, rest=None): """Retrieve data in binary mode. A new port is created for you. Args: cmd: A RETR command. callback: A single parameter callable to be called on each block of data read. blocksize: The max...
[ "def", "retrbinary", "(", "self", ",", "cmd", ",", "callback", ",", "blocksize", "=", "8192", ",", "rest", "=", "None", ")", ":", "self", ".", "voidcmd", "(", "'TYPE I'", ")", "conn", "=", "self", ".", "transfercmd", "(", "cmd", ",", "rest", ")", "...
https://github.com/wlanjie/AndroidFFmpeg/blob/7baf9122f4b8e1c74e7baf4be5c422c7a5ba5aaf/tools/fdk-aac-build/x86/toolchain/lib/python2.7/ftplib.py#L394-L416
BlueBrain/Brayns
0133aae76cc2b7f800fc0bfb064400b64fd9b792
python/brayns/utils/camera_path_handler.py
python
CameraPathHandler._build_path
(self)
Builds a smoothed path according to class member contents
Builds a smoothed path according to class member contents
[ "Builds", "a", "smoothed", "path", "according", "to", "class", "member", "contents" ]
def _build_path(self): """Builds a smoothed path according to class member contents""" origins = list() directions = list() ups = list() aperture_radii = list() focus_distances = list() for s in range(len(self._control_points)-1): p0 = self._control_...
[ "def", "_build_path", "(", "self", ")", ":", "origins", "=", "list", "(", ")", "directions", "=", "list", "(", ")", "ups", "=", "list", "(", ")", "aperture_radii", "=", "list", "(", ")", "focus_distances", "=", "list", "(", ")", "for", "s", "in", "...
https://github.com/BlueBrain/Brayns/blob/0133aae76cc2b7f800fc0bfb064400b64fd9b792/python/brayns/utils/camera_path_handler.py#L44-L130
apache/incubator-mxnet
f03fb23f1d103fec9541b5ae59ee06b1734a51d9
python/mxnet/ndarray/numpy/_op.py
python
std
(a, axis=None, dtype=None, out=None, ddof=0, keepdims=False)
return _api_internal.std(a, axis, dtype, ddof, keepdims, out)
Compute the standard deviation along the specified axis. Returns the standard deviation, a measure of the spread of a distribution, of the array elements. The standard deviation is computed for the flattened array by default, otherwise over the specified axis. Parameters ---------- a : ndarray ...
Compute the standard deviation along the specified axis. Returns the standard deviation, a measure of the spread of a distribution, of the array elements. The standard deviation is computed for the flattened array by default, otherwise over the specified axis.
[ "Compute", "the", "standard", "deviation", "along", "the", "specified", "axis", ".", "Returns", "the", "standard", "deviation", "a", "measure", "of", "the", "spread", "of", "a", "distribution", "of", "the", "array", "elements", ".", "The", "standard", "deviati...
def std(a, axis=None, dtype=None, out=None, ddof=0, keepdims=False): # pylint: disable=too-many-arguments """ Compute the standard deviation along the specified axis. Returns the standard deviation, a measure of the spread of a distribution, of the array elements. The standard deviation is computed for...
[ "def", "std", "(", "a", ",", "axis", "=", "None", ",", "dtype", "=", "None", ",", "out", "=", "None", ",", "ddof", "=", "0", ",", "keepdims", "=", "False", ")", ":", "# pylint: disable=too-many-arguments", "return", "_api_internal", ".", "std", "(", "a...
https://github.com/apache/incubator-mxnet/blob/f03fb23f1d103fec9541b5ae59ee06b1734a51d9/python/mxnet/ndarray/numpy/_op.py#L5760-L5823
Floydlang/floyd
b7070c73d58d3caf15bbcedf3d4f882db893917b
compiler/libs/benchmark/tools/gbench/util.py
python
remove_benchmark_flags
(prefix, benchmark_flags)
return [f for f in benchmark_flags if not f.startswith(prefix)]
Return a new list containing the specified benchmark_flags except those with the specified prefix.
Return a new list containing the specified benchmark_flags except those with the specified prefix.
[ "Return", "a", "new", "list", "containing", "the", "specified", "benchmark_flags", "except", "those", "with", "the", "specified", "prefix", "." ]
def remove_benchmark_flags(prefix, benchmark_flags): """ Return a new list containing the specified benchmark_flags except those with the specified prefix. """ assert prefix.startswith('--') and prefix.endswith('=') return [f for f in benchmark_flags if not f.startswith(prefix)]
[ "def", "remove_benchmark_flags", "(", "prefix", ",", "benchmark_flags", ")", ":", "assert", "prefix", ".", "startswith", "(", "'--'", ")", "and", "prefix", ".", "endswith", "(", "'='", ")", "return", "[", "f", "for", "f", "in", "benchmark_flags", "if", "no...
https://github.com/Floydlang/floyd/blob/b7070c73d58d3caf15bbcedf3d4f882db893917b/compiler/libs/benchmark/tools/gbench/util.py#L104-L110
CRYTEK/CRYENGINE
232227c59a220cbbd311576f0fbeba7bb53b2a8c
Editor/Python/windows/Lib/site-packages/setuptools/_vendor/packaging/specifiers.py
python
BaseSpecifier.__eq__
(self, other)
Returns a boolean representing whether or not the two Specifier like objects are equal.
Returns a boolean representing whether or not the two Specifier like objects are equal.
[ "Returns", "a", "boolean", "representing", "whether", "or", "not", "the", "two", "Specifier", "like", "objects", "are", "equal", "." ]
def __eq__(self, other): """ Returns a boolean representing whether or not the two Specifier like objects are equal. """
[ "def", "__eq__", "(", "self", ",", "other", ")", ":" ]
https://github.com/CRYTEK/CRYENGINE/blob/232227c59a220cbbd311576f0fbeba7bb53b2a8c/Editor/Python/windows/Lib/site-packages/setuptools/_vendor/packaging/specifiers.py#L37-L41
wxWidgets/wxPython-Classic
19571e1ae65f1ac445f5491474121998c97a1bf0
src/osx_carbon/richtext.py
python
RichTextLine.GetDescent
(*args, **kwargs)
return _richtext.RichTextLine_GetDescent(*args, **kwargs)
GetDescent(self) -> int
GetDescent(self) -> int
[ "GetDescent", "(", "self", ")", "-", ">", "int" ]
def GetDescent(*args, **kwargs): """GetDescent(self) -> int""" return _richtext.RichTextLine_GetDescent(*args, **kwargs)
[ "def", "GetDescent", "(", "*", "args", ",", "*", "*", "kwargs", ")", ":", "return", "_richtext", ".", "RichTextLine_GetDescent", "(", "*", "args", ",", "*", "*", "kwargs", ")" ]
https://github.com/wxWidgets/wxPython-Classic/blob/19571e1ae65f1ac445f5491474121998c97a1bf0/src/osx_carbon/richtext.py#L1947-L1949
BTCPrivate/BTCP-Rebase
c8c7fe6ac26b6fba71eae1c89cdc0d924f5c6d82
share/rpcauth/rpcauth.py
python
generate_password
()
return base64.urlsafe_b64encode(os.urandom(32)).decode('utf-8')
Create 32 byte b64 password
Create 32 byte b64 password
[ "Create", "32", "byte", "b64", "password" ]
def generate_password(): """Create 32 byte b64 password""" return base64.urlsafe_b64encode(os.urandom(32)).decode('utf-8')
[ "def", "generate_password", "(", ")", ":", "return", "base64", ".", "urlsafe_b64encode", "(", "os", ".", "urandom", "(", "32", ")", ")", ".", "decode", "(", "'utf-8'", ")" ]
https://github.com/BTCPrivate/BTCP-Rebase/blob/c8c7fe6ac26b6fba71eae1c89cdc0d924f5c6d82/share/rpcauth/rpcauth.py#L20-L22
wxWidgets/wxPython-Classic
19571e1ae65f1ac445f5491474121998c97a1bf0
src/osx_carbon/_gdi.py
python
Icon.GetDepth
(*args, **kwargs)
return _gdi_.Icon_GetDepth(*args, **kwargs)
GetDepth(self) -> int
GetDepth(self) -> int
[ "GetDepth", "(", "self", ")", "-", ">", "int" ]
def GetDepth(*args, **kwargs): """GetDepth(self) -> int""" return _gdi_.Icon_GetDepth(*args, **kwargs)
[ "def", "GetDepth", "(", "*", "args", ",", "*", "*", "kwargs", ")", ":", "return", "_gdi_", ".", "Icon_GetDepth", "(", "*", "args", ",", "*", "*", "kwargs", ")" ]
https://github.com/wxWidgets/wxPython-Classic/blob/19571e1ae65f1ac445f5491474121998c97a1bf0/src/osx_carbon/_gdi.py#L1296-L1298
mongodb/mongo
d8ff665343ad29cf286ee2cf4a1960d29371937b
buildscripts/libdeps/libdeps/graph.py
python
LibdepsGraph.get_node_tree
(self, node)
return networkx.subgraph_view(direct_nonprivate_graph, filter_node=subtree)
Get a tree with the passed node as the single root.
Get a tree with the passed node as the single root.
[ "Get", "a", "tree", "with", "the", "passed", "node", "as", "the", "single", "root", "." ]
def get_node_tree(self, node): """Get a tree with the passed node as the single root.""" direct_nonprivate_graph = self.get_direct_nonprivate_graph() substree_set = networkx.descendants(direct_nonprivate_graph, node) def subtree(n1): return n1 in substree_set or n1 == node ...
[ "def", "get_node_tree", "(", "self", ",", "node", ")", ":", "direct_nonprivate_graph", "=", "self", ".", "get_direct_nonprivate_graph", "(", ")", "substree_set", "=", "networkx", ".", "descendants", "(", "direct_nonprivate_graph", ",", "node", ")", "def", "subtree...
https://github.com/mongodb/mongo/blob/d8ff665343ad29cf286ee2cf4a1960d29371937b/buildscripts/libdeps/libdeps/graph.py#L132-L141
acado/acado
b4e28f3131f79cadfd1a001e9fff061f361d3a0f
misc/cpplint.py
python
_ClassifyInclude
(fileinfo, include, is_system)
return _OTHER_HEADER
Figures out what kind of header 'include' is. Args: fileinfo: The current file cpplint is running over. A FileInfo instance. include: The path to a #included file. is_system: True if the #include used <> rather than "". Returns: One of the _XXX_HEADER constants. For example: >>> _ClassifyIn...
Figures out what kind of header 'include' is.
[ "Figures", "out", "what", "kind", "of", "header", "include", "is", "." ]
def _ClassifyInclude(fileinfo, include, is_system): """Figures out what kind of header 'include' is. Args: fileinfo: The current file cpplint is running over. A FileInfo instance. include: The path to a #included file. is_system: True if the #include used <> rather than "". Returns: One of the _...
[ "def", "_ClassifyInclude", "(", "fileinfo", ",", "include", ",", "is_system", ")", ":", "# This is a list of all standard c++ header files, except", "# those already checked for above.", "is_cpp_h", "=", "include", "in", "_CPP_HEADERS", "if", "is_system", ":", "if", "is_cpp...
https://github.com/acado/acado/blob/b4e28f3131f79cadfd1a001e9fff061f361d3a0f/misc/cpplint.py#L3512-L3568
PaddlePaddle/Paddle
1252f4bb3e574df80aa6d18c7ddae1b3a90bd81c
python/paddle/fluid/dygraph/dygraph_to_static/program_translator.py
python
_extract_indeed_params_buffers
(class_instance)
return params + buffers
To filter not initialzed buffers.
To filter not initialzed buffers.
[ "To", "filter", "not", "initialzed", "buffers", "." ]
def _extract_indeed_params_buffers(class_instance): """ To filter not initialzed buffers. """ params = list(get_parameters(class_instance).values()) buffers = list(get_buffers(class_instance).values()) buffers = [buffer for buffer in buffers if len(buffer.shape) != 0] return params + buffer...
[ "def", "_extract_indeed_params_buffers", "(", "class_instance", ")", ":", "params", "=", "list", "(", "get_parameters", "(", "class_instance", ")", ".", "values", "(", ")", ")", "buffers", "=", "list", "(", "get_buffers", "(", "class_instance", ")", ".", "valu...
https://github.com/PaddlePaddle/Paddle/blob/1252f4bb3e574df80aa6d18c7ddae1b3a90bd81c/python/paddle/fluid/dygraph/dygraph_to_static/program_translator.py#L691-L699
hanpfei/chromium-net
392cc1fa3a8f92f42e4071ab6e674d8e0482f83f
third_party/catapult/dashboard/dashboard/start_try_job.py
python
_GuessCommandNonTelemetry
(suite, bisect_bot, use_buildbucket)
return ' '.join(command)
Returns a command string to use for non-Telemetry tests.
Returns a command string to use for non-Telemetry tests.
[ "Returns", "a", "command", "string", "to", "use", "for", "non", "-", "Telemetry", "tests", "." ]
def _GuessCommandNonTelemetry(suite, bisect_bot, use_buildbucket): """Returns a command string to use for non-Telemetry tests.""" if suite not in _NON_TELEMETRY_TEST_COMMANDS: return None if suite == 'cc_perftests' and bisect_bot.startswith('android'): if use_buildbucket: return ('src/build/android/...
[ "def", "_GuessCommandNonTelemetry", "(", "suite", ",", "bisect_bot", ",", "use_buildbucket", ")", ":", "if", "suite", "not", "in", "_NON_TELEMETRY_TEST_COMMANDS", ":", "return", "None", "if", "suite", "==", "'cc_perftests'", "and", "bisect_bot", ".", "startswith", ...
https://github.com/hanpfei/chromium-net/blob/392cc1fa3a8f92f42e4071ab6e674d8e0482f83f/third_party/catapult/dashboard/dashboard/start_try_job.py#L420-L446
apiaryio/drafter
4634ebd07f6c6f257cc656598ccd535492fdfb55
tools/gyp/pylib/gyp/MSVSSettings.py
python
_GetMSBuildToolSettings
(msbuild_settings, tool)
return msbuild_settings.setdefault(tool.msbuild_name, {})
Returns an MSBuild tool dictionary. Creates it if needed.
Returns an MSBuild tool dictionary. Creates it if needed.
[ "Returns", "an", "MSBuild", "tool", "dictionary", ".", "Creates", "it", "if", "needed", "." ]
def _GetMSBuildToolSettings(msbuild_settings, tool): """Returns an MSBuild tool dictionary. Creates it if needed.""" return msbuild_settings.setdefault(tool.msbuild_name, {})
[ "def", "_GetMSBuildToolSettings", "(", "msbuild_settings", ",", "tool", ")", ":", "return", "msbuild_settings", ".", "setdefault", "(", "tool", ".", "msbuild_name", ",", "{", "}", ")" ]
https://github.com/apiaryio/drafter/blob/4634ebd07f6c6f257cc656598ccd535492fdfb55/tools/gyp/pylib/gyp/MSVSSettings.py#L62-L64
livecode/livecode
4606a10ea10b16d5071d0f9f263ccdd7ede8b31d
gyp/pylib/gyp/xcode_emulation.py
python
XcodeSettings.GetCflagsObjCC
(self, configname)
return cflags_objcc
Returns flags that need to be added to .mm compilations.
Returns flags that need to be added to .mm compilations.
[ "Returns", "flags", "that", "need", "to", "be", "added", "to", ".", "mm", "compilations", "." ]
def GetCflagsObjCC(self, configname): """Returns flags that need to be added to .mm compilations.""" self.configname = configname cflags_objcc = [] self._AddObjectiveCGarbageCollectionFlags(cflags_objcc) self._AddObjectiveCARCFlags(cflags_objcc) self._AddObjectiveCMissingPropertySynthesisFlags(c...
[ "def", "GetCflagsObjCC", "(", "self", ",", "configname", ")", ":", "self", ".", "configname", "=", "configname", "cflags_objcc", "=", "[", "]", "self", ".", "_AddObjectiveCGarbageCollectionFlags", "(", "cflags_objcc", ")", "self", ".", "_AddObjectiveCARCFlags", "(...
https://github.com/livecode/livecode/blob/4606a10ea10b16d5071d0f9f263ccdd7ede8b31d/gyp/pylib/gyp/xcode_emulation.py#L655-L665
catboost/catboost
167f64f237114a4d10b2b4ee42adb4569137debe
contrib/python/setuptools/py3/pkg_resources/_vendor/appdirs.py
python
site_data_dir
(appname=None, appauthor=None, version=None, multipath=False)
return path
r"""Return full path to the user-shared data dir for this application. "appname" is the name of application. If None, just the system directory is returned. "appauthor" (only used on Windows) is the name of the appauthor or distributing body for this application. Typically ...
r"""Return full path to the user-shared data dir for this application.
[ "r", "Return", "full", "path", "to", "the", "user", "-", "shared", "data", "dir", "for", "this", "application", "." ]
def site_data_dir(appname=None, appauthor=None, version=None, multipath=False): r"""Return full path to the user-shared data dir for this application. "appname" is the name of application. If None, just the system directory is returned. "appauthor" (only used on Windows) is the name of ...
[ "def", "site_data_dir", "(", "appname", "=", "None", ",", "appauthor", "=", "None", ",", "version", "=", "None", ",", "multipath", "=", "False", ")", ":", "if", "system", "==", "\"win32\"", ":", "if", "appauthor", "is", "None", ":", "appauthor", "=", "...
https://github.com/catboost/catboost/blob/167f64f237114a4d10b2b4ee42adb4569137debe/contrib/python/setuptools/py3/pkg_resources/_vendor/appdirs.py#L100-L163
microsoft/EdgeML
ef9f8a77f096acbdeb941014791f8eda1c1bc35b
pytorch/edgeml_pytorch/utils.py
python
binaryHingeLoss
(logits, labels)
return torch.mean(F.relu(1.0 - (2 * labels - 1) * logits))
BinaryHingeLoss to match C++ Version - No pytorch internal version
BinaryHingeLoss to match C++ Version - No pytorch internal version
[ "BinaryHingeLoss", "to", "match", "C", "++", "Version", "-", "No", "pytorch", "internal", "version" ]
def binaryHingeLoss(logits, labels): ''' BinaryHingeLoss to match C++ Version - No pytorch internal version ''' return torch.mean(F.relu(1.0 - (2 * labels - 1) * logits))
[ "def", "binaryHingeLoss", "(", "logits", ",", "labels", ")", ":", "return", "torch", ".", "mean", "(", "F", ".", "relu", "(", "1.0", "-", "(", "2", "*", "labels", "-", "1", ")", "*", "logits", ")", ")" ]
https://github.com/microsoft/EdgeML/blob/ef9f8a77f096acbdeb941014791f8eda1c1bc35b/pytorch/edgeml_pytorch/utils.py#L66-L70
apple/turicreate
cce55aa5311300e3ce6af93cb45ba791fd1bdf49
deps/src/libxml2-2.9.1/python/libxml2.py
python
uCSIsKhmer
(code)
return ret
Check whether the character is part of Khmer UCS Block
Check whether the character is part of Khmer UCS Block
[ "Check", "whether", "the", "character", "is", "part", "of", "Khmer", "UCS", "Block" ]
def uCSIsKhmer(code): """Check whether the character is part of Khmer UCS Block """ ret = libxml2mod.xmlUCSIsKhmer(code) return ret
[ "def", "uCSIsKhmer", "(", "code", ")", ":", "ret", "=", "libxml2mod", ".", "xmlUCSIsKhmer", "(", "code", ")", "return", "ret" ]
https://github.com/apple/turicreate/blob/cce55aa5311300e3ce6af93cb45ba791fd1bdf49/deps/src/libxml2-2.9.1/python/libxml2.py#L2652-L2655
aws/lumberyard
f85344403c1c2e77ec8c75deb2c116e97b713217
dev/Tools/Python/3.7.10/mac/Python.framework/Versions/3.7/lib/python3.7/multiprocessing/pool.py
python
Pool.imap
(self, func, iterable, chunksize=1)
Equivalent of `map()` -- can be MUCH slower than `Pool.map()`.
Equivalent of `map()` -- can be MUCH slower than `Pool.map()`.
[ "Equivalent", "of", "map", "()", "--", "can", "be", "MUCH", "slower", "than", "Pool", ".", "map", "()", "." ]
def imap(self, func, iterable, chunksize=1): ''' Equivalent of `map()` -- can be MUCH slower than `Pool.map()`. ''' if self._state != RUN: raise ValueError("Pool not running") if chunksize == 1: result = IMapIterator(self._cache) self._taskqueu...
[ "def", "imap", "(", "self", ",", "func", ",", "iterable", ",", "chunksize", "=", "1", ")", ":", "if", "self", ".", "_state", "!=", "RUN", ":", "raise", "ValueError", "(", "\"Pool not running\"", ")", "if", "chunksize", "==", "1", ":", "result", "=", ...
https://github.com/aws/lumberyard/blob/f85344403c1c2e77ec8c75deb2c116e97b713217/dev/Tools/Python/3.7.10/mac/Python.framework/Versions/3.7/lib/python3.7/multiprocessing/pool.py#L297-L325
microsoft/TSS.MSR
0f2516fca2cd9929c31d5450e39301c9bde43688
TSS.Py/src/TpmTypes.py
python
TSS_KEY.fromBytes
(buffer)
return TpmBuffer(buffer).createObj(TSS_KEY)
Returns new TSS_KEY object constructed from its marshaled representation in the given byte buffer
Returns new TSS_KEY object constructed from its marshaled representation in the given byte buffer
[ "Returns", "new", "TSS_KEY", "object", "constructed", "from", "its", "marshaled", "representation", "in", "the", "given", "byte", "buffer" ]
def fromBytes(buffer): """ Returns new TSS_KEY object constructed from its marshaled representation in the given byte buffer """ return TpmBuffer(buffer).createObj(TSS_KEY)
[ "def", "fromBytes", "(", "buffer", ")", ":", "return", "TpmBuffer", "(", "buffer", ")", ".", "createObj", "(", "TSS_KEY", ")" ]
https://github.com/microsoft/TSS.MSR/blob/0f2516fca2cd9929c31d5450e39301c9bde43688/TSS.Py/src/TpmTypes.py#L18226-L18230
apache/qpid-proton
6bcdfebb55ea3554bc29b1901422532db331a591
python/proton/_handlers.py
python
MessagingHandler.on_link_error
(self, event: Event)
Called when the peer closes the link with an error condition. :param event: The underlying event object. Use this to obtain further information on the event.
Called when the peer closes the link with an error condition.
[ "Called", "when", "the", "peer", "closes", "the", "link", "with", "an", "error", "condition", "." ]
def on_link_error(self, event: Event) -> None: """ Called when the peer closes the link with an error condition. :param event: The underlying event object. Use this to obtain further information on the event. """ EndpointStateHandler.print_error(event.link, "link") ...
[ "def", "on_link_error", "(", "self", ",", "event", ":", "Event", ")", "->", "None", ":", "EndpointStateHandler", ".", "print_error", "(", "event", ".", "link", ",", "\"link\"", ")", "event", ".", "connection", ".", "close", "(", ")" ]
https://github.com/apache/qpid-proton/blob/6bcdfebb55ea3554bc29b1901422532db331a591/python/proton/_handlers.py#L732-L740
catboost/catboost
167f64f237114a4d10b2b4ee42adb4569137debe
contrib/python/more-itertools/py2/more_itertools/recipes.py
python
take
(n, iterable)
return list(islice(iterable, n))
Return first *n* items of the iterable as a list. >>> take(3, range(10)) [0, 1, 2] >>> take(5, range(3)) [0, 1, 2] Effectively a short replacement for ``next`` based iterator consumption when you want more than one item, but less than the whole iterator.
Return first *n* items of the iterable as a list.
[ "Return", "first", "*", "n", "*", "items", "of", "the", "iterable", "as", "a", "list", "." ]
def take(n, iterable): """Return first *n* items of the iterable as a list. >>> take(3, range(10)) [0, 1, 2] >>> take(5, range(3)) [0, 1, 2] Effectively a short replacement for ``next`` based iterator consumption when you want more than one item, but less than the whole ite...
[ "def", "take", "(", "n", ",", "iterable", ")", ":", "return", "list", "(", "islice", "(", "iterable", ",", "n", ")", ")" ]
https://github.com/catboost/catboost/blob/167f64f237114a4d10b2b4ee42adb4569137debe/contrib/python/more-itertools/py2/more_itertools/recipes.py#L82-L94
hughperkins/tf-coriander
970d3df6c11400ad68405f22b0c42a52374e94ca
tensorflow/contrib/metrics/python/ops/metric_ops.py
python
_streaming_false_negatives
(predictions, labels, weights=None, metrics_collections=None, updates_collections=None, name=None)
Computes the total number of false positives. If `weights` is `None`, weights default to 1. Use weights of 0 to mask values. Args: predictions: The predicted values, a `bool` `Tensor` of arbitrary dimensions. labels: The ground truth values, a `bool` `Tensor` whose dimensions must match `predi...
Computes the total number of false positives.
[ "Computes", "the", "total", "number", "of", "false", "positives", "." ]
def _streaming_false_negatives(predictions, labels, weights=None, metrics_collections=None, updates_collections=None, name=None): """Computes the total number of false positives. If `weights` is `None`, weights default to ...
[ "def", "_streaming_false_negatives", "(", "predictions", ",", "labels", ",", "weights", "=", "None", ",", "metrics_collections", "=", "None", ",", "updates_collections", "=", "None", ",", "name", "=", "None", ")", ":", "with", "variable_scope", ".", "variable_sc...
https://github.com/hughperkins/tf-coriander/blob/970d3df6c11400ad68405f22b0c42a52374e94ca/tensorflow/contrib/metrics/python/ops/metric_ops.py#L261-L297
rapidsai/cudf
d5b2448fc69f17509304d594f029d0df56984962
python/cudf/cudf/core/indexed_frame.py
python
IndexedFrame.memory_usage
(self, index=True, deep=False)
return usage
Return the memory usage of an object. Parameters ---------- index : bool, default True Specifies whether to include the memory usage of the index. deep : bool, default False The deep parameter is ignored and is only included for pandas compatibility. ...
Return the memory usage of an object.
[ "Return", "the", "memory", "usage", "of", "an", "object", "." ]
def memory_usage(self, index=True, deep=False): """Return the memory usage of an object. Parameters ---------- index : bool, default True Specifies whether to include the memory usage of the index. deep : bool, default False The deep parameter is ignored ...
[ "def", "memory_usage", "(", "self", ",", "index", "=", "True", ",", "deep", "=", "False", ")", ":", "usage", "=", "super", "(", ")", ".", "memory_usage", "(", "deep", "=", "deep", ")", "if", "index", ":", "usage", "[", "\"Index\"", "]", "=", "self"...
https://github.com/rapidsai/cudf/blob/d5b2448fc69f17509304d594f029d0df56984962/python/cudf/cudf/core/indexed_frame.py#L476-L536
catboost/catboost
167f64f237114a4d10b2b4ee42adb4569137debe
contrib/python/parso/py2/parso/python/tokenize.py
python
_print_tokens
(func)
return wrapper
A small helper function to help debug the tokenize_lines function.
A small helper function to help debug the tokenize_lines function.
[ "A", "small", "helper", "function", "to", "help", "debug", "the", "tokenize_lines", "function", "." ]
def _print_tokens(func): """ A small helper function to help debug the tokenize_lines function. """ def wrapper(*args, **kwargs): for token in func(*args, **kwargs): print(token) # This print is intentional for debugging! yield token return wrapper
[ "def", "_print_tokens", "(", "func", ")", ":", "def", "wrapper", "(", "*", "args", ",", "*", "*", "kwargs", ")", ":", "for", "token", "in", "func", "(", "*", "args", ",", "*", "*", "kwargs", ")", ":", "print", "(", "token", ")", "# This print is in...
https://github.com/catboost/catboost/blob/167f64f237114a4d10b2b4ee42adb4569137debe/contrib/python/parso/py2/parso/python/tokenize.py#L380-L389
oracle/graaljs
36a56e8e993d45fc40939a3a4d9c0c24990720f1
graal-nodejs/tools/gyp/pylib/gyp/msvs_emulation.py
python
MsvsSettings.GetPGDName
(self, config, expand_special)
return output_file
Gets the explicitly overridden pgd name for a target or returns None if it's not overridden.
Gets the explicitly overridden pgd name for a target or returns None if it's not overridden.
[ "Gets", "the", "explicitly", "overridden", "pgd", "name", "for", "a", "target", "or", "returns", "None", "if", "it", "s", "not", "overridden", "." ]
def GetPGDName(self, config, expand_special): """Gets the explicitly overridden pgd name for a target or returns None if it's not overridden.""" config = self._TargetConfig(config) output_file = self._Setting(("VCLinkerTool", "ProfileGuidedDatabase"), config) if output_file: ...
[ "def", "GetPGDName", "(", "self", ",", "config", ",", "expand_special", ")", ":", "config", "=", "self", ".", "_TargetConfig", "(", "config", ")", "output_file", "=", "self", ".", "_Setting", "(", "(", "\"VCLinkerTool\"", ",", "\"ProfileGuidedDatabase\"", ")",...
https://github.com/oracle/graaljs/blob/36a56e8e993d45fc40939a3a4d9c0c24990720f1/graal-nodejs/tools/gyp/pylib/gyp/msvs_emulation.py#L635-L644
ricardoquesada/Spidermonkey
4a75ea2543408bd1b2c515aa95901523eeef7858
python/mozbuild/mozpack/packager/__init__.py
python
SimpleManifestSink.remove
(self, component, pattern)
Remove files with the given pattern in the given component.
Remove files with the given pattern in the given component.
[ "Remove", "files", "with", "the", "given", "pattern", "in", "the", "given", "component", "." ]
def remove(self, component, pattern): ''' Remove files with the given pattern in the given component. ''' assert not self._closed errors.fatal('Removal is unsupported')
[ "def", "remove", "(", "self", ",", "component", ",", "pattern", ")", ":", "assert", "not", "self", ".", "_closed", "errors", ".", "fatal", "(", "'Removal is unsupported'", ")" ]
https://github.com/ricardoquesada/Spidermonkey/blob/4a75ea2543408bd1b2c515aa95901523eeef7858/python/mozbuild/mozpack/packager/__init__.py#L346-L351
baidu-research/tensorflow-allreduce
66d5b855e90b0949e9fa5cca5599fd729a70e874
tensorflow/python/debug/cli/command_parser.py
python
parse_tensor_name_with_slicing
(in_str)
return tensor_name, tensor_slicing
Parse tensor name, potentially suffixed by slicing string. Args: in_str: (str) Input name of the tensor, potentially followed by a slicing string. E.g.: Without slicing string: "hidden/weights/Variable:0", with slicing string: "hidden/weights/Variable:0[1, :]" Returns: (str) name of the tensor...
Parse tensor name, potentially suffixed by slicing string.
[ "Parse", "tensor", "name", "potentially", "suffixed", "by", "slicing", "string", "." ]
def parse_tensor_name_with_slicing(in_str): """Parse tensor name, potentially suffixed by slicing string. Args: in_str: (str) Input name of the tensor, potentially followed by a slicing string. E.g.: Without slicing string: "hidden/weights/Variable:0", with slicing string: "hidden/weights/Variable:...
[ "def", "parse_tensor_name_with_slicing", "(", "in_str", ")", ":", "if", "in_str", ".", "count", "(", "\"[\"", ")", "==", "1", "and", "in_str", ".", "endswith", "(", "\"]\"", ")", ":", "tensor_name", "=", "in_str", "[", ":", "in_str", ".", "index", "(", ...
https://github.com/baidu-research/tensorflow-allreduce/blob/66d5b855e90b0949e9fa5cca5599fd729a70e874/tensorflow/python/debug/cli/command_parser.py#L150-L170
kamyu104/LeetCode-Solutions
77605708a927ea3b85aee5a479db733938c7c211
Python/guess-the-majority-in-a-hidden-array.py
python
ArrayReader.query
(self, a, b, c, d)
:type a, b, c, d: int :rtype int
:type a, b, c, d: int :rtype int
[ ":", "type", "a", "b", "c", "d", ":", "int", ":", "rtype", "int" ]
def query(self, a, b, c, d): """ :type a, b, c, d: int :rtype int """ pass
[ "def", "query", "(", "self", ",", "a", ",", "b", ",", "c", ",", "d", ")", ":", "pass" ]
https://github.com/kamyu104/LeetCode-Solutions/blob/77605708a927ea3b85aee5a479db733938c7c211/Python/guess-the-majority-in-a-hidden-array.py#L5-L10
Xilinx/Vitis-AI
fc74d404563d9951b57245443c73bef389f3657f
tools/Vitis-AI-Quantizer/vai_q_tensorflow1.x/tensorflow/python/framework/ops.py
python
_NodeDef
(op_type, name, device=None, attrs=None)
return node_def
Create a NodeDef proto. Args: op_type: Value for the "op" attribute of the NodeDef proto. name: Value for the "name" attribute of the NodeDef proto. device: string, device, or function from NodeDef to string. Value for the "device" attribute of the NodeDef proto. attrs: Optional dictionary wher...
Create a NodeDef proto.
[ "Create", "a", "NodeDef", "proto", "." ]
def _NodeDef(op_type, name, device=None, attrs=None): # pylint: disable=redefined-outer-name """Create a NodeDef proto. Args: op_type: Value for the "op" attribute of the NodeDef proto. name: Value for the "name" attribute of the NodeDef proto. device: string, device, or function from NodeDef to strin...
[ "def", "_NodeDef", "(", "op_type", ",", "name", ",", "device", "=", "None", ",", "attrs", "=", "None", ")", ":", "# pylint: disable=redefined-outer-name", "node_def", "=", "node_def_pb2", ".", "NodeDef", "(", ")", "node_def", ".", "op", "=", "compat", ".", ...
https://github.com/Xilinx/Vitis-AI/blob/fc74d404563d9951b57245443c73bef389f3657f/tools/Vitis-AI-Quantizer/vai_q_tensorflow1.x/tensorflow/python/framework/ops.py#L1532-L1558
apple/turicreate
cce55aa5311300e3ce6af93cb45ba791fd1bdf49
src/external/coremltools_wrap/coremltools/deps/protobuf/python/google/protobuf/internal/encoder.py
python
MessageSetItemSizer
(field_number)
return FieldSize
Returns a sizer for extensions of MessageSet. The message set message looks like this: message MessageSet { repeated group Item = 1 { required int32 type_id = 2; required string message = 3; } }
Returns a sizer for extensions of MessageSet.
[ "Returns", "a", "sizer", "for", "extensions", "of", "MessageSet", "." ]
def MessageSetItemSizer(field_number): """Returns a sizer for extensions of MessageSet. The message set message looks like this: message MessageSet { repeated group Item = 1 { required int32 type_id = 2; required string message = 3; } } """ static_size = (_TagSize(1) * 2 + _...
[ "def", "MessageSetItemSizer", "(", "field_number", ")", ":", "static_size", "=", "(", "_TagSize", "(", "1", ")", "*", "2", "+", "_TagSize", "(", "2", ")", "+", "_VarintSize", "(", "field_number", ")", "+", "_TagSize", "(", "3", ")", ")", "local_VarintSiz...
https://github.com/apple/turicreate/blob/cce55aa5311300e3ce6af93cb45ba791fd1bdf49/src/external/coremltools_wrap/coremltools/deps/protobuf/python/google/protobuf/internal/encoder.py#L317-L336
PixarAnimationStudios/USD
faed18ce62c8736b02413635b584a2f637156bad
pxr/usdImaging/usdviewq/rootDataModel.py
python
RootDataModel.stage
(self, value)
Sets the current Usd.Stage object, and emits a signal if it is different from the previous stage.
Sets the current Usd.Stage object, and emits a signal if it is different from the previous stage.
[ "Sets", "the", "current", "Usd", ".", "Stage", "object", "and", "emits", "a", "signal", "if", "it", "is", "different", "from", "the", "previous", "stage", "." ]
def stage(self, value): """Sets the current Usd.Stage object, and emits a signal if it is different from the previous stage. """ validStage = (value is None) or isinstance(value, Usd.Stage) if not validStage: raise ValueError("Expected USD Stage, got: {}".format(repr...
[ "def", "stage", "(", "self", ",", "value", ")", ":", "validStage", "=", "(", "value", "is", "None", ")", "or", "isinstance", "(", "value", ",", "Usd", ".", "Stage", ")", "if", "not", "validStage", ":", "raise", "ValueError", "(", "\"Expected USD Stage, g...
https://github.com/PixarAnimationStudios/USD/blob/faed18ce62c8736b02413635b584a2f637156bad/pxr/usdImaging/usdviewq/rootDataModel.py#L67-L96
wxWidgets/wxPython-Classic
19571e1ae65f1ac445f5491474121998c97a1bf0
src/gtk/_gdi.py
python
PseudoDC.DrawIcon
(*args, **kwargs)
return _gdi_.PseudoDC_DrawIcon(*args, **kwargs)
DrawIcon(self, Icon icon, int x, int y) Draw an icon on the display (does nothing if the device context is PostScript). This can be the simplest way of drawing bitmaps on a window.
DrawIcon(self, Icon icon, int x, int y)
[ "DrawIcon", "(", "self", "Icon", "icon", "int", "x", "int", "y", ")" ]
def DrawIcon(*args, **kwargs): """ DrawIcon(self, Icon icon, int x, int y) Draw an icon on the display (does nothing if the device context is PostScript). This can be the simplest way of drawing bitmaps on a window. """ return _gdi_.PseudoDC_DrawIcon(*args, **kwa...
[ "def", "DrawIcon", "(", "*", "args", ",", "*", "*", "kwargs", ")", ":", "return", "_gdi_", ".", "PseudoDC_DrawIcon", "(", "*", "args", ",", "*", "*", "kwargs", ")" ]
https://github.com/wxWidgets/wxPython-Classic/blob/19571e1ae65f1ac445f5491474121998c97a1bf0/src/gtk/_gdi.py#L8020-L8028
Tencent/TNN
7acca99f54c55747b415a4c57677403eebc7b706
third_party/flatbuffers/python/flatbuffers/util.py
python
RemoveSizePrefix
(buf, offset)
return buf, offset + number_types.Int32Flags.bytewidth
Create a slice of a size-prefixed buffer that has its position advanced just past the size prefix.
Create a slice of a size-prefixed buffer that has its position advanced just past the size prefix.
[ "Create", "a", "slice", "of", "a", "size", "-", "prefixed", "buffer", "that", "has", "its", "position", "advanced", "just", "past", "the", "size", "prefix", "." ]
def RemoveSizePrefix(buf, offset): """ Create a slice of a size-prefixed buffer that has its position advanced just past the size prefix. """ return buf, offset + number_types.Int32Flags.bytewidth
[ "def", "RemoveSizePrefix", "(", "buf", ",", "offset", ")", ":", "return", "buf", ",", "offset", "+", "number_types", ".", "Int32Flags", ".", "bytewidth" ]
https://github.com/Tencent/TNN/blob/7acca99f54c55747b415a4c57677403eebc7b706/third_party/flatbuffers/python/flatbuffers/util.py#L38-L43
catboost/catboost
167f64f237114a4d10b2b4ee42adb4569137debe
contrib/tools/python3/src/Lib/sched.py
python
scheduler.empty
(self)
Check whether the queue is empty.
Check whether the queue is empty.
[ "Check", "whether", "the", "queue", "is", "empty", "." ]
def empty(self): """Check whether the queue is empty.""" with self._lock: return not self._queue
[ "def", "empty", "(", "self", ")", ":", "with", "self", ".", "_lock", ":", "return", "not", "self", ".", "_queue" ]
https://github.com/catboost/catboost/blob/167f64f237114a4d10b2b4ee42adb4569137debe/contrib/tools/python3/src/Lib/sched.py#L99-L102
ElvishArtisan/rivendell
153d9f73acb9735f3ce94c10b5dca069dec66fcf
apis/pypad/api/pypad.py
python
Update.syslog
(self,priority,msg)
Send a message to the syslog.
Send a message to the syslog.
[ "Send", "a", "message", "to", "the", "syslog", "." ]
def syslog(self,priority,msg): """ Send a message to the syslog. """ if((priority&248)==0): priority=priority|(int(self.__rd_config.get('Identity','SyslogFacility',fallback=syslog.LOG_USER))<<3) syslog.syslog(priority,msg)
[ "def", "syslog", "(", "self", ",", "priority", ",", "msg", ")", ":", "if", "(", "(", "priority", "&", "248", ")", "==", "0", ")", ":", "priority", "=", "priority", "|", "(", "int", "(", "self", ".", "__rd_config", ".", "get", "(", "'Identity'", "...
https://github.com/ElvishArtisan/rivendell/blob/153d9f73acb9735f3ce94c10b5dca069dec66fcf/apis/pypad/api/pypad.py#L759-L765
omniscale/imposm-parser
c1045e989af3d7d31086c2662dc632add5a45ed1
imposm/parser/pbf/parser.py
python
PrimitiveBlockParser.ways
(self)
Return an iterator for all *ways* in this primitive block. :rtype: iterator of ``(osm_id, tags, [ref1, ref2, ...])`` tuples
Return an iterator for all *ways* in this primitive block. :rtype: iterator of ``(osm_id, tags, [ref1, ref2, ...])`` tuples
[ "Return", "an", "iterator", "for", "all", "*", "ways", "*", "in", "this", "primitive", "block", ".", ":", "rtype", ":", "iterator", "of", "(", "osm_id", "tags", "[", "ref1", "ref2", "...", "]", ")", "tuples" ]
def ways(self): """ Return an iterator for all *ways* in this primitive block. :rtype: iterator of ``(osm_id, tags, [ref1, ref2, ...])`` tuples """ for group in self.primitivegroup: ways = group.ways if ways: for way in ways: ...
[ "def", "ways", "(", "self", ")", ":", "for", "group", "in", "self", ".", "primitivegroup", ":", "ways", "=", "group", ".", "ways", "if", "ways", ":", "for", "way", "in", "ways", ":", "keys", "=", "way", ".", "keys", "vals", "=", "way", ".", "vals...
https://github.com/omniscale/imposm-parser/blob/c1045e989af3d7d31086c2662dc632add5a45ed1/imposm/parser/pbf/parser.py#L220-L242
intel-iot-devkit/how-to-code-samples
b4ea616f36bbfa2e042beb1698f968cfd651d79f
doorbell/python/iot_doorbell/hardware/board.py
python
Board.update_hardware_state
(self)
Abstract method for updating hardware state.
Abstract method for updating hardware state.
[ "Abstract", "method", "for", "updating", "hardware", "state", "." ]
def update_hardware_state(self): """ Abstract method for updating hardware state. """ pass
[ "def", "update_hardware_state", "(", "self", ")", ":", "pass" ]
https://github.com/intel-iot-devkit/how-to-code-samples/blob/b4ea616f36bbfa2e042beb1698f968cfd651d79f/doorbell/python/iot_doorbell/hardware/board.py#L95-L101
SFTtech/openage
d6a08c53c48dc1e157807471df92197f6ca9e04d
openage/convert/value_object/init/game_file_version.py
python
GameFileVersion.get_hashes
(self)
return self.hashes
Return the hash-version association for the file paths.
Return the hash-version association for the file paths.
[ "Return", "the", "hash", "-", "version", "association", "for", "the", "file", "paths", "." ]
def get_hashes(self): """ Return the hash-version association for the file paths. """ return self.hashes
[ "def", "get_hashes", "(", "self", ")", ":", "return", "self", ".", "hashes" ]
https://github.com/SFTtech/openage/blob/d6a08c53c48dc1e157807471df92197f6ca9e04d/openage/convert/value_object/init/game_file_version.py#L39-L43
kismetwireless/kismet
a7c0dc270c960fb1f58bd9cec4601c201885fd4e
capture_sdr_rtlamr/KismetCaptureRtlamr/kismetexternal/__init__.py
python
ExternalInterface.send_ping
(self)
Send a PING :return: None
Send a PING
[ "Send", "a", "PING" ]
def send_ping(self): """ Send a PING :return: None """ if self.last_pong == 0: self.last_pong = time.time() ping = kismet_pb2.Ping() self.write_ext_packet("PING", ping)
[ "def", "send_ping", "(", "self", ")", ":", "if", "self", ".", "last_pong", "==", "0", ":", "self", ".", "last_pong", "=", "time", ".", "time", "(", ")", "ping", "=", "kismet_pb2", ".", "Ping", "(", ")", "self", ".", "write_ext_packet", "(", "\"PING\"...
https://github.com/kismetwireless/kismet/blob/a7c0dc270c960fb1f58bd9cec4601c201885fd4e/capture_sdr_rtlamr/KismetCaptureRtlamr/kismetexternal/__init__.py#L627-L637
CRYTEK/CRYENGINE
232227c59a220cbbd311576f0fbeba7bb53b2a8c
Code/Tools/waf-1.7.13/waflib/Tools/c_config.py
python
cc_load_tools
(conf)
Load the c tool
Load the c tool
[ "Load", "the", "c", "tool" ]
def cc_load_tools(conf): """ Load the c tool """ if not conf.env.DEST_OS: conf.env.DEST_OS = Utils.unversioned_sys_platform() conf.load('c')
[ "def", "cc_load_tools", "(", "conf", ")", ":", "if", "not", "conf", ".", "env", ".", "DEST_OS", ":", "conf", ".", "env", ".", "DEST_OS", "=", "Utils", ".", "unversioned_sys_platform", "(", ")", "conf", ".", "load", "(", "'c'", ")" ]
https://github.com/CRYTEK/CRYENGINE/blob/232227c59a220cbbd311576f0fbeba7bb53b2a8c/Code/Tools/waf-1.7.13/waflib/Tools/c_config.py#L1019-L1025
wxWidgets/wxPython-Classic
19571e1ae65f1ac445f5491474121998c97a1bf0
wx/py/PySlicesShell.py
python
main
(filename=None)
The main function for the PySlicesShell program.
The main function for the PySlicesShell program.
[ "The", "main", "function", "for", "the", "PySlicesShell", "program", "." ]
def main(filename=None): """The main function for the PySlicesShell program.""" # Cleanup the main namespace, leaving the App class. import sys if not filename and len(sys.argv) > 1: filename = sys.argv[1] if filename: filename = os.path.realpath(filename) import __main__ ...
[ "def", "main", "(", "filename", "=", "None", ")", ":", "# Cleanup the main namespace, leaving the App class.", "import", "sys", "if", "not", "filename", "and", "len", "(", "sys", ".", "argv", ")", ">", "1", ":", "filename", "=", "sys", ".", "argv", "[", "1...
https://github.com/wxWidgets/wxPython-Classic/blob/19571e1ae65f1ac445f5491474121998c97a1bf0/wx/py/PySlicesShell.py#L56-L93
pytorch/pytorch
7176c92687d3cc847cc046bf002269c6949a21c2
torch/optim/_functional.py
python
adam
(params: List[Tensor], grads: List[Tensor], exp_avgs: List[Tensor], exp_avg_sqs: List[Tensor], max_exp_avg_sqs: List[Tensor], state_steps: List[Tensor], *, amsgrad: bool, beta1: float, beta2: float, lr: float, weight_deca...
r"""Functional API that performs Adam algorithm computation. See :class:`~torch.optim.Adam` for details.
r"""Functional API that performs Adam algorithm computation.
[ "r", "Functional", "API", "that", "performs", "Adam", "algorithm", "computation", "." ]
def adam(params: List[Tensor], grads: List[Tensor], exp_avgs: List[Tensor], exp_avg_sqs: List[Tensor], max_exp_avg_sqs: List[Tensor], state_steps: List[Tensor], *, amsgrad: bool, beta1: float, beta2: float, lr: float, wei...
[ "def", "adam", "(", "params", ":", "List", "[", "Tensor", "]", ",", "grads", ":", "List", "[", "Tensor", "]", ",", "exp_avgs", ":", "List", "[", "Tensor", "]", ",", "exp_avg_sqs", ":", "List", "[", "Tensor", "]", ",", "max_exp_avg_sqs", ":", "List", ...
https://github.com/pytorch/pytorch/blob/7176c92687d3cc847cc046bf002269c6949a21c2/torch/optim/_functional.py#L71-L123
tensorflow/tensorflow
419e3a6b650ea4bd1b0cba23c4348f8a69f3272e
tensorflow/python/client/timeline.py
python
_TensorTracker.pid
(self)
return self._pid
ID of the process which created this tensor (an integer).
ID of the process which created this tensor (an integer).
[ "ID", "of", "the", "process", "which", "created", "this", "tensor", "(", "an", "integer", ")", "." ]
def pid(self): """ID of the process which created this tensor (an integer).""" return self._pid
[ "def", "pid", "(", "self", ")", ":", "return", "self", ".", "_pid" ]
https://github.com/tensorflow/tensorflow/blob/419e3a6b650ea4bd1b0cba23c4348f8a69f3272e/tensorflow/python/client/timeline.py#L297-L299
FreeCAD/FreeCAD
ba42231b9c6889b89e064d6d563448ed81e376ec
src/Mod/Tux/PersistentToolbarsGui.py
python
isConnected
(i)
Connect toolbar to onSave function.
Connect toolbar to onSave function.
[ "Connect", "toolbar", "to", "onSave", "function", "." ]
def isConnected(i): """Connect toolbar to onSave function.""" if i not in conectedToolbars: conectedToolbars.append(i) i.topLevelChanged.connect(onSave) else: pass
[ "def", "isConnected", "(", "i", ")", ":", "if", "i", "not", "in", "conectedToolbars", ":", "conectedToolbars", ".", "append", "(", "i", ")", "i", ".", "topLevelChanged", ".", "connect", "(", "onSave", ")", "else", ":", "pass" ]
https://github.com/FreeCAD/FreeCAD/blob/ba42231b9c6889b89e064d6d563448ed81e376ec/src/Mod/Tux/PersistentToolbarsGui.py#L53-L60
natanielruiz/android-yolo
1ebb54f96a67a20ff83ddfc823ed83a13dc3a47f
jni-build/jni/include/external/bazel_tools/tools/build_defs/pkg/archive.py
python
TarFileWriter.close
(self)
Close the output tar file. This class should not be used anymore after calling that method. Raises: TarFileWriter.Error: if an error happens when compressing the output file.
Close the output tar file.
[ "Close", "the", "output", "tar", "file", "." ]
def close(self): """Close the output tar file. This class should not be used anymore after calling that method. Raises: TarFileWriter.Error: if an error happens when compressing the output file. """ self.tar.close() if self.xz: # Support xz compression through xz... until we can us...
[ "def", "close", "(", "self", ")", ":", "self", ".", "tar", ".", "close", "(", ")", "if", "self", ".", "xz", ":", "# Support xz compression through xz... until we can use Py3", "if", "subprocess", ".", "call", "(", "'which xz'", ",", "shell", "=", "True", ","...
https://github.com/natanielruiz/android-yolo/blob/1ebb54f96a67a20ff83ddfc823ed83a13dc3a47f/jni-build/jni/include/external/bazel_tools/tools/build_defs/pkg/archive.py#L373-L390
pmq20/node-packer
12c46c6e44fbc14d9ee645ebd17d5296b324f7e0
lts/deps/npm/node_modules/node-gyp/gyp/pylib/gyp/xcode_ninja.py
python
IsValidTargetForWrapper
(target_extras, executable_target_pattern, spec)
return False
Limit targets for Xcode wrapper. Xcode sometimes performs poorly with too many targets, so only include proper executable targets, with filters to customize. Arguments: target_extras: Regular expression to always add, matching any target. executable_target_pattern: Regular expression limiting executable ...
Limit targets for Xcode wrapper.
[ "Limit", "targets", "for", "Xcode", "wrapper", "." ]
def IsValidTargetForWrapper(target_extras, executable_target_pattern, spec): """Limit targets for Xcode wrapper. Xcode sometimes performs poorly with too many targets, so only include proper executable targets, with filters to customize. Arguments: target_extras: Regular expression to always add, matching ...
[ "def", "IsValidTargetForWrapper", "(", "target_extras", ",", "executable_target_pattern", ",", "spec", ")", ":", "target_name", "=", "spec", ".", "get", "(", "'target_name'", ")", "# Always include targets matching target_extras.", "if", "target_extras", "is", "not", "N...
https://github.com/pmq20/node-packer/blob/12c46c6e44fbc14d9ee645ebd17d5296b324f7e0/lts/deps/npm/node_modules/node-gyp/gyp/pylib/gyp/xcode_ninja.py#L126-L150
openvinotoolkit/openvino
dedcbeafa8b84cccdc55ca64b8da516682b381c7
src/bindings/python/src/openvino/runtime/utils/types.py
python
get_element_type
(data_type: NumericType)
Return an ngraph element type for a Python type or numpy.dtype.
Return an ngraph element type for a Python type or numpy.dtype.
[ "Return", "an", "ngraph", "element", "type", "for", "a", "Python", "type", "or", "numpy", ".", "dtype", "." ]
def get_element_type(data_type: NumericType) -> NgraphType: """Return an ngraph element type for a Python type or numpy.dtype.""" if data_type is int: log.warning("Converting int type of undefined bitwidth to 32-bit ngraph integer.") return NgraphType.i32 if data_type is float: log....
[ "def", "get_element_type", "(", "data_type", ":", "NumericType", ")", "->", "NgraphType", ":", "if", "data_type", "is", "int", ":", "log", ".", "warning", "(", "\"Converting int type of undefined bitwidth to 32-bit ngraph integer.\"", ")", "return", "NgraphType", ".", ...
https://github.com/openvinotoolkit/openvino/blob/dedcbeafa8b84cccdc55ca64b8da516682b381c7/src/bindings/python/src/openvino/runtime/utils/types.py#L56-L72
google/certificate-transparency
2588562fd306a447958471b6f06c1069619c1641
python/ct/crypto/asn1/types.py
python
Choice.__init__
(self, value=None, serialized_value=None, readahead_tag=None, readahead_value=None, strict=True)
Initialize fully or partially. Args: value: if present, should be a dictionary with one entry representing the chosen key and value. serialized_value: if present, the serialized contents (with tags and lengths stripped). readahead_tag: if pres...
Initialize fully or partially.
[ "Initialize", "fully", "or", "partially", "." ]
def __init__(self, value=None, serialized_value=None, readahead_tag=None, readahead_value=None, strict=True): """Initialize fully or partially. Args: value: if present, should be a dictionary with one entry representing the chosen key and value. ...
[ "def", "__init__", "(", "self", ",", "value", "=", "None", ",", "serialized_value", "=", "None", ",", "readahead_tag", "=", "None", ",", "readahead_value", "=", "None", ",", "strict", "=", "True", ")", ":", "if", "readahead_tag", "is", "not", "None", ":"...
https://github.com/google/certificate-transparency/blob/2588562fd306a447958471b6f06c1069619c1641/python/ct/crypto/asn1/types.py#L1190-L1216
qgis/QGIS
15a77662d4bb712184f6aa60d0bd663010a76a75
python/plugins/db_manager/db_plugins/postgis/connector.py
python
PostGisDBConnector._checkSpatial
(self)
return self.has_spatial
check whether postgis_version is present in catalog
check whether postgis_version is present in catalog
[ "check", "whether", "postgis_version", "is", "present", "in", "catalog" ]
def _checkSpatial(self): """ check whether postgis_version is present in catalog """ c = self._execute(None, u"SELECT COUNT(*) FROM pg_proc WHERE proname = 'postgis_version'") self.has_spatial = self._fetchone(c)[0] > 0 self._close_cursor(c) return self.has_spatial
[ "def", "_checkSpatial", "(", "self", ")", ":", "c", "=", "self", ".", "_execute", "(", "None", ",", "u\"SELECT COUNT(*) FROM pg_proc WHERE proname = 'postgis_version'\"", ")", "self", ".", "has_spatial", "=", "self", ".", "_fetchone", "(", "c", ")", "[", "0", ...
https://github.com/qgis/QGIS/blob/15a77662d4bb712184f6aa60d0bd663010a76a75/python/plugins/db_manager/db_plugins/postgis/connector.py#L298-L303
microsoft/TSS.MSR
0f2516fca2cd9929c31d5450e39301c9bde43688
TSS.Py/src/TpmTypes.py
python
TPMS_SIGNATURE_RSAPSS.__init__
(self, hash = TPM_ALG_ID.NULL, sig = None)
Table 185 Definition of {RSA} TPMS_SIGNATURE_RSA Structure Attributes: hash (TPM_ALG_ID): The hash algorithm used to digest the message TPM_ALG_NULL is not allowed. sig (bytes): The signature is the size of a public key.
Table 185 Definition of {RSA} TPMS_SIGNATURE_RSA Structure
[ "Table", "185", "Definition", "of", "{", "RSA", "}", "TPMS_SIGNATURE_RSA", "Structure" ]
def __init__(self, hash = TPM_ALG_ID.NULL, sig = None): """ Table 185 Definition of {RSA} TPMS_SIGNATURE_RSA Structure Attributes: hash (TPM_ALG_ID): The hash algorithm used to digest the message TPM_ALG_NULL is not allowed. sig (bytes): The signature is the size...
[ "def", "__init__", "(", "self", ",", "hash", "=", "TPM_ALG_ID", ".", "NULL", ",", "sig", "=", "None", ")", ":", "super", "(", "TPMS_SIGNATURE_RSAPSS", ",", "self", ")", ".", "__init__", "(", "hash", ",", "sig", ")" ]
https://github.com/microsoft/TSS.MSR/blob/0f2516fca2cd9929c31d5450e39301c9bde43688/TSS.Py/src/TpmTypes.py#L7537-L7545
FreeCAD/FreeCAD
ba42231b9c6889b89e064d6d563448ed81e376ec
src/Tools/offlinedoc/downloadwiki.py
python
getlinks
(html)
return pages
returns a list of wikipage links in html file
returns a list of wikipage links in html file
[ "returns", "a", "list", "of", "wikipage", "links", "in", "html", "file" ]
def getlinks(html): "returns a list of wikipage links in html file" links = re.findall('<a[^>]*>.*?</a>',html) pages = [] for l in links: # rg = re.findall('php\?title=(.*)\" title',l) rg = re.findall('href=.*?php\?title=(.*?)"',l) if not rg: rg = re.findall('href="\/...
[ "def", "getlinks", "(", "html", ")", ":", "links", "=", "re", ".", "findall", "(", "'<a[^>]*>.*?</a>'", ",", "html", ")", "pages", "=", "[", "]", "for", "l", "in", "links", ":", "# rg = re.findall('php\\?title=(.*)\\\" title',l)", "rg", "=", "re", ".", "fi...
https://github.com/FreeCAD/FreeCAD/blob/ba42231b9c6889b89e064d6d563448ed81e376ec/src/Tools/offlinedoc/downloadwiki.py#L193-L217
PX4/PX4-Autopilot
0b9f60a0370be53d683352c63fd92db3d6586e18
src/lib/mixer/MultirotorMixer/geometries/tools/px_generate_mixers.py
python
parse_geometry_toml
(filename)
return geometry
Parses toml geometry file and returns a dictionary with curated list of rotors
Parses toml geometry file and returns a dictionary with curated list of rotors
[ "Parses", "toml", "geometry", "file", "and", "returns", "a", "dictionary", "with", "curated", "list", "of", "rotors" ]
def parse_geometry_toml(filename): ''' Parses toml geometry file and returns a dictionary with curated list of rotors ''' import os # Load toml file d = toml.load(filename) # Check info section if 'info' not in d: raise AttributeError('{}: Error, missing info section'.format(fi...
[ "def", "parse_geometry_toml", "(", "filename", ")", ":", "import", "os", "# Load toml file", "d", "=", "toml", ".", "load", "(", "filename", ")", "# Check info section", "if", "'info'", "not", "in", "d", ":", "raise", "AttributeError", "(", "'{}: Error, missing ...
https://github.com/PX4/PX4-Autopilot/blob/0b9f60a0370be53d683352c63fd92db3d6586e18/src/lib/mixer/MultirotorMixer/geometries/tools/px_generate_mixers.py#L68-L131
windystrife/UnrealEngine_NVIDIAGameWorks
b50e6338a7c5b26374d66306ebc7807541ff815e
Engine/Extras/ThirdPartyNotUE/emsdk/Win64/python/2.7.5.3_64bit/Lib/sets.py
python
BaseSet.__and__
(self, other)
return self.intersection(other)
Return the intersection of two sets as a new set. (I.e. all elements that are in both sets.)
Return the intersection of two sets as a new set.
[ "Return", "the", "intersection", "of", "two", "sets", "as", "a", "new", "set", "." ]
def __and__(self, other): """Return the intersection of two sets as a new set. (I.e. all elements that are in both sets.) """ if not isinstance(other, BaseSet): return NotImplemented return self.intersection(other)
[ "def", "__and__", "(", "self", ",", "other", ")", ":", "if", "not", "isinstance", "(", "other", ",", "BaseSet", ")", ":", "return", "NotImplemented", "return", "self", ".", "intersection", "(", "other", ")" ]
https://github.com/windystrife/UnrealEngine_NVIDIAGameWorks/blob/b50e6338a7c5b26374d66306ebc7807541ff815e/Engine/Extras/ThirdPartyNotUE/emsdk/Win64/python/2.7.5.3_64bit/Lib/sets.py#L196-L203
livecode/livecode
4606a10ea10b16d5071d0f9f263ccdd7ede8b31d
gyp/pylib/gyp/msvs_emulation.py
python
MsvsSettings.GetExtension
(self)
return gyp.MSVSUtil.TARGET_TYPE_EXT.get(self.spec['type'], '')
Returns the extension for the target, with no leading dot. Uses 'product_extension' if specified, otherwise uses MSVS defaults based on the target type.
Returns the extension for the target, with no leading dot.
[ "Returns", "the", "extension", "for", "the", "target", "with", "no", "leading", "dot", "." ]
def GetExtension(self): """Returns the extension for the target, with no leading dot. Uses 'product_extension' if specified, otherwise uses MSVS defaults based on the target type. """ ext = self.spec.get('product_extension', None) if ext: return ext return gyp.MSVSUtil.TARGET_TYPE_EXT...
[ "def", "GetExtension", "(", "self", ")", ":", "ext", "=", "self", ".", "spec", ".", "get", "(", "'product_extension'", ",", "None", ")", "if", "ext", ":", "return", "ext", "return", "gyp", ".", "MSVSUtil", ".", "TARGET_TYPE_EXT", ".", "get", "(", "self...
https://github.com/livecode/livecode/blob/4606a10ea10b16d5071d0f9f263ccdd7ede8b31d/gyp/pylib/gyp/msvs_emulation.py#L226-L235
thalium/icebox
99d147d5b9269222225443ce171b4fd46d8985d4
third_party/virtualbox/src/libs/libxml2-2.9.4/python/libxml2.py
python
Error.resetError
(self)
Cleanup the error.
Cleanup the error.
[ "Cleanup", "the", "error", "." ]
def resetError(self): """Cleanup the error. """ libxml2mod.xmlResetError(self._o)
[ "def", "resetError", "(", "self", ")", ":", "libxml2mod", ".", "xmlResetError", "(", "self", ".", "_o", ")" ]
https://github.com/thalium/icebox/blob/99d147d5b9269222225443ce171b4fd46d8985d4/third_party/virtualbox/src/libs/libxml2-2.9.4/python/libxml2.py#L5854-L5856
KhronosGroup/SPIRV-LLVM
1eb85593f3fe2c39379b9a9b088d51eda4f42b8b
bindings/python/llvm/common.py
python
get_library
()
Obtain a reference to the llvm library.
Obtain a reference to the llvm library.
[ "Obtain", "a", "reference", "to", "the", "llvm", "library", "." ]
def get_library(): """Obtain a reference to the llvm library.""" # On Linux, ctypes.cdll.LoadLibrary() respects LD_LIBRARY_PATH # while ctypes.util.find_library() doesn't. # See http://docs.python.org/2/library/ctypes.html#finding-shared-libraries # # To make it possible to run the unit tests w...
[ "def", "get_library", "(", ")", ":", "# On Linux, ctypes.cdll.LoadLibrary() respects LD_LIBRARY_PATH", "# while ctypes.util.find_library() doesn't.", "# See http://docs.python.org/2/library/ctypes.html#finding-shared-libraries", "#", "# To make it possible to run the unit tests without installing ...
https://github.com/KhronosGroup/SPIRV-LLVM/blob/1eb85593f3fe2c39379b9a9b088d51eda4f42b8b/bindings/python/llvm/common.py#L94-L126
aws/lumberyard
f85344403c1c2e77ec8c75deb2c116e97b713217
dev/Tools/Python/3.7.10/linux_x64/lib/python3.7/mailbox.py
python
BabylMessage.set_labels
(self, labels)
Set the list of labels on the message.
Set the list of labels on the message.
[ "Set", "the", "list", "of", "labels", "on", "the", "message", "." ]
def set_labels(self, labels): """Set the list of labels on the message.""" self._labels = list(labels)
[ "def", "set_labels", "(", "self", ",", "labels", ")", ":", "self", ".", "_labels", "=", "list", "(", "labels", ")" ]
https://github.com/aws/lumberyard/blob/f85344403c1c2e77ec8c75deb2c116e97b713217/dev/Tools/Python/3.7.10/linux_x64/lib/python3.7/mailbox.py#L1836-L1838
hughperkins/tf-coriander
970d3df6c11400ad68405f22b0c42a52374e94ca
tensorflow/python/ops/init_ops.py
python
uniform_unit_scaling_initializer
(factor=1.0, seed=None, dtype=dtypes.float32)
return _initializer
Returns an initializer that generates tensors without scaling variance. When initializing a deep network, it is in principle advantageous to keep the scale of the input variance constant, so it does not explode or diminish by reaching the final layer. If the input is `x` and the operation `x * W`, and we want ...
Returns an initializer that generates tensors without scaling variance.
[ "Returns", "an", "initializer", "that", "generates", "tensors", "without", "scaling", "variance", "." ]
def uniform_unit_scaling_initializer(factor=1.0, seed=None, dtype=dtypes.float32): """Returns an initializer that generates tensors without scaling variance. When initializing a deep network, it is in principle advantageous to keep the sca...
[ "def", "uniform_unit_scaling_initializer", "(", "factor", "=", "1.0", ",", "seed", "=", "None", ",", "dtype", "=", "dtypes", ".", "float32", ")", ":", "def", "_initializer", "(", "shape", ",", "dtype", "=", "_assert_float_dtype", "(", "dtype", ")", ",", "p...
https://github.com/hughperkins/tf-coriander/blob/970d3df6c11400ad68405f22b0c42a52374e94ca/tensorflow/python/ops/init_ops.py#L230-L281
mantidproject/mantid
03deeb89254ec4289edb8771e0188c2090a02f32
scripts/SANS/SANSUtility.py
python
create_zero_error_free_workspace
(input_workspace_name, output_workspace_name)
return message, complete
Creates a cloned workspace where all zero-error values have been replaced with a large value @param input_workspace_name :: The input workspace name @param output_workspace_name :: The output workspace name @returns a message and a completion flag
Creates a cloned workspace where all zero-error values have been replaced with a large value
[ "Creates", "a", "cloned", "workspace", "where", "all", "zero", "-", "error", "values", "have", "been", "replaced", "with", "a", "large", "value" ]
def create_zero_error_free_workspace(input_workspace_name, output_workspace_name): ''' Creates a cloned workspace where all zero-error values have been replaced with a large value @param input_workspace_name :: The input workspace name @param output_workspace_name :: The output workspace name @retur...
[ "def", "create_zero_error_free_workspace", "(", "input_workspace_name", ",", "output_workspace_name", ")", ":", "# Load the input workspace", "message", "=", "\"\"", "complete", "=", "False", "if", "input_workspace_name", "not", "in", "mtd", ":", "message", "=", "'Faile...
https://github.com/mantidproject/mantid/blob/03deeb89254ec4289edb8771e0188c2090a02f32/scripts/SANS/SANSUtility.py#L876-L907