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
netket/netket
0d534e54ecbf25b677ea72af6b85947979420652
netket/hilbert/discrete_hilbert.py
python
DiscreteHilbert.states
(self)
r"""Returns an iterator over all valid configurations of the Hilbert space. Throws an exception iff the space is not indexable. Iterating over all states with this method is typically inefficient, and ```all_states``` should be prefered.
r"""Returns an iterator over all valid configurations of the Hilbert space. Throws an exception iff the space is not indexable. Iterating over all states with this method is typically inefficient, and ```all_states``` should be prefered.
[ "r", "Returns", "an", "iterator", "over", "all", "valid", "configurations", "of", "the", "Hilbert", "space", ".", "Throws", "an", "exception", "iff", "the", "space", "is", "not", "indexable", ".", "Iterating", "over", "all", "states", "with", "this", "method...
def states(self) -> Iterator[np.ndarray]: r"""Returns an iterator over all valid configurations of the Hilbert space. Throws an exception iff the space is not indexable. Iterating over all states with this method is typically inefficient, and ```all_states``` should be prefered. ...
[ "def", "states", "(", "self", ")", "->", "Iterator", "[", "np", ".", "ndarray", "]", ":", "for", "i", "in", "range", "(", "self", ".", "n_states", ")", ":", "yield", "self", ".", "numbers_to_states", "(", "i", ")", ".", "reshape", "(", "-", "1", ...
https://github.com/netket/netket/blob/0d534e54ecbf25b677ea72af6b85947979420652/netket/hilbert/discrete_hilbert.py#L183-L191
glotzerlab/hoomd-blue
f7f97abfa3fcc2522fa8d458d65d0aeca7ba781a
hoomd/logging.py
python
Logger.only_default
(self)
return self._only_default
`bool`: Whether the logger object should only grab default loggable \ quantities.
`bool`: Whether the logger object should only grab default loggable \ quantities.
[ "bool", ":", "Whether", "the", "logger", "object", "should", "only", "grab", "default", "loggable", "\\", "quantities", "." ]
def only_default(self): """`bool`: Whether the logger object should only grab default loggable \ quantities.""" return self._only_default
[ "def", "only_default", "(", "self", ")", ":", "return", "self", ".", "_only_default" ]
https://github.com/glotzerlab/hoomd-blue/blob/f7f97abfa3fcc2522fa8d458d65d0aeca7ba781a/hoomd/logging.py#L601-L604
mantidproject/mantid
03deeb89254ec4289edb8771e0188c2090a02f32
scripts/directtools/__init__.py
python
_dostitle
(workspaces, axes)
Add title to density-of-states axes.
Add title to density-of-states axes.
[ "Add", "title", "to", "density", "-", "of", "-", "states", "axes", "." ]
def _dostitle(workspaces, axes): """Add title to density-of-states axes.""" workspaces = _normwslist(workspaces) if len(workspaces) == 1: title = _singledatatitle(workspaces[0]) else: title = _plottingtime() logs = workspaces[0].run() instrument = _instrumentname(logs) ...
[ "def", "_dostitle", "(", "workspaces", ",", "axes", ")", ":", "workspaces", "=", "_normwslist", "(", "workspaces", ")", "if", "len", "(", "workspaces", ")", "==", "1", ":", "title", "=", "_singledatatitle", "(", "workspaces", "[", "0", "]", ")", "else", ...
https://github.com/mantidproject/mantid/blob/03deeb89254ec4289edb8771e0188c2090a02f32/scripts/directtools/__init__.py#L88-L99
miyosuda/TensorFlowAndroidDemo
35903e0221aa5f109ea2dbef27f20b52e317f42d
jni-build/jni/include/tensorflow/python/ops/math_ops.py
python
_as_indexed_slices_list
(inputs)
return casted_outputs
Convert all elements of 'inputs' to IndexedSlices. Additionally, homogenize the types of all the indices to either int32 or int64. Args: inputs: List containing either Tensor or IndexedSlices objects. Returns: A list of IndexedSlices objects. Raises: TypeError: If 'inputs' is not a list or a t...
Convert all elements of 'inputs' to IndexedSlices.
[ "Convert", "all", "elements", "of", "inputs", "to", "IndexedSlices", "." ]
def _as_indexed_slices_list(inputs): """Convert all elements of 'inputs' to IndexedSlices. Additionally, homogenize the types of all the indices to either int32 or int64. Args: inputs: List containing either Tensor or IndexedSlices objects. Returns: A list of IndexedSlices objects. Raises: T...
[ "def", "_as_indexed_slices_list", "(", "inputs", ")", ":", "if", "not", "isinstance", "(", "inputs", ",", "(", "list", ",", "tuple", ")", ")", ":", "raise", "TypeError", "(", "\"Expected a list or tuple, not a %s\"", "%", "type", "(", "inputs", ")", ")", "ou...
https://github.com/miyosuda/TensorFlowAndroidDemo/blob/35903e0221aa5f109ea2dbef27f20b52e317f42d/jni-build/jni/include/tensorflow/python/ops/math_ops.py#L1413-L1443
Komnomnomnom/swigibpy
cfd307fdbfaffabc69a2dc037538d7e34a8b8daf
swigibpy.py
python
EClientSocketBase.cancelMktData
(self, id)
return _swigibpy.EClientSocketBase_cancelMktData(self, id)
cancelMktData(EClientSocketBase self, TickerId id)
cancelMktData(EClientSocketBase self, TickerId id)
[ "cancelMktData", "(", "EClientSocketBase", "self", "TickerId", "id", ")" ]
def cancelMktData(self, id): """cancelMktData(EClientSocketBase self, TickerId id)""" return _swigibpy.EClientSocketBase_cancelMktData(self, id)
[ "def", "cancelMktData", "(", "self", ",", "id", ")", ":", "return", "_swigibpy", ".", "EClientSocketBase_cancelMktData", "(", "self", ",", "id", ")" ]
https://github.com/Komnomnomnom/swigibpy/blob/cfd307fdbfaffabc69a2dc037538d7e34a8b8daf/swigibpy.py#L1457-L1459
catboost/catboost
167f64f237114a4d10b2b4ee42adb4569137debe
contrib/tools/python3/src/Lib/statistics.py
python
NormalDist.__sub__
(x1, x2)
return NormalDist(x1._mu - x2, x1._sigma)
Subtract a constant or another NormalDist instance. If *other* is a constant, translate by the constant mu, leaving sigma unchanged. If *other* is a NormalDist, subtract the means and add the variances. Mathematically, this works only if the two distributions are independent or...
Subtract a constant or another NormalDist instance.
[ "Subtract", "a", "constant", "or", "another", "NormalDist", "instance", "." ]
def __sub__(x1, x2): """Subtract a constant or another NormalDist instance. If *other* is a constant, translate by the constant mu, leaving sigma unchanged. If *other* is a NormalDist, subtract the means and add the variances. Mathematically, this works only if the two distribu...
[ "def", "__sub__", "(", "x1", ",", "x2", ")", ":", "if", "isinstance", "(", "x2", ",", "NormalDist", ")", ":", "return", "NormalDist", "(", "x1", ".", "_mu", "-", "x2", ".", "_mu", ",", "hypot", "(", "x1", ".", "_sigma", ",", "x2", ".", "_sigma", ...
https://github.com/catboost/catboost/blob/167f64f237114a4d10b2b4ee42adb4569137debe/contrib/tools/python3/src/Lib/statistics.py#L1063-L1075
dogecoin/dogecoin
31afd133119dd2e15862d46530cb99424cf564b0
contrib/devtools/security-check.py
python
get_ELF_program_headers
(executable)
return headers
Return type and flags for ELF program headers
Return type and flags for ELF program headers
[ "Return", "type", "and", "flags", "for", "ELF", "program", "headers" ]
def get_ELF_program_headers(executable): '''Return type and flags for ELF program headers''' p = subprocess.Popen([READELF_CMD, '-l', '-W', executable], stdout=subprocess.PIPE, stderr=subprocess.PIPE, stdin=subprocess.PIPE) (stdout, stderr) = p.communicate() if p.returncode: raise IOError('Error...
[ "def", "get_ELF_program_headers", "(", "executable", ")", ":", "p", "=", "subprocess", ".", "Popen", "(", "[", "READELF_CMD", ",", "'-l'", ",", "'-W'", ",", "executable", "]", ",", "stdout", "=", "subprocess", ".", "PIPE", ",", "stderr", "=", "subprocess",...
https://github.com/dogecoin/dogecoin/blob/31afd133119dd2e15862d46530cb99424cf564b0/contrib/devtools/security-check.py#L36-L63
BlzFans/wke
b0fa21158312e40c5fbd84682d643022b6c34a93
cygwin/lib/python2.6/ntpath.py
python
ismount
(path)
return len(p) == 1 and p[0] in '/\\'
Test whether a path is a mount point (defined as root of drive)
Test whether a path is a mount point (defined as root of drive)
[ "Test", "whether", "a", "path", "is", "a", "mount", "point", "(", "defined", "as", "root", "of", "drive", ")" ]
def ismount(path): """Test whether a path is a mount point (defined as root of drive)""" unc, rest = splitunc(path) if unc: return rest in ("", "/", "\\") p = splitdrive(path)[1] return len(p) == 1 and p[0] in '/\\'
[ "def", "ismount", "(", "path", ")", ":", "unc", ",", "rest", "=", "splitunc", "(", "path", ")", "if", "unc", ":", "return", "rest", "in", "(", "\"\"", ",", "\"/\"", ",", "\"\\\\\"", ")", "p", "=", "splitdrive", "(", "path", ")", "[", "1", "]", ...
https://github.com/BlzFans/wke/blob/b0fa21158312e40c5fbd84682d643022b6c34a93/cygwin/lib/python2.6/ntpath.py#L222-L228
catboost/catboost
167f64f237114a4d10b2b4ee42adb4569137debe
contrib/tools/python/src/Lib/logging/handlers.py
python
MemoryHandler.close
(self)
Flush, set the target to None and lose the buffer.
Flush, set the target to None and lose the buffer.
[ "Flush", "set", "the", "target", "to", "None", "and", "lose", "the", "buffer", "." ]
def close(self): """ Flush, set the target to None and lose the buffer. """ try: self.flush() finally: self.acquire() try: self.target = None BufferingHandler.close(self) finally: self...
[ "def", "close", "(", "self", ")", ":", "try", ":", "self", ".", "flush", "(", ")", "finally", ":", "self", ".", "acquire", "(", ")", "try", ":", "self", ".", "target", "=", "None", "BufferingHandler", ".", "close", "(", "self", ")", "finally", ":",...
https://github.com/catboost/catboost/blob/167f64f237114a4d10b2b4ee42adb4569137debe/contrib/tools/python/src/Lib/logging/handlers.py#L1230-L1242
Polidea/SiriusObfuscator
b0e590d8130e97856afe578869b83a209e2b19be
SymbolExtractorAndRenamer/lldb/scripts/Python/static-binding/lldb.py
python
SBPlatform.SetWorkingDirectory
(self, *args)
return _lldb.SBPlatform_SetWorkingDirectory(self, *args)
SetWorkingDirectory(self, str arg0) -> bool
SetWorkingDirectory(self, str arg0) -> bool
[ "SetWorkingDirectory", "(", "self", "str", "arg0", ")", "-", ">", "bool" ]
def SetWorkingDirectory(self, *args): """SetWorkingDirectory(self, str arg0) -> bool""" return _lldb.SBPlatform_SetWorkingDirectory(self, *args)
[ "def", "SetWorkingDirectory", "(", "self", ",", "*", "args", ")", ":", "return", "_lldb", ".", "SBPlatform_SetWorkingDirectory", "(", "self", ",", "*", "args", ")" ]
https://github.com/Polidea/SiriusObfuscator/blob/b0e590d8130e97856afe578869b83a209e2b19be/SymbolExtractorAndRenamer/lldb/scripts/Python/static-binding/lldb.py#L6807-L6809
brave/brave-core
ceaa3de4735789d355b6fa80c21d4709e2c1d0e8
components/brave_perf_predictor/python/model.py
python
train_model
(print_params=False, reg=REGRESSOR)
return model.get_params()
Train Model
Train Model
[ "Train", "Model" ]
def train_model(print_params=False, reg=REGRESSOR): """ Train Model """ X_train, _, y_train, _, cat_cols, num_cols = _load_dataset(DATA_PATH) # Instantiate model and set best parameters from grid search model = _build_model(num_cols, cat_cols, reg) model = model.set_params(**BEST_PARAMS) ...
[ "def", "train_model", "(", "print_params", "=", "False", ",", "reg", "=", "REGRESSOR", ")", ":", "X_train", ",", "_", ",", "y_train", ",", "_", ",", "cat_cols", ",", "num_cols", "=", "_load_dataset", "(", "DATA_PATH", ")", "# Instantiate model and set best par...
https://github.com/brave/brave-core/blob/ceaa3de4735789d355b6fa80c21d4709e2c1d0e8/components/brave_perf_predictor/python/model.py#L129-L149
htcondor/htcondor
4829724575176d1d6c936e4693dfd78a728569b0
src/condor_scripts/adstash/utils.py
python
parse_history_ad_file
(adfile)
Generates one ClassAd at a time from adfile. Necessary because classad.parseAds() cannot handle files with "weird" ad separators (e.g. "**** metadataA=foo metadata2=bar")
Generates one ClassAd at a time from adfile. Necessary because classad.parseAds() cannot handle files with "weird" ad separators (e.g. "**** metadataA=foo metadata2=bar")
[ "Generates", "one", "ClassAd", "at", "a", "time", "from", "adfile", ".", "Necessary", "because", "classad", ".", "parseAds", "()", "cannot", "handle", "files", "with", "weird", "ad", "separators", "(", "e", ".", "g", ".", "****", "metadataA", "=", "foo", ...
def parse_history_ad_file(adfile): """ Generates one ClassAd at a time from adfile. Necessary because classad.parseAds() cannot handle files with "weird" ad separators (e.g. "**** metadataA=foo metadata2=bar") """ try: with open(adfile) as f: ad_string = "" fo...
[ "def", "parse_history_ad_file", "(", "adfile", ")", ":", "try", ":", "with", "open", "(", "adfile", ")", "as", "f", ":", "ad_string", "=", "\"\"", "for", "line", "in", "f", ":", "if", "line", ".", "startswith", "(", "\"***\"", ")", "or", "line", ".",...
https://github.com/htcondor/htcondor/blob/4829724575176d1d6c936e4693dfd78a728569b0/src/condor_scripts/adstash/utils.py#L190-L213
intel/llvm
e6d0547e9d99b5a56430c4749f6c7e328bf221ab
lldb/third_party/Python/module/pexpect-4.6/pexpect/pty_spawn.py
python
spawn.writelines
(self, sequence)
This calls write() for each element in the sequence. The sequence can be any iterable object producing strings, typically a list of strings. This does not add line separators. There is no return value.
This calls write() for each element in the sequence. The sequence can be any iterable object producing strings, typically a list of strings. This does not add line separators. There is no return value.
[ "This", "calls", "write", "()", "for", "each", "element", "in", "the", "sequence", ".", "The", "sequence", "can", "be", "any", "iterable", "object", "producing", "strings", "typically", "a", "list", "of", "strings", ".", "This", "does", "not", "add", "line...
def writelines(self, sequence): '''This calls write() for each element in the sequence. The sequence can be any iterable object producing strings, typically a list of strings. This does not add line separators. There is no return value. ''' for s in sequence: self.wr...
[ "def", "writelines", "(", "self", ",", "sequence", ")", ":", "for", "s", "in", "sequence", ":", "self", ".", "write", "(", "s", ")" ]
https://github.com/intel/llvm/blob/e6d0547e9d99b5a56430c4749f6c7e328bf221ab/lldb/third_party/Python/module/pexpect-4.6/pexpect/pty_spawn.py#L495-L502
Xilinx/Vitis-AI
fc74d404563d9951b57245443c73bef389f3657f
tools/Vitis-AI-Quantizer/vai_q_tensorflow1.x/tensorflow/python/framework/importer.py
python
_SetDefaultAttrValues
(node_def, op_def)
Set any default attr values in `node_def` that aren't present.
Set any default attr values in `node_def` that aren't present.
[ "Set", "any", "default", "attr", "values", "in", "node_def", "that", "aren", "t", "present", "." ]
def _SetDefaultAttrValues(node_def, op_def): """Set any default attr values in `node_def` that aren't present.""" assert node_def.op == op_def.name for attr_def in op_def.attr: key = attr_def.name if attr_def.HasField('default_value'): value = node_def.attr[key] if value is None or value.Which...
[ "def", "_SetDefaultAttrValues", "(", "node_def", ",", "op_def", ")", ":", "assert", "node_def", ".", "op", "==", "op_def", ".", "name", "for", "attr_def", "in", "op_def", ".", "attr", ":", "key", "=", "attr_def", ".", "name", "if", "attr_def", ".", "HasF...
https://github.com/Xilinx/Vitis-AI/blob/fc74d404563d9951b57245443c73bef389f3657f/tools/Vitis-AI-Quantizer/vai_q_tensorflow1.x/tensorflow/python/framework/importer.py#L336-L344
SequoiaDB/SequoiaDB
2894ed7e5bd6fe57330afc900cf76d0ff0df9f64
driver/python/pysequoiadb/cursor.py
python
cursor.__init__
(self)
constructor of cursor Exceptions: pysequoiadb.error.SDBBaseError
constructor of cursor
[ "constructor", "of", "cursor" ]
def __init__(self): """constructor of cursor Exceptions: pysequoiadb.error.SDBBaseError """ self._cursor = None try: self._cursor = sdb.create_cursor() except SystemError: raise SDBSystemError(SDB_OOM, "Failed to alloc cursor")
[ "def", "__init__", "(", "self", ")", ":", "self", ".", "_cursor", "=", "None", "try", ":", "self", ".", "_cursor", "=", "sdb", ".", "create_cursor", "(", ")", "except", "SystemError", ":", "raise", "SDBSystemError", "(", "SDB_OOM", ",", "\"Failed to alloc ...
https://github.com/SequoiaDB/SequoiaDB/blob/2894ed7e5bd6fe57330afc900cf76d0ff0df9f64/driver/python/pysequoiadb/cursor.py#L55-L65
catboost/catboost
167f64f237114a4d10b2b4ee42adb4569137debe
contrib/python/scipy/py2/scipy/optimize/lbfgsb.py
python
LbfgsInvHessProduct.todense
(self)
return Hk
Return a dense array representation of this operator. Returns ------- arr : ndarray, shape=(n, n) An array with the same shape and containing the same data represented by this `LinearOperator`.
Return a dense array representation of this operator.
[ "Return", "a", "dense", "array", "representation", "of", "this", "operator", "." ]
def todense(self): """Return a dense array representation of this operator. Returns ------- arr : ndarray, shape=(n, n) An array with the same shape and containing the same data represented by this `LinearOperator`. """ s, y, n_corrs, rho = self....
[ "def", "todense", "(", "self", ")", ":", "s", ",", "y", ",", "n_corrs", ",", "rho", "=", "self", ".", "sk", ",", "self", ".", "yk", ",", "self", ".", "n_corrs", ",", "self", ".", "rho", "I", "=", "np", ".", "eye", "(", "*", "self", ".", "sh...
https://github.com/catboost/catboost/blob/167f64f237114a4d10b2b4ee42adb4569137debe/contrib/python/scipy/py2/scipy/optimize/lbfgsb.py#L448-L468
pgRouting/osm2pgrouting
8491929fc4037d308f271e84d59bb96da3c28aa2
tools/cpplint.py
python
FileInfo.Split
(self)
return (project,) + os.path.splitext(rest)
Splits the file into the directory, basename, and extension. For 'chrome/browser/browser.cc', Split() would return ('chrome/browser', 'browser', '.cc') Returns: A tuple of (directory, basename, extension).
Splits the file into the directory, basename, and extension.
[ "Splits", "the", "file", "into", "the", "directory", "basename", "and", "extension", "." ]
def Split(self): """Splits the file into the directory, basename, and extension. For 'chrome/browser/browser.cc', Split() would return ('chrome/browser', 'browser', '.cc') Returns: A tuple of (directory, basename, extension). """ googlename = self.RepositoryName() project, rest = os...
[ "def", "Split", "(", "self", ")", ":", "googlename", "=", "self", ".", "RepositoryName", "(", ")", "project", ",", "rest", "=", "os", ".", "path", ".", "split", "(", "googlename", ")", "return", "(", "project", ",", ")", "+", "os", ".", "path", "."...
https://github.com/pgRouting/osm2pgrouting/blob/8491929fc4037d308f271e84d59bb96da3c28aa2/tools/cpplint.py#L1031-L1043
wxWidgets/wxPython-Classic
19571e1ae65f1ac445f5491474121998c97a1bf0
wx/lib/agw/pyprogress.py
python
ProgressGauge.SetFirstGradientColour
(self, colour)
Sets the first gradient colour. :param `colour`: a valid :class:`Colour` object.
Sets the first gradient colour.
[ "Sets", "the", "first", "gradient", "colour", "." ]
def SetFirstGradientColour(self, colour): """ Sets the first gradient colour. :param `colour`: a valid :class:`Colour` object. """ if not isinstance(colour, wx.Colour): colour = wx.NamedColour(colour) self._firstGradient = colour self.Re...
[ "def", "SetFirstGradientColour", "(", "self", ",", "colour", ")", ":", "if", "not", "isinstance", "(", "colour", ",", "wx", ".", "Colour", ")", ":", "colour", "=", "wx", ".", "NamedColour", "(", "colour", ")", "self", ".", "_firstGradient", "=", "colour"...
https://github.com/wxWidgets/wxPython-Classic/blob/19571e1ae65f1ac445f5491474121998c97a1bf0/wx/lib/agw/pyprogress.py#L204-L215
aws/lumberyard
f85344403c1c2e77ec8c75deb2c116e97b713217
dev/Gems/CloudGemMetric/v1/AWS/common-code/Lib/numpy/ctypeslib.py
python
_concrete_ndptr._check_retval_
(self)
return self.contents
This method is called when this class is used as the .restype attribute for a shared-library function, to automatically wrap the pointer into an array.
This method is called when this class is used as the .restype attribute for a shared-library function, to automatically wrap the pointer into an array.
[ "This", "method", "is", "called", "when", "this", "class", "is", "used", "as", "the", ".", "restype", "attribute", "for", "a", "shared", "-", "library", "function", "to", "automatically", "wrap", "the", "pointer", "into", "an", "array", "." ]
def _check_retval_(self): """ This method is called when this class is used as the .restype attribute for a shared-library function, to automatically wrap the pointer into an array. """ return self.contents
[ "def", "_check_retval_", "(", "self", ")", ":", "return", "self", ".", "contents" ]
https://github.com/aws/lumberyard/blob/f85344403c1c2e77ec8c75deb2c116e97b713217/dev/Gems/CloudGemMetric/v1/AWS/common-code/Lib/numpy/ctypeslib.py#L207-L213
microsoft/TSS.MSR
0f2516fca2cd9929c31d5450e39301c9bde43688
TSS.Py/src/TpmTypes.py
python
TPMT_KDF_SCHEME.scheme
(self)
return details.GetUnionSelector() if details else TPM_ALG_ID.NULL
Scheme selector
Scheme selector
[ "Scheme", "selector" ]
def scheme(self): # TPM_ALG_ID """ Scheme selector """ return details.GetUnionSelector() if details else TPM_ALG_ID.NULL
[ "def", "scheme", "(", "self", ")", ":", "# TPM_ALG_ID", "return", "details", ".", "GetUnionSelector", "(", ")", "if", "details", "else", "TPM_ALG_ID", ".", "NULL" ]
https://github.com/microsoft/TSS.MSR/blob/0f2516fca2cd9929c31d5450e39301c9bde43688/TSS.Py/src/TpmTypes.py#L6931-L6933
aws/lumberyard
f85344403c1c2e77ec8c75deb2c116e97b713217
dev/Gems/CloudGemMetric/v1/AWS/python/windows/Lib/numba/charseq.py
python
unicode_charseq_get_code
(a, i)
Access i-th item of UnicodeCharSeq object via code value
Access i-th item of UnicodeCharSeq object via code value
[ "Access", "i", "-", "th", "item", "of", "UnicodeCharSeq", "object", "via", "code", "value" ]
def unicode_charseq_get_code(a, i): """Access i-th item of UnicodeCharSeq object via code value """ if unicode_byte_width == 4: return deref_uint32(a, i) elif unicode_byte_width == 2: return deref_uint16(a, i) elif unicode_byte_width == 1: return deref_uint8(a, i) else: ...
[ "def", "unicode_charseq_get_code", "(", "a", ",", "i", ")", ":", "if", "unicode_byte_width", "==", "4", ":", "return", "deref_uint32", "(", "a", ",", "i", ")", "elif", "unicode_byte_width", "==", "2", ":", "return", "deref_uint16", "(", "a", ",", "i", ")...
https://github.com/aws/lumberyard/blob/f85344403c1c2e77ec8c75deb2c116e97b713217/dev/Gems/CloudGemMetric/v1/AWS/python/windows/Lib/numba/charseq.py#L83-L94
google/shaka-player-embedded
dabbeb5b47cc257b37b9a254661546352aaf0afe
shaka/tools/idl/exposed_type_generator.py
python
_GenerateObjcHeader
(results, f, name)
Generates the header for the public Objective-C type.
Generates the header for the public Objective-C type.
[ "Generates", "the", "header", "for", "the", "public", "Objective", "-", "C", "type", "." ]
def _GenerateObjcHeader(results, f, name): """Generates the header for the public Objective-C type.""" other_types = [t.name for t in results.types] writer = embed_utils.CodeWriter(f) writer.Write('#ifndef SHAKA_EMBEDDED_OBJC_%s_H_', name.upper()) writer.Write('#define SHAKA_EMBEDDED_OBJC_%s_H_', name.upper()...
[ "def", "_GenerateObjcHeader", "(", "results", ",", "f", ",", "name", ")", ":", "other_types", "=", "[", "t", ".", "name", "for", "t", "in", "results", ".", "types", "]", "writer", "=", "embed_utils", ".", "CodeWriter", "(", "f", ")", "writer", ".", "...
https://github.com/google/shaka-player-embedded/blob/dabbeb5b47cc257b37b9a254661546352aaf0afe/shaka/tools/idl/exposed_type_generator.py#L325-L360
Kitware/VTK
5b4df4d90a4f31194d97d3c639dd38ea8f81e8b8
Wrapping/Python/vtkmodules/gtk/GtkGLExtVTKRenderWindow.py
python
GtkGLExtVTKRenderWindow.UpdateRenderer
(self,x,y)
UpdateRenderer will identify the renderer under the mouse and set up _CurrentRenderer, _CurrentCamera, and _CurrentLight.
UpdateRenderer will identify the renderer under the mouse and set up _CurrentRenderer, _CurrentCamera, and _CurrentLight.
[ "UpdateRenderer", "will", "identify", "the", "renderer", "under", "the", "mouse", "and", "set", "up", "_CurrentRenderer", "_CurrentCamera", "and", "_CurrentLight", "." ]
def UpdateRenderer(self,x,y): """ UpdateRenderer will identify the renderer under the mouse and set up _CurrentRenderer, _CurrentCamera, and _CurrentLight. """ windowX,windowY = self.widget.window.get_size() renderers = self._RenderWindow.GetRenderers() numRende...
[ "def", "UpdateRenderer", "(", "self", ",", "x", ",", "y", ")", ":", "windowX", ",", "windowY", "=", "self", ".", "widget", ".", "window", ".", "get_size", "(", ")", "renderers", "=", "self", ".", "_RenderWindow", ".", "GetRenderers", "(", ")", "numRend...
https://github.com/Kitware/VTK/blob/5b4df4d90a4f31194d97d3c639dd38ea8f81e8b8/Wrapping/Python/vtkmodules/gtk/GtkGLExtVTKRenderWindow.py#L282-L317
adobe/chromium
cfe5bf0b51b1f6b9fe239c2a3c2f2364da9967d7
third_party/closure_linter/closure_linter/statetracker.py
python
DocComment.HasFlag
(self, flag_type)
return flag_type in self.__flags
Test if the given flag has been set. Args: flag_type: The type of the flag to check. Returns: True if the flag is set.
Test if the given flag has been set.
[ "Test", "if", "the", "given", "flag", "has", "been", "set", "." ]
def HasFlag(self, flag_type): """Test if the given flag has been set. Args: flag_type: The type of the flag to check. Returns: True if the flag is set. """ return flag_type in self.__flags
[ "def", "HasFlag", "(", "self", ",", "flag_type", ")", ":", "return", "flag_type", "in", "self", ".", "__flags" ]
https://github.com/adobe/chromium/blob/cfe5bf0b51b1f6b9fe239c2a3c2f2364da9967d7/third_party/closure_linter/closure_linter/statetracker.py#L299-L308
pytorch/pytorch
7176c92687d3cc847cc046bf002269c6949a21c2
caffe2/python/core.py
python
Net._CheckLookupTables
(self)
Called from unit tests to validate the internal lookup tables match the protobuf contents.
Called from unit tests to validate the internal lookup tables match the protobuf contents.
[ "Called", "from", "unit", "tests", "to", "validate", "the", "internal", "lookup", "tables", "match", "the", "protobuf", "contents", "." ]
def _CheckLookupTables(self): ''' Called from unit tests to validate the internal lookup tables match the protobuf contents. ''' test_op_outputs = set() for op in self._net.op: for o in op.output: test_op_outputs.add(o) test_external_i...
[ "def", "_CheckLookupTables", "(", "self", ")", ":", "test_op_outputs", "=", "set", "(", ")", "for", "op", "in", "self", ".", "_net", ".", "op", ":", "for", "o", "in", "op", ".", "output", ":", "test_op_outputs", ".", "add", "(", "o", ")", "test_exter...
https://github.com/pytorch/pytorch/blob/7176c92687d3cc847cc046bf002269c6949a21c2/caffe2/python/core.py#L1989-L2004
tfwu/FaceDetection-ConvNet-3D
f9251c48eb40c5aec8fba7455115c355466555be
python/mxnet/ndarray.py
python
full
(shape, val, ctx=None)
return arr
Create a new NDArray filled with given value, with specified shape. Parameters ---------- shape : tuple shape of the NDArray. val : float value to be filled with. ctx : Context, optional The context of the NDArray, default to current default context. Returns -------...
Create a new NDArray filled with given value, with specified shape.
[ "Create", "a", "new", "NDArray", "filled", "with", "given", "value", "with", "specified", "shape", "." ]
def full(shape, val, ctx=None): """Create a new NDArray filled with given value, with specified shape. Parameters ---------- shape : tuple shape of the NDArray. val : float value to be filled with. ctx : Context, optional The context of the NDArray, default to current de...
[ "def", "full", "(", "shape", ",", "val", ",", "ctx", "=", "None", ")", ":", "arr", "=", "empty", "(", "shape", ",", "ctx", ")", "arr", "[", ":", "]", "=", "val", "return", "arr" ]
https://github.com/tfwu/FaceDetection-ConvNet-3D/blob/f9251c48eb40c5aec8fba7455115c355466555be/python/mxnet/ndarray.py#L755-L774
wxWidgets/wxPython-Classic
19571e1ae65f1ac445f5491474121998c97a1bf0
src/osx_cocoa/_core.py
python
SizerItem.GetSize
(*args, **kwargs)
return _core_.SizerItem_GetSize(*args, **kwargs)
GetSize(self) -> Size Get the current size of the item, as set in the last Layout.
GetSize(self) -> Size
[ "GetSize", "(", "self", ")", "-", ">", "Size" ]
def GetSize(*args, **kwargs): """ GetSize(self) -> Size Get the current size of the item, as set in the last Layout. """ return _core_.SizerItem_GetSize(*args, **kwargs)
[ "def", "GetSize", "(", "*", "args", ",", "*", "*", "kwargs", ")", ":", "return", "_core_", ".", "SizerItem_GetSize", "(", "*", "args", ",", "*", "*", "kwargs", ")" ]
https://github.com/wxWidgets/wxPython-Classic/blob/19571e1ae65f1ac445f5491474121998c97a1bf0/src/osx_cocoa/_core.py#L14060-L14066
catboost/catboost
167f64f237114a4d10b2b4ee42adb4569137debe
contrib/python/tornado/tornado-6/tornado/ioloop.py
python
IOLoop.add_callback
(self, callback: Callable, *args: Any, **kwargs: Any)
Calls the given callback on the next I/O loop iteration. It is safe to call this method from any thread at any time, except from a signal handler. Note that this is the **only** method in `IOLoop` that makes this thread-safety guarantee; all other interaction with the `IOLoop` must be ...
Calls the given callback on the next I/O loop iteration.
[ "Calls", "the", "given", "callback", "on", "the", "next", "I", "/", "O", "loop", "iteration", "." ]
def add_callback(self, callback: Callable, *args: Any, **kwargs: Any) -> None: """Calls the given callback on the next I/O loop iteration. It is safe to call this method from any thread at any time, except from a signal handler. Note that this is the **only** method in `IOLoop` that ma...
[ "def", "add_callback", "(", "self", ",", "callback", ":", "Callable", ",", "*", "args", ":", "Any", ",", "*", "*", "kwargs", ":", "Any", ")", "->", "None", ":", "raise", "NotImplementedError", "(", ")" ]
https://github.com/catboost/catboost/blob/167f64f237114a4d10b2b4ee42adb4569137debe/contrib/python/tornado/tornado-6/tornado/ioloop.py#L629-L642
Polidea/SiriusObfuscator
b0e590d8130e97856afe578869b83a209e2b19be
SymbolExtractorAndRenamer/lldb/utils/lui/lldbutil.py
python
get_GPRs
(frame)
return get_registers(frame, "general purpose")
Returns the general purpose registers of the frame as an SBValue. The returned SBValue object is iterable. An example: ... from lldbutil import get_GPRs regs = get_GPRs(frame) for reg in regs: print "%s => %s" % (reg.GetName(), reg.GetValue()) ...
Returns the general purpose registers of the frame as an SBValue.
[ "Returns", "the", "general", "purpose", "registers", "of", "the", "frame", "as", "an", "SBValue", "." ]
def get_GPRs(frame): """Returns the general purpose registers of the frame as an SBValue. The returned SBValue object is iterable. An example: ... from lldbutil import get_GPRs regs = get_GPRs(frame) for reg in regs: print "%s => %s" % (reg.GetName(), reg.GetValue()...
[ "def", "get_GPRs", "(", "frame", ")", ":", "return", "get_registers", "(", "frame", ",", "\"general purpose\"", ")" ]
https://github.com/Polidea/SiriusObfuscator/blob/b0e590d8130e97856afe578869b83a209e2b19be/SymbolExtractorAndRenamer/lldb/utils/lui/lldbutil.py#L913-L924
wxWidgets/wxPython-Classic
19571e1ae65f1ac445f5491474121998c97a1bf0
wx/tools/Editra/src/eclib/finddlg.py
python
FindReplaceDlgBase.GetFileFilters
(self)
return self._panel.GetFileFilters()
Get the file filters field value @return: string
Get the file filters field value @return: string
[ "Get", "the", "file", "filters", "field", "value", "@return", ":", "string" ]
def GetFileFilters(self): """Get the file filters field value @return: string """ return self._panel.GetFileFilters()
[ "def", "GetFileFilters", "(", "self", ")", ":", "return", "self", ".", "_panel", ".", "GetFileFilters", "(", ")" ]
https://github.com/wxWidgets/wxPython-Classic/blob/19571e1ae65f1ac445f5491474121998c97a1bf0/wx/tools/Editra/src/eclib/finddlg.py#L441-L446
aws/lumberyard
f85344403c1c2e77ec8c75deb2c116e97b713217
dev/Gems/CloudGemDefectReporter/v1/AWS/common-code/Lib/PIL/ImageDraw.py
python
ImageDraw.shape
(self, shape, fill=None, outline=None)
(Experimental) Draw a shape.
(Experimental) Draw a shape.
[ "(", "Experimental", ")", "Draw", "a", "shape", "." ]
def shape(self, shape, fill=None, outline=None): """(Experimental) Draw a shape.""" shape.close() ink, fill = self._getink(outline, fill) if fill is not None: self.draw.draw_outline(shape, fill, 1) if ink is not None and ink != fill: self.draw.draw_outline...
[ "def", "shape", "(", "self", ",", "shape", ",", "fill", "=", "None", ",", "outline", "=", "None", ")", ":", "shape", ".", "close", "(", ")", "ink", ",", "fill", "=", "self", ".", "_getink", "(", "outline", ",", "fill", ")", "if", "fill", "is", ...
https://github.com/aws/lumberyard/blob/f85344403c1c2e77ec8c75deb2c116e97b713217/dev/Gems/CloudGemDefectReporter/v1/AWS/common-code/Lib/PIL/ImageDraw.py#L213-L220
Kitware/ParaView
f760af9124ff4634b23ebbeab95a4f56e0261955
Web/Python/paraview/web/protocols.py
python
ParaViewWebProxyManager.get
(self, proxyId, ui=True)
return proxyJson
Returns the proxy state for the given proxyId as a JSON object.
Returns the proxy state for the given proxyId as a JSON object.
[ "Returns", "the", "proxy", "state", "for", "the", "given", "proxyId", "as", "a", "JSON", "object", "." ]
def get(self, proxyId, ui=True): """ Returns the proxy state for the given proxyId as a JSON object. """ proxyProperties = [] proxyId = str(proxyId) self.fillPropertyList(proxyId, proxyProperties) proxyProperties, groupsInfo = self.reorderProperties(proxyId, prox...
[ "def", "get", "(", "self", ",", "proxyId", ",", "ui", "=", "True", ")", ":", "proxyProperties", "=", "[", "]", "proxyId", "=", "str", "(", "proxyId", ")", "self", ".", "fillPropertyList", "(", "proxyId", ",", "proxyProperties", ")", "proxyProperties", ",...
https://github.com/Kitware/ParaView/blob/f760af9124ff4634b23ebbeab95a4f56e0261955/Web/Python/paraview/web/protocols.py#L3266-L3303
apache/incubator-mxnet
f03fb23f1d103fec9541b5ae59ee06b1734a51d9
python/mxnet/symbol/numpy/_symbol.py
python
std
(a, axis=None, dtype=None, out=None, ddof=0, keepdims=False)
return _npi.std(a, axis=axis, dtype=dtype, ddof=ddof, keepdims=keepdims, out=out)
Compute the standard deviation along the specified axis. Returns the standard deviation, a measure of the spread of a distribution, of the array elements. The standard deviation is computed for the flattened array by default, otherwise over the specified axis. Parameters ---------- a : `_Symbo...
Compute the standard deviation along the specified axis.
[ "Compute", "the", "standard", "deviation", "along", "the", "specified", "axis", "." ]
def std(a, axis=None, dtype=None, out=None, ddof=0, keepdims=False): # pylint: disable=too-many-arguments """ Compute the standard deviation along the specified axis. Returns the standard deviation, a measure of the spread of a distribution, of the array elements. The standard deviation is computed fo...
[ "def", "std", "(", "a", ",", "axis", "=", "None", ",", "dtype", "=", "None", ",", "out", "=", "None", ",", "ddof", "=", "0", ",", "keepdims", "=", "False", ")", ":", "# pylint: disable=too-many-arguments", "return", "_npi", ".", "std", "(", "a", ",",...
https://github.com/apache/incubator-mxnet/blob/f03fb23f1d103fec9541b5ae59ee06b1734a51d9/python/mxnet/symbol/numpy/_symbol.py#L5090-L5136
lilypond/lilypond
2a14759372979f5b796ee802b0ee3bc15d28b06b
scripts/build/output-distance.py
python
read_signature_file
(name: str)
return sig
Returns SystemSignature or None if file doesn't exist.
Returns SystemSignature or None if file doesn't exist.
[ "Returns", "SystemSignature", "or", "None", "if", "file", "doesn", "t", "exist", "." ]
def read_signature_file(name: str): """Returns SystemSignature or None if file doesn't exist.""" log_verbose('reading %s' % name) try: f = open(name, encoding='utf-8') except IOError as e: if e.errno == errno.ENOENT: return None else: raise entries =...
[ "def", "read_signature_file", "(", "name", ":", "str", ")", ":", "log_verbose", "(", "'reading %s'", "%", "name", ")", "try", ":", "f", "=", "open", "(", "name", ",", "encoding", "=", "'utf-8'", ")", "except", "IOError", "as", "e", ":", "if", "e", "....
https://github.com/lilypond/lilypond/blob/2a14759372979f5b796ee802b0ee3bc15d28b06b/scripts/build/output-distance.py#L405-L441
MythTV/mythtv
d282a209cb8be85d036f85a62a8ec971b67d45f4
mythtv/programs/scripts/internetcontent/nv_python_libs/dailymotion/dailymotion_api.py
python
OutStreamEncoder.__getattr__
(self, attr)
return getattr(self.out, attr)
Delegate everything but write to the stream
Delegate everything but write to the stream
[ "Delegate", "everything", "but", "write", "to", "the", "stream" ]
def __getattr__(self, attr): """Delegate everything but write to the stream""" return getattr(self.out, attr)
[ "def", "__getattr__", "(", "self", ",", "attr", ")", ":", "return", "getattr", "(", "self", ".", "out", ",", "attr", ")" ]
https://github.com/MythTV/mythtv/blob/d282a209cb8be85d036f85a62a8ec971b67d45f4/mythtv/programs/scripts/internetcontent/nv_python_libs/dailymotion/dailymotion_api.py#L65-L67
pmq20/node-packer
12c46c6e44fbc14d9ee645ebd17d5296b324f7e0
current/deps/v8/third_party/jinja2/environment.py
python
Template.from_code
(cls, environment, code, globals, uptodate=None)
return rv
Creates a template object from compiled code and the globals. This is used by the loaders and environment to create a template object.
Creates a template object from compiled code and the globals. This is used by the loaders and environment to create a template object.
[ "Creates", "a", "template", "object", "from", "compiled", "code", "and", "the", "globals", ".", "This", "is", "used", "by", "the", "loaders", "and", "environment", "to", "create", "a", "template", "object", "." ]
def from_code(cls, environment, code, globals, uptodate=None): """Creates a template object from compiled code and the globals. This is used by the loaders and environment to create a template object. """ namespace = { 'environment': environment, '__file__': ...
[ "def", "from_code", "(", "cls", ",", "environment", ",", "code", ",", "globals", ",", "uptodate", "=", "None", ")", ":", "namespace", "=", "{", "'environment'", ":", "environment", ",", "'__file__'", ":", "code", ".", "co_filename", "}", "exec", "(", "co...
https://github.com/pmq20/node-packer/blob/12c46c6e44fbc14d9ee645ebd17d5296b324f7e0/current/deps/v8/third_party/jinja2/environment.py#L948-L959
catboost/catboost
167f64f237114a4d10b2b4ee42adb4569137debe
contrib/tools/python3/src/Lib/gzip.py
python
GzipFile.fileno
(self)
return self.fileobj.fileno()
Invoke the underlying file object's fileno() method. This will raise AttributeError if the underlying file object doesn't support fileno().
Invoke the underlying file object's fileno() method.
[ "Invoke", "the", "underlying", "file", "object", "s", "fileno", "()", "method", "." ]
def fileno(self): """Invoke the underlying file object's fileno() method. This will raise AttributeError if the underlying file object doesn't support fileno(). """ return self.fileobj.fileno()
[ "def", "fileno", "(", "self", ")", ":", "return", "self", ".", "fileobj", ".", "fileno", "(", ")" ]
https://github.com/catboost/catboost/blob/167f64f237114a4d10b2b4ee42adb4569137debe/contrib/tools/python3/src/Lib/gzip.py#L352-L358
wxWidgets/wxPython-Classic
19571e1ae65f1ac445f5491474121998c97a1bf0
src/osx_carbon/_controls.py
python
PreSpinCtrl
(*args, **kwargs)
return val
PreSpinCtrl() -> SpinCtrl
PreSpinCtrl() -> SpinCtrl
[ "PreSpinCtrl", "()", "-", ">", "SpinCtrl" ]
def PreSpinCtrl(*args, **kwargs): """PreSpinCtrl() -> SpinCtrl""" val = _controls_.new_PreSpinCtrl(*args, **kwargs) return val
[ "def", "PreSpinCtrl", "(", "*", "args", ",", "*", "*", "kwargs", ")", ":", "val", "=", "_controls_", ".", "new_PreSpinCtrl", "(", "*", "args", ",", "*", "*", "kwargs", ")", "return", "val" ]
https://github.com/wxWidgets/wxPython-Classic/blob/19571e1ae65f1ac445f5491474121998c97a1bf0/src/osx_carbon/_controls.py#L2407-L2410
zhaoweicai/mscnn
534bcac5710a579d60827f192035f7eef6d8c585
scripts/cpp_lint.py
python
_NestingState.SeenOpenBrace
(self)
return (not self.stack) or self.stack[-1].seen_open_brace
Check if we have seen the opening brace for the innermost block. Returns: True if we have seen the opening brace, False if the innermost block is still expecting an opening brace.
Check if we have seen the opening brace for the innermost block.
[ "Check", "if", "we", "have", "seen", "the", "opening", "brace", "for", "the", "innermost", "block", "." ]
def SeenOpenBrace(self): """Check if we have seen the opening brace for the innermost block. Returns: True if we have seen the opening brace, False if the innermost block is still expecting an opening brace. """ return (not self.stack) or self.stack[-1].seen_open_brace
[ "def", "SeenOpenBrace", "(", "self", ")", ":", "return", "(", "not", "self", ".", "stack", ")", "or", "self", ".", "stack", "[", "-", "1", "]", ".", "seen_open_brace" ]
https://github.com/zhaoweicai/mscnn/blob/534bcac5710a579d60827f192035f7eef6d8c585/scripts/cpp_lint.py#L1931-L1938
linyouhappy/kongkongxiyou
7a69b2913eb29f4be77f9a62fb90cdd72c4160f1
cocosjs/frameworks/cocos2d-x/tools/bindings-generator/backup/clang-llvm-3.3-pybinding/cindex.py
python
CursorKind.name
(self)
return self._name_map[self]
Get the enumeration name of this cursor kind.
Get the enumeration name of this cursor kind.
[ "Get", "the", "enumeration", "name", "of", "this", "cursor", "kind", "." ]
def name(self): """Get the enumeration name of this cursor kind.""" if self._name_map is None: self._name_map = {} for key,value in CursorKind.__dict__.items(): if isinstance(value,CursorKind): self._name_map[value] = key return self._n...
[ "def", "name", "(", "self", ")", ":", "if", "self", ".", "_name_map", "is", "None", ":", "self", ".", "_name_map", "=", "{", "}", "for", "key", ",", "value", "in", "CursorKind", ".", "__dict__", ".", "items", "(", ")", ":", "if", "isinstance", "(",...
https://github.com/linyouhappy/kongkongxiyou/blob/7a69b2913eb29f4be77f9a62fb90cdd72c4160f1/cocosjs/frameworks/cocos2d-x/tools/bindings-generator/backup/clang-llvm-3.3-pybinding/cindex.py#L499-L506
ChromiumWebApps/chromium
c7361d39be8abd1574e6ce8957c8dbddd4c6ccf7
ui/gl/generate_bindings.py
python
GenerateMockBindingsSource
(file, functions)
Generates functions that invoke MockGLInterface members and a GetGLProcAddress function that returns addresses to those functions.
Generates functions that invoke MockGLInterface members and a GetGLProcAddress function that returns addresses to those functions.
[ "Generates", "functions", "that", "invoke", "MockGLInterface", "members", "and", "a", "GetGLProcAddress", "function", "that", "returns", "addresses", "to", "those", "functions", "." ]
def GenerateMockBindingsSource(file, functions): """Generates functions that invoke MockGLInterface members and a GetGLProcAddress function that returns addresses to those functions.""" file.write( """// Copyright (c) 2011 The Chromium Authors. All rights reserved. // Use of this source code is governed by a BSD...
[ "def", "GenerateMockBindingsSource", "(", "file", ",", "functions", ")", ":", "file", ".", "write", "(", "\"\"\"// Copyright (c) 2011 The Chromium Authors. All rights reserved.\n// Use of this source code is governed by a BSD-style license that can be\n// found in the LICENSE file.\n\n// Thi...
https://github.com/ChromiumWebApps/chromium/blob/c7361d39be8abd1574e6ce8957c8dbddd4c6ccf7/ui/gl/generate_bindings.py#L1724-L1793
wxWidgets/wxPython-Classic
19571e1ae65f1ac445f5491474121998c97a1bf0
src/osx_carbon/richtext.py
python
RichTextCtrl.SetDefaultStyle
(*args, **kwargs)
return _richtext.RichTextCtrl_SetDefaultStyle(*args, **kwargs)
SetDefaultStyle(self, RichTextAttr style) -> bool Set the style used by default for the rich text document.
SetDefaultStyle(self, RichTextAttr style) -> bool
[ "SetDefaultStyle", "(", "self", "RichTextAttr", "style", ")", "-", ">", "bool" ]
def SetDefaultStyle(*args, **kwargs): """ SetDefaultStyle(self, RichTextAttr style) -> bool Set the style used by default for the rich text document. """ return _richtext.RichTextCtrl_SetDefaultStyle(*args, **kwargs)
[ "def", "SetDefaultStyle", "(", "*", "args", ",", "*", "*", "kwargs", ")", ":", "return", "_richtext", ".", "RichTextCtrl_SetDefaultStyle", "(", "*", "args", ",", "*", "*", "kwargs", ")" ]
https://github.com/wxWidgets/wxPython-Classic/blob/19571e1ae65f1ac445f5491474121998c97a1bf0/src/osx_carbon/richtext.py#L3165-L3171
qgis/QGIS
15a77662d4bb712184f6aa60d0bd663010a76a75
python/plugins/db_manager/db_plugins/gpkg/connector.py
python
GPKGDBConnector.deleteTableConstraint
(self, table, constraint)
return False
Deletes constraint in a table
Deletes constraint in a table
[ "Deletes", "constraint", "in", "a", "table" ]
def deleteTableConstraint(self, table, constraint): """Deletes constraint in a table """ return False
[ "def", "deleteTableConstraint", "(", "self", ",", "table", ",", "constraint", ")", ":", "return", "False" ]
https://github.com/qgis/QGIS/blob/15a77662d4bb712184f6aa60d0bd663010a76a75/python/plugins/db_manager/db_plugins/gpkg/connector.py#L766-L768
wxWidgets/wxPython-Classic
19571e1ae65f1ac445f5491474121998c97a1bf0
wx/tools/Editra/src/extern/aui/auibar.py
python
AuiToolBar.SetToolNormalBitmap
(self, tool_id, bitmap)
Sets the tool bitmap for the tool identified by `tool_id`. :param integer `tool_id`: the tool identifier; :param Bitmap `bitmap`: the new bitmap for the toolbar item.
Sets the tool bitmap for the tool identified by `tool_id`.
[ "Sets", "the", "tool", "bitmap", "for", "the", "tool", "identified", "by", "tool_id", "." ]
def SetToolNormalBitmap(self, tool_id, bitmap): """ Sets the tool bitmap for the tool identified by `tool_id`. :param integer `tool_id`: the tool identifier; :param Bitmap `bitmap`: the new bitmap for the toolbar item. """ self.SetToolBitmap(tool_id, bitmap)
[ "def", "SetToolNormalBitmap", "(", "self", ",", "tool_id", ",", "bitmap", ")", ":", "self", ".", "SetToolBitmap", "(", "tool_id", ",", "bitmap", ")" ]
https://github.com/wxWidgets/wxPython-Classic/blob/19571e1ae65f1ac445f5491474121998c97a1bf0/wx/tools/Editra/src/extern/aui/auibar.py#L2767-L2775
catboost/catboost
167f64f237114a4d10b2b4ee42adb4569137debe
contrib/python/pandas/py3/pandas/core/arrays/datetimelike.py
python
DatetimeLikeArrayMixin._time_shift
(self, periods: int, freq=None)
return self._generate_range(start=start, end=end, periods=None, freq=self.freq)
Shift each value by `periods`. Note this is different from ExtensionArray.shift, which shifts the *position* of each element, padding the end with missing values. Parameters ---------- periods : int Number of periods to shift by. freq : pandas.DateOf...
Shift each value by `periods`.
[ "Shift", "each", "value", "by", "periods", "." ]
def _time_shift(self, periods: int, freq=None): """ Shift each value by `periods`. Note this is different from ExtensionArray.shift, which shifts the *position* of each element, padding the end with missing values. Parameters ---------- periods : int ...
[ "def", "_time_shift", "(", "self", ",", "periods", ":", "int", ",", "freq", "=", "None", ")", ":", "if", "freq", "is", "not", "None", "and", "freq", "!=", "self", ".", "freq", ":", "if", "isinstance", "(", "freq", ",", "str", ")", ":", "freq", "=...
https://github.com/catboost/catboost/blob/167f64f237114a4d10b2b4ee42adb4569137debe/contrib/python/pandas/py3/pandas/core/arrays/datetimelike.py#L1211-L1245
catboost/catboost
167f64f237114a4d10b2b4ee42adb4569137debe
contrib/python/pandas/py2/pandas/core/window.py
python
Window._prep_window
(self, **kwargs)
Provide validation for our window type, return the window we have already been validated.
Provide validation for our window type, return the window we have already been validated.
[ "Provide", "validation", "for", "our", "window", "type", "return", "the", "window", "we", "have", "already", "been", "validated", "." ]
def _prep_window(self, **kwargs): """ Provide validation for our window type, return the window we have already been validated. """ window = self._get_window() if isinstance(window, (list, tuple, np.ndarray)): return com.asarray_tuplesafe(window).astype(float...
[ "def", "_prep_window", "(", "self", ",", "*", "*", "kwargs", ")", ":", "window", "=", "self", ".", "_get_window", "(", ")", "if", "isinstance", "(", "window", ",", "(", "list", ",", "tuple", ",", "np", ".", "ndarray", ")", ")", ":", "return", "com"...
https://github.com/catboost/catboost/blob/167f64f237114a4d10b2b4ee42adb4569137debe/contrib/python/pandas/py2/pandas/core/window.py#L612-L647
fenderglass/Flye
2013acc650356cc934a2a9b82eb90af260c8b52b
flye/polishing/consensus.py
python
_contig_profile
(alignment, platform)
return profile, aln_errors
Computes alignment profile
Computes alignment profile
[ "Computes", "alignment", "profile" ]
def _contig_profile(alignment, platform): """ Computes alignment profile """ if not alignment: return [] genome_len = alignment[0].trg_len aln_errors = [] profile = [Profile() for _ in range(genome_len)] #max_aln_err = cfg.vals["err_modes"][platform]["max_aln_error"] for a...
[ "def", "_contig_profile", "(", "alignment", ",", "platform", ")", ":", "if", "not", "alignment", ":", "return", "[", "]", "genome_len", "=", "alignment", "[", "0", "]", ".", "trg_len", "aln_errors", "=", "[", "]", "profile", "=", "[", "Profile", "(", "...
https://github.com/fenderglass/Flye/blob/2013acc650356cc934a2a9b82eb90af260c8b52b/flye/polishing/consensus.py#L105-L149
apple/turicreate
cce55aa5311300e3ce6af93cb45ba791fd1bdf49
src/external/xgboost/python-package/xgboost/core.py
python
ctypes2numpy
(cptr, length, dtype)
return res
Convert a ctypes pointer array to a numpy array.
Convert a ctypes pointer array to a numpy array.
[ "Convert", "a", "ctypes", "pointer", "array", "to", "a", "numpy", "array", "." ]
def ctypes2numpy(cptr, length, dtype): """Convert a ctypes pointer array to a numpy array. """ if not isinstance(cptr, ctypes.POINTER(ctypes.c_float)): raise RuntimeError('expected float pointer') res = np.zeros(length, dtype=dtype) if not ctypes.memmove(res.ctypes.data, cptr, length * res.s...
[ "def", "ctypes2numpy", "(", "cptr", ",", "length", ",", "dtype", ")", ":", "if", "not", "isinstance", "(", "cptr", ",", "ctypes", ".", "POINTER", "(", "ctypes", ".", "c_float", ")", ")", ":", "raise", "RuntimeError", "(", "'expected float pointer'", ")", ...
https://github.com/apple/turicreate/blob/cce55aa5311300e3ce6af93cb45ba791fd1bdf49/src/external/xgboost/python-package/xgboost/core.py#L109-L117
PaddlePaddle/Paddle
1252f4bb3e574df80aa6d18c7ddae1b3a90bd81c
python/paddle/fluid/incubate/fleet/parameter_server/pslib/__init__.py
python
PSLib._set_opt_info
(self, opt_info)
this function saves the result from DistributedOptimizer.minimize()
this function saves the result from DistributedOptimizer.minimize()
[ "this", "function", "saves", "the", "result", "from", "DistributedOptimizer", ".", "minimize", "()" ]
def _set_opt_info(self, opt_info): """ this function saves the result from DistributedOptimizer.minimize() """ self._opt_info = opt_info
[ "def", "_set_opt_info", "(", "self", ",", "opt_info", ")", ":", "self", ".", "_opt_info", "=", "opt_info" ]
https://github.com/PaddlePaddle/Paddle/blob/1252f4bb3e574df80aa6d18c7ddae1b3a90bd81c/python/paddle/fluid/incubate/fleet/parameter_server/pslib/__init__.py#L799-L803
p4lang/p4c
3272e79369f20813cc1a555a5eb26f44432f84a4
tools/cpplint.py
python
GetHeaderGuardCPPVariable
(filename)
return re.sub(r'[^a-zA-Z0-9]', '_', file_path_from_root).upper() + '_'
Returns the CPP variable that should be used as a header guard. Args: filename: The name of a C++ header file. Returns: The CPP variable that should be used as a header guard in the named file.
Returns the CPP variable that should be used as a header guard.
[ "Returns", "the", "CPP", "variable", "that", "should", "be", "used", "as", "a", "header", "guard", "." ]
def GetHeaderGuardCPPVariable(filename): """Returns the CPP variable that should be used as a header guard. Args: filename: The name of a C++ header file. Returns: The CPP variable that should be used as a header guard in the named file. """ # Restores original filename in case that cpplint is...
[ "def", "GetHeaderGuardCPPVariable", "(", "filename", ")", ":", "# Restores original filename in case that cpplint is invoked from Emacs's", "# flymake.", "filename", "=", "re", ".", "sub", "(", "r'_flymake\\.h$'", ",", "'.h'", ",", "filename", ")", "filename", "=", "re", ...
https://github.com/p4lang/p4c/blob/3272e79369f20813cc1a555a5eb26f44432f84a4/tools/cpplint.py#L2289-L2363
google/syzygy
8164b24ebde9c5649c9a09e88a7fc0b0fcbd1bc5
third_party/numpy/files/numpy/lib/npyio.py
python
load
(file, mmap_mode=None)
Load a pickled, ``.npy``, or ``.npz`` binary file. Parameters ---------- file : file-like object or string The file to read. It must support ``seek()`` and ``read()`` methods. If the filename extension is ``.gz``, the file is first decompressed. mmap_mode: {None, 'r+', 'r', 'w+', 'c'},...
Load a pickled, ``.npy``, or ``.npz`` binary file.
[ "Load", "a", "pickled", ".", "npy", "or", ".", "npz", "binary", "file", "." ]
def load(file, mmap_mode=None): """ Load a pickled, ``.npy``, or ``.npz`` binary file. Parameters ---------- file : file-like object or string The file to read. It must support ``seek()`` and ``read()`` methods. If the filename extension is ``.gz``, the file is first decompressed. ...
[ "def", "load", "(", "file", ",", "mmap_mode", "=", "None", ")", ":", "import", "gzip", "own_fid", "=", "False", "if", "isinstance", "(", "file", ",", "basestring", ")", ":", "fid", "=", "open", "(", "file", ",", "\"rb\"", ")", "own_fid", "=", "True",...
https://github.com/google/syzygy/blob/8164b24ebde9c5649c9a09e88a7fc0b0fcbd1bc5/third_party/numpy/files/numpy/lib/npyio.py#L265-L359
catboost/catboost
167f64f237114a4d10b2b4ee42adb4569137debe
contrib/python/ipython/py2/IPython/lib/demo.py
python
Demo.__call__
(self,index=None)
run a block of the demo. If index is given, it should be an integer >=1 and <= nblocks. This means that the calling convention is one off from typical Python lists. The reason for the inconsistency is that the demo always prints 'Block n/N, and N is the total, so it would be very odd ...
run a block of the demo.
[ "run", "a", "block", "of", "the", "demo", "." ]
def __call__(self,index=None): """run a block of the demo. If index is given, it should be an integer >=1 and <= nblocks. This means that the calling convention is one off from typical Python lists. The reason for the inconsistency is that the demo always prints 'Block n/N, an...
[ "def", "__call__", "(", "self", ",", "index", "=", "None", ")", ":", "index", "=", "self", ".", "_get_index", "(", "index", ")", "if", "index", "is", "None", ":", "return", "try", ":", "marquee", "=", "self", ".", "marquee", "next_block", "=", "self"...
https://github.com/catboost/catboost/blob/167f64f237114a4d10b2b4ee42adb4569137debe/contrib/python/ipython/py2/IPython/lib/demo.py#L427-L477
apple/turicreate
cce55aa5311300e3ce6af93cb45ba791fd1bdf49
src/python/turicreate/data_structures/sframe.py
python
SFrame.apply
(self, fn, dtype=None)
Transform each row to an :class:`~turicreate.SArray` according to a specified function. Returns a new SArray of ``dtype`` where each element in this SArray is transformed by `fn(x)` where `x` is a single row in the sframe represented as a dictionary. The ``fn`` should return exactly one...
Transform each row to an :class:`~turicreate.SArray` according to a specified function. Returns a new SArray of ``dtype`` where each element in this SArray is transformed by `fn(x)` where `x` is a single row in the sframe represented as a dictionary. The ``fn`` should return exactly one...
[ "Transform", "each", "row", "to", "an", ":", "class", ":", "~turicreate", ".", "SArray", "according", "to", "a", "specified", "function", ".", "Returns", "a", "new", "SArray", "of", "dtype", "where", "each", "element", "in", "this", "SArray", "is", "transf...
def apply(self, fn, dtype=None): """ Transform each row to an :class:`~turicreate.SArray` according to a specified function. Returns a new SArray of ``dtype`` where each element in this SArray is transformed by `fn(x)` where `x` is a single row in the sframe represented as a dict...
[ "def", "apply", "(", "self", ",", "fn", ",", "dtype", "=", "None", ")", ":", "assert", "callable", "(", "fn", ")", ",", "\"Input must be callable\"", "test_sf", "=", "self", "[", ":", "10", "]", "dryrun", "=", "[", "fn", "(", "row", ")", "for", "ro...
https://github.com/apple/turicreate/blob/cce55aa5311300e3ce6af93cb45ba791fd1bdf49/src/python/turicreate/data_structures/sframe.py#L2638-L2702
catboost/catboost
167f64f237114a4d10b2b4ee42adb4569137debe
contrib/python/scipy/py3/scipy/optimize/_trustregion.py
python
_minimize_trust_region
(fun, x0, args=(), jac=None, hess=None, hessp=None, subproblem=None, initial_trust_radius=1.0, max_trust_radius=1000.0, eta=0.15, gtol=1e-4, maxiter=None, disp=False, return_all=False, callback=None, inexact=True...
return result
Minimization of scalar function of one or more variables using a trust-region algorithm. Options for the trust-region algorithm are: initial_trust_radius : float Initial trust radius. max_trust_radius : float Never propose steps that are longer than this value. e...
Minimization of scalar function of one or more variables using a trust-region algorithm.
[ "Minimization", "of", "scalar", "function", "of", "one", "or", "more", "variables", "using", "a", "trust", "-", "region", "algorithm", "." ]
def _minimize_trust_region(fun, x0, args=(), jac=None, hess=None, hessp=None, subproblem=None, initial_trust_radius=1.0, max_trust_radius=1000.0, eta=0.15, gtol=1e-4, maxiter=None, disp=False, return_all=False, c...
[ "def", "_minimize_trust_region", "(", "fun", ",", "x0", ",", "args", "=", "(", ")", ",", "jac", "=", "None", ",", "hess", "=", "None", ",", "hessp", "=", "None", ",", "subproblem", "=", "None", ",", "initial_trust_radius", "=", "1.0", ",", "max_trust_r...
https://github.com/catboost/catboost/blob/167f64f237114a4d10b2b4ee42adb4569137debe/contrib/python/scipy/py3/scipy/optimize/_trustregion.py#L102-L266
rodeofx/OpenWalter
6116fbe3f04f1146c854afbfbdbe944feaee647e
walter/maya/scripts/walterPanel/walterMayaTraverser.py
python
WalterMayaImplementation.invertFrozen
(self, origin)
Inverse the freeze flag of the origin node.
Inverse the freeze flag of the origin node.
[ "Inverse", "the", "freeze", "flag", "of", "the", "origin", "node", "." ]
def invertFrozen(self, origin): """Inverse the freeze flag of the origin node.""" frozen = self.getFrozen(origin) attribute = "{origin}.frozenTransforms".format(origin=origin) pm.setAttr(attribute, 1 - frozen)
[ "def", "invertFrozen", "(", "self", ",", "origin", ")", ":", "frozen", "=", "self", ".", "getFrozen", "(", "origin", ")", "attribute", "=", "\"{origin}.frozenTransforms\"", ".", "format", "(", "origin", "=", "origin", ")", "pm", ".", "setAttr", "(", "attri...
https://github.com/rodeofx/OpenWalter/blob/6116fbe3f04f1146c854afbfbdbe944feaee647e/walter/maya/scripts/walterPanel/walterMayaTraverser.py#L966-L970
wlanjie/AndroidFFmpeg
7baf9122f4b8e1c74e7baf4be5c422c7a5ba5aaf
tools/fdk-aac-build/armeabi/toolchain/lib/python2.7/plat-mac/lib-scriptpackages/CodeWarrior/Metrowerks_Shell_Suite.py
python
Metrowerks_Shell_Suite_Events.Set_Modification_Date
(self, _object, _attributes={}, **_arguments)
Set Modification Date: Changes the internal modification date of the specified file(s) Required argument: List of files Keyword argument to: undocumented, typecode 'ldt ' Keyword argument _attributes: AppleEvent attribute dictionary Returns: Error code for each modified file
Set Modification Date: Changes the internal modification date of the specified file(s) Required argument: List of files Keyword argument to: undocumented, typecode 'ldt ' Keyword argument _attributes: AppleEvent attribute dictionary Returns: Error code for each modified file
[ "Set", "Modification", "Date", ":", "Changes", "the", "internal", "modification", "date", "of", "the", "specified", "file", "(", "s", ")", "Required", "argument", ":", "List", "of", "files", "Keyword", "argument", "to", ":", "undocumented", "typecode", "ldt", ...
def Set_Modification_Date(self, _object, _attributes={}, **_arguments): """Set Modification Date: Changes the internal modification date of the specified file(s) Required argument: List of files Keyword argument to: undocumented, typecode 'ldt ' Keyword argument _attributes: AppleEvent a...
[ "def", "Set_Modification_Date", "(", "self", ",", "_object", ",", "_attributes", "=", "{", "}", ",", "*", "*", "_arguments", ")", ":", "_code", "=", "'MMPR'", "_subcode", "=", "'SMod'", "aetools", ".", "keysubst", "(", "_arguments", ",", "self", ".", "_a...
https://github.com/wlanjie/AndroidFFmpeg/blob/7baf9122f4b8e1c74e7baf4be5c422c7a5ba5aaf/tools/fdk-aac-build/armeabi/toolchain/lib/python2.7/plat-mac/lib-scriptpackages/CodeWarrior/Metrowerks_Shell_Suite.py#L648-L668
apple/turicreate
cce55aa5311300e3ce6af93cb45ba791fd1bdf49
src/python/turicreate/toolkits/evaluation.py
python
roc_curve
(targets, predictions, average=None, index_map=None)
return _turicreate.extensions._supervised_streaming_evaluator( targets, predictions, "roc_curve", opts )
r""" Compute an ROC curve for the given targets and predictions. Currently, only binary classification is supported. Parameters ---------- targets : SArray An SArray containing the observed values. For binary classification, the alpha-numerically first category is considered the ref...
r""" Compute an ROC curve for the given targets and predictions. Currently, only binary classification is supported.
[ "r", "Compute", "an", "ROC", "curve", "for", "the", "given", "targets", "and", "predictions", ".", "Currently", "only", "binary", "classification", "is", "supported", "." ]
def roc_curve(targets, predictions, average=None, index_map=None): r""" Compute an ROC curve for the given targets and predictions. Currently, only binary classification is supported. Parameters ---------- targets : SArray An SArray containing the observed values. For binary classificat...
[ "def", "roc_curve", "(", "targets", ",", "predictions", ",", "average", "=", "None", ",", "index_map", "=", "None", ")", ":", "_supervised_evaluation_error_checking", "(", "targets", ",", "predictions", ")", "_check_categorical_option_type", "(", "\"average\"", ",",...
https://github.com/apple/turicreate/blob/cce55aa5311300e3ce6af93cb45ba791fd1bdf49/src/python/turicreate/toolkits/evaluation.py#L985-L1176
Z3Prover/z3
d745d03afdfdf638d66093e2bfbacaf87187f35b
src/api/python/z3/z3.py
python
ModelRef.get_interp
(self, decl)
Return the interpretation for a given declaration or constant. >>> f = Function('f', IntSort(), IntSort()) >>> x = Int('x') >>> s = Solver() >>> s.add(x > 0, x < 2, f(x) == 0) >>> s.check() sat >>> m = s.model() >>> m[x] 1 >>> m[f] ...
Return the interpretation for a given declaration or constant.
[ "Return", "the", "interpretation", "for", "a", "given", "declaration", "or", "constant", "." ]
def get_interp(self, decl): """Return the interpretation for a given declaration or constant. >>> f = Function('f', IntSort(), IntSort()) >>> x = Int('x') >>> s = Solver() >>> s.add(x > 0, x < 2, f(x) == 0) >>> s.check() sat >>> m = s.model() >>> ...
[ "def", "get_interp", "(", "self", ",", "decl", ")", ":", "if", "z3_debug", "(", ")", ":", "_z3_assert", "(", "isinstance", "(", "decl", ",", "FuncDeclRef", ")", "or", "is_const", "(", "decl", ")", ",", "\"Z3 declaration expected\"", ")", "if", "is_const", ...
https://github.com/Z3Prover/z3/blob/d745d03afdfdf638d66093e2bfbacaf87187f35b/src/api/python/z3/z3.py#L6422-L6454
PaddlePaddle/Paddle
1252f4bb3e574df80aa6d18c7ddae1b3a90bd81c
python/paddle/hapi/callbacks.py
python
Callback.on_train_end
(self, logs=None)
Called at the end of training. Args: logs (dict): The logs is a dict or None. The keys of logs passed by paddle.Model contains 'loss', metric names and `batch_size`.
Called at the end of training.
[ "Called", "at", "the", "end", "of", "training", "." ]
def on_train_end(self, logs=None): """Called at the end of training. Args: logs (dict): The logs is a dict or None. The keys of logs passed by paddle.Model contains 'loss', metric names and `batch_size`. """
[ "def", "on_train_end", "(", "self", ",", "logs", "=", "None", ")", ":" ]
https://github.com/PaddlePaddle/Paddle/blob/1252f4bb3e574df80aa6d18c7ddae1b3a90bd81c/python/paddle/hapi/callbacks.py#L180-L187
hanpfei/chromium-net
392cc1fa3a8f92f42e4071ab6e674d8e0482f83f
build/android/pylib/utils/emulator.py
python
Emulator._AggressiveImageCleanup
()
Aggressive cleanup of emulator images. Experimentally it looks like our current emulator use on the bot leaves image files around in /tmp/android-$USER. If a "random" name gets reused, we choke with a 'File exists' error. TODO(jrg): is there a less hacky way to accomplish the same goal?
Aggressive cleanup of emulator images.
[ "Aggressive", "cleanup", "of", "emulator", "images", "." ]
def _AggressiveImageCleanup(): """Aggressive cleanup of emulator images. Experimentally it looks like our current emulator use on the bot leaves image files around in /tmp/android-$USER. If a "random" name gets reused, we choke with a 'File exists' error. TODO(jrg): is there a less hacky way to ac...
[ "def", "_AggressiveImageCleanup", "(", ")", ":", "logging", ".", "info", "(", "'Aggressive Image Cleanup'", ")", "emulator_imagedir", "=", "'/tmp/android-%s'", "%", "os", ".", "environ", "[", "'USER'", "]", "if", "not", "os", ".", "path", ".", "exists", "(", ...
https://github.com/hanpfei/chromium-net/blob/392cc1fa3a8f92f42e4071ab6e674d8e0482f83f/build/android/pylib/utils/emulator.py#L447-L463
rootm0s/Protectors
5b3f4d11687a5955caf9c3af30666c4bfc2c19ab
OWASP-ZSC/module/readline_windows/pyreadline/modes/emacs.py
python
EmacsMode.transpose_chars
(self, e)
Drag the character before the cursor forward over the character at the cursor, moving the cursor forward as well. If the insertion point is at the end of the line, then this transposes the last two characters of the line. Negative arguments have no effect.
Drag the character before the cursor forward over the character at the cursor, moving the cursor forward as well. If the insertion point is at the end of the line, then this transposes the last two characters of the line. Negative arguments have no effect.
[ "Drag", "the", "character", "before", "the", "cursor", "forward", "over", "the", "character", "at", "the", "cursor", "moving", "the", "cursor", "forward", "as", "well", ".", "If", "the", "insertion", "point", "is", "at", "the", "end", "of", "the", "line", ...
def transpose_chars(self, e): # (C-t) '''Drag the character before the cursor forward over the character at the cursor, moving the cursor forward as well. If the insertion point is at the end of the line, then this transposes the last two characters of the line. Negative arguments have ...
[ "def", "transpose_chars", "(", "self", ",", "e", ")", ":", "# (C-t)", "self", ".", "l_buffer", ".", "transpose_chars", "(", ")", "self", ".", "finalize", "(", ")" ]
https://github.com/rootm0s/Protectors/blob/5b3f4d11687a5955caf9c3af30666c4bfc2c19ab/OWASP-ZSC/module/readline_windows/pyreadline/modes/emacs.py#L400-L406
aws/lumberyard
f85344403c1c2e77ec8c75deb2c116e97b713217
dev/Tools/Python/3.7.10/windows/Lib/tkinter/__init__.py
python
Misc.clipboard_clear
(self, **kw)
Clear the data in the Tk clipboard. A widget specified for the optional displayof keyword argument specifies the target display.
Clear the data in the Tk clipboard.
[ "Clear", "the", "data", "in", "the", "Tk", "clipboard", "." ]
def clipboard_clear(self, **kw): """Clear the data in the Tk clipboard. A widget specified for the optional displayof keyword argument specifies the target display.""" if 'displayof' not in kw: kw['displayof'] = self._w self.tk.call(('clipboard', 'clear') + self._options(kw))
[ "def", "clipboard_clear", "(", "self", ",", "*", "*", "kw", ")", ":", "if", "'displayof'", "not", "in", "kw", ":", "kw", "[", "'displayof'", "]", "=", "self", ".", "_w", "self", ".", "tk", ".", "call", "(", "(", "'clipboard'", ",", "'clear'", ")", ...
https://github.com/aws/lumberyard/blob/f85344403c1c2e77ec8c75deb2c116e97b713217/dev/Tools/Python/3.7.10/windows/Lib/tkinter/__init__.py#L809-L815
catboost/catboost
167f64f237114a4d10b2b4ee42adb4569137debe
contrib/python/prompt-toolkit/py2/prompt_toolkit/interface.py
python
CommandLineInterface.pop_focus
(self)
Pop from the focus stack.
Pop from the focus stack.
[ "Pop", "from", "the", "focus", "stack", "." ]
def pop_focus(self): """ Pop from the focus stack. """ self.buffers.pop_focus(self)
[ "def", "pop_focus", "(", "self", ")", ":", "self", ".", "buffers", ".", "pop_focus", "(", "self", ")" ]
https://github.com/catboost/catboost/blob/167f64f237114a4d10b2b4ee42adb4569137debe/contrib/python/prompt-toolkit/py2/prompt_toolkit/interface.py#L248-L252
catboost/catboost
167f64f237114a4d10b2b4ee42adb4569137debe
contrib/tools/python/src/Lib/lib2to3/fixer_util.py
python
is_import
(node)
return node.type in (syms.import_name, syms.import_from)
Returns true if the node is an import statement.
Returns true if the node is an import statement.
[ "Returns", "true", "if", "the", "node", "is", "an", "import", "statement", "." ]
def is_import(node): """Returns true if the node is an import statement.""" return node.type in (syms.import_name, syms.import_from)
[ "def", "is_import", "(", "node", ")", ":", "return", "node", ".", "type", "in", "(", "syms", ".", "import_name", ",", "syms", ".", "import_from", ")" ]
https://github.com/catboost/catboost/blob/167f64f237114a4d10b2b4ee42adb4569137debe/contrib/tools/python/src/Lib/lib2to3/fixer_util.py#L290-L292
catboost/catboost
167f64f237114a4d10b2b4ee42adb4569137debe
contrib/tools/python/src/Lib/ntpath.py
python
normpath
(path)
return prefix + backslash.join(comps)
Normalize path, eliminating double slashes, etc.
Normalize path, eliminating double slashes, etc.
[ "Normalize", "path", "eliminating", "double", "slashes", "etc", "." ]
def normpath(path): """Normalize path, eliminating double slashes, etc.""" # Preserve unicode (if path is unicode) backslash, dot = (u'\\', u'.') if isinstance(path, _unicode) else ('\\', '.') if path.startswith(('\\\\.\\', '\\\\?\\')): # in the case of paths with these prefixes: # \\.\ ...
[ "def", "normpath", "(", "path", ")", ":", "# Preserve unicode (if path is unicode)", "backslash", ",", "dot", "=", "(", "u'\\\\'", ",", "u'.'", ")", "if", "isinstance", "(", "path", ",", "_unicode", ")", "else", "(", "'\\\\'", ",", "'.'", ")", "if", "path"...
https://github.com/catboost/catboost/blob/167f64f237114a4d10b2b4ee42adb4569137debe/contrib/tools/python/src/Lib/ntpath.py#L415-L464
gem5/gem5
141cc37c2d4b93959d4c249b8f7e6a8b2ef75338
src/python/gem5/runtime.py
python
get_runtime_isa
()
return isa_map[isa_str]
Gets the target ISA. This can be inferred at runtime. :returns: The target ISA.
Gets the target ISA. This can be inferred at runtime.
[ "Gets", "the", "target", "ISA", ".", "This", "can", "be", "inferred", "at", "runtime", "." ]
def get_runtime_isa() -> ISA: """Gets the target ISA. This can be inferred at runtime. :returns: The target ISA. """ isa_map = { "sparc": ISA.SPARC, "mips": ISA.MIPS, "null": ISA.NULL, "arm": ISA.ARM, "x86": ISA.X86, "power": ISA.POWER, "riscv...
[ "def", "get_runtime_isa", "(", ")", "->", "ISA", ":", "isa_map", "=", "{", "\"sparc\"", ":", "ISA", ".", "SPARC", ",", "\"mips\"", ":", "ISA", ".", "MIPS", ",", "\"null\"", ":", "ISA", ".", "NULL", ",", "\"arm\"", ":", "ISA", ".", "ARM", ",", "\"x8...
https://github.com/gem5/gem5/blob/141cc37c2d4b93959d4c249b8f7e6a8b2ef75338/src/python/gem5/runtime.py#L37-L59
cmu-db/noisepage
79276e68fe83322f1249e8a8be96bd63c583ae56
build-support/cpplint.py
python
_CppLintState.AddFilters
(self, filters)
Adds more filters to the existing list of error-message filters.
Adds more filters to the existing list of error-message filters.
[ "Adds", "more", "filters", "to", "the", "existing", "list", "of", "error", "-", "message", "filters", "." ]
def AddFilters(self, filters): """ Adds more filters to the existing list of error-message filters. """ for filt in filters.split(','): clean_filt = filt.strip() if clean_filt: self.filters.append(clean_filt) for filt in self.filters: if not (f...
[ "def", "AddFilters", "(", "self", ",", "filters", ")", ":", "for", "filt", "in", "filters", ".", "split", "(", "','", ")", ":", "clean_filt", "=", "filt", ".", "strip", "(", ")", "if", "clean_filt", ":", "self", ".", "filters", ".", "append", "(", ...
https://github.com/cmu-db/noisepage/blob/79276e68fe83322f1249e8a8be96bd63c583ae56/build-support/cpplint.py#L1068-L1077
pytorch/pytorch
7176c92687d3cc847cc046bf002269c6949a21c2
torch/ao/quantization/fx/prepare.py
python
prepare
( model: GraphModule, qconfig_dict: Any, is_qat: bool, node_name_to_scope: Dict[str, Tuple[str, type]], prepare_custom_config_dict: Optional[Dict[str, Any]] = None, equalization_qconfig_dict: Optional[Dict[str, Any]] = None, backend_config_dict: Optional[Dict[str,...
return model
standalone_module means it a submodule that is not inlined in parent module, and will be quantized separately as one unit. How the standalone module is observed is specified by `input_quantized_idxs` and `output_quantized_idxs` in the prepare_custom_config for the standalone module Args: node_n...
standalone_module means it a submodule that is not inlined in parent module, and will be quantized separately as one unit.
[ "standalone_module", "means", "it", "a", "submodule", "that", "is", "not", "inlined", "in", "parent", "module", "and", "will", "be", "quantized", "separately", "as", "one", "unit", "." ]
def prepare( model: GraphModule, qconfig_dict: Any, is_qat: bool, node_name_to_scope: Dict[str, Tuple[str, type]], prepare_custom_config_dict: Optional[Dict[str, Any]] = None, equalization_qconfig_dict: Optional[Dict[str, Any]] = None, backend_config_dict: Optiona...
[ "def", "prepare", "(", "model", ":", "GraphModule", ",", "qconfig_dict", ":", "Any", ",", "is_qat", ":", "bool", ",", "node_name_to_scope", ":", "Dict", "[", "str", ",", "Tuple", "[", "str", ",", "type", "]", "]", ",", "prepare_custom_config_dict", ":", ...
https://github.com/pytorch/pytorch/blob/7176c92687d3cc847cc046bf002269c6949a21c2/torch/ao/quantization/fx/prepare.py#L1266-L1426
aws/lumberyard
f85344403c1c2e77ec8c75deb2c116e97b713217
dev/Gems/CloudGemMetric/v1/AWS/common-code/Lib/numba/cuda/cuda_paths.py
python
get_conda_ctk
()
return os.path.dirname(max(paths))
Return path to directory containing the shared libraries of cudatoolkit.
Return path to directory containing the shared libraries of cudatoolkit.
[ "Return", "path", "to", "directory", "containing", "the", "shared", "libraries", "of", "cudatoolkit", "." ]
def get_conda_ctk(): """Return path to directory containing the shared libraries of cudatoolkit. """ is_conda_env = os.path.exists(os.path.join(sys.prefix, 'conda-meta')) if not is_conda_env: return # Asssume the existence of NVVM to imply cudatoolkit installed paths = find_lib('nvvm') ...
[ "def", "get_conda_ctk", "(", ")", ":", "is_conda_env", "=", "os", ".", "path", ".", "exists", "(", "os", ".", "path", ".", "join", "(", "sys", ".", "prefix", ",", "'conda-meta'", ")", ")", "if", "not", "is_conda_env", ":", "return", "# Asssume the existe...
https://github.com/aws/lumberyard/blob/f85344403c1c2e77ec8c75deb2c116e97b713217/dev/Gems/CloudGemMetric/v1/AWS/common-code/Lib/numba/cuda/cuda_paths.py#L113-L124
wlanjie/AndroidFFmpeg
7baf9122f4b8e1c74e7baf4be5c422c7a5ba5aaf
tools/fdk-aac-build/armeabi/toolchain/lib/python2.7/numbers.py
python
Integral.__rshift__
(self, other)
self >> other
self >> other
[ "self", ">>", "other" ]
def __rshift__(self, other): """self >> other""" raise NotImplementedError
[ "def", "__rshift__", "(", "self", ",", "other", ")", ":", "raise", "NotImplementedError" ]
https://github.com/wlanjie/AndroidFFmpeg/blob/7baf9122f4b8e1c74e7baf4be5c422c7a5ba5aaf/tools/fdk-aac-build/armeabi/toolchain/lib/python2.7/numbers.py#L331-L333
eclipse/sumo
7132a9b8b6eea734bdec38479026b4d8c4336d03
tools/contributed/sumopy/agilepy/lib_base/geometry.py
python
get_vec_on_polyline_from_pos
(polyline, pos, length, angle=0.0)
return np.array([[x2, y2, z2], [x2 + u2 * dxn, y1 + u2 * dyn, z2]], np.float32)
Returns a vector ((x1,y1,z1),(x2,y2,z2)) where first coordinate is the point on the polyline at position pos and the second coordinate is length meters ahead with an angle with respect to the direction of the polyline. TODO: Attention angle not yet implemented
Returns a vector ((x1,y1,z1),(x2,y2,z2)) where first coordinate is the point on the polyline at position pos and the second coordinate is length meters ahead with an angle with respect to the direction of the polyline.
[ "Returns", "a", "vector", "((", "x1", "y1", "z1", ")", "(", "x2", "y2", "z2", "))", "where", "first", "coordinate", "is", "the", "point", "on", "the", "polyline", "at", "position", "pos", "and", "the", "second", "coordinate", "is", "length", "meters", ...
def get_vec_on_polyline_from_pos(polyline, pos, length, angle=0.0): """ Returns a vector ((x1,y1,z1),(x2,y2,z2)) where first coordinate is the point on the polyline at position pos and the second coordinate is length meters ahead with an angle with respect to the direction of the polyline. TOD...
[ "def", "get_vec_on_polyline_from_pos", "(", "polyline", ",", "pos", ",", "length", ",", "angle", "=", "0.0", ")", ":", "pos_edge", "=", "0.0", "pos_edge_pre", "=", "0.0", "x1", ",", "y1", ",", "z1", "=", "polyline", "[", "0", "]", "for", "j", "in", "...
https://github.com/eclipse/sumo/blob/7132a9b8b6eea734bdec38479026b4d8c4336d03/tools/contributed/sumopy/agilepy/lib_base/geometry.py#L108-L143
snap-stanford/snap-python
d53c51b0a26aa7e3e7400b014cdf728948fde80a
setup/snap.py
python
TStr.GetSubStr
(self, *args)
return _snap.TStr_GetSubStr(self, *args)
GetSubStr(TStr self, int const & BChN, int const & EChN) -> TStr Parameters: BChN: int const & EChN: int const & GetSubStr(TStr self, int const & BChN) -> TStr Parameters: BChN: int const &
GetSubStr(TStr self, int const & BChN, int const & EChN) -> TStr
[ "GetSubStr", "(", "TStr", "self", "int", "const", "&", "BChN", "int", "const", "&", "EChN", ")", "-", ">", "TStr" ]
def GetSubStr(self, *args): """ GetSubStr(TStr self, int const & BChN, int const & EChN) -> TStr Parameters: BChN: int const & EChN: int const & GetSubStr(TStr self, int const & BChN) -> TStr Parameters: BChN: int const & """ ...
[ "def", "GetSubStr", "(", "self", ",", "*", "args", ")", ":", "return", "_snap", ".", "TStr_GetSubStr", "(", "self", ",", "*", "args", ")" ]
https://github.com/snap-stanford/snap-python/blob/d53c51b0a26aa7e3e7400b014cdf728948fde80a/setup/snap.py#L9883-L9897
vicaya/hypertable
e7386f799c238c109ae47973417c2a2c7f750825
src/py/ThriftClient/gen-py/hyperthrift/gen/ClientService.py
python
Client.next_cells
(self, scanner)
return self.recv_next_cells()
Iterate over cells of a scanner @param scanner - scanner id Parameters: - scanner
Iterate over cells of a scanner
[ "Iterate", "over", "cells", "of", "a", "scanner" ]
def next_cells(self, scanner): """ Iterate over cells of a scanner @param scanner - scanner id Parameters: - scanner """ self.send_next_cells(scanner) return self.recv_next_cells()
[ "def", "next_cells", "(", "self", ",", "scanner", ")", ":", "self", ".", "send_next_cells", "(", "scanner", ")", "return", "self", ".", "recv_next_cells", "(", ")" ]
https://github.com/vicaya/hypertable/blob/e7386f799c238c109ae47973417c2a2c7f750825/src/py/ThriftClient/gen-py/hyperthrift/gen/ClientService.py#L442-L452
eclipse/sumo
7132a9b8b6eea734bdec38479026b4d8c4336d03
tools/traci/_gui.py
python
GuiDomain.setZoom
(self, viewID, zoom)
setZoom(string, double) -> None Set the current zoom factor for the given view.
setZoom(string, double) -> None
[ "setZoom", "(", "string", "double", ")", "-", ">", "None" ]
def setZoom(self, viewID, zoom): """setZoom(string, double) -> None Set the current zoom factor for the given view. """ self._setCmd(tc.VAR_VIEW_ZOOM, viewID, "d", zoom)
[ "def", "setZoom", "(", "self", ",", "viewID", ",", "zoom", ")", ":", "self", ".", "_setCmd", "(", "tc", ".", "VAR_VIEW_ZOOM", ",", "viewID", ",", "\"d\"", ",", "zoom", ")" ]
https://github.com/eclipse/sumo/blob/7132a9b8b6eea734bdec38479026b4d8c4336d03/tools/traci/_gui.py#L64-L69
swift/swift
12d031cf8177fdec0137f9aa7e2912fa23c4416b
3rdParty/SCons/scons-3.0.1/engine/SCons/Memoize.py
python
CountDictCall
(keyfunc)
return decorator
Decorator for counting memoizer hits/misses while accessing dictionary values with a key-generating function. Like CountMethodCall above, it wraps the given method fn and uses a CountDict object to keep track of the caching statistics. The dict-key function keyfunc has to get pas...
Decorator for counting memoizer hits/misses while accessing dictionary values with a key-generating function. Like CountMethodCall above, it wraps the given method fn and uses a CountDict object to keep track of the caching statistics. The dict-key function keyfunc has to get pas...
[ "Decorator", "for", "counting", "memoizer", "hits", "/", "misses", "while", "accessing", "dictionary", "values", "with", "a", "key", "-", "generating", "function", ".", "Like", "CountMethodCall", "above", "it", "wraps", "the", "given", "method", "fn", "and", "...
def CountDictCall(keyfunc): """ Decorator for counting memoizer hits/misses while accessing dictionary values with a key-generating function. Like CountMethodCall above, it wraps the given method fn and uses a CountDict object to keep track of the caching statistics. The dict-key fun...
[ "def", "CountDictCall", "(", "keyfunc", ")", ":", "def", "decorator", "(", "fn", ")", ":", "if", "use_memoizer", ":", "def", "wrapper", "(", "self", ",", "*", "args", ",", "*", "*", "kwargs", ")", ":", "global", "CounterList", "key", "=", "self", "."...
https://github.com/swift/swift/blob/12d031cf8177fdec0137f9aa7e2912fa23c4416b/3rdParty/SCons/scons-3.0.1/engine/SCons/Memoize.py#L216-L239
wxWidgets/wxPython-Classic
19571e1ae65f1ac445f5491474121998c97a1bf0
contrib/gizmos/osx_carbon/gizmos.py
python
StaticPicture.__init__
(self, *args, **kwargs)
__init__(self, Window parent, int id=-1, Bitmap label=wxNullBitmap, Point pos=DefaultPosition, Size size=DefaultSize, long style=0, String name=StaticPictureNameStr) -> StaticPicture
__init__(self, Window parent, int id=-1, Bitmap label=wxNullBitmap, Point pos=DefaultPosition, Size size=DefaultSize, long style=0, String name=StaticPictureNameStr) -> StaticPicture
[ "__init__", "(", "self", "Window", "parent", "int", "id", "=", "-", "1", "Bitmap", "label", "=", "wxNullBitmap", "Point", "pos", "=", "DefaultPosition", "Size", "size", "=", "DefaultSize", "long", "style", "=", "0", "String", "name", "=", "StaticPictureNameS...
def __init__(self, *args, **kwargs): """ __init__(self, Window parent, int id=-1, Bitmap label=wxNullBitmap, Point pos=DefaultPosition, Size size=DefaultSize, long style=0, String name=StaticPictureNameStr) -> StaticPicture """ _gizmos.StaticPicture_swiginit(se...
[ "def", "__init__", "(", "self", ",", "*", "args", ",", "*", "*", "kwargs", ")", ":", "_gizmos", ".", "StaticPicture_swiginit", "(", "self", ",", "_gizmos", ".", "new_StaticPicture", "(", "*", "args", ",", "*", "*", "kwargs", ")", ")", "self", ".", "_...
https://github.com/wxWidgets/wxPython-Classic/blob/19571e1ae65f1ac445f5491474121998c97a1bf0/contrib/gizmos/osx_carbon/gizmos.py#L978-L985
wxWidgets/wxPython-Classic
19571e1ae65f1ac445f5491474121998c97a1bf0
wx/lib/agw/shortcuteditor.py
python
Shortcut.SetAccelerator
(self, accelerator)
Sets the string accelerator associated with this shortcut. :param string `accelerator`: a string representing the shortcut string (accelerator).
Sets the string accelerator associated with this shortcut.
[ "Sets", "the", "string", "accelerator", "associated", "with", "this", "shortcut", "." ]
def SetAccelerator(self, accelerator): """ Sets the string accelerator associated with this shortcut. :param string `accelerator`: a string representing the shortcut string (accelerator). """ self.accelerator = accelerator self.changed = False if self.originalA...
[ "def", "SetAccelerator", "(", "self", ",", "accelerator", ")", ":", "self", ".", "accelerator", "=", "accelerator", "self", ".", "changed", "=", "False", "if", "self", ".", "originalAccelerator", "!=", "accelerator", ":", "self", ".", "changed", "=", "True" ...
https://github.com/wxWidgets/wxPython-Classic/blob/19571e1ae65f1ac445f5491474121998c97a1bf0/wx/lib/agw/shortcuteditor.py#L1220-L1231
aws/lumberyard
f85344403c1c2e77ec8c75deb2c116e97b713217
dev/Gems/CloudGemMetric/v1/AWS/python/windows/Lib/pandas/core/dtypes/cast.py
python
construct_1d_ndarray_preserving_na
(values, dtype=None, copy: bool = False)
return subarr
Construct a new ndarray, coercing `values` to `dtype`, preserving NA. Parameters ---------- values : Sequence dtype : numpy.dtype, optional copy : bool, default False Note that copies may still be made with ``copy=False`` if casting is required. Returns ------- arr : nd...
Construct a new ndarray, coercing `values` to `dtype`, preserving NA.
[ "Construct", "a", "new", "ndarray", "coercing", "values", "to", "dtype", "preserving", "NA", "." ]
def construct_1d_ndarray_preserving_na(values, dtype=None, copy: bool = False): """ Construct a new ndarray, coercing `values` to `dtype`, preserving NA. Parameters ---------- values : Sequence dtype : numpy.dtype, optional copy : bool, default False Note that copies may still be ma...
[ "def", "construct_1d_ndarray_preserving_na", "(", "values", ",", "dtype", "=", "None", ",", "copy", ":", "bool", "=", "False", ")", ":", "subarr", "=", "np", ".", "array", "(", "values", ",", "dtype", "=", "dtype", ",", "copy", "=", "copy", ")", "if", ...
https://github.com/aws/lumberyard/blob/f85344403c1c2e77ec8c75deb2c116e97b713217/dev/Gems/CloudGemMetric/v1/AWS/python/windows/Lib/pandas/core/dtypes/cast.py#L1483-L1521
hanpfei/chromium-net
392cc1fa3a8f92f42e4071ab6e674d8e0482f83f
third_party/catapult/telemetry/third_party/web-page-replay/third_party/dns/name.py
python
Name.split
(self, depth)
return (Name(self[: -depth]), Name(self[-depth :]))
Split a name into a prefix and suffix at depth. @param depth: the number of labels in the suffix @type depth: int @raises ValueError: the depth was not >= 0 and <= the length of the name. @returns: the tuple (prefix, suffix) @rtype: tuple
Split a name into a prefix and suffix at depth.
[ "Split", "a", "name", "into", "a", "prefix", "and", "suffix", "at", "depth", "." ]
def split(self, depth): """Split a name into a prefix and suffix at depth. @param depth: the number of labels in the suffix @type depth: int @raises ValueError: the depth was not >= 0 and <= the length of the name. @returns: the tuple (prefix, suffix) @rtype: tup...
[ "def", "split", "(", "self", ",", "depth", ")", ":", "l", "=", "len", "(", "self", ".", "labels", ")", "if", "depth", "==", "0", ":", "return", "(", "self", ",", "dns", ".", "name", ".", "empty", ")", "elif", "depth", "==", "l", ":", "return", ...
https://github.com/hanpfei/chromium-net/blob/392cc1fa3a8f92f42e4071ab6e674d8e0482f83f/third_party/catapult/telemetry/third_party/web-page-replay/third_party/dns/name.py#L449-L467
aws/lumberyard
f85344403c1c2e77ec8c75deb2c116e97b713217
dev/Tools/Python/3.7.10/windows/Lib/site-packages/pip/_internal/cli/req_command.py
python
with_cleanup
(func)
return wrapper
Decorator for common logic related to managing temporary directories.
Decorator for common logic related to managing temporary directories.
[ "Decorator", "for", "common", "logic", "related", "to", "managing", "temporary", "directories", "." ]
def with_cleanup(func): # type: (Any) -> Any """Decorator for common logic related to managing temporary directories. """ def configure_tempdir_registry(registry): # type: (TempDirectoryTypeRegistry) -> None for t in KEEPABLE_TEMPDIR_TYPES: registry.set_delete(t, False) ...
[ "def", "with_cleanup", "(", "func", ")", ":", "# type: (Any) -> Any", "def", "configure_tempdir_registry", "(", "registry", ")", ":", "# type: (TempDirectoryTypeRegistry) -> None", "for", "t", "in", "KEEPABLE_TEMPDIR_TYPES", ":", "registry", ".", "set_delete", "(", "t",...
https://github.com/aws/lumberyard/blob/f85344403c1c2e77ec8c75deb2c116e97b713217/dev/Tools/Python/3.7.10/windows/Lib/site-packages/pip/_internal/cli/req_command.py#L161-L186
openmm/openmm
cb293447c4fc8b03976dfe11399f107bab70f3d9
wrappers/python/openmm/unit/unit.py
python
Unit.__pow__
(self, exponent)
return new_unit
Raise a Unit to a power. Returns a new Unit with different exponents on the BaseUnits.
Raise a Unit to a power.
[ "Raise", "a", "Unit", "to", "a", "power", "." ]
def __pow__(self, exponent): """Raise a Unit to a power. Returns a new Unit with different exponents on the BaseUnits. """ if self in Unit._pow_cache: if exponent in Unit._pow_cache[self]: return Unit._pow_cache[self][exponent] else: Unit....
[ "def", "__pow__", "(", "self", ",", "exponent", ")", ":", "if", "self", "in", "Unit", ".", "_pow_cache", ":", "if", "exponent", "in", "Unit", ".", "_pow_cache", "[", "self", "]", ":", "return", "Unit", ".", "_pow_cache", "[", "self", "]", "[", "expon...
https://github.com/openmm/openmm/blob/cb293447c4fc8b03976dfe11399f107bab70f3d9/wrappers/python/openmm/unit/unit.py#L235-L250
neopenx/Dragon
0e639a7319035ddc81918bd3df059230436ee0a1
Dragon/python/dragon/config.py
python
SetRandomSeed
(seed)
Set the global random seed. Parameters ---------- seed : int The seed to use. Returns ------- None
Set the global random seed.
[ "Set", "the", "global", "random", "seed", "." ]
def SetRandomSeed(seed): """Set the global random seed. Parameters ---------- seed : int The seed to use. Returns ------- None """ global option option['random_seed'] = seed
[ "def", "SetRandomSeed", "(", "seed", ")", ":", "global", "option", "option", "[", "'random_seed'", "]", "=", "seed" ]
https://github.com/neopenx/Dragon/blob/0e639a7319035ddc81918bd3df059230436ee0a1/Dragon/python/dragon/config.py#L89-L103
projectchrono/chrono
92015a8a6f84ef63ac8206a74e54a676251dcc89
src/demos/python/chrono-tensorflow/PPO/train_parallel.py
python
add_value
(trajectories, val_func)
Adds estimated value to all time steps of all trajectories Args: trajectories: as returned by run_policy() val_func: object with predict() method, takes observations and returns predicted state value Returns: None (mutates trajectories dictionary to add 'values')
Adds estimated value to all time steps of all trajectories
[ "Adds", "estimated", "value", "to", "all", "time", "steps", "of", "all", "trajectories" ]
def add_value(trajectories, val_func): """ Adds estimated value to all time steps of all trajectories Args: trajectories: as returned by run_policy() val_func: object with predict() method, takes observations and returns predicted state value Returns: None (mutates traj...
[ "def", "add_value", "(", "trajectories", ",", "val_func", ")", ":", "for", "trajectory", "in", "trajectories", ":", "observes", "=", "trajectory", "[", "'observes'", "]", "values", "=", "val_func", ".", "predict", "(", "observes", ")", "trajectory", "[", "'v...
https://github.com/projectchrono/chrono/blob/92015a8a6f84ef63ac8206a74e54a676251dcc89/src/demos/python/chrono-tensorflow/PPO/train_parallel.py#L115-L129
alexgkendall/caffe-posenet
62aafbd7c45df91acdba14f5d1406d8295c2bc6f
scripts/cpp_lint.py
python
_NestingState.SeenOpenBrace
(self)
return (not self.stack) or self.stack[-1].seen_open_brace
Check if we have seen the opening brace for the innermost block. Returns: True if we have seen the opening brace, False if the innermost block is still expecting an opening brace.
Check if we have seen the opening brace for the innermost block.
[ "Check", "if", "we", "have", "seen", "the", "opening", "brace", "for", "the", "innermost", "block", "." ]
def SeenOpenBrace(self): """Check if we have seen the opening brace for the innermost block. Returns: True if we have seen the opening brace, False if the innermost block is still expecting an opening brace. """ return (not self.stack) or self.stack[-1].seen_open_brace
[ "def", "SeenOpenBrace", "(", "self", ")", ":", "return", "(", "not", "self", ".", "stack", ")", "or", "self", ".", "stack", "[", "-", "1", "]", ".", "seen_open_brace" ]
https://github.com/alexgkendall/caffe-posenet/blob/62aafbd7c45df91acdba14f5d1406d8295c2bc6f/scripts/cpp_lint.py#L1931-L1938
mantidproject/mantid
03deeb89254ec4289edb8771e0188c2090a02f32
qt/python/mantidqt/mantidqt/widgets/samplelogs/model.py
python
SampleLogsModel.set_exp
(self, exp)
Change the experiment info number
Change the experiment info number
[ "Change", "the", "experiment", "info", "number" ]
def set_exp(self, exp): """Change the experiment info number""" self._exp = exp self._set_run()
[ "def", "set_exp", "(", "self", ",", "exp", ")", ":", "self", ".", "_exp", "=", "exp", "self", ".", "_set_run", "(", ")" ]
https://github.com/mantidproject/mantid/blob/03deeb89254ec4289edb8771e0188c2090a02f32/qt/python/mantidqt/mantidqt/widgets/samplelogs/model.py#L86-L89
google/mysql-protobuf
467cda676afaa49e762c5c9164a43f6ad31a1fbf
protobuf/python/google/protobuf/internal/containers.py
python
RepeatedScalarFieldContainer.__delitem__
(self, key)
Deletes the item at the specified position.
Deletes the item at the specified position.
[ "Deletes", "the", "item", "at", "the", "specified", "position", "." ]
def __delitem__(self, key): """Deletes the item at the specified position.""" del self._values[key] self._message_listener.Modified()
[ "def", "__delitem__", "(", "self", ",", "key", ")", ":", "del", "self", ".", "_values", "[", "key", "]", "self", ".", "_message_listener", ".", "Modified", "(", ")" ]
https://github.com/google/mysql-protobuf/blob/467cda676afaa49e762c5c9164a43f6ad31a1fbf/protobuf/python/google/protobuf/internal/containers.py#L319-L322
NVIDIA/DALI
bf16cc86ba8f091b145f91962f21fe1b6aff243d
docs/examples/use_cases/tensorflow/efficientdet/hparams_config.py
python
Config.parse_from_str
(self, config_str: Text)
Parse a string like 'x.y=1,x.z=2' to nested dict {x: {y: 1, z: 2}}.
Parse a string like 'x.y=1,x.z=2' to nested dict {x: {y: 1, z: 2}}.
[ "Parse", "a", "string", "like", "x", ".", "y", "=", "1", "x", ".", "z", "=", "2", "to", "nested", "dict", "{", "x", ":", "{", "y", ":", "1", "z", ":", "2", "}}", "." ]
def parse_from_str(self, config_str: Text) -> Dict[Any, Any]: """Parse a string like 'x.y=1,x.z=2' to nested dict {x: {y: 1, z: 2}}.""" if not config_str: return {} config_dict = {} try: for kv_pair in config_str.split(","): if not kv_pair: # skip...
[ "def", "parse_from_str", "(", "self", ",", "config_str", ":", "Text", ")", "->", "Dict", "[", "Any", ",", "Any", "]", ":", "if", "not", "config_str", ":", "return", "{", "}", "config_dict", "=", "{", "}", "try", ":", "for", "kv_pair", "in", "config_s...
https://github.com/NVIDIA/DALI/blob/bf16cc86ba8f091b145f91962f21fe1b6aff243d/docs/examples/use_cases/tensorflow/efficientdet/hparams_config.py#L124-L161
wlanjie/AndroidFFmpeg
7baf9122f4b8e1c74e7baf4be5c422c7a5ba5aaf
tools/fdk-aac-build/x86/toolchain/lib/python2.7/lib2to3/pytree.py
python
Node._eq
(self, other)
return (self.type, self.children) == (other.type, other.children)
Compare two nodes for equality.
Compare two nodes for equality.
[ "Compare", "two", "nodes", "for", "equality", "." ]
def _eq(self, other): """Compare two nodes for equality.""" return (self.type, self.children) == (other.type, other.children)
[ "def", "_eq", "(", "self", ",", "other", ")", ":", "return", "(", "self", ".", "type", ",", "self", ".", "children", ")", "==", "(", "other", ".", "type", ",", "other", ".", "children", ")" ]
https://github.com/wlanjie/AndroidFFmpeg/blob/7baf9122f4b8e1c74e7baf4be5c422c7a5ba5aaf/tools/fdk-aac-build/x86/toolchain/lib/python2.7/lib2to3/pytree.py#L285-L287
hanpfei/chromium-net
392cc1fa3a8f92f42e4071ab6e674d8e0482f83f
third_party/catapult/telemetry/third_party/pyserial/serial/urlhandler/protocol_hwgrep.py
python
Serial.setPort
(self, value)
translate port name before storing it
translate port name before storing it
[ "translate", "port", "name", "before", "storing", "it" ]
def setPort(self, value): """translate port name before storing it""" if isinstance(value, basestring) and value.startswith('hwgrep://'): serial.Serial.setPort(self, self.fromURL(value)) else: serial.Serial.setPort(self, value)
[ "def", "setPort", "(", "self", ",", "value", ")", ":", "if", "isinstance", "(", "value", ",", "basestring", ")", "and", "value", ".", "startswith", "(", "'hwgrep://'", ")", ":", "serial", ".", "Serial", ".", "setPort", "(", "self", ",", "self", ".", ...
https://github.com/hanpfei/chromium-net/blob/392cc1fa3a8f92f42e4071ab6e674d8e0482f83f/third_party/catapult/telemetry/third_party/pyserial/serial/urlhandler/protocol_hwgrep.py#L20-L25
catboost/catboost
167f64f237114a4d10b2b4ee42adb4569137debe
contrib/python/scipy/py2/scipy/fftpack/basic.py
python
_asfarray
(x)
Like numpy asfarray, except that it does not modify x dtype if x is already an array with a float dtype, and do not cast complex types to real.
Like numpy asfarray, except that it does not modify x dtype if x is already an array with a float dtype, and do not cast complex types to real.
[ "Like", "numpy", "asfarray", "except", "that", "it", "does", "not", "modify", "x", "dtype", "if", "x", "is", "already", "an", "array", "with", "a", "float", "dtype", "and", "do", "not", "cast", "complex", "types", "to", "real", "." ]
def _asfarray(x): """Like numpy asfarray, except that it does not modify x dtype if x is already an array with a float dtype, and do not cast complex types to real.""" if hasattr(x, "dtype") and x.dtype.char in numpy.typecodes["AllFloat"]: # 'dtype' attribute does not ensure that the # o...
[ "def", "_asfarray", "(", "x", ")", ":", "if", "hasattr", "(", "x", ",", "\"dtype\"", ")", "and", "x", ".", "dtype", ".", "char", "in", "numpy", ".", "typecodes", "[", "\"AllFloat\"", "]", ":", "# 'dtype' attribute does not ensure that the", "# object is an nda...
https://github.com/catboost/catboost/blob/167f64f237114a4d10b2b4ee42adb4569137debe/contrib/python/scipy/py2/scipy/fftpack/basic.py#L125-L145
zeroc-ice/ice
6df7df6039674d58fb5ab9a08e46f28591a210f7
python/python/Ice/__init__.py
python
Application.callbackOnInterrupt
(self)
Configures the application to invoke interruptCallback when interrupted by a signal.
Configures the application to invoke interruptCallback when interrupted by a signal.
[ "Configures", "the", "application", "to", "invoke", "interruptCallback", "when", "interrupted", "by", "a", "signal", "." ]
def callbackOnInterrupt(self): '''Configures the application to invoke interruptCallback when interrupted by a signal.''' if Application._signalPolicy == Application.HandleSignals: self._condVar.acquire() if self._ctrlCHandler.getCallback() == self._holdInterruptCallback: ...
[ "def", "callbackOnInterrupt", "(", "self", ")", ":", "if", "Application", ".", "_signalPolicy", "==", "Application", ".", "HandleSignals", ":", "self", ".", "_condVar", ".", "acquire", "(", ")", "if", "self", ".", "_ctrlCHandler", ".", "getCallback", "(", ")...
https://github.com/zeroc-ice/ice/blob/6df7df6039674d58fb5ab9a08e46f28591a210f7/python/python/Ice/__init__.py#L1654-L1666
windystrife/UnrealEngine_NVIDIAGameWorks
b50e6338a7c5b26374d66306ebc7807541ff815e
Engine/Extras/ThirdPartyNotUE/emsdk/Win64/python/2.7.5.3_64bit/Lib/site-packages/pythonwin/pywin/framework/stdin.py
python
Stdin.__get_line
(self)
Grab one line from get_input_line() and append it to the buffer.
Grab one line from get_input_line() and append it to the buffer.
[ "Grab", "one", "line", "from", "get_input_line", "()", "and", "append", "it", "to", "the", "buffer", "." ]
def __get_line(self): """Grab one line from get_input_line() and append it to the buffer. """ line = get_input_line() print '>>>',line # echo input to console self.buffer = self.buffer + line + '\n'
[ "def", "__get_line", "(", "self", ")", ":", "line", "=", "get_input_line", "(", ")", "print", "'>>>'", ",", "line", "# echo input to console", "self", ".", "buffer", "=", "self", ".", "buffer", "+", "line", "+", "'\\n'" ]
https://github.com/windystrife/UnrealEngine_NVIDIAGameWorks/blob/b50e6338a7c5b26374d66306ebc7807541ff815e/Engine/Extras/ThirdPartyNotUE/emsdk/Win64/python/2.7.5.3_64bit/Lib/site-packages/pythonwin/pywin/framework/stdin.py#L104-L109
apiaryio/drafter
4634ebd07f6c6f257cc656598ccd535492fdfb55
tools/gyp/pylib/gyp/generator/msvs.py
python
_GetMSBuildExternalBuilderTargets
(spec)
return targets
Return a list of MSBuild targets for external builders. The "Build" and "Clean" targets are always generated. If the spec contains 'msvs_external_builder_clcompile_cmd', then the "ClCompile" target will also be generated, to support building selected C/C++ files. Arguments: spec: The gyp target spec. R...
Return a list of MSBuild targets for external builders.
[ "Return", "a", "list", "of", "MSBuild", "targets", "for", "external", "builders", "." ]
def _GetMSBuildExternalBuilderTargets(spec): """Return a list of MSBuild targets for external builders. The "Build" and "Clean" targets are always generated. If the spec contains 'msvs_external_builder_clcompile_cmd', then the "ClCompile" target will also be generated, to support building selected C/C++ files...
[ "def", "_GetMSBuildExternalBuilderTargets", "(", "spec", ")", ":", "build_cmd", "=", "_BuildCommandLineForRuleRaw", "(", "spec", ",", "spec", "[", "'msvs_external_builder_build_cmd'", "]", ",", "False", ",", "False", ",", "False", ",", "False", ")", "build_target", ...
https://github.com/apiaryio/drafter/blob/4634ebd07f6c6f257cc656598ccd535492fdfb55/tools/gyp/pylib/gyp/generator/msvs.py#L3346-L3380
balint256/gr-baz
937834ce3520b730277328d8e0cdebb3f2b1aafc
python/usrp/simple_usrp.py
python
_simple_source.__init__
(self, which, side='A', rx_ant='RXA', no_hb=False)
USRP simple source contructor. @param which the unit number @param side the usrp side A or B @param rx_ant the antenna choice @param no_hb disable half band filters
USRP simple source contructor.
[ "USRP", "simple", "source", "contructor", "." ]
def __init__(self, which, side='A', rx_ant='RXA', no_hb=False): """ USRP simple source contructor. @param which the unit number @param side the usrp side A or B @param rx_ant the antenna choice @param no_hb disable half band filters """ self._no_hb = no_hb #initialize hier2 block gr.hier_block2.__in...
[ "def", "__init__", "(", "self", ",", "which", ",", "side", "=", "'A'", ",", "rx_ant", "=", "'RXA'", ",", "no_hb", "=", "False", ")", ":", "self", ".", "_no_hb", "=", "no_hb", "#initialize hier2 block", "gr", ".", "hier_block2", ".", "__init__", "(", "s...
https://github.com/balint256/gr-baz/blob/937834ce3520b730277328d8e0cdebb3f2b1aafc/python/usrp/simple_usrp.py#L30-L53
catboost/catboost
167f64f237114a4d10b2b4ee42adb4569137debe
contrib/python/protobuf/py3/google/protobuf/json_format.py
python
_Parser._ConvertGenericMessage
(self, value, message)
Convert a JSON representation into message with FromJsonString.
Convert a JSON representation into message with FromJsonString.
[ "Convert", "a", "JSON", "representation", "into", "message", "with", "FromJsonString", "." ]
def _ConvertGenericMessage(self, value, message): """Convert a JSON representation into message with FromJsonString.""" # Duration, Timestamp, FieldMask have a FromJsonString method to do the # conversion. Users can also call the method directly. try: message.FromJsonString(value) except Value...
[ "def", "_ConvertGenericMessage", "(", "self", ",", "value", ",", "message", ")", ":", "# Duration, Timestamp, FieldMask have a FromJsonString method to do the", "# conversion. Users can also call the method directly.", "try", ":", "message", ".", "FromJsonString", "(", "value", ...
https://github.com/catboost/catboost/blob/167f64f237114a4d10b2b4ee42adb4569137debe/contrib/python/protobuf/py3/google/protobuf/json_format.py#L630-L637
catboost/catboost
167f64f237114a4d10b2b4ee42adb4569137debe
contrib/python/ipython/py2/IPython/core/completer.py
python
match_dict_keys
(keys, prefix, delims)
return quote, token_start, matched
Used by dict_key_matches, matching the prefix to a list of keys
Used by dict_key_matches, matching the prefix to a list of keys
[ "Used", "by", "dict_key_matches", "matching", "the", "prefix", "to", "a", "list", "of", "keys" ]
def match_dict_keys(keys, prefix, delims): """Used by dict_key_matches, matching the prefix to a list of keys""" if not prefix: return None, 0, [repr(k) for k in keys if isinstance(k, (string_types, bytes))] quote_match = re.search('["\']', prefix) quote = quote_match.group...
[ "def", "match_dict_keys", "(", "keys", ",", "prefix", ",", "delims", ")", ":", "if", "not", "prefix", ":", "return", "None", ",", "0", ",", "[", "repr", "(", "k", ")", "for", "k", "in", "keys", "if", "isinstance", "(", "k", ",", "(", "string_types"...
https://github.com/catboost/catboost/blob/167f64f237114a4d10b2b4ee42adb4569137debe/contrib/python/ipython/py2/IPython/core/completer.py#L389-L437
logcabin/logcabin
ee6c55ae9744b82b451becd9707d26c7c1b6bbfb
scripts/cpplint.py
python
ParseArguments
(args)
return filenames
Parses the command line arguments. This may set the output format and verbosity level as side-effects. Args: args: The command line arguments: Returns: The list of filenames to lint.
Parses the command line arguments.
[ "Parses", "the", "command", "line", "arguments", "." ]
def ParseArguments(args): """Parses the command line arguments. This may set the output format and verbosity level as side-effects. Args: args: The command line arguments: Returns: The list of filenames to lint. """ try: (opts, filenames) = getopt.getopt(args, '', ['help', 'output=', 'verbose...
[ "def", "ParseArguments", "(", "args", ")", ":", "try", ":", "(", "opts", ",", "filenames", ")", "=", "getopt", ".", "getopt", "(", "args", ",", "''", ",", "[", "'help'", ",", "'output='", ",", "'verbose='", ",", "'counting='", ",", "'filter='", "]", ...
https://github.com/logcabin/logcabin/blob/ee6c55ae9744b82b451becd9707d26c7c1b6bbfb/scripts/cpplint.py#L3082-L3131
wxWidgets/wxPython-Classic
19571e1ae65f1ac445f5491474121998c97a1bf0
src/msw/_controls.py
python
AnyButton.SetBitmapHover
(*args, **kwargs)
return _controls_.AnyButton_SetBitmapHover(*args, **kwargs)
SetBitmapHover(self, Bitmap bitmap)
SetBitmapHover(self, Bitmap bitmap)
[ "SetBitmapHover", "(", "self", "Bitmap", "bitmap", ")" ]
def SetBitmapHover(*args, **kwargs): """SetBitmapHover(self, Bitmap bitmap)""" return _controls_.AnyButton_SetBitmapHover(*args, **kwargs)
[ "def", "SetBitmapHover", "(", "*", "args", ",", "*", "*", "kwargs", ")", ":", "return", "_controls_", ".", "AnyButton_SetBitmapHover", "(", "*", "args", ",", "*", "*", "kwargs", ")" ]
https://github.com/wxWidgets/wxPython-Classic/blob/19571e1ae65f1ac445f5491474121998c97a1bf0/src/msw/_controls.py#L137-L139
QMCPACK/qmcpack
d0948ab455e38364458740cc8e2239600a14c5cd
utils/determinants_tools.py
python
det_excitation_degree
(det_a, det_b)
return sum(map(or_and_popcount,zip(det_a, det_b))) // 2
>>> det_excitation_degree( Determinants(alpha=[1],beta=[0] ), ... Determinants(alpha=[1],beta=[0] ) ) 0 >>> det_excitation_degree( Determinants(alpha=[1],beta=[0] ), ... Determinants(alpha=[2],beta=[0] ) ) 1 >>> det_excitation_degree( Determinant...
>>> det_excitation_degree( Determinants(alpha=[1],beta=[0] ), ... Determinants(alpha=[1],beta=[0] ) ) 0 >>> det_excitation_degree( Determinants(alpha=[1],beta=[0] ), ... Determinants(alpha=[2],beta=[0] ) ) 1 >>> det_excitation_degree( Determinant...
[ ">>>", "det_excitation_degree", "(", "Determinants", "(", "alpha", "=", "[", "1", "]", "beta", "=", "[", "0", "]", ")", "...", "Determinants", "(", "alpha", "=", "[", "1", "]", "beta", "=", "[", "0", "]", ")", ")", "0", ">>>", "det_excitation_degree"...
def det_excitation_degree(det_a, det_b): ''' >>> det_excitation_degree( Determinants(alpha=[1],beta=[0] ), ... Determinants(alpha=[1],beta=[0] ) ) 0 >>> det_excitation_degree( Determinants(alpha=[1],beta=[0] ), ... Determinants(alpha=[2],beta=[0]...
[ "def", "det_excitation_degree", "(", "det_a", ",", "det_b", ")", ":", "or_and_popcount", "=", "lambda", "det", ":", "sum", "(", "bin", "(", "i", "^", "j", ")", ".", "count", "(", "\"1\"", ")", "for", "i", ",", "j", "in", "zip", "(", "*", "det", "...
https://github.com/QMCPACK/qmcpack/blob/d0948ab455e38364458740cc8e2239600a14c5cd/utils/determinants_tools.py#L75-L91
Xilinx/Vitis-AI
fc74d404563d9951b57245443c73bef389f3657f
tools/Vitis-AI-Quantizer/vai_q_pytorch/example/resnet18_qat.py
python
resnet18
(pretrained=False, progress=True, **kwargs)
return _resnet('resnet18', BasicBlock, [2, 2, 2, 2], pretrained, progress, **kwargs)
r"""ResNet-18 model from `"Deep Residual Learning for Image Recognition" <https://arxiv.org/pdf/1512.03385.pdf>'_ Args: pretrained (bool): If True, returns a model pre-trained on ImageNet progress (bool): If True, displays a progress bar of the download to stderr
r"""ResNet-18 model from `"Deep Residual Learning for Image Recognition" <https://arxiv.org/pdf/1512.03385.pdf>'_
[ "r", "ResNet", "-", "18", "model", "from", "Deep", "Residual", "Learning", "for", "Image", "Recognition", "<https", ":", "//", "arxiv", ".", "org", "/", "pdf", "/", "1512", ".", "03385", ".", "pdf", ">", "_" ]
def resnet18(pretrained=False, progress=True, **kwargs): r"""ResNet-18 model from `"Deep Residual Learning for Image Recognition" <https://arxiv.org/pdf/1512.03385.pdf>'_ Args: pretrained (bool): If True, returns a model pre-trained on ImageNet progress (bool): If True, displays a progress ba...
[ "def", "resnet18", "(", "pretrained", "=", "False", ",", "progress", "=", "True", ",", "*", "*", "kwargs", ")", ":", "return", "_resnet", "(", "'resnet18'", ",", "BasicBlock", ",", "[", "2", ",", "2", ",", "2", ",", "2", "]", ",", "pretrained", ","...
https://github.com/Xilinx/Vitis-AI/blob/fc74d404563d9951b57245443c73bef389f3657f/tools/Vitis-AI-Quantizer/vai_q_pytorch/example/resnet18_qat.py#L326-L335