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
raspberrypi/tools
13474ee775d0c5ec8a7da4fb0a9fa84187abfc87
arm-bcm2708/arm-rpi-4.9.3-linux-gnueabihf/share/gdb/python/gdb/command/explore.py
python
CompoundExplorer.explore_type
(name, datatype, is_child)
return False
Function to explore struct/class and union types. See Explorer.explore_type for more information.
Function to explore struct/class and union types. See Explorer.explore_type for more information.
[ "Function", "to", "explore", "struct", "/", "class", "and", "union", "types", ".", "See", "Explorer", ".", "explore_type", "for", "more", "information", "." ]
def explore_type(name, datatype, is_child): """Function to explore struct/class and union types. See Explorer.explore_type for more information. """ type_code = datatype.code type_desc = "" if type_code == gdb.TYPE_CODE_STRUCT: type_desc = "struct/class" else: type_desc = "union" fields = datatype.fields() if CompoundExplorer._get_real_field_count(fields) == 0: if is_child: print ("%s is a %s of type '%s' with no fields." % (name, type_desc, str(datatype))) Explorer.return_to_enclosing_type_prompt() else: print ("'%s' is a %s with no fields." % (name, type_desc)) return False if is_child: print ("%s is a %s of type '%s' " "with the following fields:\n" % (name, type_desc, str(datatype))) else: print ("'%s' is a %s with the following " "fields:\n" % (name, type_desc)) has_explorable_fields = False current_choice = 0 choice_to_compound_field_map = { } print_list = [ ] for field in fields: if field.artificial: continue if field.is_base_class: field_desc = "base class" else: field_desc = "field" rhs = ("<Enter %d to explore this %s of type '%s'>" % (current_choice, field_desc, str(field.type))) print_list.append((field.name, rhs)) choice_to_compound_field_map[str(current_choice)] = ( field.name, field.type, field_desc) current_choice = current_choice + 1 CompoundExplorer._print_fields(print_list) print ("") if len(choice_to_compound_field_map) > 0: choice = raw_input("Enter the field number of choice: ") if choice in choice_to_compound_field_map: if is_child: new_name = ("%s '%s' of %s" % (choice_to_compound_field_map[choice][2], choice_to_compound_field_map[choice][0], name)) else: new_name = ("%s '%s' of '%s'" % (choice_to_compound_field_map[choice][2], choice_to_compound_field_map[choice][0], name)) Explorer.explore_type(new_name, choice_to_compound_field_map[choice][1], True) return True else: if is_child: Explorer.return_to_enclosing_type() else: if is_child: Explorer.return_to_enclosing_type_prompt() return False
[ "def", "explore_type", "(", "name", ",", "datatype", ",", "is_child", ")", ":", "type_code", "=", "datatype", ".", "code", "type_desc", "=", "\"\"", "if", "type_code", "==", "gdb", ".", "TYPE_CODE_STRUCT", ":", "type_desc", "=", "\"struct/class\"", "else", "...
https://github.com/raspberrypi/tools/blob/13474ee775d0c5ec8a7da4fb0a9fa84187abfc87/arm-bcm2708/arm-rpi-4.9.3-linux-gnueabihf/share/gdb/python/gdb/command/explore.py#L473-L547
Xilinx/Vitis-AI
fc74d404563d9951b57245443c73bef389f3657f
tools/Vitis-AI-Quantizer/vai_q_tensorflow1.x/tensorflow/contrib/layers/python/layers/feature_column_ops.py
python
_check_forbidden_sequence_columns
(feature_columns)
Recursively checks `feature_columns` for `_FORBIDDEN_SEQUENCE_COLUMNS`.
Recursively checks `feature_columns` for `_FORBIDDEN_SEQUENCE_COLUMNS`.
[ "Recursively", "checks", "feature_columns", "for", "_FORBIDDEN_SEQUENCE_COLUMNS", "." ]
def _check_forbidden_sequence_columns(feature_columns): """Recursively checks `feature_columns` for `_FORBIDDEN_SEQUENCE_COLUMNS`.""" all_feature_columns = _gather_feature_columns(feature_columns) for feature_column in all_feature_columns: if isinstance(feature_column, _FORBIDDEN_SEQUENCE_COLUMNS): raise ValueError( 'Column {} is of type {}, which is not currently supported for ' 'sequences.'.format(feature_column.name, type(feature_column).__name__))
[ "def", "_check_forbidden_sequence_columns", "(", "feature_columns", ")", ":", "all_feature_columns", "=", "_gather_feature_columns", "(", "feature_columns", ")", "for", "feature_column", "in", "all_feature_columns", ":", "if", "isinstance", "(", "feature_column", ",", "_F...
https://github.com/Xilinx/Vitis-AI/blob/fc74d404563d9951b57245443c73bef389f3657f/tools/Vitis-AI-Quantizer/vai_q_tensorflow1.x/tensorflow/contrib/layers/python/layers/feature_column_ops.py#L911-L919
catboost/catboost
167f64f237114a4d10b2b4ee42adb4569137debe
contrib/python/ipython/py2/IPython/core/inputsplitter.py
python
InputSplitter.__init__
(self)
Create a new InputSplitter instance.
Create a new InputSplitter instance.
[ "Create", "a", "new", "InputSplitter", "instance", "." ]
def __init__(self): """Create a new InputSplitter instance. """ self._buffer = [] self._compile = codeop.CommandCompiler() self.encoding = get_input_encoding()
[ "def", "__init__", "(", "self", ")", ":", "self", ".", "_buffer", "=", "[", "]", "self", ".", "_compile", "=", "codeop", ".", "CommandCompiler", "(", ")", "self", ".", "encoding", "=", "get_input_encoding", "(", ")" ]
https://github.com/catboost/catboost/blob/167f64f237114a4d10b2b4ee42adb4569137debe/contrib/python/ipython/py2/IPython/core/inputsplitter.py#L215-L220
wxWidgets/wxPython-Classic
19571e1ae65f1ac445f5491474121998c97a1bf0
src/gtk/dataview.py
python
PyDataViewCustomRenderer.GetView
(*args, **kwargs)
return _dataview.PyDataViewCustomRenderer_GetView(*args, **kwargs)
GetView(self) -> DataViewCtrl
GetView(self) -> DataViewCtrl
[ "GetView", "(", "self", ")", "-", ">", "DataViewCtrl" ]
def GetView(*args, **kwargs): """GetView(self) -> DataViewCtrl""" return _dataview.PyDataViewCustomRenderer_GetView(*args, **kwargs)
[ "def", "GetView", "(", "*", "args", ",", "*", "*", "kwargs", ")", ":", "return", "_dataview", ".", "PyDataViewCustomRenderer_GetView", "(", "*", "args", ",", "*", "*", "kwargs", ")" ]
https://github.com/wxWidgets/wxPython-Classic/blob/19571e1ae65f1ac445f5491474121998c97a1bf0/src/gtk/dataview.py#L1509-L1511
hanpfei/chromium-net
392cc1fa3a8f92f42e4071ab6e674d8e0482f83f
third_party/catapult/third_party/webapp2/webapp2_extras/securecookie.py
python
SecureCookieSerializer.__init__
(self, secret_key)
Initiliazes the serializer/deserializer. :param secret_key: A random string to be used as the HMAC secret for the cookie signature.
Initiliazes the serializer/deserializer.
[ "Initiliazes", "the", "serializer", "/", "deserializer", "." ]
def __init__(self, secret_key): """Initiliazes the serializer/deserializer. :param secret_key: A random string to be used as the HMAC secret for the cookie signature. """ self.secret_key = secret_key
[ "def", "__init__", "(", "self", ",", "secret_key", ")", ":", "self", ".", "secret_key", "=", "secret_key" ]
https://github.com/hanpfei/chromium-net/blob/392cc1fa3a8f92f42e4071ab6e674d8e0482f83f/third_party/catapult/third_party/webapp2/webapp2_extras/securecookie.py#L27-L34
wlanjie/AndroidFFmpeg
7baf9122f4b8e1c74e7baf4be5c422c7a5ba5aaf
tools/fdk-aac-build/x86/toolchain/lib/python2.7/lib2to3/pgen2/grammar.py
python
Grammar.copy
(self)
return new
Copy the grammar.
Copy the grammar.
[ "Copy", "the", "grammar", "." ]
def copy(self): """ Copy the grammar. """ new = self.__class__() for dict_attr in ("symbol2number", "number2symbol", "dfas", "keywords", "tokens", "symbol2label"): setattr(new, dict_attr, getattr(self, dict_attr).copy()) new.labels = self.labels[:] new.states = self.states[:] new.start = self.start return new
[ "def", "copy", "(", "self", ")", ":", "new", "=", "self", ".", "__class__", "(", ")", "for", "dict_attr", "in", "(", "\"symbol2number\"", ",", "\"number2symbol\"", ",", "\"dfas\"", ",", "\"keywords\"", ",", "\"tokens\"", ",", "\"symbol2label\"", ")", ":", ...
https://github.com/wlanjie/AndroidFFmpeg/blob/7baf9122f4b8e1c74e7baf4be5c422c7a5ba5aaf/tools/fdk-aac-build/x86/toolchain/lib/python2.7/lib2to3/pgen2/grammar.py#L100-L111
ricardoquesada/Spidermonkey
4a75ea2543408bd1b2c515aa95901523eeef7858
python/psutil/psutil/__init__.py
python
Process.get_ext_memory_info
(self)
return self._platform_impl.get_ext_memory_info()
Return a namedtuple with variable fields depending on the platform representing extended memory information about the process. All numbers are expressed in bytes.
Return a namedtuple with variable fields depending on the platform representing extended memory information about the process. All numbers are expressed in bytes.
[ "Return", "a", "namedtuple", "with", "variable", "fields", "depending", "on", "the", "platform", "representing", "extended", "memory", "information", "about", "the", "process", ".", "All", "numbers", "are", "expressed", "in", "bytes", "." ]
def get_ext_memory_info(self): """Return a namedtuple with variable fields depending on the platform representing extended memory information about the process. All numbers are expressed in bytes. """ return self._platform_impl.get_ext_memory_info()
[ "def", "get_ext_memory_info", "(", "self", ")", ":", "return", "self", ".", "_platform_impl", ".", "get_ext_memory_info", "(", ")" ]
https://github.com/ricardoquesada/Spidermonkey/blob/4a75ea2543408bd1b2c515aa95901523eeef7858/python/psutil/psutil/__init__.py#L642-L647
SpenceKonde/megaTinyCore
1c4a70b18a149fe6bcb551dfa6db11ca50b8997b
megaavr/tools/libs/serial/urlhandler/protocol_socket.py
python
Serial.cts
(self)
return True
Read terminal status line: Clear To Send
Read terminal status line: Clear To Send
[ "Read", "terminal", "status", "line", ":", "Clear", "To", "Send" ]
def cts(self): """Read terminal status line: Clear To Send""" if not self.is_open: raise portNotOpenError if self.logger: self.logger.info('returning dummy for cts') return True
[ "def", "cts", "(", "self", ")", ":", "if", "not", "self", ".", "is_open", ":", "raise", "portNotOpenError", "if", "self", ".", "logger", ":", "self", ".", "logger", ".", "info", "(", "'returning dummy for cts'", ")", "return", "True" ]
https://github.com/SpenceKonde/megaTinyCore/blob/1c4a70b18a149fe6bcb551dfa6db11ca50b8997b/megaavr/tools/libs/serial/urlhandler/protocol_socket.py#L301-L307
pmq20/node-packer
12c46c6e44fbc14d9ee645ebd17d5296b324f7e0
lts/tools/gyp/pylib/gyp/msvs_emulation.py
python
GenerateEnvironmentFiles
(toplevel_build_dir, generator_flags, system_includes, open_out)
return cl_paths
It's not sufficient to have the absolute path to the compiler, linker, etc. on Windows, as those tools rely on .dlls being in the PATH. We also need to support both x86 and x64 compilers within the same build (to support msvs_target_platform hackery). Different architectures require a different compiler binary, and different supporting environment variables (INCLUDE, LIB, LIBPATH). So, we extract the environment here, wrap all invocations of compiler tools (cl, link, lib, rc, midl, etc.) via win_tool.py which sets up the environment, and then we do not prefix the compiler with an absolute path, instead preferring something like "cl.exe" in the rule which will then run whichever the environment setup has put in the path. When the following procedure to generate environment files does not meet your requirement (e.g. for custom toolchains), you can pass "-G ninja_use_custom_environment_files" to the gyp to suppress file generation and use custom environment files prepared by yourself.
It's not sufficient to have the absolute path to the compiler, linker, etc. on Windows, as those tools rely on .dlls being in the PATH. We also need to support both x86 and x64 compilers within the same build (to support msvs_target_platform hackery). Different architectures require a different compiler binary, and different supporting environment variables (INCLUDE, LIB, LIBPATH). So, we extract the environment here, wrap all invocations of compiler tools (cl, link, lib, rc, midl, etc.) via win_tool.py which sets up the environment, and then we do not prefix the compiler with an absolute path, instead preferring something like "cl.exe" in the rule which will then run whichever the environment setup has put in the path. When the following procedure to generate environment files does not meet your requirement (e.g. for custom toolchains), you can pass "-G ninja_use_custom_environment_files" to the gyp to suppress file generation and use custom environment files prepared by yourself.
[ "It", "s", "not", "sufficient", "to", "have", "the", "absolute", "path", "to", "the", "compiler", "linker", "etc", ".", "on", "Windows", "as", "those", "tools", "rely", "on", ".", "dlls", "being", "in", "the", "PATH", ".", "We", "also", "need", "to", ...
def GenerateEnvironmentFiles(toplevel_build_dir, generator_flags, system_includes, open_out): """It's not sufficient to have the absolute path to the compiler, linker, etc. on Windows, as those tools rely on .dlls being in the PATH. We also need to support both x86 and x64 compilers within the same build (to support msvs_target_platform hackery). Different architectures require a different compiler binary, and different supporting environment variables (INCLUDE, LIB, LIBPATH). So, we extract the environment here, wrap all invocations of compiler tools (cl, link, lib, rc, midl, etc.) via win_tool.py which sets up the environment, and then we do not prefix the compiler with an absolute path, instead preferring something like "cl.exe" in the rule which will then run whichever the environment setup has put in the path. When the following procedure to generate environment files does not meet your requirement (e.g. for custom toolchains), you can pass "-G ninja_use_custom_environment_files" to the gyp to suppress file generation and use custom environment files prepared by yourself.""" archs = ('x86', 'x64') if generator_flags.get('ninja_use_custom_environment_files', 0): cl_paths = {} for arch in archs: cl_paths[arch] = 'cl.exe' return cl_paths vs = GetVSVersion(generator_flags) cl_paths = {} for arch in archs: # Extract environment variables for subprocesses. args = vs.SetupScript(arch) args.extend(('&&', 'set')) popen = subprocess.Popen( args, shell=True, stdout=subprocess.PIPE, stderr=subprocess.STDOUT) variables, _ = popen.communicate() if PY3: variables = variables.decode('utf-8') if popen.returncode != 0: raise Exception('"%s" failed with error %d' % (args, popen.returncode)) env = _ExtractImportantEnvironment(variables) # Inject system includes from gyp files into INCLUDE. if system_includes: system_includes = system_includes | OrderedSet( env.get('INCLUDE', '').split(';')) env['INCLUDE'] = ';'.join(system_includes) env_block = _FormatAsEnvironmentBlock(env) f = open_out(os.path.join(toplevel_build_dir, 'environment.' + arch), 'wb') f.write(env_block) f.close() # Find cl.exe location for this architecture. args = vs.SetupScript(arch) args.extend(('&&', 'for', '%i', 'in', '(cl.exe)', 'do', '@echo', 'LOC:%~$PATH:i')) popen = subprocess.Popen(args, shell=True, stdout=subprocess.PIPE) output, _ = popen.communicate() if PY3: output = output.decode('utf-8') cl_paths[arch] = _ExtractCLPath(output) return cl_paths
[ "def", "GenerateEnvironmentFiles", "(", "toplevel_build_dir", ",", "generator_flags", ",", "system_includes", ",", "open_out", ")", ":", "archs", "=", "(", "'x86'", ",", "'x64'", ")", "if", "generator_flags", ".", "get", "(", "'ninja_use_custom_environment_files'", ...
https://github.com/pmq20/node-packer/blob/12c46c6e44fbc14d9ee645ebd17d5296b324f7e0/lts/tools/gyp/pylib/gyp/msvs_emulation.py#L1030-L1087
aws/lumberyard
f85344403c1c2e77ec8c75deb2c116e97b713217
dev/Gems/CloudGemMetric/v1/AWS/common-code/Lib/numpy/core/_asarray.py
python
asfortranarray
(a, dtype=None)
return array(a, dtype, copy=False, order='F', ndmin=1)
Return an array (ndim >= 1) laid out in Fortran order in memory. Parameters ---------- a : array_like Input array. dtype : str or dtype object, optional By default, the data-type is inferred from the input data. Returns ------- out : ndarray The input `a` in Fortran, or column-major, order. See Also -------- ascontiguousarray : Convert input to a contiguous (C order) array. asanyarray : Convert input to an ndarray with either row or column-major memory order. require : Return an ndarray that satisfies requirements. ndarray.flags : Information about the memory layout of the array. Examples -------- >>> x = np.arange(6).reshape(2,3) >>> y = np.asfortranarray(x) >>> x.flags['F_CONTIGUOUS'] False >>> y.flags['F_CONTIGUOUS'] True Note: This function returns an array with at least one-dimension (1-d) so it will not preserve 0-d arrays.
Return an array (ndim >= 1) laid out in Fortran order in memory.
[ "Return", "an", "array", "(", "ndim", ">", "=", "1", ")", "laid", "out", "in", "Fortran", "order", "in", "memory", "." ]
def asfortranarray(a, dtype=None): """ Return an array (ndim >= 1) laid out in Fortran order in memory. Parameters ---------- a : array_like Input array. dtype : str or dtype object, optional By default, the data-type is inferred from the input data. Returns ------- out : ndarray The input `a` in Fortran, or column-major, order. See Also -------- ascontiguousarray : Convert input to a contiguous (C order) array. asanyarray : Convert input to an ndarray with either row or column-major memory order. require : Return an ndarray that satisfies requirements. ndarray.flags : Information about the memory layout of the array. Examples -------- >>> x = np.arange(6).reshape(2,3) >>> y = np.asfortranarray(x) >>> x.flags['F_CONTIGUOUS'] False >>> y.flags['F_CONTIGUOUS'] True Note: This function returns an array with at least one-dimension (1-d) so it will not preserve 0-d arrays. """ return array(a, dtype, copy=False, order='F', ndmin=1)
[ "def", "asfortranarray", "(", "a", ",", "dtype", "=", "None", ")", ":", "return", "array", "(", "a", ",", "dtype", ",", "copy", "=", "False", ",", "order", "=", "'F'", ",", "ndmin", "=", "1", ")" ]
https://github.com/aws/lumberyard/blob/f85344403c1c2e77ec8c75deb2c116e97b713217/dev/Gems/CloudGemMetric/v1/AWS/common-code/Lib/numpy/core/_asarray.py#L183-L220
google/clif
cab24d6a105609a65c95a36a1712ae3c20c7b5df
clif/python/slots.py
python
GenSetItem
(setitem_slots)
Combine __setitem__ / __delitem__ funcs into one xx_setitem slot.
Combine __setitem__ / __delitem__ funcs into one xx_setitem slot.
[ "Combine", "__setitem__", "/", "__delitem__", "funcs", "into", "one", "xx_setitem", "slot", "." ]
def GenSetItem(setitem_slots): """Combine __setitem__ / __delitem__ funcs into one xx_setitem slot.""" assert len(setitem_slots) == 2, 'Need __setitem__ / __delitem__ funcs.' setitem, delitem = setitem_slots assert setitem or delitem, 'Need one or both __setitem__ / __delitem__ funcs.' yield '' yield 'int slot_seti(PyObject* self, Py_ssize_t idx, PyObject* value) {' yield I+'idx = slot::item_index(self, idx);' yield I+'if (idx < 0) return -1;' yield I+'PyObject* i = PyLong_FromSize_t(idx);' yield I+'if (i == nullptr) return -1;' yield I+'if (value != nullptr) {' if setitem: yield I+I+'PyObject* args = PyTuple_Pack(2, i, value);' yield I+I+'Py_DECREF(i);' yield I+I+'if (args == nullptr) return -1;' yield I+I+'PyObject* res = %s(self, args, nullptr);' % setitem yield I+I+'Py_DECREF(args);' yield I+I+'return slot::ignore(res);' else: yield I+I+'PyErr_SetNone(PyExc_NotImplementedError);' yield I+I+'return -1;' yield I+'} else {' if delitem: yield I+I+'PyObject* args = PyTuple_Pack(1, i);' yield I+I+'Py_DECREF(i);' yield I+I+'if (args == nullptr) return -1;' yield I+I+'PyObject* res = %s(self, args, nullptr);' % delitem yield I+I+'Py_DECREF(args);' yield I+I+'return slot::ignore(res);' else: yield I+I+'PyErr_SetNone(PyExc_NotImplementedError);' yield I+I+'return -1;' yield I+'}' yield '}'
[ "def", "GenSetItem", "(", "setitem_slots", ")", ":", "assert", "len", "(", "setitem_slots", ")", "==", "2", ",", "'Need __setitem__ / __delitem__ funcs.'", "setitem", ",", "delitem", "=", "setitem_slots", "assert", "setitem", "or", "delitem", ",", "'Need one or both...
https://github.com/google/clif/blob/cab24d6a105609a65c95a36a1712ae3c20c7b5df/clif/python/slots.py#L152-L186
aws/lumberyard
f85344403c1c2e77ec8c75deb2c116e97b713217
dev/Tools/Python/3.7.10/windows/Lib/tkinter/__init__.py
python
Misc._report_exception
(self)
Internal function.
Internal function.
[ "Internal", "function", "." ]
def _report_exception(self): """Internal function.""" exc, val, tb = sys.exc_info() root = self._root() root.report_callback_exception(exc, val, tb)
[ "def", "_report_exception", "(", "self", ")", ":", "exc", ",", "val", ",", "tb", "=", "sys", ".", "exc_info", "(", ")", "root", "=", "self", ".", "_root", "(", ")", "root", ".", "report_callback_exception", "(", "exc", ",", "val", ",", "tb", ")" ]
https://github.com/aws/lumberyard/blob/f85344403c1c2e77ec8c75deb2c116e97b713217/dev/Tools/Python/3.7.10/windows/Lib/tkinter/__init__.py#L1448-L1452
oracle/graaljs
36a56e8e993d45fc40939a3a4d9c0c24990720f1
graal-nodejs/tools/gyp/pylib/gyp/generator/make.py
python
MakefileWriter.WritePchTargets
(self, pch_commands)
Writes make rules to compile prefix headers.
Writes make rules to compile prefix headers.
[ "Writes", "make", "rules", "to", "compile", "prefix", "headers", "." ]
def WritePchTargets(self, pch_commands): """Writes make rules to compile prefix headers.""" if not pch_commands: return for gch, lang_flag, lang, input in pch_commands: extra_flags = { "c": "$(CFLAGS_C_$(BUILDTYPE))", "cc": "$(CFLAGS_CC_$(BUILDTYPE))", "m": "$(CFLAGS_C_$(BUILDTYPE)) $(CFLAGS_OBJC_$(BUILDTYPE))", "mm": "$(CFLAGS_CC_$(BUILDTYPE)) $(CFLAGS_OBJCC_$(BUILDTYPE))", }[lang] var_name = { "c": "GYP_PCH_CFLAGS", "cc": "GYP_PCH_CXXFLAGS", "m": "GYP_PCH_OBJCFLAGS", "mm": "GYP_PCH_OBJCXXFLAGS", }[lang] self.WriteLn( f"{gch}: {var_name} := {lang_flag} " + "$(DEFS_$(BUILDTYPE)) " "$(INCS_$(BUILDTYPE)) " "$(CFLAGS_$(BUILDTYPE)) " + extra_flags ) self.WriteLn(f"{gch}: {input} FORCE_DO_CMD") self.WriteLn("\t@$(call do_cmd,pch_%s,1)" % lang) self.WriteLn("") assert " " not in gch, "Spaces in gch filenames not supported (%s)" % gch self.WriteLn("all_deps += %s" % gch) self.WriteLn("")
[ "def", "WritePchTargets", "(", "self", ",", "pch_commands", ")", ":", "if", "not", "pch_commands", ":", "return", "for", "gch", ",", "lang_flag", ",", "lang", ",", "input", "in", "pch_commands", ":", "extra_flags", "=", "{", "\"c\"", ":", "\"$(CFLAGS_C_$(BUI...
https://github.com/oracle/graaljs/blob/36a56e8e993d45fc40939a3a4d9c0c24990720f1/graal-nodejs/tools/gyp/pylib/gyp/generator/make.py#L1422-L1451
wxWidgets/wxPython-Classic
19571e1ae65f1ac445f5491474121998c97a1bf0
wx/lib/docview.py
python
DocTemplate.GetDocumentName
(self)
return self._docTypeName
Returns the document type name, as passed to the document template constructor.
Returns the document type name, as passed to the document template constructor.
[ "Returns", "the", "document", "type", "name", "as", "passed", "to", "the", "document", "template", "constructor", "." ]
def GetDocumentName(self): """ Returns the document type name, as passed to the document template constructor. """ return self._docTypeName
[ "def", "GetDocumentName", "(", "self", ")", ":", "return", "self", ".", "_docTypeName" ]
https://github.com/wxWidgets/wxPython-Classic/blob/19571e1ae65f1ac445f5491474121998c97a1bf0/wx/lib/docview.py#L1229-L1234
eventql/eventql
7ca0dbb2e683b525620ea30dc40540a22d5eb227
deps/3rdparty/spidermonkey/mozjs/python/bitstring/bitstring.py
python
Bits._assertsanity
(self)
return True
Check internal self consistency as a debugging aid.
Check internal self consistency as a debugging aid.
[ "Check", "internal", "self", "consistency", "as", "a", "debugging", "aid", "." ]
def _assertsanity(self): """Check internal self consistency as a debugging aid.""" assert self.len >= 0 assert 0 <= self._offset, "offset={0}".format(self._offset) assert (self.len + self._offset + 7) // 8 == self._datastore.bytelength + self._datastore.byteoffset return True
[ "def", "_assertsanity", "(", "self", ")", ":", "assert", "self", ".", "len", ">=", "0", "assert", "0", "<=", "self", ".", "_offset", ",", "\"offset={0}\"", ".", "format", "(", "self", ".", "_offset", ")", "assert", "(", "self", ".", "len", "+", "self...
https://github.com/eventql/eventql/blob/7ca0dbb2e683b525620ea30dc40540a22d5eb227/deps/3rdparty/spidermonkey/mozjs/python/bitstring/bitstring.py#L1195-L1200
qgis/QGIS
15a77662d4bb712184f6aa60d0bd663010a76a75
python/plugins/db_manager/dlg_table_properties.py
python
DlgTableProperties.addColumn
(self)
open dialog to set column info and add column to table
open dialog to set column info and add column to table
[ "open", "dialog", "to", "set", "column", "info", "and", "add", "column", "to", "table" ]
def addColumn(self): """ open dialog to set column info and add column to table """ dlg = DlgFieldProperties(self, None, self.table) if not dlg.exec_(): return fld = dlg.getField() with OverrideCursor(Qt.WaitCursor): self.aboutToChangeTable.emit() try: # add column to table self.table.addField(fld) self.refresh() except BaseError as e: DlgDbError.showError(e, self)
[ "def", "addColumn", "(", "self", ")", ":", "dlg", "=", "DlgFieldProperties", "(", "self", ",", "None", ",", "self", ".", "table", ")", "if", "not", "dlg", ".", "exec_", "(", ")", ":", "return", "fld", "=", "dlg", ".", "getField", "(", ")", "with", ...
https://github.com/qgis/QGIS/blob/15a77662d4bb712184f6aa60d0bd663010a76a75/python/plugins/db_manager/dlg_table_properties.py#L126-L140
NREL/EnergyPlus
fadc5973b85c70e8cc923efb69c144e808a26078
cmake/ReverseDDPostProcess.py
python
configure_root_dirs
(test_dir: str)
return os.path.join(test_dir, 'Regular'), os.path.join(test_dir, 'Reversed')
Set up the test directories based on prescribed names
Set up the test directories based on prescribed names
[ "Set", "up", "the", "test", "directories", "based", "on", "prescribed", "names" ]
def configure_root_dirs(test_dir: str) -> Tuple[str, str]: """Set up the test directories based on prescribed names""" return os.path.join(test_dir, 'Regular'), os.path.join(test_dir, 'Reversed')
[ "def", "configure_root_dirs", "(", "test_dir", ":", "str", ")", "->", "Tuple", "[", "str", ",", "str", "]", ":", "return", "os", ".", "path", ".", "join", "(", "test_dir", ",", "'Regular'", ")", ",", "os", ".", "path", ".", "join", "(", "test_dir", ...
https://github.com/NREL/EnergyPlus/blob/fadc5973b85c70e8cc923efb69c144e808a26078/cmake/ReverseDDPostProcess.py#L73-L75
psi4/psi4
be533f7f426b6ccc263904e55122899b16663395
psi4/driver/qcdb/basislist.py
python
BasisFamily.add_rifit
(self, fit)
Function to add basis *fit* as associated fitting basis member *rifit* to a BasisFamily object.
Function to add basis *fit* as associated fitting basis member *rifit* to a BasisFamily object.
[ "Function", "to", "add", "basis", "*", "fit", "*", "as", "associated", "fitting", "basis", "member", "*", "rifit", "*", "to", "a", "BasisFamily", "object", "." ]
def add_rifit(self, fit): """Function to add basis *fit* as associated fitting basis member *rifit* to a BasisFamily object. """ self.rifit = sanitize_basisname(fit)
[ "def", "add_rifit", "(", "self", ",", "fit", ")", ":", "self", ".", "rifit", "=", "sanitize_basisname", "(", "fit", ")" ]
https://github.com/psi4/psi4/blob/be533f7f426b6ccc263904e55122899b16663395/psi4/driver/qcdb/basislist.py#L105-L110
miyosuda/TensorFlowAndroidDemo
35903e0221aa5f109ea2dbef27f20b52e317f42d
jni-build/jni/include/tensorflow/python/training/summary_io.py
python
SummaryWriter.close
(self)
Flushes the event file to disk and close the file. Call this method when you do not need the summary writer anymore.
Flushes the event file to disk and close the file.
[ "Flushes", "the", "event", "file", "to", "disk", "and", "close", "the", "file", "." ]
def close(self): """Flushes the event file to disk and close the file. Call this method when you do not need the summary writer anymore. """ self.flush() self._ev_writer.Close() self._closed = True
[ "def", "close", "(", "self", ")", ":", "self", ".", "flush", "(", ")", "self", ".", "_ev_writer", ".", "Close", "(", ")", "self", ".", "_closed", "=", "True" ]
https://github.com/miyosuda/TensorFlowAndroidDemo/blob/35903e0221aa5f109ea2dbef27f20b52e317f42d/jni-build/jni/include/tensorflow/python/training/summary_io.py#L274-L281
baidu-research/tensorflow-allreduce
66d5b855e90b0949e9fa5cca5599fd729a70e874
tensorflow/contrib/layers/python/layers/feature_column.py
python
_get_feature_config
(feature_column)
Returns configuration for the base feature defined in feature_column.
Returns configuration for the base feature defined in feature_column.
[ "Returns", "configuration", "for", "the", "base", "feature", "defined", "in", "feature_column", "." ]
def _get_feature_config(feature_column): """Returns configuration for the base feature defined in feature_column.""" if not isinstance(feature_column, _FeatureColumn): raise TypeError( "feature_columns should only contain instances of _FeatureColumn. " "Given column is {}".format(feature_column)) if isinstance(feature_column, (_SparseColumn, _WeightedSparseColumn, _EmbeddingColumn, _RealValuedColumn, _RealValuedVarLenColumn, _BucketizedColumn, _CrossedColumn, _OneHotColumn, _ScatteredEmbeddingColumn)): return feature_column.config raise TypeError("Not supported _FeatureColumn type. " "Given column is {}".format(feature_column))
[ "def", "_get_feature_config", "(", "feature_column", ")", ":", "if", "not", "isinstance", "(", "feature_column", ",", "_FeatureColumn", ")", ":", "raise", "TypeError", "(", "\"feature_columns should only contain instances of _FeatureColumn. \"", "\"Given column is {}\"", ".",...
https://github.com/baidu-research/tensorflow-allreduce/blob/66d5b855e90b0949e9fa5cca5599fd729a70e874/tensorflow/contrib/layers/python/layers/feature_column.py#L2462-L2476
aws/lumberyard
f85344403c1c2e77ec8c75deb2c116e97b713217
dev/Gems/CloudGemFramework/v1/ResourceManager/resource_manager/stack.py
python
Monitor.wait
(self)
Waits for the operation to complete, displaying events as they occur.
Waits for the operation to complete, displaying events as they occur.
[ "Waits", "for", "the", "operation", "to", "complete", "displaying", "events", "as", "they", "occur", "." ]
def wait(self): """Waits for the operation to complete, displaying events as they occur.""" errors = [] failed_resources = set([]) done = False while not done: for monitored_stack_id in self.monitored_stacks: try: res = self.client.describe_stack_events(StackName=monitored_stack_id) stack_events = reversed(res['StackEvents']) except ClientError as e: if e.response['Error']['Code'] == 'Throttling': time.sleep(MONITOR_WAIT_SECONDS) stack_events = [] else: raise HandledError('Could not get events for {0} stack.'.format(self.stack_id), e) for event in stack_events: if event['EventId'] not in self.events_seen: resource_status = event.get('ResourceStatus', None) self.events_seen[event['EventId']] = True self.context.view.sack_event(event) if resource_status.endswith('_FAILED'): errors.append( '{status} for {logical} ({type} with id "{physical}") - {reason}'.format( status=event.get('ResourceStatus', ''), type=event.get('ResourceType', 'unknown type'), logical=event.get('LogicalResourceId', 'unknown resource'), reason=event.get('ResourceStatusReason', 'No reason reported.'), physical=event.get('PhysicalResourceId', '{unknown}') ) ) if event['StackId'] == self.stack_id: if resource_status in self.finished_status and event['PhysicalResourceId'] == self.stack_id: if errors: self.context.view.stack_event_errors(errors, resource_status == self.success_status) if resource_status == self.success_status: done = True else: if len(failed_resources) > 0: return failed_resources raise HandledError("The operation failed.") if event['ResourceType'] == 'AWS::CloudFormation::Stack': if resource_status in self.start_nested_stack_status and resource_status not in self.monitored_stacks: if event['PhysicalResourceId'] is not None and event['PhysicalResourceId'] != '': self.monitored_stacks.append(event['PhysicalResourceId']) if resource_status in self.end_nested_stack_status and resource_status in self.monitored_stacks: self.monitored_stacks.remove(event['PhysicalResourceId']) else: # return resources ids for resources that failed to delete logical_resource_id = event.get('LogicalResourceId', None) if logical_resource_id is not None: if resource_status != self.context.stack.STATUS_DELETE_COMPLETE: failed_resources.add(logical_resource_id) elif logical_resource_id in failed_resources: failed_resources.remove(logical_resource_id) if not done: time.sleep(MONITOR_WAIT_SECONDS) # seconds else: return []
[ "def", "wait", "(", "self", ")", ":", "errors", "=", "[", "]", "failed_resources", "=", "set", "(", "[", "]", ")", "done", "=", "False", "while", "not", "done", ":", "for", "monitored_stack_id", "in", "self", ".", "monitored_stacks", ":", "try", ":", ...
https://github.com/aws/lumberyard/blob/f85344403c1c2e77ec8c75deb2c116e97b713217/dev/Gems/CloudGemFramework/v1/ResourceManager/resource_manager/stack.py#L1130-L1201
CRYTEK/CRYENGINE
232227c59a220cbbd311576f0fbeba7bb53b2a8c
Editor/Python/windows/Lib/site-packages/pip/_vendor/requests/packages/urllib3/util/url.py
python
get_host
(url)
return p.scheme or 'http', p.hostname, p.port
Deprecated. Use :func:`.parse_url` instead.
Deprecated. Use :func:`.parse_url` instead.
[ "Deprecated", ".", "Use", ":", "func", ":", ".", "parse_url", "instead", "." ]
def get_host(url): """ Deprecated. Use :func:`.parse_url` instead. """ p = parse_url(url) return p.scheme or 'http', p.hostname, p.port
[ "def", "get_host", "(", "url", ")", ":", "p", "=", "parse_url", "(", "url", ")", "return", "p", ".", "scheme", "or", "'http'", ",", "p", ".", "hostname", ",", "p", ".", "port" ]
https://github.com/CRYTEK/CRYENGINE/blob/232227c59a220cbbd311576f0fbeba7bb53b2a8c/Editor/Python/windows/Lib/site-packages/pip/_vendor/requests/packages/urllib3/util/url.py#L209-L214
Polidea/SiriusObfuscator
b0e590d8130e97856afe578869b83a209e2b19be
SymbolExtractorAndRenamer/lldb/scripts/Python/static-binding/lldb.py
python
SBBreakpoint.GetIgnoreCount
(self)
return _lldb.SBBreakpoint_GetIgnoreCount(self)
GetIgnoreCount(self) -> uint32_t
GetIgnoreCount(self) -> uint32_t
[ "GetIgnoreCount", "(", "self", ")", "-", ">", "uint32_t" ]
def GetIgnoreCount(self): """GetIgnoreCount(self) -> uint32_t""" return _lldb.SBBreakpoint_GetIgnoreCount(self)
[ "def", "GetIgnoreCount", "(", "self", ")", ":", "return", "_lldb", ".", "SBBreakpoint_GetIgnoreCount", "(", "self", ")" ]
https://github.com/Polidea/SiriusObfuscator/blob/b0e590d8130e97856afe578869b83a209e2b19be/SymbolExtractorAndRenamer/lldb/scripts/Python/static-binding/lldb.py#L1502-L1504
hanpfei/chromium-net
392cc1fa3a8f92f42e4071ab6e674d8e0482f83f
third_party/catapult/telemetry/telemetry/internal/image_processing/frame_generator.py
python
FrameGenerator.__init__
(self)
Initializes the FrameGenerator object.
Initializes the FrameGenerator object.
[ "Initializes", "the", "FrameGenerator", "object", "." ]
def __init__(self): """ Initializes the FrameGenerator object. """ self._generator = self._CreateGenerator()
[ "def", "__init__", "(", "self", ")", ":", "self", ".", "_generator", "=", "self", ".", "_CreateGenerator", "(", ")" ]
https://github.com/hanpfei/chromium-net/blob/392cc1fa3a8f92f42e4071ab6e674d8e0482f83f/third_party/catapult/telemetry/telemetry/internal/image_processing/frame_generator.py#L20-L22
natanielruiz/android-yolo
1ebb54f96a67a20ff83ddfc823ed83a13dc3a47f
jni-build/jni/include/tensorflow/contrib/factorization/python/ops/clustering_ops.py
python
KMeans._mini_batch_training_op
(self, inputs, cluster_idx_list, cluster_centers, cluster_centers_var, total_counts)
return tf.group(*update_ops)
Creates an op for training for mini batch case. Args: inputs: list of input Tensors. cluster_idx_list: A vector (or list of vectors). Each element in the vector corresponds to an input row in 'inp' and specifies the cluster id corresponding to the input. cluster_centers: Tensor of cluster centers, possibly normalized. cluster_centers_var: Tensor Ref of cluster centers. total_counts: Tensor Ref of cluster counts. Returns: An op for doing an update of mini-batch k-means.
Creates an op for training for mini batch case.
[ "Creates", "an", "op", "for", "training", "for", "mini", "batch", "case", "." ]
def _mini_batch_training_op(self, inputs, cluster_idx_list, cluster_centers, cluster_centers_var, total_counts): """Creates an op for training for mini batch case. Args: inputs: list of input Tensors. cluster_idx_list: A vector (or list of vectors). Each element in the vector corresponds to an input row in 'inp' and specifies the cluster id corresponding to the input. cluster_centers: Tensor of cluster centers, possibly normalized. cluster_centers_var: Tensor Ref of cluster centers. total_counts: Tensor Ref of cluster counts. Returns: An op for doing an update of mini-batch k-means. """ update_ops = [] for inp, cluster_idx in zip(inputs, cluster_idx_list): with ops.colocate_with(inp): assert total_counts is not None cluster_idx = tf.reshape(cluster_idx, [-1]) # Dedupe the unique ids of cluster_centers being updated so that updates # can be locally aggregated. unique_ids, unique_idx = tf.unique(cluster_idx) num_unique_cluster_idx = tf.size(unique_ids) # Fetch the old values of counts and cluster_centers. with ops.colocate_with(total_counts): old_counts = tf.gather(total_counts, unique_ids) with ops.colocate_with(cluster_centers): old_cluster_centers = tf.gather(cluster_centers, unique_ids) # Locally aggregate the increment to counts. count_updates = tf.unsorted_segment_sum( tf.ones_like(unique_idx, dtype=total_counts.dtype), unique_idx, num_unique_cluster_idx) # Locally compute the sum of inputs mapped to each id. # For a cluster with old cluster value x, old count n, and with data # d_1,...d_k newly assigned to it, we recompute the new value as # x += (sum_i(d_i) - k * x) / (n + k). # Compute sum_i(d_i), see comment above. cluster_center_updates = tf.unsorted_segment_sum( inp, unique_idx, num_unique_cluster_idx) # Shape to enable broadcasting count_updates and learning_rate to inp. # It extends the shape with 1's to match the rank of inp. broadcast_shape = tf.concat( 0, [tf.reshape(num_unique_cluster_idx, [1]), tf.ones(tf.reshape(tf.rank(inp) - 1, [1]), dtype=tf.int32)]) # Subtract k * x, see comment above. cluster_center_updates -= tf.cast( tf.reshape(count_updates, broadcast_shape), inp.dtype) * old_cluster_centers learning_rate = tf.inv(tf.cast(old_counts + count_updates, inp.dtype)) learning_rate = tf.reshape(learning_rate, broadcast_shape) # scale by 1 / (n + k), see comment above. cluster_center_updates *= learning_rate # Apply the updates. update_counts = tf.scatter_add( total_counts, unique_ids, count_updates) update_cluster_centers = tf.scatter_add( cluster_centers_var, unique_ids, cluster_center_updates) update_ops.extend([update_counts, update_cluster_centers]) return tf.group(*update_ops)
[ "def", "_mini_batch_training_op", "(", "self", ",", "inputs", ",", "cluster_idx_list", ",", "cluster_centers", ",", "cluster_centers_var", ",", "total_counts", ")", ":", "update_ops", "=", "[", "]", "for", "inp", ",", "cluster_idx", "in", "zip", "(", "inputs", ...
https://github.com/natanielruiz/android-yolo/blob/1ebb54f96a67a20ff83ddfc823ed83a13dc3a47f/jni-build/jni/include/tensorflow/contrib/factorization/python/ops/clustering_ops.py#L307-L376
baidu-research/tensorflow-allreduce
66d5b855e90b0949e9fa5cca5599fd729a70e874
tensorflow/python/framework/ops.py
python
Graph.finalized
(self)
return self._finalized
True if this graph has been finalized.
True if this graph has been finalized.
[ "True", "if", "this", "graph", "has", "been", "finalized", "." ]
def finalized(self): """True if this graph has been finalized.""" return self._finalized
[ "def", "finalized", "(", "self", ")", ":", "return", "self", ".", "_finalized" ]
https://github.com/baidu-research/tensorflow-allreduce/blob/66d5b855e90b0949e9fa5cca5599fd729a70e874/tensorflow/python/framework/ops.py#L2364-L2366
hpi-xnor/BMXNet-v2
af2b1859eafc5c721b1397cef02f946aaf2ce20d
python/mxnet/contrib/tensorrt.py
python
set_use_fp16
(status)
Set an environment variable which will enable or disable the use of FP16 precision in TensorRT Note: The mode FP16 force the whole TRT node to be executed in FP16 :param status: Boolean, True if TensorRT should run in FP16, False for FP32
Set an environment variable which will enable or disable the use of FP16 precision in TensorRT Note: The mode FP16 force the whole TRT node to be executed in FP16 :param status: Boolean, True if TensorRT should run in FP16, False for FP32
[ "Set", "an", "environment", "variable", "which", "will", "enable", "or", "disable", "the", "use", "of", "FP16", "precision", "in", "TensorRT", "Note", ":", "The", "mode", "FP16", "force", "the", "whole", "TRT", "node", "to", "be", "executed", "in", "FP16",...
def set_use_fp16(status): """ Set an environment variable which will enable or disable the use of FP16 precision in TensorRT Note: The mode FP16 force the whole TRT node to be executed in FP16 :param status: Boolean, True if TensorRT should run in FP16, False for FP32 """ os.environ["MXNET_TENSORRT_USE_FP16"] = str(int(status))
[ "def", "set_use_fp16", "(", "status", ")", ":", "os", ".", "environ", "[", "\"MXNET_TENSORRT_USE_FP16\"", "]", "=", "str", "(", "int", "(", "status", ")", ")" ]
https://github.com/hpi-xnor/BMXNet-v2/blob/af2b1859eafc5c721b1397cef02f946aaf2ce20d/python/mxnet/contrib/tensorrt.py#L21-L28
simon-anders/htseq
5ba0507ea237e2e067ea79fb28febbc56a37f0d4
python3/HTSeq/StepVector.py
python
StepVector.__setitem__
( self, index, value )
To set element i of StepVector sv to the value v, write sv[i] = v If you want to set a whole step, say, all values from i to j (not including j), write sv[i:j] = v Note that the StepVector class will only notice that all the values from i to j are equal if you assign them in this fashion. Assigning each item individually in a loop from i to j will result in the value v being stored many times.
To set element i of StepVector sv to the value v, write sv[i] = v If you want to set a whole step, say, all values from i to j (not including j), write sv[i:j] = v Note that the StepVector class will only notice that all the values from i to j are equal if you assign them in this fashion. Assigning each item individually in a loop from i to j will result in the value v being stored many times.
[ "To", "set", "element", "i", "of", "StepVector", "sv", "to", "the", "value", "v", "write", "sv", "[", "i", "]", "=", "v", "If", "you", "want", "to", "set", "a", "whole", "step", "say", "all", "values", "from", "i", "to", "j", "(", "not", "includi...
def __setitem__( self, index, value ): """To set element i of StepVector sv to the value v, write sv[i] = v If you want to set a whole step, say, all values from i to j (not including j), write sv[i:j] = v Note that the StepVector class will only notice that all the values from i to j are equal if you assign them in this fashion. Assigning each item individually in a loop from i to j will result in the value v being stored many times. """ if isinstance( value, StepVector ): if self._swigobj is value._swigobj and \ value.start == index.start and value.stop == index.stop: return else: raise NotImplemented("Stepvector-to-Stepvector assignment still missing") if isinstance( index, slice ): if index.step is not None and index.step != 1: raise ValueError("Striding slices (i.e., step != 1) are not supported") if index.start is None: start = self.start else: if index.start < self.start: raise IndexError("start too small") start = index.start if index.stop is None: stop = self.stop else: if index.stop > self.stop: raise IndexError("stop too large") stop = index.stop self._swigobj.set_value( start, stop-1, value ) # Note the "-1": The C++ object uses closed intervals, but we follow # Python convention here and use half-open ones. else: self._swigobj.set_value( index, index, value )
[ "def", "__setitem__", "(", "self", ",", "index", ",", "value", ")", ":", "if", "isinstance", "(", "value", ",", "StepVector", ")", ":", "if", "self", ".", "_swigobj", "is", "value", ".", "_swigobj", "and", "value", ".", "start", "==", "index", ".", "...
https://github.com/simon-anders/htseq/blob/5ba0507ea237e2e067ea79fb28febbc56a37f0d4/python3/HTSeq/StepVector.py#L497-L533
aws/lumberyard
f85344403c1c2e77ec8c75deb2c116e97b713217
dev/Gems/CloudGemMetric/v1/AWS/python/windows/Lib/numba/cuda/cudadrv/driver.py
python
load_module_image
(context, image)
return Module(weakref.proxy(context), handle, info_log, _module_finalizer(context, handle))
image must be a pointer
image must be a pointer
[ "image", "must", "be", "a", "pointer" ]
def load_module_image(context, image): """ image must be a pointer """ logsz = int(get_numba_envvar('CUDA_LOG_SIZE', 1024)) jitinfo = (c_char * logsz)() jiterrors = (c_char * logsz)() options = { enums.CU_JIT_INFO_LOG_BUFFER: addressof(jitinfo), enums.CU_JIT_INFO_LOG_BUFFER_SIZE_BYTES: c_void_p(logsz), enums.CU_JIT_ERROR_LOG_BUFFER: addressof(jiterrors), enums.CU_JIT_ERROR_LOG_BUFFER_SIZE_BYTES: c_void_p(logsz), enums.CU_JIT_LOG_VERBOSE: c_void_p(VERBOSE_JIT_LOG), } option_keys = (drvapi.cu_jit_option * len(options))(*options.keys()) option_vals = (c_void_p * len(options))(*options.values()) handle = drvapi.cu_module() try: driver.cuModuleLoadDataEx(byref(handle), image, len(options), option_keys, option_vals) except CudaAPIError as e: msg = "cuModuleLoadDataEx error:\n%s" % jiterrors.value.decode("utf8") raise CudaAPIError(e.code, msg) info_log = jitinfo.value return Module(weakref.proxy(context), handle, info_log, _module_finalizer(context, handle))
[ "def", "load_module_image", "(", "context", ",", "image", ")", ":", "logsz", "=", "int", "(", "get_numba_envvar", "(", "'CUDA_LOG_SIZE'", ",", "1024", ")", ")", "jitinfo", "=", "(", "c_char", "*", "logsz", ")", "(", ")", "jiterrors", "=", "(", "c_char", ...
https://github.com/aws/lumberyard/blob/f85344403c1c2e77ec8c75deb2c116e97b713217/dev/Gems/CloudGemMetric/v1/AWS/python/windows/Lib/numba/cuda/cudadrv/driver.py#L926-L957
cvxpy/cvxpy
5165b4fb750dfd237de8659383ef24b4b2e33aaf
cvxpy/atoms/log_det.py
python
log_det.is_atom_concave
(self)
return True
Is the atom concave?
Is the atom concave?
[ "Is", "the", "atom", "concave?" ]
def is_atom_concave(self) -> bool: """Is the atom concave? """ return True
[ "def", "is_atom_concave", "(", "self", ")", "->", "bool", ":", "return", "True" ]
https://github.com/cvxpy/cvxpy/blob/5165b4fb750dfd237de8659383ef24b4b2e33aaf/cvxpy/atoms/log_det.py#L71-L74
weolar/miniblink49
1c4678db0594a4abde23d3ebbcc7cd13c3170777
third_party/WebKit/Tools/Scripts/webkitpy/thirdparty/coverage/results.py
python
Analysis.total_branches
(self)
return sum([count for count in exit_counts.values() if count > 1])
How many total branches are there?
How many total branches are there?
[ "How", "many", "total", "branches", "are", "there?" ]
def total_branches(self): """How many total branches are there?""" exit_counts = self.parser.exit_counts() return sum([count for count in exit_counts.values() if count > 1])
[ "def", "total_branches", "(", "self", ")", ":", "exit_counts", "=", "self", ".", "parser", ".", "exit_counts", "(", ")", "return", "sum", "(", "[", "count", "for", "count", "in", "exit_counts", ".", "values", "(", ")", "if", "count", ">", "1", "]", "...
https://github.com/weolar/miniblink49/blob/1c4678db0594a4abde23d3ebbcc7cd13c3170777/third_party/WebKit/Tools/Scripts/webkitpy/thirdparty/coverage/results.py#L114-L117
wxWidgets/wxPython-Classic
19571e1ae65f1ac445f5491474121998c97a1bf0
wx/lib/agw/knobctrl.py
python
KnobCtrl.Draw
(self, dc)
Draws everything on the empty bitmap. Here all the chosen styles are applied. :param `dc`: an instance of :class:`DC`.
Draws everything on the empty bitmap. Here all the chosen styles are applied.
[ "Draws", "everything", "on", "the", "empty", "bitmap", ".", "Here", "all", "the", "chosen", "styles", "are", "applied", "." ]
def Draw(self, dc): """ Draws everything on the empty bitmap. Here all the chosen styles are applied. :param `dc`: an instance of :class:`DC`. """ size = self.GetClientSize() if size.x < 21 or size.y < 21: return dc.SetClippingRegionAsRegion(self._region) self.DrawDiagonalGradient(dc, size) self.DrawInsetCircle(dc, self._knobcolour) dc.DestroyClippingRegion() self.DrawBoundingCircle(dc, size) if self._tags: self.DrawTags(dc, size)
[ "def", "Draw", "(", "self", ",", "dc", ")", ":", "size", "=", "self", ".", "GetClientSize", "(", ")", "if", "size", ".", "x", "<", "21", "or", "size", ".", "y", "<", "21", ":", "return", "dc", ".", "SetClippingRegionAsRegion", "(", "self", ".", "...
https://github.com/wxWidgets/wxPython-Classic/blob/19571e1ae65f1ac445f5491474121998c97a1bf0/wx/lib/agw/knobctrl.py#L576-L596
may0324/DeepCompression-caffe
0aff6c1287bda4cfc7f378ed8a16524e1afabd8c
scripts/download_model_binary.py
python
reporthook
(count, block_size, total_size)
From http://blog.moleculea.com/2012/10/04/urlretrieve-progres-indicator/
From http://blog.moleculea.com/2012/10/04/urlretrieve-progres-indicator/
[ "From", "http", ":", "//", "blog", ".", "moleculea", ".", "com", "/", "2012", "/", "10", "/", "04", "/", "urlretrieve", "-", "progres", "-", "indicator", "/" ]
def reporthook(count, block_size, total_size): """ From http://blog.moleculea.com/2012/10/04/urlretrieve-progres-indicator/ """ global start_time if count == 0: start_time = time.time() return duration = (time.time() - start_time) or 0.01 progress_size = int(count * block_size) speed = int(progress_size / (1024 * duration)) percent = int(count * block_size * 100 / total_size) sys.stdout.write("\r...%d%%, %d MB, %d KB/s, %d seconds passed" % (percent, progress_size / (1024 * 1024), speed, duration)) sys.stdout.flush()
[ "def", "reporthook", "(", "count", ",", "block_size", ",", "total_size", ")", ":", "global", "start_time", "if", "count", "==", "0", ":", "start_time", "=", "time", ".", "time", "(", ")", "return", "duration", "=", "(", "time", ".", "time", "(", ")", ...
https://github.com/may0324/DeepCompression-caffe/blob/0aff6c1287bda4cfc7f378ed8a16524e1afabd8c/scripts/download_model_binary.py#L13-L27
baidu-research/tensorflow-allreduce
66d5b855e90b0949e9fa5cca5599fd729a70e874
tensorflow/contrib/bayesflow/python/ops/stochastic_variables.py
python
make_stochastic_variable_getter
(dist_cls, dist_kwargs=None, param_initializers=None, prior=None)
return functools.partial( get_stochastic_variable, dist_cls=dist_cls, dist_kwargs=dist_kwargs, param_initializers=param_initializers, prior=prior)
`get_stochastic_variable` with args partially applied.
`get_stochastic_variable` with args partially applied.
[ "get_stochastic_variable", "with", "args", "partially", "applied", "." ]
def make_stochastic_variable_getter(dist_cls, dist_kwargs=None, param_initializers=None, prior=None): """`get_stochastic_variable` with args partially applied.""" return functools.partial( get_stochastic_variable, dist_cls=dist_cls, dist_kwargs=dist_kwargs, param_initializers=param_initializers, prior=prior)
[ "def", "make_stochastic_variable_getter", "(", "dist_cls", ",", "dist_kwargs", "=", "None", ",", "param_initializers", "=", "None", ",", "prior", "=", "None", ")", ":", "return", "functools", ".", "partial", "(", "get_stochastic_variable", ",", "dist_cls", "=", ...
https://github.com/baidu-research/tensorflow-allreduce/blob/66d5b855e90b0949e9fa5cca5599fd729a70e874/tensorflow/contrib/bayesflow/python/ops/stochastic_variables.py#L141-L151
NVlabs/fermat
06e8c03ac59ab440cbb13897f90631ef1861e769
contrib/assimp-4.1.0/port/PyAssimp/pyassimp/core.py
python
_init
(self, target = None, parent = None)
return self
Custom initialize() for C structs, adds safely accessible member functionality. :param target: set the object which receive the added methods. Useful when manipulating pointers, to skip the intermediate 'contents' deferencing.
Custom initialize() for C structs, adds safely accessible member functionality.
[ "Custom", "initialize", "()", "for", "C", "structs", "adds", "safely", "accessible", "member", "functionality", "." ]
def _init(self, target = None, parent = None): """ Custom initialize() for C structs, adds safely accessible member functionality. :param target: set the object which receive the added methods. Useful when manipulating pointers, to skip the intermediate 'contents' deferencing. """ if not target: target = self dirself = dir(self) for m in dirself: if m.startswith("_"): continue if m.startswith('mNum'): if 'm' + m[4:] in dirself: continue # will be processed later on else: name = m[1:].lower() obj = getattr(self, m) setattr(target, name, obj) continue if m == 'mName': obj = self.mName try: uni = unicode(obj.data, errors='ignore') except: uni = str(obj.data, errors='ignore') target.name = str( uni ) target.__class__.__repr__ = lambda x: str(x.__class__) + "(" + x.name + ")" target.__class__.__str__ = lambda x: x.name continue name = m[1:].lower() obj = getattr(self, m) # Create tuples if isinstance(obj, structs.assimp_structs_as_tuple): setattr(target, name, make_tuple(obj)) logger.debug(str(self) + ": Added array " + str(getattr(target, name)) + " as self." + name.lower()) continue if m.startswith('m'): if name == "parent": setattr(target, name, parent) logger.debug("Added a parent as self." + name) continue if helper.hasattr_silent(self, 'mNum' + m[1:]): length = getattr(self, 'mNum' + m[1:]) # -> special case: properties are # stored as a dict. if m == 'mProperties': setattr(target, name, _get_properties(obj, length)) continue if not length: # empty! setattr(target, name, []) logger.debug(str(self) + ": " + name + " is an empty list.") continue try: if obj._type_ in structs.assimp_structs_as_tuple: if numpy: setattr(target, name, numpy.array([make_tuple(obj[i]) for i in range(length)], dtype=numpy.float32)) logger.debug(str(self) + ": Added an array of numpy arrays (type "+ str(type(obj)) + ") as self." + name) else: setattr(target, name, [make_tuple(obj[i]) for i in range(length)]) logger.debug(str(self) + ": Added a list of lists (type "+ str(type(obj)) + ") as self." + name) else: setattr(target, name, [obj[i] for i in range(length)]) #TODO: maybe not necessary to recreate an array? logger.debug(str(self) + ": Added list of " + str(obj) + " " + name + " as self." + name + " (type: " + str(type(obj)) + ")") # initialize array elements try: init = assimp_struct_inits[type(obj[0])] except KeyError: if _is_init_type(obj[0]): for e in getattr(target, name): call_init(e, target) else: for e in getattr(target, name): init(e) except IndexError: logger.error("in " + str(self) +" : mismatch between mNum" + name + " and the actual amount of data in m" + name + ". This may be due to version mismatch between libassimp and pyassimp. Quitting now.") sys.exit(1) except ValueError as e: logger.error("In " + str(self) + "->" + name + ": " + str(e) + ". Quitting now.") if "setting an array element with a sequence" in str(e): logger.error("Note that pyassimp does not currently " "support meshes with mixed triangles " "and quads. Try to load your mesh with" " a post-processing to triangulate your" " faces.") raise e else: # starts with 'm' but not iterable setattr(target, name, obj) logger.debug("Added " + name + " as self." + name + " (type: " + str(type(obj)) + ")") if _is_init_type(obj): call_init(obj, target) if isinstance(self, structs.Mesh): _finalize_mesh(self, target) if isinstance(self, structs.Texture): _finalize_texture(self, target) return self
[ "def", "_init", "(", "self", ",", "target", "=", "None", ",", "parent", "=", "None", ")", ":", "if", "not", "target", ":", "target", "=", "self", "dirself", "=", "dir", "(", "self", ")", "for", "m", "in", "dirself", ":", "if", "m", ".", "startswi...
https://github.com/NVlabs/fermat/blob/06e8c03ac59ab440cbb13897f90631ef1861e769/contrib/assimp-4.1.0/port/PyAssimp/pyassimp/core.py#L94-L224
wxWidgets/wxPython-Classic
19571e1ae65f1ac445f5491474121998c97a1bf0
src/msw/_misc.py
python
DateSpan.__mul__
(*args, **kwargs)
return _misc_.DateSpan___mul__(*args, **kwargs)
__mul__(self, int n) -> DateSpan
__mul__(self, int n) -> DateSpan
[ "__mul__", "(", "self", "int", "n", ")", "-", ">", "DateSpan" ]
def __mul__(*args, **kwargs): """__mul__(self, int n) -> DateSpan""" return _misc_.DateSpan___mul__(*args, **kwargs)
[ "def", "__mul__", "(", "*", "args", ",", "*", "*", "kwargs", ")", ":", "return", "_misc_", ".", "DateSpan___mul__", "(", "*", "args", ",", "*", "*", "kwargs", ")" ]
https://github.com/wxWidgets/wxPython-Classic/blob/19571e1ae65f1ac445f5491474121998c97a1bf0/src/msw/_misc.py#L4729-L4731
aws/lumberyard
f85344403c1c2e77ec8c75deb2c116e97b713217
dev/Tools/Python/3.7.10/linux_x64/lib/python3.7/importlib/_bootstrap_external.py
python
SourceLoader.path_stats
(self, path)
return {'mtime': self.path_mtime(path)}
Optional method returning a metadata dict for the specified path to by the path (str). Possible keys: - 'mtime' (mandatory) is the numeric timestamp of last source code modification; - 'size' (optional) is the size in bytes of the source code. Implementing this method allows the loader to read bytecode files. Raises OSError when the path cannot be handled.
Optional method returning a metadata dict for the specified path to by the path (str). Possible keys: - 'mtime' (mandatory) is the numeric timestamp of last source code modification; - 'size' (optional) is the size in bytes of the source code.
[ "Optional", "method", "returning", "a", "metadata", "dict", "for", "the", "specified", "path", "to", "by", "the", "path", "(", "str", ")", ".", "Possible", "keys", ":", "-", "mtime", "(", "mandatory", ")", "is", "the", "numeric", "timestamp", "of", "last...
def path_stats(self, path): """Optional method returning a metadata dict for the specified path to by the path (str). Possible keys: - 'mtime' (mandatory) is the numeric timestamp of last source code modification; - 'size' (optional) is the size in bytes of the source code. Implementing this method allows the loader to read bytecode files. Raises OSError when the path cannot be handled. """ return {'mtime': self.path_mtime(path)}
[ "def", "path_stats", "(", "self", ",", "path", ")", ":", "return", "{", "'mtime'", ":", "self", ".", "path_mtime", "(", "path", ")", "}" ]
https://github.com/aws/lumberyard/blob/f85344403c1c2e77ec8c75deb2c116e97b713217/dev/Tools/Python/3.7.10/linux_x64/lib/python3.7/importlib/_bootstrap_external.py#L745-L756
catboost/catboost
167f64f237114a4d10b2b4ee42adb4569137debe
contrib/python/ipython/py3/IPython/utils/text.py
python
SList.sort
(self,field= None, nums = False)
return SList([t[1] for t in dsu])
sort by specified fields (see fields()) Example:: a.sort(1, nums = True) Sorts a by second field, in numerical order (so that 21 > 3)
sort by specified fields (see fields())
[ "sort", "by", "specified", "fields", "(", "see", "fields", "()", ")" ]
def sort(self,field= None, nums = False): """ sort by specified fields (see fields()) Example:: a.sort(1, nums = True) Sorts a by second field, in numerical order (so that 21 > 3) """ #decorate, sort, undecorate if field is not None: dsu = [[SList([line]).fields(field), line] for line in self] else: dsu = [[line, line] for line in self] if nums: for i in range(len(dsu)): numstr = "".join([ch for ch in dsu[i][0] if ch.isdigit()]) try: n = int(numstr) except ValueError: n = 0 dsu[i][0] = n dsu.sort() return SList([t[1] for t in dsu])
[ "def", "sort", "(", "self", ",", "field", "=", "None", ",", "nums", "=", "False", ")", ":", "#decorate, sort, undecorate", "if", "field", "is", "not", "None", ":", "dsu", "=", "[", "[", "SList", "(", "[", "line", "]", ")", ".", "fields", "(", "fiel...
https://github.com/catboost/catboost/blob/167f64f237114a4d10b2b4ee42adb4569137debe/contrib/python/ipython/py3/IPython/utils/text.py#L204-L231
ricardoquesada/Spidermonkey
4a75ea2543408bd1b2c515aa95901523eeef7858
media/webrtc/trunk/tools/gyp/pylib/gyp/mac_tool.py
python
MacTool._CommandifyName
(self, name_string)
return name_string.title().replace('-', '')
Transforms a tool name like copy-info-plist to CopyInfoPlist
Transforms a tool name like copy-info-plist to CopyInfoPlist
[ "Transforms", "a", "tool", "name", "like", "copy", "-", "info", "-", "plist", "to", "CopyInfoPlist" ]
def _CommandifyName(self, name_string): """Transforms a tool name like copy-info-plist to CopyInfoPlist""" return name_string.title().replace('-', '')
[ "def", "_CommandifyName", "(", "self", ",", "name_string", ")", ":", "return", "name_string", ".", "title", "(", ")", ".", "replace", "(", "'-'", ",", "''", ")" ]
https://github.com/ricardoquesada/Spidermonkey/blob/4a75ea2543408bd1b2c515aa95901523eeef7858/media/webrtc/trunk/tools/gyp/pylib/gyp/mac_tool.py#L40-L42
okex/V3-Open-API-SDK
c5abb0db7e2287718e0055e17e57672ce0ec7fd9
okex-python-sdk-api/venv/Lib/site-packages/pip-19.0.3-py3.8.egg/pip/_vendor/pkg_resources/__init__.py
python
WorkingSet.run_script
(self, requires, script_name)
Locate distribution for `requires` and run `script_name` script
Locate distribution for `requires` and run `script_name` script
[ "Locate", "distribution", "for", "requires", "and", "run", "script_name", "script" ]
def run_script(self, requires, script_name): """Locate distribution for `requires` and run `script_name` script""" ns = sys._getframe(1).f_globals name = ns['__name__'] ns.clear() ns['__name__'] = name self.require(requires)[0].run_script(script_name, ns)
[ "def", "run_script", "(", "self", ",", "requires", ",", "script_name", ")", ":", "ns", "=", "sys", ".", "_getframe", "(", "1", ")", ".", "f_globals", "name", "=", "ns", "[", "'__name__'", "]", "ns", ".", "clear", "(", ")", "ns", "[", "'__name__'", ...
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/_vendor/pkg_resources/__init__.py#L658-L664
wlanjie/AndroidFFmpeg
7baf9122f4b8e1c74e7baf4be5c422c7a5ba5aaf
tools/fdk-aac-build/armeabi/toolchain/lib/python2.7/idlelib/macosxSupport.py
python
addOpenEventSupport
(root, flist)
This ensures that the application will respond to open AppleEvents, which makes is feasible to use IDLE as the default application for python files.
This ensures that the application will respond to open AppleEvents, which makes is feasible to use IDLE as the default application for python files.
[ "This", "ensures", "that", "the", "application", "will", "respond", "to", "open", "AppleEvents", "which", "makes", "is", "feasible", "to", "use", "IDLE", "as", "the", "default", "application", "for", "python", "files", "." ]
def addOpenEventSupport(root, flist): """ This ensures that the application will respond to open AppleEvents, which makes is feasible to use IDLE as the default application for python files. """ def doOpenFile(*args): for fn in args: flist.open(fn) # The command below is a hook in aquatk that is called whenever the app # receives a file open event. The callback can have multiple arguments, # one for every file that should be opened. root.createcommand("::tk::mac::OpenDocument", doOpenFile)
[ "def", "addOpenEventSupport", "(", "root", ",", "flist", ")", ":", "def", "doOpenFile", "(", "*", "args", ")", ":", "for", "fn", "in", "args", ":", "flist", ".", "open", "(", "fn", ")", "# The command below is a hook in aquatk that is called whenever the app", "...
https://github.com/wlanjie/AndroidFFmpeg/blob/7baf9122f4b8e1c74e7baf4be5c422c7a5ba5aaf/tools/fdk-aac-build/armeabi/toolchain/lib/python2.7/idlelib/macosxSupport.py#L58-L70
aws/lumberyard
f85344403c1c2e77ec8c75deb2c116e97b713217
dev/Tools/build/waf-1.7.13/waflib/Tools/msvc.py
python
gather_icl_versions
(conf, versions)
Checks ICL compilers :param versions: list to modify :type versions: list
Checks ICL compilers
[ "Checks", "ICL", "compilers" ]
def gather_icl_versions(conf, versions): """ Checks ICL compilers :param versions: list to modify :type versions: list """ version_pattern = re.compile('^...?.?\....?.?') try: all_versions = Utils.winreg.OpenKey(Utils.winreg.HKEY_LOCAL_MACHINE, 'SOFTWARE\\Wow6432node\\Intel\\Compilers\\C++') except WindowsError: try: all_versions = Utils.winreg.OpenKey(Utils.winreg.HKEY_LOCAL_MACHINE, 'SOFTWARE\\Intel\\Compilers\\C++') except WindowsError: return index = 0 while 1: try: version = Utils.winreg.EnumKey(all_versions, index) except WindowsError: break index = index + 1 if not version_pattern.match(version): continue targets = [] for target,arch in all_icl_platforms: try: if target=='intel64': targetDir='EM64T_NATIVE' else: targetDir=target Utils.winreg.OpenKey(all_versions,version+'\\'+targetDir) icl_version=Utils.winreg.OpenKey(all_versions,version) path,type=Utils.winreg.QueryValueEx(icl_version,'ProductDir') batch_file=os.path.join(path,'bin','iclvars.bat') if os.path.isfile(batch_file): try: targets.append((target,(arch,conf.get_msvc_version('intel',version,target,batch_file)))) except conf.errors.ConfigurationError: pass except WindowsError: pass for target,arch in all_icl_platforms: try: icl_version = Utils.winreg.OpenKey(all_versions, version+'\\'+target) path,type = Utils.winreg.QueryValueEx(icl_version,'ProductDir') batch_file=os.path.join(path,'bin','iclvars.bat') if os.path.isfile(batch_file): try: targets.append((target, (arch, conf.get_msvc_version('intel', version, target, batch_file)))) except conf.errors.ConfigurationError: pass except WindowsError: continue major = version[0:2] versions.append(('intel ' + major, targets))
[ "def", "gather_icl_versions", "(", "conf", ",", "versions", ")", ":", "version_pattern", "=", "re", ".", "compile", "(", "'^...?.?\\....?.?'", ")", "try", ":", "all_versions", "=", "Utils", ".", "winreg", ".", "OpenKey", "(", "Utils", ".", "winreg", ".", "...
https://github.com/aws/lumberyard/blob/f85344403c1c2e77ec8c75deb2c116e97b713217/dev/Tools/build/waf-1.7.13/waflib/Tools/msvc.py#L390-L443
aws/lumberyard
f85344403c1c2e77ec8c75deb2c116e97b713217
dev/Tools/Python/3.7.10/windows/Lib/site-packages/pip/_vendor/distlib/_backport/tarfile.py
python
TarFile.extractfile
(self, member)
Extract a member from the archive as a file object. `member' may be a filename or a TarInfo object. If `member' is a regular file, a file-like object is returned. If `member' is a link, a file-like object is constructed from the link's target. If `member' is none of the above, None is returned. The file-like object is read-only and provides the following methods: read(), readline(), readlines(), seek() and tell()
Extract a member from the archive as a file object. `member' may be a filename or a TarInfo object. If `member' is a regular file, a file-like object is returned. If `member' is a link, a file-like object is constructed from the link's target. If `member' is none of the above, None is returned. The file-like object is read-only and provides the following methods: read(), readline(), readlines(), seek() and tell()
[ "Extract", "a", "member", "from", "the", "archive", "as", "a", "file", "object", ".", "member", "may", "be", "a", "filename", "or", "a", "TarInfo", "object", ".", "If", "member", "is", "a", "regular", "file", "a", "file", "-", "like", "object", "is", ...
def extractfile(self, member): """Extract a member from the archive as a file object. `member' may be a filename or a TarInfo object. If `member' is a regular file, a file-like object is returned. If `member' is a link, a file-like object is constructed from the link's target. If `member' is none of the above, None is returned. The file-like object is read-only and provides the following methods: read(), readline(), readlines(), seek() and tell() """ self._check("r") if isinstance(member, str): tarinfo = self.getmember(member) else: tarinfo = member if tarinfo.isreg(): return self.fileobject(self, tarinfo) elif tarinfo.type not in SUPPORTED_TYPES: # If a member's type is unknown, it is treated as a # regular file. return self.fileobject(self, tarinfo) elif tarinfo.islnk() or tarinfo.issym(): if isinstance(self.fileobj, _Stream): # A small but ugly workaround for the case that someone tries # to extract a (sym)link as a file-object from a non-seekable # stream of tar blocks. raise StreamError("cannot extract (sym)link as file object") else: # A (sym)link's file object is its target's file object. return self.extractfile(self._find_link_target(tarinfo)) else: # If there's no data associated with the member (directory, chrdev, # blkdev, etc.), return None instead of a file object. return None
[ "def", "extractfile", "(", "self", ",", "member", ")", ":", "self", ".", "_check", "(", "\"r\"", ")", "if", "isinstance", "(", "member", ",", "str", ")", ":", "tarinfo", "=", "self", ".", "getmember", "(", "member", ")", "else", ":", "tarinfo", "=", ...
https://github.com/aws/lumberyard/blob/f85344403c1c2e77ec8c75deb2c116e97b713217/dev/Tools/Python/3.7.10/windows/Lib/site-packages/pip/_vendor/distlib/_backport/tarfile.py#L2199-L2235
codilime/veles
e65de5a7c268129acffcdb03034efd8d256d025c
python/veles/async_conn/conn.py
python
AsyncConnection.get_node
(self, id)
return self.get_node_norefresh(id).refresh()
Fetches an AsyncNode with the given id from the server. If this node is already available, it is refreshed. Returns an awaitable of AsyncNode.
Fetches an AsyncNode with the given id from the server. If this node is already available, it is refreshed. Returns an awaitable of AsyncNode.
[ "Fetches", "an", "AsyncNode", "with", "the", "given", "id", "from", "the", "server", ".", "If", "this", "node", "is", "already", "available", "it", "is", "refreshed", ".", "Returns", "an", "awaitable", "of", "AsyncNode", "." ]
def get_node(self, id): """ Fetches an AsyncNode with the given id from the server. If this node is already available, it is refreshed. Returns an awaitable of AsyncNode. """ return self.get_node_norefresh(id).refresh()
[ "def", "get_node", "(", "self", ",", "id", ")", ":", "return", "self", ".", "get_node_norefresh", "(", "id", ")", ".", "refresh", "(", ")" ]
https://github.com/codilime/veles/blob/e65de5a7c268129acffcdb03034efd8d256d025c/python/veles/async_conn/conn.py#L53-L59
ChromiumWebApps/chromium
c7361d39be8abd1574e6ce8957c8dbddd4c6ccf7
build/android/pylib/forwarder.py
python
Forwarder._GetInstanceLocked
(tool)
return Forwarder._instance
Returns the singleton instance. Note that the global lock must be acquired before calling this method. Args: tool: Tool class to use to get wrapper, if necessary, for executing the forwarder (see valgrind_tools.py).
Returns the singleton instance.
[ "Returns", "the", "singleton", "instance", "." ]
def _GetInstanceLocked(tool): """Returns the singleton instance. Note that the global lock must be acquired before calling this method. Args: tool: Tool class to use to get wrapper, if necessary, for executing the forwarder (see valgrind_tools.py). """ if not Forwarder._instance: Forwarder._instance = Forwarder(tool) return Forwarder._instance
[ "def", "_GetInstanceLocked", "(", "tool", ")", ":", "if", "not", "Forwarder", ".", "_instance", ":", "Forwarder", ".", "_instance", "=", "Forwarder", "(", "tool", ")", "return", "Forwarder", ".", "_instance" ]
https://github.com/ChromiumWebApps/chromium/blob/c7361d39be8abd1574e6ce8957c8dbddd4c6ccf7/build/android/pylib/forwarder.py#L174-L185
sonyxperiadev/WebGL
0299b38196f78c6d5f74bcf6fa312a3daee6de60
Tools/Scripts/webkitpy/style/checkers/cpp.py
python
_process_lines
(filename, file_extension, lines, error, min_confidence)
Performs lint checks and reports any errors to the given error function. Args: filename: Filename of the file that is being processed. file_extension: The extension (dot not included) of the file. lines: An array of strings, each representing a line of the file, with the last element being empty if the file is termined with a newline. error: A callable to which errors are reported, which takes 4 arguments:
Performs lint checks and reports any errors to the given error function.
[ "Performs", "lint", "checks", "and", "reports", "any", "errors", "to", "the", "given", "error", "function", "." ]
def _process_lines(filename, file_extension, lines, error, min_confidence): """Performs lint checks and reports any errors to the given error function. Args: filename: Filename of the file that is being processed. file_extension: The extension (dot not included) of the file. lines: An array of strings, each representing a line of the file, with the last element being empty if the file is termined with a newline. error: A callable to which errors are reported, which takes 4 arguments: """ lines = (['// marker so line numbers and indices both start at 1'] + lines + ['// marker so line numbers end in a known way']) include_state = _IncludeState() function_state = _FunctionState(min_confidence) class_state = _ClassState() check_for_copyright(lines, error) if file_extension == 'h': check_for_header_guard(filename, lines, error) remove_multi_line_comments(lines, error) clean_lines = CleansedLines(lines) file_state = _FileState(clean_lines, file_extension) for line in xrange(clean_lines.num_lines()): process_line(filename, file_extension, clean_lines, line, include_state, function_state, class_state, file_state, error) class_state.check_finished(error) check_for_include_what_you_use(filename, clean_lines, include_state, error) # We check here rather than inside process_line so that we see raw # lines rather than "cleaned" lines. check_for_unicode_replacement_characters(lines, error) check_for_new_line_at_eof(lines, error)
[ "def", "_process_lines", "(", "filename", ",", "file_extension", ",", "lines", ",", "error", ",", "min_confidence", ")", ":", "lines", "=", "(", "[", "'// marker so line numbers and indices both start at 1'", "]", "+", "lines", "+", "[", "'// marker so line numbers en...
https://github.com/sonyxperiadev/WebGL/blob/0299b38196f78c6d5f74bcf6fa312a3daee6de60/Tools/Scripts/webkitpy/style/checkers/cpp.py#L3367-L3403
nasa/fprime
595cf3682d8365943d86c1a6fe7c78f0a116acf0
Autocoders/Python/src/fprime_ac/models/TopoFactory.py
python
TopoFactory.__set_base_id_list
(self, id, size, inst)
return [ n, b, w, inst, component_calculated_window_range, self.__compute_component_ID_amount(comp), ]
Routine to set up the base id and window size with actual or instance set values. Routine also checks window size against component max IDs needed if they are found.
Routine to set up the base id and window size with actual or instance set values. Routine also checks window size against component max IDs needed if they are found.
[ "Routine", "to", "set", "up", "the", "base", "id", "and", "window", "size", "with", "actual", "or", "instance", "set", "values", ".", "Routine", "also", "checks", "window", "size", "against", "component", "max", "IDs", "needed", "if", "they", "are", "found...
def __set_base_id_list(self, id, size, inst): """ Routine to set up the base id and window size with actual or instance set values. Routine also checks window size against component max IDs needed if they are found. """ comp = inst.get_component_object() # set instance name n = inst.get_name() # """ Logic for calculating base ids 1) If the user did not specify the base ID within an instance, set it to None 2) If the user did specify the base ID within an instance, check if it is greater than the base ID for the entire topology a) if it is greater, use the base ID from the instance b) if it is not greater, add the base ID from the instance and the base ID from the topology model and use the sum """ if inst.get_base_id() is None: b = None else: if id > abs(int(inst.get_base_id(), 0)): b = abs(int(inst.get_base_id(), 0)) + id PRINT.info( "WARNING: {} instance adding instance supplied base ID to the topology supplied base ID (New ID is {}) because instance supplied base ID is smaller than the topology supplied base ID.".format( n, b ) ) else: b = abs(int(inst.get_base_id(), 0)) PRINT.info("WARNING: %s instance resetting base id to %d" % (n, b)) # # set window size or override it on instance basis component_calculated_window_range = self.__compute_component_base_id_range(comp) """ Note: The calculated window range is really the largest ID (plus one) found in the component object. Logic for calculating window size 1) If user specifies window size in instance tag, use that. 2) If the user does not specify the window size in the instance tag, use the larger of the default window size and the calculated window size 3) If the calculated window size is larger than the new window size, thrown an error """ if inst.get_base_id_window() is not None: w = abs(int(inst.get_base_id_window(), 0)) PRINT.info( "{} instance resetting base id window range to instance specified size ({})".format( n, w ) ) else: if size > component_calculated_window_range: w = size PRINT.info( "{} instance resetting base id window range to default topology size ({})".format( n, w ) ) else: w = component_calculated_window_range PRINT.info( "{} instance resetting base id window range to size calculated from the component XML file ({})".format( n, w ) ) if ( component_calculated_window_range is not None and w < component_calculated_window_range ): PRINT.info( "ERROR: The specified window range for component {} is {}, which is smaller than the calculated window range of {}. Please check the instance definitions in the topology xml file.".format( n, w, component_calculated_window_range ) ) return [ n, b, w, inst, component_calculated_window_range, self.__compute_component_ID_amount(comp), ]
[ "def", "__set_base_id_list", "(", "self", ",", "id", ",", "size", ",", "inst", ")", ":", "comp", "=", "inst", ".", "get_component_object", "(", ")", "# set instance name", "n", "=", "inst", ".", "get_name", "(", ")", "#", "\"\"\"\n Logic for calculating...
https://github.com/nasa/fprime/blob/595cf3682d8365943d86c1a6fe7c78f0a116acf0/Autocoders/Python/src/fprime_ac/models/TopoFactory.py#L621-L704
pyne/pyne
0c2714d7c0d1b5e20be6ae6527da2c660dd6b1b3
pyne/cccc.py
python
Isotxs._read_file_control
(self)
Reads the file control block. This block is always present and gives many parameters for the file including number of energy groups, number of isotopes, etc.
Reads the file control block. This block is always present and gives many parameters for the file including number of energy groups, number of isotopes, etc.
[ "Reads", "the", "file", "control", "block", ".", "This", "block", "is", "always", "present", "and", "gives", "many", "parameters", "for", "the", "file", "including", "number", "of", "energy", "groups", "number", "of", "isotopes", "etc", "." ]
def _read_file_control(self): """Reads the file control block. This block is always present and gives many parameters for the file including number of energy groups, number of isotopes, etc. """ # Get file control record fc = self.get_fortran_record() # Read data from file control record self.fc['ngroup'] = fc.get_int()[0] # Number of energy groups in file self.fc['niso'] = fc.get_int()[0] # Number of isotopes in file # Maximum number of upscatter groups self.fc['maxup'] = fc.get_int()[0] # Maximum number of downscatter groups self.fc['maxdown'] = fc.get_int()[0] self.fc['maxord'] = fc.get_int()[0] # Maximum scattering order self.fc['ichidst'] = fc.get_int()[0] # File-wide fission spectrum flag # Max blocks of scatter data (seems to be actual number) self.fc['nscmax'] = fc.get_int()[0] self.fc['nsblok'] = fc.get_int()[0]
[ "def", "_read_file_control", "(", "self", ")", ":", "# Get file control record", "fc", "=", "self", ".", "get_fortran_record", "(", ")", "# Read data from file control record", "self", ".", "fc", "[", "'ngroup'", "]", "=", "fc", ".", "get_int", "(", ")", "[", ...
https://github.com/pyne/pyne/blob/0c2714d7c0d1b5e20be6ae6527da2c660dd6b1b3/pyne/cccc.py#L133-L153
wxWidgets/wxPython-Classic
19571e1ae65f1ac445f5491474121998c97a1bf0
src/osx_cocoa/propgrid.py
python
PropertyGridInterface.GetPropertyParent
(*args, **kwargs)
return _propgrid.PropertyGridInterface_GetPropertyParent(*args, **kwargs)
GetPropertyParent(self, PGPropArg id) -> PGProperty
GetPropertyParent(self, PGPropArg id) -> PGProperty
[ "GetPropertyParent", "(", "self", "PGPropArg", "id", ")", "-", ">", "PGProperty" ]
def GetPropertyParent(*args, **kwargs): """GetPropertyParent(self, PGPropArg id) -> PGProperty""" return _propgrid.PropertyGridInterface_GetPropertyParent(*args, **kwargs)
[ "def", "GetPropertyParent", "(", "*", "args", ",", "*", "*", "kwargs", ")", ":", "return", "_propgrid", ".", "PropertyGridInterface_GetPropertyParent", "(", "*", "args", ",", "*", "*", "kwargs", ")" ]
https://github.com/wxWidgets/wxPython-Classic/blob/19571e1ae65f1ac445f5491474121998c97a1bf0/src/osx_cocoa/propgrid.py#L1237-L1239
miyosuda/TensorFlowAndroidDemo
35903e0221aa5f109ea2dbef27f20b52e317f42d
jni-build/jni/include/tensorflow/python/ops/math_ops.py
python
_BatchMatMulShape
(op)
return [batch_dims.concatenate([output_rows, output_cols])]
Shape function for BatchMatMul op.
Shape function for BatchMatMul op.
[ "Shape", "function", "for", "BatchMatMul", "op", "." ]
def _BatchMatMulShape(op): """Shape function for BatchMatMul op.""" a_shape = op.inputs[0].get_shape() adj_a = op.get_attr("adj_x") b_shape = op.inputs[1].get_shape() adj_b = op.get_attr("adj_y") if a_shape.dims is None and b_shape.dims is None: return [tensor_shape.unknown_shape()] batch_dims = a_shape[:-2].merge_with(b_shape[:-2]) output_rows = a_shape[-1] if adj_a else a_shape[-2] output_cols = b_shape[-2] if adj_b else b_shape[-1] inner_a = a_shape[-2] if adj_a else a_shape[-1] inner_b = b_shape[-1] if adj_b else b_shape[-2] inner_a.assert_is_compatible_with(inner_b) return [batch_dims.concatenate([output_rows, output_cols])]
[ "def", "_BatchMatMulShape", "(", "op", ")", ":", "a_shape", "=", "op", ".", "inputs", "[", "0", "]", ".", "get_shape", "(", ")", "adj_a", "=", "op", ".", "get_attr", "(", "\"adj_x\"", ")", "b_shape", "=", "op", ".", "inputs", "[", "1", "]", ".", ...
https://github.com/miyosuda/TensorFlowAndroidDemo/blob/35903e0221aa5f109ea2dbef27f20b52e317f42d/jni-build/jni/include/tensorflow/python/ops/math_ops.py#L1549-L1563
infinidb/infinidb
6c9f5dfdabc41ad80e81ba9e1a4eb0d7271a5d23
writeengine/bulk/checkidx.py
python
main
()
Validate indexes..
Validate indexes..
[ "Validate", "indexes", ".." ]
def main(): """ Validate indexes.. """ if not os.access('.', os.W_OK): os.chdir('/tmp') print 'Changing to /tmp to have permission to write files' if len(os.getenv('LD_LIBRARY_PATH'))<5: print 'Suspicous LD_LIBRARY_PATH: %s'%os.getenv('LD_LIBRARY_PATH') home = os.getenv('HOME') genii = home+'/genii' (bulkroot, dbroot) = find_paths() if len(glob.glob(bulkroot+'/job/Job_300.xml')) == 0: sys.exit("No Job_300.xml exist ") indexes = validate_indexes(bulkroot+'/job/Job_300.xml') for idxCmdArg in indexes: print idxCmdArg exec_cmd( genii + '/tools/evalidx/evalidx', idxCmdArg )
[ "def", "main", "(", ")", ":", "if", "not", "os", ".", "access", "(", "'.'", ",", "os", ".", "W_OK", ")", ":", "os", ".", "chdir", "(", "'/tmp'", ")", "print", "'Changing to /tmp to have permission to write files'", "if", "len", "(", "os", ".", "getenv", ...
https://github.com/infinidb/infinidb/blob/6c9f5dfdabc41ad80e81ba9e1a4eb0d7271a5d23/writeengine/bulk/checkidx.py#L70-L93
Xilinx/Vitis-AI
fc74d404563d9951b57245443c73bef389f3657f
tools/Vitis-AI-Quantizer/vai_q_tensorflow1.x/tensorflow/python/keras/estimator/__init__.py
python
model_to_estimator_v2
( keras_model=None, keras_model_path=None, custom_objects=None, model_dir=None, config=None, checkpoint_format='checkpoint')
return keras_lib.model_to_estimator( # pylint:disable=unexpected-keyword-arg keras_model=keras_model, keras_model_path=keras_model_path, custom_objects=custom_objects, model_dir=model_dir, config=config, checkpoint_format=checkpoint_format, use_v2_estimator=True)
Constructs an `Estimator` instance from given keras model. For usage example, please see: [Creating estimators from Keras Models](https://tensorflow.org/guide/estimators#model_to_estimator). __Sample Weights__ Estimators returned by `model_to_estimator` are configured to handle sample weights (similar to `keras_model.fit(x, y, sample_weights)`). To pass sample weights when training or evaluating the Estimator, the first item returned by the input function should be a dictionary with keys `features` and `sample_weights`. Example below: ``` keras_model = tf.keras.Model(...) keras_model.compile(...) estimator = tf.keras.estimator.model_to_estimator(keras_model) def input_fn(): return dataset_ops.Dataset.from_tensors( ({'features': features, 'sample_weights': sample_weights}, targets)) estimator.train(input_fn, steps=1) ``` Args: keras_model: A compiled Keras model object. This argument is mutually exclusive with `keras_model_path`. keras_model_path: Path to a compiled Keras model saved on disk, in HDF5 format, which can be generated with the `save()` method of a Keras model. This argument is mutually exclusive with `keras_model`. custom_objects: Dictionary for custom objects. model_dir: Directory to save `Estimator` model parameters, graph, summary files for TensorBoard, etc. config: `RunConfig` to config `Estimator`. checkpoint_format: Sets the format of the checkpoint saved by the estimator when training. May be `saver` or `checkpoint`, depending on whether to save checkpoints from `tf.compat.v1.train.Saver` or `tf.train.Checkpoint`. The default is `checkpoint`. Estimators use name-based `tf.train.Saver` checkpoints, while Keras models use object-based checkpoints from `tf.train.Checkpoint`. Currently, saving object-based checkpoints from `model_to_estimator` is only supported by Functional and Sequential models. Returns: An Estimator from given keras model. Raises: ValueError: if neither keras_model nor keras_model_path was given. ValueError: if both keras_model and keras_model_path was given. ValueError: if the keras_model_path is a GCS URI. ValueError: if keras_model has not been compiled. ValueError: if an invalid checkpoint_format was given.
Constructs an `Estimator` instance from given keras model.
[ "Constructs", "an", "Estimator", "instance", "from", "given", "keras", "model", "." ]
def model_to_estimator_v2( keras_model=None, keras_model_path=None, custom_objects=None, model_dir=None, config=None, checkpoint_format='checkpoint'): """Constructs an `Estimator` instance from given keras model. For usage example, please see: [Creating estimators from Keras Models](https://tensorflow.org/guide/estimators#model_to_estimator). __Sample Weights__ Estimators returned by `model_to_estimator` are configured to handle sample weights (similar to `keras_model.fit(x, y, sample_weights)`). To pass sample weights when training or evaluating the Estimator, the first item returned by the input function should be a dictionary with keys `features` and `sample_weights`. Example below: ``` keras_model = tf.keras.Model(...) keras_model.compile(...) estimator = tf.keras.estimator.model_to_estimator(keras_model) def input_fn(): return dataset_ops.Dataset.from_tensors( ({'features': features, 'sample_weights': sample_weights}, targets)) estimator.train(input_fn, steps=1) ``` Args: keras_model: A compiled Keras model object. This argument is mutually exclusive with `keras_model_path`. keras_model_path: Path to a compiled Keras model saved on disk, in HDF5 format, which can be generated with the `save()` method of a Keras model. This argument is mutually exclusive with `keras_model`. custom_objects: Dictionary for custom objects. model_dir: Directory to save `Estimator` model parameters, graph, summary files for TensorBoard, etc. config: `RunConfig` to config `Estimator`. checkpoint_format: Sets the format of the checkpoint saved by the estimator when training. May be `saver` or `checkpoint`, depending on whether to save checkpoints from `tf.compat.v1.train.Saver` or `tf.train.Checkpoint`. The default is `checkpoint`. Estimators use name-based `tf.train.Saver` checkpoints, while Keras models use object-based checkpoints from `tf.train.Checkpoint`. Currently, saving object-based checkpoints from `model_to_estimator` is only supported by Functional and Sequential models. Returns: An Estimator from given keras model. Raises: ValueError: if neither keras_model nor keras_model_path was given. ValueError: if both keras_model and keras_model_path was given. ValueError: if the keras_model_path is a GCS URI. ValueError: if keras_model has not been compiled. ValueError: if an invalid checkpoint_format was given. """ try: from tensorflow_estimator.python.estimator import keras as keras_lib # pylint: disable=g-import-not-at-top except ImportError: raise NotImplementedError( 'tf.keras.estimator.model_to_estimator function not available in your ' 'installation.') return keras_lib.model_to_estimator( # pylint:disable=unexpected-keyword-arg keras_model=keras_model, keras_model_path=keras_model_path, custom_objects=custom_objects, model_dir=model_dir, config=config, checkpoint_format=checkpoint_format, use_v2_estimator=True)
[ "def", "model_to_estimator_v2", "(", "keras_model", "=", "None", ",", "keras_model_path", "=", "None", ",", "custom_objects", "=", "None", ",", "model_dir", "=", "None", ",", "config", "=", "None", ",", "checkpoint_format", "=", "'checkpoint'", ")", ":", "try"...
https://github.com/Xilinx/Vitis-AI/blob/fc74d404563d9951b57245443c73bef389f3657f/tools/Vitis-AI-Quantizer/vai_q_tensorflow1.x/tensorflow/python/keras/estimator/__init__.py#L111-L187
alibaba/MNN
c4d9566171d589c3ded23aa18ffb197016995a12
pymnn/pip_package/MNN/expr/__init__.py
python
log
(x)
return _F.log(x)
log(x) Return the log(x), element-wise. Parameters ---------- x : var_like, input value. Returns ------- y : Var. The log of `x`. Example: ------- >>> expr.log([9., 4.5]) var([2.1972246, 1.5040774])
log(x) Return the log(x), element-wise.
[ "log", "(", "x", ")", "Return", "the", "log", "(", "x", ")", "element", "-", "wise", "." ]
def log(x): ''' log(x) Return the log(x), element-wise. Parameters ---------- x : var_like, input value. Returns ------- y : Var. The log of `x`. Example: ------- >>> expr.log([9., 4.5]) var([2.1972246, 1.5040774]) ''' x = _to_var(x) return _F.log(x)
[ "def", "log", "(", "x", ")", ":", "x", "=", "_to_var", "(", "x", ")", "return", "_F", ".", "log", "(", "x", ")" ]
https://github.com/alibaba/MNN/blob/c4d9566171d589c3ded23aa18ffb197016995a12/pymnn/pip_package/MNN/expr/__init__.py#L328-L347
aws/lumberyard
f85344403c1c2e77ec8c75deb2c116e97b713217
dev/Tools/Python/3.7.10/mac/Python.framework/Versions/3.7/lib/python3.7/operator.py
python
add
(a, b)
return a + b
Same as a + b.
Same as a + b.
[ "Same", "as", "a", "+", "b", "." ]
def add(a, b): "Same as a + b." return a + b
[ "def", "add", "(", "a", ",", "b", ")", ":", "return", "a", "+", "b" ]
https://github.com/aws/lumberyard/blob/f85344403c1c2e77ec8c75deb2c116e97b713217/dev/Tools/Python/3.7.10/mac/Python.framework/Versions/3.7/lib/python3.7/operator.py#L75-L77
benoitsteiner/tensorflow-opencl
cb7cb40a57fde5cfd4731bc551e82a1e2fef43a5
tensorflow/contrib/boosted_trees/examples/mnist.py
python
get_input_fn
(dataset_split, batch_size, capacity=10000, min_after_dequeue=3000)
return _input_fn
Input function over MNIST data.
Input function over MNIST data.
[ "Input", "function", "over", "MNIST", "data", "." ]
def get_input_fn(dataset_split, batch_size, capacity=10000, min_after_dequeue=3000): """Input function over MNIST data.""" def _input_fn(): """Prepare features and labels.""" images_batch, labels_batch = tf.train.shuffle_batch( tensors=[dataset_split.images, dataset_split.labels.astype(np.int32)], batch_size=batch_size, capacity=capacity, min_after_dequeue=min_after_dequeue, enqueue_many=True, num_threads=4) features_map = {"images": images_batch} return features_map, labels_batch return _input_fn
[ "def", "get_input_fn", "(", "dataset_split", ",", "batch_size", ",", "capacity", "=", "10000", ",", "min_after_dequeue", "=", "3000", ")", ":", "def", "_input_fn", "(", ")", ":", "\"\"\"Prepare features and labels.\"\"\"", "images_batch", ",", "labels_batch", "=", ...
https://github.com/benoitsteiner/tensorflow-opencl/blob/cb7cb40a57fde5cfd4731bc551e82a1e2fef43a5/tensorflow/contrib/boosted_trees/examples/mnist.py#L47-L66
windystrife/UnrealEngine_NVIDIAGameWorks
b50e6338a7c5b26374d66306ebc7807541ff815e
Engine/Extras/ThirdPartyNotUE/emsdk/Win64/python/2.7.5.3_64bit/Lib/ftplib.py
python
parse227
(resp)
return host, port
Parse the '227' response for a PASV request. Raises error_proto if it does not contain '(h1,h2,h3,h4,p1,p2)' Return ('host.addr.as.numbers', port#) tuple.
Parse the '227' response for a PASV request. Raises error_proto if it does not contain '(h1,h2,h3,h4,p1,p2)' Return ('host.addr.as.numbers', port#) tuple.
[ "Parse", "the", "227", "response", "for", "a", "PASV", "request", ".", "Raises", "error_proto", "if", "it", "does", "not", "contain", "(", "h1", "h2", "h3", "h4", "p1", "p2", ")", "Return", "(", "host", ".", "addr", ".", "as", ".", "numbers", "port#"...
def parse227(resp): '''Parse the '227' response for a PASV request. Raises error_proto if it does not contain '(h1,h2,h3,h4,p1,p2)' Return ('host.addr.as.numbers', port#) tuple.''' if resp[:3] != '227': raise error_reply, resp global _227_re if _227_re is None: import re _227_re = re.compile(r'(\d+),(\d+),(\d+),(\d+),(\d+),(\d+)') m = _227_re.search(resp) if not m: raise error_proto, resp numbers = m.groups() host = '.'.join(numbers[:4]) port = (int(numbers[4]) << 8) + int(numbers[5]) return host, port
[ "def", "parse227", "(", "resp", ")", ":", "if", "resp", "[", ":", "3", "]", "!=", "'227'", ":", "raise", "error_reply", ",", "resp", "global", "_227_re", "if", "_227_re", "is", "None", ":", "import", "re", "_227_re", "=", "re", ".", "compile", "(", ...
https://github.com/windystrife/UnrealEngine_NVIDIAGameWorks/blob/b50e6338a7c5b26374d66306ebc7807541ff815e/Engine/Extras/ThirdPartyNotUE/emsdk/Win64/python/2.7.5.3_64bit/Lib/ftplib.py#L794-L811
miyosuda/TensorFlowAndroidMNIST
7b5a4603d2780a8a2834575706e9001977524007
jni-build/jni/include/external/bazel_tools/tools/build_defs/pkg/make_deb.py
python
AddArFileEntry
(fileobj, filename, content='', timestamp=0, owner_id=0, group_id=0, mode=0o644)
Add a AR file entry to fileobj.
Add a AR file entry to fileobj.
[ "Add", "a", "AR", "file", "entry", "to", "fileobj", "." ]
def AddArFileEntry(fileobj, filename, content='', timestamp=0, owner_id=0, group_id=0, mode=0o644): """Add a AR file entry to fileobj.""" fileobj.write((filename + '/').ljust(16)) # filename (SysV) fileobj.write(str(timestamp).ljust(12)) # timestamp fileobj.write(str(owner_id).ljust(6)) # owner id fileobj.write(str(group_id).ljust(6)) # group id fileobj.write(oct(mode).ljust(8)) # mode fileobj.write(str(len(content)).ljust(10)) # size fileobj.write('\x60\x0a') # end of file entry fileobj.write(content) if len(content) % 2 != 0: fileobj.write('\n')
[ "def", "AddArFileEntry", "(", "fileobj", ",", "filename", ",", "content", "=", "''", ",", "timestamp", "=", "0", ",", "owner_id", "=", "0", ",", "group_id", "=", "0", ",", "mode", "=", "0o644", ")", ":", "fileobj", ".", "write", "(", "(", "filename",...
https://github.com/miyosuda/TensorFlowAndroidMNIST/blob/7b5a4603d2780a8a2834575706e9001977524007/jni-build/jni/include/external/bazel_tools/tools/build_defs/pkg/make_deb.py#L75-L88
wxWidgets/wxPython-Classic
19571e1ae65f1ac445f5491474121998c97a1bf0
wx/lib/agw/foldpanelbar.py
python
CaptionBarStyle.GetCaptionStyle
(self)
return self._captionStyle
Returns the caption style for the caption bar. :note: Please be warned this will result in an assertion failure when this property is not previously set. :see: :meth:`~CaptionBarStyle.SetCaptionStyle`, :meth:`~CaptionBarStyle.CaptionStyleUsed`
Returns the caption style for the caption bar. :note: Please be warned this will result in an assertion failure when this property is not previously set. :see: :meth:`~CaptionBarStyle.SetCaptionStyle`, :meth:`~CaptionBarStyle.CaptionStyleUsed`
[ "Returns", "the", "caption", "style", "for", "the", "caption", "bar", ".", ":", "note", ":", "Please", "be", "warned", "this", "will", "result", "in", "an", "assertion", "failure", "when", "this", "property", "is", "not", "previously", "set", ".", ":", "...
def GetCaptionStyle(self): """ Returns the caption style for the caption bar. :note: Please be warned this will result in an assertion failure when this property is not previously set. :see: :meth:`~CaptionBarStyle.SetCaptionStyle`, :meth:`~CaptionBarStyle.CaptionStyleUsed` """ return self._captionStyle
[ "def", "GetCaptionStyle", "(", "self", ")", ":", "return", "self", ".", "_captionStyle" ]
https://github.com/wxWidgets/wxPython-Classic/blob/19571e1ae65f1ac445f5491474121998c97a1bf0/wx/lib/agw/foldpanelbar.py#L498-L508
google/or-tools
2cb85b4eead4c38e1c54b48044f92087cf165bce
ortools/sat/python/visualization.py
python
SvgWrapper.AddXScale
(self, step=1)
Add an scale on the x axis.
Add an scale on the x axis.
[ "Add", "an", "scale", "on", "the", "x", "axis", "." ]
def AddXScale(self, step=1): """Add an scale on the x axis.""" o = self.__offset s = self.__scaling y = self.__sizey * s + o / 2.0 + o dy = self.__offset / 4.0 self.__dwg.add( self.__dwg.line((o, y), (self.__sizex * s + o, y), stroke='black')) for i in range(0, int(self.__sizex) + 1, step): self.__dwg.add( self.__dwg.line((o + i * s, y - dy), (o + i * s, y + dy), stroke='black'))
[ "def", "AddXScale", "(", "self", ",", "step", "=", "1", ")", ":", "o", "=", "self", ".", "__offset", "s", "=", "self", ".", "__scaling", "y", "=", "self", ".", "__sizey", "*", "s", "+", "o", "/", "2.0", "+", "o", "dy", "=", "self", ".", "__of...
https://github.com/google/or-tools/blob/2cb85b4eead4c38e1c54b48044f92087cf165bce/ortools/sat/python/visualization.py#L132-L143
CRYTEK/CRYENGINE
232227c59a220cbbd311576f0fbeba7bb53b2a8c
Code/Tools/waf-1.7.13/crywaflib/msvs.py
python
compile_template
(line)
return Task.funex(fun)
Compile a template expression into a python function (like jsps, but way shorter)
Compile a template expression into a python function (like jsps, but way shorter)
[ "Compile", "a", "template", "expression", "into", "a", "python", "function", "(", "like", "jsps", "but", "way", "shorter", ")" ]
def compile_template(line): """ Compile a template expression into a python function (like jsps, but way shorter) """ extr = [] def repl(match): g = match.group if g('dollar'): return "$" elif g('backslash'): return "\\" elif g('subst'): extr.append(g('code')) return "<<|@|>>" return None line2 = reg_act.sub(repl, line) params = line2.split('<<|@|>>') assert(extr) indent = 0 buf = [] app = buf.append def app(txt): buf.append(indent * '\t' + txt) for x in range(len(extr)): if params[x]: app("lst.append(%r)" % params[x]) f = extr[x] if f.startswith('if') or f.startswith('for'): app(f + ':') indent += 1 elif f.startswith('py:'): app(f[3:]) elif f.startswith('endif') or f.startswith('endfor'): indent -= 1 elif f.startswith('else') or f.startswith('elif'): indent -= 1 app(f + ':') indent += 1 elif f.startswith('xml:'): app('lst.append(xml_escape(%s))' % f[4:]) else: #app('lst.append((%s) or "cannot find %s")' % (f, f)) app('lst.append(%s)' % f) if extr: if params[-1]: app("lst.append(%r)" % params[-1]) fun = COMPILE_TEMPLATE % "\n\t".join(buf) #print(fun) return Task.funex(fun)
[ "def", "compile_template", "(", "line", ")", ":", "extr", "=", "[", "]", "def", "repl", "(", "match", ")", ":", "g", "=", "match", ".", "group", "if", "g", "(", "'dollar'", ")", ":", "return", "\"$\"", "elif", "g", "(", "'backslash'", ")", ":", "...
https://github.com/CRYTEK/CRYENGINE/blob/232227c59a220cbbd311576f0fbeba7bb53b2a8c/Code/Tools/waf-1.7.13/crywaflib/msvs.py#L613-L667
baidu-research/tensorflow-allreduce
66d5b855e90b0949e9fa5cca5599fd729a70e874
tensorflow/contrib/learn/python/learn/dataframe/transform.py
python
TensorFlowTransform._produce_output_series
(self, input_series=None)
return [TransformedSeries(input_series, self, output_name) for output_name in self.output_names]
Apply this `Transform` to the provided `Series`, producing `Series`. Args: input_series: None, a `Series`, or a list of input `Series`, acting as positional arguments. Returns: A namedtuple of the output `Series`.
Apply this `Transform` to the provided `Series`, producing `Series`.
[ "Apply", "this", "Transform", "to", "the", "provided", "Series", "producing", "Series", "." ]
def _produce_output_series(self, input_series=None): """Apply this `Transform` to the provided `Series`, producing `Series`. Args: input_series: None, a `Series`, or a list of input `Series`, acting as positional arguments. Returns: A namedtuple of the output `Series`. """ return [TransformedSeries(input_series, self, output_name) for output_name in self.output_names]
[ "def", "_produce_output_series", "(", "self", ",", "input_series", "=", "None", ")", ":", "return", "[", "TransformedSeries", "(", "input_series", ",", "self", ",", "output_name", ")", "for", "output_name", "in", "self", ".", "output_names", "]" ]
https://github.com/baidu-research/tensorflow-allreduce/blob/66d5b855e90b0949e9fa5cca5599fd729a70e874/tensorflow/contrib/learn/python/learn/dataframe/transform.py#L266-L277
mantidproject/mantid
03deeb89254ec4289edb8771e0188c2090a02f32
qt/python/mantidqt/mantidqt/plotting/markers.py
python
RangeMarker.is_marker_moving
(self)
return self.min_marker.is_marker_moving() or self.max_marker.is_marker_moving()
Returns true if one of the markers is being moved :return: True if one of the markers is being moved.
Returns true if one of the markers is being moved :return: True if one of the markers is being moved.
[ "Returns", "true", "if", "one", "of", "the", "markers", "is", "being", "moved", ":", "return", ":", "True", "if", "one", "of", "the", "markers", "is", "being", "moved", "." ]
def is_marker_moving(self): """ Returns true if one of the markers is being moved :return: True if one of the markers is being moved. """ return self.min_marker.is_marker_moving() or self.max_marker.is_marker_moving()
[ "def", "is_marker_moving", "(", "self", ")", ":", "return", "self", ".", "min_marker", ".", "is_marker_moving", "(", ")", "or", "self", ".", "max_marker", ".", "is_marker_moving", "(", ")" ]
https://github.com/mantidproject/mantid/blob/03deeb89254ec4289edb8771e0188c2090a02f32/qt/python/mantidqt/mantidqt/plotting/markers.py#L1170-L1175
gromacs/gromacs
7dec3a3f99993cf5687a122de3e12de31c21c399
python_packaging/src/gmxapi/simulation/fileio.py
python
read_tpr
(tprfile: typing.Union[str, TprFile])
return _SimulationInput(tprfile)
Get a simulation input object from a TPR run input file. Arguments: tprfile : TPR input object or filename Returns: simulation input object The returned object may be inspected by the user. Simulation input parameters may be extracted through the `parameters` attribute. Example: >>> sim_input = gmx.fileio.read_tpr(tprfile=tprfilename) >>> params = sim_input.parameters.extract() >>> print(params['init-step']) 0 Supports the `read_tpr` gmxapi work graph operation. (not yet implemented)
Get a simulation input object from a TPR run input file.
[ "Get", "a", "simulation", "input", "object", "from", "a", "TPR", "run", "input", "file", "." ]
def read_tpr(tprfile: typing.Union[str, TprFile]): """ Get a simulation input object from a TPR run input file. Arguments: tprfile : TPR input object or filename Returns: simulation input object The returned object may be inspected by the user. Simulation input parameters may be extracted through the `parameters` attribute. Example: >>> sim_input = gmx.fileio.read_tpr(tprfile=tprfilename) >>> params = sim_input.parameters.extract() >>> print(params['init-step']) 0 Supports the `read_tpr` gmxapi work graph operation. (not yet implemented) """ if not isinstance(tprfile, TprFile): try: tprfile = TprFile(os.fsencode(tprfile), mode='r') except Exception as e: raise exceptions.UsageError("TPR object or file name is required.") from e return _SimulationInput(tprfile)
[ "def", "read_tpr", "(", "tprfile", ":", "typing", ".", "Union", "[", "str", ",", "TprFile", "]", ")", ":", "if", "not", "isinstance", "(", "tprfile", ",", "TprFile", ")", ":", "try", ":", "tprfile", "=", "TprFile", "(", "os", ".", "fsencode", "(", ...
https://github.com/gromacs/gromacs/blob/7dec3a3f99993cf5687a122de3e12de31c21c399/python_packaging/src/gmxapi/simulation/fileio.py#L176-L203
miyosuda/TensorFlowAndroidDemo
35903e0221aa5f109ea2dbef27f20b52e317f42d
jni-build/jni/include/tensorflow/python/ops/tensor_array_ops.py
python
TensorArray.concat
(self, name=None)
Return the values in the TensorArray as a concatenated `Tensor`. All of the values must have been written, their ranks must match, and and their shapes must all match for all dimensions except the first. Args: name: A name for the operation (optional). Returns: All the tensors in the TensorArray concatenated into one tensor.
Return the values in the TensorArray as a concatenated `Tensor`.
[ "Return", "the", "values", "in", "the", "TensorArray", "as", "a", "concatenated", "Tensor", "." ]
def concat(self, name=None): """Return the values in the TensorArray as a concatenated `Tensor`. All of the values must have been written, their ranks must match, and and their shapes must all match for all dimensions except the first. Args: name: A name for the operation (optional). Returns: All the tensors in the TensorArray concatenated into one tensor. """ if self._elem_shape and self._elem_shape[0].dims is not None: element_shape_except0 = tensor_shape.TensorShape(self._elem_shape[0].dims[ 1:]) else: element_shape_except0 = tensor_shape.TensorShape(None) with ops.colocate_with(self._handle): value, _ = gen_data_flow_ops._tensor_array_concat( handle=self._handle, flow_in=self._flow, dtype=self._dtype, name=name, element_shape_except0=element_shape_except0) if self._elem_shape and self._elem_shape[0].dims is not None: value.set_shape([None] + self._elem_shape[0].dims[1:]) return value
[ "def", "concat", "(", "self", ",", "name", "=", "None", ")", ":", "if", "self", ".", "_elem_shape", "and", "self", ".", "_elem_shape", "[", "0", "]", ".", "dims", "is", "not", "None", ":", "element_shape_except0", "=", "tensor_shape", ".", "TensorShape",...
https://github.com/miyosuda/TensorFlowAndroidDemo/blob/35903e0221aa5f109ea2dbef27f20b52e317f42d/jni-build/jni/include/tensorflow/python/ops/tensor_array_ops.py#L255-L281
wxWidgets/wxPython-Classic
19571e1ae65f1ac445f5491474121998c97a1bf0
src/osx_cocoa/_controls.py
python
ComboBox.GetClassDefaultAttributes
(*args, **kwargs)
return _controls_.ComboBox_GetClassDefaultAttributes(*args, **kwargs)
GetClassDefaultAttributes(int variant=WINDOW_VARIANT_NORMAL) -> VisualAttributes Get the default attributes for this class. This is useful if you want to use the same font or colour in your own control as in a standard control -- which is a much better idea than hard coding specific colours or fonts which might look completely out of place on the user's system, especially if it uses themes. The variant parameter is only relevant under Mac currently and is ignore under other platforms. Under Mac, it will change the size of the returned font. See `wx.Window.SetWindowVariant` for more about this.
GetClassDefaultAttributes(int variant=WINDOW_VARIANT_NORMAL) -> VisualAttributes
[ "GetClassDefaultAttributes", "(", "int", "variant", "=", "WINDOW_VARIANT_NORMAL", ")", "-", ">", "VisualAttributes" ]
def GetClassDefaultAttributes(*args, **kwargs): """ GetClassDefaultAttributes(int variant=WINDOW_VARIANT_NORMAL) -> VisualAttributes Get the default attributes for this class. This is useful if you want to use the same font or colour in your own control as in a standard control -- which is a much better idea than hard coding specific colours or fonts which might look completely out of place on the user's system, especially if it uses themes. The variant parameter is only relevant under Mac currently and is ignore under other platforms. Under Mac, it will change the size of the returned font. See `wx.Window.SetWindowVariant` for more about this. """ return _controls_.ComboBox_GetClassDefaultAttributes(*args, **kwargs)
[ "def", "GetClassDefaultAttributes", "(", "*", "args", ",", "*", "*", "kwargs", ")", ":", "return", "_controls_", ".", "ComboBox_GetClassDefaultAttributes", "(", "*", "args", ",", "*", "*", "kwargs", ")" ]
https://github.com/wxWidgets/wxPython-Classic/blob/19571e1ae65f1ac445f5491474121998c97a1bf0/src/osx_cocoa/_controls.py#L669-L684
aws/lumberyard
f85344403c1c2e77ec8c75deb2c116e97b713217
dev/Tools/Python/3.7.10/windows/Lib/asyncio/selector_events.py
python
BaseSelectorEventLoop._remove_writer
(self, fd)
Remove a writer callback.
Remove a writer callback.
[ "Remove", "a", "writer", "callback", "." ]
def _remove_writer(self, fd): """Remove a writer callback.""" if self.is_closed(): return False try: key = self._selector.get_key(fd) except KeyError: return False else: mask, (reader, writer) = key.events, key.data # Remove both writer and connector. mask &= ~selectors.EVENT_WRITE if not mask: self._selector.unregister(fd) else: self._selector.modify(fd, mask, (reader, None)) if writer is not None: writer.cancel() return True else: return False
[ "def", "_remove_writer", "(", "self", ",", "fd", ")", ":", "if", "self", ".", "is_closed", "(", ")", ":", "return", "False", "try", ":", "key", "=", "self", ".", "_selector", ".", "get_key", "(", "fd", ")", "except", "KeyError", ":", "return", "False...
https://github.com/aws/lumberyard/blob/f85344403c1c2e77ec8c75deb2c116e97b713217/dev/Tools/Python/3.7.10/windows/Lib/asyncio/selector_events.py#L303-L324
hanpfei/chromium-net
392cc1fa3a8f92f42e4071ab6e674d8e0482f83f
third_party/catapult/third_party/gsutil/third_party/boto/boto/dynamodb2/layer1.py
python
DynamoDBConnection.create_table
(self, attribute_definitions, table_name, key_schema, provisioned_throughput, local_secondary_indexes=None, global_secondary_indexes=None)
return self.make_request(action='CreateTable', body=json.dumps(params))
The CreateTable operation adds a new table to your account. In an AWS account, table names must be unique within each region. That is, you can have two tables with same name if you create the tables in different regions. CreateTable is an asynchronous operation. Upon receiving a CreateTable request, DynamoDB immediately returns a response with a TableStatus of `CREATING`. After the table is created, DynamoDB sets the TableStatus to `ACTIVE`. You can perform read and write operations only on an `ACTIVE` table. You can optionally define secondary indexes on the new table, as part of the CreateTable operation. If you want to create multiple tables with secondary indexes on them, you must create the tables sequentially. Only one table with secondary indexes can be in the `CREATING` state at any given time. You can use the DescribeTable API to check the table status. :type attribute_definitions: list :param attribute_definitions: An array of attributes that describe the key schema for the table and indexes. :type table_name: string :param table_name: The name of the table to create. :type key_schema: list :param key_schema: Specifies the attributes that make up the primary key for a table or an index. The attributes in KeySchema must also be defined in the AttributeDefinitions array. For more information, see `Data Model`_ in the Amazon DynamoDB Developer Guide . Each KeySchemaElement in the array is composed of: + AttributeName - The name of this key attribute. + KeyType - Determines whether the key attribute is `HASH` or `RANGE`. For a primary key that consists of a hash attribute, you must specify exactly one element with a KeyType of `HASH`. For a primary key that consists of hash and range attributes, you must specify exactly two elements, in this order: The first element must have a KeyType of `HASH`, and the second element must have a KeyType of `RANGE`. For more information, see `Specifying the Primary Key`_ in the Amazon DynamoDB Developer Guide . :type local_secondary_indexes: list :param local_secondary_indexes: One or more local secondary indexes (the maximum is five) to be created on the table. Each index is scoped to a given hash key value. There is a 10 GB size limit per hash key; otherwise, the size of a local secondary index is unconstrained. Each local secondary index in the array includes the following: + IndexName - The name of the local secondary index. Must be unique only for this table. + KeySchema - Specifies the key schema for the local secondary index. The key schema must begin with the same hash key attribute as the table. + Projection - Specifies attributes that are copied (projected) from the table into the index. These are in addition to the primary key attributes and index key attributes, which are automatically projected. Each attribute specification is composed of: + ProjectionType - One of the following: + `KEYS_ONLY` - Only the index and primary keys are projected into the index. + `INCLUDE` - Only the specified table attributes are projected into the index. The list of projected attributes are in NonKeyAttributes . + `ALL` - All of the table attributes are projected into the index. + NonKeyAttributes - A list of one or more non-key attribute names that are projected into the secondary index. The total count of attributes specified in NonKeyAttributes , summed across all of the secondary indexes, must not exceed 20. If you project the same attribute into two different indexes, this counts as two distinct attributes when determining the total. :type global_secondary_indexes: list :param global_secondary_indexes: One or more global secondary indexes (the maximum is five) to be created on the table. Each global secondary index in the array includes the following: + IndexName - The name of the global secondary index. Must be unique only for this table. + KeySchema - Specifies the key schema for the global secondary index. + Projection - Specifies attributes that are copied (projected) from the table into the index. These are in addition to the primary key attributes and index key attributes, which are automatically projected. Each attribute specification is composed of: + ProjectionType - One of the following: + `KEYS_ONLY` - Only the index and primary keys are projected into the index. + `INCLUDE` - Only the specified table attributes are projected into the index. The list of projected attributes are in NonKeyAttributes . + `ALL` - All of the table attributes are projected into the index. + NonKeyAttributes - A list of one or more non-key attribute names that are projected into the secondary index. The total count of attributes specified in NonKeyAttributes , summed across all of the secondary indexes, must not exceed 20. If you project the same attribute into two different indexes, this counts as two distinct attributes when determining the total. + ProvisionedThroughput - The provisioned throughput settings for the global secondary index, consisting of read and write capacity units. :type provisioned_throughput: dict :param provisioned_throughput: Represents the provisioned throughput settings for a specified table or index. The settings can be modified using the UpdateTable operation. For current minimum and maximum provisioned throughput values, see `Limits`_ in the Amazon DynamoDB Developer Guide .
The CreateTable operation adds a new table to your account. In an AWS account, table names must be unique within each region. That is, you can have two tables with same name if you create the tables in different regions.
[ "The", "CreateTable", "operation", "adds", "a", "new", "table", "to", "your", "account", ".", "In", "an", "AWS", "account", "table", "names", "must", "be", "unique", "within", "each", "region", ".", "That", "is", "you", "can", "have", "two", "tables", "w...
def create_table(self, attribute_definitions, table_name, key_schema, provisioned_throughput, local_secondary_indexes=None, global_secondary_indexes=None): """ The CreateTable operation adds a new table to your account. In an AWS account, table names must be unique within each region. That is, you can have two tables with same name if you create the tables in different regions. CreateTable is an asynchronous operation. Upon receiving a CreateTable request, DynamoDB immediately returns a response with a TableStatus of `CREATING`. After the table is created, DynamoDB sets the TableStatus to `ACTIVE`. You can perform read and write operations only on an `ACTIVE` table. You can optionally define secondary indexes on the new table, as part of the CreateTable operation. If you want to create multiple tables with secondary indexes on them, you must create the tables sequentially. Only one table with secondary indexes can be in the `CREATING` state at any given time. You can use the DescribeTable API to check the table status. :type attribute_definitions: list :param attribute_definitions: An array of attributes that describe the key schema for the table and indexes. :type table_name: string :param table_name: The name of the table to create. :type key_schema: list :param key_schema: Specifies the attributes that make up the primary key for a table or an index. The attributes in KeySchema must also be defined in the AttributeDefinitions array. For more information, see `Data Model`_ in the Amazon DynamoDB Developer Guide . Each KeySchemaElement in the array is composed of: + AttributeName - The name of this key attribute. + KeyType - Determines whether the key attribute is `HASH` or `RANGE`. For a primary key that consists of a hash attribute, you must specify exactly one element with a KeyType of `HASH`. For a primary key that consists of hash and range attributes, you must specify exactly two elements, in this order: The first element must have a KeyType of `HASH`, and the second element must have a KeyType of `RANGE`. For more information, see `Specifying the Primary Key`_ in the Amazon DynamoDB Developer Guide . :type local_secondary_indexes: list :param local_secondary_indexes: One or more local secondary indexes (the maximum is five) to be created on the table. Each index is scoped to a given hash key value. There is a 10 GB size limit per hash key; otherwise, the size of a local secondary index is unconstrained. Each local secondary index in the array includes the following: + IndexName - The name of the local secondary index. Must be unique only for this table. + KeySchema - Specifies the key schema for the local secondary index. The key schema must begin with the same hash key attribute as the table. + Projection - Specifies attributes that are copied (projected) from the table into the index. These are in addition to the primary key attributes and index key attributes, which are automatically projected. Each attribute specification is composed of: + ProjectionType - One of the following: + `KEYS_ONLY` - Only the index and primary keys are projected into the index. + `INCLUDE` - Only the specified table attributes are projected into the index. The list of projected attributes are in NonKeyAttributes . + `ALL` - All of the table attributes are projected into the index. + NonKeyAttributes - A list of one or more non-key attribute names that are projected into the secondary index. The total count of attributes specified in NonKeyAttributes , summed across all of the secondary indexes, must not exceed 20. If you project the same attribute into two different indexes, this counts as two distinct attributes when determining the total. :type global_secondary_indexes: list :param global_secondary_indexes: One or more global secondary indexes (the maximum is five) to be created on the table. Each global secondary index in the array includes the following: + IndexName - The name of the global secondary index. Must be unique only for this table. + KeySchema - Specifies the key schema for the global secondary index. + Projection - Specifies attributes that are copied (projected) from the table into the index. These are in addition to the primary key attributes and index key attributes, which are automatically projected. Each attribute specification is composed of: + ProjectionType - One of the following: + `KEYS_ONLY` - Only the index and primary keys are projected into the index. + `INCLUDE` - Only the specified table attributes are projected into the index. The list of projected attributes are in NonKeyAttributes . + `ALL` - All of the table attributes are projected into the index. + NonKeyAttributes - A list of one or more non-key attribute names that are projected into the secondary index. The total count of attributes specified in NonKeyAttributes , summed across all of the secondary indexes, must not exceed 20. If you project the same attribute into two different indexes, this counts as two distinct attributes when determining the total. + ProvisionedThroughput - The provisioned throughput settings for the global secondary index, consisting of read and write capacity units. :type provisioned_throughput: dict :param provisioned_throughput: Represents the provisioned throughput settings for a specified table or index. The settings can be modified using the UpdateTable operation. For current minimum and maximum provisioned throughput values, see `Limits`_ in the Amazon DynamoDB Developer Guide . """ params = { 'AttributeDefinitions': attribute_definitions, 'TableName': table_name, 'KeySchema': key_schema, 'ProvisionedThroughput': provisioned_throughput, } if local_secondary_indexes is not None: params['LocalSecondaryIndexes'] = local_secondary_indexes if global_secondary_indexes is not None: params['GlobalSecondaryIndexes'] = global_secondary_indexes return self.make_request(action='CreateTable', body=json.dumps(params))
[ "def", "create_table", "(", "self", ",", "attribute_definitions", ",", "table_name", ",", "key_schema", ",", "provisioned_throughput", ",", "local_secondary_indexes", "=", "None", ",", "global_secondary_indexes", "=", "None", ")", ":", "params", "=", "{", "'Attribut...
https://github.com/hanpfei/chromium-net/blob/392cc1fa3a8f92f42e4071ab6e674d8e0482f83f/third_party/catapult/third_party/gsutil/third_party/boto/boto/dynamodb2/layer1.py#L422-L565
funnyzhou/Adaptive_Feeding
9c78182331d8c0ea28de47226e805776c638d46f
lib/rpn/generate_anchors.py
python
generate_anchors
(base_size=16, ratios=[0.5, 1, 2], scales=2**np.arange(3, 6))
return anchors
Generate anchor (reference) windows by enumerating aspect ratios X scales wrt a reference (0, 0, 15, 15) window.
Generate anchor (reference) windows by enumerating aspect ratios X scales wrt a reference (0, 0, 15, 15) window.
[ "Generate", "anchor", "(", "reference", ")", "windows", "by", "enumerating", "aspect", "ratios", "X", "scales", "wrt", "a", "reference", "(", "0", "0", "15", "15", ")", "window", "." ]
def generate_anchors(base_size=16, ratios=[0.5, 1, 2], scales=2**np.arange(3, 6)): """ Generate anchor (reference) windows by enumerating aspect ratios X scales wrt a reference (0, 0, 15, 15) window. """ base_anchor = np.array([1, 1, base_size, base_size]) - 1 ratio_anchors = _ratio_enum(base_anchor, ratios) anchors = np.vstack([_scale_enum(ratio_anchors[i, :], scales) for i in xrange(ratio_anchors.shape[0])]) return anchors
[ "def", "generate_anchors", "(", "base_size", "=", "16", ",", "ratios", "=", "[", "0.5", ",", "1", ",", "2", "]", ",", "scales", "=", "2", "**", "np", ".", "arange", "(", "3", ",", "6", ")", ")", ":", "base_anchor", "=", "np", ".", "array", "(",...
https://github.com/funnyzhou/Adaptive_Feeding/blob/9c78182331d8c0ea28de47226e805776c638d46f/lib/rpn/generate_anchors.py#L37-L48
papyrussolution/OpenPapyrus
bbfb5ec2ea2109b8e2f125edd838e12eaf7b8b91
Src/OSF/protobuf-3.19.1/python/google/protobuf/internal/containers.py
python
MessageMap.get_or_create
(self, key)
return self[key]
get_or_create() is an alias for getitem (ie. map[key]). Args: key: The key to get or create in the map. This is useful in cases where you want to be explicit that the call is mutating the map. This can avoid lint errors for statements like this that otherwise would appear to be pointless statements: msg.my_map[key]
get_or_create() is an alias for getitem (ie. map[key]).
[ "get_or_create", "()", "is", "an", "alias", "for", "getitem", "(", "ie", ".", "map", "[", "key", "]", ")", "." ]
def get_or_create(self, key): """get_or_create() is an alias for getitem (ie. map[key]). Args: key: The key to get or create in the map. This is useful in cases where you want to be explicit that the call is mutating the map. This can avoid lint errors for statements like this that otherwise would appear to be pointless statements: msg.my_map[key] """ return self[key]
[ "def", "get_or_create", "(", "self", ",", "key", ")", ":", "return", "self", "[", "key", "]" ]
https://github.com/papyrussolution/OpenPapyrus/blob/bbfb5ec2ea2109b8e2f125edd838e12eaf7b8b91/Src/OSF/protobuf-3.19.1/python/google/protobuf/internal/containers.py#L448-L460
wxWidgets/wxPython-Classic
19571e1ae65f1ac445f5491474121998c97a1bf0
src/osx_cocoa/_gdi.py
python
GraphicsBrush.__init__
(self, *args, **kwargs)
__init__(self) -> GraphicsBrush A wx.GraphicsBrush is a native representation of a brush. It is used for filling a path on a `wx.GraphicsContext`. The contents are specific and private to the respective renderer. The only way to get a valid instance is via a Create...Brush call on the graphics context or the renderer instance.
__init__(self) -> GraphicsBrush
[ "__init__", "(", "self", ")", "-", ">", "GraphicsBrush" ]
def __init__(self, *args, **kwargs): """ __init__(self) -> GraphicsBrush A wx.GraphicsBrush is a native representation of a brush. It is used for filling a path on a `wx.GraphicsContext`. The contents are specific and private to the respective renderer. The only way to get a valid instance is via a Create...Brush call on the graphics context or the renderer instance. """ _gdi_.GraphicsBrush_swiginit(self,_gdi_.new_GraphicsBrush(*args, **kwargs))
[ "def", "__init__", "(", "self", ",", "*", "args", ",", "*", "*", "kwargs", ")", ":", "_gdi_", ".", "GraphicsBrush_swiginit", "(", "self", ",", "_gdi_", ".", "new_GraphicsBrush", "(", "*", "args", ",", "*", "*", "kwargs", ")", ")" ]
https://github.com/wxWidgets/wxPython-Classic/blob/19571e1ae65f1ac445f5491474121998c97a1bf0/src/osx_cocoa/_gdi.py#L5545-L5555
aws/lumberyard
f85344403c1c2e77ec8c75deb2c116e97b713217
dev/Gems/CloudGemFramework/v1/AWS/common-code/lib/OpenSSL/crypto.py
python
CRL.set_nextUpdate
(self, when)
return self._set_boundary_time(_lib.X509_CRL_get_nextUpdate, when)
Set when the CRL will next be udpated. The timestamp is formatted as an ASN.1 TIME:: YYYYMMDDhhmmssZ .. versionadded:: 16.1.0 :param bytes when: A timestamp string. :return: ``None``
Set when the CRL will next be udpated.
[ "Set", "when", "the", "CRL", "will", "next", "be", "udpated", "." ]
def set_nextUpdate(self, when): """ Set when the CRL will next be udpated. The timestamp is formatted as an ASN.1 TIME:: YYYYMMDDhhmmssZ .. versionadded:: 16.1.0 :param bytes when: A timestamp string. :return: ``None`` """ return self._set_boundary_time(_lib.X509_CRL_get_nextUpdate, when)
[ "def", "set_nextUpdate", "(", "self", ",", "when", ")", ":", "return", "self", ".", "_set_boundary_time", "(", "_lib", ".", "X509_CRL_get_nextUpdate", ",", "when", ")" ]
https://github.com/aws/lumberyard/blob/f85344403c1c2e77ec8c75deb2c116e97b713217/dev/Gems/CloudGemFramework/v1/AWS/common-code/lib/OpenSSL/crypto.py#L2204-L2217
google/llvm-propeller
45c226984fe8377ebfb2ad7713c680d652ba678d
clang/utils/check_cfc/check_cfc.py
python
is_normal_compile
(args)
return compile_step and not bitcode and not query and not dependency and input_is_valid
Check if this is a normal compile which will output an object file rather than a preprocess or link. args is a list of command line arguments.
Check if this is a normal compile which will output an object file rather than a preprocess or link. args is a list of command line arguments.
[ "Check", "if", "this", "is", "a", "normal", "compile", "which", "will", "output", "an", "object", "file", "rather", "than", "a", "preprocess", "or", "link", ".", "args", "is", "a", "list", "of", "command", "line", "arguments", "." ]
def is_normal_compile(args): """Check if this is a normal compile which will output an object file rather than a preprocess or link. args is a list of command line arguments.""" compile_step = '-c' in args # Bitcode cannot be disassembled in the same way bitcode = '-flto' in args or '-emit-llvm' in args # Version and help are queries of the compiler and override -c if specified query = '--version' in args or '--help' in args # Options to output dependency files for make dependency = '-M' in args or '-MM' in args # Check if the input is recognised as a source file (this may be too # strong a restriction) input_is_valid = bool(get_input_file(args)) return compile_step and not bitcode and not query and not dependency and input_is_valid
[ "def", "is_normal_compile", "(", "args", ")", ":", "compile_step", "=", "'-c'", "in", "args", "# Bitcode cannot be disassembled in the same way", "bitcode", "=", "'-flto'", "in", "args", "or", "'-emit-llvm'", "in", "args", "# Version and help are queries of the compiler and...
https://github.com/google/llvm-propeller/blob/45c226984fe8377ebfb2ad7713c680d652ba678d/clang/utils/check_cfc/check_cfc.py#L217-L230
sdhash/sdhash
b9eff63e4e5867e910f41fd69032bbb1c94a2a5e
sdhash-ui/cherrypy/process/plugins.py
python
Monitor.graceful
(self)
Stop the callback's background task thread and restart it.
Stop the callback's background task thread and restart it.
[ "Stop", "the", "callback", "s", "background", "task", "thread", "and", "restart", "it", "." ]
def graceful(self): """Stop the callback's background task thread and restart it.""" self.stop() self.start()
[ "def", "graceful", "(", "self", ")", ":", "self", ".", "stop", "(", ")", "self", ".", "start", "(", ")" ]
https://github.com/sdhash/sdhash/blob/b9eff63e4e5867e910f41fd69032bbb1c94a2a5e/sdhash-ui/cherrypy/process/plugins.py#L534-L537
numworks/epsilon
8952d2f8b1de1c3f064eec8ffcea804c5594ba4c
build/device/usb/legacy.py
python
DeviceHandle.resetEndpoint
(self, endpoint)
r"""Reset all states for the specified endpoint. Arguments: endpoint: endpoint number.
r"""Reset all states for the specified endpoint.
[ "r", "Reset", "all", "states", "for", "the", "specified", "endpoint", "." ]
def resetEndpoint(self, endpoint): r"""Reset all states for the specified endpoint. Arguments: endpoint: endpoint number. """ self.clearHalt(endpoint)
[ "def", "resetEndpoint", "(", "self", ",", "endpoint", ")", ":", "self", ".", "clearHalt", "(", "endpoint", ")" ]
https://github.com/numworks/epsilon/blob/8952d2f8b1de1c3f064eec8ffcea804c5594ba4c/build/device/usb/legacy.py#L245-L251
limbo018/DREAMPlace
146c3b9fd003d1acd52c96d9fd02e3f0a05154e4
dreamplace/ops/dct/discrete_spectral_transform.py
python
idsct2
(x, expk_0=None, expk_1=None)
return idxt(idxt(x, 0, expk_1).transpose_(dim0=-2, dim1=-1), 1, expk_0).transpose_(dim0=-2, dim1=-1)
Batch 2D Inverse Discrete Sine-Cosine Transformation without normalization to coefficients. It computes following equation, which is slightly different from standard DCT formulation. y_{u, v} = \sum_p \sum_q x_{p, q} sin(pi/M*p*(u+0.5)) cos(pi/N*q*(v+0.5)) Compute 1D DST and then 1D DCT. @param x batch tensor, the 2D part is MxN @param expk_0 with length M, 2*exp(-1j*pi*k/(2M)) @param expk_1 with length N, 2*exp(-1j*pi*k/(2N))
Batch 2D Inverse Discrete Sine-Cosine Transformation without normalization to coefficients. It computes following equation, which is slightly different from standard DCT formulation. y_{u, v} = \sum_p \sum_q x_{p, q} sin(pi/M*p*(u+0.5)) cos(pi/N*q*(v+0.5)) Compute 1D DST and then 1D DCT.
[ "Batch", "2D", "Inverse", "Discrete", "Sine", "-", "Cosine", "Transformation", "without", "normalization", "to", "coefficients", ".", "It", "computes", "following", "equation", "which", "is", "slightly", "different", "from", "standard", "DCT", "formulation", ".", ...
def idsct2(x, expk_0=None, expk_1=None): """ Batch 2D Inverse Discrete Sine-Cosine Transformation without normalization to coefficients. It computes following equation, which is slightly different from standard DCT formulation. y_{u, v} = \sum_p \sum_q x_{p, q} sin(pi/M*p*(u+0.5)) cos(pi/N*q*(v+0.5)) Compute 1D DST and then 1D DCT. @param x batch tensor, the 2D part is MxN @param expk_0 with length M, 2*exp(-1j*pi*k/(2M)) @param expk_1 with length N, 2*exp(-1j*pi*k/(2N)) """ return idxt(idxt(x, 0, expk_1).transpose_(dim0=-2, dim1=-1), 1, expk_0).transpose_(dim0=-2, dim1=-1)
[ "def", "idsct2", "(", "x", ",", "expk_0", "=", "None", ",", "expk_1", "=", "None", ")", ":", "return", "idxt", "(", "idxt", "(", "x", ",", "0", ",", "expk_1", ")", ".", "transpose_", "(", "dim0", "=", "-", "2", ",", "dim1", "=", "-", "1", ")"...
https://github.com/limbo018/DREAMPlace/blob/146c3b9fd003d1acd52c96d9fd02e3f0a05154e4/dreamplace/ops/dct/discrete_spectral_transform.py#L385-L394
aws/lumberyard
f85344403c1c2e77ec8c75deb2c116e97b713217
dev/Gems/CloudGemMetric/v1/AWS/common-code/Lib/psutil/__init__.py
python
net_if_stats
()
return _psplatform.net_if_stats()
Return information about each NIC (network interface card) installed on the system as a dictionary whose keys are the NIC names and value is a namedtuple with the following fields: - isup: whether the interface is up (bool) - duplex: can be either NIC_DUPLEX_FULL, NIC_DUPLEX_HALF or NIC_DUPLEX_UNKNOWN - speed: the NIC speed expressed in mega bits (MB); if it can't be determined (e.g. 'localhost') it will be set to 0. - mtu: the maximum transmission unit expressed in bytes.
Return information about each NIC (network interface card) installed on the system as a dictionary whose keys are the NIC names and value is a namedtuple with the following fields:
[ "Return", "information", "about", "each", "NIC", "(", "network", "interface", "card", ")", "installed", "on", "the", "system", "as", "a", "dictionary", "whose", "keys", "are", "the", "NIC", "names", "and", "value", "is", "a", "namedtuple", "with", "the", "...
def net_if_stats(): """Return information about each NIC (network interface card) installed on the system as a dictionary whose keys are the NIC names and value is a namedtuple with the following fields: - isup: whether the interface is up (bool) - duplex: can be either NIC_DUPLEX_FULL, NIC_DUPLEX_HALF or NIC_DUPLEX_UNKNOWN - speed: the NIC speed expressed in mega bits (MB); if it can't be determined (e.g. 'localhost') it will be set to 0. - mtu: the maximum transmission unit expressed in bytes. """ return _psplatform.net_if_stats()
[ "def", "net_if_stats", "(", ")", ":", "return", "_psplatform", ".", "net_if_stats", "(", ")" ]
https://github.com/aws/lumberyard/blob/f85344403c1c2e77ec8c75deb2c116e97b713217/dev/Gems/CloudGemMetric/v1/AWS/common-code/Lib/psutil/__init__.py#L2206-L2218
ricardoquesada/Spidermonkey
4a75ea2543408bd1b2c515aa95901523eeef7858
media/webrtc/trunk/tools/gyp/pylib/gyp/generator/android.py
python
AndroidMkWriter.ExtractIncludesFromCFlags
(self, cflags)
return (clean_cflags, include_paths)
Extract includes "-I..." out from cflags Args: cflags: A list of compiler flags, which may be mixed with "-I.." Returns: A tuple of lists: (clean_clfags, include_paths). "-I.." is trimmed.
Extract includes "-I..." out from cflags
[ "Extract", "includes", "-", "I", "...", "out", "from", "cflags" ]
def ExtractIncludesFromCFlags(self, cflags): """Extract includes "-I..." out from cflags Args: cflags: A list of compiler flags, which may be mixed with "-I.." Returns: A tuple of lists: (clean_clfags, include_paths). "-I.." is trimmed. """ clean_cflags = [] include_paths = [] if cflags: for flag in cflags: if flag.startswith('-I'): include_paths.append(flag[2:]) else: clean_cflags.append(flag) return (clean_cflags, include_paths)
[ "def", "ExtractIncludesFromCFlags", "(", "self", ",", "cflags", ")", ":", "clean_cflags", "=", "[", "]", "include_paths", "=", "[", "]", "if", "cflags", ":", "for", "flag", "in", "cflags", ":", "if", "flag", ".", "startswith", "(", "'-I'", ")", ":", "i...
https://github.com/ricardoquesada/Spidermonkey/blob/4a75ea2543408bd1b2c515aa95901523eeef7858/media/webrtc/trunk/tools/gyp/pylib/gyp/generator/android.py#L724-L741
wlanjie/AndroidFFmpeg
7baf9122f4b8e1c74e7baf4be5c422c7a5ba5aaf
tools/fdk-aac-build/armeabi-v7a/toolchain/lib/python2.7/lib-tk/Tkinter.py
python
Text.delete
(self, index1, index2=None)
Delete the characters between INDEX1 and INDEX2 (not included).
Delete the characters between INDEX1 and INDEX2 (not included).
[ "Delete", "the", "characters", "between", "INDEX1", "and", "INDEX2", "(", "not", "included", ")", "." ]
def delete(self, index1, index2=None): """Delete the characters between INDEX1 and INDEX2 (not included).""" self.tk.call(self._w, 'delete', index1, index2)
[ "def", "delete", "(", "self", ",", "index1", ",", "index2", "=", "None", ")", ":", "self", ".", "tk", ".", "call", "(", "self", ".", "_w", ",", "'delete'", ",", "index1", ",", "index2", ")" ]
https://github.com/wlanjie/AndroidFFmpeg/blob/7baf9122f4b8e1c74e7baf4be5c422c7a5ba5aaf/tools/fdk-aac-build/armeabi-v7a/toolchain/lib/python2.7/lib-tk/Tkinter.py#L2913-L2915
intel-iot-devkit/how-to-code-samples
b4ea616f36bbfa2e042beb1698f968cfd651d79f
close-call-reporter/python/iot_close_call_reporter/__main__.py
python
main
()
Start main function.
Start main function.
[ "Start", "main", "function", "." ]
def main(): """ Start main function. """ runner = Runner() print("Running {0} example.".format(runner.project_name)) runner.start() def signal_handle(sig, frame): reactor.stop() _exit(0) signal(SIGINT, signal_handle) reactor.run(installSignalHandlers=0)
[ "def", "main", "(", ")", ":", "runner", "=", "Runner", "(", ")", "print", "(", "\"Running {0} example.\"", ".", "format", "(", "runner", ".", "project_name", ")", ")", "runner", ".", "start", "(", ")", "def", "signal_handle", "(", "sig", ",", "frame", ...
https://github.com/intel-iot-devkit/how-to-code-samples/blob/b4ea616f36bbfa2e042beb1698f968cfd651d79f/close-call-reporter/python/iot_close_call_reporter/__main__.py#L32-L48
wlanjie/AndroidFFmpeg
7baf9122f4b8e1c74e7baf4be5c422c7a5ba5aaf
tools/fdk-aac-build/armeabi/toolchain/lib/python2.7/platform.py
python
_platform
(*args)
return platform
Helper to format the platform string in a filename compatible format e.g. "system-version-machine".
Helper to format the platform string in a filename compatible format e.g. "system-version-machine".
[ "Helper", "to", "format", "the", "platform", "string", "in", "a", "filename", "compatible", "format", "e", ".", "g", ".", "system", "-", "version", "-", "machine", "." ]
def _platform(*args): """ Helper to format the platform string in a filename compatible format e.g. "system-version-machine". """ # Format the platform string platform = string.join( map(string.strip, filter(len, args)), '-') # Cleanup some possible filename obstacles... replace = string.replace platform = replace(platform,' ','_') platform = replace(platform,'/','-') platform = replace(platform,'\\','-') platform = replace(platform,':','-') platform = replace(platform,';','-') platform = replace(platform,'"','-') platform = replace(platform,'(','-') platform = replace(platform,')','-') # No need to report 'unknown' information... platform = replace(platform,'unknown','') # Fold '--'s and remove trailing '-' while 1: cleaned = replace(platform,'--','-') if cleaned == platform: break platform = cleaned while platform[-1] == '-': platform = platform[:-1] return platform
[ "def", "_platform", "(", "*", "args", ")", ":", "# Format the platform string", "platform", "=", "string", ".", "join", "(", "map", "(", "string", ".", "strip", ",", "filter", "(", "len", ",", "args", ")", ")", ",", "'-'", ")", "# Cleanup some possible fil...
https://github.com/wlanjie/AndroidFFmpeg/blob/7baf9122f4b8e1c74e7baf4be5c422c7a5ba5aaf/tools/fdk-aac-build/armeabi/toolchain/lib/python2.7/platform.py#L922-L956
CRYTEK/CRYENGINE
232227c59a220cbbd311576f0fbeba7bb53b2a8c
Code/Tools/waf-1.7.13/waflib/Configure.py
python
ConfigurationContext.eval_rules
(self, rules)
Execute the configuration tests. The method :py:meth:`waflib.Configure.ConfigurationContext.err_handler` is used to process the eventual exceptions :param rules: list of configuration method names :type rules: list of string
Execute the configuration tests. The method :py:meth:`waflib.Configure.ConfigurationContext.err_handler` is used to process the eventual exceptions
[ "Execute", "the", "configuration", "tests", ".", "The", "method", ":", "py", ":", "meth", ":", "waflib", ".", "Configure", ".", "ConfigurationContext", ".", "err_handler", "is", "used", "to", "process", "the", "eventual", "exceptions" ]
def eval_rules(self, rules): """ Execute the configuration tests. The method :py:meth:`waflib.Configure.ConfigurationContext.err_handler` is used to process the eventual exceptions :param rules: list of configuration method names :type rules: list of string """ self.rules = Utils.to_list(rules) for x in self.rules: f = getattr(self, x) if not f: self.fatal("No such method '%s'." % x) try: f() except Exception as e: ret = self.err_handler(x, e) if ret == BREAK: break elif ret == CONTINUE: continue else: raise
[ "def", "eval_rules", "(", "self", ",", "rules", ")", ":", "self", ".", "rules", "=", "Utils", ".", "to_list", "(", "rules", ")", "for", "x", "in", "self", ".", "rules", ":", "f", "=", "getattr", "(", "self", ",", "x", ")", "if", "not", "f", ":"...
https://github.com/CRYTEK/CRYENGINE/blob/232227c59a220cbbd311576f0fbeba7bb53b2a8c/Code/Tools/waf-1.7.13/waflib/Configure.py#L356-L377
eventql/eventql
7ca0dbb2e683b525620ea30dc40540a22d5eb227
deps/3rdparty/spidermonkey/mozjs/media/webrtc/trunk/tools/gyp/pylib/gyp/MSVSVersion.py
python
VisualStudioVersion.Path
(self)
return self.path
Returns the path to Visual Studio installation.
Returns the path to Visual Studio installation.
[ "Returns", "the", "path", "to", "Visual", "Studio", "installation", "." ]
def Path(self): """Returns the path to Visual Studio installation.""" return self.path
[ "def", "Path", "(", "self", ")", ":", "return", "self", ".", "path" ]
https://github.com/eventql/eventql/blob/7ca0dbb2e683b525620ea30dc40540a22d5eb227/deps/3rdparty/spidermonkey/mozjs/media/webrtc/trunk/tools/gyp/pylib/gyp/MSVSVersion.py#L57-L59
generalized-intelligence/GAAS
29ab17d3e8a4ba18edef3a57c36d8db6329fac73
algorithms/src/LocalizationAndMapping/icp_lidar_localization/fast_gicp/thirdparty/pybind11/pybind11/setup_helpers.py
python
has_flag
(compiler, flag)
Return the flag if a flag name is supported on the specified compiler, otherwise None (can be used as a boolean). If multiple flags are passed, return the first that matches.
Return the flag if a flag name is supported on the specified compiler, otherwise None (can be used as a boolean). If multiple flags are passed, return the first that matches.
[ "Return", "the", "flag", "if", "a", "flag", "name", "is", "supported", "on", "the", "specified", "compiler", "otherwise", "None", "(", "can", "be", "used", "as", "a", "boolean", ")", ".", "If", "multiple", "flags", "are", "passed", "return", "the", "firs...
def has_flag(compiler, flag): """ Return the flag if a flag name is supported on the specified compiler, otherwise None (can be used as a boolean). If multiple flags are passed, return the first that matches. """ with tmp_chdir(): fname = "flagcheck.cpp" with open(fname, "w") as f: # Don't trigger -Wunused-parameter. f.write("int main (int, char **) { return 0; }") try: compiler.compile([fname], extra_postargs=[flag]) except distutils.errors.CompileError: return False return True
[ "def", "has_flag", "(", "compiler", ",", "flag", ")", ":", "with", "tmp_chdir", "(", ")", ":", "fname", "=", "\"flagcheck.cpp\"", "with", "open", "(", "fname", ",", "\"w\"", ")", "as", "f", ":", "# Don't trigger -Wunused-parameter.", "f", ".", "write", "("...
https://github.com/generalized-intelligence/GAAS/blob/29ab17d3e8a4ba18edef3a57c36d8db6329fac73/algorithms/src/LocalizationAndMapping/icp_lidar_localization/fast_gicp/thirdparty/pybind11/pybind11/setup_helpers.py#L232-L249
aws/lumberyard
f85344403c1c2e77ec8c75deb2c116e97b713217
dev/Gems/CloudGemMetric/v1/AWS/python/windows/Lib/llvmlite/binding/initfini.py
python
initialize_all_asmprinters
()
Initialize all code generators. Necessary before generating any assembly or machine code via the :meth:`TargetMachine.emit_object` and :meth:`TargetMachine.emit_assembly` methods.
Initialize all code generators. Necessary before generating any assembly or machine code via the :meth:`TargetMachine.emit_object` and :meth:`TargetMachine.emit_assembly` methods.
[ "Initialize", "all", "code", "generators", ".", "Necessary", "before", "generating", "any", "assembly", "or", "machine", "code", "via", "the", ":", "meth", ":", "TargetMachine", ".", "emit_object", "and", ":", "meth", ":", "TargetMachine", ".", "emit_assembly", ...
def initialize_all_asmprinters(): """ Initialize all code generators. Necessary before generating any assembly or machine code via the :meth:`TargetMachine.emit_object` and :meth:`TargetMachine.emit_assembly` methods. """ ffi.lib.LLVMPY_InitializeAllAsmPrinters()
[ "def", "initialize_all_asmprinters", "(", ")", ":", "ffi", ".", "lib", ".", "LLVMPY_InitializeAllAsmPrinters", "(", ")" ]
https://github.com/aws/lumberyard/blob/f85344403c1c2e77ec8c75deb2c116e97b713217/dev/Gems/CloudGemMetric/v1/AWS/python/windows/Lib/llvmlite/binding/initfini.py#L22-L28
wxWidgets/wxPython-Classic
19571e1ae65f1ac445f5491474121998c97a1bf0
src/osx_carbon/_gdi.py
python
IconLocation.IsOk
(*args, **kwargs)
return _gdi_.IconLocation_IsOk(*args, **kwargs)
IsOk(self) -> bool
IsOk(self) -> bool
[ "IsOk", "(", "self", ")", "-", ">", "bool" ]
def IsOk(*args, **kwargs): """IsOk(self) -> bool""" return _gdi_.IconLocation_IsOk(*args, **kwargs)
[ "def", "IsOk", "(", "*", "args", ",", "*", "*", "kwargs", ")", ":", "return", "_gdi_", ".", "IconLocation_IsOk", "(", "*", "args", ",", "*", "*", "kwargs", ")" ]
https://github.com/wxWidgets/wxPython-Classic/blob/19571e1ae65f1ac445f5491474121998c97a1bf0/src/osx_carbon/_gdi.py#L1351-L1353
catboost/catboost
167f64f237114a4d10b2b4ee42adb4569137debe
contrib/python/scikit-learn/py2/sklearn/calibration.py
python
_CalibratedClassifier.predict_proba
(self, X)
return proba
Posterior probabilities of classification This function returns posterior probabilities of classification according to each class on an array of test vectors X. Parameters ---------- X : array-like, shape (n_samples, n_features) The samples. Returns ------- C : array, shape (n_samples, n_classes) The predicted probas. Can be exact zeros.
Posterior probabilities of classification
[ "Posterior", "probabilities", "of", "classification" ]
def predict_proba(self, X): """Posterior probabilities of classification This function returns posterior probabilities of classification according to each class on an array of test vectors X. Parameters ---------- X : array-like, shape (n_samples, n_features) The samples. Returns ------- C : array, shape (n_samples, n_classes) The predicted probas. Can be exact zeros. """ n_classes = len(self.classes_) proba = np.zeros((X.shape[0], n_classes)) df, idx_pos_class = self._preproc(X) for k, this_df, calibrator in \ zip(idx_pos_class, df.T, self.calibrators_): if n_classes == 2: k += 1 proba[:, k] = calibrator.predict(this_df) # Normalize the probabilities if n_classes == 2: proba[:, 0] = 1. - proba[:, 1] else: proba /= np.sum(proba, axis=1)[:, np.newaxis] # XXX : for some reason all probas can be 0 proba[np.isnan(proba)] = 1. / n_classes # Deal with cases where the predicted probability minimally exceeds 1.0 proba[(1.0 < proba) & (proba <= 1.0 + 1e-5)] = 1.0 return proba
[ "def", "predict_proba", "(", "self", ",", "X", ")", ":", "n_classes", "=", "len", "(", "self", ".", "classes_", ")", "proba", "=", "np", ".", "zeros", "(", "(", "X", ".", "shape", "[", "0", "]", ",", "n_classes", ")", ")", "df", ",", "idx_pos_cla...
https://github.com/catboost/catboost/blob/167f64f237114a4d10b2b4ee42adb4569137debe/contrib/python/scikit-learn/py2/sklearn/calibration.py#L348-L387
wxWidgets/wxPython-Classic
19571e1ae65f1ac445f5491474121998c97a1bf0
src/gtk/propgrid.py
python
PGChoices.AllocExclusive
(*args, **kwargs)
return _propgrid.PGChoices_AllocExclusive(*args, **kwargs)
AllocExclusive(self)
AllocExclusive(self)
[ "AllocExclusive", "(", "self", ")" ]
def AllocExclusive(*args, **kwargs): """AllocExclusive(self)""" return _propgrid.PGChoices_AllocExclusive(*args, **kwargs)
[ "def", "AllocExclusive", "(", "*", "args", ",", "*", "*", "kwargs", ")", ":", "return", "_propgrid", ".", "PGChoices_AllocExclusive", "(", "*", "args", ",", "*", "*", "kwargs", ")" ]
https://github.com/wxWidgets/wxPython-Classic/blob/19571e1ae65f1ac445f5491474121998c97a1bf0/src/gtk/propgrid.py#L326-L328
facebook/watchman
0917460c71b000b96be9b9575d77f06f2f6053bb
build/fbcode_builder/getdeps/builder.py
python
CargoBuilder._resolve_dep_to_crates
(build_source_dir, dep_to_git)
return dep_to_crates
This function traverse the build_source_dir in search of Cargo.toml files, extracts the crate names from them using _extract_crates function and returns a merged result containing crate names per dependency name from all Cargo.toml files in the project.
This function traverse the build_source_dir in search of Cargo.toml files, extracts the crate names from them using _extract_crates function and returns a merged result containing crate names per dependency name from all Cargo.toml files in the project.
[ "This", "function", "traverse", "the", "build_source_dir", "in", "search", "of", "Cargo", ".", "toml", "files", "extracts", "the", "crate", "names", "from", "them", "using", "_extract_crates", "function", "and", "returns", "a", "merged", "result", "containing", ...
def _resolve_dep_to_crates(build_source_dir, dep_to_git): """ This function traverse the build_source_dir in search of Cargo.toml files, extracts the crate names from them using _extract_crates function and returns a merged result containing crate names per dependency name from all Cargo.toml files in the project. """ if not dep_to_git: return {} # no deps, so don't waste time traversing files dep_to_crates = {} for root, _, files in os.walk(build_source_dir): for f in files: if f == "Cargo.toml": more_dep_to_crates = CargoBuilder._extract_crates( os.path.join(root, f), dep_to_git ) for name, crates in more_dep_to_crates.items(): dep_to_crates.setdefault(name, set()).update(crates) return dep_to_crates
[ "def", "_resolve_dep_to_crates", "(", "build_source_dir", ",", "dep_to_git", ")", ":", "if", "not", "dep_to_git", ":", "return", "{", "}", "# no deps, so don't waste time traversing files", "dep_to_crates", "=", "{", "}", "for", "root", ",", "_", ",", "files", "in...
https://github.com/facebook/watchman/blob/0917460c71b000b96be9b9575d77f06f2f6053bb/build/fbcode_builder/getdeps/builder.py#L1431-L1450
aws/lumberyard
f85344403c1c2e77ec8c75deb2c116e97b713217
dev/Gems/CloudGemMetric/v1/AWS/common-code/Lib/pandas/core/window/ewm.py
python
EWM.mean
(self, *args, **kwargs)
return self._apply("ewma", **kwargs)
Exponential weighted moving average. Parameters ---------- *args, **kwargs Arguments and keyword arguments to be passed into func.
Exponential weighted moving average.
[ "Exponential", "weighted", "moving", "average", "." ]
def mean(self, *args, **kwargs): """ Exponential weighted moving average. Parameters ---------- *args, **kwargs Arguments and keyword arguments to be passed into func. """ nv.validate_window_func("mean", args, kwargs) return self._apply("ewma", **kwargs)
[ "def", "mean", "(", "self", ",", "*", "args", ",", "*", "*", "kwargs", ")", ":", "nv", ".", "validate_window_func", "(", "\"mean\"", ",", "args", ",", "kwargs", ")", "return", "self", ".", "_apply", "(", "\"ewma\"", ",", "*", "*", "kwargs", ")" ]
https://github.com/aws/lumberyard/blob/f85344403c1c2e77ec8c75deb2c116e97b713217/dev/Gems/CloudGemMetric/v1/AWS/common-code/Lib/pandas/core/window/ewm.py#L257-L267
openthread/openthread
9fcdbed9c526c70f1556d1ed84099c1535c7cd32
tools/otci/otci/otci.py
python
OTCI.get_ifconfig_state
(self)
return self.__parse_values(self.execute_command('ifconfig'), up=True, down=False)
Get the status of the IPv6 interface.
Get the status of the IPv6 interface.
[ "Get", "the", "status", "of", "the", "IPv6", "interface", "." ]
def get_ifconfig_state(self) -> bool: """Get the status of the IPv6 interface.""" return self.__parse_values(self.execute_command('ifconfig'), up=True, down=False)
[ "def", "get_ifconfig_state", "(", "self", ")", "->", "bool", ":", "return", "self", ".", "__parse_values", "(", "self", ".", "execute_command", "(", "'ifconfig'", ")", ",", "up", "=", "True", ",", "down", "=", "False", ")" ]
https://github.com/openthread/openthread/blob/9fcdbed9c526c70f1556d1ed84099c1535c7cd32/tools/otci/otci/otci.py#L193-L195
lballabio/quantlib-old
136336947ed4fea9ecc1da6edad188700e821739
gensrc/gensrc/serialization/serializable.py
python
Serializable.groupName
(self)
return self.groupName_
Return unique identifier for this object.
Return unique identifier for this object.
[ "Return", "unique", "identifier", "for", "this", "object", "." ]
def groupName(self): """Return unique identifier for this object.""" return self.groupName_
[ "def", "groupName", "(", "self", ")", ":", "return", "self", ".", "groupName_" ]
https://github.com/lballabio/quantlib-old/blob/136336947ed4fea9ecc1da6edad188700e821739/gensrc/gensrc/serialization/serializable.py#L42-L44
miyosuda/TensorFlowAndroidDemo
35903e0221aa5f109ea2dbef27f20b52e317f42d
jni-build/jni/include/external/bazel_tools/tools/android/merge_manifests.py
python
MergeManifests._RemoveAndroidLabel
(self, node)
Remove android:label. We do this because it is not required by merger manifest, and it might contain @string references that will not allow compilation. Args: node: Node for which to remove Android labels.
Remove android:label.
[ "Remove", "android", ":", "label", "." ]
def _RemoveAndroidLabel(self, node): """Remove android:label. We do this because it is not required by merger manifest, and it might contain @string references that will not allow compilation. Args: node: Node for which to remove Android labels. """ if node.hasAttribute(self._ANDROID_LABEL): node.removeAttribute(self._ANDROID_LABEL)
[ "def", "_RemoveAndroidLabel", "(", "self", ",", "node", ")", ":", "if", "node", ".", "hasAttribute", "(", "self", ".", "_ANDROID_LABEL", ")", ":", "node", ".", "removeAttribute", "(", "self", ".", "_ANDROID_LABEL", ")" ]
https://github.com/miyosuda/TensorFlowAndroidDemo/blob/35903e0221aa5f109ea2dbef27f20b52e317f42d/jni-build/jni/include/external/bazel_tools/tools/android/merge_manifests.py#L200-L210
H-uru/Plasma
c2140ea046e82e9c199e257a7f2e7edb42602871
Scripts/Python/kdshTreeRings.py
python
kdshTreeRings.__del__
(self)
unload the dialog that we loaded
unload the dialog that we loaded
[ "unload", "the", "dialog", "that", "we", "loaded" ]
def __del__(self): "unload the dialog that we loaded"
[ "def", "__del__", "(", "self", ")", ":" ]
https://github.com/H-uru/Plasma/blob/c2140ea046e82e9c199e257a7f2e7edb42602871/Scripts/Python/kdshTreeRings.py#L215-L216
baidu/bigflow
449245016c0df7d1252e85581e588bfc60cefad3
bigflow_python/python/bigflow/util/utils.py
python
detect_ptype
(runtime_value)
Detect the default PType type for a runtime value Args: runtime_value (object): a runtime value, cannot be PType Returns: class: detected PType class
Detect the default PType type for a runtime value
[ "Detect", "the", "default", "PType", "type", "for", "a", "runtime", "value" ]
def detect_ptype(runtime_value): """ Detect the default PType type for a runtime value Args: runtime_value (object): a runtime value, cannot be PType Returns: class: detected PType class """ import collections def helper(nested_level, v): if isinstance(v, collections.MutableMapping): return helper(nested_level + 1, v.values()[0]) elif isinstance(v, list): return nested_level, pcollection.PCollection else: return nested_level, pobject.PObject if isinstance(runtime_value, ptype.PType): raise ValueError("Input cannot be PType") if isinstance(runtime_value, collections.MutableMapping): return helper(0, runtime_value.values()[0]) elif isinstance(runtime_value, list): return -1, pcollection.PCollection else: return -1, pobject.PObject
[ "def", "detect_ptype", "(", "runtime_value", ")", ":", "import", "collections", "def", "helper", "(", "nested_level", ",", "v", ")", ":", "if", "isinstance", "(", "v", ",", "collections", ".", "MutableMapping", ")", ":", "return", "helper", "(", "nested_leve...
https://github.com/baidu/bigflow/blob/449245016c0df7d1252e85581e588bfc60cefad3/bigflow_python/python/bigflow/util/utils.py#L95-L123
wlanjie/AndroidFFmpeg
7baf9122f4b8e1c74e7baf4be5c422c7a5ba5aaf
tools/fdk-aac-build/armeabi-v7a/toolchain/lib/python2.7/lib2to3/refactor.py
python
get_all_fix_names
(fixer_pkg, remove_prefix=True)
return fix_names
Return a sorted list of all available fix names in the given package.
Return a sorted list of all available fix names in the given package.
[ "Return", "a", "sorted", "list", "of", "all", "available", "fix", "names", "in", "the", "given", "package", "." ]
def get_all_fix_names(fixer_pkg, remove_prefix=True): """Return a sorted list of all available fix names in the given package.""" pkg = __import__(fixer_pkg, [], [], ["*"]) fixer_dir = os.path.dirname(pkg.__file__) fix_names = [] for name in sorted(os.listdir(fixer_dir)): if name.startswith("fix_") and name.endswith(".py"): if remove_prefix: name = name[4:] fix_names.append(name[:-3]) return fix_names
[ "def", "get_all_fix_names", "(", "fixer_pkg", ",", "remove_prefix", "=", "True", ")", ":", "pkg", "=", "__import__", "(", "fixer_pkg", ",", "[", "]", ",", "[", "]", ",", "[", "\"*\"", "]", ")", "fixer_dir", "=", "os", ".", "path", ".", "dirname", "("...
https://github.com/wlanjie/AndroidFFmpeg/blob/7baf9122f4b8e1c74e7baf4be5c422c7a5ba5aaf/tools/fdk-aac-build/armeabi-v7a/toolchain/lib/python2.7/lib2to3/refactor.py#L33-L43
wxWidgets/wxPython-Classic
19571e1ae65f1ac445f5491474121998c97a1bf0
src/gtk/html.py
python
HtmlCell.FindCellByPos
(*args, **kwargs)
return _html.HtmlCell_FindCellByPos(*args, **kwargs)
FindCellByPos(self, int x, int y, unsigned int flags=HTML_FIND_EXACT) -> HtmlCell
FindCellByPos(self, int x, int y, unsigned int flags=HTML_FIND_EXACT) -> HtmlCell
[ "FindCellByPos", "(", "self", "int", "x", "int", "y", "unsigned", "int", "flags", "=", "HTML_FIND_EXACT", ")", "-", ">", "HtmlCell" ]
def FindCellByPos(*args, **kwargs): """FindCellByPos(self, int x, int y, unsigned int flags=HTML_FIND_EXACT) -> HtmlCell""" return _html.HtmlCell_FindCellByPos(*args, **kwargs)
[ "def", "FindCellByPos", "(", "*", "args", ",", "*", "*", "kwargs", ")", ":", "return", "_html", ".", "HtmlCell_FindCellByPos", "(", "*", "args", ",", "*", "*", "kwargs", ")" ]
https://github.com/wxWidgets/wxPython-Classic/blob/19571e1ae65f1ac445f5491474121998c97a1bf0/src/gtk/html.py#L714-L716
p4lang/behavioral-model
81ce0163f0770c6b9d6056a28ce2e0cc035bb6e9
tools/cpplint.py
python
_IsParentOrSame
(parent, child)
return child == os.path.join(prefix, child_suffix)
Return true if child is subdirectory of parent. Assumes both paths are absolute and don't contain symlinks.
Return true if child is subdirectory of parent. Assumes both paths are absolute and don't contain symlinks.
[ "Return", "true", "if", "child", "is", "subdirectory", "of", "parent", ".", "Assumes", "both", "paths", "are", "absolute", "and", "don", "t", "contain", "symlinks", "." ]
def _IsParentOrSame(parent, child): """Return true if child is subdirectory of parent. Assumes both paths are absolute and don't contain symlinks. """ parent = os.path.normpath(parent) child = os.path.normpath(child) if parent == child: return True prefix = os.path.commonprefix([parent, child]) if prefix != parent: return False # Note: os.path.commonprefix operates on character basis, so # take extra care of situations like '/foo/ba' and '/foo/bar/baz' child_suffix = child[len(prefix):] child_suffix = child_suffix.lstrip(os.sep) return child == os.path.join(prefix, child_suffix)
[ "def", "_IsParentOrSame", "(", "parent", ",", "child", ")", ":", "parent", "=", "os", ".", "path", ".", "normpath", "(", "parent", ")", "child", "=", "os", ".", "path", ".", "normpath", "(", "child", ")", "if", "parent", "==", "child", ":", "return",...
https://github.com/p4lang/behavioral-model/blob/81ce0163f0770c6b9d6056a28ce2e0cc035bb6e9/tools/cpplint.py#L6858-L6874
benoitsteiner/tensorflow-opencl
cb7cb40a57fde5cfd4731bc551e82a1e2fef43a5
tensorflow/python/debug/lib/grpc_debug_server.py
python
EventListenerBaseStreamHandler.__init__
(self)
Constructor of EventListenerBaseStreamHandler.
Constructor of EventListenerBaseStreamHandler.
[ "Constructor", "of", "EventListenerBaseStreamHandler", "." ]
def __init__(self): """Constructor of EventListenerBaseStreamHandler."""
[ "def", "__init__", "(", "self", ")", ":" ]
https://github.com/benoitsteiner/tensorflow-opencl/blob/cb7cb40a57fde5cfd4731bc551e82a1e2fef43a5/tensorflow/python/debug/lib/grpc_debug_server.py#L53-L54
deeplearningais/CUV
4e920ad1304af9de3e5f755cc2e9c5c96e06c324
examples/mlp/multi_layer_perceptron.py
python
MLP.__init__
(self, neurons, batch_size)
Constructor @param neurons -- array of sizes of layers. @param batch_size -- size of batch being used for training.
Constructor
[ "Constructor" ]
def __init__(self, neurons, batch_size): """ Constructor @param neurons -- array of sizes of layers. @param batch_size -- size of batch being used for training. """ self.n_layers = len(neurons) - 1 self.batch_size = batch_size self.neuron_layers = [] self.weight_layers = [] print("Training MLP with %d hidden layer(s)." % (self.n_layers - 1)) for i in xrange(self.n_layers + 1): dim1 = neurons[i] self.neuron_layers.append(neuron_layer(dim1, self.batch_size)) for i in xrange(self.n_layers): self.weight_layers.append(weight_layer(self.neuron_layers[i], self.neuron_layers[i + 1]))
[ "def", "__init__", "(", "self", ",", "neurons", ",", "batch_size", ")", ":", "self", ".", "n_layers", "=", "len", "(", "neurons", ")", "-", "1", "self", ".", "batch_size", "=", "batch_size", "self", ".", "neuron_layers", "=", "[", "]", "self", ".", "...
https://github.com/deeplearningais/CUV/blob/4e920ad1304af9de3e5f755cc2e9c5c96e06c324/examples/mlp/multi_layer_perceptron.py#L23-L42
Xilinx/Vitis-AI
fc74d404563d9951b57245443c73bef389f3657f
tools/Vitis-AI-Quantizer/vai_q_tensorflow1.x/tensorflow/contrib/distributions/python/ops/vector_sinh_arcsinh_diag.py
python
VectorSinhArcsinhDiag.loc
(self)
return self._loc
The `loc` in `Y := loc + scale @ F(Z) * (2 / F(2)).
The `loc` in `Y := loc + scale
[ "The", "loc", "in", "Y", ":", "=", "loc", "+", "scale" ]
def loc(self): """The `loc` in `Y := loc + scale @ F(Z) * (2 / F(2)).""" return self._loc
[ "def", "loc", "(", "self", ")", ":", "return", "self", ".", "_loc" ]
https://github.com/Xilinx/Vitis-AI/blob/fc74d404563d9951b57245443c73bef389f3657f/tools/Vitis-AI-Quantizer/vai_q_tensorflow1.x/tensorflow/contrib/distributions/python/ops/vector_sinh_arcsinh_diag.py#L257-L259