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
Xilinx/Vitis-AI
fc74d404563d9951b57245443c73bef389f3657f
tools/Vitis-AI-Quantizer/vai_q_tensorflow1.x/tensorflow/contrib/layers/python/ops/sparse_ops.py
python
sparse_row_envelope
(sparse_input, row_axis=0, col_axis=1, name=None)
Returns the length of each 'row' in a `SparseTensor`. For example, if `sparse_input` has indices `[[0,0], [2, 0], [2, 1], [2, 2]]` and shape `[3, 3]`, this function will return `[1, 0, 3]`. Args: sparse_input: a `SparseTensor` of rank at least 2. row_axis: An integer. The axis for the row of the envelop...
Returns the length of each 'row' in a `SparseTensor`.
[ "Returns", "the", "length", "of", "each", "row", "in", "a", "SparseTensor", "." ]
def sparse_row_envelope(sparse_input, row_axis=0, col_axis=1, name=None): """Returns the length of each 'row' in a `SparseTensor`. For example, if `sparse_input` has indices `[[0,0], [2, 0], [2, 1], [2, 2]]` and shape `[3, 3]`, this function will return `[1, 0, 3]`. Args: sparse_input: a `SparseTensor` of...
[ "def", "sparse_row_envelope", "(", "sparse_input", ",", "row_axis", "=", "0", ",", "col_axis", "=", "1", ",", "name", "=", "None", ")", ":", "if", "not", "(", "isinstance", "(", "row_axis", ",", "compat", ".", "integral_types", ")", "and", "isinstance", ...
https://github.com/Xilinx/Vitis-AI/blob/fc74d404563d9951b57245443c73bef389f3657f/tools/Vitis-AI-Quantizer/vai_q_tensorflow1.x/tensorflow/contrib/layers/python/ops/sparse_ops.py#L190-L227
kamyu104/LeetCode-Solutions
77605708a927ea3b85aee5a479db733938c7c211
Python/count-nodes-with-the-highest-score.py
python
Solution.countHighestScoreNodes
(self, parents)
return iter_dfs(adj)
:type parents: List[int] :rtype: int
:type parents: List[int] :rtype: int
[ ":", "type", "parents", ":", "List", "[", "int", "]", ":", "rtype", ":", "int" ]
def countHighestScoreNodes(self, parents): """ :type parents: List[int] :rtype: int """ def iter_dfs(adj): result = [0]*2 stk = [(1, (0, [0]))] while stk: step, args = stk.pop() if step == 1: ...
[ "def", "countHighestScoreNodes", "(", "self", ",", "parents", ")", ":", "def", "iter_dfs", "(", "adj", ")", ":", "result", "=", "[", "0", "]", "*", "2", "stk", "=", "[", "(", "1", ",", "(", "0", ",", "[", "0", "]", ")", ")", "]", "while", "st...
https://github.com/kamyu104/LeetCode-Solutions/blob/77605708a927ea3b85aee5a479db733938c7c211/Python/count-nodes-with-the-highest-score.py#L5-L34
wlanjie/AndroidFFmpeg
7baf9122f4b8e1c74e7baf4be5c422c7a5ba5aaf
tools/fdk-aac-build/x86/toolchain/lib/python2.7/plat-mac/aepack.py
python
pack
(x, forcetype = None)
return AE.AECreateDesc('TEXT', repr(x))
Pack a python object into an AE descriptor
Pack a python object into an AE descriptor
[ "Pack", "a", "python", "object", "into", "an", "AE", "descriptor" ]
def pack(x, forcetype = None): """Pack a python object into an AE descriptor""" if forcetype: if type(x) is StringType: return AE.AECreateDesc(forcetype, x) else: return pack(x).AECoerceDesc(forcetype) if x is None: return AE.AECreateDesc('null', '') if...
[ "def", "pack", "(", "x", ",", "forcetype", "=", "None", ")", ":", "if", "forcetype", ":", "if", "type", "(", "x", ")", "is", "StringType", ":", "return", "AE", ".", "AECreateDesc", "(", "forcetype", ",", "x", ")", "else", ":", "return", "pack", "("...
https://github.com/wlanjie/AndroidFFmpeg/blob/7baf9122f4b8e1c74e7baf4be5c422c7a5ba5aaf/tools/fdk-aac-build/x86/toolchain/lib/python2.7/plat-mac/aepack.py#L78-L129
wxWidgets/wxPython-Classic
19571e1ae65f1ac445f5491474121998c97a1bf0
src/gtk/_core.py
python
Validator.TransferFromWindow
(*args, **kwargs)
return _core_.Validator_TransferFromWindow(*args, **kwargs)
TransferFromWindow(self) -> bool
TransferFromWindow(self) -> bool
[ "TransferFromWindow", "(", "self", ")", "-", ">", "bool" ]
def TransferFromWindow(*args, **kwargs): """TransferFromWindow(self) -> bool""" return _core_.Validator_TransferFromWindow(*args, **kwargs)
[ "def", "TransferFromWindow", "(", "*", "args", ",", "*", "*", "kwargs", ")", ":", "return", "_core_", ".", "Validator_TransferFromWindow", "(", "*", "args", ",", "*", "*", "kwargs", ")" ]
https://github.com/wxWidgets/wxPython-Classic/blob/19571e1ae65f1ac445f5491474121998c97a1bf0/src/gtk/_core.py#L11884-L11886
wxWidgets/wxPython-Classic
19571e1ae65f1ac445f5491474121998c97a1bf0
src/msw/_core.py
python
HeaderColumn.IsSortKey
(*args, **kwargs)
return _core_.HeaderColumn_IsSortKey(*args, **kwargs)
IsSortKey(self) -> bool
IsSortKey(self) -> bool
[ "IsSortKey", "(", "self", ")", "-", ">", "bool" ]
def IsSortKey(*args, **kwargs): """IsSortKey(self) -> bool""" return _core_.HeaderColumn_IsSortKey(*args, **kwargs)
[ "def", "IsSortKey", "(", "*", "args", ",", "*", "*", "kwargs", ")", ":", "return", "_core_", ".", "HeaderColumn_IsSortKey", "(", "*", "args", ",", "*", "*", "kwargs", ")" ]
https://github.com/wxWidgets/wxPython-Classic/blob/19571e1ae65f1ac445f5491474121998c97a1bf0/src/msw/_core.py#L16432-L16434
gem5/gem5
141cc37c2d4b93959d4c249b8f7e6a8b2ef75338
src/python/m5/util/fdthelper.py
python
Fdt.writeDtsFile
(self, filename)
Convert the device tree to DTS and write to a file.
Convert the device tree to DTS and write to a file.
[ "Convert", "the", "device", "tree", "to", "DTS", "and", "write", "to", "a", "file", "." ]
def writeDtsFile(self, filename): """Convert the device tree to DTS and write to a file.""" filename = os.path.realpath(filename) try: with open(filename, 'w') as f: f.write(self.to_dts()) return filename except IOError: raise RuntimeEr...
[ "def", "writeDtsFile", "(", "self", ",", "filename", ")", ":", "filename", "=", "os", ".", "path", ".", "realpath", "(", "filename", ")", "try", ":", "with", "open", "(", "filename", ",", "'w'", ")", "as", "f", ":", "f", ".", "write", "(", "self", ...
https://github.com/gem5/gem5/blob/141cc37c2d4b93959d4c249b8f7e6a8b2ef75338/src/python/m5/util/fdthelper.py#L260-L268
albertz/openlierox
d316c14a8eb57848ef56e9bfa7b23a56f694a51b
tools/DedicatedServerVideo/gdata/Crypto/PublicKey/pubkey.py
python
pubkey.verify
(self, M, signature)
return self._verify(M, signature)
verify(M:string|long, signature:tuple) : bool Verify that the signature is valid for the message M; returns true if the signature checks out.
verify(M:string|long, signature:tuple) : bool Verify that the signature is valid for the message M; returns true if the signature checks out.
[ "verify", "(", "M", ":", "string|long", "signature", ":", "tuple", ")", ":", "bool", "Verify", "that", "the", "signature", "is", "valid", "for", "the", "message", "M", ";", "returns", "true", "if", "the", "signature", "checks", "out", "." ]
def verify (self, M, signature): """verify(M:string|long, signature:tuple) : bool Verify that the signature is valid for the message M; returns true if the signature checks out. """ if isinstance(M, types.StringType): M=bytes_to_long(M) return self._verify(M, signature)
[ "def", "verify", "(", "self", ",", "M", ",", "signature", ")", ":", "if", "isinstance", "(", "M", ",", "types", ".", "StringType", ")", ":", "M", "=", "bytes_to_long", "(", "M", ")", "return", "self", ".", "_verify", "(", "M", ",", "signature", ")"...
https://github.com/albertz/openlierox/blob/d316c14a8eb57848ef56e9bfa7b23a56f694a51b/tools/DedicatedServerVideo/gdata/Crypto/PublicKey/pubkey.py#L78-L84
aws/lumberyard
f85344403c1c2e77ec8c75deb2c116e97b713217
dev/Tools/Python/3.7.10/linux_x64/lib/python3.7/_pydecimal.py
python
Decimal.copy_sign
(self, other, context=None)
return _dec_from_triple(other._sign, self._int, self._exp, self._is_special)
Returns self with the sign of other.
Returns self with the sign of other.
[ "Returns", "self", "with", "the", "sign", "of", "other", "." ]
def copy_sign(self, other, context=None): """Returns self with the sign of other.""" other = _convert_other(other, raiseit=True) return _dec_from_triple(other._sign, self._int, self._exp, self._is_special)
[ "def", "copy_sign", "(", "self", ",", "other", ",", "context", "=", "None", ")", ":", "other", "=", "_convert_other", "(", "other", ",", "raiseit", "=", "True", ")", "return", "_dec_from_triple", "(", "other", ".", "_sign", ",", "self", ".", "_int", ",...
https://github.com/aws/lumberyard/blob/f85344403c1c2e77ec8c75deb2c116e97b713217/dev/Tools/Python/3.7.10/linux_x64/lib/python3.7/_pydecimal.py#L3030-L3034
ceph/ceph
959663007321a369c83218414a29bd9dbc8bda3a
src/pybind/mgr/mgr_module.py
python
MgrModule.get_mgr_id
(self)
return self._ceph_get_mgr_id()
Retrieve the name of the manager daemon where this plugin is currently being executed (i.e. the active manager). :return: str
Retrieve the name of the manager daemon where this plugin is currently being executed (i.e. the active manager).
[ "Retrieve", "the", "name", "of", "the", "manager", "daemon", "where", "this", "plugin", "is", "currently", "being", "executed", "(", "i", ".", "e", ".", "the", "active", "manager", ")", "." ]
def get_mgr_id(self) -> str: """ Retrieve the name of the manager daemon where this plugin is currently being executed (i.e. the active manager). :return: str """ return self._ceph_get_mgr_id()
[ "def", "get_mgr_id", "(", "self", ")", "->", "str", ":", "return", "self", ".", "_ceph_get_mgr_id", "(", ")" ]
https://github.com/ceph/ceph/blob/959663007321a369c83218414a29bd9dbc8bda3a/src/pybind/mgr/mgr_module.py#L1729-L1736
plaidml/plaidml
f3c6681db21460e5fdc11ae651d6d7b6c27f8262
plaidml/edsl/__init__.py
python
pow
(x, y)
return intrinsic('pow', x, y)
Computes the elementwise ``y``th power of ``x``. Args: x (Tensor): The base Tensor. y (Tensor): The exponent Tensor. Returns: Tensor: The resultant tensor.
Computes the elementwise ``y``th power of ``x``.
[ "Computes", "the", "elementwise", "y", "th", "power", "of", "x", "." ]
def pow(x, y): """Computes the elementwise ``y``th power of ``x``. Args: x (Tensor): The base Tensor. y (Tensor): The exponent Tensor. Returns: Tensor: The resultant tensor. """ return intrinsic('pow', x, y)
[ "def", "pow", "(", "x", ",", "y", ")", ":", "return", "intrinsic", "(", "'pow'", ",", "x", ",", "y", ")" ]
https://github.com/plaidml/plaidml/blob/f3c6681db21460e5fdc11ae651d6d7b6c27f8262/plaidml/edsl/__init__.py#L990-L1000
JumpingYang001/webrtc
c03d6e965e1f54aeadd670e491eabe5fdb8db968
rtc_tools/py_event_log_analyzer/rtp_analyzer.py
python
RTPStatistics.ComputeBandwidth
(self)
Computes bandwidth averaged over several consecutive packets. The number of consecutive packets used in the average is BANDWIDTH_SMOOTHING_WINDOW_SIZE. Averaging is done with numpy.correlate.
Computes bandwidth averaged over several consecutive packets.
[ "Computes", "bandwidth", "averaged", "over", "several", "consecutive", "packets", "." ]
def ComputeBandwidth(self): """Computes bandwidth averaged over several consecutive packets. The number of consecutive packets used in the average is BANDWIDTH_SMOOTHING_WINDOW_SIZE. Averaging is done with numpy.correlate. """ start_ms = self.data_points[0].real_send_time_ms sto...
[ "def", "ComputeBandwidth", "(", "self", ")", ":", "start_ms", "=", "self", ".", "data_points", "[", "0", "]", ".", "real_send_time_ms", "stop_ms", "=", "self", ".", "data_points", "[", "-", "1", "]", ".", "real_send_time_ms", "(", "self", ".", "bandwidth_k...
https://github.com/JumpingYang001/webrtc/blob/c03d6e965e1f54aeadd670e491eabe5fdb8db968/rtc_tools/py_event_log_analyzer/rtp_analyzer.py#L232-L253
nasa/fprime
595cf3682d8365943d86c1a6fe7c78f0a116acf0
Autocoders/Python/src/fprime_ac/generators/visitors/TopologyCppVisitor.py
python
TopologyCppVisitor.includes2Visit
(self, obj)
Defined to generate internal includes within a file. Usually used for data type includes and system includes. @param args: the instance of the concrete element to operation on.
Defined to generate internal includes within a file. Usually used for data type includes and system includes.
[ "Defined", "to", "generate", "internal", "includes", "within", "a", "file", ".", "Usually", "used", "for", "data", "type", "includes", "and", "system", "includes", "." ]
def includes2Visit(self, obj): """ Defined to generate internal includes within a file. Usually used for data type includes and system includes. @param args: the instance of the concrete element to operation on. """
[ "def", "includes2Visit", "(", "self", ",", "obj", ")", ":" ]
https://github.com/nasa/fprime/blob/595cf3682d8365943d86c1a6fe7c78f0a116acf0/Autocoders/Python/src/fprime_ac/generators/visitors/TopologyCppVisitor.py#L227-L232
aws/lumberyard
f85344403c1c2e77ec8c75deb2c116e97b713217
dev/Tools/Python/3.7.10/mac/Python.framework/Versions/3.7/lib/python3.7/site-packages/pip/_vendor/requests/models.py
python
Response.apparent_encoding
(self)
return chardet.detect(self.content)['encoding']
The apparent encoding, provided by the chardet library.
The apparent encoding, provided by the chardet library.
[ "The", "apparent", "encoding", "provided", "by", "the", "chardet", "library", "." ]
def apparent_encoding(self): """The apparent encoding, provided by the chardet library.""" return chardet.detect(self.content)['encoding']
[ "def", "apparent_encoding", "(", "self", ")", ":", "return", "chardet", ".", "detect", "(", "self", ".", "content", ")", "[", "'encoding'", "]" ]
https://github.com/aws/lumberyard/blob/f85344403c1c2e77ec8c75deb2c116e97b713217/dev/Tools/Python/3.7.10/mac/Python.framework/Versions/3.7/lib/python3.7/site-packages/pip/_vendor/requests/models.py#L728-L730
pyne/pyne
0c2714d7c0d1b5e20be6ae6527da2c660dd6b1b3
pyne/dbgen/ndsfpy.py
python
readtable
(i, spdat)
return dfinal
Reads in a set of 5 html tables and returns corresponding yield data
Reads in a set of 5 html tables and returns corresponding yield data
[ "Reads", "in", "a", "set", "of", "5", "html", "tables", "and", "returns", "corresponding", "yield", "data" ]
def readtable(i, spdat): """ Reads in a set of 5 html tables and returns corresponding yield data """ parent = getdata(i, spdat)[0] pfinal = (parent.split('<strong>')[1]).split('</strong>')[0] pid = conv_to_id(pfinal) fpdata = getdata(i + 1, spdat) dt = np.dtype([('from_nuc', 'i4'), ('to...
[ "def", "readtable", "(", "i", ",", "spdat", ")", ":", "parent", "=", "getdata", "(", "i", ",", "spdat", ")", "[", "0", "]", "pfinal", "=", "(", "parent", ".", "split", "(", "'<strong>'", ")", "[", "1", "]", ")", ".", "split", "(", "'</strong>'", ...
https://github.com/pyne/pyne/blob/0c2714d7c0d1b5e20be6ae6527da2c660dd6b1b3/pyne/dbgen/ndsfpy.py#L39-L71
catboost/catboost
167f64f237114a4d10b2b4ee42adb4569137debe
contrib/python/Jinja2/py2/jinja2/compiler.py
python
CodeGenerator.pull_dependencies
(self, nodes)
Pull all the dependencies.
Pull all the dependencies.
[ "Pull", "all", "the", "dependencies", "." ]
def pull_dependencies(self, nodes): """Pull all the dependencies.""" visitor = DependencyFinderVisitor() for node in nodes: visitor.visit(node) for dependency in "filters", "tests": mapping = getattr(self, dependency) for name in getattr(visitor, depen...
[ "def", "pull_dependencies", "(", "self", ",", "nodes", ")", ":", "visitor", "=", "DependencyFinderVisitor", "(", ")", "for", "node", "in", "nodes", ":", "visitor", ".", "visit", "(", "node", ")", "for", "dependency", "in", "\"filters\"", ",", "\"tests\"", ...
https://github.com/catboost/catboost/blob/167f64f237114a4d10b2b4ee42adb4569137debe/contrib/python/Jinja2/py2/jinja2/compiler.py#L464-L476
idaholab/moose
9eeebc65e098b4c30f8205fb41591fd5b61eb6ff
python/MooseDocs/base/renderers.py
python
MaterializeRenderer._method
(self, component)
Fallback to the HTMLRenderer method if the MaterializeRenderer method is not located. Inputs: component[RenderComponent]: Object to use for locating desired method for renderering.
Fallback to the HTMLRenderer method if the MaterializeRenderer method is not located.
[ "Fallback", "to", "the", "HTMLRenderer", "method", "if", "the", "MaterializeRenderer", "method", "is", "not", "located", "." ]
def _method(self, component): """ Fallback to the HTMLRenderer method if the MaterializeRenderer method is not located. Inputs: component[RenderComponent]: Object to use for locating desired method for renderering. """ if hasattr(component, self.METHOD): ...
[ "def", "_method", "(", "self", ",", "component", ")", ":", "if", "hasattr", "(", "component", ",", "self", ".", "METHOD", ")", ":", "return", "getattr", "(", "component", ",", "self", ".", "METHOD", ")", "elif", "hasattr", "(", "component", ",", "HTMLR...
https://github.com/idaholab/moose/blob/9eeebc65e098b4c30f8205fb41591fd5b61eb6ff/python/MooseDocs/base/renderers.py#L361-L374
wxWidgets/wxPython-Classic
19571e1ae65f1ac445f5491474121998c97a1bf0
wx/lib/sheet.py
python
CSheet.OnRightClick
(self, event)
Move grid cursor when a cell is right-clicked
Move grid cursor when a cell is right-clicked
[ "Move", "grid", "cursor", "when", "a", "cell", "is", "right", "-", "clicked" ]
def OnRightClick(self, event): """ Move grid cursor when a cell is right-clicked """ self.SetGridCursor( event.GetRow(), event.GetCol() ) event.Skip()
[ "def", "OnRightClick", "(", "self", ",", "event", ")", ":", "self", ".", "SetGridCursor", "(", "event", ".", "GetRow", "(", ")", ",", "event", ".", "GetCol", "(", ")", ")", "event", ".", "Skip", "(", ")" ]
https://github.com/wxWidgets/wxPython-Classic/blob/19571e1ae65f1ac445f5491474121998c97a1bf0/wx/lib/sheet.py#L222-L225
Tencent/CMONGO
c40380caa14e05509f46993aa8b8da966b09b0b5
src/third_party/scons-2.5.0/scons-local-2.5.0/SCons/Util.py
python
PrependPath
(oldpath, newpath, sep = os.pathsep, delete_existing=1, canonicalize=None)
This prepends newpath elements to the given oldpath. Will only add any particular path once (leaving the first one it encounters and ignoring the rest, to preserve path order), and will os.path.normpath and os.path.normcase all paths to help assure this. This can also handle the case where the given o...
This prepends newpath elements to the given oldpath. Will only add any particular path once (leaving the first one it encounters and ignoring the rest, to preserve path order), and will os.path.normpath and os.path.normcase all paths to help assure this. This can also handle the case where the given o...
[ "This", "prepends", "newpath", "elements", "to", "the", "given", "oldpath", ".", "Will", "only", "add", "any", "particular", "path", "once", "(", "leaving", "the", "first", "one", "it", "encounters", "and", "ignoring", "the", "rest", "to", "preserve", "path"...
def PrependPath(oldpath, newpath, sep = os.pathsep, delete_existing=1, canonicalize=None): """This prepends newpath elements to the given oldpath. Will only add any particular path once (leaving the first one it encounters and ignoring the rest, to preserve path order), and will os.pat...
[ "def", "PrependPath", "(", "oldpath", ",", "newpath", ",", "sep", "=", "os", ".", "pathsep", ",", "delete_existing", "=", "1", ",", "canonicalize", "=", "None", ")", ":", "orig", "=", "oldpath", "is_list", "=", "1", "paths", "=", "orig", "if", "not", ...
https://github.com/Tencent/CMONGO/blob/c40380caa14e05509f46993aa8b8da966b09b0b5/src/third_party/scons-2.5.0/scons-local-2.5.0/SCons/Util.py#L736-L816
sdhash/sdhash
b9eff63e4e5867e910f41fd69032bbb1c94a2a5e
sdhash-ui/jinja2/utils.py
python
LRUCache.itervalue
(self)
return iter(self.values())
Iterate over all values.
Iterate over all values.
[ "Iterate", "over", "all", "values", "." ]
def itervalue(self): """Iterate over all values.""" return iter(self.values())
[ "def", "itervalue", "(", "self", ")", ":", "return", "iter", "(", "self", ".", "values", "(", ")", ")" ]
https://github.com/sdhash/sdhash/blob/b9eff63e4e5867e910f41fd69032bbb1c94a2a5e/sdhash-ui/jinja2/utils.py#L508-L510
benoitsteiner/tensorflow-opencl
cb7cb40a57fde5cfd4731bc551e82a1e2fef43a5
tensorflow/contrib/distributions/python/ops/vector_student_t.py
python
_VectorStudentT.__init__
(self, df, loc=None, scale_identity_multiplier=None, scale_diag=None, scale_tril=None, scale_perturb_factor=None, scale_perturb_diag=None, validate_args=False, allow_nan_stats=True, ...
Instantiates the vector Student's t-distributions on `R^k`. The `batch_shape` is the broadcast between `df.batch_shape` and `Affine.batch_shape` where `Affine` is constructed from `loc` and `scale_*` arguments. The `event_shape` is the event shape of `Affine.event_shape`. Args: df: Floating...
Instantiates the vector Student's t-distributions on `R^k`.
[ "Instantiates", "the", "vector", "Student", "s", "t", "-", "distributions", "on", "R^k", "." ]
def __init__(self, df, loc=None, scale_identity_multiplier=None, scale_diag=None, scale_tril=None, scale_perturb_factor=None, scale_perturb_diag=None, validate_args=False, allow_nan_sta...
[ "def", "__init__", "(", "self", ",", "df", ",", "loc", "=", "None", ",", "scale_identity_multiplier", "=", "None", ",", "scale_diag", "=", "None", ",", "scale_tril", "=", "None", ",", "scale_perturb_factor", "=", "None", ",", "scale_perturb_diag", "=", "None...
https://github.com/benoitsteiner/tensorflow-opencl/blob/cb7cb40a57fde5cfd4731bc551e82a1e2fef43a5/tensorflow/contrib/distributions/python/ops/vector_student_t.py#L124-L225
aws/lumberyard
f85344403c1c2e77ec8c75deb2c116e97b713217
dev/Tools/Python/3.7.10/linux_x64/lib/python3.7/email/utils.py
python
decode_rfc2231
(s)
return parts
Decode string according to RFC 2231
Decode string according to RFC 2231
[ "Decode", "string", "according", "to", "RFC", "2231" ]
def decode_rfc2231(s): """Decode string according to RFC 2231""" parts = s.split(TICK, 2) if len(parts) <= 2: return None, None, s return parts
[ "def", "decode_rfc2231", "(", "s", ")", ":", "parts", "=", "s", ".", "split", "(", "TICK", ",", "2", ")", "if", "len", "(", "parts", ")", "<=", "2", ":", "return", "None", ",", "None", ",", "s", "return", "parts" ]
https://github.com/aws/lumberyard/blob/f85344403c1c2e77ec8c75deb2c116e97b713217/dev/Tools/Python/3.7.10/linux_x64/lib/python3.7/email/utils.py#L231-L236
SequoiaDB/SequoiaDB
2894ed7e5bd6fe57330afc900cf76d0ff0df9f64
tools/server/php_linux/libxml2/lib/python2.4/site-packages/libxml2.py
python
parserCtxt.parseQuotedString
(self)
return ret
Parse and return a string between quotes or doublequotes TODO: Deprecated, to be removed at next drop of binary compatibility
Parse and return a string between quotes or doublequotes TODO: Deprecated, to be removed at next drop of binary compatibility
[ "Parse", "and", "return", "a", "string", "between", "quotes", "or", "doublequotes", "TODO", ":", "Deprecated", "to", "be", "removed", "at", "next", "drop", "of", "binary", "compatibility" ]
def parseQuotedString(self): """Parse and return a string between quotes or doublequotes TODO: Deprecated, to be removed at next drop of binary compatibility """ ret = libxml2mod.xmlParseQuotedString(self._o) return ret
[ "def", "parseQuotedString", "(", "self", ")", ":", "ret", "=", "libxml2mod", ".", "xmlParseQuotedString", "(", "self", ".", "_o", ")", "return", "ret" ]
https://github.com/SequoiaDB/SequoiaDB/blob/2894ed7e5bd6fe57330afc900cf76d0ff0df9f64/tools/server/php_linux/libxml2/lib/python2.4/site-packages/libxml2.py#L5353-L5358
apache/incubator-weex
5c25f0b59f7ac90703c363e7261f60bd06356dbe
weex_core/tools/cpplint.py
python
UpdateIncludeState
(filename, include_dict, io=codecs)
return True
Fill up the include_dict with new includes found from the file. Args: filename: the name of the header to read. include_dict: a dictionary in which the headers are inserted. io: The io factory to use to read the file. Provided for testability. Returns: True if a header was successfully added. Fals...
Fill up the include_dict with new includes found from the file.
[ "Fill", "up", "the", "include_dict", "with", "new", "includes", "found", "from", "the", "file", "." ]
def UpdateIncludeState(filename, include_dict, io=codecs): """Fill up the include_dict with new includes found from the file. Args: filename: the name of the header to read. include_dict: a dictionary in which the headers are inserted. io: The io factory to use to read the file. Provided for testabilit...
[ "def", "UpdateIncludeState", "(", "filename", ",", "include_dict", ",", "io", "=", "codecs", ")", ":", "headerfile", "=", "None", "try", ":", "headerfile", "=", "io", ".", "open", "(", "filename", ",", "'r'", ",", "'utf8'", ",", "'replace'", ")", "except...
https://github.com/apache/incubator-weex/blob/5c25f0b59f7ac90703c363e7261f60bd06356dbe/weex_core/tools/cpplint.py#L5471-L5495
clementine-player/Clementine
111379dfd027802b59125829fcf87e3e1d0ad73b
dist/cpplint.py
python
CheckForFunctionLengths
(filename, clean_lines, linenum, function_state, error)
Reports for long function bodies. For an overview why this is done, see: http://google-styleguide.googlecode.com/svn/trunk/cppguide.xml#Write_Short_Functions Uses a simplistic algorithm assuming other style guidelines (especially spacing) are followed. Only checks unindented functions, so class members are ...
Reports for long function bodies.
[ "Reports", "for", "long", "function", "bodies", "." ]
def CheckForFunctionLengths(filename, clean_lines, linenum, function_state, error): """Reports for long function bodies. For an overview why this is done, see: http://google-styleguide.googlecode.com/svn/trunk/cppguide.xml#Write_Short_Functions Uses a simplistic algorithm assuming ...
[ "def", "CheckForFunctionLengths", "(", "filename", ",", "clean_lines", ",", "linenum", ",", "function_state", ",", "error", ")", ":", "lines", "=", "clean_lines", ".", "lines", "line", "=", "lines", "[", "linenum", "]", "joined_line", "=", "''", "starting_func...
https://github.com/clementine-player/Clementine/blob/111379dfd027802b59125829fcf87e3e1d0ad73b/dist/cpplint.py#L2776-L2841
Kitware/ParaView
f760af9124ff4634b23ebbeab95a4f56e0261955
Plugins/pvblot/blotish.py
python
tmin
(value=None)
Set deltime
Set deltime
[ "Set", "deltime" ]
def tmin(value=None): """Set deltime""" state.time_selection.set_tmin(_maybe_convert(value, float)) state.time_selection.print_show()
[ "def", "tmin", "(", "value", "=", "None", ")", ":", "state", ".", "time_selection", ".", "set_tmin", "(", "_maybe_convert", "(", "value", ",", "float", ")", ")", "state", ".", "time_selection", ".", "print_show", "(", ")" ]
https://github.com/Kitware/ParaView/blob/f760af9124ff4634b23ebbeab95a4f56e0261955/Plugins/pvblot/blotish.py#L905-L908
catboost/catboost
167f64f237114a4d10b2b4ee42adb4569137debe
contrib/python/pandas/py3/pandas/io/formats/latex.py
python
LatexFormatter.column_format
(self)
return self._column_format
Column format.
Column format.
[ "Column", "format", "." ]
def column_format(self) -> str | None: """Column format.""" return self._column_format
[ "def", "column_format", "(", "self", ")", "->", "str", "|", "None", ":", "return", "self", ".", "_column_format" ]
https://github.com/catboost/catboost/blob/167f64f237114a4d10b2b4ee42adb4569137debe/contrib/python/pandas/py3/pandas/io/formats/latex.py#L752-L754
pytorch/pytorch
7176c92687d3cc847cc046bf002269c6949a21c2
torch/distributed/fsdp/fully_sharded_data_parallel.py
python
FullyShardedDataParallel._lazy_init
(self)
Initialization steps that should happen lazily, typically right before the first forward pass.
Initialization steps that should happen lazily, typically right before the first forward pass.
[ "Initialization", "steps", "that", "should", "happen", "lazily", "typically", "right", "before", "the", "first", "forward", "pass", "." ]
def _lazy_init(self) -> None: """Initialization steps that should happen lazily, typically right before the first forward pass. """ # Initialize param attributes lazily, in case the param's dtype or # device changes after __init__. for p in self.params: self._...
[ "def", "_lazy_init", "(", "self", ")", "->", "None", ":", "# Initialize param attributes lazily, in case the param's dtype or", "# device changes after __init__.", "for", "p", "in", "self", ".", "params", ":", "self", ".", "_init_param_attributes", "(", "p", ")", "# Ini...
https://github.com/pytorch/pytorch/blob/7176c92687d3cc847cc046bf002269c6949a21c2/torch/distributed/fsdp/fully_sharded_data_parallel.py#L444-L476
LiquidPlayer/LiquidCore
9405979363f2353ac9a71ad8ab59685dd7f919c9
deps/boost_1_66_0/tools/build/src/build/targets.py
python
ProjectTarget.mark_targets_as_explicit
(self, target_names)
Add 'target' to the list of targets in this project that should be build only by explicit request.
Add 'target' to the list of targets in this project that should be build only by explicit request.
[ "Add", "target", "to", "the", "list", "of", "targets", "in", "this", "project", "that", "should", "be", "build", "only", "by", "explicit", "request", "." ]
def mark_targets_as_explicit (self, target_names): """Add 'target' to the list of targets in this project that should be build only by explicit request.""" # Record the name of the target, not instance, since this # rule is called before main target instaces are created. assert ...
[ "def", "mark_targets_as_explicit", "(", "self", ",", "target_names", ")", ":", "# Record the name of the target, not instance, since this", "# rule is called before main target instaces are created.", "assert", "is_iterable_typed", "(", "target_names", ",", "basestring", ")", "self...
https://github.com/LiquidPlayer/LiquidCore/blob/9405979363f2353ac9a71ad8ab59685dd7f919c9/deps/boost_1_66_0/tools/build/src/build/targets.py#L471-L478
cathywu/Sentiment-Analysis
eb501fd1375c0c3f3ab430f963255f1bb858e659
PyML-0.7.9/PyML/utils/myio.py
python
csvread
(fileName, delim = ',')
return data
read a character array from a file in csv format
read a character array from a file in csv format
[ "read", "a", "character", "array", "from", "a", "file", "in", "csv", "format" ]
def csvread(fileName, delim = ',') : '''read a character array from a file in csv format''' import misc fileHandle = open(fileName, "r") line = fileHandle.readline() if delim == ' ' : delim = None data = misc.emptyLOL(len(line.split(delim))) dim = len(data) while 1 : ...
[ "def", "csvread", "(", "fileName", ",", "delim", "=", "','", ")", ":", "import", "misc", "fileHandle", "=", "open", "(", "fileName", ",", "\"r\"", ")", "line", "=", "fileHandle", ".", "readline", "(", ")", "if", "delim", "==", "' '", ":", "delim", "=...
https://github.com/cathywu/Sentiment-Analysis/blob/eb501fd1375c0c3f3ab430f963255f1bb858e659/PyML-0.7.9/PyML/utils/myio.py#L76-L102
google/earthenterprise
0fe84e29be470cd857e3a0e52e5d0afd5bb8cee9
earth_enterprise/src/google/protobuf-py/mox.py
python
Mox.CreateMockAnything
(self)
return new_mock
Create a mock that will accept any method calls. This does not enforce an interface.
Create a mock that will accept any method calls.
[ "Create", "a", "mock", "that", "will", "accept", "any", "method", "calls", "." ]
def CreateMockAnything(self): """Create a mock that will accept any method calls. This does not enforce an interface. """ new_mock = MockAnything() self._mock_objects.append(new_mock) return new_mock
[ "def", "CreateMockAnything", "(", "self", ")", ":", "new_mock", "=", "MockAnything", "(", ")", "self", ".", "_mock_objects", ".", "append", "(", "new_mock", ")", "return", "new_mock" ]
https://github.com/google/earthenterprise/blob/0fe84e29be470cd857e3a0e52e5d0afd5bb8cee9/earth_enterprise/src/google/protobuf-py/mox.py#L179-L187
wlanjie/AndroidFFmpeg
7baf9122f4b8e1c74e7baf4be5c422c7a5ba5aaf
tools/fdk-aac-build/armeabi-v7a/toolchain/lib/python2.7/decimal.py
python
Context.quantize
(self, a, b)
return a.quantize(b, context=self)
Returns a value equal to 'a' (rounded), having the exponent of 'b'. The coefficient of the result is derived from that of the left-hand operand. It may be rounded using the current rounding setting (if the exponent is being increased), multiplied by a positive power of ten (if the expo...
Returns a value equal to 'a' (rounded), having the exponent of 'b'.
[ "Returns", "a", "value", "equal", "to", "a", "(", "rounded", ")", "having", "the", "exponent", "of", "b", "." ]
def quantize(self, a, b): """Returns a value equal to 'a' (rounded), having the exponent of 'b'. The coefficient of the result is derived from that of the left-hand operand. It may be rounded using the current rounding setting (if the exponent is being increased), multiplied by a posit...
[ "def", "quantize", "(", "self", ",", "a", ",", "b", ")", ":", "a", "=", "_convert_other", "(", "a", ",", "raiseit", "=", "True", ")", "return", "a", ".", "quantize", "(", "b", ",", "context", "=", "self", ")" ]
https://github.com/wlanjie/AndroidFFmpeg/blob/7baf9122f4b8e1c74e7baf4be5c422c7a5ba5aaf/tools/fdk-aac-build/armeabi-v7a/toolchain/lib/python2.7/decimal.py#L5045-L5101
Xilinx/Vitis-AI
fc74d404563d9951b57245443c73bef389f3657f
tools/Vitis-AI-Quantizer/vai_q_pytorch/nndct_shared/utils/registry.py
python
Registry.register
(self, obj, name=None)
Registers a Python object "obj" for the given "name". Args: obj: The object to add to the registry. name: An optional string specifying the registry key for the obj. If None, obj.__name__ will be used. Raises: KeyError: If same name is registered twice.
Registers a Python object "obj" for the given "name".
[ "Registers", "a", "Python", "object", "obj", "for", "the", "given", "name", "." ]
def register(self, obj, name=None): """Registers a Python object "obj" for the given "name". Args: obj: The object to add to the registry. name: An optional string specifying the registry key for the obj. If None, obj.__name__ will be used. Raises: KeyError: If same name is re...
[ "def", "register", "(", "self", ",", "obj", ",", "name", "=", "None", ")", ":", "if", "not", "name", ":", "name", "=", "obj", ".", "__name__", "if", "name", "in", "self", ".", "_registry", ":", "raise", "KeyError", "(", "\"Name '%s' has been registered i...
https://github.com/Xilinx/Vitis-AI/blob/fc74d404563d9951b57245443c73bef389f3657f/tools/Vitis-AI-Quantizer/vai_q_pytorch/nndct_shared/utils/registry.py#L36-L53
ceph/ceph
959663007321a369c83218414a29bd9dbc8bda3a
src/ceph-volume/ceph_volume/devices/lvm/prepare.py
python
Prepare.prepare_data_device
(self, device_type, osd_uuid)
Check if ``arg`` is a device or partition to create an LV out of it with a distinct volume group name, assigning LV tags on it and ultimately, returning the logical volume object. Failing to detect a device or partition will result in error. :param arg: The value of ``--data`` when par...
Check if ``arg`` is a device or partition to create an LV out of it with a distinct volume group name, assigning LV tags on it and ultimately, returning the logical volume object. Failing to detect a device or partition will result in error.
[ "Check", "if", "arg", "is", "a", "device", "or", "partition", "to", "create", "an", "LV", "out", "of", "it", "with", "a", "distinct", "volume", "group", "name", "assigning", "LV", "tags", "on", "it", "and", "ultimately", "returning", "the", "logical", "v...
def prepare_data_device(self, device_type, osd_uuid): """ Check if ``arg`` is a device or partition to create an LV out of it with a distinct volume group name, assigning LV tags on it and ultimately, returning the logical volume object. Failing to detect a device or partition w...
[ "def", "prepare_data_device", "(", "self", ",", "device_type", ",", "osd_uuid", ")", ":", "device", "=", "self", ".", "args", ".", "data", "if", "disk", ".", "is_partition", "(", "device", ")", "or", "disk", ".", "is_device", "(", "device", ")", ":", "...
https://github.com/ceph/ceph/blob/959663007321a369c83218414a29bd9dbc8bda3a/src/ceph-volume/ceph_volume/devices/lvm/prepare.py#L196-L228
hughperkins/tf-coriander
970d3df6c11400ad68405f22b0c42a52374e94ca
tensorflow/python/ops/sparse_ops.py
python
sparse_to_dense
(sparse_indices, output_shape, sparse_values, default_value=0, validate_indices=True, name=None)
return gen_sparse_ops._sparse_to_dense( sparse_indices, output_shape, sparse_values, default_value=default_value, validate_indices=validate_indices, name=name)
Converts a sparse representation into a dense tensor. Builds an array `dense` with shape `output_shape` such that ```python # If sparse_indices is scalar dense[i] = (i == sparse_indices ? sparse_values : default_value) # If sparse_indices is a vector, then for each i dense[sparse_indices[i]] = sparse_val...
Converts a sparse representation into a dense tensor.
[ "Converts", "a", "sparse", "representation", "into", "a", "dense", "tensor", "." ]
def sparse_to_dense(sparse_indices, output_shape, sparse_values, default_value=0, validate_indices=True, name=None): """Converts a sparse representation into a dense tensor. Builds an array `dense` with shape `outpu...
[ "def", "sparse_to_dense", "(", "sparse_indices", ",", "output_shape", ",", "sparse_values", ",", "default_value", "=", "0", ",", "validate_indices", "=", "True", ",", "name", "=", "None", ")", ":", "return", "gen_sparse_ops", ".", "_sparse_to_dense", "(", "spars...
https://github.com/hughperkins/tf-coriander/blob/970d3df6c11400ad68405f22b0c42a52374e94ca/tensorflow/python/ops/sparse_ops.py#L503-L555
wxWidgets/wxPython-Classic
19571e1ae65f1ac445f5491474121998c97a1bf0
wx/lib/agw/flatmenu.py
python
FlatMenuBar.SetOptions
(self, options)
Sets the :class:`FlatMenuBar` options, whether to show a toolbar, to use LCD screen settings etc... :param integer `options`: a combination of the following bits: ========================= ========= ============================= `options` Bit Hex Value Description ...
Sets the :class:`FlatMenuBar` options, whether to show a toolbar, to use LCD screen settings etc...
[ "Sets", "the", ":", "class", ":", "FlatMenuBar", "options", "whether", "to", "show", "a", "toolbar", "to", "use", "LCD", "screen", "settings", "etc", "..." ]
def SetOptions(self, options): """ Sets the :class:`FlatMenuBar` options, whether to show a toolbar, to use LCD screen settings etc... :param integer `options`: a combination of the following bits: ========================= ========= ============================= `opt...
[ "def", "SetOptions", "(", "self", ",", "options", ")", ":", "self", ".", "_options", "=", "options", "self", ".", "_showToolbar", "=", "options", "&", "FM_OPT_SHOW_TOOLBAR", "self", ".", "_showCustomize", "=", "options", "&", "FM_OPT_SHOW_CUSTOMIZE", "self", "...
https://github.com/wxWidgets/wxPython-Classic/blob/19571e1ae65f1ac445f5491474121998c97a1bf0/wx/lib/agw/flatmenu.py#L2544-L2571
catboost/catboost
167f64f237114a4d10b2b4ee42adb4569137debe
contrib/python/importlib-metadata/py3/importlib_metadata/__init__.py
python
DistributionFinder.find_distributions
(self, context=Context())
Find distributions. Return an iterable of all Distribution instances capable of loading the metadata for packages matching the ``context``, a DistributionFinder.Context instance.
Find distributions.
[ "Find", "distributions", "." ]
def find_distributions(self, context=Context()): """ Find distributions. Return an iterable of all Distribution instances capable of loading the metadata for packages matching the ``context``, a DistributionFinder.Context instance. """
[ "def", "find_distributions", "(", "self", ",", "context", "=", "Context", "(", ")", ")", ":" ]
https://github.com/catboost/catboost/blob/167f64f237114a4d10b2b4ee42adb4569137debe/contrib/python/importlib-metadata/py3/importlib_metadata/__init__.py#L751-L758
gwaldron/osgearth
4c521857d59a69743e4a9cedba00afe570f984e8
src/third_party/tinygltf/deps/cpplint.py
python
NestingState.InExternC
(self)
return self.stack and isinstance(self.stack[-1], _ExternCInfo)
Check if we are currently one level inside an 'extern "C"' block. Returns: True if top of the stack is an extern block, False otherwise.
Check if we are currently one level inside an 'extern "C"' block.
[ "Check", "if", "we", "are", "currently", "one", "level", "inside", "an", "extern", "C", "block", "." ]
def InExternC(self): """Check if we are currently one level inside an 'extern "C"' block. Returns: True if top of the stack is an extern block, False otherwise. """ return self.stack and isinstance(self.stack[-1], _ExternCInfo)
[ "def", "InExternC", "(", "self", ")", ":", "return", "self", ".", "stack", "and", "isinstance", "(", "self", ".", "stack", "[", "-", "1", "]", ",", "_ExternCInfo", ")" ]
https://github.com/gwaldron/osgearth/blob/4c521857d59a69743e4a9cedba00afe570f984e8/src/third_party/tinygltf/deps/cpplint.py#L2242-L2248
stan-dev/math
5fd79f89933269a4ca4d8dd1fde2a36d53d4768c
lib/tbb_2020.3/python/tbb/pool.py
python
ApplyResult.successful
(self)
return self._success
Returns whether the call completed without raising an exception. Will raise AssertionError if the result is not ready.
Returns whether the call completed without raising an exception. Will raise AssertionError if the result is not ready.
[ "Returns", "whether", "the", "call", "completed", "without", "raising", "an", "exception", ".", "Will", "raise", "AssertionError", "if", "the", "result", "is", "not", "ready", "." ]
def successful(self): """Returns whether the call completed without raising an exception. Will raise AssertionError if the result is not ready.""" assert self.ready() return self._success
[ "def", "successful", "(", "self", ")", ":", "assert", "self", ".", "ready", "(", ")", "return", "self", ".", "_success" ]
https://github.com/stan-dev/math/blob/5fd79f89933269a4ca4d8dd1fde2a36d53d4768c/lib/tbb_2020.3/python/tbb/pool.py#L365-L370
pgRouting/osm2pgrouting
8491929fc4037d308f271e84d59bb96da3c28aa2
tools/cpplint.py
python
NestingState.InAsmBlock
(self)
return self.stack and self.stack[-1].inline_asm != _NO_ASM
Check if we are currently one level inside an inline ASM block. Returns: True if the top of the stack is a block containing inline ASM.
Check if we are currently one level inside an inline ASM block.
[ "Check", "if", "we", "are", "currently", "one", "level", "inside", "an", "inline", "ASM", "block", "." ]
def InAsmBlock(self): """Check if we are currently one level inside an inline ASM block. Returns: True if the top of the stack is a block containing inline ASM. """ return self.stack and self.stack[-1].inline_asm != _NO_ASM
[ "def", "InAsmBlock", "(", "self", ")", ":", "return", "self", ".", "stack", "and", "self", ".", "stack", "[", "-", "1", "]", ".", "inline_asm", "!=", "_NO_ASM" ]
https://github.com/pgRouting/osm2pgrouting/blob/8491929fc4037d308f271e84d59bb96da3c28aa2/tools/cpplint.py#L2256-L2262
apache/arrow
af33dd1157eb8d7d9bfac25ebf61445b793b7943
python/pyarrow/__init__.py
python
show_info
()
Print detailed version and platform information, for error reporting
Print detailed version and platform information, for error reporting
[ "Print", "detailed", "version", "and", "platform", "information", "for", "error", "reporting" ]
def show_info(): """ Print detailed version and platform information, for error reporting """ show_versions() def print_entry(label, value): print(f" {label: <20}: {value: <8}") print("\nPlatform:") print_entry("OS / Arch", f"{_platform.system()} {_platform.machine()}") print_...
[ "def", "show_info", "(", ")", ":", "show_versions", "(", ")", "def", "print_entry", "(", "label", ",", "value", ")", ":", "print", "(", "f\" {label: <20}: {value: <8}\"", ")", "print", "(", "\"\\nPlatform:\"", ")", "print_entry", "(", "\"OS / Arch\"", ",", "f...
https://github.com/apache/arrow/blob/af33dd1157eb8d7d9bfac25ebf61445b793b7943/python/pyarrow/__init__.py#L119-L157
aws/lumberyard
f85344403c1c2e77ec8c75deb2c116e97b713217
dev/Gems/CloudGemMetric/v1/AWS/python/windows/Lib/llvmlite/six.py
python
with_metaclass
(meta, *bases)
return type.__new__(metaclass, 'temporary_class', (), {})
Create a base class with a metaclass.
Create a base class with a metaclass.
[ "Create", "a", "base", "class", "with", "a", "metaclass", "." ]
def with_metaclass(meta, *bases): """Create a base class with a metaclass.""" # This requires a bit of explanation: the basic idea is to make a dummy # metaclass for one level of class instantiation that replaces itself with # the actual metaclass. class metaclass(meta): def __new__(cls, nam...
[ "def", "with_metaclass", "(", "meta", ",", "*", "bases", ")", ":", "# This requires a bit of explanation: the basic idea is to make a dummy", "# metaclass for one level of class instantiation that replaces itself with", "# the actual metaclass.", "class", "metaclass", "(", "meta", ")...
https://github.com/aws/lumberyard/blob/f85344403c1c2e77ec8c75deb2c116e97b713217/dev/Gems/CloudGemMetric/v1/AWS/python/windows/Lib/llvmlite/six.py#L730-L738
aws/lumberyard
f85344403c1c2e77ec8c75deb2c116e97b713217
dev/Tools/AWSPythonSDK/1.5.8/botocore/credentials.py
python
AssumeRoleCredentialFetcher._get_credentials
(self)
return client.assume_role(**kwargs)
Get credentials by calling assume role.
Get credentials by calling assume role.
[ "Get", "credentials", "by", "calling", "assume", "role", "." ]
def _get_credentials(self): """Get credentials by calling assume role.""" kwargs = self._assume_role_kwargs() client = self._create_client() return client.assume_role(**kwargs)
[ "def", "_get_credentials", "(", "self", ")", ":", "kwargs", "=", "self", ".", "_assume_role_kwargs", "(", ")", "client", "=", "self", ".", "_create_client", "(", ")", "return", "client", ".", "assume_role", "(", "*", "*", "kwargs", ")" ]
https://github.com/aws/lumberyard/blob/f85344403c1c2e77ec8c75deb2c116e97b713217/dev/Tools/AWSPythonSDK/1.5.8/botocore/credentials.py#L683-L687
plumonito/dtslam
5994bb9cf7a11981b830370db206bceb654c085d
3rdparty/opencv-git/3rdparty/jinja2/environment.py
python
Environment.preprocess
(self, source, name=None, filename=None)
return reduce(lambda s, e: e.preprocess(s, name, filename), self.iter_extensions(), text_type(source))
Preprocesses the source with all extensions. This is automatically called for all parsing and compiling methods but *not* for :meth:`lex` because there you usually only want the actual source tokenized.
Preprocesses the source with all extensions. This is automatically called for all parsing and compiling methods but *not* for :meth:`lex` because there you usually only want the actual source tokenized.
[ "Preprocesses", "the", "source", "with", "all", "extensions", ".", "This", "is", "automatically", "called", "for", "all", "parsing", "and", "compiling", "methods", "but", "*", "not", "*", "for", ":", "meth", ":", "lex", "because", "there", "you", "usually", ...
def preprocess(self, source, name=None, filename=None): """Preprocesses the source with all extensions. This is automatically called for all parsing and compiling methods but *not* for :meth:`lex` because there you usually only want the actual source tokenized. """ return reduce...
[ "def", "preprocess", "(", "self", ",", "source", ",", "name", "=", "None", ",", "filename", "=", "None", ")", ":", "return", "reduce", "(", "lambda", "s", ",", "e", ":", "e", ".", "preprocess", "(", "s", ",", "name", ",", "filename", ")", ",", "s...
https://github.com/plumonito/dtslam/blob/5994bb9cf7a11981b830370db206bceb654c085d/3rdparty/opencv-git/3rdparty/jinja2/environment.py#L478-L484
mantidproject/mantid
03deeb89254ec4289edb8771e0188c2090a02f32
Framework/PythonInterface/plugins/algorithms/WorkflowAlgorithms/DirectILLCollectData.py
python
_createFlatBkg
(ws, wsType, windowWidth, wsNames, algorithmLogging)
return bkgWS
Return a flat background workspace.
Return a flat background workspace.
[ "Return", "a", "flat", "background", "workspace", "." ]
def _createFlatBkg(ws, wsType, windowWidth, wsNames, algorithmLogging): """Return a flat background workspace.""" if wsType == common.WS_CONTENT_DETS: bkgWSName = wsNames.withSuffix('flat_bkg_for_detectors') else: bkgWSName = wsNames.withSuffix('flat_bkg_for_monitors') bkgWS = CalculateF...
[ "def", "_createFlatBkg", "(", "ws", ",", "wsType", ",", "windowWidth", ",", "wsNames", ",", "algorithmLogging", ")", ":", "if", "wsType", "==", "common", ".", "WS_CONTENT_DETS", ":", "bkgWSName", "=", "wsNames", ".", "withSuffix", "(", "'flat_bkg_for_detectors'"...
https://github.com/mantidproject/mantid/blob/03deeb89254ec4289edb8771e0188c2090a02f32/Framework/PythonInterface/plugins/algorithms/WorkflowAlgorithms/DirectILLCollectData.py#L108-L129
ideawu/ssdb
f229ba277c7f7d0ca5a441c0c6fb3d1209af68e4
deps/cpy/antlr3/tree.py
python
CommonTreeAdaptor.dupNode
(self, treeNode)
return treeNode.dupNode()
Duplicate a node. This is part of the factory; override if you want another kind of node to be built. I could use reflection to prevent having to override this but reflection is slow.
Duplicate a node. This is part of the factory; override if you want another kind of node to be built.
[ "Duplicate", "a", "node", ".", "This", "is", "part", "of", "the", "factory", ";", "override", "if", "you", "want", "another", "kind", "of", "node", "to", "be", "built", "." ]
def dupNode(self, treeNode): """ Duplicate a node. This is part of the factory; override if you want another kind of node to be built. I could use reflection to prevent having to override this but reflection is slow. """ if treeNode is None: return ...
[ "def", "dupNode", "(", "self", ",", "treeNode", ")", ":", "if", "treeNode", "is", "None", ":", "return", "None", "return", "treeNode", ".", "dupNode", "(", ")" ]
https://github.com/ideawu/ssdb/blob/f229ba277c7f7d0ca5a441c0c6fb3d1209af68e4/deps/cpy/antlr3/tree.py#L1401-L1413
panda3d/panda3d
833ad89ebad58395d0af0b7ec08538e5e4308265
direct/src/filter/CommonFilters.py
python
CommonFilters.delSrgbEncode
(self)
return True
Reverses the effects of setSrgbEncode.
Reverses the effects of setSrgbEncode.
[ "Reverses", "the", "effects", "of", "setSrgbEncode", "." ]
def delSrgbEncode(self): """ Reverses the effects of setSrgbEncode. """ if "SrgbEncode" in self.configuration: old_enable = self.configuration["SrgbEncode"] del self.configuration["SrgbEncode"] return self.reconfigure(old_enable, "SrgbEncode") return True
[ "def", "delSrgbEncode", "(", "self", ")", ":", "if", "\"SrgbEncode\"", "in", "self", ".", "configuration", ":", "old_enable", "=", "self", ".", "configuration", "[", "\"SrgbEncode\"", "]", "del", "self", ".", "configuration", "[", "\"SrgbEncode\"", "]", "retur...
https://github.com/panda3d/panda3d/blob/833ad89ebad58395d0af0b7ec08538e5e4308265/direct/src/filter/CommonFilters.py#L622-L628
jackaudio/jack2
21b293dbc37d42446141a08922cdec0d2550c6a0
waflib/Logs.py
python
formatter.format
(self, rec)
return logging.Formatter.format(self, rec)
Formats records and adds colors as needed. The records do not get a leading hour format if the logging level is above *INFO*.
Formats records and adds colors as needed. The records do not get a leading hour format if the logging level is above *INFO*.
[ "Formats", "records", "and", "adds", "colors", "as", "needed", ".", "The", "records", "do", "not", "get", "a", "leading", "hour", "format", "if", "the", "logging", "level", "is", "above", "*", "INFO", "*", "." ]
def format(self, rec): """ Formats records and adds colors as needed. The records do not get a leading hour format if the logging level is above *INFO*. """ try: msg = rec.msg.decode('utf-8') except Exception: msg = rec.msg use = colors_lst['USE'] if (use == 1 and rec.stream.isatty()) or use == 2...
[ "def", "format", "(", "self", ",", "rec", ")", ":", "try", ":", "msg", "=", "rec", ".", "msg", ".", "decode", "(", "'utf-8'", ")", "except", "Exception", ":", "msg", "=", "rec", ".", "msg", "use", "=", "colors_lst", "[", "'USE'", "]", "if", "(", ...
https://github.com/jackaudio/jack2/blob/21b293dbc37d42446141a08922cdec0d2550c6a0/waflib/Logs.py#L208-L246
floooh/oryol
eb08cffe1b1cb6b05ed14ec692bca9372cef064e
fips-files/generators/util/png.py
python
read_pnm_header
(infile, supported=('P5','P6'))
return header[0], header[1], header[2], depth, header[3]
Read a PNM header, returning (format,width,height,depth,maxval). `width` and `height` are in pixels. `depth` is the number of channels in the image; for PBM and PGM it is synthesized as 1, for PPM as 3; for PAM images it is read from the header. `maxval` is synthesized (as 1) for PBM images.
Read a PNM header, returning (format,width,height,depth,maxval). `width` and `height` are in pixels. `depth` is the number of channels in the image; for PBM and PGM it is synthesized as 1, for PPM as 3; for PAM images it is read from the header. `maxval` is synthesized (as 1) for PBM images.
[ "Read", "a", "PNM", "header", "returning", "(", "format", "width", "height", "depth", "maxval", ")", ".", "width", "and", "height", "are", "in", "pixels", ".", "depth", "is", "the", "number", "of", "channels", "in", "the", "image", ";", "for", "PBM", "...
def read_pnm_header(infile, supported=('P5','P6')): """ Read a PNM header, returning (format,width,height,depth,maxval). `width` and `height` are in pixels. `depth` is the number of channels in the image; for PBM and PGM it is synthesized as 1, for PPM as 3; for PAM images it is read from the heade...
[ "def", "read_pnm_header", "(", "infile", ",", "supported", "=", "(", "'P5'", ",", "'P6'", ")", ")", ":", "# Generally, see http://netpbm.sourceforge.net/doc/ppm.html", "# and http://netpbm.sourceforge.net/doc/pam.html", "supported", "=", "[", "strtobytes", "(", "x", ")", ...
https://github.com/floooh/oryol/blob/eb08cffe1b1cb6b05ed14ec692bca9372cef064e/fips-files/generators/util/png.py#L3511-L3588
miyosuda/TensorFlowAndroidMNIST
7b5a4603d2780a8a2834575706e9001977524007
jni-build/jni/include/tensorflow/python/ops/image_ops.py
python
random_saturation
(image, lower, upper, seed=None)
return adjust_saturation(image, saturation_factor)
Adjust the saturation of an RGB image by a random factor. Equivalent to `adjust_saturation()` but uses a `saturation_factor` randomly picked in the interval `[lower, upper]`. Args: image: RGB image or images. Size of the last dimension must be 3. lower: float. Lower bound for the random saturation fact...
Adjust the saturation of an RGB image by a random factor.
[ "Adjust", "the", "saturation", "of", "an", "RGB", "image", "by", "a", "random", "factor", "." ]
def random_saturation(image, lower, upper, seed=None): """Adjust the saturation of an RGB image by a random factor. Equivalent to `adjust_saturation()` but uses a `saturation_factor` randomly picked in the interval `[lower, upper]`. Args: image: RGB image or images. Size of the last dimension must be 3. ...
[ "def", "random_saturation", "(", "image", ",", "lower", ",", "upper", ",", "seed", "=", "None", ")", ":", "if", "upper", "<=", "lower", ":", "raise", "ValueError", "(", "'upper must be > lower.'", ")", "if", "lower", "<", "0", ":", "raise", "ValueError", ...
https://github.com/miyosuda/TensorFlowAndroidMNIST/blob/7b5a4603d2780a8a2834575706e9001977524007/jni-build/jni/include/tensorflow/python/ops/image_ops.py#L1272-L1301
synfig/synfig
a5ec91db5b751dc12e4400ccfb5c063fd6d2d928
synfig-studio/plugins/lottie-exporter/common/WidthPointList.py
python
WidthPointList.get_len
(self)
return len(self.entry_list)
Returns the number of entries
Returns the number of entries
[ "Returns", "the", "number", "of", "entries" ]
def get_len(self): """ Returns the number of entries """ return len(self.entry_list)
[ "def", "get_len", "(", "self", ")", ":", "return", "len", "(", "self", ".", "entry_list", ")" ]
https://github.com/synfig/synfig/blob/a5ec91db5b751dc12e4400ccfb5c063fd6d2d928/synfig-studio/plugins/lottie-exporter/common/WidthPointList.py#L103-L107
NVIDIA/nvvl
a94c7493ec9f309cc54acf81a66c62a068a06962
examples/pytorch_superres/nvidia/fp16.py
python
FP16_Optimizer.clip_fp32_grads
(self, max_norm, norm_type=2)
Clips fp32 master gradients via torch.nn.utils.clip_grad_norm. Args: max_norm (float or int): max norm of the gradients norm_type (float or int): type of the used p-norm. Can be ``'inf'`` for infinity norm. Returns: Total norm of the current fp32 gra...
Clips fp32 master gradients via torch.nn.utils.clip_grad_norm.
[ "Clips", "fp32", "master", "gradients", "via", "torch", ".", "nn", ".", "utils", ".", "clip_grad_norm", "." ]
def clip_fp32_grads(self, max_norm, norm_type=2): """ Clips fp32 master gradients via torch.nn.utils.clip_grad_norm. Args: max_norm (float or int): max norm of the gradients norm_type (float or int): type of the used p-norm. Can be ``'inf'`` for infinity ...
[ "def", "clip_fp32_grads", "(", "self", ",", "max_norm", ",", "norm_type", "=", "2", ")", ":", "if", "not", "self", ".", "overflow", ":", "fp32_params", "=", "[", "]", "for", "param_group", "in", "self", ".", "optimizer", ".", "param_groups", ":", "for", ...
https://github.com/NVIDIA/nvvl/blob/a94c7493ec9f309cc54acf81a66c62a068a06962/examples/pytorch_superres/nvidia/fp16.py#L165-L187
nodejs/nan
8db8c8f544f2b6ce1b0859ef6ecdd0a3873a9e62
cpplint.py
python
CheckForFunctionLengths
(filename, clean_lines, linenum, function_state, error)
Reports for long function bodies. For an overview why this is done, see: https://google-styleguide.googlecode.com/svn/trunk/cppguide.xml#Write_Short_Functions Uses a simplistic algorithm assuming other style guidelines (especially spacing) are followed. Only checks unindented functions, so class members are...
Reports for long function bodies.
[ "Reports", "for", "long", "function", "bodies", "." ]
def CheckForFunctionLengths(filename, clean_lines, linenum, function_state, error): """Reports for long function bodies. For an overview why this is done, see: https://google-styleguide.googlecode.com/svn/trunk/cppguide.xml#Write_Short_Functions Uses a simplistic algorithm assuming...
[ "def", "CheckForFunctionLengths", "(", "filename", ",", "clean_lines", ",", "linenum", ",", "function_state", ",", "error", ")", ":", "lines", "=", "clean_lines", ".", "lines", "line", "=", "lines", "[", "linenum", "]", "joined_line", "=", "''", "starting_func...
https://github.com/nodejs/nan/blob/8db8c8f544f2b6ce1b0859ef6ecdd0a3873a9e62/cpplint.py#L3283-L3348
rapidsai/cudf
d5b2448fc69f17509304d594f029d0df56984962
python/cudf/cudf/core/series.py
python
DatetimeProperties.is_month_start
(self)
return (self.day == 1).fillna(False)
Booleans indicating if dates are the first day of the month.
Booleans indicating if dates are the first day of the month.
[ "Booleans", "indicating", "if", "dates", "are", "the", "first", "day", "of", "the", "month", "." ]
def is_month_start(self): """ Booleans indicating if dates are the first day of the month. """ return (self.day == 1).fillna(False)
[ "def", "is_month_start", "(", "self", ")", ":", "return", "(", "self", ".", "day", "==", "1", ")", ".", "fillna", "(", "False", ")" ]
https://github.com/rapidsai/cudf/blob/d5b2448fc69f17509304d594f029d0df56984962/python/cudf/cudf/core/series.py#L4082-L4086
cliqz-oss/keyvi
957cb7197b2bff78d3afb22ad95e092f89afb0a6
keyvi/3rdparty/tpie/scripts/stream_header.py
python
read
(file_name, output_file)
Read the TPIE stream in `file_name` (str), and print its header as JSON to `output_file` (file).
Read the TPIE stream in `file_name` (str), and print its header as JSON to `output_file` (file).
[ "Read", "the", "TPIE", "stream", "in", "file_name", "(", "str", ")", "and", "print", "its", "header", "as", "JSON", "to", "output_file", "(", "file", ")", "." ]
def read(file_name, output_file): """Read the TPIE stream in `file_name` (str), and print its header as JSON to `output_file` (file).""" with open(file_name, 'rb') as stream: values = stream_header.unpack_from(stream.read(stream_header.size)) header_data = dict(zip(field_names, values)) json...
[ "def", "read", "(", "file_name", ",", "output_file", ")", ":", "with", "open", "(", "file_name", ",", "'rb'", ")", "as", "stream", ":", "values", "=", "stream_header", ".", "unpack_from", "(", "stream", ".", "read", "(", "stream_header", ".", "size", ")"...
https://github.com/cliqz-oss/keyvi/blob/957cb7197b2bff78d3afb22ad95e092f89afb0a6/keyvi/3rdparty/tpie/scripts/stream_header.py#L62-L70
microsoft/checkedc-clang
a173fefde5d7877b7750e7ce96dd08cf18baebf2
lldb/examples/python/mach_o.py
python
TerminalColors.white
(self, fg=True)
return ''
Set the foreground or background color to white. The foreground color will be set if "fg" tests True. The background color will be set if "fg" tests False.
Set the foreground or background color to white. The foreground color will be set if "fg" tests True. The background color will be set if "fg" tests False.
[ "Set", "the", "foreground", "or", "background", "color", "to", "white", ".", "The", "foreground", "color", "will", "be", "set", "if", "fg", "tests", "True", ".", "The", "background", "color", "will", "be", "set", "if", "fg", "tests", "False", "." ]
def white(self, fg=True): '''Set the foreground or background color to white. The foreground color will be set if "fg" tests True. The background color will be set if "fg" tests False.''' if self.enabled: if fg: return "\x1b[37m" else: retu...
[ "def", "white", "(", "self", ",", "fg", "=", "True", ")", ":", "if", "self", ".", "enabled", ":", "if", "fg", ":", "return", "\"\\x1b[37m\"", "else", ":", "return", "\"\\x1b[47m\"", "return", "''" ]
https://github.com/microsoft/checkedc-clang/blob/a173fefde5d7877b7750e7ce96dd08cf18baebf2/lldb/examples/python/mach_o.py#L341-L349
naver/sling
5671cd445a2caae0b4dd0332299e4cfede05062c
webkit/Tools/Scripts/webkitpy/xcode/simulator.py
python
Simulator.lookup_or_create_device
(self, name, device_type, runtime)
return testing_device
Returns an available iOS Simulator device for testing. This function will create a new simulator device with the specified name, device type and runtime if one does not already exist. :param name: The name of the simulator device to lookup or create. :type name: str :param devi...
Returns an available iOS Simulator device for testing.
[ "Returns", "an", "available", "iOS", "Simulator", "device", "for", "testing", "." ]
def lookup_or_create_device(self, name, device_type, runtime): """ Returns an available iOS Simulator device for testing. This function will create a new simulator device with the specified name, device type and runtime if one does not already exist. :param name: The name of th...
[ "def", "lookup_or_create_device", "(", "self", ",", "name", ",", "device_type", ",", "runtime", ")", ":", "assert", "(", "runtime", ".", "available", ")", "testing_device", "=", "self", ".", "device", "(", "name", "=", "name", ",", "runtime", "=", "runtime...
https://github.com/naver/sling/blob/5671cd445a2caae0b4dd0332299e4cfede05062c/webkit/Tools/Scripts/webkitpy/xcode/simulator.py#L496-L518
hanpfei/chromium-net
392cc1fa3a8f92f42e4071ab6e674d8e0482f83f
third_party/catapult/third_party/gsutil/third_party/boto/boto/glacier/utils.py
python
tree_hash_from_str
(str_as_bytes)
return bytes_to_hex(tree_hash(chunk_hashes(str_as_bytes)))
:type str_as_bytes: str :param str_as_bytes: The string for which to compute the tree hash. :rtype: str :return: The computed tree hash, returned as hex.
[]
def tree_hash_from_str(str_as_bytes): """ :type str_as_bytes: str :param str_as_bytes: The string for which to compute the tree hash. :rtype: str :return: The computed tree hash, returned as hex. """ return bytes_to_hex(tree_hash(chunk_hashes(str_as_bytes)))
[ "def", "tree_hash_from_str", "(", "str_as_bytes", ")", ":", "return", "bytes_to_hex", "(", "tree_hash", "(", "chunk_hashes", "(", "str_as_bytes", ")", ")", ")" ]
https://github.com/hanpfei/chromium-net/blob/392cc1fa3a8f92f42e4071ab6e674d8e0482f83f/third_party/catapult/third_party/gsutil/third_party/boto/boto/glacier/utils.py#L152-L162
hanpfei/chromium-net
392cc1fa3a8f92f42e4071ab6e674d8e0482f83f
third_party/catapult/third_party/coverage/coverage/html.py
python
HtmlStatus.reset
(self)
Initialize to empty.
Initialize to empty.
[ "Initialize", "to", "empty", "." ]
def reset(self): """Initialize to empty.""" self.settings = '' self.files = {}
[ "def", "reset", "(", "self", ")", ":", "self", ".", "settings", "=", "''", "self", ".", "files", "=", "{", "}" ]
https://github.com/hanpfei/chromium-net/blob/392cc1fa3a8f92f42e4071ab6e674d8e0482f83f/third_party/catapult/third_party/coverage/coverage/html.py#L339-L342
mindspore-ai/mindspore
fb8fd3338605bb34fa5cea054e535a8b1d753fab
mindspore/python/mindspore/ops/_op_impl/_custom_op/fake_learned_scale_quant_perchannel_grad.py
python
fake_learned_scale_quant_perchannel_grad_d_compute
(dout, input_data, alpha_data, quant_max_data, neg_trunc, kernel_name="fake_learned_scale_quant_perchannel_grad_d")
return [dx, dalpha_each]
FakeLearnedScaleQuantPerChannelGradD
FakeLearnedScaleQuantPerChannelGradD
[ "FakeLearnedScaleQuantPerChannelGradD" ]
def fake_learned_scale_quant_perchannel_grad_d_compute(dout, input_data, alpha_data, quant_max_data, neg_trunc, kernel_name="fake_learned_scale_quant_perchannel_grad_d"): """FakeLearnedScaleQuantPerChannelGradD""" input_shape = te.lang.cce.util.shape_to_lis...
[ "def", "fake_learned_scale_quant_perchannel_grad_d_compute", "(", "dout", ",", "input_data", ",", "alpha_data", ",", "quant_max_data", ",", "neg_trunc", ",", "kernel_name", "=", "\"fake_learned_scale_quant_perchannel_grad_d\"", ")", ":", "input_shape", "=", "te", ".", "la...
https://github.com/mindspore-ai/mindspore/blob/fb8fd3338605bb34fa5cea054e535a8b1d753fab/mindspore/python/mindspore/ops/_op_impl/_custom_op/fake_learned_scale_quant_perchannel_grad.py#L92-L140
aws/lumberyard
f85344403c1c2e77ec8c75deb2c116e97b713217
dev/Gems/CloudGemMetric/v1/AWS/python/windows/Lib/pandas/core/frame.py
python
DataFrame.rename
( self, mapper: Optional[Renamer] = None, *, index: Optional[Renamer] = None, columns: Optional[Renamer] = None, axis: Optional[Axis] = None, copy: bool = True, inplace: bool = False, level: Optional[Level] = None, errors: str = "ignore", ...
return super().rename( mapper=mapper, index=index, columns=columns, axis=axis, copy=copy, inplace=inplace, level=level, errors=errors, )
Alter axes labels. Function / dict values must be unique (1-to-1). Labels not contained in a dict / Series will be left as-is. Extra labels listed don't throw an error. See the :ref:`user guide <basics.rename>` for more. Parameters ---------- mapper : dict-like...
Alter axes labels.
[ "Alter", "axes", "labels", "." ]
def rename( self, mapper: Optional[Renamer] = None, *, index: Optional[Renamer] = None, columns: Optional[Renamer] = None, axis: Optional[Axis] = None, copy: bool = True, inplace: bool = False, level: Optional[Level] = None, errors: str = "...
[ "def", "rename", "(", "self", ",", "mapper", ":", "Optional", "[", "Renamer", "]", "=", "None", ",", "*", ",", "index", ":", "Optional", "[", "Renamer", "]", "=", "None", ",", "columns", ":", "Optional", "[", "Renamer", "]", "=", "None", ",", "axis...
https://github.com/aws/lumberyard/blob/f85344403c1c2e77ec8c75deb2c116e97b713217/dev/Gems/CloudGemMetric/v1/AWS/python/windows/Lib/pandas/core/frame.py#L4004-L4134
y123456yz/reading-and-annotate-mongodb-3.6
93280293672ca7586dc24af18132aa61e4ed7fcf
mongo/src/third_party/scons-2.5.0/scons-local-2.5.0/SCons/Node/Alias.py
python
Alias.sconsign
(self)
An Alias is not recorded in .sconsign files
An Alias is not recorded in .sconsign files
[ "An", "Alias", "is", "not", "recorded", "in", ".", "sconsign", "files" ]
def sconsign(self): """An Alias is not recorded in .sconsign files""" pass
[ "def", "sconsign", "(", "self", ")", ":", "pass" ]
https://github.com/y123456yz/reading-and-annotate-mongodb-3.6/blob/93280293672ca7586dc24af18132aa61e4ed7fcf/mongo/src/third_party/scons-2.5.0/scons-local-2.5.0/SCons/Node/Alias.py#L136-L138
baidu-research/tensorflow-allreduce
66d5b855e90b0949e9fa5cca5599fd729a70e874
tensorflow/python/platform/tf_logging.py
python
_get_thread_id
()
return thread_id & _THREAD_ID_MASK
Get id of current thread, suitable for logging as an unsigned quantity.
Get id of current thread, suitable for logging as an unsigned quantity.
[ "Get", "id", "of", "current", "thread", "suitable", "for", "logging", "as", "an", "unsigned", "quantity", "." ]
def _get_thread_id(): """Get id of current thread, suitable for logging as an unsigned quantity.""" # pylint: disable=protected-access thread_id = six.moves._thread.get_ident() # pylint:enable=protected-access return thread_id & _THREAD_ID_MASK
[ "def", "_get_thread_id", "(", ")", ":", "# pylint: disable=protected-access", "thread_id", "=", "six", ".", "moves", ".", "_thread", ".", "get_ident", "(", ")", "# pylint:enable=protected-access", "return", "thread_id", "&", "_THREAD_ID_MASK" ]
https://github.com/baidu-research/tensorflow-allreduce/blob/66d5b855e90b0949e9fa5cca5599fd729a70e874/tensorflow/python/platform/tf_logging.py#L236-L241
y123456yz/reading-and-annotate-mongodb-3.6
93280293672ca7586dc24af18132aa61e4ed7fcf
mongo/buildscripts/resmokelib/logging/loggers.py
python
BaseLogger.__init__
(self, name, logging_config=None, build_logger_server=None, parent=None)
Initialize a BaseLogger. :param name: the logger name. :param logging_config: the logging configuration. :param build_logger_server: the build logger server (e.g. logkeeper). :param parent: the parent logger.
Initialize a BaseLogger.
[ "Initialize", "a", "BaseLogger", "." ]
def __init__(self, name, logging_config=None, build_logger_server=None, parent=None): """Initialize a BaseLogger. :param name: the logger name. :param logging_config: the logging configuration. :param build_logger_server: the build logger server (e.g. logkeeper). :param parent: ...
[ "def", "__init__", "(", "self", ",", "name", ",", "logging_config", "=", "None", ",", "build_logger_server", "=", "None", ",", "parent", "=", "None", ")", ":", "logging", ".", "Logger", ".", "__init__", "(", "self", ",", "name", ",", "level", "=", "log...
https://github.com/y123456yz/reading-and-annotate-mongodb-3.6/blob/93280293672ca7586dc24af18132aa61e4ed7fcf/mongo/buildscripts/resmokelib/logging/loggers.py#L53-L66
catboost/catboost
167f64f237114a4d10b2b4ee42adb4569137debe
contrib/python/scikit-learn/py3/sklearn/covariance/_shrunk_covariance.py
python
shrunk_covariance
(emp_cov, shrinkage=0.1)
return shrunk_cov
Calculates a covariance matrix shrunk on the diagonal Read more in the :ref:`User Guide <shrunk_covariance>`. Parameters ---------- emp_cov : array-like, shape (n_features, n_features) Covariance matrix to be shrunk shrinkage : float, 0 <= shrinkage <= 1 Coefficient in the convex ...
Calculates a covariance matrix shrunk on the diagonal
[ "Calculates", "a", "covariance", "matrix", "shrunk", "on", "the", "diagonal" ]
def shrunk_covariance(emp_cov, shrinkage=0.1): """Calculates a covariance matrix shrunk on the diagonal Read more in the :ref:`User Guide <shrunk_covariance>`. Parameters ---------- emp_cov : array-like, shape (n_features, n_features) Covariance matrix to be shrunk shrinkage : float, ...
[ "def", "shrunk_covariance", "(", "emp_cov", ",", "shrinkage", "=", "0.1", ")", ":", "emp_cov", "=", "check_array", "(", "emp_cov", ")", "n_features", "=", "emp_cov", ".", "shape", "[", "0", "]", "mu", "=", "np", ".", "trace", "(", "emp_cov", ")", "/", ...
https://github.com/catboost/catboost/blob/167f64f237114a4d10b2b4ee42adb4569137debe/contrib/python/scikit-learn/py3/sklearn/covariance/_shrunk_covariance.py#L25-L60
RoboJackets/robocup-software
bce13ce53ddb2ecb9696266d980722c34617dc15
rj_gameplay/stp/role/constraint.py
python
has_ball
()
return constraint_fn
Creates a constraint function that returns true if the current robot has the ball. :return: Constraint function for current robot having the ball.
Creates a constraint function that returns true if the current robot has the ball. :return: Constraint function for current robot having the ball.
[ "Creates", "a", "constraint", "function", "that", "returns", "true", "if", "the", "current", "robot", "has", "the", "ball", ".", ":", "return", ":", "Constraint", "function", "for", "current", "robot", "having", "the", "ball", "." ]
def has_ball() -> role.ConstraintFn: """Creates a constraint function that returns true if the current robot has the ball. :return: Constraint function for current robot having the ball. """ def constraint_fn( robot: rc.Robot, prev_result: Optional[role.RoleResult], world_st...
[ "def", "has_ball", "(", ")", "->", "role", ".", "ConstraintFn", ":", "def", "constraint_fn", "(", "robot", ":", "rc", ".", "Robot", ",", "prev_result", ":", "Optional", "[", "role", ".", "RoleResult", "]", ",", "world_state", ":", "rc", ".", "WorldState"...
https://github.com/RoboJackets/robocup-software/blob/bce13ce53ddb2ecb9696266d980722c34617dc15/rj_gameplay/stp/role/constraint.py#L10-L23
Xilinx/Vitis-AI
fc74d404563d9951b57245443c73bef389f3657f
demo/DPU-for-RNN/rnnt_asr_vck5000/model_rnnt.py
python
RNNT.predict
(self, y, state=None, add_sos=True)
return g, hid
B - batch size U - label length H - Hidden dimension size L - Number of decoder layers = 2 Args: y: (B, U) Returns: Tuple (g, hid) where: g: (B, U + 1, H) hid: (h, c) where h is the final sequence hidden state and c is ...
B - batch size U - label length H - Hidden dimension size L - Number of decoder layers = 2
[ "B", "-", "batch", "size", "U", "-", "label", "length", "H", "-", "Hidden", "dimension", "size", "L", "-", "Number", "of", "decoder", "layers", "=", "2" ]
def predict(self, y, state=None, add_sos=True): """ B - batch size U - label length H - Hidden dimension size L - Number of decoder layers = 2 Args: y: (B, U) Returns: Tuple (g, hid) where: g: (B, U + 1, H) ...
[ "def", "predict", "(", "self", ",", "y", ",", "state", "=", "None", ",", "add_sos", "=", "True", ")", ":", "if", "isinstance", "(", "y", ",", "torch", ".", "Tensor", ")", ":", "y", "=", "self", ".", "prediction", "[", "\"embed\"", "]", "(", "y", ...
https://github.com/Xilinx/Vitis-AI/blob/fc74d404563d9951b57245443c73bef389f3657f/demo/DPU-for-RNN/rnnt_asr_vck5000/model_rnnt.py#L219-L271
baidu-research/tensorflow-allreduce
66d5b855e90b0949e9fa5cca5599fd729a70e874
tensorflow/python/ops/resource_variable_ops.py
python
ResourceVariable.value
(self)
A cached operation which reads the value of this variable.
A cached operation which reads the value of this variable.
[ "A", "cached", "operation", "which", "reads", "the", "value", "of", "this", "variable", "." ]
def value(self): """A cached operation which reads the value of this variable.""" if self._cached_value is not None: return self._cached_value with ops.colocate_with(None, ignore_existing=True): with ops.device(self._handle.device): return gen_resource_variable_ops.read_variable_op( ...
[ "def", "value", "(", "self", ")", ":", "if", "self", ".", "_cached_value", "is", "not", "None", ":", "return", "self", ".", "_cached_value", "with", "ops", ".", "colocate_with", "(", "None", ",", "ignore_existing", "=", "True", ")", ":", "with", "ops", ...
https://github.com/baidu-research/tensorflow-allreduce/blob/66d5b855e90b0949e9fa5cca5599fd729a70e874/tensorflow/python/ops/resource_variable_ops.py#L294-L301
wxWidgets/wxPython-Classic
19571e1ae65f1ac445f5491474121998c97a1bf0
src/osx_carbon/_core.py
python
EvtHandler.Disconnect
(*args, **kwargs)
return _core_.EvtHandler_Disconnect(*args, **kwargs)
Disconnect(self, int id, int lastId=-1, EventType eventType=wxEVT_NULL, PyObject func=None) -> bool
Disconnect(self, int id, int lastId=-1, EventType eventType=wxEVT_NULL, PyObject func=None) -> bool
[ "Disconnect", "(", "self", "int", "id", "int", "lastId", "=", "-", "1", "EventType", "eventType", "=", "wxEVT_NULL", "PyObject", "func", "=", "None", ")", "-", ">", "bool" ]
def Disconnect(*args, **kwargs): """ Disconnect(self, int id, int lastId=-1, EventType eventType=wxEVT_NULL, PyObject func=None) -> bool """ return _core_.EvtHandler_Disconnect(*args, **kwargs)
[ "def", "Disconnect", "(", "*", "args", ",", "*", "*", "kwargs", ")", ":", "return", "_core_", ".", "EvtHandler_Disconnect", "(", "*", "args", ",", "*", "*", "kwargs", ")" ]
https://github.com/wxWidgets/wxPython-Classic/blob/19571e1ae65f1ac445f5491474121998c97a1bf0/src/osx_carbon/_core.py#L4184-L4189
miyosuda/TensorFlowAndroidMNIST
7b5a4603d2780a8a2834575706e9001977524007
jni-build/jni/include/tensorflow/python/framework/common_shapes.py
python
bias_add_grad_shape
(op)
return [output_shape]
Shape function for a BiasAddGrad op.
Shape function for a BiasAddGrad op.
[ "Shape", "function", "for", "a", "BiasAddGrad", "op", "." ]
def bias_add_grad_shape(op): """Shape function for a BiasAddGrad op.""" input_shape = op.inputs[0].get_shape().with_rank_at_least(2) try: data_format = op.get_attr("data_format") except ValueError: data_format = None if data_format == b"NCHW": output_shape = input_shape[-3] else: output_sha...
[ "def", "bias_add_grad_shape", "(", "op", ")", ":", "input_shape", "=", "op", ".", "inputs", "[", "0", "]", ".", "get_shape", "(", ")", ".", "with_rank_at_least", "(", "2", ")", "try", ":", "data_format", "=", "op", ".", "get_attr", "(", "\"data_format\""...
https://github.com/miyosuda/TensorFlowAndroidMNIST/blob/7b5a4603d2780a8a2834575706e9001977524007/jni-build/jni/include/tensorflow/python/framework/common_shapes.py#L121-L134
yuxng/PoseCNN
9f3dd7b7bce21dcafc05e8f18ccc90da3caabd04
lib/datasets/ycb.py
python
ycb.image_path_from_index
(self, index)
return image_path
Construct an image path from the image's "index" identifier.
Construct an image path from the image's "index" identifier.
[ "Construct", "an", "image", "path", "from", "the", "image", "s", "index", "identifier", "." ]
def image_path_from_index(self, index): """ Construct an image path from the image's "index" identifier. """ image_path = os.path.join(self._data_path, index + self._image_ext) assert os.path.exists(image_path), \ 'Path does not exist: {}'.format(image_path) ...
[ "def", "image_path_from_index", "(", "self", ",", "index", ")", ":", "image_path", "=", "os", ".", "path", ".", "join", "(", "self", ".", "_data_path", ",", "index", "+", "self", ".", "_image_ext", ")", "assert", "os", ".", "path", ".", "exists", "(", ...
https://github.com/yuxng/PoseCNN/blob/9f3dd7b7bce21dcafc05e8f18ccc90da3caabd04/lib/datasets/ycb.py#L54-L62
naver/sling
5671cd445a2caae0b4dd0332299e4cfede05062c
webkit/Tools/Scripts/webkitpy/thirdparty/mod_pywebsocket/util.py
python
prepend_message_to_exception
(message, exc)
return
Prepend message to the exception.
Prepend message to the exception.
[ "Prepend", "message", "to", "the", "exception", "." ]
def prepend_message_to_exception(message, exc): """Prepend message to the exception.""" exc.args = (message + str(exc),) return
[ "def", "prepend_message_to_exception", "(", "message", ",", "exc", ")", ":", "exc", ".", "args", "=", "(", "message", "+", "str", "(", "exc", ")", ",", ")", "return" ]
https://github.com/naver/sling/blob/5671cd445a2caae0b4dd0332299e4cfede05062c/webkit/Tools/Scripts/webkitpy/thirdparty/mod_pywebsocket/util.py#L78-L82
google/syzygy
8164b24ebde9c5649c9a09e88a7fc0b0fcbd1bc5
syzygy/py/etw_db/etw_db/process.py
python
ProcessThreadDatabase.__init__
(self, no_pruning=False)
Initializes a new database. Args: no_pruning: if true, process and thread information is maintained past process/thread end events.
Initializes a new database.
[ "Initializes", "a", "new", "database", "." ]
def __init__(self, no_pruning=False): """Initializes a new database. Args: no_pruning: if true, process and thread information is maintained past process/thread end events. """ EventConsumer.__init__(self) self._no_pruning = no_pruning # Processes by id maps from process ID to c...
[ "def", "__init__", "(", "self", ",", "no_pruning", "=", "False", ")", ":", "EventConsumer", ".", "__init__", "(", "self", ")", "self", ".", "_no_pruning", "=", "no_pruning", "# Processes by id maps from process ID to command line.", "self", ".", "_processes_by_id", ...
https://github.com/google/syzygy/blob/8164b24ebde9c5649c9a09e88a7fc0b0fcbd1bc5/syzygy/py/etw_db/etw_db/process.py#L44-L56
wlanjie/AndroidFFmpeg
7baf9122f4b8e1c74e7baf4be5c422c7a5ba5aaf
tools/fdk-aac-build/x86/toolchain/lib/python2.7/logging/handlers.py
python
SMTPHandler.getSubject
(self, record)
return self.subject
Determine the subject for the email. If you want to specify a subject line which is record-dependent, override this method.
Determine the subject for the email.
[ "Determine", "the", "subject", "for", "the", "email", "." ]
def getSubject(self, record): """ Determine the subject for the email. If you want to specify a subject line which is record-dependent, override this method. """ return self.subject
[ "def", "getSubject", "(", "self", ",", "record", ")", ":", "return", "self", ".", "subject" ]
https://github.com/wlanjie/AndroidFFmpeg/blob/7baf9122f4b8e1c74e7baf4be5c422c7a5ba5aaf/tools/fdk-aac-build/x86/toolchain/lib/python2.7/logging/handlers.py#L907-L914
aws/lumberyard
f85344403c1c2e77ec8c75deb2c116e97b713217
dev/Tools/Python/3.7.10/linux_x64/lib/python3.7/site-packages/pip/_internal/index/package_finder.py
python
CandidatePreferences.__init__
( self, prefer_binary=False, # type: bool allow_all_prereleases=False, # type: bool )
:param allow_all_prereleases: Whether to allow all pre-releases.
[]
def __init__( self, prefer_binary=False, # type: bool allow_all_prereleases=False, # type: bool ): # type: (...) -> None """ :param allow_all_prereleases: Whether to allow all pre-releases. """ self.allow_all_prereleases = allow_all_prerelea...
[ "def", "__init__", "(", "self", ",", "prefer_binary", "=", "False", ",", "# type: bool", "allow_all_prereleases", "=", "False", ",", "# type: bool", ")", ":", "# type: (...) -> None", "self", ".", "allow_all_prereleases", "=", "allow_all_prereleases", "self", ".", "...
https://github.com/aws/lumberyard/blob/f85344403c1c2e77ec8c75deb2c116e97b713217/dev/Tools/Python/3.7.10/linux_x64/lib/python3.7/site-packages/pip/_internal/index/package_finder.py#L641-L661
baidu-research/tensorflow-allreduce
66d5b855e90b0949e9fa5cca5599fd729a70e874
tensorflow/python/ops/distributions/transformed_distribution.py
python
_logical_not
(x)
return constant_op.constant(np.logical_not(x_))
Convenience function which attempts to statically apply `logical_not`.
Convenience function which attempts to statically apply `logical_not`.
[ "Convenience", "function", "which", "attempts", "to", "statically", "apply", "logical_not", "." ]
def _logical_not(x): """Convenience function which attempts to statically apply `logical_not`.""" x_ = _static_value(x) if x_ is None: return math_ops.logical_not(x) return constant_op.constant(np.logical_not(x_))
[ "def", "_logical_not", "(", "x", ")", ":", "x_", "=", "_static_value", "(", "x", ")", "if", "x_", "is", "None", ":", "return", "math_ops", ".", "logical_not", "(", "x", ")", "return", "constant_op", ".", "constant", "(", "np", ".", "logical_not", "(", ...
https://github.com/baidu-research/tensorflow-allreduce/blob/66d5b855e90b0949e9fa5cca5599fd729a70e874/tensorflow/python/ops/distributions/transformed_distribution.py#L73-L78
Samsung/veles
95ed733c2e49bc011ad98ccf2416ecec23fbf352
veles/external/pydot.py
python
Graph.set_simplify
(self, simplify)
Set whether to simplify or not. If True it will avoid displaying equal edges, i.e. only one edge between two nodes. removing the duplicated ones.
Set whether to simplify or not. If True it will avoid displaying equal edges, i.e. only one edge between two nodes. removing the duplicated ones.
[ "Set", "whether", "to", "simplify", "or", "not", ".", "If", "True", "it", "will", "avoid", "displaying", "equal", "edges", "i", ".", "e", ".", "only", "one", "edge", "between", "two", "nodes", ".", "removing", "the", "duplicated", "ones", "." ]
def set_simplify(self, simplify): """Set whether to simplify or not. If True it will avoid displaying equal edges, i.e. only one edge between two nodes. removing the duplicated ones. """ self.obj_dict['simplify'] = simplify
[ "def", "set_simplify", "(", "self", ",", "simplify", ")", ":", "self", ".", "obj_dict", "[", "'simplify'", "]", "=", "simplify" ]
https://github.com/Samsung/veles/blob/95ed733c2e49bc011ad98ccf2416ecec23fbf352/veles/external/pydot.py#L1152-L1160
scribusproject/scribus
41ec7c775a060912cf251682a8b1437f753f80f4
codegen/cheetah/Cheetah/Template.py
python
Template.webInput
(self, names, namesMulti=(), default='', src='f', defaultInt=0, defaultFloat=0.00, badInt=0, badFloat=0.00, debug=False)
return dic
Method for importing web transaction variables in bulk. This works for GET/POST fields both in Webware servlets and in CGI scripts, and for cookies and session variables in Webware servlets. If you try to read a cookie or session variable in a CGI script, you'll get a RuntimeError. 'I...
Method for importing web transaction variables in bulk.
[ "Method", "for", "importing", "web", "transaction", "variables", "in", "bulk", "." ]
def webInput(self, names, namesMulti=(), default='', src='f', defaultInt=0, defaultFloat=0.00, badInt=0, badFloat=0.00, debug=False): """Method for importing web transaction variables in bulk. This works for GET/POST fields both in Webware servlets and in CGI scripts, and for cookies an...
[ "def", "webInput", "(", "self", ",", "names", ",", "namesMulti", "=", "(", ")", ",", "default", "=", "''", ",", "src", "=", "'f'", ",", "defaultInt", "=", "0", ",", "defaultFloat", "=", "0.00", ",", "badInt", "=", "0", ",", "badFloat", "=", "0.00",...
https://github.com/scribusproject/scribus/blob/41ec7c775a060912cf251682a8b1437f753f80f4/codegen/cheetah/Cheetah/Template.py#L1632-L1859
baidu-research/tensorflow-allreduce
66d5b855e90b0949e9fa5cca5599fd729a70e874
tensorflow/contrib/specs/python/specs_lib.py
python
check_keywords
(spec)
Check for common Python keywords in spec. This function discourages the use of complex constructs in TensorFlow specs; it doesn't completely prohibit them (if necessary, we could check the AST). Args: spec: spec string Raises: ValueError: raised if spec contains a prohibited keyword.
Check for common Python keywords in spec.
[ "Check", "for", "common", "Python", "keywords", "in", "spec", "." ]
def check_keywords(spec): """Check for common Python keywords in spec. This function discourages the use of complex constructs in TensorFlow specs; it doesn't completely prohibit them (if necessary, we could check the AST). Args: spec: spec string Raises: ValueError: raised if spec contains a...
[ "def", "check_keywords", "(", "spec", ")", ":", "spec", "=", "re", ".", "sub", "(", "QUOTED", ",", "\"\"", ",", "spec", ")", "match", "=", "re", ".", "search", "(", "KEYWORDS", ",", "spec", ")", "if", "match", ":", "raise", "ValueError", "(", "\"ke...
https://github.com/baidu-research/tensorflow-allreduce/blob/66d5b855e90b0949e9fa5cca5599fd729a70e874/tensorflow/contrib/specs/python/specs_lib.py#L37-L53
ApolloAuto/apollo-platform
86d9dc6743b496ead18d597748ebabd34a513289
ros/ros_comm/roslaunch/src/roslaunch/server.py
python
ROSLaunchChildHandler.shutdown
(self)
return 1, "success", 1
@return: code, msg, ignore @rtype: int, str, int
[]
def shutdown(self): """ @return: code, msg, ignore @rtype: int, str, int """ self._shutdown("external call") return 1, "success", 1
[ "def", "shutdown", "(", "self", ")", ":", "self", ".", "_shutdown", "(", "\"external call\"", ")", "return", "1", ",", "\"success\"", ",", "1" ]
https://github.com/ApolloAuto/apollo-platform/blob/86d9dc6743b496ead18d597748ebabd34a513289/ros/ros_comm/roslaunch/src/roslaunch/server.py#L279-L285
tensorflow/deepmath
b5b721f54de1d5d6a02d78f5da5995237f9995f9
deepmath/deephol/utilities/normalization_lib.py
python
extend_context
(context: List[Callable[[Text], Text]], old_name: Text, new_name: Text)
return new_context
Extends the stack of variable renamings.
Extends the stack of variable renamings.
[ "Extends", "the", "stack", "of", "variable", "renamings", "." ]
def extend_context(context: List[Callable[[Text], Text]], old_name: Text, new_name: Text): """Extends the stack of variable renamings.""" new_context = list(context) new_context.append(lambda s: new_name if s == old_name else s) return new_context
[ "def", "extend_context", "(", "context", ":", "List", "[", "Callable", "[", "[", "Text", "]", ",", "Text", "]", "]", ",", "old_name", ":", "Text", ",", "new_name", ":", "Text", ")", ":", "new_context", "=", "list", "(", "context", ")", "new_context", ...
https://github.com/tensorflow/deepmath/blob/b5b721f54de1d5d6a02d78f5da5995237f9995f9/deepmath/deephol/utilities/normalization_lib.py#L28-L33
FreeCAD/FreeCAD
ba42231b9c6889b89e064d6d563448ed81e376ec
src/Mod/Draft/draftutils/init_tools.py
python
get_draft_utility_commands_menu
()
return ["Draft_SetStyle", "Draft_ApplyStyle", "Separator", "Draft_Layer", "Draft_AddNamedGroup", "Draft_AddToGroup", "Draft_SelectGroup", "Draft_ToggleConstructionMode", "Draft_AddConstruction", "Separator", ...
Return the utility commands list for the menu.
Return the utility commands list for the menu.
[ "Return", "the", "utility", "commands", "list", "for", "the", "menu", "." ]
def get_draft_utility_commands_menu(): """Return the utility commands list for the menu.""" return ["Draft_SetStyle", "Draft_ApplyStyle", "Separator", "Draft_Layer", "Draft_AddNamedGroup", "Draft_AddToGroup", "Draft_SelectGroup", ...
[ "def", "get_draft_utility_commands_menu", "(", ")", ":", "return", "[", "\"Draft_SetStyle\"", ",", "\"Draft_ApplyStyle\"", ",", "\"Separator\"", ",", "\"Draft_Layer\"", ",", "\"Draft_AddNamedGroup\"", ",", "\"Draft_AddToGroup\"", ",", "\"Draft_SelectGroup\"", ",", "\"Draft_...
https://github.com/FreeCAD/FreeCAD/blob/ba42231b9c6889b89e064d6d563448ed81e376ec/src/Mod/Draft/draftutils/init_tools.py#L109-L128
wlanjie/AndroidFFmpeg
7baf9122f4b8e1c74e7baf4be5c422c7a5ba5aaf
tools/fdk-aac-build/x86/toolchain/lib/python2.7/logging/__init__.py
python
FileHandler._open
(self)
return stream
Open the current base file with the (original) mode and encoding. Return the resulting stream.
Open the current base file with the (original) mode and encoding. Return the resulting stream.
[ "Open", "the", "current", "base", "file", "with", "the", "(", "original", ")", "mode", "and", "encoding", ".", "Return", "the", "resulting", "stream", "." ]
def _open(self): """ Open the current base file with the (original) mode and encoding. Return the resulting stream. """ if self.encoding is None: stream = open(self.baseFilename, self.mode) else: stream = codecs.open(self.baseFilename, self.mode, s...
[ "def", "_open", "(", "self", ")", ":", "if", "self", ".", "encoding", "is", "None", ":", "stream", "=", "open", "(", "self", ".", "baseFilename", ",", "self", ".", "mode", ")", "else", ":", "stream", "=", "codecs", ".", "open", "(", "self", ".", ...
https://github.com/wlanjie/AndroidFFmpeg/blob/7baf9122f4b8e1c74e7baf4be5c422c7a5ba5aaf/tools/fdk-aac-build/x86/toolchain/lib/python2.7/logging/__init__.py#L919-L928
google-ar/WebARonTango
e86965d2cbc652156b480e0fcf77c716745578cd
chromium/src/gpu/command_buffer/build_gles2_cmd_buffer.py
python
Function.WriteGLES2Header
(self, f)
Writes the GLES2 Implemention unit test.
Writes the GLES2 Implemention unit test.
[ "Writes", "the", "GLES2", "Implemention", "unit", "test", "." ]
def WriteGLES2Header(self, f): """Writes the GLES2 Implemention unit test.""" self.type_handler.WriteGLES2Header(self, f)
[ "def", "WriteGLES2Header", "(", "self", ",", "f", ")", ":", "self", ".", "type_handler", ".", "WriteGLES2Header", "(", "self", ",", "f", ")" ]
https://github.com/google-ar/WebARonTango/blob/e86965d2cbc652156b480e0fcf77c716745578cd/chromium/src/gpu/command_buffer/build_gles2_cmd_buffer.py#L9659-L9661
baidu-research/tensorflow-allreduce
66d5b855e90b0949e9fa5cca5599fd729a70e874
tensorflow/contrib/factorization/examples/mnist.py
python
placeholder_inputs
()
return images_placeholder, labels_placeholder
Generate placeholder variables to represent the input tensors. Returns: images_placeholder: Images placeholder. labels_placeholder: Labels placeholder.
Generate placeholder variables to represent the input tensors.
[ "Generate", "placeholder", "variables", "to", "represent", "the", "input", "tensors", "." ]
def placeholder_inputs(): """Generate placeholder variables to represent the input tensors. Returns: images_placeholder: Images placeholder. labels_placeholder: Labels placeholder. """ images_placeholder = tf.placeholder(tf.float32, shape=(None, ...
[ "def", "placeholder_inputs", "(", ")", ":", "images_placeholder", "=", "tf", ".", "placeholder", "(", "tf", ".", "float32", ",", "shape", "=", "(", "None", ",", "mnist", ".", "IMAGE_PIXELS", ")", ")", "labels_placeholder", "=", "tf", ".", "placeholder", "(...
https://github.com/baidu-research/tensorflow-allreduce/blob/66d5b855e90b0949e9fa5cca5599fd729a70e874/tensorflow/contrib/factorization/examples/mnist.py#L52-L62
aws/lumberyard
f85344403c1c2e77ec8c75deb2c116e97b713217
dev/Tools/Python/3.7.10/windows/Lib/site-packages/pip/_vendor/six.py
python
_add_doc
(func, doc)
Add documentation to a function.
Add documentation to a function.
[ "Add", "documentation", "to", "a", "function", "." ]
def _add_doc(func, doc): """Add documentation to a function.""" func.__doc__ = doc
[ "def", "_add_doc", "(", "func", ",", "doc", ")", ":", "func", ".", "__doc__", "=", "doc" ]
https://github.com/aws/lumberyard/blob/f85344403c1c2e77ec8c75deb2c116e97b713217/dev/Tools/Python/3.7.10/windows/Lib/site-packages/pip/_vendor/six.py#L75-L77
kevinlin311tw/cvpr16-deepbit
c60fb3233d7d534cfcee9d3ed47d77af437ee32a
scripts/cpp_lint.py
python
_NestingState.Update
(self, filename, clean_lines, linenum, error)
Update nesting state with current line. Args: filename: The name of the current file. clean_lines: A CleansedLines instance containing the file. linenum: The number of the line to check. error: The function to call with any errors found.
Update nesting state with current line.
[ "Update", "nesting", "state", "with", "current", "line", "." ]
def Update(self, filename, clean_lines, linenum, error): """Update nesting state with current line. Args: filename: The name of the current file. clean_lines: A CleansedLines instance containing the file. linenum: The number of the line to check. error: The function to call with any err...
[ "def", "Update", "(", "self", ",", "filename", ",", "clean_lines", ",", "linenum", ",", "error", ")", ":", "line", "=", "clean_lines", ".", "elided", "[", "linenum", "]", "# Update pp_stack first", "self", ".", "UpdatePreprocessor", "(", "line", ")", "# Coun...
https://github.com/kevinlin311tw/cvpr16-deepbit/blob/c60fb3233d7d534cfcee9d3ed47d77af437ee32a/scripts/cpp_lint.py#L2004-L2158
domino-team/openwrt-cc
8b181297c34d14d3ca521cc9f31430d561dbc688
package/gli-pub/openwrt-node-packages-master/node/node-v6.9.1/tools/gyp/tools/pretty_vcproj.py
python
FlattenFilter
(node)
return node_list
Returns a list of all the node and sub nodes.
Returns a list of all the node and sub nodes.
[ "Returns", "a", "list", "of", "all", "the", "node", "and", "sub", "nodes", "." ]
def FlattenFilter(node): """Returns a list of all the node and sub nodes.""" node_list = [] if (node.attributes and node.getAttribute('Name') == '_excluded_files'): # We don't add the "_excluded_files" filter. return [] for current in node.childNodes: if current.nodeName == 'Filter': ...
[ "def", "FlattenFilter", "(", "node", ")", ":", "node_list", "=", "[", "]", "if", "(", "node", ".", "attributes", "and", "node", ".", "getAttribute", "(", "'Name'", ")", "==", "'_excluded_files'", ")", ":", "# We don't add the \"_excluded_files\" filter.", "retur...
https://github.com/domino-team/openwrt-cc/blob/8b181297c34d14d3ca521cc9f31430d561dbc688/package/gli-pub/openwrt-node-packages-master/node/node-v6.9.1/tools/gyp/tools/pretty_vcproj.py#L95-L110
DaFuCoding/MTCNN_Caffe
09c30c3ff391bd9cb6b249c1910afaf147767ab3
scripts/cpp_lint.py
python
PrintCategories
()
Prints a list of all the error-categories used by error messages. These are the categories used to filter messages via --filter.
Prints a list of all the error-categories used by error messages.
[ "Prints", "a", "list", "of", "all", "the", "error", "-", "categories", "used", "by", "error", "messages", "." ]
def PrintCategories(): """Prints a list of all the error-categories used by error messages. These are the categories used to filter messages via --filter. """ sys.stderr.write(''.join(' %s\n' % cat for cat in _ERROR_CATEGORIES)) sys.exit(0)
[ "def", "PrintCategories", "(", ")", ":", "sys", ".", "stderr", ".", "write", "(", "''", ".", "join", "(", "' %s\\n'", "%", "cat", "for", "cat", "in", "_ERROR_CATEGORIES", ")", ")", "sys", ".", "exit", "(", "0", ")" ]
https://github.com/DaFuCoding/MTCNN_Caffe/blob/09c30c3ff391bd9cb6b249c1910afaf147767ab3/scripts/cpp_lint.py#L4770-L4776
tomahawk-player/tomahawk-resolvers
7f827bbe410ccfdb0446f7d6a91acc2199c9cc8d
archive/spotify/breakpad/third_party/protobuf/protobuf/python/mox.py
python
In.equals
(self, rhs)
return self._key in rhs
Check to see whether key is in rhs. Args: rhs: dict Returns: bool
Check to see whether key is in rhs.
[ "Check", "to", "see", "whether", "key", "is", "in", "rhs", "." ]
def equals(self, rhs): """Check to see whether key is in rhs. Args: rhs: dict Returns: bool """ return self._key in rhs
[ "def", "equals", "(", "self", ",", "rhs", ")", ":", "return", "self", ".", "_key", "in", "rhs" ]
https://github.com/tomahawk-player/tomahawk-resolvers/blob/7f827bbe410ccfdb0446f7d6a91acc2199c9cc8d/archive/spotify/breakpad/third_party/protobuf/protobuf/python/mox.py#L955-L965
esphome/esphome
40e06c9819f17409615d4f4eec5cfe4dc9a3776d
esphome/cpp_generator.py
python
MockObj.template
(self, *args: SafeExpType)
return MockObj(f"{self.base}{args}")
Apply template parameters to this object.
Apply template parameters to this object.
[ "Apply", "template", "parameters", "to", "this", "object", "." ]
def template(self, *args: SafeExpType) -> "MockObj": """Apply template parameters to this object.""" if len(args) != 1 or not isinstance(args[0], TemplateArguments): args = TemplateArguments(*args) else: args = args[0] return MockObj(f"{self.base}{args}")
[ "def", "template", "(", "self", ",", "*", "args", ":", "SafeExpType", ")", "->", "\"MockObj\"", ":", "if", "len", "(", "args", ")", "!=", "1", "or", "not", "isinstance", "(", "args", "[", "0", "]", ",", "TemplateArguments", ")", ":", "args", "=", "...
https://github.com/esphome/esphome/blob/40e06c9819f17409615d4f4eec5cfe4dc9a3776d/esphome/cpp_generator.py#L745-L751
CRYTEK/CRYENGINE
232227c59a220cbbd311576f0fbeba7bb53b2a8c
Code/Tools/waf-1.7.13/waflib/Configure.py
python
conf
(f)
return f
Decorator: attach new configuration functions to :py:class:`waflib.Build.BuildContext` and :py:class:`waflib.Configure.ConfigurationContext`. The methods bound will accept a parameter named 'mandatory' to disable the configuration errors:: def configure(conf): conf.find_program('abc', mandatory=False) :param ...
Decorator: attach new configuration functions to :py:class:`waflib.Build.BuildContext` and :py:class:`waflib.Configure.ConfigurationContext`. The methods bound will accept a parameter named 'mandatory' to disable the configuration errors::
[ "Decorator", ":", "attach", "new", "configuration", "functions", "to", ":", "py", ":", "class", ":", "waflib", ".", "Build", ".", "BuildContext", "and", ":", "py", ":", "class", ":", "waflib", ".", "Configure", ".", "ConfigurationContext", ".", "The", "met...
def conf(f): """ Decorator: attach new configuration functions to :py:class:`waflib.Build.BuildContext` and :py:class:`waflib.Configure.ConfigurationContext`. The methods bound will accept a parameter named 'mandatory' to disable the configuration errors:: def configure(conf): conf.find_program('abc', mandato...
[ "def", "conf", "(", "f", ")", ":", "def", "fun", "(", "*", "k", ",", "*", "*", "kw", ")", ":", "mandatory", "=", "True", "if", "'mandatory'", "in", "kw", ":", "mandatory", "=", "kw", "[", "'mandatory'", "]", "del", "kw", "[", "'mandatory'", "]", ...
https://github.com/CRYTEK/CRYENGINE/blob/232227c59a220cbbd311576f0fbeba7bb53b2a8c/Code/Tools/waf-1.7.13/waflib/Configure.py#L390-L417
catboost/catboost
167f64f237114a4d10b2b4ee42adb4569137debe
contrib/python/numpy/py3/numpy/core/defchararray.py
python
translate
(a, table, deletechars=None)
For each element in `a`, return a copy of the string where all characters occurring in the optional argument `deletechars` are removed, and the remaining characters have been mapped through the given translation table. Calls `str.translate` element-wise. Parameters ---------- a : array-lik...
For each element in `a`, return a copy of the string where all characters occurring in the optional argument `deletechars` are removed, and the remaining characters have been mapped through the given translation table.
[ "For", "each", "element", "in", "a", "return", "a", "copy", "of", "the", "string", "where", "all", "characters", "occurring", "in", "the", "optional", "argument", "deletechars", "are", "removed", "and", "the", "remaining", "characters", "have", "been", "mapped...
def translate(a, table, deletechars=None): """ For each element in `a`, return a copy of the string where all characters occurring in the optional argument `deletechars` are removed, and the remaining characters have been mapped through the given translation table. Calls `str.translate` element...
[ "def", "translate", "(", "a", ",", "table", ",", "deletechars", "=", "None", ")", ":", "a_arr", "=", "numpy", ".", "asarray", "(", "a", ")", "if", "issubclass", "(", "a_arr", ".", "dtype", ".", "type", ",", "unicode_", ")", ":", "return", "_vec_strin...
https://github.com/catboost/catboost/blob/167f64f237114a4d10b2b4ee42adb4569137debe/contrib/python/numpy/py3/numpy/core/defchararray.py#L1635-L1668
wxWidgets/wxPython-Classic
19571e1ae65f1ac445f5491474121998c97a1bf0
src/msw/_core.py
python
SettableHeaderColumn.UnsetAsSortKey
(*args, **kwargs)
return _core_.SettableHeaderColumn_UnsetAsSortKey(*args, **kwargs)
UnsetAsSortKey(self)
UnsetAsSortKey(self)
[ "UnsetAsSortKey", "(", "self", ")" ]
def UnsetAsSortKey(*args, **kwargs): """UnsetAsSortKey(self)""" return _core_.SettableHeaderColumn_UnsetAsSortKey(*args, **kwargs)
[ "def", "UnsetAsSortKey", "(", "*", "args", ",", "*", "*", "kwargs", ")", ":", "return", "_core_", ".", "SettableHeaderColumn_UnsetAsSortKey", "(", "*", "args", ",", "*", "*", "kwargs", ")" ]
https://github.com/wxWidgets/wxPython-Classic/blob/19571e1ae65f1ac445f5491474121998c97a1bf0/src/msw/_core.py#L16516-L16518
wxWidgets/wxPython-Classic
19571e1ae65f1ac445f5491474121998c97a1bf0
src/gtk/_core.py
python
MenuItem.GetMenu
(*args, **kwargs)
return _core_.MenuItem_GetMenu(*args, **kwargs)
GetMenu(self) -> Menu
GetMenu(self) -> Menu
[ "GetMenu", "(", "self", ")", "-", ">", "Menu" ]
def GetMenu(*args, **kwargs): """GetMenu(self) -> Menu""" return _core_.MenuItem_GetMenu(*args, **kwargs)
[ "def", "GetMenu", "(", "*", "args", ",", "*", "*", "kwargs", ")", ":", "return", "_core_", ".", "MenuItem_GetMenu", "(", "*", "args", ",", "*", "*", "kwargs", ")" ]
https://github.com/wxWidgets/wxPython-Classic/blob/19571e1ae65f1ac445f5491474121998c97a1bf0/src/gtk/_core.py#L12439-L12441
catboost/catboost
167f64f237114a4d10b2b4ee42adb4569137debe
contrib/python/numpy/py3/numpy/polynomial/legendre.py
python
leggrid3d
(x, y, z, c)
return pu._gridnd(legval, c, x, y, z)
Evaluate a 3-D Legendre series on the Cartesian product of x, y, and z. This function returns the values: .. math:: p(a,b,c) = \\sum_{i,j,k} c_{i,j,k} * L_i(a) * L_j(b) * L_k(c) where the points `(a, b, c)` consist of all triples formed by taking `a` from `x`, `b` from `y`, and `c` from `z`. The resu...
Evaluate a 3-D Legendre series on the Cartesian product of x, y, and z.
[ "Evaluate", "a", "3", "-", "D", "Legendre", "series", "on", "the", "Cartesian", "product", "of", "x", "y", "and", "z", "." ]
def leggrid3d(x, y, z, c): """ Evaluate a 3-D Legendre series on the Cartesian product of x, y, and z. This function returns the values: .. math:: p(a,b,c) = \\sum_{i,j,k} c_{i,j,k} * L_i(a) * L_j(b) * L_k(c) where the points `(a, b, c)` consist of all triples formed by taking `a` from `x`, `...
[ "def", "leggrid3d", "(", "x", ",", "y", ",", "z", ",", "c", ")", ":", "return", "pu", ".", "_gridnd", "(", "legval", ",", "c", ",", "x", ",", "y", ",", "z", ")" ]
https://github.com/catboost/catboost/blob/167f64f237114a4d10b2b4ee42adb4569137debe/contrib/python/numpy/py3/numpy/polynomial/legendre.py#L1070-L1123
daijifeng001/caffe-rfcn
543f8f6a4b7c88256ea1445ae951a12d1ad9cffd
python/caffe/net_spec.py
python
assign_proto
(proto, name, val)
Assign a Python object to a protobuf message, based on the Python type (in recursive fashion). Lists become repeated fields/messages, dicts become messages, and other types are assigned directly. For convenience, repeated fields whose values are not lists are converted to single-element lists; e.g., `my...
Assign a Python object to a protobuf message, based on the Python type (in recursive fashion). Lists become repeated fields/messages, dicts become messages, and other types are assigned directly. For convenience, repeated fields whose values are not lists are converted to single-element lists; e.g., `my...
[ "Assign", "a", "Python", "object", "to", "a", "protobuf", "message", "based", "on", "the", "Python", "type", "(", "in", "recursive", "fashion", ")", ".", "Lists", "become", "repeated", "fields", "/", "messages", "dicts", "become", "messages", "and", "other",...
def assign_proto(proto, name, val): """Assign a Python object to a protobuf message, based on the Python type (in recursive fashion). Lists become repeated fields/messages, dicts become messages, and other types are assigned directly. For convenience, repeated fields whose values are not lists are conve...
[ "def", "assign_proto", "(", "proto", ",", "name", ",", "val", ")", ":", "is_repeated_field", "=", "hasattr", "(", "getattr", "(", "proto", ",", "name", ")", ",", "'extend'", ")", "if", "is_repeated_field", "and", "not", "isinstance", "(", "val", ",", "li...
https://github.com/daijifeng001/caffe-rfcn/blob/543f8f6a4b7c88256ea1445ae951a12d1ad9cffd/python/caffe/net_spec.py#L56-L79
jubatus/jubatus
1251ce551bac980488a6313728e72b3fe0b79a9f
tools/codestyle/cpplint/cpplint.py
python
ProcessLine
(filename, file_extension, clean_lines, line, include_state, function_state, class_state, error, extra_check_functions=[])
Processes a single line in the file. Args: filename: Filename of the file that is being processed. file_extension: The extension (dot not included) of the file. clean_lines: An array of strings, each representing a line of the file, with comments stripped. line: Number of line being ...
Processes a single line in the file.
[ "Processes", "a", "single", "line", "in", "the", "file", "." ]
def ProcessLine(filename, file_extension, clean_lines, line, include_state, function_state, class_state, error, extra_check_functions=[]): """Processes a single line in the file. Args: filename: Filename of the file that is being processed. file_extension: The extension (dot...
[ "def", "ProcessLine", "(", "filename", ",", "file_extension", ",", "clean_lines", ",", "line", ",", "include_state", ",", "function_state", ",", "class_state", ",", "error", ",", "extra_check_functions", "=", "[", "]", ")", ":", "raw_lines", "=", "clean_lines", ...
https://github.com/jubatus/jubatus/blob/1251ce551bac980488a6313728e72b3fe0b79a9f/tools/codestyle/cpplint/cpplint.py#L3151-L3185
lukasmonk/lucaschess
13e2e5cb13b38a720ccf897af649054a64bcb914
Code/QT/Grid.py
python
Grid.mouseCabecera
(self, numColumna)
Se gestiona este evento, ante la posibilidad de que la ventana quiera controlar, los doble clicks sobre la cabecera , normalmente para cambiar el orden de la columna, llamando a la rutina correspondiente si existe (gridDobleClickCabecera) y con el argumento del objeto columna
Se gestiona este evento, ante la posibilidad de que la ventana quiera controlar, los doble clicks sobre la cabecera , normalmente para cambiar el orden de la columna, llamando a la rutina correspondiente si existe (gridDobleClickCabecera) y con el argumento del objeto columna
[ "Se", "gestiona", "este", "evento", "ante", "la", "posibilidad", "de", "que", "la", "ventana", "quiera", "controlar", "los", "doble", "clicks", "sobre", "la", "cabecera", "normalmente", "para", "cambiar", "el", "orden", "de", "la", "columna", "llamando", "a", ...
def mouseCabecera(self, numColumna): """ Se gestiona este evento, ante la posibilidad de que la ventana quiera controlar, los doble clicks sobre la cabecera , normalmente para cambiar el orden de la columna, llamando a la rutina correspondiente si existe (gridDobleClickCabecera) y con el...
[ "def", "mouseCabecera", "(", "self", ",", "numColumna", ")", ":", "if", "hasattr", "(", "self", ".", "wParent", ",", "\"gridMouseCabecera\"", ")", ":", "self", ".", "wParent", ".", "gridMouseCabecera", "(", "self", ",", "self", ".", "oColumnasR", ".", "col...
https://github.com/lukasmonk/lucaschess/blob/13e2e5cb13b38a720ccf897af649054a64bcb914/Code/QT/Grid.py#L381-L389
thalium/icebox
99d147d5b9269222225443ce171b4fd46d8985d4
third_party/retdec-3.2/scripts/type_extractor/type_extractor/io.py
python
load_json_file
(json_file)
Loads the data from the given json file, returns them as dict.
Loads the data from the given json file, returns them as dict.
[ "Loads", "the", "data", "from", "the", "given", "json", "file", "returns", "them", "as", "dict", "." ]
def load_json_file(json_file): """Loads the data from the given json file, returns them as dict.""" with open(json_file, 'r') as j_file: return json.load(j_file)
[ "def", "load_json_file", "(", "json_file", ")", ":", "with", "open", "(", "json_file", ",", "'r'", ")", "as", "j_file", ":", "return", "json", ".", "load", "(", "j_file", ")" ]
https://github.com/thalium/icebox/blob/99d147d5b9269222225443ce171b4fd46d8985d4/third_party/retdec-3.2/scripts/type_extractor/type_extractor/io.py#L22-L25
cms-sw/cmssw
fd9de012d503d3405420bcbeec0ec879baa57cf2
Validation/RecoTrack/python/plotting/ntupleDataFormat.py
python
_TrackingParticleMatchAdaptor.bestMatchingTrackingParticleFromFirstHitShareFrac
(self)
return self.bestFromFirstHitSimTrkShareFrac()
Fraction of shared hits with reco hits as denominator for best-matching TrackingParticle starting from the first hit of a track.
Fraction of shared hits with reco hits as denominator for best-matching TrackingParticle starting from the first hit of a track.
[ "Fraction", "of", "shared", "hits", "with", "reco", "hits", "as", "denominator", "for", "best", "-", "matching", "TrackingParticle", "starting", "from", "the", "first", "hit", "of", "a", "track", "." ]
def bestMatchingTrackingParticleFromFirstHitShareFrac(self): """Fraction of shared hits with reco hits as denominator for best-matching TrackingParticle starting from the first hit of a track.""" return self.bestFromFirstHitSimTrkShareFrac()
[ "def", "bestMatchingTrackingParticleFromFirstHitShareFrac", "(", "self", ")", ":", "return", "self", ".", "bestFromFirstHitSimTrkShareFrac", "(", ")" ]
https://github.com/cms-sw/cmssw/blob/fd9de012d503d3405420bcbeec0ec879baa57cf2/Validation/RecoTrack/python/plotting/ntupleDataFormat.py#L364-L366