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
NVIDIA/DALI
bf16cc86ba8f091b145f91962f21fe1b6aff243d
dali/python/nvidia/dali/pipeline.py
python
Pipeline._check_api_type_scope
(self, type)
return api_checker(self)
Checks the API currently used by pipeline and throws an error if it differs It helps preventing of mixing simple, iterator and scheduled based API for pipeline run. Disables further checks in its scope
Checks the API currently used by pipeline and throws an error if it differs
[ "Checks", "the", "API", "currently", "used", "by", "pipeline", "and", "throws", "an", "error", "if", "it", "differs" ]
def _check_api_type_scope(self, type): """Checks the API currently used by pipeline and throws an error if it differs It helps preventing of mixing simple, iterator and scheduled based API for pipeline run. Disables further checks in its scope """ if not self._skip_api_check: ...
[ "def", "_check_api_type_scope", "(", "self", ",", "type", ")", ":", "if", "not", "self", ".", "_skip_api_check", ":", "self", ".", "_check_api_type", "(", "type", ")", "class", "api_checker", "(", ")", ":", "def", "__init__", "(", "self", ",", "pipe", ")...
https://github.com/NVIDIA/DALI/blob/bf16cc86ba8f091b145f91962f21fe1b6aff243d/dali/python/nvidia/dali/pipeline.py#L479-L499
catboost/catboost
167f64f237114a4d10b2b4ee42adb4569137debe
contrib/python/ipython/py3/IPython/core/formatters.py
python
JSONFormatter._check_return
(self, r, obj)
return super(JSONFormatter, self)._check_return(r, obj)
Check that a return value is appropriate Return the value if so, None otherwise, warning if invalid.
Check that a return value is appropriate Return the value if so, None otherwise, warning if invalid.
[ "Check", "that", "a", "return", "value", "is", "appropriate", "Return", "the", "value", "if", "so", "None", "otherwise", "warning", "if", "invalid", "." ]
def _check_return(self, r, obj): """Check that a return value is appropriate Return the value if so, None otherwise, warning if invalid. """ if r is None: return md = None if isinstance(r, tuple): # unpack data, metadata tuple for type che...
[ "def", "_check_return", "(", "self", ",", "r", ",", "obj", ")", ":", "if", "r", "is", "None", ":", "return", "md", "=", "None", "if", "isinstance", "(", "r", ",", "tuple", ")", ":", "# unpack data, metadata tuple for type checking on first element", "r", ","...
https://github.com/catboost/catboost/blob/167f64f237114a4d10b2b4ee42adb4569137debe/contrib/python/ipython/py3/IPython/core/formatters.py#L824-L845
LiquidPlayer/LiquidCore
9405979363f2353ac9a71ad8ab59685dd7f919c9
deps/boost_1_66_0/libs/metaparse/tools/build_environment.py
python
main
()
The main function of the utility
The main function of the utility
[ "The", "main", "function", "of", "the", "utility" ]
def main(): """The main function of the utility""" parser = argparse.ArgumentParser( description='Manage the build environment of Boost.Metaparse' ) parser.add_argument( '--dep_json', required=True, help='The json file describing the dependencies' ) parser.add_arg...
[ "def", "main", "(", ")", ":", "parser", "=", "argparse", ".", "ArgumentParser", "(", "description", "=", "'Manage the build environment of Boost.Metaparse'", ")", "parser", ".", "add_argument", "(", "'--dep_json'", ",", "required", "=", "True", ",", "help", "=", ...
https://github.com/LiquidPlayer/LiquidCore/blob/9405979363f2353ac9a71ad8ab59685dd7f919c9/deps/boost_1_66_0/libs/metaparse/tools/build_environment.py#L81-L130
syoyo/tinygltf
e7f1ff5c59d3ca2489923beb239bdf93d863498f
deps/cpplint.py
python
CheckVlogArguments
(filename, clean_lines, linenum, error)
Checks that VLOG() is only used for defining a logging level. For example, VLOG(2) is correct. VLOG(INFO), VLOG(WARNING), VLOG(ERROR), and VLOG(FATAL) are not. Args: filename: The name of the current file. clean_lines: A CleansedLines instance containing the file. linenum: The number of the line to ...
Checks that VLOG() is only used for defining a logging level.
[ "Checks", "that", "VLOG", "()", "is", "only", "used", "for", "defining", "a", "logging", "level", "." ]
def CheckVlogArguments(filename, clean_lines, linenum, error): """Checks that VLOG() is only used for defining a logging level. For example, VLOG(2) is correct. VLOG(INFO), VLOG(WARNING), VLOG(ERROR), and VLOG(FATAL) are not. Args: filename: The name of the current file. clean_lines: A CleansedLines i...
[ "def", "CheckVlogArguments", "(", "filename", ",", "clean_lines", ",", "linenum", ",", "error", ")", ":", "line", "=", "clean_lines", ".", "elided", "[", "linenum", "]", "if", "Search", "(", "r'\\bVLOG\\((INFO|ERROR|WARNING|DFATAL|FATAL)\\)'", ",", "line", ")", ...
https://github.com/syoyo/tinygltf/blob/e7f1ff5c59d3ca2489923beb239bdf93d863498f/deps/cpplint.py#L1937-L1953
DLR-SC/tigl
d1c5901e948e33d10b1f9659ff3e22c4717b455f
bindings/bindings_generator/fortran03_generator.py
python
Fortran03Generator.create_method_wrapper
(self, method_name, fun_dec)
return string
Generates the Fortran 2003 wrapper code around a c function call
Generates the Fortran 2003 wrapper code around a c function call
[ "Generates", "the", "Fortran", "2003", "wrapper", "code", "around", "a", "c", "function", "call" ]
def create_method_wrapper(self, method_name, fun_dec): ''' Generates the Fortran 2003 wrapper code around a c function call ''' string = '' header, footer = self.create_method_declaration(method_name, fun_dec, 'F') # generate conversion stuff var_alias =...
[ "def", "create_method_wrapper", "(", "self", ",", "method_name", ",", "fun_dec", ")", ":", "string", "=", "''", "header", ",", "footer", "=", "self", ".", "create_method_declaration", "(", "method_name", ",", "fun_dec", ",", "'F'", ")", "# generate conversion st...
https://github.com/DLR-SC/tigl/blob/d1c5901e948e33d10b1f9659ff3e22c4717b455f/bindings/bindings_generator/fortran03_generator.py#L303-L367
mongodb/mongo
d8ff665343ad29cf286ee2cf4a1960d29371937b
buildscripts/idl/idl/generator.py
python
_CppHeaderFileWriter.gen_member
(self, field)
Generate the C++ class member definition for a field.
Generate the C++ class member definition for a field.
[ "Generate", "the", "C", "++", "class", "member", "definition", "for", "a", "field", "." ]
def gen_member(self, field): # type: (ast.Field) -> None """Generate the C++ class member definition for a field.""" cpp_type_info = cpp_types.get_cpp_type(field) member_type = cpp_type_info.get_storage_type() member_name = _get_field_member_name(field) if field.default ...
[ "def", "gen_member", "(", "self", ",", "field", ")", ":", "# type: (ast.Field) -> None", "cpp_type_info", "=", "cpp_types", ".", "get_cpp_type", "(", "field", ")", "member_type", "=", "cpp_type_info", ".", "get_storage_type", "(", ")", "member_name", "=", "_get_fi...
https://github.com/mongodb/mongo/blob/d8ff665343ad29cf286ee2cf4a1960d29371937b/buildscripts/idl/idl/generator.py#L613-L627
natanielruiz/android-yolo
1ebb54f96a67a20ff83ddfc823ed83a13dc3a47f
jni-build/jni/include/tensorflow/python/client/timeline.py
python
_ChromeTraceFormatter.emit_obj_snapshot
(self, category, name, timestamp, pid, tid, object_id, snapshot)
Adds an object snapshot event to the trace. Args: category: The event category as a string. name: The event name as a string. timestamp: The timestamp of this event as a long integer. pid: Identifier of the process generating this event as an integer. tid: Identifier of the thread...
Adds an object snapshot event to the trace.
[ "Adds", "an", "object", "snapshot", "event", "to", "the", "trace", "." ]
def emit_obj_snapshot(self, category, name, timestamp, pid, tid, object_id, snapshot): """Adds an object snapshot event to the trace. Args: category: The event category as a string. name: The event name as a string. timestamp: The timestamp of this event as a long in...
[ "def", "emit_obj_snapshot", "(", "self", ",", "category", ",", "name", ",", "timestamp", ",", "pid", ",", "tid", ",", "object_id", ",", "snapshot", ")", ":", "event", "=", "self", ".", "_create_event", "(", "'O'", ",", "category", ",", "name", ",", "pi...
https://github.com/natanielruiz/android-yolo/blob/1ebb54f96a67a20ff83ddfc823ed83a13dc3a47f/jni-build/jni/include/tensorflow/python/client/timeline.py#L168-L184
wlanjie/AndroidFFmpeg
7baf9122f4b8e1c74e7baf4be5c422c7a5ba5aaf
tools/fdk-aac-build/armeabi-v7a/toolchain/lib/python2.7/lib-tk/Tkinter.py
python
Misc.winfo_manager
(self)
return self.tk.call('winfo', 'manager', self._w)
Return the window mananger name for this widget.
Return the window mananger name for this widget.
[ "Return", "the", "window", "mananger", "name", "for", "this", "widget", "." ]
def winfo_manager(self): """Return the window mananger name for this widget.""" return self.tk.call('winfo', 'manager', self._w)
[ "def", "winfo_manager", "(", "self", ")", ":", "return", "self", ".", "tk", ".", "call", "(", "'winfo'", ",", "'manager'", ",", "self", ".", "_w", ")" ]
https://github.com/wlanjie/AndroidFFmpeg/blob/7baf9122f4b8e1c74e7baf4be5c422c7a5ba5aaf/tools/fdk-aac-build/armeabi-v7a/toolchain/lib/python2.7/lib-tk/Tkinter.py#L795-L797
esa/pagmo
80281d549c8f1b470e1489a5d37c8f06b2e429c0
PyGMO/algorithm/__init__.py
python
_de_ctor
( self, gen=100, f=0.8, cr=0.9, variant=2, ftol=1e-6, xtol=1e-6, screen_output=False)
Constructs a Differential Evolution algorithm: USAGE: algorithm.de(gen=1, f=0.5, cr=0.9, variant=2, ftol=1e-6, xtol=1e-6, screen_output = False) * gen: number of generations * f: weighting factor in [0,1] (if -1 self-adptation is used) * cr: crossover in [0,1] (if -1 self-adptation is used) * vari...
Constructs a Differential Evolution algorithm:
[ "Constructs", "a", "Differential", "Evolution", "algorithm", ":" ]
def _de_ctor( self, gen=100, f=0.8, cr=0.9, variant=2, ftol=1e-6, xtol=1e-6, screen_output=False): """ Constructs a Differential Evolution algorithm: USAGE: algorithm.de(gen=1, f=0.5, cr=0.9, variant=2, ftol=1e-6, xtol=1e-6, screen_output = Fa...
[ "def", "_de_ctor", "(", "self", ",", "gen", "=", "100", ",", "f", "=", "0.8", ",", "cr", "=", "0.9", ",", "variant", "=", "2", ",", "ftol", "=", "1e-6", ",", "xtol", "=", "1e-6", ",", "screen_output", "=", "False", ")", ":", "# We set the defaults ...
https://github.com/esa/pagmo/blob/80281d549c8f1b470e1489a5d37c8f06b2e429c0/PyGMO/algorithm/__init__.py#L39-L79
wxWidgets/wxPython-Classic
19571e1ae65f1ac445f5491474121998c97a1bf0
src/msw/_controls.py
python
PreDatePickerCtrl
(*args, **kwargs)
return val
PreDatePickerCtrl() -> DatePickerCtrl Precreate a DatePickerCtrl for use in 2-phase creation.
PreDatePickerCtrl() -> DatePickerCtrl
[ "PreDatePickerCtrl", "()", "-", ">", "DatePickerCtrl" ]
def PreDatePickerCtrl(*args, **kwargs): """ PreDatePickerCtrl() -> DatePickerCtrl Precreate a DatePickerCtrl for use in 2-phase creation. """ val = _controls_.new_PreDatePickerCtrl(*args, **kwargs) return val
[ "def", "PreDatePickerCtrl", "(", "*", "args", ",", "*", "*", "kwargs", ")", ":", "val", "=", "_controls_", ".", "new_PreDatePickerCtrl", "(", "*", "args", ",", "*", "*", "kwargs", ")", "return", "val" ]
https://github.com/wxWidgets/wxPython-Classic/blob/19571e1ae65f1ac445f5491474121998c97a1bf0/src/msw/_controls.py#L6541-L6548
gyunaev/birdtray
e9ddee108b3cdb9d668df88b3400205586ac9316
.github/scripts/checkTranslation.py
python
TranslationHandler._checkFormatSpecifiers
(self)
Check for problems with format specifiers.
Check for problems with format specifiers.
[ "Check", "for", "problems", "with", "format", "specifiers", "." ]
def _checkFormatSpecifiers(self): """ Check for problems with format specifiers. """ for formatSpecifierRegex in self._formatSpecifierRegexes: sourceSpecifiers = set(formatSpecifierRegex.findall(self._source)) translationSpecifiers = set(formatSpecifierRegex.findall(self._transla...
[ "def", "_checkFormatSpecifiers", "(", "self", ")", ":", "for", "formatSpecifierRegex", "in", "self", ".", "_formatSpecifierRegexes", ":", "sourceSpecifiers", "=", "set", "(", "formatSpecifierRegex", ".", "findall", "(", "self", ".", "_source", ")", ")", "translati...
https://github.com/gyunaev/birdtray/blob/e9ddee108b3cdb9d668df88b3400205586ac9316/.github/scripts/checkTranslation.py#L506-L518
cvxpy/cvxpy
5165b4fb750dfd237de8659383ef24b4b2e33aaf
cvxpy/reductions/solvers/conic_solvers/cplex_conif.py
python
get_status
(model)
Map CPLEX status to CPXPY status.
Map CPLEX status to CPXPY status.
[ "Map", "CPLEX", "status", "to", "CPXPY", "status", "." ]
def get_status(model): """Map CPLEX status to CPXPY status.""" pfeas = model.solution.is_primal_feasible() # NOTE: dfeas is always false for a MIP. dfeas = model.solution.is_dual_feasible() status = model.solution.status solstat = _handle_solve_status(model, model.solution.get_status()) if s...
[ "def", "get_status", "(", "model", ")", ":", "pfeas", "=", "model", ".", "solution", ".", "is_primal_feasible", "(", ")", "# NOTE: dfeas is always false for a MIP.", "dfeas", "=", "model", ".", "solution", ".", "is_dual_feasible", "(", ")", "status", "=", "model...
https://github.com/cvxpy/cvxpy/blob/5165b4fb750dfd237de8659383ef24b4b2e33aaf/cvxpy/reductions/solvers/conic_solvers/cplex_conif.py#L144-L201
H-uru/Plasma
c2140ea046e82e9c199e257a7f2e7edb42602871
Scripts/Python/xDialogClothingBB.py
python
xDialogClothingBB.IWhatPantsAmIWearing
(self,avatar)
return kNoPantsIdx
Find out what pants we are already wearing - returns index
Find out what pants we are already wearing - returns index
[ "Find", "out", "what", "pants", "we", "are", "already", "wearing", "-", "returns", "index" ]
def IWhatPantsAmIWearing(self,avatar): "Find out what pants we are already wearing - returns index" global PantNames worn = avatar.avatar.getAvatarClothingList() for item in worn: try: pantIdx = PantNames.index(item) return pantIdx ...
[ "def", "IWhatPantsAmIWearing", "(", "self", ",", "avatar", ")", ":", "global", "PantNames", "worn", "=", "avatar", ".", "avatar", ".", "getAvatarClothingList", "(", ")", "for", "item", "in", "worn", ":", "try", ":", "pantIdx", "=", "PantNames", ".", "index...
https://github.com/H-uru/Plasma/blob/c2140ea046e82e9c199e257a7f2e7edb42602871/Scripts/Python/xDialogClothingBB.py#L215-L233
aws/lumberyard
f85344403c1c2e77ec8c75deb2c116e97b713217
dev/Gems/CloudGemMetric/v1/AWS/python/windows/Lib/numpy/ma/extras.py
python
average
(a, axis=None, weights=None, returned=False)
Return the weighted average of array over the given axis. Parameters ---------- a : array_like Data to be averaged. Masked entries are not taken into account in the computation. axis : int, optional Axis along which to average `a`. If None, averaging is done over the fla...
Return the weighted average of array over the given axis.
[ "Return", "the", "weighted", "average", "of", "array", "over", "the", "given", "axis", "." ]
def average(a, axis=None, weights=None, returned=False): """ Return the weighted average of array over the given axis. Parameters ---------- a : array_like Data to be averaged. Masked entries are not taken into account in the computation. axis : int, optional Axis along ...
[ "def", "average", "(", "a", ",", "axis", "=", "None", ",", "weights", "=", "None", ",", "returned", "=", "False", ")", ":", "a", "=", "asarray", "(", "a", ")", "m", "=", "getmask", "(", "a", ")", "# inspired by 'average' in numpy/lib/function_base.py", "...
https://github.com/aws/lumberyard/blob/f85344403c1c2e77ec8c75deb2c116e97b713217/dev/Gems/CloudGemMetric/v1/AWS/python/windows/Lib/numpy/ma/extras.py#L535-L638
hughperkins/tf-coriander
970d3df6c11400ad68405f22b0c42a52374e94ca
tensorflow/contrib/layers/python/layers/summaries.py
python
summarize_activations
(name_filter=None, summarizer=summarize_activation)
return summarize_collection(ops.GraphKeys.ACTIVATIONS, name_filter, summarizer)
Summarize activations, using `summarize_activation` to summarize.
Summarize activations, using `summarize_activation` to summarize.
[ "Summarize", "activations", "using", "summarize_activation", "to", "summarize", "." ]
def summarize_activations(name_filter=None, summarizer=summarize_activation): """Summarize activations, using `summarize_activation` to summarize.""" return summarize_collection(ops.GraphKeys.ACTIVATIONS, name_filter, summarizer)
[ "def", "summarize_activations", "(", "name_filter", "=", "None", ",", "summarizer", "=", "summarize_activation", ")", ":", "return", "summarize_collection", "(", "ops", ".", "GraphKeys", ".", "ACTIVATIONS", ",", "name_filter", ",", "summarizer", ")" ]
https://github.com/hughperkins/tf-coriander/blob/970d3df6c11400ad68405f22b0c42a52374e94ca/tensorflow/contrib/layers/python/layers/summaries.py#L178-L181
freesurfer/freesurfer
6dbe527d43ffa611acb2cd112e9469f9bfec8e36
cnn_sphere_register/ext/neuron/neuron/dataproc.py
python
prior_to_weights
(prior_filename, nargout=1, min_freq=0, force_binary=False, verbose=False)
transform a 4D prior (3D + nb_labels) into a class weight vector
transform a 4D prior (3D + nb_labels) into a class weight vector
[ "transform", "a", "4D", "prior", "(", "3D", "+", "nb_labels", ")", "into", "a", "class", "weight", "vector" ]
def prior_to_weights(prior_filename, nargout=1, min_freq=0, force_binary=False, verbose=False): ''' transform a 4D prior (3D + nb_labels) into a class weight vector ''' # load prior if isinstance(prior_filename, six.string_types): prior = np.load(prior_filename)['prior'] else: prior = ...
[ "def", "prior_to_weights", "(", "prior_filename", ",", "nargout", "=", "1", ",", "min_freq", "=", "0", ",", "force_binary", "=", "False", ",", "verbose", "=", "False", ")", ":", "# load prior", "if", "isinstance", "(", "prior_filename", ",", "six", ".", "s...
https://github.com/freesurfer/freesurfer/blob/6dbe527d43ffa611acb2cd112e9469f9bfec8e36/cnn_sphere_register/ext/neuron/neuron/dataproc.py#L233-L286
toggl-open-source/toggldesktop
91865205885531cc8fd9e8d613dad49d625d56e7
third_party/cpplint/cpplint.py
python
IsBlankLine
(line)
return not line or line.isspace()
Returns true if the given line is blank. We consider a line to be blank if the line is empty or consists of only white spaces. Args: line: A line of a string. Returns: True, if the given line is blank.
Returns true if the given line is blank.
[ "Returns", "true", "if", "the", "given", "line", "is", "blank", "." ]
def IsBlankLine(line): """Returns true if the given line is blank. We consider a line to be blank if the line is empty or consists of only white spaces. Args: line: A line of a string. Returns: True, if the given line is blank. """ return not line or line.isspace()
[ "def", "IsBlankLine", "(", "line", ")", ":", "return", "not", "line", "or", "line", ".", "isspace", "(", ")" ]
https://github.com/toggl-open-source/toggldesktop/blob/91865205885531cc8fd9e8d613dad49d625d56e7/third_party/cpplint/cpplint.py#L2813-L2825
mindspore-ai/mindspore
fb8fd3338605bb34fa5cea054e535a8b1d753fab
mindspore/python/mindspore/numpy/array_creations.py
python
histogram_bin_edges
(a, bins=10, range=None, weights=None)
return linspace(start, end, bins + 1)
Function to calculate only the edges of the bins used by the histogram function. Note: String values for `bins` is not supported. Args: a (Union[int, float, bool, list, tuple, Tensor]): Input data. The histogram is computed over the flattened array. bins ((Union[int, tuple,...
Function to calculate only the edges of the bins used by the histogram function.
[ "Function", "to", "calculate", "only", "the", "edges", "of", "the", "bins", "used", "by", "the", "histogram", "function", "." ]
def histogram_bin_edges(a, bins=10, range=None, weights=None): # pylint: disable=redefined-builtin """ Function to calculate only the edges of the bins used by the histogram function. Note: String values for `bins` is not supported. Args: a (Union[int, float, bool, list, tuple, Tensor]...
[ "def", "histogram_bin_edges", "(", "a", ",", "bins", "=", "10", ",", "range", "=", "None", ",", "weights", "=", "None", ")", ":", "# pylint: disable=redefined-builtin", "a", "=", "_to_tensor", "(", "a", ")", "if", "weights", "is", "not", "None", ":", "we...
https://github.com/mindspore-ai/mindspore/blob/fb8fd3338605bb34fa5cea054e535a8b1d753fab/mindspore/python/mindspore/numpy/array_creations.py#L2053-L2118
Komnomnomnom/swigibpy
cfd307fdbfaffabc69a2dc037538d7e34a8b8daf
swigibpy.py
python
ComboLegList.__delslice__
(self, i, j)
return _swigibpy.ComboLegList___delslice__(self, i, j)
__delslice__(ComboLegList self, std::vector< shared_ptr< ComboLeg > >::difference_type i, std::vector< shared_ptr< ComboLeg > >::difference_type j)
__delslice__(ComboLegList self, std::vector< shared_ptr< ComboLeg > >::difference_type i, std::vector< shared_ptr< ComboLeg > >::difference_type j)
[ "__delslice__", "(", "ComboLegList", "self", "std", "::", "vector<", "shared_ptr<", "ComboLeg", ">", ">", "::", "difference_type", "i", "std", "::", "vector<", "shared_ptr<", "ComboLeg", ">", ">", "::", "difference_type", "j", ")" ]
def __delslice__(self, i, j): """__delslice__(ComboLegList self, std::vector< shared_ptr< ComboLeg > >::difference_type i, std::vector< shared_ptr< ComboLeg > >::difference_type j)""" return _swigibpy.ComboLegList___delslice__(self, i, j)
[ "def", "__delslice__", "(", "self", ",", "i", ",", "j", ")", ":", "return", "_swigibpy", ".", "ComboLegList___delslice__", "(", "self", ",", "i", ",", "j", ")" ]
https://github.com/Komnomnomnom/swigibpy/blob/cfd307fdbfaffabc69a2dc037538d7e34a8b8daf/swigibpy.py#L281-L283
krishauser/Klampt
972cc83ea5befac3f653c1ba20f80155768ad519
Python/python2_version/klampt/math/optimize.py
python
OptimizationProblemBuilder.inBoundsSymbolic
(self)
return symbolic.all_(*exprs)
Returns a symbolic.Expression, over variables in self.context, that evaluates to True the configuration meets bound constraints
Returns a symbolic.Expression, over variables in self.context, that evaluates to True the configuration meets bound constraints
[ "Returns", "a", "symbolic", ".", "Expression", "over", "variables", "in", "self", ".", "context", "that", "evaluates", "to", "True", "the", "configuration", "meets", "bound", "constraints" ]
def inBoundsSymbolic(self): """Returns a symbolic.Expression, over variables in self.context, that evaluates to True the configuration meets bound constraints""" exprs = [] for k,bnd in self.variableBounds.iteritems(): exprs.append(self.context.linalg.bound_contains(qmin,qmax...
[ "def", "inBoundsSymbolic", "(", "self", ")", ":", "exprs", "=", "[", "]", "for", "k", ",", "bnd", "in", "self", ".", "variableBounds", ".", "iteritems", "(", ")", ":", "exprs", ".", "append", "(", "self", ".", "context", ".", "linalg", ".", "bound_co...
https://github.com/krishauser/Klampt/blob/972cc83ea5befac3f653c1ba20f80155768ad519/Python/python2_version/klampt/math/optimize.py#L1095-L1101
pytorch/pytorch
7176c92687d3cc847cc046bf002269c6949a21c2
torch/distributed/pipeline/sync/pipeline.py
python
Pipeline.fence
( self, batches: List[Batch], schedule: List[Tuple[int, int]], skip_trackers: List[SkipTrackerThroughPotals], )
Copies micro-batches after computation for the previous micro-batches.
Copies micro-batches after computation for the previous micro-batches.
[ "Copies", "micro", "-", "batches", "after", "computation", "for", "the", "previous", "micro", "-", "batches", "." ]
def fence( self, batches: List[Batch], schedule: List[Tuple[int, int]], skip_trackers: List[SkipTrackerThroughPotals], ) -> None: """Copies micro-batches after computation for the previous micro-batches. """ copy_streams = self.copy_streams skip_layout = self.skip_lay...
[ "def", "fence", "(", "self", ",", "batches", ":", "List", "[", "Batch", "]", ",", "schedule", ":", "List", "[", "Tuple", "[", "int", ",", "int", "]", "]", ",", "skip_trackers", ":", "List", "[", "SkipTrackerThroughPotals", "]", ",", ")", "->", "None"...
https://github.com/pytorch/pytorch/blob/7176c92687d3cc847cc046bf002269c6949a21c2/torch/distributed/pipeline/sync/pipeline.py#L120-L143
tensorflow/tensorflow
419e3a6b650ea4bd1b0cba23c4348f8a69f3272e
tensorflow/python/tpu/tpu.py
python
initialize_system
( embedding_config: Optional[embedding_pb2.TPUEmbeddingConfiguration] = None, job: Optional[Text] = None, compilation_failure_closes_chips: bool = True, tpu_cancellation_closes_chips: Optional[bool] = None, )
Initializes a distributed TPU system for use with TensorFlow. Args: embedding_config: If not None, a `TPUEmbeddingConfiguration` proto describing the desired configuration of the hardware embedding lookup tables. If embedding_config is None, no hardware embeddings can be used. job: The job (the X...
Initializes a distributed TPU system for use with TensorFlow.
[ "Initializes", "a", "distributed", "TPU", "system", "for", "use", "with", "TensorFlow", "." ]
def initialize_system( embedding_config: Optional[embedding_pb2.TPUEmbeddingConfiguration] = None, job: Optional[Text] = None, compilation_failure_closes_chips: bool = True, tpu_cancellation_closes_chips: Optional[bool] = None, ) -> core_types.Tensor: """Initializes a distributed TPU system for use wi...
[ "def", "initialize_system", "(", "embedding_config", ":", "Optional", "[", "embedding_pb2", ".", "TPUEmbeddingConfiguration", "]", "=", "None", ",", "job", ":", "Optional", "[", "Text", "]", "=", "None", ",", "compilation_failure_closes_chips", ":", "bool", "=", ...
https://github.com/tensorflow/tensorflow/blob/419e3a6b650ea4bd1b0cba23c4348f8a69f3272e/tensorflow/python/tpu/tpu.py#L111-L165
benoitsteiner/tensorflow-opencl
cb7cb40a57fde5cfd4731bc551e82a1e2fef43a5
tensorflow/contrib/factorization/python/ops/factorization_ops.py
python
WALSModel.col_weights
(self)
return self._col_weights
Returns a list of tensors corresponding to col weight shards.
Returns a list of tensors corresponding to col weight shards.
[ "Returns", "a", "list", "of", "tensors", "corresponding", "to", "col", "weight", "shards", "." ]
def col_weights(self): """Returns a list of tensors corresponding to col weight shards.""" return self._col_weights
[ "def", "col_weights", "(", "self", ")", ":", "return", "self", ".", "_col_weights" ]
https://github.com/benoitsteiner/tensorflow-opencl/blob/cb7cb40a57fde5cfd4731bc551e82a1e2fef43a5/tensorflow/contrib/factorization/python/ops/factorization_ops.py#L289-L291
baidu-research/tensorflow-allreduce
66d5b855e90b0949e9fa5cca5599fd729a70e874
tensorflow/contrib/data/python/ops/dataset_ops.py
python
BatchDataset.__init__
(self, input_dataset, batch_size)
See `Dataset.batch()` for details.
See `Dataset.batch()` for details.
[ "See", "Dataset", ".", "batch", "()", "for", "details", "." ]
def __init__(self, input_dataset, batch_size): """See `Dataset.batch()` for details.""" super(BatchDataset, self).__init__() self._input_dataset = input_dataset self._batch_size = batch_size
[ "def", "__init__", "(", "self", ",", "input_dataset", ",", "batch_size", ")", ":", "super", "(", "BatchDataset", ",", "self", ")", ".", "__init__", "(", ")", "self", ".", "_input_dataset", "=", "input_dataset", "self", ".", "_batch_size", "=", "batch_size" ]
https://github.com/baidu-research/tensorflow-allreduce/blob/66d5b855e90b0949e9fa5cca5599fd729a70e874/tensorflow/contrib/data/python/ops/dataset_ops.py#L1455-L1459
baidu/AnyQ
d94d450d2aaa5f7ed73424b10aa4539835b97527
tools/common/utils.py
python
print_progress
(task_name, percentage, style=0)
Print progress bar Args: task_name: The name of the current task percentage: Current progress style: Progress bar form
Print progress bar Args: task_name: The name of the current task percentage: Current progress style: Progress bar form
[ "Print", "progress", "bar", "Args", ":", "task_name", ":", "The", "name", "of", "the", "current", "task", "percentage", ":", "Current", "progress", "style", ":", "Progress", "bar", "form" ]
def print_progress(task_name, percentage, style=0): """ Print progress bar Args: task_name: The name of the current task percentage: Current progress style: Progress bar form """ styles = ['#', '█'] mark = styles[style] * percentage mark += ' ' * (100 - percentage) sta...
[ "def", "print_progress", "(", "task_name", ",", "percentage", ",", "style", "=", "0", ")", ":", "styles", "=", "[", "'#'", ",", "'█']", "", "mark", "=", "styles", "[", "style", "]", "*", "percentage", "mark", "+=", "' '", "*", "(", "100", "-", "per...
https://github.com/baidu/AnyQ/blob/d94d450d2aaa5f7ed73424b10aa4539835b97527/tools/common/utils.py#L112-L126
aws/lumberyard
f85344403c1c2e77ec8c75deb2c116e97b713217
dev/Tools/Python/3.7.10/mac/Python.framework/Versions/3.7/lib/python3.7/random.py
python
Random._randbelow
(self, n, int=int, maxsize=1<<BPF, type=type, Method=_MethodType, BuiltinMethod=_BuiltinMethodType)
return int(r*maxsize) % n
Return a random int in the range [0,n). Raises ValueError if n==0.
Return a random int in the range [0,n). Raises ValueError if n==0.
[ "Return", "a", "random", "int", "in", "the", "range", "[", "0", "n", ")", ".", "Raises", "ValueError", "if", "n", "==", "0", "." ]
def _randbelow(self, n, int=int, maxsize=1<<BPF, type=type, Method=_MethodType, BuiltinMethod=_BuiltinMethodType): "Return a random int in the range [0,n). Raises ValueError if n==0." random = self.random getrandbits = self.getrandbits # Only call self.getrandbits if...
[ "def", "_randbelow", "(", "self", ",", "n", ",", "int", "=", "int", ",", "maxsize", "=", "1", "<<", "BPF", ",", "type", "=", "type", ",", "Method", "=", "_MethodType", ",", "BuiltinMethod", "=", "_BuiltinMethodType", ")", ":", "random", "=", "self", ...
https://github.com/aws/lumberyard/blob/f85344403c1c2e77ec8c75deb2c116e97b713217/dev/Tools/Python/3.7.10/mac/Python.framework/Versions/3.7/lib/python3.7/random.py#L224-L252
pytorch/pytorch
7176c92687d3cc847cc046bf002269c6949a21c2
torch/cuda/__init__.py
python
init
()
r"""Initialize PyTorch's CUDA state. You may need to call this explicitly if you are interacting with PyTorch via its C API, as Python bindings for CUDA functionality will not be available until this initialization takes place. Ordinary users should not need this, as all of PyTorch's CUDA methods ...
r"""Initialize PyTorch's CUDA state. You may need to call this explicitly if you are interacting with PyTorch via its C API, as Python bindings for CUDA functionality will not be available until this initialization takes place. Ordinary users should not need this, as all of PyTorch's CUDA methods ...
[ "r", "Initialize", "PyTorch", "s", "CUDA", "state", ".", "You", "may", "need", "to", "call", "this", "explicitly", "if", "you", "are", "interacting", "with", "PyTorch", "via", "its", "C", "API", "as", "Python", "bindings", "for", "CUDA", "functionality", "...
def init(): r"""Initialize PyTorch's CUDA state. You may need to call this explicitly if you are interacting with PyTorch via its C API, as Python bindings for CUDA functionality will not be available until this initialization takes place. Ordinary users should not need this, as all of PyTorch's C...
[ "def", "init", "(", ")", ":", "_lazy_init", "(", ")" ]
https://github.com/pytorch/pytorch/blob/7176c92687d3cc847cc046bf002269c6949a21c2/torch/cuda/__init__.py#L177-L187
hanpfei/chromium-net
392cc1fa3a8f92f42e4071ab6e674d8e0482f83f
third_party/catapult/third_party/mock/mock.py
python
_patch.__exit__
(self, *exc_info)
Undo the patch.
Undo the patch.
[ "Undo", "the", "patch", "." ]
def __exit__(self, *exc_info): """Undo the patch.""" if not _is_started(self): raise RuntimeError('stop called on unstarted patcher') if self.is_local and self.temp_original is not DEFAULT: setattr(self.target, self.attribute, self.temp_original) else: ...
[ "def", "__exit__", "(", "self", ",", "*", "exc_info", ")", ":", "if", "not", "_is_started", "(", "self", ")", ":", "raise", "RuntimeError", "(", "'stop called on unstarted patcher'", ")", "if", "self", ".", "is_local", "and", "self", ".", "temp_original", "i...
https://github.com/hanpfei/chromium-net/blob/392cc1fa3a8f92f42e4071ab6e674d8e0482f83f/third_party/catapult/third_party/mock/mock.py#L1373-L1391
kungfu-origin/kungfu
90c84b2b590855654cb9a6395ed050e0f7763512
core/deps/SQLiteCpp-2.3.0/cpplint.py
python
_ClassifyInclude
(fileinfo, include, is_system)
return _OTHER_HEADER
Figures out what kind of header 'include' is. Args: fileinfo: The current file cpplint is running over. A FileInfo instance. include: The path to a #included file. is_system: True if the #include used <> rather than "". Returns: One of the _XXX_HEADER constants. For example: >>> _ClassifyIn...
Figures out what kind of header 'include' is.
[ "Figures", "out", "what", "kind", "of", "header", "include", "is", "." ]
def _ClassifyInclude(fileinfo, include, is_system): """Figures out what kind of header 'include' is. Args: fileinfo: The current file cpplint is running over. A FileInfo instance. include: The path to a #included file. is_system: True if the #include used <> rather than "". Returns: One of the _...
[ "def", "_ClassifyInclude", "(", "fileinfo", ",", "include", ",", "is_system", ")", ":", "# This is a list of all standard c++ header files, except", "# those already checked for above.", "is_cpp_h", "=", "include", "in", "_CPP_HEADERS", "if", "is_system", ":", "if", "is_cpp...
https://github.com/kungfu-origin/kungfu/blob/90c84b2b590855654cb9a6395ed050e0f7763512/core/deps/SQLiteCpp-2.3.0/cpplint.py#L3549-L3605
vergecurrency/verge
cc5711be0a978bcdc06c62569b129fe6ab4e4d9f
share/qt/extract_strings_qt.py
python
parse_po
(text)
return messages
Parse 'po' format produced by xgettext. Return a list of (msgid,msgstr) tuples.
Parse 'po' format produced by xgettext. Return a list of (msgid,msgstr) tuples.
[ "Parse", "po", "format", "produced", "by", "xgettext", ".", "Return", "a", "list", "of", "(", "msgid", "msgstr", ")", "tuples", "." ]
def parse_po(text): """ Parse 'po' format produced by xgettext. Return a list of (msgid,msgstr) tuples. """ messages = [] msgid = [] msgstr = [] in_msgid = False in_msgstr = False for line in text.split('\n'): line = line.rstrip('\r') if line.startswith('msgid ')...
[ "def", "parse_po", "(", "text", ")", ":", "messages", "=", "[", "]", "msgid", "=", "[", "]", "msgstr", "=", "[", "]", "in_msgid", "=", "False", "in_msgstr", "=", "False", "for", "line", "in", "text", ".", "split", "(", "'\\n'", ")", ":", "line", ...
https://github.com/vergecurrency/verge/blob/cc5711be0a978bcdc06c62569b129fe6ab4e4d9f/share/qt/extract_strings_qt.py#L17-L51
larroy/clearskies_core
3574ddf0edc8555454c7044126e786a6c29444dc
tools/gyp/buildbot/buildbot_run.py
python
PrepareCmake
()
Build CMake 2.8.8 since the version in Precise is 2.8.7.
Build CMake 2.8.8 since the version in Precise is 2.8.7.
[ "Build", "CMake", "2", ".", "8", ".", "8", "since", "the", "version", "in", "Precise", "is", "2", ".", "8", ".", "7", "." ]
def PrepareCmake(): """Build CMake 2.8.8 since the version in Precise is 2.8.7.""" if os.environ['BUILDBOT_CLOBBER'] == '1': print '@@@BUILD_STEP Clobber CMake checkout@@@' shutil.rmtree(CMAKE_DIR) # We always build CMake 2.8.8, so no need to do anything # if the directory already exists. if os.path....
[ "def", "PrepareCmake", "(", ")", ":", "if", "os", ".", "environ", "[", "'BUILDBOT_CLOBBER'", "]", "==", "'1'", ":", "print", "'@@@BUILD_STEP Clobber CMake checkout@@@'", "shutil", ".", "rmtree", "(", "CMAKE_DIR", ")", "# We always build CMake 2.8.8, so no need to do any...
https://github.com/larroy/clearskies_core/blob/3574ddf0edc8555454c7044126e786a6c29444dc/tools/gyp/buildbot/buildbot_run.py#L39-L73
Dovyski/cvui
d1b40267bdee34fcc193a375911415222f1409b3
cvui.py
python
text
(theText, theFontScale = 0.4, theColor = 0xCECECE)
Display a piece of text within a `begin*()` and `end*()` block. IMPORTANT: this function can only be used within a `begin*()/end*()` block, otherwise it does nothing. Parameters ---------- theText: str text content. theFontScale: float size of the text. theColor: uint color of the text in the format `0xRR...
Display a piece of text within a `begin*()` and `end*()` block.
[ "Display", "a", "piece", "of", "text", "within", "a", "begin", "*", "()", "and", "end", "*", "()", "block", "." ]
def text(theText, theFontScale = 0.4, theColor = 0xCECECE): """ Display a piece of text within a `begin*()` and `end*()` block. IMPORTANT: this function can only be used within a `begin*()/end*()` block, otherwise it does nothing. Parameters ---------- theText: str text content. theFontScale: float size of...
[ "def", "text", "(", "theText", ",", "theFontScale", "=", "0.4", ",", "theColor", "=", "0xCECECE", ")", ":", "print", "(", "'This is wrapper function to help code autocompletion.'", ")" ]
https://github.com/Dovyski/cvui/blob/d1b40267bdee34fcc193a375911415222f1409b3/cvui.py#L1999-L2022
ricardoquesada/Spidermonkey
4a75ea2543408bd1b2c515aa95901523eeef7858
dom/bindings/parser/WebIDL.py
python
Parser.p_ReadOnlyEmpty
(self, p)
ReadOnly :
ReadOnly :
[ "ReadOnly", ":" ]
def p_ReadOnlyEmpty(self, p): """ ReadOnly : """ p[0] = False
[ "def", "p_ReadOnlyEmpty", "(", "self", ",", "p", ")", ":", "p", "[", "0", "]", "=", "False" ]
https://github.com/ricardoquesada/Spidermonkey/blob/4a75ea2543408bd1b2c515aa95901523eeef7858/dom/bindings/parser/WebIDL.py#L4659-L4663
aws/lumberyard
f85344403c1c2e77ec8c75deb2c116e97b713217
dev/Tools/Python/3.7.10/windows/Tools/parser/unparse.py
python
Unparser.leave
(self)
Decrease the indentation level.
Decrease the indentation level.
[ "Decrease", "the", "indentation", "level", "." ]
def leave(self): "Decrease the indentation level." self._indent -= 1
[ "def", "leave", "(", "self", ")", ":", "self", ".", "_indent", "-=", "1" ]
https://github.com/aws/lumberyard/blob/f85344403c1c2e77ec8c75deb2c116e97b713217/dev/Tools/Python/3.7.10/windows/Tools/parser/unparse.py#L52-L54
thalium/icebox
99d147d5b9269222225443ce171b4fd46d8985d4
third_party/virtualbox/src/libs/libxml2-2.9.4/python/libxml2.py
python
URI.setQueryRaw
(self, query_raw)
Set the raw query part of an URI (i.e. the unescaped form).
Set the raw query part of an URI (i.e. the unescaped form).
[ "Set", "the", "raw", "query", "part", "of", "an", "URI", "(", "i", ".", "e", ".", "the", "unescaped", "form", ")", "." ]
def setQueryRaw(self, query_raw): """Set the raw query part of an URI (i.e. the unescaped form). """ libxml2mod.xmlURISetQueryRaw(self._o, query_raw)
[ "def", "setQueryRaw", "(", "self", ",", "query_raw", ")", ":", "libxml2mod", ".", "xmlURISetQueryRaw", "(", "self", ".", "_o", ",", "query_raw", ")" ]
https://github.com/thalium/icebox/blob/99d147d5b9269222225443ce171b4fd46d8985d4/third_party/virtualbox/src/libs/libxml2-2.9.4/python/libxml2.py#L7039-L7041
wxWidgets/wxPython-Classic
19571e1ae65f1ac445f5491474121998c97a1bf0
src/gtk/_windows.py
python
TopLevelWindow.Maximize
(*args, **kwargs)
return _windows_.TopLevelWindow_Maximize(*args, **kwargs)
Maximize(self, bool maximize=True)
Maximize(self, bool maximize=True)
[ "Maximize", "(", "self", "bool", "maximize", "=", "True", ")" ]
def Maximize(*args, **kwargs): """Maximize(self, bool maximize=True)""" return _windows_.TopLevelWindow_Maximize(*args, **kwargs)
[ "def", "Maximize", "(", "*", "args", ",", "*", "*", "kwargs", ")", ":", "return", "_windows_", ".", "TopLevelWindow_Maximize", "(", "*", "args", ",", "*", "*", "kwargs", ")" ]
https://github.com/wxWidgets/wxPython-Classic/blob/19571e1ae65f1ac445f5491474121998c97a1bf0/src/gtk/_windows.py#L405-L407
wxWidgets/wxPython-Classic
19571e1ae65f1ac445f5491474121998c97a1bf0
wx/lib/colourutils.py
python
AdjustColour
(color, percent, alpha=wx.ALPHA_OPAQUE)
return wx.Colour(red, green, blue, alpha)
Brighten/Darken input colour by percent and adjust alpha channel if needed. Returns the modified color. :param Colour `color`: color object to adjust :param integer `percent`: percent to adjust +(brighten) or -(darken) :keyword `alpha`: amount to adjust alpha channel
Brighten/Darken input colour by percent and adjust alpha channel if needed. Returns the modified color. :param Colour `color`: color object to adjust :param integer `percent`: percent to adjust +(brighten) or -(darken) :keyword `alpha`: amount to adjust alpha channel
[ "Brighten", "/", "Darken", "input", "colour", "by", "percent", "and", "adjust", "alpha", "channel", "if", "needed", ".", "Returns", "the", "modified", "color", ".", ":", "param", "Colour", "color", ":", "color", "object", "to", "adjust", ":", "param", "int...
def AdjustColour(color, percent, alpha=wx.ALPHA_OPAQUE): """ Brighten/Darken input colour by percent and adjust alpha channel if needed. Returns the modified color. :param Colour `color`: color object to adjust :param integer `percent`: percent to adjust +(brighten) or -(darken) :keyword `a...
[ "def", "AdjustColour", "(", "color", ",", "percent", ",", "alpha", "=", "wx", ".", "ALPHA_OPAQUE", ")", ":", "radj", ",", "gadj", ",", "badj", "=", "[", "int", "(", "val", "*", "(", "abs", "(", "percent", ")", "/", "100.", ")", ")", "for", "val",...
https://github.com/wxWidgets/wxPython-Classic/blob/19571e1ae65f1ac445f5491474121998c97a1bf0/wx/lib/colourutils.py#L28-L49
catboost/catboost
167f64f237114a4d10b2b4ee42adb4569137debe
contrib/tools/python/src/Tools/ccbench/ccbench.py
python
task_pidigits
()
return calc_ndigits, (50, )
Pi calculation (Python)
Pi calculation (Python)
[ "Pi", "calculation", "(", "Python", ")" ]
def task_pidigits(): """Pi calculation (Python)""" _map = map _count = itertools.count _islice = itertools.islice def calc_ndigits(n): # From http://shootout.alioth.debian.org/ def gen_x(): return _map(lambda k: (k, 4*k + 2, 0, 2*k + 1), _count(1)) def compose(a...
[ "def", "task_pidigits", "(", ")", ":", "_map", "=", "map", "_count", "=", "itertools", ".", "count", "_islice", "=", "itertools", ".", "islice", "def", "calc_ndigits", "(", "n", ")", ":", "# From http://shootout.alioth.debian.org/", "def", "gen_x", "(", ")", ...
https://github.com/catboost/catboost/blob/167f64f237114a4d10b2b4ee42adb4569137debe/contrib/tools/python/src/Tools/ccbench/ccbench.py#L43-L79
catboost/catboost
167f64f237114a4d10b2b4ee42adb4569137debe
contrib/tools/python/src/Lib/email/_parseaddr.py
python
AddrlistClass.gotonext
(self)
Parse up to the start of the next address.
Parse up to the start of the next address.
[ "Parse", "up", "to", "the", "start", "of", "the", "next", "address", "." ]
def gotonext(self): """Parse up to the start of the next address.""" while self.pos < len(self.field): if self.field[self.pos] in self.LWS + '\n\r': self.pos += 1 elif self.field[self.pos] == '(': self.commentlist.append(self.getcomment()) ...
[ "def", "gotonext", "(", "self", ")", ":", "while", "self", ".", "pos", "<", "len", "(", "self", ".", "field", ")", ":", "if", "self", ".", "field", "[", "self", ".", "pos", "]", "in", "self", ".", "LWS", "+", "'\\n\\r'", ":", "self", ".", "pos"...
https://github.com/catboost/catboost/blob/167f64f237114a4d10b2b4ee42adb4569137debe/contrib/tools/python/src/Lib/email/_parseaddr.py#L201-L209
pyne/pyne
0c2714d7c0d1b5e20be6ae6527da2c660dd6b1b3
pyne/mesh.py
python
_structured_step_iter
(it, n)
return r
Helper method for structured_get_vertex and structured_get_hex Return the nth item in the iterator.
Helper method for structured_get_vertex and structured_get_hex
[ "Helper", "method", "for", "structured_get_vertex", "and", "structured_get_hex" ]
def _structured_step_iter(it, n): """Helper method for structured_get_vertex and structured_get_hex Return the nth item in the iterator. """ it.step(n) r = next(it) it.reset() return r
[ "def", "_structured_step_iter", "(", "it", ",", "n", ")", ":", "it", ".", "step", "(", "n", ")", "r", "=", "next", "(", "it", ")", "it", ".", "reset", "(", ")", "return", "r" ]
https://github.com/pyne/pyne/blob/0c2714d7c0d1b5e20be6ae6527da2c660dd6b1b3/pyne/mesh.py#L1786-L1795
vslavik/poedit
f7a9daa0a10037e090aa0a86f5ce0f24ececdf6a
deps/boost/tools/build/src/build/virtual_target.py
python
VirtualTarget.project
(self)
return self.project_
Project of this target.
Project of this target.
[ "Project", "of", "this", "target", "." ]
def project (self): """ Project of this target. """ return self.project_
[ "def", "project", "(", "self", ")", ":", "return", "self", ".", "project_" ]
https://github.com/vslavik/poedit/blob/f7a9daa0a10037e090aa0a86f5ce0f24ececdf6a/deps/boost/tools/build/src/build/virtual_target.py#L294-L297
catboost/catboost
167f64f237114a4d10b2b4ee42adb4569137debe
contrib/python/scipy/py2/scipy/spatial/_spherical_voronoi.py
python
sphere_check
(points, radius, center)
return abs(max_discrepancy)
Determines distance of generators from theoretical sphere surface.
Determines distance of generators from theoretical sphere surface.
[ "Determines", "distance", "of", "generators", "from", "theoretical", "sphere", "surface", "." ]
def sphere_check(points, radius, center): """ Determines distance of generators from theoretical sphere surface. """ actual_squared_radii = (((points[...,0] - center[0]) ** 2) + ((points[...,1] - center[1]) ** 2) + ((points[...,2] - center[2]) ** ...
[ "def", "sphere_check", "(", "points", ",", "radius", ",", "center", ")", ":", "actual_squared_radii", "=", "(", "(", "(", "points", "[", "...", ",", "0", "]", "-", "center", "[", "0", "]", ")", "**", "2", ")", "+", "(", "(", "points", "[", "...",...
https://github.com/catboost/catboost/blob/167f64f237114a4d10b2b4ee42adb4569137debe/contrib/python/scipy/py2/scipy/spatial/_spherical_voronoi.py#L22-L31
ApolloAuto/apollo-platform
86d9dc6743b496ead18d597748ebabd34a513289
ros/third_party/lib_aarch64/python2.7/dist-packages/geographic_msgs/msg/_BoundingBox.py
python
BoundingBox.deserialize_numpy
(self, str, numpy)
unpack serialized message in str into this message instance using numpy for array types :param str: byte array of serialized message, ``str`` :param numpy: numpy python module
unpack serialized message in str into this message instance using numpy for array types :param str: byte array of serialized message, ``str`` :param numpy: numpy python module
[ "unpack", "serialized", "message", "in", "str", "into", "this", "message", "instance", "using", "numpy", "for", "array", "types", ":", "param", "str", ":", "byte", "array", "of", "serialized", "message", "str", ":", "param", "numpy", ":", "numpy", "python", ...
def deserialize_numpy(self, str, numpy): """ unpack serialized message in str into this message instance using numpy for array types :param str: byte array of serialized message, ``str`` :param numpy: numpy python module """ try: if self.min_pt is None: self.min_pt = geographic_msg...
[ "def", "deserialize_numpy", "(", "self", ",", "str", ",", "numpy", ")", ":", "try", ":", "if", "self", ".", "min_pt", "is", "None", ":", "self", ".", "min_pt", "=", "geographic_msgs", ".", "msg", ".", "GeoPoint", "(", ")", "if", "self", ".", "max_pt"...
https://github.com/ApolloAuto/apollo-platform/blob/86d9dc6743b496ead18d597748ebabd34a513289/ros/third_party/lib_aarch64/python2.7/dist-packages/geographic_msgs/msg/_BoundingBox.py#L122-L140
PaddlePaddle/Paddle
1252f4bb3e574df80aa6d18c7ddae1b3a90bd81c
python/paddle/fluid/contrib/sparsity/asp.py
python
ASPHelper._get_not_ASP_relevant_vars
(main_program)
return var_list
r""" Get all parameters's Variables in :attr:`main_program` but excluded ASP mask Variables. Args: main_program (Program): Program with model definition and its parameters. Returns: list: A list of parameter Variables in :attr:`main_program` (excluded ASP mask Variables)...
r""" Get all parameters's Variables in :attr:`main_program` but excluded ASP mask Variables.
[ "r", "Get", "all", "parameters", "s", "Variables", "in", ":", "attr", ":", "main_program", "but", "excluded", "ASP", "mask", "Variables", "." ]
def _get_not_ASP_relevant_vars(main_program): r""" Get all parameters's Variables in :attr:`main_program` but excluded ASP mask Variables. Args: main_program (Program): Program with model definition and its parameters. Returns: list: A list of parameter Variables...
[ "def", "_get_not_ASP_relevant_vars", "(", "main_program", ")", ":", "var_list", "=", "[", "]", "for", "param", "in", "main_program", ".", "global_block", "(", ")", ".", "all_parameters", "(", ")", ":", "if", "ASPHelper", ".", "MASK_APPENDDED_NAME", "not", "in"...
https://github.com/PaddlePaddle/Paddle/blob/1252f4bb3e574df80aa6d18c7ddae1b3a90bd81c/python/paddle/fluid/contrib/sparsity/asp.py#L389-L402
catboost/catboost
167f64f237114a4d10b2b4ee42adb4569137debe
contrib/tools/python/src/Lib/nntplib.py
python
NNTP.putline
(self, line)
Internal: send one line to the server, appending CRLF.
Internal: send one line to the server, appending CRLF.
[ "Internal", ":", "send", "one", "line", "to", "the", "server", "appending", "CRLF", "." ]
def putline(self, line): """Internal: send one line to the server, appending CRLF.""" line = line + CRLF if self.debugging > 1: print '*put*', repr(line) self.sock.sendall(line)
[ "def", "putline", "(", "self", ",", "line", ")", ":", "line", "=", "line", "+", "CRLF", "if", "self", ".", "debugging", ">", "1", ":", "print", "'*put*'", ",", "repr", "(", "line", ")", "self", ".", "sock", ".", "sendall", "(", "line", ")" ]
https://github.com/catboost/catboost/blob/167f64f237114a4d10b2b4ee42adb4569137debe/contrib/tools/python/src/Lib/nntplib.py#L196-L200
wxWidgets/wxPython-Classic
19571e1ae65f1ac445f5491474121998c97a1bf0
src/msw/_windows.py
python
VarHVScrollHelper.ScrollToRowColumn
(*args, **kwargs)
return _windows_.VarHVScrollHelper_ScrollToRowColumn(*args, **kwargs)
ScrollToRowColumn(self, Position pos) -> bool
ScrollToRowColumn(self, Position pos) -> bool
[ "ScrollToRowColumn", "(", "self", "Position", "pos", ")", "-", ">", "bool" ]
def ScrollToRowColumn(*args, **kwargs): """ScrollToRowColumn(self, Position pos) -> bool""" return _windows_.VarHVScrollHelper_ScrollToRowColumn(*args, **kwargs)
[ "def", "ScrollToRowColumn", "(", "*", "args", ",", "*", "*", "kwargs", ")", ":", "return", "_windows_", ".", "VarHVScrollHelper_ScrollToRowColumn", "(", "*", "args", ",", "*", "*", "kwargs", ")" ]
https://github.com/wxWidgets/wxPython-Classic/blob/19571e1ae65f1ac445f5491474121998c97a1bf0/src/msw/_windows.py#L2375-L2377
catboost/catboost
167f64f237114a4d10b2b4ee42adb4569137debe
contrib/python/scipy/scipy/stats/morestats.py
python
boxcox_llf
(lmb, data)
return llf
r"""The boxcox log-likelihood function. Parameters ---------- lmb : scalar Parameter for Box-Cox transformation. See `boxcox` for details. data : array_like Data to calculate Box-Cox log-likelihood for. If `data` is multi-dimensional, the log-likelihood is calculated along the...
r"""The boxcox log-likelihood function.
[ "r", "The", "boxcox", "log", "-", "likelihood", "function", "." ]
def boxcox_llf(lmb, data): r"""The boxcox log-likelihood function. Parameters ---------- lmb : scalar Parameter for Box-Cox transformation. See `boxcox` for details. data : array_like Data to calculate Box-Cox log-likelihood for. If `data` is multi-dimensional, the log-lik...
[ "def", "boxcox_llf", "(", "lmb", ",", "data", ")", ":", "data", "=", "np", ".", "asarray", "(", "data", ")", "N", "=", "data", ".", "shape", "[", "0", "]", "if", "N", "==", "0", ":", "return", "np", ".", "nan", "y", "=", "boxcox", "(", "data"...
https://github.com/catboost/catboost/blob/167f64f237114a4d10b2b4ee42adb4569137debe/contrib/python/scipy/scipy/stats/morestats.py#L818-L906
ideawu/ssdb-rocks
a3cbb322cafb2f493252829c608e2239df98c9ac
deps/rocksdb-master/linters/cpp_linter/cpplint.py
python
Error
(filename, linenum, category, confidence, message)
Logs the fact we've found a lint error. We log where the error was found, and also our confidence in the error, that is, how certain we are this is a legitimate style regression, and not a misidentification or a use that's sometimes justified. False positives can be suppressed by the use of "cpplint(categor...
Logs the fact we've found a lint error.
[ "Logs", "the", "fact", "we", "ve", "found", "a", "lint", "error", "." ]
def Error(filename, linenum, category, confidence, message): """Logs the fact we've found a lint error. We log where the error was found, and also our confidence in the error, that is, how certain we are this is a legitimate style regression, and not a misidentification or a use that's sometimes justified. ...
[ "def", "Error", "(", "filename", ",", "linenum", ",", "category", ",", "confidence", ",", "message", ")", ":", "if", "_ShouldPrintError", "(", "category", ",", "confidence", ",", "linenum", ")", ":", "_cpplint_state", ".", "IncrementErrorCount", "(", "category...
https://github.com/ideawu/ssdb-rocks/blob/a3cbb322cafb2f493252829c608e2239df98c9ac/deps/rocksdb-master/linters/cpp_linter/cpplint.py#L982-L1014
infinisql/infinisql
6e858e142196e20b6779e1ee84c4a501e246c1f8
manager/infinisqlmgr/management/__init__.py
python
Controller.process_leader_tasks
(self)
Performs processing of tasks delegated to the leader. :return: None
Performs processing of tasks delegated to the leader. :return: None
[ "Performs", "processing", "of", "tasks", "delegated", "to", "the", "leader", ".", ":", "return", ":", "None" ]
def process_leader_tasks(self): """ Performs processing of tasks delegated to the leader. :return: None """ # Perform leader tasks if I am the leader. if self.leader_node_id != self.node_id: return self.current_cluster_time += 1
[ "def", "process_leader_tasks", "(", "self", ")", ":", "# Perform leader tasks if I am the leader.", "if", "self", ".", "leader_node_id", "!=", "self", ".", "node_id", ":", "return", "self", ".", "current_cluster_time", "+=", "1" ]
https://github.com/infinisql/infinisql/blob/6e858e142196e20b6779e1ee84c4a501e246c1f8/manager/infinisqlmgr/management/__init__.py#L464-L473
catboost/catboost
167f64f237114a4d10b2b4ee42adb4569137debe
contrib/python/scikit-learn/py2/sklearn/ensemble/forest.py
python
ForestRegressor._set_oob_score
(self, X, y)
Compute out-of-bag scores
Compute out-of-bag scores
[ "Compute", "out", "-", "of", "-", "bag", "scores" ]
def _set_oob_score(self, X, y): """Compute out-of-bag scores""" X = check_array(X, dtype=DTYPE, accept_sparse='csr') n_samples = y.shape[0] predictions = np.zeros((n_samples, self.n_outputs_)) n_predictions = np.zeros((n_samples, self.n_outputs_)) for estimator in self...
[ "def", "_set_oob_score", "(", "self", ",", "X", ",", "y", ")", ":", "X", "=", "check_array", "(", "X", ",", "dtype", "=", "DTYPE", ",", "accept_sparse", "=", "'csr'", ")", "n_samples", "=", "y", ".", "shape", "[", "0", "]", "predictions", "=", "np"...
https://github.com/catboost/catboost/blob/167f64f237114a4d10b2b4ee42adb4569137debe/contrib/python/scikit-learn/py2/sklearn/ensemble/forest.py#L701-L741
gwaldron/osgearth
4c521857d59a69743e4a9cedba00afe570f984e8
src/third_party/tinygltf/deps/cpplint.py
python
_RestoreFilters
()
Restores filters previously backed up.
Restores filters previously backed up.
[ "Restores", "filters", "previously", "backed", "up", "." ]
def _RestoreFilters(): """ Restores filters previously backed up.""" _cpplint_state.RestoreFilters()
[ "def", "_RestoreFilters", "(", ")", ":", "_cpplint_state", ".", "RestoreFilters", "(", ")" ]
https://github.com/gwaldron/osgearth/blob/4c521857d59a69743e4a9cedba00afe570f984e8/src/third_party/tinygltf/deps/cpplint.py#L909-L911
apache/incubator-mxnet
f03fb23f1d103fec9541b5ae59ee06b1734a51d9
python/mxnet/contrib/quantization.py
python
_LayerHistogramCollector.get_optimal_threshold
(hist_data, quantized_dtype, num_quantized_bins=255)
return min_val, max_val, threshold, divergence
Given a dataset, find the optimal threshold for quantizing it. The reference distribution is `q`, and the candidate distribution is `p`. `q` is a truncated version of the original distribution. Ref: http://on-demand.gputechconf.com/gtc/2017/presentation/s7310-8-bit-inference-with-tensorrt.pdf
Given a dataset, find the optimal threshold for quantizing it. The reference distribution is `q`, and the candidate distribution is `p`. `q` is a truncated version of the original distribution.
[ "Given", "a", "dataset", "find", "the", "optimal", "threshold", "for", "quantizing", "it", ".", "The", "reference", "distribution", "is", "q", "and", "the", "candidate", "distribution", "is", "p", ".", "q", "is", "a", "truncated", "version", "of", "the", "...
def get_optimal_threshold(hist_data, quantized_dtype, num_quantized_bins=255): """Given a dataset, find the optimal threshold for quantizing it. The reference distribution is `q`, and the candidate distribution is `p`. `q` is a truncated version of the original distribution. Ref: http:/...
[ "def", "get_optimal_threshold", "(", "hist_data", ",", "quantized_dtype", ",", "num_quantized_bins", "=", "255", ")", ":", "(", "hist", ",", "hist_edges", ",", "min_val", ",", "max_val", ",", "_", ")", "=", "hist_data", "num_bins", "=", "len", "(", "hist", ...
https://github.com/apache/incubator-mxnet/blob/f03fb23f1d103fec9541b5ae59ee06b1734a51d9/python/mxnet/contrib/quantization.py#L249-L269
hanpfei/chromium-net
392cc1fa3a8f92f42e4071ab6e674d8e0482f83f
tools/cr/cr/actions/ninja.py
python
NinjaBuilder.GetTargets
(self)
return self._targets
Overridden from Builder.GetTargets.
Overridden from Builder.GetTargets.
[ "Overridden", "from", "Builder", ".", "GetTargets", "." ]
def GetTargets(self): """Overridden from Builder.GetTargets.""" if not self._targets: try: cr.context.Get('CR_BUILD_DIR', raise_errors=True) except KeyError: return self._targets output = cr.Host.Capture( '{NINJA_BINARY}', '-C{CR_BUILD_DIR}', '-tta...
[ "def", "GetTargets", "(", "self", ")", ":", "if", "not", "self", ".", "_targets", ":", "try", ":", "cr", ".", "context", ".", "Get", "(", "'CR_BUILD_DIR'", ",", "raise_errors", "=", "True", ")", "except", "KeyError", ":", "return", "self", ".", "_targe...
https://github.com/hanpfei/chromium-net/blob/392cc1fa3a8f92f42e4071ab6e674d8e0482f83f/tools/cr/cr/actions/ninja.py#L83-L104
ricardoquesada/Spidermonkey
4a75ea2543408bd1b2c515aa95901523eeef7858
dom/bindings/parser/WebIDL.py
python
Parser.p_ReturnTypeType
(self, p)
ReturnType : Type
ReturnType : Type
[ "ReturnType", ":", "Type" ]
def p_ReturnTypeType(self, p): """ ReturnType : Type """ p[0] = p[1]
[ "def", "p_ReturnTypeType", "(", "self", ",", "p", ")", ":", "p", "[", "0", "]", "=", "p", "[", "1", "]" ]
https://github.com/ricardoquesada/Spidermonkey/blob/4a75ea2543408bd1b2c515aa95901523eeef7858/dom/bindings/parser/WebIDL.py#L5464-L5468
gemrb/gemrb
730206eed8d1dd358ca5e69a62f9e099aa22ffc6
gemrb/GUIScripts/GUICommonWindows.py
python
SelectFormationPreset
()
return
Choose the default formation.
Choose the default formation.
[ "Choose", "the", "default", "formation", "." ]
def SelectFormationPreset (): """Choose the default formation.""" GemRB.GameSetFormation (GemRB.GetVar ("Value"), GemRB.GetVar ("Formation") ) GroupControls () return
[ "def", "SelectFormationPreset", "(", ")", ":", "GemRB", ".", "GameSetFormation", "(", "GemRB", ".", "GetVar", "(", "\"Value\"", ")", ",", "GemRB", ".", "GetVar", "(", "\"Formation\"", ")", ")", "GroupControls", "(", ")", "return" ]
https://github.com/gemrb/gemrb/blob/730206eed8d1dd358ca5e69a62f9e099aa22ffc6/gemrb/GUIScripts/GUICommonWindows.py#L355-L359
idaholab/moose
9eeebc65e098b4c30f8205fb41591fd5b61eb6ff
python/mooseutils/PerfGraphReporterReader.py
python
PerfGraphObject.percentMemory
(self)
return self.totalMemory() * 100 / self.rootNode().totalMemory()
Returns the percentage of memory this this took relative to the total time of the root node.
Returns the percentage of memory this this took relative to the total time of the root node.
[ "Returns", "the", "percentage", "of", "memory", "this", "this", "took", "relative", "to", "the", "total", "time", "of", "the", "root", "node", "." ]
def percentMemory(self): """ Returns the percentage of memory this this took relative to the total time of the root node. """ return self.totalMemory() * 100 / self.rootNode().totalMemory()
[ "def", "percentMemory", "(", "self", ")", ":", "return", "self", ".", "totalMemory", "(", ")", "*", "100", "/", "self", ".", "rootNode", "(", ")", ".", "totalMemory", "(", ")" ]
https://github.com/idaholab/moose/blob/9eeebc65e098b4c30f8205fb41591fd5b61eb6ff/python/mooseutils/PerfGraphReporterReader.py#L113-L118
windystrife/UnrealEngine_NVIDIAGameWorks
b50e6338a7c5b26374d66306ebc7807541ff815e
Engine/Extras/ThirdPartyNotUE/emsdk/Win64/python/2.7.5.3_64bit/Lib/platform.py
python
_syscmd_ver
(system='', release='', version='', supported_platforms=('win32','win16','dos','os2'))
return system,release,version
Tries to figure out the OS version used and returns a tuple (system,release,version). It uses the "ver" shell command for this which is known to exists on Windows, DOS and OS/2. XXX Others too ? In case this fails, the given parameters are used as defaults.
Tries to figure out the OS version used and returns a tuple (system,release,version).
[ "Tries", "to", "figure", "out", "the", "OS", "version", "used", "and", "returns", "a", "tuple", "(", "system", "release", "version", ")", "." ]
def _syscmd_ver(system='', release='', version='', supported_platforms=('win32','win16','dos','os2')): """ Tries to figure out the OS version used and returns a tuple (system,release,version). It uses the "ver" shell command for this which is known to exists on Windows, DOS...
[ "def", "_syscmd_ver", "(", "system", "=", "''", ",", "release", "=", "''", ",", "version", "=", "''", ",", "supported_platforms", "=", "(", "'win32'", ",", "'win16'", ",", "'dos'", ",", "'os2'", ")", ")", ":", "if", "sys", ".", "platform", "not", "in...
https://github.com/windystrife/UnrealEngine_NVIDIAGameWorks/blob/b50e6338a7c5b26374d66306ebc7807541ff815e/Engine/Extras/ThirdPartyNotUE/emsdk/Win64/python/2.7.5.3_64bit/Lib/platform.py#L482-L532
krishauser/Klampt
972cc83ea5befac3f653c1ba20f80155768ad519
Python/klampt/vis/visualization.py
python
setLabel
(name : ItemPath, text : str)
Changes the label of an item in the visualization
Changes the label of an item in the visualization
[ "Changes", "the", "label", "of", "an", "item", "in", "the", "visualization" ]
def setLabel(name : ItemPath, text : str) -> None: """Changes the label of an item in the visualization""" setAttribute(name,"label",text)
[ "def", "setLabel", "(", "name", ":", "ItemPath", ",", "text", ":", "str", ")", "->", "None", ":", "setAttribute", "(", "name", ",", "\"label\"", ",", "text", ")" ]
https://github.com/krishauser/Klampt/blob/972cc83ea5befac3f653c1ba20f80155768ad519/Python/klampt/vis/visualization.py#L1279-L1281
wxWidgets/wxPython-Classic
19571e1ae65f1ac445f5491474121998c97a1bf0
src/osx_cocoa/_controls.py
python
TextAttr.SetOutlineLevel
(*args, **kwargs)
return _controls_.TextAttr_SetOutlineLevel(*args, **kwargs)
SetOutlineLevel(self, int level)
SetOutlineLevel(self, int level)
[ "SetOutlineLevel", "(", "self", "int", "level", ")" ]
def SetOutlineLevel(*args, **kwargs): """SetOutlineLevel(self, int level)""" return _controls_.TextAttr_SetOutlineLevel(*args, **kwargs)
[ "def", "SetOutlineLevel", "(", "*", "args", ",", "*", "*", "kwargs", ")", ":", "return", "_controls_", ".", "TextAttr_SetOutlineLevel", "(", "*", "args", ",", "*", "*", "kwargs", ")" ]
https://github.com/wxWidgets/wxPython-Classic/blob/19571e1ae65f1ac445f5491474121998c97a1bf0/src/osx_cocoa/_controls.py#L1635-L1637
CRYTEK/CRYENGINE
232227c59a220cbbd311576f0fbeba7bb53b2a8c
Editor/Python/windows/Lib/site-packages/pip/_vendor/distlib/manifest.py
python
Manifest._parse_directive
(self, directive)
return action, patterns, thedir, dir_pattern
Validate a directive. :param directive: The directive to validate. :return: A tuple of action, patterns, thedir, dir_patterns
Validate a directive. :param directive: The directive to validate. :return: A tuple of action, patterns, thedir, dir_patterns
[ "Validate", "a", "directive", ".", ":", "param", "directive", ":", "The", "directive", "to", "validate", ".", ":", "return", ":", "A", "tuple", "of", "action", "patterns", "thedir", "dir_patterns" ]
def _parse_directive(self, directive): """ Validate a directive. :param directive: The directive to validate. :return: A tuple of action, patterns, thedir, dir_patterns """ words = directive.split() if len(words) == 1 and words[0] not in ('include', 'exclude', ...
[ "def", "_parse_directive", "(", "self", ",", "directive", ")", ":", "words", "=", "directive", ".", "split", "(", ")", "if", "len", "(", "words", ")", "==", "1", "and", "words", "[", "0", "]", "not", "in", "(", "'include'", ",", "'exclude'", ",", "...
https://github.com/CRYTEK/CRYENGINE/blob/232227c59a220cbbd311576f0fbeba7bb53b2a8c/Editor/Python/windows/Lib/site-packages/pip/_vendor/distlib/manifest.py#L202-L247
ampl/mp
cad8d370089a76507cb9c5518c21a1097f4a504b
support/build-docs.py
python
pip_install
(package, **kwargs)
Install package using pip.
Install package using pip.
[ "Install", "package", "using", "pip", "." ]
def pip_install(package, **kwargs): "Install package using pip." commit = kwargs.get('commit') if commit: package = 'git+git://github.com/{0}.git@{1}'.format(package, commit) run('pip', 'install', '-q', package)
[ "def", "pip_install", "(", "package", ",", "*", "*", "kwargs", ")", ":", "commit", "=", "kwargs", ".", "get", "(", "'commit'", ")", "if", "commit", ":", "package", "=", "'git+git://github.com/{0}.git@{1}'", ".", "format", "(", "package", ",", "commit", ")"...
https://github.com/ampl/mp/blob/cad8d370089a76507cb9c5518c21a1097f4a504b/support/build-docs.py#L61-L66
PlatformLab/RAMCloud
b1866af19124325a6dfd8cbc267e2e3ef1f965d1
scripts/cluster.py
python
Cluster.ensure_servers
(self, numMasters=None, numBackups=None, timeout=30)
Poll the coordinator and block until the specified number of masters and backups have enlisted. Useful for ensuring that the cluster is in the expected state before experiments begin. If the expected state isn't acheived within 5 seconds the call will throw an exception. @param ...
Poll the coordinator and block until the specified number of masters and backups have enlisted. Useful for ensuring that the cluster is in the expected state before experiments begin. If the expected state isn't acheived within 5 seconds the call will throw an exception.
[ "Poll", "the", "coordinator", "and", "block", "until", "the", "specified", "number", "of", "masters", "and", "backups", "have", "enlisted", ".", "Useful", "for", "ensuring", "that", "the", "cluster", "is", "in", "the", "expected", "state", "before", "experimen...
def ensure_servers(self, numMasters=None, numBackups=None, timeout=30): """Poll the coordinator and block until the specified number of masters and backups have enlisted. Useful for ensuring that the cluster is in the expected state before experiments begin. If the expected state isn't a...
[ "def", "ensure_servers", "(", "self", ",", "numMasters", "=", "None", ",", "numBackups", "=", "None", ",", "timeout", "=", "30", ")", ":", "if", "not", "numMasters", ":", "numMasters", "=", "self", ".", "masters_started", "if", "not", "numBackups", ":", ...
https://github.com/PlatformLab/RAMCloud/blob/b1866af19124325a6dfd8cbc267e2e3ef1f965d1/scripts/cluster.py#L412-L445
NASA-SW-VnV/ikos
71325dfb94737332542caa708d7537752021522d
analyzer/python/ikos/view.py
python
RequestHandler._serve_static
(self, path)
Serve a static file
Serve a static file
[ "Serve", "a", "static", "file" ]
def _serve_static(self, path): ''' Serve a static file ''' fullpath = os.path.join(SHARE_DIR, 'static', path) if os.path.isfile(fullpath): self._send_static_headers(path) self._write_file(fullpath) else: self._serve_not_found()
[ "def", "_serve_static", "(", "self", ",", "path", ")", ":", "fullpath", "=", "os", ".", "path", ".", "join", "(", "SHARE_DIR", ",", "'static'", ",", "path", ")", "if", "os", ".", "path", ".", "isfile", "(", "fullpath", ")", ":", "self", ".", "_send...
https://github.com/NASA-SW-VnV/ikos/blob/71325dfb94737332542caa708d7537752021522d/analyzer/python/ikos/view.py#L153-L161
aws/lumberyard
f85344403c1c2e77ec8c75deb2c116e97b713217
dev/Gems/CloudGemMetric/v1/AWS/python/windows/Lib/dateutil/rrule.py
python
rrulebase.xafter
(self, dt, count=None, inc=False)
Generator which yields up to `count` recurrences after the given datetime instance, equivalent to `after`. :param dt: The datetime at which to start generating recurrences. :param count: The maximum number of recurrences to generate. If `None` (default), dat...
Generator which yields up to `count` recurrences after the given datetime instance, equivalent to `after`.
[ "Generator", "which", "yields", "up", "to", "count", "recurrences", "after", "the", "given", "datetime", "instance", "equivalent", "to", "after", "." ]
def xafter(self, dt, count=None, inc=False): """ Generator which yields up to `count` recurrences after the given datetime instance, equivalent to `after`. :param dt: The datetime at which to start generating recurrences. :param count: The maximum number...
[ "def", "xafter", "(", "self", ",", "dt", ",", "count", "=", "None", ",", "inc", "=", "False", ")", ":", "if", "self", ".", "_cache_complete", ":", "gen", "=", "self", ".", "_cache", "else", ":", "gen", "=", "self", "# Select the comparison function", "...
https://github.com/aws/lumberyard/blob/f85344403c1c2e77ec8c75deb2c116e97b713217/dev/Gems/CloudGemMetric/v1/AWS/python/windows/Lib/dateutil/rrule.py#L228-L267
garbear/kodi-steamlink
3f8e5970b01607cdb3c2688fbaa78e08f2d9c561
tools/EventClients/lib/python/xbmcclient.py
python
XBMCClient.send_button_state
(self, map="", button="", amount=0, down=0, axis=0)
Send a button event to XBMC Keyword arguments: map -- a combination of map_name and button_name refers to a mapping in the user's Keymap.xml or Lircmap.xml. map_name can be one of the following: "KB" => standard keyboard map ( <keyboard> section ) ...
Send a button event to XBMC Keyword arguments: map -- a combination of map_name and button_name refers to a mapping in the user's Keymap.xml or Lircmap.xml. map_name can be one of the following: "KB" => standard keyboard map ( <keyboard> section ) ...
[ "Send", "a", "button", "event", "to", "XBMC", "Keyword", "arguments", ":", "map", "--", "a", "combination", "of", "map_name", "and", "button_name", "refers", "to", "a", "mapping", "in", "the", "user", "s", "Keymap", ".", "xml", "or", "Lircmap", ".", "xml...
def send_button_state(self, map="", button="", amount=0, down=0, axis=0): """Send a button event to XBMC Keyword arguments: map -- a combination of map_name and button_name refers to a mapping in the user's Keymap.xml or Lircmap.xml. map_name can be one of the follo...
[ "def", "send_button_state", "(", "self", ",", "map", "=", "\"\"", ",", "button", "=", "\"\"", ",", "amount", "=", "0", ",", "down", "=", "0", ",", "axis", "=", "0", ")", ":", "if", "axis", ":", "down", "=", "int", "(", "amount", "!=", "0", ")",...
https://github.com/garbear/kodi-steamlink/blob/3f8e5970b01607cdb3c2688fbaa78e08f2d9c561/tools/EventClients/lib/python/xbmcclient.py#L580-L602
aws/lumberyard
f85344403c1c2e77ec8c75deb2c116e97b713217
dev/Tools/Python/3.7.10/linux_x64/lib/python3.7/asyncio/streams.py
python
StreamReader.at_eof
(self)
return self._eof and not self._buffer
Return True if the buffer is empty and 'feed_eof' was called.
Return True if the buffer is empty and 'feed_eof' was called.
[ "Return", "True", "if", "the", "buffer", "is", "empty", "and", "feed_eof", "was", "called", "." ]
def at_eof(self): """Return True if the buffer is empty and 'feed_eof' was called.""" return self._eof and not self._buffer
[ "def", "at_eof", "(", "self", ")", ":", "return", "self", ".", "_eof", "and", "not", "self", ".", "_buffer" ]
https://github.com/aws/lumberyard/blob/f85344403c1c2e77ec8c75deb2c116e97b713217/dev/Tools/Python/3.7.10/linux_x64/lib/python3.7/asyncio/streams.py#L423-L425
aws/lumberyard
f85344403c1c2e77ec8c75deb2c116e97b713217
dev/Tools/Python/3.7.10/windows/Lib/multiprocessing/managers.py
python
public_methods
(obj)
return [name for name in all_methods(obj) if name[0] != '_']
Return a list of names of methods of `obj` which do not start with '_'
Return a list of names of methods of `obj` which do not start with '_'
[ "Return", "a", "list", "of", "names", "of", "methods", "of", "obj", "which", "do", "not", "start", "with", "_" ]
def public_methods(obj): ''' Return a list of names of methods of `obj` which do not start with '_' ''' return [name for name in all_methods(obj) if name[0] != '_']
[ "def", "public_methods", "(", "obj", ")", ":", "return", "[", "name", "for", "name", "in", "all_methods", "(", "obj", ")", "if", "name", "[", "0", "]", "!=", "'_'", "]" ]
https://github.com/aws/lumberyard/blob/f85344403c1c2e77ec8c75deb2c116e97b713217/dev/Tools/Python/3.7.10/windows/Lib/multiprocessing/managers.py#L118-L122
grpc/grpc
27bc6fe7797e43298dc931b96dc57322d0852a9f
src/python/grpcio/grpc/__init__.py
python
stream_unary_rpc_method_handler
(behavior, request_deserializer=None, response_serializer=None)
return _utilities.RpcMethodHandler(True, False, request_deserializer, response_serializer, None, None, behavior, None)
Creates an RpcMethodHandler for a stream-unary RPC method. Args: behavior: The implementation of an RPC that accepts an iterator of request values and returns a single response value. request_deserializer: An optional :term:`deserializer` for request deserialization. response_serializer: ...
Creates an RpcMethodHandler for a stream-unary RPC method.
[ "Creates", "an", "RpcMethodHandler", "for", "a", "stream", "-", "unary", "RPC", "method", "." ]
def stream_unary_rpc_method_handler(behavior, request_deserializer=None, response_serializer=None): """Creates an RpcMethodHandler for a stream-unary RPC method. Args: behavior: The implementation of an RPC that accepts an iterator o...
[ "def", "stream_unary_rpc_method_handler", "(", "behavior", ",", "request_deserializer", "=", "None", ",", "response_serializer", "=", "None", ")", ":", "from", "grpc", "import", "_utilities", "# pylint: disable=cyclic-import", "return", "_utilities", ".", "RpcMethodHandle...
https://github.com/grpc/grpc/blob/27bc6fe7797e43298dc931b96dc57322d0852a9f/src/python/grpcio/grpc/__init__.py#L1550-L1567
catboost/catboost
167f64f237114a4d10b2b4ee42adb4569137debe
contrib/python/ipython/py3/IPython/terminal/ipapp.py
python
TerminalIPythonApp.parse_command_line
(self, argv=None)
return super(TerminalIPythonApp, self).parse_command_line(argv)
override to allow old '-pylab' flag with deprecation warning
override to allow old '-pylab' flag with deprecation warning
[ "override", "to", "allow", "old", "-", "pylab", "flag", "with", "deprecation", "warning" ]
def parse_command_line(self, argv=None): """override to allow old '-pylab' flag with deprecation warning""" argv = sys.argv[1:] if argv is None else argv if '-pylab' in argv: # deprecated `-pylab` given, # warn and transform into current syntax argv = argv[:...
[ "def", "parse_command_line", "(", "self", ",", "argv", "=", "None", ")", ":", "argv", "=", "sys", ".", "argv", "[", "1", ":", "]", "if", "argv", "is", "None", "else", "argv", "if", "'-pylab'", "in", "argv", ":", "# deprecated `-pylab` given,", "# warn an...
https://github.com/catboost/catboost/blob/167f64f237114a4d10b2b4ee42adb4569137debe/contrib/python/ipython/py3/IPython/terminal/ipapp.py#L289-L303
wxWidgets/wxPython-Classic
19571e1ae65f1ac445f5491474121998c97a1bf0
contrib/gizmos/gtk/gizmos.py
python
TreeListCtrl.GetItemTextColour
(*args, **kwargs)
return _gizmos.TreeListCtrl_GetItemTextColour(*args, **kwargs)
GetItemTextColour(self, TreeItemId item) -> Colour
GetItemTextColour(self, TreeItemId item) -> Colour
[ "GetItemTextColour", "(", "self", "TreeItemId", "item", ")", "-", ">", "Colour" ]
def GetItemTextColour(*args, **kwargs): """GetItemTextColour(self, TreeItemId item) -> Colour""" return _gizmos.TreeListCtrl_GetItemTextColour(*args, **kwargs)
[ "def", "GetItemTextColour", "(", "*", "args", ",", "*", "*", "kwargs", ")", ":", "return", "_gizmos", ".", "TreeListCtrl_GetItemTextColour", "(", "*", "args", ",", "*", "*", "kwargs", ")" ]
https://github.com/wxWidgets/wxPython-Classic/blob/19571e1ae65f1ac445f5491474121998c97a1bf0/contrib/gizmos/gtk/gizmos.py#L689-L691
aws/lumberyard
f85344403c1c2e77ec8c75deb2c116e97b713217
dev/Tools/Python/3.7.10/windows/Lib/_pyio.py
python
IOBase.__del__
(self)
Destructor. Calls close().
Destructor. Calls close().
[ "Destructor", ".", "Calls", "close", "()", "." ]
def __del__(self): """Destructor. Calls close().""" # The try/except block is in case this is called at program # exit time, when it's possible that globals have already been # deleted, and then the close() call might fail. Since # there's nothing we can do about such failures ...
[ "def", "__del__", "(", "self", ")", ":", "# The try/except block is in case this is called at program", "# exit time, when it's possible that globals have already been", "# deleted, and then the close() call might fail. Since", "# there's nothing we can do about such failures and they annoy", "...
https://github.com/aws/lumberyard/blob/f85344403c1c2e77ec8c75deb2c116e97b713217/dev/Tools/Python/3.7.10/windows/Lib/_pyio.py#L374-L384
wxWidgets/wxPython-Classic
19571e1ae65f1ac445f5491474121998c97a1bf0
wx/lib/pubsub/core/topicmgr.py
python
_MasterTopicDefnProvider.clear
(self)
Remove all providers added.
Remove all providers added.
[ "Remove", "all", "providers", "added", "." ]
def clear(self): """Remove all providers added.""" self.__providers = []
[ "def", "clear", "(", "self", ")", ":", "self", ".", "__providers", "=", "[", "]" ]
https://github.com/wxWidgets/wxPython-Classic/blob/19571e1ae65f1ac445f5491474121998c97a1bf0/wx/lib/pubsub/core/topicmgr.py#L422-L424
catboost/catboost
167f64f237114a4d10b2b4ee42adb4569137debe
contrib/tools/python3/src/Lib/statistics.py
python
NormalDist.__eq__
(x1, x2)
return x1._mu == x2._mu and x1._sigma == x2._sigma
Two NormalDist objects are equal if their mu and sigma are both equal.
Two NormalDist objects are equal if their mu and sigma are both equal.
[ "Two", "NormalDist", "objects", "are", "equal", "if", "their", "mu", "and", "sigma", "are", "both", "equal", "." ]
def __eq__(x1, x2): "Two NormalDist objects are equal if their mu and sigma are both equal." if not isinstance(x2, NormalDist): return NotImplemented return x1._mu == x2._mu and x1._sigma == x2._sigma
[ "def", "__eq__", "(", "x1", ",", "x2", ")", ":", "if", "not", "isinstance", "(", "x2", ",", "NormalDist", ")", ":", "return", "NotImplemented", "return", "x1", ".", "_mu", "==", "x2", ".", "_mu", "and", "x1", ".", "_sigma", "==", "x2", ".", "_sigma...
https://github.com/catboost/catboost/blob/167f64f237114a4d10b2b4ee42adb4569137debe/contrib/tools/python3/src/Lib/statistics.py#L1109-L1113
hanpfei/chromium-net
392cc1fa3a8f92f42e4071ab6e674d8e0482f83f
third_party/catapult/telemetry/telemetry/web_perf/metrics/webrtc_rendering_stats.py
python
WebMediaPlayerMsRenderingStats._GetFpsFromCadence
(self, frame_distribution)
return DISPLAY_HERTZ / mean_ratio
Calculate the apparent FPS from frame distribution. Knowing the display frequency and the frame distribution, it is possible to calculate the video apparent frame rate as played by WebMediaPlayerMs module. Args: frame_distribution: the source to output distribution. Returns: the video...
Calculate the apparent FPS from frame distribution.
[ "Calculate", "the", "apparent", "FPS", "from", "frame", "distribution", "." ]
def _GetFpsFromCadence(self, frame_distribution): """Calculate the apparent FPS from frame distribution. Knowing the display frequency and the frame distribution, it is possible to calculate the video apparent frame rate as played by WebMediaPlayerMs module. Args: frame_distribution: the sou...
[ "def", "_GetFpsFromCadence", "(", "self", ",", "frame_distribution", ")", ":", "number_frames", "=", "sum", "(", "frame_distribution", ".", "values", "(", ")", ")", "number_vsyncs", "=", "sum", "(", "[", "ticks", "*", "frame_distribution", "[", "ticks", "]", ...
https://github.com/hanpfei/chromium-net/blob/392cc1fa3a8f92f42e4071ab6e674d8e0482f83f/third_party/catapult/telemetry/telemetry/web_perf/metrics/webrtc_rendering_stats.py#L150-L167
Xilinx/Vitis-AI
fc74d404563d9951b57245443c73bef389f3657f
tools/Vitis-AI-Quantizer/vai_q_tensorflow1.x/tensorflow/contrib/layers/python/layers/rev_block_lib.py
python
_recompute_grad
(fn, args, use_data_dep=_USE_DEFAULT, tupleize_grads=False)
return fn_with_recompute(*args)
See recompute_grad.
See recompute_grad.
[ "See", "recompute_grad", "." ]
def _recompute_grad(fn, args, use_data_dep=_USE_DEFAULT, tupleize_grads=False): """See recompute_grad.""" has_is_recompute_kwarg = "is_recomputing" in tf_inspect.getargspec(fn).args for arg in args: if not isinstance(arg, framework_ops.Tensor): raise ValueError("All inputs to function must be Tensors") ...
[ "def", "_recompute_grad", "(", "fn", ",", "args", ",", "use_data_dep", "=", "_USE_DEFAULT", ",", "tupleize_grads", "=", "False", ")", ":", "has_is_recompute_kwarg", "=", "\"is_recomputing\"", "in", "tf_inspect", ".", "getargspec", "(", "fn", ")", ".", "args", ...
https://github.com/Xilinx/Vitis-AI/blob/fc74d404563d9951b57245443c73bef389f3657f/tools/Vitis-AI-Quantizer/vai_q_tensorflow1.x/tensorflow/contrib/layers/python/layers/rev_block_lib.py#L577-L636
wxWidgets/wxPython-Classic
19571e1ae65f1ac445f5491474121998c97a1bf0
src/osx_cocoa/_gdi.py
python
RendererNative.Set
(*args, **kwargs)
return _gdi_.RendererNative_Set(*args, **kwargs)
Set(RendererNative renderer) -> RendererNative Set the renderer to use, passing None reverts to using the default renderer. Returns the previous renderer used with Set or None.
Set(RendererNative renderer) -> RendererNative
[ "Set", "(", "RendererNative", "renderer", ")", "-", ">", "RendererNative" ]
def Set(*args, **kwargs): """ Set(RendererNative renderer) -> RendererNative Set the renderer to use, passing None reverts to using the default renderer. Returns the previous renderer used with Set or None. """ return _gdi_.RendererNative_Set(*args, **kwargs)
[ "def", "Set", "(", "*", "args", ",", "*", "*", "kwargs", ")", ":", "return", "_gdi_", ".", "RendererNative_Set", "(", "*", "args", ",", "*", "*", "kwargs", ")" ]
https://github.com/wxWidgets/wxPython-Classic/blob/19571e1ae65f1ac445f5491474121998c97a1bf0/src/osx_cocoa/_gdi.py#L7495-L7502
google/llvm-propeller
45c226984fe8377ebfb2ad7713c680d652ba678d
clang/tools/scan-build-py/libscanbuild/analyze.py
python
filter_debug_flags
(opts, continuation=dispatch_ctu)
return continuation(opts)
Filter out nondebug macros when requested.
Filter out nondebug macros when requested.
[ "Filter", "out", "nondebug", "macros", "when", "requested", "." ]
def filter_debug_flags(opts, continuation=dispatch_ctu): """ Filter out nondebug macros when requested. """ if opts.pop('force_debug'): # lazy implementation just append an undefine macro at the end opts.update({'flags': opts['flags'] + ['-UNDEBUG']}) return continuation(opts)
[ "def", "filter_debug_flags", "(", "opts", ",", "continuation", "=", "dispatch_ctu", ")", ":", "if", "opts", ".", "pop", "(", "'force_debug'", ")", ":", "# lazy implementation just append an undefine macro at the end", "opts", ".", "update", "(", "{", "'flags'", ":",...
https://github.com/google/llvm-propeller/blob/45c226984fe8377ebfb2ad7713c680d652ba678d/clang/tools/scan-build-py/libscanbuild/analyze.py#L662-L669
klzgrad/naiveproxy
ed2c513637c77b18721fe428d7ed395b4d284c83
src/build/android/gyp/util/resource_utils.py
python
ToAndroidLocaleName
(chromium_locale)
return '%s-r%s' % (lang, region)
Convert a Chromium locale name into a corresponding Android one.
Convert a Chromium locale name into a corresponding Android one.
[ "Convert", "a", "Chromium", "locale", "name", "into", "a", "corresponding", "Android", "one", "." ]
def ToAndroidLocaleName(chromium_locale): """Convert a Chromium locale name into a corresponding Android one.""" # Should be in sync with build/config/locales.gni. # First handle the special cases, these are needed to deal with Android # releases *before* 5.0/Lollipop. android_locale = _CHROME_TO_ANDROID_LOCA...
[ "def", "ToAndroidLocaleName", "(", "chromium_locale", ")", ":", "# Should be in sync with build/config/locales.gni.", "# First handle the special cases, these are needed to deal with Android", "# releases *before* 5.0/Lollipop.", "android_locale", "=", "_CHROME_TO_ANDROID_LOCALE_MAP", ".", ...
https://github.com/klzgrad/naiveproxy/blob/ed2c513637c77b18721fe428d7ed395b4d284c83/src/build/android/gyp/util/resource_utils.py#L67-L89
p4lang/p4c
3272e79369f20813cc1a555a5eb26f44432f84a4
tools/cpplint.py
python
PathSplitToList
(path)
return lst
Returns the path split into a list by the separator. Args: path: An absolute or relative path (e.g. '/a/b/c/' or '../a') Returns: A list of path components (e.g. ['a', 'b', 'c]).
Returns the path split into a list by the separator.
[ "Returns", "the", "path", "split", "into", "a", "list", "by", "the", "separator", "." ]
def PathSplitToList(path): """Returns the path split into a list by the separator. Args: path: An absolute or relative path (e.g. '/a/b/c/' or '../a') Returns: A list of path components (e.g. ['a', 'b', 'c]). """ lst = [] while True: (head, tail) = os.path.split(path) if head == path: # a...
[ "def", "PathSplitToList", "(", "path", ")", ":", "lst", "=", "[", "]", "while", "True", ":", "(", "head", ",", "tail", ")", "=", "os", ".", "path", ".", "split", "(", "path", ")", "if", "head", "==", "path", ":", "# absolute paths end", "lst", ".",...
https://github.com/p4lang/p4c/blob/3272e79369f20813cc1a555a5eb26f44432f84a4/tools/cpplint.py#L2264-L2287
deepmind/open_spiel
4ca53bea32bb2875c7385d215424048ae92f78c8
open_spiel/python/algorithms/lp_solver.py
python
LinearProgram.add_or_reuse_variable
(self, label, lb=None, ub=None)
Adds a variable to this LP, or reuses one if the label exists. If the variable already exists, simply checks that the upper and lower bounds are the same as previously specified. Args: label: a label to assign to this constraint lb: a lower-bound value for this variable ub: an upper-boun...
Adds a variable to this LP, or reuses one if the label exists.
[ "Adds", "a", "variable", "to", "this", "LP", "or", "reuses", "one", "if", "the", "label", "exists", "." ]
def add_or_reuse_variable(self, label, lb=None, ub=None): """Adds a variable to this LP, or reuses one if the label exists. If the variable already exists, simply checks that the upper and lower bounds are the same as previously specified. Args: label: a label to assign to this constraint ...
[ "def", "add_or_reuse_variable", "(", "self", ",", "label", ",", "lb", "=", "None", ",", "ub", "=", "None", ")", ":", "var", "=", "self", ".", "_vars", ".", "get", "(", "label", ")", "if", "var", "is", "not", "None", ":", "# Do not re-add, but ensure it...
https://github.com/deepmind/open_spiel/blob/4ca53bea32bb2875c7385d215424048ae92f78c8/open_spiel/python/algorithms/lp_solver.py#L86-L104
ceph/ceph
959663007321a369c83218414a29bd9dbc8bda3a
qa/tasks/rbd.py
python
clone_image
(ctx, config)
Clones a parent imag For example:: tasks: - ceph: - rbd.clone_image: client.0: parent_name: testimage image_name: cloneimage
Clones a parent imag
[ "Clones", "a", "parent", "imag" ]
def clone_image(ctx, config): """ Clones a parent imag For example:: tasks: - ceph: - rbd.clone_image: client.0: parent_name: testimage image_name: cloneimage """ assert isinstance(config, dict) or isinstance(config, list), \ ...
[ "def", "clone_image", "(", "ctx", ",", "config", ")", ":", "assert", "isinstance", "(", "config", ",", "dict", ")", "or", "isinstance", "(", "config", ",", "list", ")", ",", "\"task clone_image only supports a list or dictionary for configuration\"", "if", "isinstan...
https://github.com/ceph/ceph/blob/959663007321a369c83218414a29bd9dbc8bda3a/qa/tasks/rbd.py#L133-L203
MegEngine/MegEngine
ce9ad07a27ec909fb8db4dd67943d24ba98fb93a
imperative/python/megengine/core/tensor/dtype.py
python
convert_from_quint8
(arr: np.ndarray)
return _convert_from_quantized_dtype(arr, _builtin_quant_dtypes["quint8"])
r"""Dequantize a quint8 NumPy ndarray into a float one. Args: arr: Input ndarray.
r"""Dequantize a quint8 NumPy ndarray into a float one.
[ "r", "Dequantize", "a", "quint8", "NumPy", "ndarray", "into", "a", "float", "one", "." ]
def convert_from_quint8(arr: np.ndarray): r"""Dequantize a quint8 NumPy ndarray into a float one. Args: arr: Input ndarray. """ return _convert_from_quantized_dtype(arr, _builtin_quant_dtypes["quint8"])
[ "def", "convert_from_quint8", "(", "arr", ":", "np", ".", "ndarray", ")", ":", "return", "_convert_from_quantized_dtype", "(", "arr", ",", "_builtin_quant_dtypes", "[", "\"quint8\"", "]", ")" ]
https://github.com/MegEngine/MegEngine/blob/ce9ad07a27ec909fb8db4dd67943d24ba98fb93a/imperative/python/megengine/core/tensor/dtype.py#L251-L257
eclipse/sumo
7132a9b8b6eea734bdec38479026b4d8c4336d03
tools/contributed/sumopy/agilepy/lib_base/misc.py
python
random_choice_dist2
(n, b)
Returns the absolute distribution of a random choice sample of size n having the choice between len(b) options where each option has the probability represented in vector b.
Returns the absolute distribution of a random choice sample of size n having the choice between len(b) options where each option has the probability represented in vector b.
[ "Returns", "the", "absolute", "distribution", "of", "a", "random", "choice", "sample", "of", "size", "n", "having", "the", "choice", "between", "len", "(", "b", ")", "options", "where", "each", "option", "has", "the", "probability", "represented", "in", "vec...
def random_choice_dist2(n, b): """ Returns the absolute distribution of a random choice sample of size n having the choice between len(b) options where each option has the probability represented in vector b. """
[ "def", "random_choice_dist2", "(", "n", ",", "b", ")", ":" ]
https://github.com/eclipse/sumo/blob/7132a9b8b6eea734bdec38479026b4d8c4336d03/tools/contributed/sumopy/agilepy/lib_base/misc.py#L53-L58
rootm0s/Injectors
7c3b6f9a1b5ccb11d09c893da0dfbb95eefb006e
pyPE_inject_obfuscate/pyPE_injection.py
python
infect
()
Path to executable
Path to executable
[ "Path", "to", "executable" ]
def infect(): def align(val_to_align, alignment): return ((val_to_align + alignment - 1) / alignment) * alignment ''' Path to executable ''' exe_path = "PsExec.exe" ''' Resize the Executable ''' print "\n[!] Resizing the Executable" original_size = os.path.getsize(exe_path) print "\t[+] Original Size = ...
[ "def", "infect", "(", ")", ":", "def", "align", "(", "val_to_align", ",", "alignment", ")", ":", "return", "(", "(", "val_to_align", "+", "alignment", "-", "1", ")", "/", "alignment", ")", "*", "alignment", "exe_path", "=", "\"PsExec.exe\"", "'''\n\tResize...
https://github.com/rootm0s/Injectors/blob/7c3b6f9a1b5ccb11d09c893da0dfbb95eefb006e/pyPE_inject_obfuscate/pyPE_injection.py#L17-L123
cztomczak/cefpython
5679f28cec18a57a56e298da2927aac8d8f83ad6
tools/build_distrib.py
python
remove_unnecessary_package_files
(arch)
Do not ship sample applications (cefclient etc) with the package. They increase size and also are an additional unnecessary factor when dealing with false-positives in Anti-Virus software.
Do not ship sample applications (cefclient etc) with the package. They increase size and also are an additional unnecessary factor when dealing with false-positives in Anti-Virus software.
[ "Do", "not", "ship", "sample", "applications", "(", "cefclient", "etc", ")", "with", "the", "package", ".", "They", "increase", "size", "and", "also", "are", "an", "additional", "unnecessary", "factor", "when", "dealing", "with", "false", "-", "positives", "...
def remove_unnecessary_package_files(arch): """Do not ship sample applications (cefclient etc) with the package. They increase size and also are an additional unnecessary factor when dealing with false-positives in Anti-Virus software.""" print("[build_distrib.py] Reduce package size for {arch} (Issue #...
[ "def", "remove_unnecessary_package_files", "(", "arch", ")", ":", "print", "(", "\"[build_distrib.py] Reduce package size for {arch} (Issue #321)\"", ".", "format", "(", "arch", "=", "arch", ")", ")", "prebuilt_basename", "=", "get_cef_binaries_libraries_basename", "(", "ge...
https://github.com/cztomczak/cefpython/blob/5679f28cec18a57a56e298da2927aac8d8f83ad6/tools/build_distrib.py#L486-L495
wxWidgets/wxPython-Classic
19571e1ae65f1ac445f5491474121998c97a1bf0
src/osx_carbon/_core.py
python
Window.SetLabel
(*args, **kwargs)
return _core_.Window_SetLabel(*args, **kwargs)
SetLabel(self, String label) Set the text which the window shows in its label if applicable.
SetLabel(self, String label)
[ "SetLabel", "(", "self", "String", "label", ")" ]
def SetLabel(*args, **kwargs): """ SetLabel(self, String label) Set the text which the window shows in its label if applicable. """ return _core_.Window_SetLabel(*args, **kwargs)
[ "def", "SetLabel", "(", "*", "args", ",", "*", "*", "kwargs", ")", ":", "return", "_core_", ".", "Window_SetLabel", "(", "*", "args", ",", "*", "*", "kwargs", ")" ]
https://github.com/wxWidgets/wxPython-Classic/blob/19571e1ae65f1ac445f5491474121998c97a1bf0/src/osx_carbon/_core.py#L9201-L9207
apple/turicreate
cce55aa5311300e3ce6af93cb45ba791fd1bdf49
deps/src/libxml2-2.9.1/python/libxml2.py
python
ValidCtxt.validateNotationUse
(self, doc, notationName)
return ret
Validate that the given name match a notation declaration. - [ VC: Notation Declared ]
Validate that the given name match a notation declaration. - [ VC: Notation Declared ]
[ "Validate", "that", "the", "given", "name", "match", "a", "notation", "declaration", ".", "-", "[", "VC", ":", "Notation", "Declared", "]" ]
def validateNotationUse(self, doc, notationName): """Validate that the given name match a notation declaration. - [ VC: Notation Declared ] """ if doc is None: doc__o = None else: doc__o = doc._o ret = libxml2mod.xmlValidateNotationUse(self._o, doc__o, notationName) re...
[ "def", "validateNotationUse", "(", "self", ",", "doc", ",", "notationName", ")", ":", "if", "doc", "is", "None", ":", "doc__o", "=", "None", "else", ":", "doc__o", "=", "doc", ".", "_o", "ret", "=", "libxml2mod", ".", "xmlValidateNotationUse", "(", "self...
https://github.com/apple/turicreate/blob/cce55aa5311300e3ce6af93cb45ba791fd1bdf49/deps/src/libxml2-2.9.1/python/libxml2.py#L7162-L7168
sfzhang15/FaceBoxes
b52cc92f9362d3adc08d54666aeb9ebb62fdb7da
scripts/cpp_lint.py
python
Match
(pattern, s)
return _regexp_compile_cache[pattern].match(s)
Matches the string with the pattern, caching the compiled regexp.
Matches the string with the pattern, caching the compiled regexp.
[ "Matches", "the", "string", "with", "the", "pattern", "caching", "the", "compiled", "regexp", "." ]
def Match(pattern, s): """Matches the string with the pattern, caching the compiled regexp.""" # The regexp compilation caching is inlined in both Match and Search for # performance reasons; factoring it out into a separate function turns out # to be noticeably expensive. if pattern not in _regexp_compile_cac...
[ "def", "Match", "(", "pattern", ",", "s", ")", ":", "# The regexp compilation caching is inlined in both Match and Search for", "# performance reasons; factoring it out into a separate function turns out", "# to be noticeably expensive.", "if", "pattern", "not", "in", "_regexp_compile_...
https://github.com/sfzhang15/FaceBoxes/blob/b52cc92f9362d3adc08d54666aeb9ebb62fdb7da/scripts/cpp_lint.py#L515-L522
tensorflow/tensorflow
419e3a6b650ea4bd1b0cba23c4348f8a69f3272e
tensorflow/python/ops/session_ops.py
python
TensorHandle._get_reader_key
(handle)
return handle_parts[0] + ";" + handle_parts[-1]
The graph key for reader.
The graph key for reader.
[ "The", "graph", "key", "for", "reader", "." ]
def _get_reader_key(handle): """The graph key for reader.""" handle_parts = str(handle).split(";") return handle_parts[0] + ";" + handle_parts[-1]
[ "def", "_get_reader_key", "(", "handle", ")", ":", "handle_parts", "=", "str", "(", "handle", ")", ".", "split", "(", "\";\"", ")", "return", "handle_parts", "[", "0", "]", "+", "\";\"", "+", "handle_parts", "[", "-", "1", "]" ]
https://github.com/tensorflow/tensorflow/blob/419e3a6b650ea4bd1b0cba23c4348f8a69f3272e/tensorflow/python/ops/session_ops.py#L123-L126
wxWidgets/wxPython-Classic
19571e1ae65f1ac445f5491474121998c97a1bf0
wx/py/sliceshell.py
python
SlicesShell.OnHistoryReplace
(self, step)
Replace with the previous/next command from the history buffer.
Replace with the previous/next command from the history buffer.
[ "Replace", "with", "the", "previous", "/", "next", "command", "from", "the", "history", "buffer", "." ]
def OnHistoryReplace(self, step): """Replace with the previous/next command from the history buffer.""" if not self.CanEdit(): return self.clearCommand() self.replaceFromHistory(step)
[ "def", "OnHistoryReplace", "(", "self", ",", "step", ")", ":", "if", "not", "self", ".", "CanEdit", "(", ")", ":", "return", "self", ".", "clearCommand", "(", ")", "self", ".", "replaceFromHistory", "(", "step", ")" ]
https://github.com/wxWidgets/wxPython-Classic/blob/19571e1ae65f1ac445f5491474121998c97a1bf0/wx/py/sliceshell.py#L2203-L2208
mantidproject/mantid
03deeb89254ec4289edb8771e0188c2090a02f32
Framework/PythonInterface/plugins/algorithms/CreateCacheFilename.py
python
matched
(keys, patterns)
return set(filtered)
return keys that match any of the given patterns
return keys that match any of the given patterns
[ "return", "keys", "that", "match", "any", "of", "the", "given", "patterns" ]
def matched(keys, patterns): "return keys that match any of the given patterns" import fnmatch filtered = [] for pat in patterns: filtered += fnmatch.filter(keys, pat) continue return set(filtered)
[ "def", "matched", "(", "keys", ",", "patterns", ")", ":", "import", "fnmatch", "filtered", "=", "[", "]", "for", "pat", "in", "patterns", ":", "filtered", "+=", "fnmatch", ".", "filter", "(", "keys", ",", "pat", ")", "continue", "return", "set", "(", ...
https://github.com/mantidproject/mantid/blob/03deeb89254ec4289edb8771e0188c2090a02f32/Framework/PythonInterface/plugins/algorithms/CreateCacheFilename.py#L131-L138
microsoft/TSS.MSR
0f2516fca2cd9929c31d5450e39301c9bde43688
TSS.Py/src/TpmTypes.py
python
TPMS_NULL_SIG_SCHEME.fromTpm
(buf)
return buf.createObj(TPMS_NULL_SIG_SCHEME)
Returns new TPMS_NULL_SIG_SCHEME object constructed from its marshaled representation in the given TpmBuffer buffer
Returns new TPMS_NULL_SIG_SCHEME object constructed from its marshaled representation in the given TpmBuffer buffer
[ "Returns", "new", "TPMS_NULL_SIG_SCHEME", "object", "constructed", "from", "its", "marshaled", "representation", "in", "the", "given", "TpmBuffer", "buffer" ]
def fromTpm(buf): """ Returns new TPMS_NULL_SIG_SCHEME object constructed from its marshaled representation in the given TpmBuffer buffer """ return buf.createObj(TPMS_NULL_SIG_SCHEME)
[ "def", "fromTpm", "(", "buf", ")", ":", "return", "buf", ".", "createObj", "(", "TPMS_NULL_SIG_SCHEME", ")" ]
https://github.com/microsoft/TSS.MSR/blob/0f2516fca2cd9929c31d5450e39301c9bde43688/TSS.Py/src/TpmTypes.py#L6598-L6602
sdhash/sdhash
b9eff63e4e5867e910f41fd69032bbb1c94a2a5e
sdhash-ui/jinja2/parser.py
python
Parser.free_identifier
(self, lineno=None)
return rv
Return a new free identifier as :class:`~jinja2.nodes.InternalName`.
Return a new free identifier as :class:`~jinja2.nodes.InternalName`.
[ "Return", "a", "new", "free", "identifier", "as", ":", "class", ":", "~jinja2", ".", "nodes", ".", "InternalName", "." ]
def free_identifier(self, lineno=None): """Return a new free identifier as :class:`~jinja2.nodes.InternalName`.""" self._last_identifier += 1 rv = object.__new__(nodes.InternalName) nodes.Node.__init__(rv, 'fi%d' % self._last_identifier, lineno=lineno) return rv
[ "def", "free_identifier", "(", "self", ",", "lineno", "=", "None", ")", ":", "self", ".", "_last_identifier", "+=", "1", "rv", "=", "object", ".", "__new__", "(", "nodes", ".", "InternalName", ")", "nodes", ".", "Node", ".", "__init__", "(", "rv", ",",...
https://github.com/sdhash/sdhash/blob/b9eff63e4e5867e910f41fd69032bbb1c94a2a5e/sdhash-ui/jinja2/parser.py#L106-L111
thalium/icebox
99d147d5b9269222225443ce171b4fd46d8985d4
third_party/virtualbox/src/VBox/Devices/EFI/Firmware/AppPkg/Applications/Python/PyMod-2.7.2/Lib/site.py
python
removeduppaths
()
return known_paths
Remove duplicate entries from sys.path along with making them absolute
Remove duplicate entries from sys.path along with making them absolute
[ "Remove", "duplicate", "entries", "from", "sys", ".", "path", "along", "with", "making", "them", "absolute" ]
def removeduppaths(): """ Remove duplicate entries from sys.path along with making them absolute""" # This ensures that the initial path provided by the interpreter contains # only absolute pathnames, even if we're running from the build directory. L = [] known_paths = set() for dir in sys.p...
[ "def", "removeduppaths", "(", ")", ":", "# This ensures that the initial path provided by the interpreter contains", "# only absolute pathnames, even if we're running from the build directory.", "L", "=", "[", "]", "known_paths", "=", "set", "(", ")", "for", "dir", "in", "sys",...
https://github.com/thalium/icebox/blob/99d147d5b9269222225443ce171b4fd46d8985d4/third_party/virtualbox/src/VBox/Devices/EFI/Firmware/AppPkg/Applications/Python/PyMod-2.7.2/Lib/site.py#L106-L122
nasa/fprime
595cf3682d8365943d86c1a6fe7c78f0a116acf0
Autocoders/Python/src/fprime_ac/generators/visitors/AbstractVisitor.py
python
AbstractVisitor.DictBodyVisit
(self, obj)
Defined to generate body for Python command class.
Defined to generate body for Python command class.
[ "Defined", "to", "generate", "body", "for", "Python", "command", "class", "." ]
def DictBodyVisit(self, obj): """ Defined to generate body for Python command class. """ raise Exception( "# DictStartVisit.commandBodyVisit() - Implementation Error: you must supply your own concrete implementation." )
[ "def", "DictBodyVisit", "(", "self", ",", "obj", ")", ":", "raise", "Exception", "(", "\"# DictStartVisit.commandBodyVisit() - Implementation Error: you must supply your own concrete implementation.\"", ")" ]
https://github.com/nasa/fprime/blob/595cf3682d8365943d86c1a6fe7c78f0a116acf0/Autocoders/Python/src/fprime_ac/generators/visitors/AbstractVisitor.py#L163-L169
gimli-org/gimli
17aa2160de9b15ababd9ef99e89b1bc3277bbb23
pygimli/meshtools/mesh.py
python
readHDF5Mesh
(fileName, group='mesh', indices='cell_indices', pos='coordinates', cells='topology', marker='values', marker_default=0, dimension=3, verbose=True, useFenicsIndices=False)
return mesh
Function for loading a mesh from HDF5 file format. Returns an instance of :gimliapi:`GIMLI::Mesh` class. Default values for keywords are suited for :term:`FEniCS` syntax .h5 meshes. Requirements: h5py module TODO: * Fenics hdf5 meshes do not have boundary markers. Parameters ----...
Function for loading a mesh from HDF5 file format.
[ "Function", "for", "loading", "a", "mesh", "from", "HDF5", "file", "format", "." ]
def readHDF5Mesh(fileName, group='mesh', indices='cell_indices', pos='coordinates', cells='topology', marker='values', marker_default=0, dimension=3, verbose=True, useFenicsIndices=False): """Function for loading a mesh from HDF5 file format. Returns an instan...
[ "def", "readHDF5Mesh", "(", "fileName", ",", "group", "=", "'mesh'", ",", "indices", "=", "'cell_indices'", ",", "pos", "=", "'coordinates'", ",", "cells", "=", "'topology'", ",", "marker", "=", "'values'", ",", "marker_default", "=", "0", ",", "dimension", ...
https://github.com/gimli-org/gimli/blob/17aa2160de9b15ababd9ef99e89b1bc3277bbb23/pygimli/meshtools/mesh.py#L1391-L1460
hanpfei/chromium-net
392cc1fa3a8f92f42e4071ab6e674d8e0482f83f
third_party/catapult/third_party/py_vulcanize/third_party/rjsmin/bench/main.py
python
bench
(filenames, count)
return struct
Benchmark the minifiers with given javascript samples :Parameters: `filenames` : sequence List of filenames `count` : ``int`` Number of runs per js file and minifier :Exceptions: - `RuntimeError` : empty filenames sequence
Benchmark the minifiers with given javascript samples
[ "Benchmark", "the", "minifiers", "with", "given", "javascript", "samples" ]
def bench(filenames, count): """ Benchmark the minifiers with given javascript samples :Parameters: `filenames` : sequence List of filenames `count` : ``int`` Number of runs per js file and minifier :Exceptions: - `RuntimeError` : empty filenames sequence """ ...
[ "def", "bench", "(", "filenames", ",", "count", ")", ":", "if", "not", "filenames", ":", "raise", "RuntimeError", "(", "\"Missing files to benchmark\"", ")", "try", ":", "xrange", "except", "NameError", ":", "xrange", "=", "range", "try", ":", "cmp", "except...
https://github.com/hanpfei/chromium-net/blob/392cc1fa3a8f92f42e4071ab6e674d8e0482f83f/third_party/catapult/third_party/py_vulcanize/third_party/rjsmin/bench/main.py#L102-L200
wxWidgets/wxPython-Classic
19571e1ae65f1ac445f5491474121998c97a1bf0
src/osx_cocoa/propgrid.py
python
PGProperty.Last
(*args, **kwargs)
return _propgrid.PGProperty_Last(*args, **kwargs)
Last(self) -> PGProperty
Last(self) -> PGProperty
[ "Last", "(", "self", ")", "-", ">", "PGProperty" ]
def Last(*args, **kwargs): """Last(self) -> PGProperty""" return _propgrid.PGProperty_Last(*args, **kwargs)
[ "def", "Last", "(", "*", "args", ",", "*", "*", "kwargs", ")", ":", "return", "_propgrid", ".", "PGProperty_Last", "(", "*", "args", ",", "*", "*", "kwargs", ")" ]
https://github.com/wxWidgets/wxPython-Classic/blob/19571e1ae65f1ac445f5491474121998c97a1bf0/src/osx_cocoa/propgrid.py#L819-L821
tensorflow/tensorflow
419e3a6b650ea4bd1b0cba23c4348f8a69f3272e
tensorflow/python/ops/summary_ops_v2.py
python
_legacy_contrib_should_record_summaries
()
return _should_record_summaries_internal(default_state=False)
Returns boolean Tensor which is true if summaries should be recorded.
Returns boolean Tensor which is true if summaries should be recorded.
[ "Returns", "boolean", "Tensor", "which", "is", "true", "if", "summaries", "should", "be", "recorded", "." ]
def _legacy_contrib_should_record_summaries(): """Returns boolean Tensor which is true if summaries should be recorded.""" return _should_record_summaries_internal(default_state=False)
[ "def", "_legacy_contrib_should_record_summaries", "(", ")", ":", "return", "_should_record_summaries_internal", "(", "default_state", "=", "False", ")" ]
https://github.com/tensorflow/tensorflow/blob/419e3a6b650ea4bd1b0cba23c4348f8a69f3272e/tensorflow/python/ops/summary_ops_v2.py#L143-L145
wxWidgets/wxPython-Classic
19571e1ae65f1ac445f5491474121998c97a1bf0
wx/lib/agw/ultimatelistctrl.py
python
UltimateListMainWindow.SetItemCount
(self, count)
This method can only be used with virtual :class:`UltimateListCtrl`. It is used to indicate to the control the number of items it contains. After calling it, the main program should be ready to handle calls to various item callbacks (such as :meth:`UltimateListCtrl.OnGetItemText() <UltimateListC...
This method can only be used with virtual :class:`UltimateListCtrl`. It is used to indicate to the control the number of items it contains. After calling it, the main program should be ready to handle calls to various item callbacks (such as :meth:`UltimateListCtrl.OnGetItemText() <UltimateListC...
[ "This", "method", "can", "only", "be", "used", "with", "virtual", ":", "class", ":", "UltimateListCtrl", ".", "It", "is", "used", "to", "indicate", "to", "the", "control", "the", "number", "of", "items", "it", "contains", ".", "After", "calling", "it", "...
def SetItemCount(self, count): """ This method can only be used with virtual :class:`UltimateListCtrl`. It is used to indicate to the control the number of items it contains. After calling it, the main program should be ready to handle calls to various item callbacks (such as :me...
[ "def", "SetItemCount", "(", "self", ",", "count", ")", ":", "self", ".", "_selStore", ".", "SetItemCount", "(", "count", ")", "self", ".", "_countVirt", "=", "count", "self", ".", "ResetVisibleLinesRange", "(", ")", "# scrollbars must be reset", "self", ".", ...
https://github.com/wxWidgets/wxPython-Classic/blob/19571e1ae65f1ac445f5491474121998c97a1bf0/wx/lib/agw/ultimatelistctrl.py#L9470-L9486