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
psi4/psi4
be533f7f426b6ccc263904e55122899b16663395
psi4/driver/qcdb/vecutil.py
python
mult
(matrix1, matrix2)
Matrix multiplication
Matrix multiplication
[ "Matrix", "multiplication" ]
def mult(matrix1, matrix2): """ Matrix multiplication""" if len(matrix1[0]) != len(matrix2): # Check matrix dimensions raise ValidationError('Matrices must be m*n and n*p to multiply!') else: # Multiply if correct dimensions try: new_matrix = zero(len(matrix1), l...
[ "def", "mult", "(", "matrix1", ",", "matrix2", ")", ":", "if", "len", "(", "matrix1", "[", "0", "]", ")", "!=", "len", "(", "matrix2", ")", ":", "# Check matrix dimensions", "raise", "ValidationError", "(", "'Matrices must be m*n and n*p to multiply!'", ")", "...
https://github.com/psi4/psi4/blob/be533f7f426b6ccc263904e55122899b16663395/psi4/driver/qcdb/vecutil.py#L307-L326
eric612/MobileNet-YOLO
69b4441cb3ec8d553fbdef788ad033e246f901bd
scripts/cpp_lint.py
python
CleansedLines.NumLines
(self)
return self.num_lines
Returns the number of lines represented.
Returns the number of lines represented.
[ "Returns", "the", "number", "of", "lines", "represented", "." ]
def NumLines(self): """Returns the number of lines represented.""" return self.num_lines
[ "def", "NumLines", "(", "self", ")", ":", "return", "self", ".", "num_lines" ]
https://github.com/eric612/MobileNet-YOLO/blob/69b4441cb3ec8d553fbdef788ad033e246f901bd/scripts/cpp_lint.py#L1208-L1210
catboost/catboost
167f64f237114a4d10b2b4ee42adb4569137debe
contrib/python/Pygments/py3/pygments/lexers/matlab.py
python
OctaveLexer.analyse_text
(text)
return 0
Octave is quite hard to spot, and it looks like Matlab as well.
Octave is quite hard to spot, and it looks like Matlab as well.
[ "Octave", "is", "quite", "hard", "to", "spot", "and", "it", "looks", "like", "Matlab", "as", "well", "." ]
def analyse_text(text): """Octave is quite hard to spot, and it looks like Matlab as well.""" return 0
[ "def", "analyse_text", "(", "text", ")", ":", "return", "0" ]
https://github.com/catboost/catboost/blob/167f64f237114a4d10b2b4ee42adb4569137debe/contrib/python/Pygments/py3/pygments/lexers/matlab.py#L3223-L3225
NVIDIA/TensorRT
42805f078052daad1a98bc5965974fcffaad0960
tools/onnx-graphsurgeon/onnx_graphsurgeon/logger/logger.py
python
Logger.indent
(self, level=1)
return LoggerIndent(self, level + self.logging_indent)
Returns a context manager that indents all strings logged by the specified amount.
Returns a context manager that indents all strings logged by the specified amount.
[ "Returns", "a", "context", "manager", "that", "indents", "all", "strings", "logged", "by", "the", "specified", "amount", "." ]
def indent(self, level=1): """ Returns a context manager that indents all strings logged by the specified amount. """ return LoggerIndent(self, level + self.logging_indent)
[ "def", "indent", "(", "self", ",", "level", "=", "1", ")", ":", "return", "LoggerIndent", "(", "self", ",", "level", "+", "self", ".", "logging_indent", ")" ]
https://github.com/NVIDIA/TensorRT/blob/42805f078052daad1a98bc5965974fcffaad0960/tools/onnx-graphsurgeon/onnx_graphsurgeon/logger/logger.py#L131-L135
facebookresearch/faiss
eb8781557f556505ca93f6f21fff932e17f0d9e0
faiss/python/__init__.py
python
index_cpu_to_gpus_list
(index, co=None, gpus=None, ngpu=-1)
return index_gpu
Here we can pass list of GPU ids as a parameter or ngpu to use first n GPU's. gpus mut be a list or None
Here we can pass list of GPU ids as a parameter or ngpu to use first n GPU's. gpus mut be a list or None
[ "Here", "we", "can", "pass", "list", "of", "GPU", "ids", "as", "a", "parameter", "or", "ngpu", "to", "use", "first", "n", "GPU", "s", ".", "gpus", "mut", "be", "a", "list", "or", "None" ]
def index_cpu_to_gpus_list(index, co=None, gpus=None, ngpu=-1): """ Here we can pass list of GPU ids as a parameter or ngpu to use first n GPU's. gpus mut be a list or None""" if (gpus is None) and (ngpu == -1): # All blank gpus = range(get_num_gpus()) elif (gpus is None) and (ngpu != -1): # G...
[ "def", "index_cpu_to_gpus_list", "(", "index", ",", "co", "=", "None", ",", "gpus", "=", "None", ",", "ngpu", "=", "-", "1", ")", ":", "if", "(", "gpus", "is", "None", ")", "and", "(", "ngpu", "==", "-", "1", ")", ":", "# All blank", "gpus", "=",...
https://github.com/facebookresearch/faiss/blob/eb8781557f556505ca93f6f21fff932e17f0d9e0/faiss/python/__init__.py#L891-L900
google/earthenterprise
0fe84e29be470cd857e3a0e52e5d0afd5bb8cee9
earth_enterprise/src/fusion/portableglobe/cutter/cgi-bin/common/form_wrap.py
python
FormWrap.getvalue_path
(self, key, default_val=None)
return val
Gets path value (filesystem path). Args: key: requested argument. default_val: a default value to return if requested argument is not present. Returns: value for requested argument.
Gets path value (filesystem path).
[ "Gets", "path", "value", "(", "filesystem", "path", ")", "." ]
def getvalue_path(self, key, default_val=None): """Gets path value (filesystem path). Args: key: requested argument. default_val: a default value to return if requested argument is not present. Returns: value for requested argument. """ logging.debug("getvalue_p...
[ "def", "getvalue_path", "(", "self", ",", "key", ",", "default_val", "=", "None", ")", ":", "logging", ".", "debug", "(", "\"getvalue_path() - key: %s\"", ",", "key", ")", "val", "=", "self", ".", "_getvalue_raw", "(", "key", ",", "default_val", ")", "if",...
https://github.com/google/earthenterprise/blob/0fe84e29be470cd857e3a0e52e5d0afd5bb8cee9/earth_enterprise/src/fusion/portableglobe/cutter/cgi-bin/common/form_wrap.py#L241-L261
mantidproject/mantid
03deeb89254ec4289edb8771e0188c2090a02f32
Framework/PythonInterface/plugins/algorithms/WorkflowAlgorithms/DirectILLReduction.py
python
DirectILLReduction._correctByDetectorEfficiency
(self, mainWS)
return correctedWS
Apply detector efficiency corrections.
Apply detector efficiency corrections.
[ "Apply", "detector", "efficiency", "corrections", "." ]
def _correctByDetectorEfficiency(self, mainWS): """Apply detector efficiency corrections.""" correctedWSName = self._names.withSuffix('detector_efficiency_corrected') correctedWS = \ DetectorEfficiencyCorUser(InputWorkspace=mainWS, OutputWorkspac...
[ "def", "_correctByDetectorEfficiency", "(", "self", ",", "mainWS", ")", ":", "correctedWSName", "=", "self", ".", "_names", ".", "withSuffix", "(", "'detector_efficiency_corrected'", ")", "correctedWS", "=", "DetectorEfficiencyCorUser", "(", "InputWorkspace", "=", "ma...
https://github.com/mantidproject/mantid/blob/03deeb89254ec4289edb8771e0188c2090a02f32/Framework/PythonInterface/plugins/algorithms/WorkflowAlgorithms/DirectILLReduction.py#L426-L434
wxWidgets/wxPython-Classic
19571e1ae65f1ac445f5491474121998c97a1bf0
wx/tools/Editra/src/eclib/panelbox.py
python
PanelBoxItem.SetLabel
(self, lbl)
Set the label text @param lbl: string
Set the label text @param lbl: string
[ "Set", "the", "label", "text", "@param", "lbl", ":", "string" ]
def SetLabel(self, lbl): """Set the label text @param lbl: string """ self._lbl.SetLabel(lbl) self._lbl.Refresh() self.Layout()
[ "def", "SetLabel", "(", "self", ",", "lbl", ")", ":", "self", ".", "_lbl", ".", "SetLabel", "(", "lbl", ")", "self", ".", "_lbl", ".", "Refresh", "(", ")", "self", ".", "Layout", "(", ")" ]
https://github.com/wxWidgets/wxPython-Classic/blob/19571e1ae65f1ac445f5491474121998c97a1bf0/wx/tools/Editra/src/eclib/panelbox.py#L431-L438
apache/thrift
0b29261a4f3c6882ef3b09aae47914f0012b0472
lib/py/src/server/TNonblockingServer.py
python
TNonblockingServer.stop
(self)
Stop the server. This method causes the serve() method to return. stop() may be invoked from within your handler, or from another thread. After stop() is called, serve() will return but the server will still be listening on the socket. serve() may then be called again to resume ...
Stop the server.
[ "Stop", "the", "server", "." ]
def stop(self): """Stop the server. This method causes the serve() method to return. stop() may be invoked from within your handler, or from another thread. After stop() is called, serve() will return but the server will still be listening on the socket. serve() may then be c...
[ "def", "stop", "(", "self", ")", ":", "self", ".", "_stop", "=", "True", "self", ".", "wake_up", "(", ")" ]
https://github.com/apache/thrift/blob/0b29261a4f3c6882ef3b09aae47914f0012b0472/lib/py/src/server/TNonblockingServer.py#L283-L296
Xilinx/Vitis-AI
fc74d404563d9951b57245443c73bef389f3657f
tools/Vitis-AI-Quantizer/vai_q_tensorflow1.x/tensorflow/python/keras/utils/generic_utils.py
python
object_list_uid
(object_list)
return ', '.join([str(abs(id(x))) for x in object_list])
Creates a single string from object ids.
Creates a single string from object ids.
[ "Creates", "a", "single", "string", "from", "object", "ids", "." ]
def object_list_uid(object_list): """Creates a single string from object ids.""" object_list = nest.flatten(object_list) return ', '.join([str(abs(id(x))) for x in object_list])
[ "def", "object_list_uid", "(", "object_list", ")", ":", "object_list", "=", "nest", ".", "flatten", "(", "object_list", ")", "return", "', '", ".", "join", "(", "[", "str", "(", "abs", "(", "id", "(", "x", ")", ")", ")", "for", "x", "in", "object_lis...
https://github.com/Xilinx/Vitis-AI/blob/fc74d404563d9951b57245443c73bef389f3657f/tools/Vitis-AI-Quantizer/vai_q_tensorflow1.x/tensorflow/python/keras/utils/generic_utils.py#L561-L564
mantidproject/mantid
03deeb89254ec4289edb8771e0188c2090a02f32
qt/python/mantidqtinterfaces/mantidqtinterfaces/drill/view/DrillHeaderView.py
python
DrillHeaderView.mousePressEvent
(self, event)
Deal with mouse press event. Override of QTableView::mousePressEvent. This function change the state of a eventual push button below the mouse pointer. Args: event (QMouseEvent): mouse press envent
Deal with mouse press event. Override of QTableView::mousePressEvent. This function change the state of a eventual push button below the mouse pointer.
[ "Deal", "with", "mouse", "press", "event", ".", "Override", "of", "QTableView", "::", "mousePressEvent", ".", "This", "function", "change", "the", "state", "of", "a", "eventual", "push", "button", "below", "the", "mouse", "pointer", "." ]
def mousePressEvent(self, event): """ Deal with mouse press event. Override of QTableView::mousePressEvent. This function change the state of a eventual push button below the mouse pointer. Args: event (QMouseEvent): mouse press envent """ li = self.l...
[ "def", "mousePressEvent", "(", "self", ",", "event", ")", ":", "li", "=", "self", ".", "logicalIndexAt", "(", "event", ".", "pos", "(", ")", ")", "if", "self", ".", "mouseOnButton", "(", "event", ".", "pos", "(", ")", ",", "li", ")", ":", "self", ...
https://github.com/mantidproject/mantid/blob/03deeb89254ec4289edb8771e0188c2090a02f32/qt/python/mantidqtinterfaces/mantidqtinterfaces/drill/view/DrillHeaderView.py#L175-L189
deepmind/open_spiel
4ca53bea32bb2875c7385d215424048ae92f78c8
open_spiel/python/algorithms/psro_v2/optimization_oracle.py
python
AbstractOracle.__call__
(self, game, policy, total_policies, current_player, probabilities_of_playing_policies, **oracle_specific_execution_kwargs)
Call method for oracle, returns best response against a set of policies. Args: game: The game on which the optimization process takes place. policy: The current policy, in policy.Policy, from which we wish to start optimizing. total_policies: A list of all policy.Policy strategies used fo...
Call method for oracle, returns best response against a set of policies.
[ "Call", "method", "for", "oracle", "returns", "best", "response", "against", "a", "set", "of", "policies", "." ]
def __call__(self, game, policy, total_policies, current_player, probabilities_of_playing_policies, **oracle_specific_execution_kwargs): """Call method for oracle, returns best response against a set of policies. Args: game: The game on which the optimization process takes p...
[ "def", "__call__", "(", "self", ",", "game", ",", "policy", ",", "total_policies", ",", "current_player", ",", "probabilities_of_playing_policies", ",", "*", "*", "oracle_specific_execution_kwargs", ")", ":", "raise", "NotImplementedError", "(", "\"Calling Abstract clas...
https://github.com/deepmind/open_spiel/blob/4ca53bea32bb2875c7385d215424048ae92f78c8/open_spiel/python/algorithms/psro_v2/optimization_oracle.py#L76-L95
baidu-research/tensorflow-allreduce
66d5b855e90b0949e9fa5cca5599fd729a70e874
tensorflow/contrib/bayesflow/python/ops/variational_inference_impl.py
python
register_prior
(variational, prior)
Associate a variational `StochasticTensor` with a `Distribution` prior. This is a helper function used in conjunction with `elbo` that allows users to specify the mapping between variational distributions and their priors without having to pass in `variational_with_prior` explicitly. Args: variational: `S...
Associate a variational `StochasticTensor` with a `Distribution` prior.
[ "Associate", "a", "variational", "StochasticTensor", "with", "a", "Distribution", "prior", "." ]
def register_prior(variational, prior): """Associate a variational `StochasticTensor` with a `Distribution` prior. This is a helper function used in conjunction with `elbo` that allows users to specify the mapping between variational distributions and their priors without having to pass in `variational_with_pr...
[ "def", "register_prior", "(", "variational", ",", "prior", ")", ":", "if", "not", "isinstance", "(", "variational", ",", "st", ".", "StochasticTensor", ")", ":", "raise", "TypeError", "(", "\"variational must be a StochasticTensor\"", ")", "if", "not", "isinstance...
https://github.com/baidu-research/tensorflow-allreduce/blob/66d5b855e90b0949e9fa5cca5599fd729a70e874/tensorflow/contrib/bayesflow/python/ops/variational_inference_impl.py#L40-L62
catboost/catboost
167f64f237114a4d10b2b4ee42adb4569137debe
contrib/python/setuptools/py3/setuptools/_vendor/ordered_set.py
python
OrderedSet.symmetric_difference_update
(self, other)
Update this OrderedSet to remove items from another set, then add items from the other set that were not present in this set. Example: >>> this = OrderedSet([1, 4, 3, 5, 7]) >>> other = OrderedSet([9, 7, 1, 3, 2]) >>> this.symmetric_difference_update(other) ...
Update this OrderedSet to remove items from another set, then add items from the other set that were not present in this set.
[ "Update", "this", "OrderedSet", "to", "remove", "items", "from", "another", "set", "then", "add", "items", "from", "the", "other", "set", "that", "were", "not", "present", "in", "this", "set", "." ]
def symmetric_difference_update(self, other): """ Update this OrderedSet to remove items from another set, then add items from the other set that were not present in this set. Example: >>> this = OrderedSet([1, 4, 3, 5, 7]) >>> other = OrderedSet([9, 7, 1, 3, 2])...
[ "def", "symmetric_difference_update", "(", "self", ",", "other", ")", ":", "items_to_add", "=", "[", "item", "for", "item", "in", "other", "if", "item", "not", "in", "self", "]", "items_to_remove", "=", "set", "(", "other", ")", "self", ".", "_update_items...
https://github.com/catboost/catboost/blob/167f64f237114a4d10b2b4ee42adb4569137debe/contrib/python/setuptools/py3/setuptools/_vendor/ordered_set.py#L472-L488
aws/lumberyard
f85344403c1c2e77ec8c75deb2c116e97b713217
dev/Tools/Python/3.7.10/linux_x64/lib/python3.7/pdb.py
python
Pdb.do_args
(self, arg)
a(rgs) Print the argument list of the current function.
a(rgs) Print the argument list of the current function.
[ "a", "(", "rgs", ")", "Print", "the", "argument", "list", "of", "the", "current", "function", "." ]
def do_args(self, arg): """a(rgs) Print the argument list of the current function. """ co = self.curframe.f_code dict = self.curframe_locals n = co.co_argcount + co.co_kwonlyargcount if co.co_flags & inspect.CO_VARARGS: n = n+1 if co.co_flags & inspect.CO_...
[ "def", "do_args", "(", "self", ",", "arg", ")", ":", "co", "=", "self", ".", "curframe", ".", "f_code", "dict", "=", "self", ".", "curframe_locals", "n", "=", "co", ".", "co_argcount", "+", "co", ".", "co_kwonlyargcount", "if", "co", ".", "co_flags", ...
https://github.com/aws/lumberyard/blob/f85344403c1c2e77ec8c75deb2c116e97b713217/dev/Tools/Python/3.7.10/linux_x64/lib/python3.7/pdb.py#L1128-L1142
catboost/catboost
167f64f237114a4d10b2b4ee42adb4569137debe
contrib/python/scipy/py2/scipy/linalg/_interpolative_backend.py
python
id_srandi
(t)
Initialize seed values for :func:`id_srand` (any appropriately random numbers will do). :param t: Array of 55 seed values. :type t: :class:`numpy.ndarray`
Initialize seed values for :func:`id_srand` (any appropriately random numbers will do).
[ "Initialize", "seed", "values", "for", ":", "func", ":", "id_srand", "(", "any", "appropriately", "random", "numbers", "will", "do", ")", "." ]
def id_srandi(t): """ Initialize seed values for :func:`id_srand` (any appropriately random numbers will do). :param t: Array of 55 seed values. :type t: :class:`numpy.ndarray` """ t = np.asfortranarray(t) _id.id_srandi(t)
[ "def", "id_srandi", "(", "t", ")", ":", "t", "=", "np", ".", "asfortranarray", "(", "t", ")", "_id", ".", "id_srandi", "(", "t", ")" ]
https://github.com/catboost/catboost/blob/167f64f237114a4d10b2b4ee42adb4569137debe/contrib/python/scipy/py2/scipy/linalg/_interpolative_backend.py#L60-L70
wxWidgets/wxPython-Classic
19571e1ae65f1ac445f5491474121998c97a1bf0
wx/lib/agw/labelbook.py
python
ImageContainerBase.GetImageSize
(self)
return self._nImgSize
Returns the image size inside the :class:`ImageContainerBase` image list.
Returns the image size inside the :class:`ImageContainerBase` image list.
[ "Returns", "the", "image", "size", "inside", "the", ":", "class", ":", "ImageContainerBase", "image", "list", "." ]
def GetImageSize(self): """ Returns the image size inside the :class:`ImageContainerBase` image list. """ return self._nImgSize
[ "def", "GetImageSize", "(", "self", ")", ":", "return", "self", ".", "_nImgSize" ]
https://github.com/wxWidgets/wxPython-Classic/blob/19571e1ae65f1ac445f5491474121998c97a1bf0/wx/lib/agw/labelbook.py#L589-L592
Genius-x/genius-x
9fc9f194e6d1fb92dd0e33d43db19ddb67cda7b0
cocos2d/tools/bindings-generator/clang/cindex.py
python
Cursor.result_type
(self)
return self._result_type
Retrieve the Type of the result for this Cursor.
Retrieve the Type of the result for this Cursor.
[ "Retrieve", "the", "Type", "of", "the", "result", "for", "this", "Cursor", "." ]
def result_type(self): """Retrieve the Type of the result for this Cursor.""" if not hasattr(self, '_result_type'): self._result_type = conf.lib.clang_getResultType(self.type) return self._result_type
[ "def", "result_type", "(", "self", ")", ":", "if", "not", "hasattr", "(", "self", ",", "'_result_type'", ")", ":", "self", ".", "_result_type", "=", "conf", ".", "lib", ".", "clang_getResultType", "(", "self", ".", "type", ")", "return", "self", ".", "...
https://github.com/Genius-x/genius-x/blob/9fc9f194e6d1fb92dd0e33d43db19ddb67cda7b0/cocos2d/tools/bindings-generator/clang/cindex.py#L1323-L1328
baidu-research/tensorflow-allreduce
66d5b855e90b0949e9fa5cca5599fd729a70e874
tensorflow/python/ops/losses/losses_impl.py
python
_safe_mean
(losses, num_present)
return _safe_div(total_loss, num_present)
Computes a safe mean of the losses. Args: losses: `Tensor` whose elements contain individual loss measurements. num_present: The number of measurable elements in `losses`. Returns: A scalar representing the mean of `losses`. If `num_present` is zero, then zero is returned.
Computes a safe mean of the losses.
[ "Computes", "a", "safe", "mean", "of", "the", "losses", "." ]
def _safe_mean(losses, num_present): """Computes a safe mean of the losses. Args: losses: `Tensor` whose elements contain individual loss measurements. num_present: The number of measurable elements in `losses`. Returns: A scalar representing the mean of `losses`. If `num_present` is zero, the...
[ "def", "_safe_mean", "(", "losses", ",", "num_present", ")", ":", "total_loss", "=", "math_ops", ".", "reduce_sum", "(", "losses", ")", "return", "_safe_div", "(", "total_loss", ",", "num_present", ")" ]
https://github.com/baidu-research/tensorflow-allreduce/blob/66d5b855e90b0949e9fa5cca5599fd729a70e874/tensorflow/python/ops/losses/losses_impl.py#L87-L99
catboost/catboost
167f64f237114a4d10b2b4ee42adb4569137debe
contrib/python/Pygments/py3/pygments/lexers/textedit.py
python
VimLexer.is_in
(self, w, mapping)
return False
r""" It's kind of difficult to decide if something might be a keyword in VimL because it allows you to abbreviate them. In fact, 'ab[breviate]' is a good example. :ab, :abbre, or :abbreviate are valid ways to call it so rather than making really awful regexps like:: ...
r""" It's kind of difficult to decide if something might be a keyword in VimL because it allows you to abbreviate them. In fact, 'ab[breviate]' is a good example. :ab, :abbre, or :abbreviate are valid ways to call it so rather than making really awful regexps like::
[ "r", "It", "s", "kind", "of", "difficult", "to", "decide", "if", "something", "might", "be", "a", "keyword", "in", "VimL", "because", "it", "allows", "you", "to", "abbreviate", "them", ".", "In", "fact", "ab", "[", "breviate", "]", "is", "a", "good", ...
def is_in(self, w, mapping): r""" It's kind of difficult to decide if something might be a keyword in VimL because it allows you to abbreviate them. In fact, 'ab[breviate]' is a good example. :ab, :abbre, or :abbreviate are valid ways to call it so rather than making really awf...
[ "def", "is_in", "(", "self", ",", "w", ",", "mapping", ")", ":", "p", "=", "bisect", "(", "mapping", ",", "(", "w", ",", ")", ")", "if", "p", ">", "0", ":", "if", "mapping", "[", "p", "-", "1", "]", "[", "0", "]", "==", "w", "[", ":", "...
https://github.com/catboost/catboost/blob/167f64f237114a4d10b2b4ee42adb4569137debe/contrib/python/Pygments/py3/pygments/lexers/textedit.py#L164-L185
catboost/catboost
167f64f237114a4d10b2b4ee42adb4569137debe
contrib/tools/python3/src/Lib/lib2to3/btm_utils.py
python
MinNode.get_linear_subpattern
(self)
Drives the leaf_to_root method. The reason that leaf_to_root must be run multiple times is because we need to reject 'group' matches; for example the alternative form (a | b c) creates a group [b c] that needs to be matched. Since matching multiple linear patterns overcomes the automaton...
Drives the leaf_to_root method. The reason that leaf_to_root must be run multiple times is because we need to reject 'group' matches; for example the alternative form (a | b c) creates a group [b c] that needs to be matched. Since matching multiple linear patterns overcomes the automaton...
[ "Drives", "the", "leaf_to_root", "method", ".", "The", "reason", "that", "leaf_to_root", "must", "be", "run", "multiple", "times", "is", "because", "we", "need", "to", "reject", "group", "matches", ";", "for", "example", "the", "alternative", "form", "(", "a...
def get_linear_subpattern(self): """Drives the leaf_to_root method. The reason that leaf_to_root must be run multiple times is because we need to reject 'group' matches; for example the alternative form (a | b c) creates a group [b c] that needs to be matched. Since matching mult...
[ "def", "get_linear_subpattern", "(", "self", ")", ":", "for", "l", "in", "self", ".", "leaves", "(", ")", ":", "subp", "=", "l", ".", "leaf_to_root", "(", ")", "if", "subp", ":", "return", "subp" ]
https://github.com/catboost/catboost/blob/167f64f237114a4d10b2b4ee42adb4569137debe/contrib/tools/python3/src/Lib/lib2to3/btm_utils.py#L75-L94
wxWidgets/wxPython-Classic
19571e1ae65f1ac445f5491474121998c97a1bf0
src/osx_carbon/_controls.py
python
DragImage.Show
(*args, **kwargs)
return _controls_.DragImage_Show(*args, **kwargs)
Show(self) -> bool
Show(self) -> bool
[ "Show", "(", "self", ")", "-", ">", "bool" ]
def Show(*args, **kwargs): """Show(self) -> bool""" return _controls_.DragImage_Show(*args, **kwargs)
[ "def", "Show", "(", "*", "args", ",", "*", "*", "kwargs", ")", ":", "return", "_controls_", ".", "DragImage_Show", "(", "*", "args", ",", "*", "*", "kwargs", ")" ]
https://github.com/wxWidgets/wxPython-Classic/blob/19571e1ae65f1ac445f5491474121998c97a1bf0/src/osx_carbon/_controls.py#L6372-L6374
keyboardio/Kaleidoscope
d59604e98b2439d108647f15be52984a6837d360
bin/cpplint.py
python
_SetVerboseLevel
(level)
return _cpplint_state.SetVerboseLevel(level)
Sets the module's verbosity, and returns the previous setting.
Sets the module's verbosity, and returns the previous setting.
[ "Sets", "the", "module", "s", "verbosity", "and", "returns", "the", "previous", "setting", "." ]
def _SetVerboseLevel(level): """Sets the module's verbosity, and returns the previous setting.""" return _cpplint_state.SetVerboseLevel(level)
[ "def", "_SetVerboseLevel", "(", "level", ")", ":", "return", "_cpplint_state", ".", "SetVerboseLevel", "(", "level", ")" ]
https://github.com/keyboardio/Kaleidoscope/blob/d59604e98b2439d108647f15be52984a6837d360/bin/cpplint.py#L1185-L1187
mongodb/mongo
d8ff665343ad29cf286ee2cf4a1960d29371937b
buildscripts/idl/idl/generator.py
python
_CppHeaderFileWriter._gen_config_function_declaration
(self, spec)
Generate function declarations for config initializers.
Generate function declarations for config initializers.
[ "Generate", "function", "declarations", "for", "config", "initializers", "." ]
def _gen_config_function_declaration(self, spec): # type: (ast.IDLAST) -> None """Generate function declarations for config initializers.""" initializer = spec.globals.configs and spec.globals.configs.initializer if not initializer: return if initializer.register: ...
[ "def", "_gen_config_function_declaration", "(", "self", ",", "spec", ")", ":", "# type: (ast.IDLAST) -> None", "initializer", "=", "spec", ".", "globals", ".", "configs", "and", "spec", ".", "globals", ".", "configs", ".", "initializer", "if", "not", "initializer"...
https://github.com/mongodb/mongo/blob/d8ff665343ad29cf286ee2cf4a1960d29371937b/buildscripts/idl/idl/generator.py#L799-L815
facebook/ThreatExchange
31914a51820c73c8a0daffe62ccca29a6e3d359e
python-threatexchange/threatexchange/api.py
python
ThreatExchangeAPI.react_to_threat_descriptor
( self, descriptor_id, reaction, *, showURLs=False, dryRun=False )
return self._postThreatDescriptor( "/".join( ( self._base_url, str(descriptor_id), f"?access_token={self.api_token}", ) ), {"reactions": reaction}, showURLs=showURLs, d...
Does a POST to the reactions API. See: https://developers.facebook.com/docs/threat-exchange/reference/reacting
Does a POST to the reactions API.
[ "Does", "a", "POST", "to", "the", "reactions", "API", "." ]
def react_to_threat_descriptor( self, descriptor_id, reaction, *, showURLs=False, dryRun=False ): """ Does a POST to the reactions API. See: https://developers.facebook.com/docs/threat-exchange/reference/reacting """ return self._postThreatDescriptor( "/"...
[ "def", "react_to_threat_descriptor", "(", "self", ",", "descriptor_id", ",", "reaction", ",", "*", ",", "showURLs", "=", "False", ",", "dryRun", "=", "False", ")", ":", "return", "self", ".", "_postThreatDescriptor", "(", "\"/\"", ".", "join", "(", "(", "s...
https://github.com/facebook/ThreatExchange/blob/31914a51820c73c8a0daffe62ccca29a6e3d359e/python-threatexchange/threatexchange/api.py#L428-L447
apache/arrow
af33dd1157eb8d7d9bfac25ebf61445b793b7943
dev/archery/archery/cli.py
python
release_curate
(obj, version)
Release curation.
Release curation.
[ "Release", "curation", "." ]
def release_curate(obj, version): """Release curation.""" from .release import Release release = Release.from_jira(version, jira=obj['jira'], repo=obj['repo']) curation = release.curate() click.echo(curation.render('console'))
[ "def", "release_curate", "(", "obj", ",", "version", ")", ":", "from", ".", "release", "import", "Release", "release", "=", "Release", ".", "from_jira", "(", "version", ",", "jira", "=", "obj", "[", "'jira'", "]", ",", "repo", "=", "obj", "[", "'repo'"...
https://github.com/apache/arrow/blob/af33dd1157eb8d7d9bfac25ebf61445b793b7943/dev/archery/archery/cli.py#L802-L809
miyosuda/TensorFlowAndroidDemo
35903e0221aa5f109ea2dbef27f20b52e317f42d
jni-build/jni/include/tensorflow/python/framework/tensor_shape.py
python
TensorShape.concatenate
(self, other)
Returns the concatenation of the dimension in `self` and `other`. *N.B.* If either `self` or `other` is completely unknown, concatenation will discard information about the other shape. In future, we might support concatenation that preserves this information for use with slicing. Args: othe...
Returns the concatenation of the dimension in `self` and `other`.
[ "Returns", "the", "concatenation", "of", "the", "dimension", "in", "self", "and", "other", "." ]
def concatenate(self, other): """Returns the concatenation of the dimension in `self` and `other`. *N.B.* If either `self` or `other` is completely unknown, concatenation will discard information about the other shape. In future, we might support concatenation that preserves this information for us...
[ "def", "concatenate", "(", "self", ",", "other", ")", ":", "# TODO(mrry): Handle the case where we concatenate a known shape with a", "# completely unknown shape, so that we can use the partial information.", "other", "=", "as_shape", "(", "other", ")", "if", "self", ".", "_dim...
https://github.com/miyosuda/TensorFlowAndroidDemo/blob/35903e0221aa5f109ea2dbef27f20b52e317f42d/jni-build/jni/include/tensorflow/python/framework/tensor_shape.py#L572-L593
wxWidgets/wxPython-Classic
19571e1ae65f1ac445f5491474121998c97a1bf0
src/msw/_core.py
python
PyApp.__init__
(self, *args, **kwargs)
__init__(self) -> PyApp Create a new application object, starting the bootstrap process.
__init__(self) -> PyApp
[ "__init__", "(", "self", ")", "-", ">", "PyApp" ]
def __init__(self, *args, **kwargs): """ __init__(self) -> PyApp Create a new application object, starting the bootstrap process. """ _core_.PyApp_swiginit(self,_core_.new_PyApp(*args, **kwargs)) self._setOORInfo(self, False);PyApp._setCallbackInfo(self, self, PyApp);se...
[ "def", "__init__", "(", "self", ",", "*", "args", ",", "*", "*", "kwargs", ")", ":", "_core_", ".", "PyApp_swiginit", "(", "self", ",", "_core_", ".", "new_PyApp", "(", "*", "args", ",", "*", "*", "kwargs", ")", ")", "self", ".", "_setOORInfo", "("...
https://github.com/wxWidgets/wxPython-Classic/blob/19571e1ae65f1ac445f5491474121998c97a1bf0/src/msw/_core.py#L7700-L7707
tensorflow/tensorflow
419e3a6b650ea4bd1b0cba23c4348f8a69f3272e
tensorflow/python/training/checkpoint_utils.py
python
list_variables
(ckpt_dir_or_file)
return result
Lists the checkpoint keys and shapes of variables in a checkpoint. Checkpoint keys are paths in a checkpoint graph. Example usage: ```python import tensorflow as tf import os ckpt_directory = "/tmp/training_checkpoints/ckpt" ckpt = tf.train.Checkpoint(optimizer=optimizer, model=model) manager = tf....
Lists the checkpoint keys and shapes of variables in a checkpoint.
[ "Lists", "the", "checkpoint", "keys", "and", "shapes", "of", "variables", "in", "a", "checkpoint", "." ]
def list_variables(ckpt_dir_or_file): """Lists the checkpoint keys and shapes of variables in a checkpoint. Checkpoint keys are paths in a checkpoint graph. Example usage: ```python import tensorflow as tf import os ckpt_directory = "/tmp/training_checkpoints/ckpt" ckpt = tf.train.Checkpoint(optimi...
[ "def", "list_variables", "(", "ckpt_dir_or_file", ")", ":", "reader", "=", "load_checkpoint", "(", "ckpt_dir_or_file", ")", "variable_map", "=", "reader", ".", "get_variable_to_shape_map", "(", ")", "names", "=", "sorted", "(", "variable_map", ".", "keys", "(", ...
https://github.com/tensorflow/tensorflow/blob/419e3a6b650ea4bd1b0cba23c4348f8a69f3272e/tensorflow/python/training/checkpoint_utils.py#L86-L115
hanpfei/chromium-net
392cc1fa3a8f92f42e4071ab6e674d8e0482f83f
third_party/catapult/third_party/mapreduce/mapreduce/operation/db.py
python
Delete.__call__
(self, context)
Perform operation. Args: context: mapreduce context as context.Context.
Perform operation.
[ "Perform", "operation", "." ]
def __call__(self, context): """Perform operation. Args: context: mapreduce context as context.Context. """ context._mutation_pool.delete(self.entity)
[ "def", "__call__", "(", "self", ",", "context", ")", ":", "context", ".", "_mutation_pool", ".", "delete", "(", "self", ".", "entity", ")" ]
https://github.com/hanpfei/chromium-net/blob/392cc1fa3a8f92f42e4071ab6e674d8e0482f83f/third_party/catapult/third_party/mapreduce/mapreduce/operation/db.py#L66-L72
hpi-xnor/BMXNet
ed0b201da6667887222b8e4b5f997c4f6b61943d
python/mxnet/rnn/rnn_cell.py
python
BaseRNNCell.unroll
(self, length, inputs, begin_state=None, layout='NTC', merge_outputs=None)
return outputs, states
Unroll an RNN cell across time steps. Parameters ---------- length : int Number of steps to unroll. inputs : Symbol, list of Symbol, or None If `inputs` is a single Symbol (usually the output of Embedding symbol), it should have shape (bat...
Unroll an RNN cell across time steps.
[ "Unroll", "an", "RNN", "cell", "across", "time", "steps", "." ]
def unroll(self, length, inputs, begin_state=None, layout='NTC', merge_outputs=None): """Unroll an RNN cell across time steps. Parameters ---------- length : int Number of steps to unroll. inputs : Symbol, list of Symbol, or None If `inputs` is a single S...
[ "def", "unroll", "(", "self", ",", "length", ",", "inputs", ",", "begin_state", "=", "None", ",", "layout", "=", "'NTC'", ",", "merge_outputs", "=", "None", ")", ":", "self", ".", "reset", "(", ")", "inputs", ",", "_", "=", "_normalize_sequence", "(", ...
https://github.com/hpi-xnor/BMXNet/blob/ed0b201da6667887222b8e4b5f997c4f6b61943d/python/mxnet/rnn/rnn_cell.py#L295-L351
ChromiumWebApps/chromium
c7361d39be8abd1574e6ce8957c8dbddd4c6ccf7
tools/json_schema_compiler/cpp_util.py
python
Classname
(s)
return '_'.join([x[0].upper() + x[1:] for x in re.split('\W', s)])
Translates a namespace name or function name into something more suited to C++. eg experimental.downloads -> Experimental_Downloads updateAll -> UpdateAll.
Translates a namespace name or function name into something more suited to C++.
[ "Translates", "a", "namespace", "name", "or", "function", "name", "into", "something", "more", "suited", "to", "C", "++", "." ]
def Classname(s): """Translates a namespace name or function name into something more suited to C++. eg experimental.downloads -> Experimental_Downloads updateAll -> UpdateAll. """ return '_'.join([x[0].upper() + x[1:] for x in re.split('\W', s)])
[ "def", "Classname", "(", "s", ")", ":", "return", "'_'", ".", "join", "(", "[", "x", "[", "0", "]", ".", "upper", "(", ")", "+", "x", "[", "1", ":", "]", "for", "x", "in", "re", ".", "split", "(", "'\\W'", ",", "s", ")", "]", ")" ]
https://github.com/ChromiumWebApps/chromium/blob/c7361d39be8abd1574e6ce8957c8dbddd4c6ccf7/tools/json_schema_compiler/cpp_util.py#L32-L39
aws/lumberyard
f85344403c1c2e77ec8c75deb2c116e97b713217
dev/Tools/Python/3.7.10/linux_x64/lib/python3.7/mailbox.py
python
_singlefileMailbox._append_message
(self, message)
return offsets
Append message to mailbox and return (start, stop) offsets.
Append message to mailbox and return (start, stop) offsets.
[ "Append", "message", "to", "mailbox", "and", "return", "(", "start", "stop", ")", "offsets", "." ]
def _append_message(self, message): """Append message to mailbox and return (start, stop) offsets.""" self._file.seek(0, 2) before = self._file.tell() if len(self._toc) == 0 and not self._pending: # This is the first message, and the _pre_mailbox_hook # hasn't yet...
[ "def", "_append_message", "(", "self", ",", "message", ")", ":", "self", ".", "_file", ".", "seek", "(", "0", ",", "2", ")", "before", "=", "self", ".", "_file", ".", "tell", "(", ")", "if", "len", "(", "self", ".", "_toc", ")", "==", "0", "and...
https://github.com/aws/lumberyard/blob/f85344403c1c2e77ec8c75deb2c116e97b713217/dev/Tools/Python/3.7.10/linux_x64/lib/python3.7/mailbox.py#L746-L765
wxWidgets/wxPython-Classic
19571e1ae65f1ac445f5491474121998c97a1bf0
src/osx_cocoa/richtext.py
python
RichTextCtrl.ClearListStyle
(*args, **kwargs)
return _richtext.RichTextCtrl_ClearListStyle(*args, **kwargs)
ClearListStyle(self, RichTextRange range, int flags=RICHTEXT_SETSTYLE_WITH_UNDO) -> bool
ClearListStyle(self, RichTextRange range, int flags=RICHTEXT_SETSTYLE_WITH_UNDO) -> bool
[ "ClearListStyle", "(", "self", "RichTextRange", "range", "int", "flags", "=", "RICHTEXT_SETSTYLE_WITH_UNDO", ")", "-", ">", "bool" ]
def ClearListStyle(*args, **kwargs): """ClearListStyle(self, RichTextRange range, int flags=RICHTEXT_SETSTYLE_WITH_UNDO) -> bool""" return _richtext.RichTextCtrl_ClearListStyle(*args, **kwargs)
[ "def", "ClearListStyle", "(", "*", "args", ",", "*", "*", "kwargs", ")", ":", "return", "_richtext", ".", "RichTextCtrl_ClearListStyle", "(", "*", "args", ",", "*", "*", "kwargs", ")" ]
https://github.com/wxWidgets/wxPython-Classic/blob/19571e1ae65f1ac445f5491474121998c97a1bf0/src/osx_cocoa/richtext.py#L3188-L3190
catboost/catboost
167f64f237114a4d10b2b4ee42adb4569137debe
contrib/python/numpy/py3/numpy/polynomial/_polybase.py
python
ABCPolyBase.has_samewindow
(self, other)
return np.all(self.window == other.window)
Check if windows match. .. versionadded:: 1.6.0 Parameters ---------- other : class instance The other class must have the ``window`` attribute. Returns ------- bool : boolean True if the windows are the same, False otherwise.
Check if windows match.
[ "Check", "if", "windows", "match", "." ]
def has_samewindow(self, other): """Check if windows match. .. versionadded:: 1.6.0 Parameters ---------- other : class instance The other class must have the ``window`` attribute. Returns ------- bool : boolean True if the windo...
[ "def", "has_samewindow", "(", "self", ",", "other", ")", ":", "return", "np", ".", "all", "(", "self", ".", "window", "==", "other", ".", "window", ")" ]
https://github.com/catboost/catboost/blob/167f64f237114a4d10b2b4ee42adb4569137debe/contrib/python/numpy/py3/numpy/polynomial/_polybase.py#L218-L234
catboost/catboost
167f64f237114a4d10b2b4ee42adb4569137debe
contrib/python/scipy/py3/scipy/spatial/distance.py
python
directed_hausdorff
(u, v, seed=0)
return result
Compute the directed Hausdorff distance between two N-D arrays. Distances between pairs are calculated using a Euclidean metric. Parameters ---------- u : (M,N) ndarray Input array. v : (O,N) ndarray Input array. seed : int or None Local `np.random.RandomState` seed. De...
Compute the directed Hausdorff distance between two N-D arrays.
[ "Compute", "the", "directed", "Hausdorff", "distance", "between", "two", "N", "-", "D", "arrays", "." ]
def directed_hausdorff(u, v, seed=0): """ Compute the directed Hausdorff distance between two N-D arrays. Distances between pairs are calculated using a Euclidean metric. Parameters ---------- u : (M,N) ndarray Input array. v : (O,N) ndarray Input array. seed : int or N...
[ "def", "directed_hausdorff", "(", "u", ",", "v", ",", "seed", "=", "0", ")", ":", "u", "=", "np", ".", "asarray", "(", "u", ",", "dtype", "=", "np", ".", "float64", ",", "order", "=", "'c'", ")", "v", "=", "np", ".", "asarray", "(", "v", ",",...
https://github.com/catboost/catboost/blob/167f64f237114a4d10b2b4ee42adb4569137debe/contrib/python/scipy/py3/scipy/spatial/distance.py#L351-L439
rapidsai/cudf
d5b2448fc69f17509304d594f029d0df56984962
python/cudf/cudf/core/df_protocol.py
python
_CuDFColumn.num_chunks
(self)
return 1
Return the number of chunks the column consists of.
Return the number of chunks the column consists of.
[ "Return", "the", "number", "of", "chunks", "the", "column", "consists", "of", "." ]
def num_chunks(self) -> int: """ Return the number of chunks the column consists of. """ return 1
[ "def", "num_chunks", "(", "self", ")", "->", "int", ":", "return", "1" ]
https://github.com/rapidsai/cudf/blob/d5b2448fc69f17509304d594f029d0df56984962/python/cudf/cudf/core/df_protocol.py#L342-L346
catboost/catboost
167f64f237114a4d10b2b4ee42adb4569137debe
contrib/python/numpy/py3/numpy/f2py/f2py2e.py
python
run_compile
()
Do it all in one call!
Do it all in one call!
[ "Do", "it", "all", "in", "one", "call!" ]
def run_compile(): """ Do it all in one call! """ import tempfile i = sys.argv.index('-c') del sys.argv[i] remove_build_dir = 0 try: i = sys.argv.index('--build-dir') except ValueError: i = None if i is not None: build_dir = sys.argv[i + 1] del s...
[ "def", "run_compile", "(", ")", ":", "import", "tempfile", "i", "=", "sys", ".", "argv", ".", "index", "(", "'-c'", ")", "del", "sys", ".", "argv", "[", "i", "]", "remove_build_dir", "=", "0", "try", ":", "i", "=", "sys", ".", "argv", ".", "index...
https://github.com/catboost/catboost/blob/167f64f237114a4d10b2b4ee42adb4569137debe/contrib/python/numpy/py3/numpy/f2py/f2py2e.py#L492-L662
microsoft/ivy
9f3c7ecc0b2383129fdd0953e10890d98d09a82d
ivy/ivy_parser.py
python
p_optreturns_tsyms
(p)
optreturns : RETURNS LPAREN lparams RPAREN
optreturns : RETURNS LPAREN lparams RPAREN
[ "optreturns", ":", "RETURNS", "LPAREN", "lparams", "RPAREN" ]
def p_optreturns_tsyms(p): 'optreturns : RETURNS LPAREN lparams RPAREN' p[0] = p[3]
[ "def", "p_optreturns_tsyms", "(", "p", ")", ":", "p", "[", "0", "]", "=", "p", "[", "3", "]" ]
https://github.com/microsoft/ivy/blob/9f3c7ecc0b2383129fdd0953e10890d98d09a82d/ivy/ivy_parser.py#L1392-L1394
gv22ga/dlib-face-recognition-android
42d6305cbd85833f2b85bb79b70ab9ab004153c9
tools/lint/cpplint.py
python
NestingState.CheckCompletedBlocks
(self, filename, error)
Checks that all classes and namespaces have been completely parsed. Call this when all lines in a file have been processed. Args: filename: The name of the current file. error: The function to call with any errors found.
Checks that all classes and namespaces have been completely parsed. Call this when all lines in a file have been processed. Args: filename: The name of the current file. error: The function to call with any errors found.
[ "Checks", "that", "all", "classes", "and", "namespaces", "have", "been", "completely", "parsed", ".", "Call", "this", "when", "all", "lines", "in", "a", "file", "have", "been", "processed", ".", "Args", ":", "filename", ":", "The", "name", "of", "the", "...
def CheckCompletedBlocks(self, filename, error): """Checks that all classes and namespaces have been completely parsed. Call this when all lines in a file have been processed. Args: filename: The name of the current file. error: The function to call with any errors found. """ # Note: Thi...
[ "def", "CheckCompletedBlocks", "(", "self", ",", "filename", ",", "error", ")", ":", "# Note: This test can result in false positives if #ifdef constructs", "# get in the way of brace matching. See the testBuildClass test in", "# cpplint_unittest.py for an example of this.", "for", "obj"...
https://github.com/gv22ga/dlib-face-recognition-android/blob/42d6305cbd85833f2b85bb79b70ab9ab004153c9/tools/lint/cpplint.py#L2528-L2546
Komnomnomnom/swigibpy
cfd307fdbfaffabc69a2dc037538d7e34a8b8daf
swigibpy.py
python
EClientSocketBase.cancelHistoricalData
(self, tickerId)
return _swigibpy.EClientSocketBase_cancelHistoricalData(self, tickerId)
cancelHistoricalData(EClientSocketBase self, TickerId tickerId)
cancelHistoricalData(EClientSocketBase self, TickerId tickerId)
[ "cancelHistoricalData", "(", "EClientSocketBase", "self", "TickerId", "tickerId", ")" ]
def cancelHistoricalData(self, tickerId): """cancelHistoricalData(EClientSocketBase self, TickerId tickerId)""" return _swigibpy.EClientSocketBase_cancelHistoricalData(self, tickerId)
[ "def", "cancelHistoricalData", "(", "self", ",", "tickerId", ")", ":", "return", "_swigibpy", ".", "EClientSocketBase_cancelHistoricalData", "(", "self", ",", "tickerId", ")" ]
https://github.com/Komnomnomnom/swigibpy/blob/cfd307fdbfaffabc69a2dc037538d7e34a8b8daf/swigibpy.py#L1562-L1564
ChromiumWebApps/chromium
c7361d39be8abd1574e6ce8957c8dbddd4c6ccf7
tools/generate_stubs/generate_stubs.py
python
PosixStubWriter.__init__
(self, module_name, signatures)
Initializes PosixStubWriter for this set of signatures and module_name. Args: module_name: The name of the module we are writing a stub for. signatures: The list of signature hashes, as produced by ParseSignatures, to create stubs for.
Initializes PosixStubWriter for this set of signatures and module_name.
[ "Initializes", "PosixStubWriter", "for", "this", "set", "of", "signatures", "and", "module_name", "." ]
def __init__(self, module_name, signatures): """Initializes PosixStubWriter for this set of signatures and module_name. Args: module_name: The name of the module we are writing a stub for. signatures: The list of signature hashes, as produced by ParseSignatures, to create stubs fo...
[ "def", "__init__", "(", "self", ",", "module_name", ",", "signatures", ")", ":", "self", ".", "signatures", "=", "signatures", "self", ".", "module_name", "=", "module_name" ]
https://github.com/ChromiumWebApps/chromium/blob/c7361d39be8abd1574e6ce8957c8dbddd4c6ccf7/tools/generate_stubs/generate_stubs.py#L520-L529
wxWidgets/wxPython-Classic
19571e1ae65f1ac445f5491474121998c97a1bf0
src/msw/_controls.py
python
HelpEvent.SetTarget
(*args, **kwargs)
return _controls_.HelpEvent_SetTarget(*args, **kwargs)
SetTarget(self, String target) Set an optional target to display help in. E.g. a window specification
SetTarget(self, String target)
[ "SetTarget", "(", "self", "String", "target", ")" ]
def SetTarget(*args, **kwargs): """ SetTarget(self, String target) Set an optional target to display help in. E.g. a window specification """ return _controls_.HelpEvent_SetTarget(*args, **kwargs)
[ "def", "SetTarget", "(", "*", "args", ",", "*", "*", "kwargs", ")", ":", "return", "_controls_", ".", "HelpEvent_SetTarget", "(", "*", "args", ",", "*", "*", "kwargs", ")" ]
https://github.com/wxWidgets/wxPython-Classic/blob/19571e1ae65f1ac445f5491474121998c97a1bf0/src/msw/_controls.py#L6094-L6100
wxWidgets/wxPython-Classic
19571e1ae65f1ac445f5491474121998c97a1bf0
wx/lib/agw/ultimatelistctrl.py
python
UltimateListCtrl.SetAGWWindowStyleFlag
(self, style)
Sets the :class:`UltimateListCtrl` AGW-specific style flag. :param `style`: the AGW-specific window style; can be almost any combination of the following bits: =============================== =========== =======================================================================================...
Sets the :class:`UltimateListCtrl` AGW-specific style flag.
[ "Sets", "the", ":", "class", ":", "UltimateListCtrl", "AGW", "-", "specific", "style", "flag", "." ]
def SetAGWWindowStyleFlag(self, style): """ Sets the :class:`UltimateListCtrl` AGW-specific style flag. :param `style`: the AGW-specific window style; can be almost any combination of the following bits: =============================== =========== ===========================...
[ "def", "SetAGWWindowStyleFlag", "(", "self", ",", "style", ")", ":", "if", "style", "&", "ULC_HAS_VARIABLE_ROW_HEIGHT", "and", "not", "self", ".", "HasAGWFlag", "(", "ULC_REPORT", ")", ":", "raise", "Exception", "(", "\"ULC_HAS_VARIABLE_ROW_HEIGHT style can be used on...
https://github.com/wxWidgets/wxPython-Classic/blob/19571e1ae65f1ac445f5491474121998c97a1bf0/wx/lib/agw/ultimatelistctrl.py#L11132-L11201
kamyu104/LeetCode-Solutions
77605708a927ea3b85aee5a479db733938c7c211
Python/minimum-operations-to-make-a-uni-value-grid.py
python
Solution.minOperations
(self, grid, x)
return sum(abs(v-median)//x for v in nums)
:type grid: List[List[int]] :type x: int :rtype: int
:type grid: List[List[int]] :type x: int :rtype: int
[ ":", "type", "grid", ":", "List", "[", "List", "[", "int", "]]", ":", "type", "x", ":", "int", ":", "rtype", ":", "int" ]
def minOperations(self, grid, x): """ :type grid: List[List[int]] :type x: int :rtype: int """ def nth_element(nums, n, compare=lambda a, b: a < b): def tri_partition(nums, left, right, target, compare): mid = left while mid <= ...
[ "def", "minOperations", "(", "self", ",", "grid", ",", "x", ")", ":", "def", "nth_element", "(", "nums", ",", "n", ",", "compare", "=", "lambda", "a", ",", "b", ":", "a", "<", "b", ")", ":", "def", "tri_partition", "(", "nums", ",", "left", ",", ...
https://github.com/kamyu104/LeetCode-Solutions/blob/77605708a927ea3b85aee5a479db733938c7c211/Python/minimum-operations-to-make-a-uni-value-grid.py#L7-L44
pytorch/pytorch
7176c92687d3cc847cc046bf002269c6949a21c2
torch/nn/functional.py
python
gumbel_softmax
(logits: Tensor, tau: float = 1, hard: bool = False, eps: float = 1e-10, dim: int = -1)
return ret
r""" Samples from the Gumbel-Softmax distribution (`Link 1`_ `Link 2`_) and optionally discretizes. Args: logits: `[..., num_features]` unnormalized log probabilities tau: non-negative scalar temperature hard: if ``True``, the returned samples will be discretized as one-hot vectors, ...
r""" Samples from the Gumbel-Softmax distribution (`Link 1`_ `Link 2`_) and optionally discretizes.
[ "r", "Samples", "from", "the", "Gumbel", "-", "Softmax", "distribution", "(", "Link", "1", "_", "Link", "2", "_", ")", "and", "optionally", "discretizes", "." ]
def gumbel_softmax(logits: Tensor, tau: float = 1, hard: bool = False, eps: float = 1e-10, dim: int = -1) -> Tensor: r""" Samples from the Gumbel-Softmax distribution (`Link 1`_ `Link 2`_) and optionally discretizes. Args: logits: `[..., num_features]` unnormalized log probabilities tau: non-n...
[ "def", "gumbel_softmax", "(", "logits", ":", "Tensor", ",", "tau", ":", "float", "=", "1", ",", "hard", ":", "bool", "=", "False", ",", "eps", ":", "float", "=", "1e-10", ",", "dim", ":", "int", "=", "-", "1", ")", "->", "Tensor", ":", "if", "h...
https://github.com/pytorch/pytorch/blob/7176c92687d3cc847cc046bf002269c6949a21c2/torch/nn/functional.py#L1824-L1883
tensorflow/tensorflow
419e3a6b650ea4bd1b0cba23c4348f8a69f3272e
tensorflow/python/ops/batch_norm_benchmark.py
python
batch_norm_py
(tensor, mean, variance, beta, gamma, scale)
return nn_impl.batch_normalization(tensor, mean, variance, beta, gamma if scale else None, 0.001)
Python implementation of batch normalization.
Python implementation of batch normalization.
[ "Python", "implementation", "of", "batch", "normalization", "." ]
def batch_norm_py(tensor, mean, variance, beta, gamma, scale): """Python implementation of batch normalization.""" return nn_impl.batch_normalization(tensor, mean, variance, beta, gamma if scale else None, 0.001)
[ "def", "batch_norm_py", "(", "tensor", ",", "mean", ",", "variance", ",", "beta", ",", "gamma", ",", "scale", ")", ":", "return", "nn_impl", ".", "batch_normalization", "(", "tensor", ",", "mean", ",", "variance", ",", "beta", ",", "gamma", "if", "scale"...
https://github.com/tensorflow/tensorflow/blob/419e3a6b650ea4bd1b0cba23c4348f8a69f3272e/tensorflow/python/ops/batch_norm_benchmark.py#L51-L54
tiny-dnn/tiny-dnn
c0f576f5cb7b35893f62127cb7aec18f77a3bcc5
third_party/gemmlowp/meta/generators/zip_Nx8_neon.py
python
GenerateLeftoverLoadAggregateStore
(emitter, leftovers, lanes, output_address)
Handle leftovers when count is not a multiply of 8.
Handle leftovers when count is not a multiply of 8.
[ "Handle", "leftovers", "when", "count", "is", "not", "a", "multiply", "of", "8", "." ]
def GenerateLeftoverLoadAggregateStore(emitter, leftovers, lanes, output_address): """Handle leftovers when count is not a multiply of 8.""" emitter.EmitNewline() emitter.EmitComment('Leftover Load Aggregate Store.') # Clear load registers. for lane in lanes: emitte...
[ "def", "GenerateLeftoverLoadAggregateStore", "(", "emitter", ",", "leftovers", ",", "lanes", ",", "output_address", ")", ":", "emitter", ".", "EmitNewline", "(", ")", "emitter", ".", "EmitComment", "(", "'Leftover Load Aggregate Store.'", ")", "# Clear load registers.",...
https://github.com/tiny-dnn/tiny-dnn/blob/c0f576f5cb7b35893f62127cb7aec18f77a3bcc5/third_party/gemmlowp/meta/generators/zip_Nx8_neon.py#L84-L103
AngoraFuzzer/Angora
80e81c8590077bc0ac069dbd367da8ce405ff618
llvm_mode/dfsan_rt/sanitizer_common/scripts/cpplint.py
python
_SetVerboseLevel
(level)
return _cpplint_state.SetVerboseLevel(level)
Sets the module's verbosity, and returns the previous setting.
Sets the module's verbosity, and returns the previous setting.
[ "Sets", "the", "module", "s", "verbosity", "and", "returns", "the", "previous", "setting", "." ]
def _SetVerboseLevel(level): """Sets the module's verbosity, and returns the previous setting.""" return _cpplint_state.SetVerboseLevel(level)
[ "def", "_SetVerboseLevel", "(", "level", ")", ":", "return", "_cpplint_state", ".", "SetVerboseLevel", "(", "level", ")" ]
https://github.com/AngoraFuzzer/Angora/blob/80e81c8590077bc0ac069dbd367da8ce405ff618/llvm_mode/dfsan_rt/sanitizer_common/scripts/cpplint.py#L646-L648
thalium/icebox
99d147d5b9269222225443ce171b4fd46d8985d4
third_party/virtualbox/src/libs/libxml2-2.9.4/python/libxml2class.py
python
outputBuffer.htmlNodeDumpFormatOutput
(self, doc, cur, encoding, format)
Dump an HTML node, recursive behaviour,children are printed too.
Dump an HTML node, recursive behaviour,children are printed too.
[ "Dump", "an", "HTML", "node", "recursive", "behaviour", "children", "are", "printed", "too", "." ]
def htmlNodeDumpFormatOutput(self, doc, cur, encoding, format): """Dump an HTML node, recursive behaviour,children are printed too. """ if doc is None: doc__o = None else: doc__o = doc._o if cur is None: cur__o = None else: cur__o = cur._o libxml2mod.htmlNodeDu...
[ "def", "htmlNodeDumpFormatOutput", "(", "self", ",", "doc", ",", "cur", ",", "encoding", ",", "format", ")", ":", "if", "doc", "is", "None", ":", "doc__o", "=", "None", "else", ":", "doc__o", "=", "doc", ".", "_o", "if", "cur", "is", "None", ":", "...
https://github.com/thalium/icebox/blob/99d147d5b9269222225443ce171b4fd46d8985d4/third_party/virtualbox/src/libs/libxml2-2.9.4/python/libxml2class.py#L5263-L5270
Xilinx/Vitis-AI
fc74d404563d9951b57245443c73bef389f3657f
tools/Vitis-AI-Quantizer/vai_q_tensorflow1.x/tensorflow/python/framework/constant_op.py
python
_constant_impl
( value, dtype, shape, name, verify_shape, allow_broadcast)
return const_tensor
Implementation of constant.
Implementation of constant.
[ "Implementation", "of", "constant", "." ]
def _constant_impl( value, dtype, shape, name, verify_shape, allow_broadcast): """Implementation of constant.""" ctx = context.context() if ctx.executing_eagerly(): t = convert_to_eager_tensor(value, ctx, dtype) if shape is None: return t shape = tensor_shape.as_shape(shape) if shape == ...
[ "def", "_constant_impl", "(", "value", ",", "dtype", ",", "shape", ",", "name", ",", "verify_shape", ",", "allow_broadcast", ")", ":", "ctx", "=", "context", ".", "context", "(", ")", "if", "ctx", ".", "executing_eagerly", "(", ")", ":", "t", "=", "con...
https://github.com/Xilinx/Vitis-AI/blob/fc74d404563d9951b57245443c73bef389f3657f/tools/Vitis-AI-Quantizer/vai_q_tensorflow1.x/tensorflow/python/framework/constant_op.py#L230-L272
lammps/lammps
b75c3065430a75b1b5543a10e10f46d9b4c91913
tools/i-pi/ipi/inputs/forces.py
python
InputForceBeads.store
(self, forceb)
Takes a ForceBeads instance and stores a minimal representation of it. Args: forceb: A ForceBeads object.
Takes a ForceBeads instance and stores a minimal representation of it.
[ "Takes", "a", "ForceBeads", "instance", "and", "stores", "a", "minimal", "representation", "of", "it", "." ]
def store(self, forceb): """Takes a ForceBeads instance and stores a minimal representation of it. Args: forceb: A ForceBeads object. """ Input.store(self,forceb) self.nbeads.store(forceb.nbeads) self.weight.store(forceb.weight)
[ "def", "store", "(", "self", ",", "forceb", ")", ":", "Input", ".", "store", "(", "self", ",", "forceb", ")", "self", ".", "nbeads", ".", "store", "(", "forceb", ".", "nbeads", ")", "self", ".", "weight", ".", "store", "(", "forceb", ".", "weight",...
https://github.com/lammps/lammps/blob/b75c3065430a75b1b5543a10e10f46d9b4c91913/tools/i-pi/ipi/inputs/forces.py#L55-L64
Xilinx/Vitis-AI
fc74d404563d9951b57245443c73bef389f3657f
tools/Vitis-AI-Quantizer/vai_q_tensorflow1.x/tensorflow/python/saved_model/function_deserialization.py
python
fix_node_def
(node_def, functions, shared_name_suffix, debug_name)
Replace functions calls and shared names in `node_def`.
Replace functions calls and shared names in `node_def`.
[ "Replace", "functions", "calls", "and", "shared", "names", "in", "node_def", "." ]
def fix_node_def(node_def, functions, shared_name_suffix, debug_name): """Replace functions calls and shared names in `node_def`.""" if "_gradient_op_type" in node_def.attr: if node_def.op in ["StatefulPartitionedCall", "PartitionedCall"]: # TODO(andresp): This code assumes that the gradient registered fo...
[ "def", "fix_node_def", "(", "node_def", ",", "functions", ",", "shared_name_suffix", ",", "debug_name", ")", ":", "if", "\"_gradient_op_type\"", "in", "node_def", ".", "attr", ":", "if", "node_def", ".", "op", "in", "[", "\"StatefulPartitionedCall\"", ",", "\"Pa...
https://github.com/Xilinx/Vitis-AI/blob/fc74d404563d9951b57245443c73bef389f3657f/tools/Vitis-AI-Quantizer/vai_q_tensorflow1.x/tensorflow/python/saved_model/function_deserialization.py#L363-L402
catboost/catboost
167f64f237114a4d10b2b4ee42adb4569137debe
contrib/python/pandas/py2/pandas/core/indexes/frozen.py
python
FrozenNDArray.__unicode__
(self)
return "%s(%s, dtype='%s')" % (type(self).__name__, prepr, self.dtype)
Return a string representation for this object. Invoked by unicode(df) in py2 only. Yields a Unicode String in both py2/py3.
Return a string representation for this object.
[ "Return", "a", "string", "representation", "for", "this", "object", "." ]
def __unicode__(self): """ Return a string representation for this object. Invoked by unicode(df) in py2 only. Yields a Unicode String in both py2/py3. """ prepr = pprint_thing(self, escape_chars=('\t', '\r', '\n'), quote_strings=True) ...
[ "def", "__unicode__", "(", "self", ")", ":", "prepr", "=", "pprint_thing", "(", "self", ",", "escape_chars", "=", "(", "'\\t'", ",", "'\\r'", ",", "'\\n'", ")", ",", "quote_strings", "=", "True", ")", "return", "\"%s(%s, dtype='%s')\"", "%", "(", "type", ...
https://github.com/catboost/catboost/blob/167f64f237114a4d10b2b4ee42adb4569137debe/contrib/python/pandas/py2/pandas/core/indexes/frozen.py#L152-L161
miyosuda/TensorFlowAndroidDemo
35903e0221aa5f109ea2dbef27f20b52e317f42d
jni-build/jni/include/tensorflow/contrib/factorization/python/ops/gmm_ops.py
python
GmmAlgorithm._define_partial_maximization_operation
(self, shard_id, shard)
Computes the partial statistics of the means and covariances. Args: shard_id: current shard id. shard: current data shard, 1 X num_examples X dimensions.
Computes the partial statistics of the means and covariances.
[ "Computes", "the", "partial", "statistics", "of", "the", "means", "and", "covariances", "." ]
def _define_partial_maximization_operation(self, shard_id, shard): """Computes the partial statistics of the means and covariances. Args: shard_id: current shard id. shard: current data shard, 1 X num_examples X dimensions. """ # Soft assignment of each data point to each of the two cluster...
[ "def", "_define_partial_maximization_operation", "(", "self", ",", "shard_id", ",", "shard", ")", ":", "# Soft assignment of each data point to each of the two clusters.", "self", ".", "_points_in_k", "[", "shard_id", "]", "=", "tf", ".", "reduce_sum", "(", "self", ".",...
https://github.com/miyosuda/TensorFlowAndroidDemo/blob/35903e0221aa5f109ea2dbef27f20b52e317f42d/jni-build/jni/include/tensorflow/contrib/factorization/python/ops/gmm_ops.py#L307-L328
catboost/catboost
167f64f237114a4d10b2b4ee42adb4569137debe
contrib/python/numpy/py3/numpy/distutils/fcompiler/gnu.py
python
Gnu95FCompiler.wrap_unlinkable_objects
(self, objects, output_dir, extra_dll_dir)
Convert a set of object files that are not compatible with the default linker, to a file that is compatible.
Convert a set of object files that are not compatible with the default linker, to a file that is compatible.
[ "Convert", "a", "set", "of", "object", "files", "that", "are", "not", "compatible", "with", "the", "default", "linker", "to", "a", "file", "that", "is", "compatible", "." ]
def wrap_unlinkable_objects(self, objects, output_dir, extra_dll_dir): """ Convert a set of object files that are not compatible with the default linker, to a file that is compatible. """ if self.c_compiler.compiler_type == "msvc": # Compile a DLL and return the lib f...
[ "def", "wrap_unlinkable_objects", "(", "self", ",", "objects", ",", "output_dir", ",", "extra_dll_dir", ")", ":", "if", "self", ".", "c_compiler", ".", "compiler_type", "==", "\"msvc\"", ":", "# Compile a DLL and return the lib for the DLL as", "# the object. Also keep tr...
https://github.com/catboost/catboost/blob/167f64f237114a4d10b2b4ee42adb4569137debe/contrib/python/numpy/py3/numpy/distutils/fcompiler/gnu.py#L474-L517
kristjankorjus/Replicating-DeepMind
68539394e792b34a4d6b430a2eb73b8b8f91d8db
Hybrid/src/ai/layers.py
python
shared_single
(dim=2)
return theano.shared(np.zeros(shp, dtype='float32'))
Shortcut to create an undefined single precision Theano shared variable.
Shortcut to create an undefined single precision Theano shared variable.
[ "Shortcut", "to", "create", "an", "undefined", "single", "precision", "Theano", "shared", "variable", "." ]
def shared_single(dim=2): """ Shortcut to create an undefined single precision Theano shared variable. """ shp = tuple([1] * dim) return theano.shared(np.zeros(shp, dtype='float32'))
[ "def", "shared_single", "(", "dim", "=", "2", ")", ":", "shp", "=", "tuple", "(", "[", "1", "]", "*", "dim", ")", "return", "theano", ".", "shared", "(", "np", ".", "zeros", "(", "shp", ",", "dtype", "=", "'float32'", ")", ")" ]
https://github.com/kristjankorjus/Replicating-DeepMind/blob/68539394e792b34a4d6b430a2eb73b8b8f91d8db/Hybrid/src/ai/layers.py#L296-L301
wlanjie/AndroidFFmpeg
7baf9122f4b8e1c74e7baf4be5c422c7a5ba5aaf
tools/fdk-aac-build/armeabi/toolchain/lib/python2.7/wsgiref/handlers.py
python
BaseHandler.setup_environ
(self)
Set up the environment for one request
Set up the environment for one request
[ "Set", "up", "the", "environment", "for", "one", "request" ]
def setup_environ(self): """Set up the environment for one request""" env = self.environ = self.os_environ.copy() self.add_cgi_vars() env['wsgi.input'] = self.get_stdin() env['wsgi.errors'] = self.get_stderr() env['wsgi.version'] = self.wsgi_version ...
[ "def", "setup_environ", "(", "self", ")", ":", "env", "=", "self", ".", "environ", "=", "self", ".", "os_environ", ".", "copy", "(", ")", "self", ".", "add_cgi_vars", "(", ")", "env", "[", "'wsgi.input'", "]", "=", "self", ".", "get_stdin", "(", ")",...
https://github.com/wlanjie/AndroidFFmpeg/blob/7baf9122f4b8e1c74e7baf4be5c422c7a5ba5aaf/tools/fdk-aac-build/armeabi/toolchain/lib/python2.7/wsgiref/handlers.py#L96-L114
hszhao/PSPNet
cf7e5a99ba37e46118026e96be5821a9bc63bde0
scripts/cpp_lint.py
python
FindNextMultiLineCommentStart
(lines, lineix)
return len(lines)
Find the beginning marker for a multiline comment.
Find the beginning marker for a multiline comment.
[ "Find", "the", "beginning", "marker", "for", "a", "multiline", "comment", "." ]
def FindNextMultiLineCommentStart(lines, lineix): """Find the beginning marker for a multiline comment.""" while lineix < len(lines): if lines[lineix].strip().startswith('/*'): # Only return this marker if the comment goes beyond this line if lines[lineix].strip().find('*/', 2) < 0: return l...
[ "def", "FindNextMultiLineCommentStart", "(", "lines", ",", "lineix", ")", ":", "while", "lineix", "<", "len", "(", "lines", ")", ":", "if", "lines", "[", "lineix", "]", ".", "strip", "(", ")", ".", "startswith", "(", "'/*'", ")", ":", "# Only return this...
https://github.com/hszhao/PSPNet/blob/cf7e5a99ba37e46118026e96be5821a9bc63bde0/scripts/cpp_lint.py#L1123-L1131
google/syzygy
8164b24ebde9c5649c9a09e88a7fc0b0fcbd1bc5
third_party/numpy/files/numpy/core/fromnumeric.py
python
round_
(a, decimals=0, out=None)
return round(decimals, out)
Round an array to the given number of decimals. Refer to `around` for full documentation. See Also -------- around : equivalent function
Round an array to the given number of decimals.
[ "Round", "an", "array", "to", "the", "given", "number", "of", "decimals", "." ]
def round_(a, decimals=0, out=None): """ Round an array to the given number of decimals. Refer to `around` for full documentation. See Also -------- around : equivalent function """ try: round = a.round except AttributeError: return _wrapit(a, 'round', decimals, ou...
[ "def", "round_", "(", "a", ",", "decimals", "=", "0", ",", "out", "=", "None", ")", ":", "try", ":", "round", "=", "a", ".", "round", "except", "AttributeError", ":", "return", "_wrapit", "(", "a", ",", "'round'", ",", "decimals", ",", "out", ")", ...
https://github.com/google/syzygy/blob/8164b24ebde9c5649c9a09e88a7fc0b0fcbd1bc5/third_party/numpy/files/numpy/core/fromnumeric.py#L2281-L2296
facebookincubator/profilo
d3a275d0e7897cc4e3507d543459f3227e85c67f
python/profilo/workflow_demo.py
python
syscounters
(tracefile, args)
Parse system counter information from a trace file, sort by increasing timestamp order, and plot as a time series.
Parse system counter information from a trace file, sort by increasing timestamp order, and plot as a time series.
[ "Parse", "system", "counter", "information", "from", "a", "trace", "file", "sort", "by", "increasing", "timestamp", "order", "and", "plot", "as", "a", "time", "series", "." ]
def syscounters(tracefile, args): """ Parse system counter information from a trace file, sort by increasing timestamp order, and plot as a time series. """ plotdir = os.path.join(args.plotdir, "") # Validate output directory actually exists if not os.path.exists(args.plotdir): print...
[ "def", "syscounters", "(", "tracefile", ",", "args", ")", ":", "plotdir", "=", "os", ".", "path", ".", "join", "(", "args", ".", "plotdir", ",", "\"\"", ")", "# Validate output directory actually exists", "if", "not", "os", ".", "path", ".", "exists", "(",...
https://github.com/facebookincubator/profilo/blob/d3a275d0e7897cc4e3507d543459f3227e85c67f/python/profilo/workflow_demo.py#L125-L175
wxWidgets/wxPython-Classic
19571e1ae65f1ac445f5491474121998c97a1bf0
wx/tools/Editra/src/extern/aui/aui_utilities.py
python
DrawMACCloseButton
(colour, backColour=None)
return bmp
Draws the wxMAC tab close button using :class:`GraphicsContext`. :param Colour `colour`: the colour to use to draw the circle; :param Colour `backColour`: the optional background colour for the circle.
Draws the wxMAC tab close button using :class:`GraphicsContext`.
[ "Draws", "the", "wxMAC", "tab", "close", "button", "using", ":", "class", ":", "GraphicsContext", "." ]
def DrawMACCloseButton(colour, backColour=None): """ Draws the wxMAC tab close button using :class:`GraphicsContext`. :param Colour `colour`: the colour to use to draw the circle; :param Colour `backColour`: the optional background colour for the circle. """ bmp = wx.EmptyBitmapRGBA(16, 16) ...
[ "def", "DrawMACCloseButton", "(", "colour", ",", "backColour", "=", "None", ")", ":", "bmp", "=", "wx", ".", "EmptyBitmapRGBA", "(", "16", ",", "16", ")", "dc", "=", "wx", ".", "MemoryDC", "(", ")", "dc", ".", "SelectObject", "(", "bmp", ")", "gc", ...
https://github.com/wxWidgets/wxPython-Classic/blob/19571e1ae65f1ac445f5491474121998c97a1bf0/wx/tools/Editra/src/extern/aui/aui_utilities.py#L295-L331
ceph/ceph
959663007321a369c83218414a29bd9dbc8bda3a
src/pybind/mgr/rbd_support/module.py
python
Module.task_add_remove
(self, image_spec: str)
Remove an image asynchronously in the background
Remove an image asynchronously in the background
[ "Remove", "an", "image", "asynchronously", "in", "the", "background" ]
def task_add_remove(self, image_spec: str) -> Tuple[int, str, str]: """ Remove an image asynchronously in the background """ with self.task.lock: return self.task.queue_remove(image_spec)
[ "def", "task_add_remove", "(", "self", ",", "image_spec", ":", "str", ")", "->", "Tuple", "[", "int", ",", "str", ",", "str", "]", ":", "with", "self", ".", "task", ".", "lock", ":", "return", "self", ".", "task", ".", "queue_remove", "(", "image_spe...
https://github.com/ceph/ceph/blob/959663007321a369c83218414a29bd9dbc8bda3a/src/pybind/mgr/rbd_support/module.py#L163-L168
unicode-org/icu
2f8749a026f3ddc8cf54d4622480b7c543bb7fc0
tools/unicode/py/preparseucd.py
python
CopyAndStrip
(s, t)
return CopyAndStripWithOptionalMerge(s, t, False)
Copies a file and removes comments behind data lines but not in others.
Copies a file and removes comments behind data lines but not in others.
[ "Copies", "a", "file", "and", "removes", "comments", "behind", "data", "lines", "but", "not", "in", "others", "." ]
def CopyAndStrip(s, t): """Copies a file and removes comments behind data lines but not in others.""" return CopyAndStripWithOptionalMerge(s, t, False)
[ "def", "CopyAndStrip", "(", "s", ",", "t", ")", ":", "return", "CopyAndStripWithOptionalMerge", "(", "s", ",", "t", ",", "False", ")" ]
https://github.com/unicode-org/icu/blob/2f8749a026f3ddc8cf54d4622480b7c543bb7fc0/tools/unicode/py/preparseucd.py#L1582-L1584
benoitsteiner/tensorflow-opencl
cb7cb40a57fde5cfd4731bc551e82a1e2fef43a5
tensorflow/contrib/meta_graph_transform/meta_graph_transform.py
python
_get_single_node_name_from_collection
(meta_graph_def, collection_key)
return collection.node_list.value[0]
Obtain a node name that is the single element of a collection.
Obtain a node name that is the single element of a collection.
[ "Obtain", "a", "node", "name", "that", "is", "the", "single", "element", "of", "a", "collection", "." ]
def _get_single_node_name_from_collection(meta_graph_def, collection_key): """Obtain a node name that is the single element of a collection.""" if collection_key not in meta_graph_def.collection_def: return None collection = meta_graph_def.collection_def[collection_key] if not collection.node_list.value: ...
[ "def", "_get_single_node_name_from_collection", "(", "meta_graph_def", ",", "collection_key", ")", ":", "if", "collection_key", "not", "in", "meta_graph_def", ".", "collection_def", ":", "return", "None", "collection", "=", "meta_graph_def", ".", "collection_def", "[", ...
https://github.com/benoitsteiner/tensorflow-opencl/blob/cb7cb40a57fde5cfd4731bc551e82a1e2fef43a5/tensorflow/contrib/meta_graph_transform/meta_graph_transform.py#L572-L585
intel/llvm
e6d0547e9d99b5a56430c4749f6c7e328bf221ab
clang/tools/scan-build-py/lib/libscanbuild/intercept.py
python
write_exec_trace
(filename, entry)
Write execution report file. This method shall be sync with the execution report writer in interception library. The entry in the file is a JSON objects. :param filename: path to the output execution trace file, :param entry: the Execution object to append to that file.
Write execution report file.
[ "Write", "execution", "report", "file", "." ]
def write_exec_trace(filename, entry): """ Write execution report file. This method shall be sync with the execution report writer in interception library. The entry in the file is a JSON objects. :param filename: path to the output execution trace file, :param entry: the Execution object...
[ "def", "write_exec_trace", "(", "filename", ",", "entry", ")", ":", "with", "open", "(", "filename", ",", "'ab'", ")", "as", "handler", ":", "pid", "=", "str", "(", "entry", ".", "pid", ")", "command", "=", "US", ".", "join", "(", "entry", ".", "cm...
https://github.com/intel/llvm/blob/e6d0547e9d99b5a56430c4749f6c7e328bf221ab/clang/tools/scan-build-py/lib/libscanbuild/intercept.py#L167-L180
snap-stanford/snap-python
d53c51b0a26aa7e3e7400b014cdf728948fde80a
setup/snap.py
python
TIntIntVH.Load
(self, *args)
return _snap.TIntIntVH_Load(self, *args)
Load(TIntIntVH self, TSIn SIn) Parameters: SIn: TSIn &
Load(TIntIntVH self, TSIn SIn)
[ "Load", "(", "TIntIntVH", "self", "TSIn", "SIn", ")" ]
def Load(self, *args): """ Load(TIntIntVH self, TSIn SIn) Parameters: SIn: TSIn & """ return _snap.TIntIntVH_Load(self, *args)
[ "def", "Load", "(", "self", ",", "*", "args", ")", ":", "return", "_snap", ".", "TIntIntVH_Load", "(", "self", ",", "*", "args", ")" ]
https://github.com/snap-stanford/snap-python/blob/d53c51b0a26aa7e3e7400b014cdf728948fde80a/setup/snap.py#L17664-L17672
windystrife/UnrealEngine_NVIDIAGameWorks
b50e6338a7c5b26374d66306ebc7807541ff815e
Engine/Extras/ThirdPartyNotUE/emsdk/Win64/python/2.7.5.3_64bit/Lib/mailbox.py
python
Mailbox.discard
(self, key)
If the keyed message exists, remove it.
If the keyed message exists, remove it.
[ "If", "the", "keyed", "message", "exists", "remove", "it", "." ]
def discard(self, key): """If the keyed message exists, remove it.""" try: self.remove(key) except KeyError: pass
[ "def", "discard", "(", "self", ",", "key", ")", ":", "try", ":", "self", ".", "remove", "(", "key", ")", "except", "KeyError", ":", "pass" ]
https://github.com/windystrife/UnrealEngine_NVIDIAGameWorks/blob/b50e6338a7c5b26374d66306ebc7807541ff815e/Engine/Extras/ThirdPartyNotUE/emsdk/Win64/python/2.7.5.3_64bit/Lib/mailbox.py#L61-L66
neilogd/Engine
58fe0eed517b894e67dd646f0f5adfe328e129fb
3rdparty/jsoncpp/makerelease.py
python
check_no_pending_commit
()
return '\n'.join(msg)
Checks that there is no pending commit in the sandbox.
Checks that there is no pending commit in the sandbox.
[ "Checks", "that", "there", "is", "no", "pending", "commit", "in", "the", "sandbox", "." ]
def check_no_pending_commit(): """Checks that there is no pending commit in the sandbox.""" stdout = svn_command('status', '--xml') etree = ElementTree.fromstring(stdout) msg = [] for entry in etree.getiterator('entry'): path = entry.get('path') status = entry.find('wc-status').get('...
[ "def", "check_no_pending_commit", "(", ")", ":", "stdout", "=", "svn_command", "(", "'status'", ",", "'--xml'", ")", "etree", "=", "ElementTree", ".", "fromstring", "(", "stdout", ")", "msg", "=", "[", "]", "for", "entry", "in", "etree", ".", "getiterator"...
https://github.com/neilogd/Engine/blob/58fe0eed517b894e67dd646f0f5adfe328e129fb/3rdparty/jsoncpp/makerelease.py#L67-L79
wxWidgets/wxPython-Classic
19571e1ae65f1ac445f5491474121998c97a1bf0
src/osx_cocoa/richtext.py
python
RichTextParagraphLayoutBox.UpdateRanges
(*args, **kwargs)
return _richtext.RichTextParagraphLayoutBox_UpdateRanges(*args, **kwargs)
UpdateRanges(self)
UpdateRanges(self)
[ "UpdateRanges", "(", "self", ")" ]
def UpdateRanges(*args, **kwargs): """UpdateRanges(self)""" return _richtext.RichTextParagraphLayoutBox_UpdateRanges(*args, **kwargs)
[ "def", "UpdateRanges", "(", "*", "args", ",", "*", "*", "kwargs", ")", ":", "return", "_richtext", ".", "RichTextParagraphLayoutBox_UpdateRanges", "(", "*", "args", ",", "*", "*", "kwargs", ")" ]
https://github.com/wxWidgets/wxPython-Classic/blob/19571e1ae65f1ac445f5491474121998c97a1bf0/src/osx_cocoa/richtext.py#L1826-L1828
catboost/catboost
167f64f237114a4d10b2b4ee42adb4569137debe
contrib/python/prompt-toolkit/py3/prompt_toolkit/application/application.py
python
Application.get_used_style_strings
(self)
return []
Return a list of used style strings. This is helpful for debugging, and for writing a new `Style`.
Return a list of used style strings. This is helpful for debugging, and for writing a new `Style`.
[ "Return", "a", "list", "of", "used", "style", "strings", ".", "This", "is", "helpful", "for", "debugging", "and", "for", "writing", "a", "new", "Style", "." ]
def get_used_style_strings(self) -> List[str]: """ Return a list of used style strings. This is helpful for debugging, and for writing a new `Style`. """ attrs_for_style = self.renderer._attrs_for_style if attrs_for_style: return sorted( [ ...
[ "def", "get_used_style_strings", "(", "self", ")", "->", "List", "[", "str", "]", ":", "attrs_for_style", "=", "self", ".", "renderer", ".", "_attrs_for_style", "if", "attrs_for_style", ":", "return", "sorted", "(", "[", "re", ".", "sub", "(", "r\"\\s+\"", ...
https://github.com/catboost/catboost/blob/167f64f237114a4d10b2b4ee42adb4569137debe/contrib/python/prompt-toolkit/py3/prompt_toolkit/application/application.py#L1250-L1265
PixarAnimationStudios/USD
faed18ce62c8736b02413635b584a2f637156bad
pxr/usdImaging/usdviewq/appController.py
python
AppController.selectBoundMaterialForPurpose
(self, materialPurpose)
Iterates through all selected prims, selecting their bound preview materials.
Iterates through all selected prims, selecting their bound preview materials.
[ "Iterates", "through", "all", "selected", "prims", "selecting", "their", "bound", "preview", "materials", "." ]
def selectBoundMaterialForPurpose(self, materialPurpose): """Iterates through all selected prims, selecting their bound preview materials. """ oldPrims = self._dataModel.selection.getPrims() with self._dataModel.selection.batchPrimChanges: self._dataModel.selection...
[ "def", "selectBoundMaterialForPurpose", "(", "self", ",", "materialPurpose", ")", ":", "oldPrims", "=", "self", ".", "_dataModel", ".", "selection", ".", "getPrims", "(", ")", "with", "self", ".", "_dataModel", ".", "selection", ".", "batchPrimChanges", ":", "...
https://github.com/PixarAnimationStudios/USD/blob/faed18ce62c8736b02413635b584a2f637156bad/pxr/usdImaging/usdviewq/appController.py#L3172-L3184
FreeCAD/FreeCAD
ba42231b9c6889b89e064d6d563448ed81e376ec
src/Mod/Draft/draftguitools/gui_layers.py
python
Layer.GetResources
(self)
return {'Pixmap': 'Draft_Layer', 'MenuText': QT_TRANSLATE_NOOP("Draft_Layer", "Layer"), 'ToolTip': QT_TRANSLATE_NOOP("Draft_Layer", "Adds a layer to the document.\nObjects added to this layer can share the same visual properties such as line color, line width, and shape color.")}
Set icon, menu and tooltip.
Set icon, menu and tooltip.
[ "Set", "icon", "menu", "and", "tooltip", "." ]
def GetResources(self): """Set icon, menu and tooltip.""" return {'Pixmap': 'Draft_Layer', 'MenuText': QT_TRANSLATE_NOOP("Draft_Layer", "Layer"), 'ToolTip': QT_TRANSLATE_NOOP("Draft_Layer", "Adds a layer to the document.\nObjects added to this layer can share the same vis...
[ "def", "GetResources", "(", "self", ")", ":", "return", "{", "'Pixmap'", ":", "'Draft_Layer'", ",", "'MenuText'", ":", "QT_TRANSLATE_NOOP", "(", "\"Draft_Layer\"", ",", "\"Layer\"", ")", ",", "'ToolTip'", ":", "QT_TRANSLATE_NOOP", "(", "\"Draft_Layer\"", ",", "\...
https://github.com/FreeCAD/FreeCAD/blob/ba42231b9c6889b89e064d6d563448ed81e376ec/src/Mod/Draft/draftguitools/gui_layers.py#L49-L53
catboost/catboost
167f64f237114a4d10b2b4ee42adb4569137debe
contrib/python/prompt-toolkit/py2/prompt_toolkit/key_binding/bindings/vi.py
python
load_extra_vi_page_navigation_bindings
()
return registry
Key bindings, for scrolling up and down through pages. This are separate bindings, because GNU readline doesn't have them.
Key bindings, for scrolling up and down through pages. This are separate bindings, because GNU readline doesn't have them.
[ "Key", "bindings", "for", "scrolling", "up", "and", "down", "through", "pages", ".", "This", "are", "separate", "bindings", "because", "GNU", "readline", "doesn", "t", "have", "them", "." ]
def load_extra_vi_page_navigation_bindings(): """ Key bindings, for scrolling up and down through pages. This are separate bindings, because GNU readline doesn't have them. """ registry = ConditionalRegistry(Registry(), ViMode()) handle = registry.add_binding handle(Keys.ControlF)(scroll_fo...
[ "def", "load_extra_vi_page_navigation_bindings", "(", ")", ":", "registry", "=", "ConditionalRegistry", "(", "Registry", "(", ")", ",", "ViMode", "(", ")", ")", "handle", "=", "registry", ".", "add_binding", "handle", "(", "Keys", ".", "ControlF", ")", "(", ...
https://github.com/catboost/catboost/blob/167f64f237114a4d10b2b4ee42adb4569137debe/contrib/python/prompt-toolkit/py2/prompt_toolkit/key_binding/bindings/vi.py#L1876-L1893
NVIDIA/TensorRT
42805f078052daad1a98bc5965974fcffaad0960
samples/python/efficientnet/build_engine.py
python
EngineBuilder.__init__
(self, verbose=False)
:param verbose: If enabled, a higher verbosity level will be set on the TensorRT logger.
:param verbose: If enabled, a higher verbosity level will be set on the TensorRT logger.
[ ":", "param", "verbose", ":", "If", "enabled", "a", "higher", "verbosity", "level", "will", "be", "set", "on", "the", "TensorRT", "logger", "." ]
def __init__(self, verbose=False): """ :param verbose: If enabled, a higher verbosity level will be set on the TensorRT logger. """ self.trt_logger = trt.Logger(trt.Logger.INFO) if verbose: self.trt_logger.min_severity = trt.Logger.Severity.VERBOSE trt.init_l...
[ "def", "__init__", "(", "self", ",", "verbose", "=", "False", ")", ":", "self", ".", "trt_logger", "=", "trt", ".", "Logger", "(", "trt", ".", "Logger", ".", "INFO", ")", "if", "verbose", ":", "self", ".", "trt_logger", ".", "min_severity", "=", "trt...
https://github.com/NVIDIA/TensorRT/blob/42805f078052daad1a98bc5965974fcffaad0960/samples/python/efficientnet/build_engine.py#L115-L131
aws/lumberyard
f85344403c1c2e77ec8c75deb2c116e97b713217
dev/Tools/Python/3.7.10/linux_x64/lib/python3.7/site-packages/pip/_vendor/urllib3/util/request.py
python
make_headers
( keep_alive=None, accept_encoding=None, user_agent=None, basic_auth=None, proxy_basic_auth=None, disable_cache=None, )
return headers
Shortcuts for generating request headers. :param keep_alive: If ``True``, adds 'connection: keep-alive' header. :param accept_encoding: Can be a boolean, list, or string. ``True`` translates to 'gzip,deflate'. List will get joined by comma. String will be used ...
[]
def make_headers( keep_alive=None, accept_encoding=None, user_agent=None, basic_auth=None, proxy_basic_auth=None, disable_cache=None, ): """ Shortcuts for generating request headers. :param keep_alive: If ``True``, adds 'connection: keep-alive' header. :pa...
[ "def", "make_headers", "(", "keep_alive", "=", "None", ",", "accept_encoding", "=", "None", ",", "user_agent", "=", "None", ",", "basic_auth", "=", "None", ",", "proxy_basic_auth", "=", "None", ",", "disable_cache", "=", "None", ",", ")", ":", "headers", "...
https://github.com/aws/lumberyard/blob/f85344403c1c2e77ec8c75deb2c116e97b713217/dev/Tools/Python/3.7.10/linux_x64/lib/python3.7/site-packages/pip/_vendor/urllib3/util/request.py#L51-L189
miyosuda/TensorFlowAndroidMNIST
7b5a4603d2780a8a2834575706e9001977524007
jni-build/jni/include/tensorflow/contrib/learn/python/learn/utils/export.py
python
regression_signature_fn
(examples, unused_features, predictions)
return signatures['regression'], signatures
Creates regression signature from given examples and predictions. Args: examples: `Tensor`. unused_features: `dict` of `Tensor`s. predictions: `dict` of `Tensor`s. Returns: Tuple of default regression signature and named signature.
Creates regression signature from given examples and predictions.
[ "Creates", "regression", "signature", "from", "given", "examples", "and", "predictions", "." ]
def regression_signature_fn(examples, unused_features, predictions): """Creates regression signature from given examples and predictions. Args: examples: `Tensor`. unused_features: `dict` of `Tensor`s. predictions: `dict` of `Tensor`s. Returns: Tuple of default regression signature and named sig...
[ "def", "regression_signature_fn", "(", "examples", ",", "unused_features", ",", "predictions", ")", ":", "signatures", "=", "{", "}", "signatures", "[", "'regression'", "]", "=", "exporter", ".", "regression_signature", "(", "input_tensor", "=", "examples", ",", ...
https://github.com/miyosuda/TensorFlowAndroidMNIST/blob/7b5a4603d2780a8a2834575706e9001977524007/jni-build/jni/include/tensorflow/contrib/learn/python/learn/utils/export.py#L135-L149
eclipse/sumo
7132a9b8b6eea734bdec38479026b4d8c4336d03
tools/traci/_edge.py
python
EdgeDomain.getFuelConsumption
(self, edgeID)
return self._getUniversal(tc.VAR_FUELCONSUMPTION, edgeID)
getFuelConsumption(string) -> double Returns the fuel consumption in ml for the last time step on the given edge.
getFuelConsumption(string) -> double
[ "getFuelConsumption", "(", "string", ")", "-", ">", "double" ]
def getFuelConsumption(self, edgeID): """getFuelConsumption(string) -> double Returns the fuel consumption in ml for the last time step on the given edge. """ return self._getUniversal(tc.VAR_FUELCONSUMPTION, edgeID)
[ "def", "getFuelConsumption", "(", "self", ",", "edgeID", ")", ":", "return", "self", ".", "_getUniversal", "(", "tc", ".", "VAR_FUELCONSUMPTION", ",", "edgeID", ")" ]
https://github.com/eclipse/sumo/blob/7132a9b8b6eea734bdec38479026b4d8c4336d03/tools/traci/_edge.py#L91-L96
aws/lumberyard
f85344403c1c2e77ec8c75deb2c116e97b713217
dev/Tools/Python/3.7.10/linux_x64/lib/python3.7/_pydecimal.py
python
Context.min_mag
(self, a, b)
return a.min_mag(b, context=self)
Compares the values numerically with their sign ignored. >>> ExtendedContext.min_mag(Decimal('3'), Decimal('-2')) Decimal('-2') >>> ExtendedContext.min_mag(Decimal('-3'), Decimal('NaN')) Decimal('-3') >>> ExtendedContext.min_mag(1, -2) Decimal('1') >>> ExtendedCo...
Compares the values numerically with their sign ignored.
[ "Compares", "the", "values", "numerically", "with", "their", "sign", "ignored", "." ]
def min_mag(self, a, b): """Compares the values numerically with their sign ignored. >>> ExtendedContext.min_mag(Decimal('3'), Decimal('-2')) Decimal('-2') >>> ExtendedContext.min_mag(Decimal('-3'), Decimal('NaN')) Decimal('-3') >>> ExtendedContext.min_mag(1, -2) ...
[ "def", "min_mag", "(", "self", ",", "a", ",", "b", ")", ":", "a", "=", "_convert_other", "(", "a", ",", "raiseit", "=", "True", ")", "return", "a", ".", "min_mag", "(", "b", ",", "context", "=", "self", ")" ]
https://github.com/aws/lumberyard/blob/f85344403c1c2e77ec8c75deb2c116e97b713217/dev/Tools/Python/3.7.10/linux_x64/lib/python3.7/_pydecimal.py#L4909-L4924
su2code/SU2
72b2fa977b64b9683a388920f05298a40d39e5c5
SU2_PY/SU2/io/config.py
python
Config.dist
(self,konfig,keys_check='ALL')
return distance
calculates a distance to another config Inputs: konfig - a second config keys_check - optional, a list of keys to check Outputs: distance - a float Currently only works for DV_VALUE_NEW ...
calculates a distance to another config Inputs: konfig - a second config keys_check - optional, a list of keys to check Outputs: distance - a float Currently only works for DV_VALUE_NEW ...
[ "calculates", "a", "distance", "to", "another", "config", "Inputs", ":", "konfig", "-", "a", "second", "config", "keys_check", "-", "optional", "a", "list", "of", "keys", "to", "check", "Outputs", ":", "distance", "-", "a", "float", "Currently", "only", "w...
def dist(self,konfig,keys_check='ALL'): """ calculates a distance to another config Inputs: konfig - a second config keys_check - optional, a list of keys to check Outputs: distance - a float ...
[ "def", "dist", "(", "self", ",", "konfig", ",", "keys_check", "=", "'ALL'", ")", ":", "konfig_diff", "=", "self", ".", "diff", "(", "konfig", ")", "if", "keys_check", "==", "'ALL'", ":", "keys_check", "=", "konfig_diff", ".", "keys", "(", ")", "distanc...
https://github.com/su2code/SU2/blob/72b2fa977b64b9683a388920f05298a40d39e5c5/SU2_PY/SU2/io/config.py#L261-L304
wxWidgets/wxPython-Classic
19571e1ae65f1ac445f5491474121998c97a1bf0
wx/tools/Editra/src/ed_cmdbar.py
python
PopupList.SetStringSelection
(self, text)
Set the list selection by using a string value @param text: string to select in list
Set the list selection by using a string value @param text: string to select in list
[ "Set", "the", "list", "selection", "by", "using", "a", "string", "value", "@param", "text", ":", "string", "to", "select", "in", "list" ]
def SetStringSelection(self, text): """Set the list selection by using a string value @param text: string to select in list """ self._list.SetStringSelection(text)
[ "def", "SetStringSelection", "(", "self", ",", "text", ")", ":", "self", ".", "_list", ".", "SetStringSelection", "(", "text", ")" ]
https://github.com/wxWidgets/wxPython-Classic/blob/19571e1ae65f1ac445f5491474121998c97a1bf0/wx/tools/Editra/src/ed_cmdbar.py#L1224-L1229
ApolloAuto/apollo-platform
86d9dc6743b496ead18d597748ebabd34a513289
ros/third_party/lib_x86_64/python2.7/dist-packages/numpy/distutils/exec_command.py
python
exec_command
( command, execute_in='', use_shell=None, use_tee = None, _with_python = 1, **env )
return st
Return (status,output) of executed command. command is a concatenated string of executable and arguments. The output contains both stdout and stderr messages. The following special keyword arguments can be used: use_shell - execute `sh -c command` use_tee - pipe the output of command through ...
Return (status,output) of executed command.
[ "Return", "(", "status", "output", ")", "of", "executed", "command", "." ]
def exec_command( command, execute_in='', use_shell=None, use_tee = None, _with_python = 1, **env ): """ Return (status,output) of executed command. command is a concatenated string of executable and arguments. The output contains both stdout and stderr...
[ "def", "exec_command", "(", "command", ",", "execute_in", "=", "''", ",", "use_shell", "=", "None", ",", "use_tee", "=", "None", ",", "_with_python", "=", "1", ",", "*", "*", "env", ")", ":", "log", ".", "debug", "(", "'exec_command(%r,%s)'", "%", "(",...
https://github.com/ApolloAuto/apollo-platform/blob/86d9dc6743b496ead18d597748ebabd34a513289/ros/third_party/lib_x86_64/python2.7/dist-packages/numpy/distutils/exec_command.py#L157-L230
microsoft/TSS.MSR
0f2516fca2cd9929c31d5450e39301c9bde43688
TSS.Py/src/TpmTypes.py
python
TPM2_ReadPublic_REQUEST.__init__
(self, objectHandle = TPM_HANDLE())
This command allows access to the public area of a loaded object. Attributes: objectHandle (TPM_HANDLE): TPM handle of an object Auth Index: None
This command allows access to the public area of a loaded object.
[ "This", "command", "allows", "access", "to", "the", "public", "area", "of", "a", "loaded", "object", "." ]
def __init__(self, objectHandle = TPM_HANDLE()): """ This command allows access to the public area of a loaded object. Attributes: objectHandle (TPM_HANDLE): TPM handle of an object Auth Index: None """ self.objectHandle = objectHandle
[ "def", "__init__", "(", "self", ",", "objectHandle", "=", "TPM_HANDLE", "(", ")", ")", ":", "self", ".", "objectHandle", "=", "objectHandle" ]
https://github.com/microsoft/TSS.MSR/blob/0f2516fca2cd9929c31d5450e39301c9bde43688/TSS.Py/src/TpmTypes.py#L9752-L9759
ApolloAuto/apollo
463fb82f9e979d02dcb25044e60931293ab2dba0
modules/tools/vehicle_calibration/data_collector.py
python
main
()
Main function
Main function
[ "Main", "function" ]
def main(): """ Main function """ node = cyber.Node("data_collector") data_collector = DataCollector(node) plotter = Plotter() node.create_reader('/apollo/localization/pose', localization_pb2.LocalizationEstimate, data_collector.callback_localiz...
[ "def", "main", "(", ")", ":", "node", "=", "cyber", ".", "Node", "(", "\"data_collector\"", ")", "data_collector", "=", "DataCollector", "(", "node", ")", "plotter", "=", "Plotter", "(", ")", "node", ".", "create_reader", "(", "'/apollo/localization/pose'", ...
https://github.com/ApolloAuto/apollo/blob/463fb82f9e979d02dcb25044e60931293ab2dba0/modules/tools/vehicle_calibration/data_collector.py#L188-L231
tensorflow/tensorflow
419e3a6b650ea4bd1b0cba23c4348f8a69f3272e
tensorflow/python/debug/cli/base_ui.py
python
BaseUI.register_command_handler
(self, prefix, handler, help_info, prefix_aliases=None)
A wrapper around CommandHandlerRegistry.register_command_handler(). In addition to calling the wrapped register_command_handler() method, this method also registers the top-level tab-completion context based on the command prefixes and their aliases. See the doc string of the wrapped method for more d...
A wrapper around CommandHandlerRegistry.register_command_handler().
[ "A", "wrapper", "around", "CommandHandlerRegistry", ".", "register_command_handler", "()", "." ]
def register_command_handler(self, prefix, handler, help_info, prefix_aliases=None): """A wrapper around CommandHandlerRegistry.register_command_handler(). In addition to calling the wrap...
[ "def", "register_command_handler", "(", "self", ",", "prefix", ",", "handler", ",", "help_info", ",", "prefix_aliases", "=", "None", ")", ":", "self", ".", "_command_handler_registry", ".", "register_command_handler", "(", "prefix", ",", "handler", ",", "help_info...
https://github.com/tensorflow/tensorflow/blob/419e3a6b650ea4bd1b0cba23c4348f8a69f3272e/tensorflow/python/debug/cli/base_ui.py#L78-L103
adobe/chromium
cfe5bf0b51b1f6b9fe239c2a3c2f2364da9967d7
third_party/tlslite/tlslite/Checker.py
python
Checker.__call__
(self, connection)
Check a TLSConnection. When a Checker is passed to a handshake function, this will be called at the end of the function. @type connection: L{tlslite.TLSConnection.TLSConnection} @param connection: The TLSConnection to examine. @raise tlslite.errors.TLSAuthenticationError: If t...
Check a TLSConnection.
[ "Check", "a", "TLSConnection", "." ]
def __call__(self, connection): """Check a TLSConnection. When a Checker is passed to a handshake function, this will be called at the end of the function. @type connection: L{tlslite.TLSConnection.TLSConnection} @param connection: The TLSConnection to examine. @raise ...
[ "def", "__call__", "(", "self", ",", "connection", ")", ":", "if", "not", "self", ".", "checkResumedSession", "and", "connection", ".", "resumed", ":", "return", "if", "self", ".", "cryptoID", "or", "self", ".", "x509Fingerprint", "or", "self", ".", "x509T...
https://github.com/adobe/chromium/blob/cfe5bf0b51b1f6b9fe239c2a3c2f2364da9967d7/third_party/tlslite/tlslite/Checker.py#L89-L145
pmq20/node-packer
12c46c6e44fbc14d9ee645ebd17d5296b324f7e0
current/deps/v8/tools/run_perf.py
python
TraceConfig.ConsumeOutput
(self, output, result_tracker)
return result
Extracts trace results from the output. Args: output: Output object from the test run. result_tracker: Result tracker to be updated. Returns: The raw extracted result value or None if an error occurred.
Extracts trace results from the output.
[ "Extracts", "trace", "results", "from", "the", "output", "." ]
def ConsumeOutput(self, output, result_tracker): """Extracts trace results from the output. Args: output: Output object from the test run. result_tracker: Result tracker to be updated. Returns: The raw extracted result value or None if an error occurred. """ result = None std...
[ "def", "ConsumeOutput", "(", "self", ",", "output", ",", "result_tracker", ")", ":", "result", "=", "None", "stddev", "=", "None", "try", ":", "result", "=", "float", "(", "re", ".", "search", "(", "self", ".", "results_regexp", ",", "output", ".", "st...
https://github.com/pmq20/node-packer/blob/12c46c6e44fbc14d9ee645ebd17d5296b324f7e0/current/deps/v8/tools/run_perf.py#L400-L439
hanpfei/chromium-net
392cc1fa3a8f92f42e4071ab6e674d8e0482f83f
third_party/catapult/telemetry/build/linux_setup_msr.py
python
_CheckMsrDevNodes
()
return True
Check whether the MSR /dev files have the right permissions.
Check whether the MSR /dev files have the right permissions.
[ "Check", "whether", "the", "MSR", "/", "dev", "files", "have", "the", "right", "permissions", "." ]
def _CheckMsrDevNodes(): """Check whether the MSR /dev files have the right permissions.""" if not os.path.exists(MSR_DEV_FILE_PATH): print 'Error: %s does not exist.' % MSR_DEV_FILE_PATH return False if not os.access(MSR_DEV_FILE_PATH, os.R_OK): print 'Error: Cannot read from %s' % MSR_DEV_FILE_PATH...
[ "def", "_CheckMsrDevNodes", "(", ")", ":", "if", "not", "os", ".", "path", ".", "exists", "(", "MSR_DEV_FILE_PATH", ")", ":", "print", "'Error: %s does not exist.'", "%", "MSR_DEV_FILE_PATH", "return", "False", "if", "not", "os", ".", "access", "(", "MSR_DEV_F...
https://github.com/hanpfei/chromium-net/blob/392cc1fa3a8f92f42e4071ab6e674d8e0482f83f/third_party/catapult/telemetry/build/linux_setup_msr.py#L45-L55
LLNL/lbann
26083e6c86050302ce33148aea70f62e61cacb92
python/lbann/launcher/slurm.py
python
SlurmBatchScript.__init__
(self, script_file=None, work_dir=os.getcwd(), nodes=1, procs_per_node=1, time_limit=None, job_name=None, partition=None, account=None, launcher='srun', ...
Construct Slurm batch script manager. Args: script_file (str): Script file. work_dir (str, optional): Working directory (default: current working directory). nodes (int, optional): Number of compute nodes (default: 1). procs_per_no...
Construct Slurm batch script manager.
[ "Construct", "Slurm", "batch", "script", "manager", "." ]
def __init__(self, script_file=None, work_dir=os.getcwd(), nodes=1, procs_per_node=1, time_limit=None, job_name=None, partition=None, account=None, launcher='srun', ...
[ "def", "__init__", "(", "self", ",", "script_file", "=", "None", ",", "work_dir", "=", "os", ".", "getcwd", "(", ")", ",", "nodes", "=", "1", ",", "procs_per_node", "=", "1", ",", "time_limit", "=", "None", ",", "job_name", "=", "None", ",", "partiti...
https://github.com/LLNL/lbann/blob/26083e6c86050302ce33148aea70f62e61cacb92/python/lbann/launcher/slurm.py#L19-L85
wxWidgets/wxPython-Classic
19571e1ae65f1ac445f5491474121998c97a1bf0
src/msw/stc.py
python
StyledTextCtrl.SetFoldMarginHiColour
(*args, **kwargs)
return _stc.StyledTextCtrl_SetFoldMarginHiColour(*args, **kwargs)
SetFoldMarginHiColour(self, bool useSetting, Colour fore)
SetFoldMarginHiColour(self, bool useSetting, Colour fore)
[ "SetFoldMarginHiColour", "(", "self", "bool", "useSetting", "Colour", "fore", ")" ]
def SetFoldMarginHiColour(*args, **kwargs): """SetFoldMarginHiColour(self, bool useSetting, Colour fore)""" return _stc.StyledTextCtrl_SetFoldMarginHiColour(*args, **kwargs)
[ "def", "SetFoldMarginHiColour", "(", "*", "args", ",", "*", "*", "kwargs", ")", ":", "return", "_stc", ".", "StyledTextCtrl_SetFoldMarginHiColour", "(", "*", "args", ",", "*", "*", "kwargs", ")" ]
https://github.com/wxWidgets/wxPython-Classic/blob/19571e1ae65f1ac445f5491474121998c97a1bf0/src/msw/stc.py#L4322-L4324
google/llvm-propeller
45c226984fe8377ebfb2ad7713c680d652ba678d
lldb/utils/lui/lldbutil.py
python
which
(program)
return None
Returns the full path to a program; None otherwise.
Returns the full path to a program; None otherwise.
[ "Returns", "the", "full", "path", "to", "a", "program", ";", "None", "otherwise", "." ]
def which(program): """Returns the full path to a program; None otherwise.""" fpath, fname = os.path.split(program) if fpath: if is_exe(program): return program else: for path in os.environ["PATH"].split(os.pathsep): exe_file = os.path.join(path, program) ...
[ "def", "which", "(", "program", ")", ":", "fpath", ",", "fname", "=", "os", ".", "path", ".", "split", "(", "program", ")", "if", "fpath", ":", "if", "is_exe", "(", "program", ")", ":", "return", "program", "else", ":", "for", "path", "in", "os", ...
https://github.com/google/llvm-propeller/blob/45c226984fe8377ebfb2ad7713c680d652ba678d/lldb/utils/lui/lldbutil.py#L32-L43
Genius-x/genius-x
9fc9f194e6d1fb92dd0e33d43db19ddb67cda7b0
cocos2d/tools/bindings-generator/clang/cindex.py
python
CompilationDatabase.getCompileCommands
(self, filename)
return conf.lib.clang_CompilationDatabase_getCompileCommands(self, filename)
Get an iterable object providing all the CompileCommands available to build filename. Returns None if filename is not found in the database.
Get an iterable object providing all the CompileCommands available to build filename. Returns None if filename is not found in the database.
[ "Get", "an", "iterable", "object", "providing", "all", "the", "CompileCommands", "available", "to", "build", "filename", ".", "Returns", "None", "if", "filename", "is", "not", "found", "in", "the", "database", "." ]
def getCompileCommands(self, filename): """ Get an iterable object providing all the CompileCommands available to build filename. Returns None if filename is not found in the database. """ return conf.lib.clang_CompilationDatabase_getCompileCommands(self, ...
[ "def", "getCompileCommands", "(", "self", ",", "filename", ")", ":", "return", "conf", ".", "lib", ".", "clang_CompilationDatabase_getCompileCommands", "(", "self", ",", "filename", ")" ]
https://github.com/Genius-x/genius-x/blob/9fc9f194e6d1fb92dd0e33d43db19ddb67cda7b0/cocos2d/tools/bindings-generator/clang/cindex.py#L2641-L2647
wxWidgets/wxPython-Classic
19571e1ae65f1ac445f5491474121998c97a1bf0
src/gtk/stc.py
python
StyledTextCtrl.StyleSetBackground
(*args, **kwargs)
return _stc.StyledTextCtrl_StyleSetBackground(*args, **kwargs)
StyleSetBackground(self, int style, Colour back) Set the background colour of a style.
StyleSetBackground(self, int style, Colour back)
[ "StyleSetBackground", "(", "self", "int", "style", "Colour", "back", ")" ]
def StyleSetBackground(*args, **kwargs): """ StyleSetBackground(self, int style, Colour back) Set the background colour of a style. """ return _stc.StyledTextCtrl_StyleSetBackground(*args, **kwargs)
[ "def", "StyleSetBackground", "(", "*", "args", ",", "*", "*", "kwargs", ")", ":", "return", "_stc", ".", "StyledTextCtrl_StyleSetBackground", "(", "*", "args", ",", "*", "*", "kwargs", ")" ]
https://github.com/wxWidgets/wxPython-Classic/blob/19571e1ae65f1ac445f5491474121998c97a1bf0/src/gtk/stc.py#L2522-L2528
ricardoquesada/Spidermonkey
4a75ea2543408bd1b2c515aa95901523eeef7858
dom/bindings/parser/WebIDL.py
python
Parser.p_Const
(self, p)
Const : CONST ConstType IDENTIFIER EQUALS ConstValue SEMICOLON
Const : CONST ConstType IDENTIFIER EQUALS ConstValue SEMICOLON
[ "Const", ":", "CONST", "ConstType", "IDENTIFIER", "EQUALS", "ConstValue", "SEMICOLON" ]
def p_Const(self, p): """ Const : CONST ConstType IDENTIFIER EQUALS ConstValue SEMICOLON """ location = self.getLocation(p, 1) type = p[2] identifier = IDLUnresolvedIdentifier(self.getLocation(p, 3), p[3]) value = p[5] p[0] = IDLConst(location, identif...
[ "def", "p_Const", "(", "self", ",", "p", ")", ":", "location", "=", "self", ".", "getLocation", "(", "p", ",", "1", ")", "type", "=", "p", "[", "2", "]", "identifier", "=", "IDLUnresolvedIdentifier", "(", "self", ".", "getLocation", "(", "p", ",", ...
https://github.com/ricardoquesada/Spidermonkey/blob/4a75ea2543408bd1b2c515aa95901523eeef7858/dom/bindings/parser/WebIDL.py#L4554-L4562
SequoiaDB/SequoiaDB
2894ed7e5bd6fe57330afc900cf76d0ff0df9f64
tools/server/php_linux/libxml2/lib/python2.4/site-packages/libxml2.py
python
xmlNode.newTextChild
(self, ns, name, content)
return __tmp
Creation of a new child element, added at the end of @parent children list. @ns and @content parameters are optional (None). If @ns is None, the newly created element inherits the namespace of @parent. If @content is non None, a child TEXT node will be created containing the stri...
Creation of a new child element, added at the end of
[ "Creation", "of", "a", "new", "child", "element", "added", "at", "the", "end", "of" ]
def newTextChild(self, ns, name, content): """Creation of a new child element, added at the end of @parent children list. @ns and @content parameters are optional (None). If @ns is None, the newly created element inherits the namespace of @parent. If @content is non None, ...
[ "def", "newTextChild", "(", "self", ",", "ns", ",", "name", ",", "content", ")", ":", "if", "ns", "is", "None", ":", "ns__o", "=", "None", "else", ":", "ns__o", "=", "ns", ".", "_o", "ret", "=", "libxml2mod", ".", "xmlNewTextChild", "(", "self", "....
https://github.com/SequoiaDB/SequoiaDB/blob/2894ed7e5bd6fe57330afc900cf76d0ff0df9f64/tools/server/php_linux/libxml2/lib/python2.4/site-packages/libxml2.py#L3353-L3370
chromiumembedded/cef
80caf947f3fe2210e5344713c5281d8af9bdc295
tools/yapf/yapf/yapflib/format_token.py
python
FormatToken.must_split
(self)
return pytree_utils.GetNodeAnnotation(self.node, pytree_utils.Annotation.MUST_SPLIT)
Return true if the token requires a split before it.
Return true if the token requires a split before it.
[ "Return", "true", "if", "the", "token", "requires", "a", "split", "before", "it", "." ]
def must_split(self): """Return true if the token requires a split before it.""" return pytree_utils.GetNodeAnnotation(self.node, pytree_utils.Annotation.MUST_SPLIT)
[ "def", "must_split", "(", "self", ")", ":", "return", "pytree_utils", ".", "GetNodeAnnotation", "(", "self", ".", "node", ",", "pytree_utils", ".", "Annotation", ".", "MUST_SPLIT", ")" ]
https://github.com/chromiumembedded/cef/blob/80caf947f3fe2210e5344713c5281d8af9bdc295/tools/yapf/yapf/yapflib/format_token.py#L202-L205
sfzhang15/RefineDet
52b6fe23dc1a160fe710b7734576dca509bf4fae
scripts/cpp_lint.py
python
_CppLintState.SetVerboseLevel
(self, level)
return last_verbose_level
Sets the module's verbosity, and returns the previous setting.
Sets the module's verbosity, and returns the previous setting.
[ "Sets", "the", "module", "s", "verbosity", "and", "returns", "the", "previous", "setting", "." ]
def SetVerboseLevel(self, level): """Sets the module's verbosity, and returns the previous setting.""" last_verbose_level = self.verbose_level self.verbose_level = level return last_verbose_level
[ "def", "SetVerboseLevel", "(", "self", ",", "level", ")", ":", "last_verbose_level", "=", "self", ".", "verbose_level", "self", ".", "verbose_level", "=", "level", "return", "last_verbose_level" ]
https://github.com/sfzhang15/RefineDet/blob/52b6fe23dc1a160fe710b7734576dca509bf4fae/scripts/cpp_lint.py#L707-L711
DLR-SC/tigl
d1c5901e948e33d10b1f9659ff3e22c4717b455f
thirdparty/nsiqcppstyle/nsiqcppstyle_checker.py
python
t_COMMENT
(t)
return t
r'/\*(.|\n)*?\*/
r'/\*(.|\n)*?\*/
[ "r", "/", "\\", "*", "(", ".", "|", "\\", "n", ")", "*", "?", "\\", "*", "/" ]
def t_COMMENT(t): r'/\*(.|\n)*?\*/' t.lexer.lineno += t.value.count('\n') if Search(r"/\*\*\s", t.value) : t.additional = 'DOXYGEN' return t
[ "def", "t_COMMENT", "(", "t", ")", ":", "t", ".", "lexer", ".", "lineno", "+=", "t", ".", "value", ".", "count", "(", "'\\n'", ")", "if", "Search", "(", "r\"/\\*\\*\\s\"", ",", "t", ".", "value", ")", ":", "t", ".", "additional", "=", "'DOXYGEN'", ...
https://github.com/DLR-SC/tigl/blob/d1c5901e948e33d10b1f9659ff3e22c4717b455f/thirdparty/nsiqcppstyle/nsiqcppstyle_checker.py#L291-L296
aws/lumberyard
f85344403c1c2e77ec8c75deb2c116e97b713217
dev/Tools/build/waf-1.7.13/waflib/Tools/gxx.py
python
configure
(conf)
Configuration for g++
Configuration for g++
[ "Configuration", "for", "g", "++" ]
def configure(conf): """ Configuration for g++ """ conf.find_gxx() conf.find_ar() conf.gxx_common_flags() conf.gxx_modifier_platform() conf.cxx_load_tools() conf.cxx_add_flags() conf.link_add_flags()
[ "def", "configure", "(", "conf", ")", ":", "conf", ".", "find_gxx", "(", ")", "conf", ".", "find_ar", "(", ")", "conf", ".", "gxx_common_flags", "(", ")", "conf", ".", "gxx_modifier_platform", "(", ")", "conf", ".", "cxx_load_tools", "(", ")", "conf", ...
https://github.com/aws/lumberyard/blob/f85344403c1c2e77ec8c75deb2c116e97b713217/dev/Tools/build/waf-1.7.13/waflib/Tools/gxx.py#L143-L153
HANDS-FREE/handsfree
3766907a44d46828cc9de462c1126ceeb8e14061
handsfree_smach/script/RadianTurn.py
python
RadianTurn.turn_to_target
(self, radian_to_turn=0.0)
to make robot turn target_radian radians :param: target_radian: the target radian that robot needs to turn :type: float :return:
to make robot turn target_radian radians :param: target_radian: the target radian that robot needs to turn :type: float :return:
[ "to", "make", "robot", "turn", "target_radian", "radians", ":", "param", ":", "target_radian", ":", "the", "target", "radian", "that", "robot", "needs", "to", "turn", ":", "type", ":", "float", ":", "return", ":" ]
def turn_to_target(self, radian_to_turn=0.0): """ to make robot turn target_radian radians :param: target_radian: the target radian that robot needs to turn :type: float :return: """ # the range of yaw of odom is -pi ~ pi, we transform it to 0 ~ 2*pi robot...
[ "def", "turn_to_target", "(", "self", ",", "radian_to_turn", "=", "0.0", ")", ":", "# the range of yaw of odom is -pi ~ pi, we transform it to 0 ~ 2*pi", "robot_start_yaw", "=", "(", "self", ".", "__get_robot_pos", "(", ")", "+", "math", ".", "pi", "*", "2", ")", ...
https://github.com/HANDS-FREE/handsfree/blob/3766907a44d46828cc9de462c1126ceeb8e14061/handsfree_smach/script/RadianTurn.py#L33-L64