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
tensorflow/tensorflow
419e3a6b650ea4bd1b0cba23c4348f8a69f3272e
tensorflow/python/keras/distribute/model_collection_base.py
python
ModelAndInput.get_data
(self)
Returns data for training and predicting. Returns: x_train: data used for training y_train: label used for training x_predict: data used for predicting
Returns data for training and predicting.
[ "Returns", "data", "for", "training", "and", "predicting", "." ]
def get_data(self): """Returns data for training and predicting. Returns: x_train: data used for training y_train: label used for training x_predict: data used for predicting """ raise NotImplementedError("must be implemented in descendants")
[ "def", "get_data", "(", "self", ")", ":", "raise", "NotImplementedError", "(", "\"must be implemented in descendants\"", ")" ]
https://github.com/tensorflow/tensorflow/blob/419e3a6b650ea4bd1b0cba23c4348f8a69f3272e/tensorflow/python/keras/distribute/model_collection_base.py#L30-L38
catboost/catboost
167f64f237114a4d10b2b4ee42adb4569137debe
contrib/tools/python3/src/Lib/ftplib.py
python
FTP.getwelcome
(self)
return self.welcome
Get the welcome message from the server. (this is read and squirreled away by connect())
Get the welcome message from the server. (this is read and squirreled away by connect())
[ "Get", "the", "welcome", "message", "from", "the", "server", ".", "(", "this", "is", "read", "and", "squirreled", "away", "by", "connect", "()", ")" ]
def getwelcome(self): '''Get the welcome message from the server. (this is read and squirreled away by connect())''' if self.debugging: print('*welcome*', self.sanitize(self.welcome)) return self.welcome
[ "def", "getwelcome", "(", "self", ")", ":", "if", "self", ".", "debugging", ":", "print", "(", "'*welcome*'", ",", "self", ".", "sanitize", "(", "self", ".", "welcome", ")", ")", "return", "self", ".", "welcome" ]
https://github.com/catboost/catboost/blob/167f64f237114a4d10b2b4ee42adb4569137debe/contrib/tools/python3/src/Lib/ftplib.py#L165-L170
cvxpy/cvxpy
5165b4fb750dfd237de8659383ef24b4b2e33aaf
cvxpy/expressions/variable.py
python
Variable.canonicalize
(self)
return (obj, [])
Returns the graph implementation of the object. Returns: A tuple of (affine expression, [constraints]).
Returns the graph implementation of the object.
[ "Returns", "the", "graph", "implementation", "of", "the", "object", "." ]
def canonicalize(self): """Returns the graph implementation of the object. Returns: A tuple of (affine expression, [constraints]). """ obj = lu.create_var(self.shape, self.id) return (obj, [])
[ "def", "canonicalize", "(", "self", ")", ":", "obj", "=", "lu", ".", "create_var", "(", "self", ".", "shape", ",", "self", ".", "id", ")", "return", "(", "obj", ",", "[", "]", ")" ]
https://github.com/cvxpy/cvxpy/blob/5165b4fb750dfd237de8659383ef24b4b2e33aaf/cvxpy/expressions/variable.py#L112-L119
mongodb/mongo
d8ff665343ad29cf286ee2cf4a1960d29371937b
buildscripts/task_generation/suite_split_strategies.py
python
divide_remaining_tests_among_suites
(remaining_tests_runtimes: List[TestRuntime], suites: List[List[TestRuntime]])
Divide the list of tests given among the suites given. :param remaining_tests_runtimes: Tests that still need to be added to a suite. :param suites: Lists of tests in their test suites.
Divide the list of tests given among the suites given.
[ "Divide", "the", "list", "of", "tests", "given", "among", "the", "suites", "given", "." ]
def divide_remaining_tests_among_suites(remaining_tests_runtimes: List[TestRuntime], suites: List[List[TestRuntime]]) -> None: """ Divide the list of tests given among the suites given. :param remaining_tests_runtimes: Tests that still need to be added to a suite. ...
[ "def", "divide_remaining_tests_among_suites", "(", "remaining_tests_runtimes", ":", "List", "[", "TestRuntime", "]", ",", "suites", ":", "List", "[", "List", "[", "TestRuntime", "]", "]", ")", "->", "None", ":", "suite_idx", "=", "0", "for", "test_instance", "...
https://github.com/mongodb/mongo/blob/d8ff665343ad29cf286ee2cf4a1960d29371937b/buildscripts/task_generation/suite_split_strategies.py#L14-L28
microsoft/ivy
9f3c7ecc0b2383129fdd0953e10890d98d09a82d
ivy/ivy_dafny_grammar.py
python
p_opt_semi_semi
(p)
opt_semi : SEMI
opt_semi : SEMI
[ "opt_semi", ":", "SEMI" ]
def p_opt_semi_semi(p): 'opt_semi : SEMI'
[ "def", "p_opt_semi_semi", "(", "p", ")", ":" ]
https://github.com/microsoft/ivy/blob/9f3c7ecc0b2383129fdd0953e10890d98d09a82d/ivy/ivy_dafny_grammar.py#L66-L67
rdiankov/openrave
d1a23023fd4b58f077d2ca949ceaf1b91f3f13d7
python/examples/collision.py
python
run
(args=None)
Command-line execution of the example. :param args: arguments for script to parse, if not specified will use sys.argv
Command-line execution of the example.
[ "Command", "-", "line", "execution", "of", "the", "example", "." ]
def run(args=None): """Command-line execution of the example. :param args: arguments for script to parse, if not specified will use sys.argv """ parser = OptionParser(description='Example shows how to query collision detection information using openravepy') OpenRAVEGlobalArguments.addOptions(parser...
[ "def", "run", "(", "args", "=", "None", ")", ":", "parser", "=", "OptionParser", "(", "description", "=", "'Example shows how to query collision detection information using openravepy'", ")", "OpenRAVEGlobalArguments", ".", "addOptions", "(", "parser", ")", "(", "option...
https://github.com/rdiankov/openrave/blob/d1a23023fd4b58f077d2ca949ceaf1b91f3f13d7/python/examples/collision.py#L121-L129
eclipse/sumo
7132a9b8b6eea734bdec38479026b4d8c4336d03
tools/contributed/sumopy/coremodules/demand/demand.py
python
Demand.update_netoffset
(self, deltaoffset)
Called when network offset has changed. Children may need to adjust their coordinates.
Called when network offset has changed. Children may need to adjust their coordinates.
[ "Called", "when", "network", "offset", "has", "changed", ".", "Children", "may", "need", "to", "adjust", "their", "coordinates", "." ]
def update_netoffset(self, deltaoffset): """ Called when network offset has changed. Children may need to adjust their coordinates. """ # self.odintervals.update_netoffset(deltaoffset) pass
[ "def", "update_netoffset", "(", "self", ",", "deltaoffset", ")", ":", "# self.odintervals.update_netoffset(deltaoffset)", "pass" ]
https://github.com/eclipse/sumo/blob/7132a9b8b6eea734bdec38479026b4d8c4336d03/tools/contributed/sumopy/coremodules/demand/demand.py#L149-L155
intel/llvm
e6d0547e9d99b5a56430c4749f6c7e328bf221ab
llvm/utils/check_ninja_deps.py
python
toposort
(g)
Topologically sort a graph. The input g is a pygraphviz graph object representing a DAG. The function yields the vertices of g in an arbitrary order consistent with the edges, so that for any edge v->w, v is output before w.
Topologically sort a graph.
[ "Topologically", "sort", "a", "graph", "." ]
def toposort(g): """Topologically sort a graph. The input g is a pygraphviz graph object representing a DAG. The function yields the vertices of g in an arbitrary order consistent with the edges, so that for any edge v->w, v is output before w.""" # Count the number of immediate predecessors *not ...
[ "def", "toposort", "(", "g", ")", ":", "# Count the number of immediate predecessors *not yet output* for each", "# vertex. Initially this is simply their in-degrees.", "ideg", "=", "{", "v", ":", "g", ".", "in_degree", "(", "v", ")", "for", "v", "in", "g", ".", "node...
https://github.com/intel/llvm/blob/e6d0547e9d99b5a56430c4749f6c7e328bf221ab/llvm/utils/check_ninja_deps.py#L61-L89
ceph/ceph
959663007321a369c83218414a29bd9dbc8bda3a
src/pybind/mgr/crash/module.py
python
Module.do_info
(self, id: str)
return 0, val, ''
show crash dump metadata
show crash dump metadata
[ "show", "crash", "dump", "metadata" ]
def do_info(self, id: str) -> Tuple[int, str, str]: """ show crash dump metadata """ crashid = id assert self.crashes is not None crash = self.crashes.get(crashid) if not crash: return errno.EINVAL, '', 'crash info: %s not found' % crashid val ...
[ "def", "do_info", "(", "self", ",", "id", ":", "str", ")", "->", "Tuple", "[", "int", ",", "str", ",", "str", "]", ":", "crashid", "=", "id", "assert", "self", ".", "crashes", "is", "not", "None", "crash", "=", "self", ".", "crashes", ".", "get",...
https://github.com/ceph/ceph/blob/959663007321a369c83218414a29bd9dbc8bda3a/src/pybind/mgr/crash/module.py#L220-L230
stan-dev/math
5fd79f89933269a4ca4d8dd1fde2a36d53d4768c
lib/tbb_2020.3/python/tbb/pool.py
python
AbstractResultCollector.register_result
(self, apply_result)
Used to identify which results we're waiting for. Will always be called BEFORE the Jobs get submitted to the work queue, and BEFORE the __iter__ and _get_result() methods can be called \param apply_result ApplyResult object to add in our collection
Used to identify which results we're waiting for. Will always be called BEFORE the Jobs get submitted to the work queue, and BEFORE the __iter__ and _get_result() methods can be called \param apply_result ApplyResult object to add in our collection
[ "Used", "to", "identify", "which", "results", "we", "re", "waiting", "for", ".", "Will", "always", "be", "called", "BEFORE", "the", "Jobs", "get", "submitted", "to", "the", "work", "queue", "and", "BEFORE", "the", "__iter__", "and", "_get_result", "()", "m...
def register_result(self, apply_result): """Used to identify which results we're waiting for. Will always be called BEFORE the Jobs get submitted to the work queue, and BEFORE the __iter__ and _get_result() methods can be called \param apply_result ApplyResult object to add in ou...
[ "def", "register_result", "(", "self", ",", "apply_result", ")", ":", "raise", "NotImplementedError", "(", "\"Children classes must implement it\"", ")" ]
https://github.com/stan-dev/math/blob/5fd79f89933269a4ca4d8dd1fde2a36d53d4768c/lib/tbb_2020.3/python/tbb/pool.py#L417-L424
aws/lumberyard
f85344403c1c2e77ec8c75deb2c116e97b713217
dev/Tools/AWSPythonSDK/1.5.8/docutils/nodes.py
python
Element.append_attr_list
(self, attr, values)
For each element in values, if it does not exist in self[attr], append it. NOTE: Requires self[attr] and values to be sequence type and the former should specifically be a list.
For each element in values, if it does not exist in self[attr], append it.
[ "For", "each", "element", "in", "values", "if", "it", "does", "not", "exist", "in", "self", "[", "attr", "]", "append", "it", "." ]
def append_attr_list(self, attr, values): """ For each element in values, if it does not exist in self[attr], append it. NOTE: Requires self[attr] and values to be sequence type and the former should specifically be a list. """ # List Concatenation for va...
[ "def", "append_attr_list", "(", "self", ",", "attr", ",", "values", ")", ":", "# List Concatenation", "for", "value", "in", "values", ":", "if", "not", "value", "in", "self", "[", "attr", "]", ":", "self", "[", "attr", "]", ".", "append", "(", "value",...
https://github.com/aws/lumberyard/blob/f85344403c1c2e77ec8c75deb2c116e97b713217/dev/Tools/AWSPythonSDK/1.5.8/docutils/nodes.py#L707-L718
deepmind/reverb
ef3c8f0be1b720a741d2dee335e15e44668c291a
reverb/trajectory_writer.py
python
TrajectoryColumn.numpy
(self)
return np.stack([ref.numpy() for ref in self._data_references])
Gets and stacks all the referenced data. Data is copied from buffers in the C++ layers and may involve decompression of already created chunks. This can be quite a memory intensive operation when used on large arrays. Returns: All referenced data stacked in a single numpy array if column isn't ...
Gets and stacks all the referenced data.
[ "Gets", "and", "stacks", "all", "the", "referenced", "data", "." ]
def numpy(self) -> np.ndarray: """Gets and stacks all the referenced data. Data is copied from buffers in the C++ layers and may involve decompression of already created chunks. This can be quite a memory intensive operation when used on large arrays. Returns: All referenced data stacked in ...
[ "def", "numpy", "(", "self", ")", "->", "np", ".", "ndarray", ":", "if", "any", "(", "reference", ".", "expired", "for", "reference", "in", "self", ".", "_data_references", ")", ":", "raise", "RuntimeError", "(", "'Cannot convert TrajectoryColumn with expired da...
https://github.com/deepmind/reverb/blob/ef3c8f0be1b720a741d2dee335e15e44668c291a/reverb/trajectory_writer.py#L655-L678
aws/lumberyard
f85344403c1c2e77ec8c75deb2c116e97b713217
dev/Tools/build/waf-1.7.13/waflib/Logs.py
python
formatter.format
(self, rec)
return logging.Formatter.format(self, rec)
Messages in warning, error or info mode are displayed in color by default
Messages in warning, error or info mode are displayed in color by default
[ "Messages", "in", "warning", "error", "or", "info", "mode", "are", "displayed", "in", "color", "by", "default" ]
def format(self, rec): """Messages in warning, error or info mode are displayed in color by default""" if rec.levelno >= logging.WARNING or rec.levelno == logging.INFO: try: msg = rec.msg.decode(sys.stdout.encoding or 'iso8859-1', 'replace') except Exception: msg = rec.msg return '%s%s%s' % (rec.c1...
[ "def", "format", "(", "self", ",", "rec", ")", ":", "if", "rec", ".", "levelno", ">=", "logging", ".", "WARNING", "or", "rec", ".", "levelno", "==", "logging", ".", "INFO", ":", "try", ":", "msg", "=", "rec", ".", "msg", ".", "decode", "(", "sys"...
https://github.com/aws/lumberyard/blob/f85344403c1c2e77ec8c75deb2c116e97b713217/dev/Tools/build/waf-1.7.13/waflib/Logs.py#L210-L218
wlanjie/AndroidFFmpeg
7baf9122f4b8e1c74e7baf4be5c422c7a5ba5aaf
tools/fdk-aac-build/armeabi/toolchain/lib/python2.7/pydoc.py
python
ttypager
(text)
Page through text on a text terminal.
Page through text on a text terminal.
[ "Page", "through", "text", "on", "a", "text", "terminal", "." ]
def ttypager(text): """Page through text on a text terminal.""" lines = split(plain(text), '\n') try: import tty fd = sys.stdin.fileno() old = tty.tcgetattr(fd) tty.setcbreak(fd) getchar = lambda: sys.stdin.read(1) except (ImportError, AttributeError): tty...
[ "def", "ttypager", "(", "text", ")", ":", "lines", "=", "split", "(", "plain", "(", "text", ")", ",", "'\\n'", ")", "try", ":", "import", "tty", "fd", "=", "sys", ".", "stdin", ".", "fileno", "(", ")", "old", "=", "tty", ".", "tcgetattr", "(", ...
https://github.com/wlanjie/AndroidFFmpeg/blob/7baf9122f4b8e1c74e7baf4be5c422c7a5ba5aaf/tools/fdk-aac-build/armeabi/toolchain/lib/python2.7/pydoc.py#L1395-L1431
hanpfei/chromium-net
392cc1fa3a8f92f42e4071ab6e674d8e0482f83f
third_party/catapult/third_party/gsutil/third_party/rsa/rsa/_version133.py
python
fast_exponentiation
(a, p, n)
return result
Calculates r = a^p mod n
Calculates r = a^p mod n
[ "Calculates", "r", "=", "a^p", "mod", "n" ]
def fast_exponentiation(a, p, n): """Calculates r = a^p mod n """ result = a % n remainders = [] while p != 1: remainders.append(p & 1) p = p >> 1 while remainders: rem = remainders.pop() result = ((a ** rem) * result ** 2) % n return result
[ "def", "fast_exponentiation", "(", "a", ",", "p", ",", "n", ")", ":", "result", "=", "a", "%", "n", "remainders", "=", "[", "]", "while", "p", "!=", "1", ":", "remainders", ".", "append", "(", "p", "&", "1", ")", "p", "=", "p", ">>", "1", "wh...
https://github.com/hanpfei/chromium-net/blob/392cc1fa3a8f92f42e4071ab6e674d8e0482f83f/third_party/catapult/third_party/gsutil/third_party/rsa/rsa/_version133.py#L88-L99
baidu-research/tensorflow-allreduce
66d5b855e90b0949e9fa5cca5599fd729a70e874
tensorflow/python/framework/errors_impl.py
python
AlreadyExistsError.__init__
(self, node_def, op, message)
Creates an `AlreadyExistsError`.
Creates an `AlreadyExistsError`.
[ "Creates", "an", "AlreadyExistsError", "." ]
def __init__(self, node_def, op, message): """Creates an `AlreadyExistsError`.""" super(AlreadyExistsError, self).__init__(node_def, op, message, ALREADY_EXISTS)
[ "def", "__init__", "(", "self", ",", "node_def", ",", "op", ",", "message", ")", ":", "super", "(", "AlreadyExistsError", ",", "self", ")", ".", "__init__", "(", "node_def", ",", "op", ",", "message", ",", "ALREADY_EXISTS", ")" ]
https://github.com/baidu-research/tensorflow-allreduce/blob/66d5b855e90b0949e9fa5cca5599fd729a70e874/tensorflow/python/framework/errors_impl.py#L253-L256
zeroc-ice/ice
6df7df6039674d58fb5ab9a08e46f28591a210f7
config/makeprops.py
python
PropertyHandler.propertyImpl
(self, propertyName)
Needs to be overridden in derived class
Needs to be overridden in derived class
[ "Needs", "to", "be", "overridden", "in", "derived", "class" ]
def propertyImpl(self, propertyName): """Needs to be overridden in derived class""" pass
[ "def", "propertyImpl", "(", "self", ",", "propertyName", ")", ":", "pass" ]
https://github.com/zeroc-ice/ice/blob/6df7df6039674d58fb5ab9a08e46f28591a210f7/config/makeprops.py#L230-L232
facebookincubator/mvfst
034a40c797485113d00127852d4df3c5bb44b3ed
build/fbcode_builder/getdeps/builder.py
python
CargoBuilder._resolve_crate_to_path
(crate, git_conf)
Tries to find <crate> in git_conf["inst_dir"] by searching a [package] keyword followed by name = "<crate>".
Tries to find <crate> in git_conf["inst_dir"] by searching a [package] keyword followed by name = "<crate>".
[ "Tries", "to", "find", "<crate", ">", "in", "git_conf", "[", "inst_dir", "]", "by", "searching", "a", "[", "package", "]", "keyword", "followed", "by", "name", "=", "<crate", ">", "." ]
def _resolve_crate_to_path(crate, git_conf): """ Tries to find <crate> in git_conf["inst_dir"] by searching a [package] keyword followed by name = "<crate>". """ source_dir = git_conf["source_dir"] search_pattern = '[package]\nname = "{}"'.format(crate) for root,...
[ "def", "_resolve_crate_to_path", "(", "crate", ",", "git_conf", ")", ":", "source_dir", "=", "git_conf", "[", "\"source_dir\"", "]", "search_pattern", "=", "'[package]\\nname = \"{}\"'", ".", "format", "(", "crate", ")", "for", "root", ",", "_", ",", "files", ...
https://github.com/facebookincubator/mvfst/blob/034a40c797485113d00127852d4df3c5bb44b3ed/build/fbcode_builder/getdeps/builder.py#L1477-L1492
microsoft/clang
86d4513d3e0daa4d5a29b0b1de7c854ca15f9fe5
bindings/python/clang/cindex.py
python
SourceRange.__contains__
(self, other)
return False
Useful to detect the Token/Lexer bug
Useful to detect the Token/Lexer bug
[ "Useful", "to", "detect", "the", "Token", "/", "Lexer", "bug" ]
def __contains__(self, other): """Useful to detect the Token/Lexer bug""" if not isinstance(other, SourceLocation): return False if other.file is None and self.start.file is None: pass elif ( self.start.file.name != other.file.name or other.file.nam...
[ "def", "__contains__", "(", "self", ",", "other", ")", ":", "if", "not", "isinstance", "(", "other", ",", "SourceLocation", ")", ":", "return", "False", "if", "other", ".", "file", "is", "None", "and", "self", ".", "start", ".", "file", "is", "None", ...
https://github.com/microsoft/clang/blob/86d4513d3e0daa4d5a29b0b1de7c854ca15f9fe5/bindings/python/clang/cindex.py#L327-L348
catboost/catboost
167f64f237114a4d10b2b4ee42adb4569137debe
contrib/tools/python3/src/Lib/pdb.py
python
Pdb.checkline
(self, filename, lineno)
return lineno
Check whether specified line seems to be executable. Return `lineno` if it is, 0 if not (e.g. a docstring, comment, blank line or EOF). Warning: testing is not comprehensive.
Check whether specified line seems to be executable.
[ "Check", "whether", "specified", "line", "seems", "to", "be", "executable", "." ]
def checkline(self, filename, lineno): """Check whether specified line seems to be executable. Return `lineno` if it is, 0 if not (e.g. a docstring, comment, blank line or EOF). Warning: testing is not comprehensive. """ # this method should be callable before starting debugging...
[ "def", "checkline", "(", "self", ",", "filename", ",", "lineno", ")", ":", "# this method should be callable before starting debugging, so default", "# to \"no globals\" if there is no current frame", "frame", "=", "getattr", "(", "self", ",", "'curframe'", ",", "None", ")"...
https://github.com/catboost/catboost/blob/167f64f237114a4d10b2b4ee42adb4569137debe/contrib/tools/python3/src/Lib/pdb.py#L746-L766
aws/lumberyard
f85344403c1c2e77ec8c75deb2c116e97b713217
dev/Tools/Python/3.7.10/linux_x64/lib/python3.7/turtle.py
python
TurtleScreen.ontimer
(self, fun, t=0)
Install a timer, which calls fun after t milliseconds. Arguments: fun -- a function with no arguments. t -- a number >= 0 Example (for a TurtleScreen instance named screen): >>> running = True >>> def f(): ... if running: ... fd(50) ...
Install a timer, which calls fun after t milliseconds.
[ "Install", "a", "timer", "which", "calls", "fun", "after", "t", "milliseconds", "." ]
def ontimer(self, fun, t=0): """Install a timer, which calls fun after t milliseconds. Arguments: fun -- a function with no arguments. t -- a number >= 0 Example (for a TurtleScreen instance named screen): >>> running = True >>> def f(): ... if runn...
[ "def", "ontimer", "(", "self", ",", "fun", ",", "t", "=", "0", ")", ":", "self", ".", "_ontimer", "(", "fun", ",", "t", ")" ]
https://github.com/aws/lumberyard/blob/f85344403c1c2e77ec8c75deb2c116e97b713217/dev/Tools/Python/3.7.10/linux_x64/lib/python3.7/turtle.py#L1440-L1459
panda3d/panda3d
833ad89ebad58395d0af0b7ec08538e5e4308265
direct/src/showbase/PythonUtil.py
python
flywheel
(*args, **kArgs)
return flywheel
>>> for i in flywheel([1,2,3], countList=[10, 5, 1]): ... print i, ... 1 2 3 1 2 1 2 1 2 1 2 1 1 1 1 1
>>> for i in flywheel([1,2,3], countList=[10, 5, 1]): ... print i, ... 1 2 3 1 2 1 2 1 2 1 2 1 1 1 1 1
[ ">>>", "for", "i", "in", "flywheel", "(", "[", "1", "2", "3", "]", "countList", "=", "[", "10", "5", "1", "]", ")", ":", "...", "print", "i", "...", "1", "2", "3", "1", "2", "1", "2", "1", "2", "1", "2", "1", "1", "1", "1", "1" ]
def flywheel(*args, **kArgs): # create a flywheel generator # see arguments and comments in flywheelGen above # example usage: """ >>> for i in flywheel([1,2,3], countList=[10, 5, 1]): ... print i, ... 1 2 3 1 2 1 2 1 2 1 2 1 1 1 1 1 """ for flywheel in makeFlywheelGen(*args, *...
[ "def", "flywheel", "(", "*", "args", ",", "*", "*", "kArgs", ")", ":", "# create a flywheel generator", "# see arguments and comments in flywheelGen above", "# example usage:", "for", "flywheel", "in", "makeFlywheelGen", "(", "*", "args", ",", "*", "*", "kArgs", ")"...
https://github.com/panda3d/panda3d/blob/833ad89ebad58395d0af0b7ec08538e5e4308265/direct/src/showbase/PythonUtil.py#L2137-L2149
wxWidgets/wxPython-Classic
19571e1ae65f1ac445f5491474121998c97a1bf0
src/osx_cocoa/_core.py
python
CommandEvent.SetExtraLong
(*args, **kwargs)
return _core_.CommandEvent_SetExtraLong(*args, **kwargs)
SetExtraLong(self, long extraLong)
SetExtraLong(self, long extraLong)
[ "SetExtraLong", "(", "self", "long", "extraLong", ")" ]
def SetExtraLong(*args, **kwargs): """SetExtraLong(self, long extraLong)""" return _core_.CommandEvent_SetExtraLong(*args, **kwargs)
[ "def", "SetExtraLong", "(", "*", "args", ",", "*", "*", "kwargs", ")", ":", "return", "_core_", ".", "CommandEvent_SetExtraLong", "(", "*", "args", ",", "*", "*", "kwargs", ")" ]
https://github.com/wxWidgets/wxPython-Classic/blob/19571e1ae65f1ac445f5491474121998c97a1bf0/src/osx_cocoa/_core.py#L5256-L5258
wxWidgets/wxPython-Classic
19571e1ae65f1ac445f5491474121998c97a1bf0
wx/tools/Editra/src/ed_txt.py
python
EdFile.EncodeText
(self)
return bOk
Do a trial run of encoding all the text to ensure that we can determine an encoding that will correctly be able to write the data to disk. @return: bool
Do a trial run of encoding all the text to ensure that we can determine an encoding that will correctly be able to write the data to disk. @return: bool
[ "Do", "a", "trial", "run", "of", "encoding", "all", "the", "text", "to", "ensure", "that", "we", "can", "determine", "an", "encoding", "that", "will", "correctly", "be", "able", "to", "write", "the", "data", "to", "disk", ".", "@return", ":", "bool" ]
def EncodeText(self): """Do a trial run of encoding all the text to ensure that we can determine an encoding that will correctly be able to write the data to disk. @return: bool """ bOk = True txt = self.__buffer.read(8) self.__buffer.seek(0) if n...
[ "def", "EncodeText", "(", "self", ")", ":", "bOk", "=", "True", "txt", "=", "self", ".", "__buffer", ".", "read", "(", "8", ")", "self", ".", "__buffer", ".", "seek", "(", "0", ")", "if", "not", "ebmlib", ".", "IsUnicode", "(", "txt", ")", ":", ...
https://github.com/wxWidgets/wxPython-Classic/blob/19571e1ae65f1ac445f5491474121998c97a1bf0/wx/tools/Editra/src/ed_txt.py#L276-L327
baidu-research/tensorflow-allreduce
66d5b855e90b0949e9fa5cca5599fd729a70e874
tensorflow/python/layers/base.py
python
Layer.variables
(self)
return self.weights
Returns the list of all layer variables/weights. Returns: A list of variables.
Returns the list of all layer variables/weights.
[ "Returns", "the", "list", "of", "all", "layer", "variables", "/", "weights", "." ]
def variables(self): """Returns the list of all layer variables/weights. Returns: A list of variables. """ return self.weights
[ "def", "variables", "(", "self", ")", ":", "return", "self", ".", "weights" ]
https://github.com/baidu-research/tensorflow-allreduce/blob/66d5b855e90b0949e9fa5cca5599fd729a70e874/tensorflow/python/layers/base.py#L166-L172
wxWidgets/wxPython-Classic
19571e1ae65f1ac445f5491474121998c97a1bf0
src/msw/_misc.py
python
DateTime_GetEnglishWeekDayName
(*args, **kwargs)
return _misc_.DateTime_GetEnglishWeekDayName(*args, **kwargs)
DateTime_GetEnglishWeekDayName(int weekday, int flags=Name_Full) -> String
DateTime_GetEnglishWeekDayName(int weekday, int flags=Name_Full) -> String
[ "DateTime_GetEnglishWeekDayName", "(", "int", "weekday", "int", "flags", "=", "Name_Full", ")", "-", ">", "String" ]
def DateTime_GetEnglishWeekDayName(*args, **kwargs): """DateTime_GetEnglishWeekDayName(int weekday, int flags=Name_Full) -> String""" return _misc_.DateTime_GetEnglishWeekDayName(*args, **kwargs)
[ "def", "DateTime_GetEnglishWeekDayName", "(", "*", "args", ",", "*", "*", "kwargs", ")", ":", "return", "_misc_", ".", "DateTime_GetEnglishWeekDayName", "(", "*", "args", ",", "*", "*", "kwargs", ")" ]
https://github.com/wxWidgets/wxPython-Classic/blob/19571e1ae65f1ac445f5491474121998c97a1bf0/src/msw/_misc.py#L4277-L4279
pytorch/pytorch
7176c92687d3cc847cc046bf002269c6949a21c2
torch/nn/modules/transformer.py
python
Transformer.generate_square_subsequent_mask
(sz: int)
return torch.triu(torch.full((sz, sz), float('-inf')), diagonal=1)
r"""Generate a square mask for the sequence. The masked positions are filled with float('-inf'). Unmasked positions are filled with float(0.0).
r"""Generate a square mask for the sequence. The masked positions are filled with float('-inf'). Unmasked positions are filled with float(0.0).
[ "r", "Generate", "a", "square", "mask", "for", "the", "sequence", ".", "The", "masked", "positions", "are", "filled", "with", "float", "(", "-", "inf", ")", ".", "Unmasked", "positions", "are", "filled", "with", "float", "(", "0", ".", "0", ")", "." ]
def generate_square_subsequent_mask(sz: int) -> Tensor: r"""Generate a square mask for the sequence. The masked positions are filled with float('-inf'). Unmasked positions are filled with float(0.0). """ return torch.triu(torch.full((sz, sz), float('-inf')), diagonal=1)
[ "def", "generate_square_subsequent_mask", "(", "sz", ":", "int", ")", "->", "Tensor", ":", "return", "torch", ".", "triu", "(", "torch", ".", "full", "(", "(", "sz", ",", "sz", ")", ",", "float", "(", "'-inf'", ")", ")", ",", "diagonal", "=", "1", ...
https://github.com/pytorch/pytorch/blob/7176c92687d3cc847cc046bf002269c6949a21c2/torch/nn/modules/transformer.py#L152-L156
chukong/SampleGame-EarthWarrior3D
ddbda78b3c211f1b0363339a90044caf49fff1d1
proj.android/build_native.py
python
select_toolchain_version
()
Because ndk-r8e uses gcc4.6 as default. gcc4.6 doesn't support c++11. So we should select gcc4.7 when using ndk-r8e. But gcc4.7 is removed in ndk-r9, so we should determine whether gcc4.7 exist. Conclution: ndk-r8e -> use gcc4.7 ndk-r9 -> use gcc4.8
Because ndk-r8e uses gcc4.6 as default. gcc4.6 doesn't support c++11. So we should select gcc4.7 when using ndk-r8e. But gcc4.7 is removed in ndk-r9, so we should determine whether gcc4.7 exist. Conclution: ndk-r8e -> use gcc4.7 ndk-r9 -> use gcc4.8
[ "Because", "ndk", "-", "r8e", "uses", "gcc4", ".", "6", "as", "default", ".", "gcc4", ".", "6", "doesn", "t", "support", "c", "++", "11", ".", "So", "we", "should", "select", "gcc4", ".", "7", "when", "using", "ndk", "-", "r8e", ".", "But", "gcc4...
def select_toolchain_version(): '''Because ndk-r8e uses gcc4.6 as default. gcc4.6 doesn't support c++11. So we should select gcc4.7 when using ndk-r8e. But gcc4.7 is removed in ndk-r9, so we should determine whether gcc4.7 exist. Conclution: ndk-r8e -> use gcc4.7 ndk-r9 -> use gcc4.8 ''' ...
[ "def", "select_toolchain_version", "(", ")", ":", "ndk_root", "=", "check_environment_variables", "(", ")", "if", "os", ".", "path", ".", "isdir", "(", "os", ".", "path", ".", "join", "(", "ndk_root", ",", "\"toolchains/arm-linux-androideabi-4.8\"", ")", ")", ...
https://github.com/chukong/SampleGame-EarthWarrior3D/blob/ddbda78b3c211f1b0363339a90044caf49fff1d1/proj.android/build_native.py#L52-L69
google/filament
d21f092645b8e1e312307cbf89f1484891347c63
third_party/spirv-tools/utils/generate_grammar_tables.py
python
generate_operand_kind_table
(enums)
return '\n\n'.join((caps_arrays,) + (exts_arrays,) + enum_entries + (table,))
Returns the info table containing all SPIR-V operand kinds.
Returns the info table containing all SPIR-V operand kinds.
[ "Returns", "the", "info", "table", "containing", "all", "SPIR", "-", "V", "operand", "kinds", "." ]
def generate_operand_kind_table(enums): """Returns the info table containing all SPIR-V operand kinds.""" # We only need to output info tables for those operand kinds that are enums. enums = [e for e in enums if e.get('category') in ['ValueEnum', 'BitEnum']] caps = [entry.get('capabilities', []) ...
[ "def", "generate_operand_kind_table", "(", "enums", ")", ":", "# We only need to output info tables for those operand kinds that are enums.", "enums", "=", "[", "e", "for", "e", "in", "enums", "if", "e", ".", "get", "(", "'category'", ")", "in", "[", "'ValueEnum'", ...
https://github.com/google/filament/blob/d21f092645b8e1e312307cbf89f1484891347c63/third_party/spirv-tools/utils/generate_grammar_tables.py#L510-L549
rapidsai/cudf
d5b2448fc69f17509304d594f029d0df56984962
python/cudf/cudf/core/frame.py
python
Frame.acos
(self)
return result
Get Trigonometric inverse cosine, element-wise. The inverse of cos so that, if y = x.cos(), then x = y.acos() Returns ------- DataFrame/Series/Index Result of the trigonometric operation. Examples -------- >>> import cudf >>> ser = cudf.Seri...
Get Trigonometric inverse cosine, element-wise.
[ "Get", "Trigonometric", "inverse", "cosine", "element", "-", "wise", "." ]
def acos(self): """ Get Trigonometric inverse cosine, element-wise. The inverse of cos so that, if y = x.cos(), then x = y.acos() Returns ------- DataFrame/Series/Index Result of the trigonometric operation. Examples -------- >>> imp...
[ "def", "acos", "(", "self", ")", ":", "result", "=", "self", ".", "copy", "(", "deep", "=", "False", ")", "for", "col", "in", "result", ".", "_data", ":", "min_float_dtype", "=", "cudf", ".", "utils", ".", "dtypes", ".", "get_min_float_dtype", "(", "...
https://github.com/rapidsai/cudf/blob/d5b2448fc69f17509304d594f029d0df56984962/python/cudf/cudf/core/frame.py#L2890-L2946
snap-stanford/snap-python
d53c51b0a26aa7e3e7400b014cdf728948fde80a
setup/snap.py
python
TInt_LoadFrugalIntV
(*args)
return _snap.TInt_LoadFrugalIntV(*args)
LoadFrugalIntV(TSIn SIn, TIntV IntV, bool ClrP=True) Parameters: SIn: TSIn & IntV: TVec< TInt,int > & ClrP: bool TInt_LoadFrugalIntV(TSIn SIn, TIntV IntV) Parameters: SIn: TSIn & IntV: TVec< TInt,int > &
LoadFrugalIntV(TSIn SIn, TIntV IntV, bool ClrP=True)
[ "LoadFrugalIntV", "(", "TSIn", "SIn", "TIntV", "IntV", "bool", "ClrP", "=", "True", ")" ]
def TInt_LoadFrugalIntV(*args): """ LoadFrugalIntV(TSIn SIn, TIntV IntV, bool ClrP=True) Parameters: SIn: TSIn & IntV: TVec< TInt,int > & ClrP: bool TInt_LoadFrugalIntV(TSIn SIn, TIntV IntV) Parameters: SIn: TSIn & IntV: TVec< TInt,int > & """ return _...
[ "def", "TInt_LoadFrugalIntV", "(", "*", "args", ")", ":", "return", "_snap", ".", "TInt_LoadFrugalIntV", "(", "*", "args", ")" ]
https://github.com/snap-stanford/snap-python/blob/d53c51b0a26aa7e3e7400b014cdf728948fde80a/setup/snap.py#L13539-L13555
wxWidgets/wxPython-Classic
19571e1ae65f1ac445f5491474121998c97a1bf0
src/msw/_gdi.py
python
Font_AdjustToSymbolicSize
(*args, **kwargs)
return _gdi_.Font_AdjustToSymbolicSize(*args, **kwargs)
Font_AdjustToSymbolicSize(int size, int base) -> int
Font_AdjustToSymbolicSize(int size, int base) -> int
[ "Font_AdjustToSymbolicSize", "(", "int", "size", "int", "base", ")", "-", ">", "int" ]
def Font_AdjustToSymbolicSize(*args, **kwargs): """Font_AdjustToSymbolicSize(int size, int base) -> int""" return _gdi_.Font_AdjustToSymbolicSize(*args, **kwargs)
[ "def", "Font_AdjustToSymbolicSize", "(", "*", "args", ",", "*", "*", "kwargs", ")", ":", "return", "_gdi_", ".", "Font_AdjustToSymbolicSize", "(", "*", "args", ",", "*", "*", "kwargs", ")" ]
https://github.com/wxWidgets/wxPython-Classic/blob/19571e1ae65f1ac445f5491474121998c97a1bf0/src/msw/_gdi.py#L2711-L2713
mapnik/mapnik
f3da900c355e1d15059c4a91b00203dcc9d9f0ef
scons/scons-local-4.1.0/SCons/SConsign.py
python
DirFile.__init__
(self, dir)
dir - the directory for the file
dir - the directory for the file
[ "dir", "-", "the", "directory", "for", "the", "file" ]
def __init__(self, dir): """ dir - the directory for the file """ self.dir = dir self.sconsign = os.path.join(dir.get_internal_path(), '.sconsign') try: fp = open(self.sconsign, 'rb') except IOError: fp = None try: Di...
[ "def", "__init__", "(", "self", ",", "dir", ")", ":", "self", ".", "dir", "=", "dir", "self", ".", "sconsign", "=", "os", ".", "path", ".", "join", "(", "dir", ".", "get_internal_path", "(", ")", ",", "'.sconsign'", ")", "try", ":", "fp", "=", "o...
https://github.com/mapnik/mapnik/blob/f3da900c355e1d15059c4a91b00203dcc9d9f0ef/scons/scons-local-4.1.0/SCons/SConsign.py#L315-L342
wlanjie/AndroidFFmpeg
7baf9122f4b8e1c74e7baf4be5c422c7a5ba5aaf
tools/fdk-aac-build/armeabi/toolchain/lib/python2.7/lib-tk/ttk.py
python
Treeview.tag_bind
(self, tagname, sequence=None, callback=None)
Bind a callback for the given event sequence to the tag tagname. When an event is delivered to an item, the callbacks for each of the item's tags option are called.
Bind a callback for the given event sequence to the tag tagname. When an event is delivered to an item, the callbacks for each of the item's tags option are called.
[ "Bind", "a", "callback", "for", "the", "given", "event", "sequence", "to", "the", "tag", "tagname", ".", "When", "an", "event", "is", "delivered", "to", "an", "item", "the", "callbacks", "for", "each", "of", "the", "item", "s", "tags", "option", "are", ...
def tag_bind(self, tagname, sequence=None, callback=None): """Bind a callback for the given event sequence to the tag tagname. When an event is delivered to an item, the callbacks for each of the item's tags option are called.""" self._bind((self._w, "tag", "bind", tagname), sequence, ca...
[ "def", "tag_bind", "(", "self", ",", "tagname", ",", "sequence", "=", "None", ",", "callback", "=", "None", ")", ":", "self", ".", "_bind", "(", "(", "self", ".", "_w", ",", "\"tag\"", ",", "\"bind\"", ",", "tagname", ")", ",", "sequence", ",", "ca...
https://github.com/wlanjie/AndroidFFmpeg/blob/7baf9122f4b8e1c74e7baf4be5c422c7a5ba5aaf/tools/fdk-aac-build/armeabi/toolchain/lib/python2.7/lib-tk/ttk.py#L1428-L1432
rsocket/rsocket-cpp
45ed594ebd6701f40795c31ec922d784ec7fc921
build/fbcode_builder/getdeps/fetcher.py
python
ShipitPathMap._minimize_roots
(self)
compute the de-duplicated set of roots within fbsource. We take the shortest common directory prefix to make this determination
compute the de-duplicated set of roots within fbsource. We take the shortest common directory prefix to make this determination
[ "compute", "the", "de", "-", "duplicated", "set", "of", "roots", "within", "fbsource", ".", "We", "take", "the", "shortest", "common", "directory", "prefix", "to", "make", "this", "determination" ]
def _minimize_roots(self): """compute the de-duplicated set of roots within fbsource. We take the shortest common directory prefix to make this determination""" self.roots.sort(key=len) minimized = [] for r in self.roots: add_this_entry = True for...
[ "def", "_minimize_roots", "(", "self", ")", ":", "self", ".", "roots", ".", "sort", "(", "key", "=", "len", ")", "minimized", "=", "[", "]", "for", "r", "in", "self", ".", "roots", ":", "add_this_entry", "=", "True", "for", "existing", "in", "minimiz...
https://github.com/rsocket/rsocket-cpp/blob/45ed594ebd6701f40795c31ec922d784ec7fc921/build/fbcode_builder/getdeps/fetcher.py#L391-L407
tensorflow/tensorflow
419e3a6b650ea4bd1b0cba23c4348f8a69f3272e
tensorflow/python/ops/ragged/ragged_shape.py
python
_list_with_ellipsis_to_str
(arr)
return "[" + _element_to_string(arr[0]) + _list_tail_with_ellipsis(arr[1:])
Print a list that might have ellipsis.
Print a list that might have ellipsis.
[ "Print", "a", "list", "that", "might", "have", "ellipsis", "." ]
def _list_with_ellipsis_to_str(arr): """Print a list that might have ellipsis.""" if not arr: return "[]" return "[" + _element_to_string(arr[0]) + _list_tail_with_ellipsis(arr[1:])
[ "def", "_list_with_ellipsis_to_str", "(", "arr", ")", ":", "if", "not", "arr", ":", "return", "\"[]\"", "return", "\"[\"", "+", "_element_to_string", "(", "arr", "[", "0", "]", ")", "+", "_list_tail_with_ellipsis", "(", "arr", "[", "1", ":", "]", ")" ]
https://github.com/tensorflow/tensorflow/blob/419e3a6b650ea4bd1b0cba23c4348f8a69f3272e/tensorflow/python/ops/ragged/ragged_shape.py#L2264-L2268
Slicer/SlicerGitSVNArchive
65e92bb16c2b32ea47a1a66bee71f238891ee1ca
Modules/Scripted/EditorLib/ChangeIslandEffect.py
python
ChangeIslandEffectTool.processEvent
(self, caller=None, event=None)
handle events from the render window interactor
handle events from the render window interactor
[ "handle", "events", "from", "the", "render", "window", "interactor" ]
def processEvent(self, caller=None, event=None): """ handle events from the render window interactor """ if super(ChangeIslandEffectTool,self).processEvent(caller,event): return # events from the interactory if event == "LeftButtonPressEvent": self.logic.undoRedo = self.undoRedo ...
[ "def", "processEvent", "(", "self", ",", "caller", "=", "None", ",", "event", "=", "None", ")", ":", "if", "super", "(", "ChangeIslandEffectTool", ",", "self", ")", ".", "processEvent", "(", "caller", ",", "event", ")", ":", "return", "# events from the in...
https://github.com/Slicer/SlicerGitSVNArchive/blob/65e92bb16c2b32ea47a1a66bee71f238891ee1ca/Modules/Scripted/EditorLib/ChangeIslandEffect.py#L112-L125
adobe/chromium
cfe5bf0b51b1f6b9fe239c2a3c2f2364da9967d7
third_party/mesa/MesaLib/src/mesa/main/APIspecutil.py
python
_Conversion
(func, src_param)
return (dst_param.base_type(), conversion)
Return the destination type of the conversion, or None.
Return the destination type of the conversion, or None.
[ "Return", "the", "destination", "type", "of", "the", "conversion", "or", "None", "." ]
def _Conversion(func, src_param): """Return the destination type of the conversion, or None.""" alias, need_conv = __aliases[func.name] if need_conv: dst_param = alias.get_param(src_param.name) if src_param.type == dst_param.type: need_conv = False if not need_conv: r...
[ "def", "_Conversion", "(", "func", ",", "src_param", ")", ":", "alias", ",", "need_conv", "=", "__aliases", "[", "func", ".", "name", "]", "if", "need_conv", ":", "dst_param", "=", "alias", ".", "get_param", "(", "src_param", ".", "name", ")", "if", "s...
https://github.com/adobe/chromium/blob/cfe5bf0b51b1f6b9fe239c2a3c2f2364da9967d7/third_party/mesa/MesaLib/src/mesa/main/APIspecutil.py#L139-L171
papyrussolution/OpenPapyrus
bbfb5ec2ea2109b8e2f125edd838e12eaf7b8b91
Src/OSF/ctemplate/src/htmlparser/generate_fsm.py
python
FSMGenerateC._CreateNumStates
(self)
return "#define %s_NUM_STATES %s" % (self._config.name.upper(), str(len(self._config.states) + 1))
Print a Macro defining the number of states.
Print a Macro defining the number of states.
[ "Print", "a", "Macro", "defining", "the", "number", "of", "states", "." ]
def _CreateNumStates(self): """Print a Macro defining the number of states.""" return "#define %s_NUM_STATES %s" % (self._config.name.upper(), str(len(self._config.states) + 1))
[ "def", "_CreateNumStates", "(", "self", ")", ":", "return", "\"#define %s_NUM_STATES %s\"", "%", "(", "self", ".", "_config", ".", "name", ".", "upper", "(", ")", ",", "str", "(", "len", "(", "self", ".", "_config", ".", "states", ")", "+", "1", ")", ...
https://github.com/papyrussolution/OpenPapyrus/blob/bbfb5ec2ea2109b8e2f125edd838e12eaf7b8b91/Src/OSF/ctemplate/src/htmlparser/generate_fsm.py#L168-L172
yrnkrn/zapcc
c6a8aa30006d997eff0d60fd37b0e62b8aa0ea50
tools/clang/bindings/python/clang/cindex.py
python
Type.element_type
(self)
return result
Retrieve the Type of elements within this Type. If accessed on a type that is not an array, complex, or vector type, an exception will be raised.
Retrieve the Type of elements within this Type.
[ "Retrieve", "the", "Type", "of", "elements", "within", "this", "Type", "." ]
def element_type(self): """Retrieve the Type of elements within this Type. If accessed on a type that is not an array, complex, or vector type, an exception will be raised. """ result = conf.lib.clang_getElementType(self) if result.kind == TypeKind.INVALID: r...
[ "def", "element_type", "(", "self", ")", ":", "result", "=", "conf", ".", "lib", ".", "clang_getElementType", "(", "self", ")", "if", "result", ".", "kind", "==", "TypeKind", ".", "INVALID", ":", "raise", "Exception", "(", "'Element type not available on this ...
https://github.com/yrnkrn/zapcc/blob/c6a8aa30006d997eff0d60fd37b0e62b8aa0ea50/tools/clang/bindings/python/clang/cindex.py#L2203-L2213
nsnam/ns-3-dev-git
efdb2e21f45c0a87a60b47c547b68fa140a7b686
src/visualizer/visualizer/plugins/wifi_intrastructure_link.py
python
WifiLinkMonitor.__init__
(self, dummy_viz)
! Initialize function. @param self The object pointer. @param dummy_viz A dummy visualizer
! Initialize function.
[ "!", "Initialize", "function", "." ]
def __init__(self, dummy_viz): """! Initialize function. @param self The object pointer. @param dummy_viz A dummy visualizer """ self.access_points = {} # bssid -> node self.stations = []
[ "def", "__init__", "(", "self", ",", "dummy_viz", ")", ":", "self", ".", "access_points", "=", "{", "}", "# bssid -> node", "self", ".", "stations", "=", "[", "]" ]
https://github.com/nsnam/ns-3-dev-git/blob/efdb2e21f45c0a87a60b47c547b68fa140a7b686/src/visualizer/visualizer/plugins/wifi_intrastructure_link.py#L113-L119
lawy623/SVS
b7c7ae367c82a4797ff4a896a2ff304f02e7f724
caffe/scripts/cpp_lint.py
python
ReplaceAll
(pattern, rep, s)
return _regexp_compile_cache[pattern].sub(rep, s)
Replaces instances of pattern in a string with a replacement. The compiled regex is kept in a cache shared by Match and Search. Args: pattern: regex pattern rep: replacement text s: search string Returns: string with replacements made (or original string if no replacements)
Replaces instances of pattern in a string with a replacement.
[ "Replaces", "instances", "of", "pattern", "in", "a", "string", "with", "a", "replacement", "." ]
def ReplaceAll(pattern, rep, s): """Replaces instances of pattern in a string with a replacement. The compiled regex is kept in a cache shared by Match and Search. Args: pattern: regex pattern rep: replacement text s: search string Returns: string with replacements made (or original string if...
[ "def", "ReplaceAll", "(", "pattern", ",", "rep", ",", "s", ")", ":", "if", "pattern", "not", "in", "_regexp_compile_cache", ":", "_regexp_compile_cache", "[", "pattern", "]", "=", "sre_compile", ".", "compile", "(", "pattern", ")", "return", "_regexp_compile_c...
https://github.com/lawy623/SVS/blob/b7c7ae367c82a4797ff4a896a2ff304f02e7f724/caffe/scripts/cpp_lint.py#L525-L540
GJDuck/LowFat
ecf6a0f0fa1b73a27a626cf493cc39e477b6faea
llvm-4.0.0.src/projects/compiler-rt/lib/sanitizer_common/scripts/cpplint.py
python
CheckInvalidIncrement
(filename, clean_lines, linenum, error)
Checks for invalid increment *count++. For example following function: void increment_counter(int* count) { *count++; } is invalid, because it effectively does count++, moving pointer, and should be replaced with ++*count, (*count)++ or *count += 1. Args: filename: The name of the current file. ...
Checks for invalid increment *count++.
[ "Checks", "for", "invalid", "increment", "*", "count", "++", "." ]
def CheckInvalidIncrement(filename, clean_lines, linenum, error): """Checks for invalid increment *count++. For example following function: void increment_counter(int* count) { *count++; } is invalid, because it effectively does count++, moving pointer, and should be replaced with ++*count, (*count)++ ...
[ "def", "CheckInvalidIncrement", "(", "filename", ",", "clean_lines", ",", "linenum", ",", "error", ")", ":", "line", "=", "clean_lines", ".", "elided", "[", "linenum", "]", "if", "_RE_PATTERN_INVALID_INCREMENT", ".", "match", "(", "line", ")", ":", "error", ...
https://github.com/GJDuck/LowFat/blob/ecf6a0f0fa1b73a27a626cf493cc39e477b6faea/llvm-4.0.0.src/projects/compiler-rt/lib/sanitizer_common/scripts/cpplint.py#L1335-L1354
aws/lumberyard
f85344403c1c2e77ec8c75deb2c116e97b713217
dev/Tools/Python/3.7.10/mac/Python.framework/Versions/3.7/lib/python3.7/tkinter/__init__.py
python
Listbox.selection_anchor
(self, index)
Set the fixed end oft the selection to INDEX.
Set the fixed end oft the selection to INDEX.
[ "Set", "the", "fixed", "end", "oft", "the", "selection", "to", "INDEX", "." ]
def selection_anchor(self, index): """Set the fixed end oft the selection to INDEX.""" self.tk.call(self._w, 'selection', 'anchor', index)
[ "def", "selection_anchor", "(", "self", ",", "index", ")", ":", "self", ".", "tk", ".", "call", "(", "self", ".", "_w", ",", "'selection'", ",", "'anchor'", ",", "index", ")" ]
https://github.com/aws/lumberyard/blob/f85344403c1c2e77ec8c75deb2c116e97b713217/dev/Tools/Python/3.7.10/mac/Python.framework/Versions/3.7/lib/python3.7/tkinter/__init__.py#L2822-L2824
microsoft/TSS.MSR
0f2516fca2cd9929c31d5450e39301c9bde43688
TSS.Py/src/TpmTypes.py
python
TPML_HANDLE.fromTpm
(buf)
return buf.createObj(TPML_HANDLE)
Returns new TPML_HANDLE object constructed from its marshaled representation in the given TpmBuffer buffer
Returns new TPML_HANDLE object constructed from its marshaled representation in the given TpmBuffer buffer
[ "Returns", "new", "TPML_HANDLE", "object", "constructed", "from", "its", "marshaled", "representation", "in", "the", "given", "TpmBuffer", "buffer" ]
def fromTpm(buf): """ Returns new TPML_HANDLE object constructed from its marshaled representation in the given TpmBuffer buffer """ return buf.createObj(TPML_HANDLE)
[ "def", "fromTpm", "(", "buf", ")", ":", "return", "buf", ".", "createObj", "(", "TPML_HANDLE", ")" ]
https://github.com/microsoft/TSS.MSR/blob/0f2516fca2cd9929c31d5450e39301c9bde43688/TSS.Py/src/TpmTypes.py#L4577-L4581
aws/lumberyard
f85344403c1c2e77ec8c75deb2c116e97b713217
dev/Gems/CloudGemMetric/v1/AWS/common-code/Lib/llvmlite/binding/value.py
python
TypeRef.element_type
(self)
return TypeRef(ffi.lib.LLVMPY_GetElementType(self))
Returns the pointed-to type. When the type is not a pointer, raises exception.
Returns the pointed-to type. When the type is not a pointer, raises exception.
[ "Returns", "the", "pointed", "-", "to", "type", ".", "When", "the", "type", "is", "not", "a", "pointer", "raises", "exception", "." ]
def element_type(self): """ Returns the pointed-to type. When the type is not a pointer, raises exception. """ if not self.is_pointer: raise ValueError("Type {} is not a pointer".format(self)) return TypeRef(ffi.lib.LLVMPY_GetElementType(self))
[ "def", "element_type", "(", "self", ")", ":", "if", "not", "self", ".", "is_pointer", ":", "raise", "ValueError", "(", "\"Type {} is not a pointer\"", ".", "format", "(", "self", ")", ")", "return", "TypeRef", "(", "ffi", ".", "lib", ".", "LLVMPY_GetElementT...
https://github.com/aws/lumberyard/blob/f85344403c1c2e77ec8c75deb2c116e97b713217/dev/Gems/CloudGemMetric/v1/AWS/common-code/Lib/llvmlite/binding/value.py#L64-L71
hanpfei/chromium-net
392cc1fa3a8f92f42e4071ab6e674d8e0482f83f
third_party/catapult/third_party/gsutil/third_party/boto/boto/mws/connection.py
python
MWSConnection.get_subscription
(self, request, response, **kw)
return self._post_request(request, kw, response)
Gets the subscription for the specified notification type and destination.
Gets the subscription for the specified notification type and destination.
[ "Gets", "the", "subscription", "for", "the", "specified", "notification", "type", "and", "destination", "." ]
def get_subscription(self, request, response, **kw): """Gets the subscription for the specified notification type and destination. """ return self._post_request(request, kw, response)
[ "def", "get_subscription", "(", "self", ",", "request", ",", "response", ",", "*", "*", "kw", ")", ":", "return", "self", ".", "_post_request", "(", "request", ",", "kw", ",", "response", ")" ]
https://github.com/hanpfei/chromium-net/blob/392cc1fa3a8f92f42e4071ab6e674d8e0482f83f/third_party/catapult/third_party/gsutil/third_party/boto/boto/mws/connection.py#L1028-L1032
sdhash/sdhash
b9eff63e4e5867e910f41fd69032bbb1c94a2a5e
sdhash-ui/cherrypy/lib/httputil.py
python
get_ranges
(headervalue, content_length)
return result
Return a list of (start, stop) indices from a Range header, or None. Each (start, stop) tuple will be composed of two ints, which are suitable for use in a slicing operation. That is, the header "Range: bytes=3-6", if applied against a Python string, is requesting resource[3:7]. This function will ...
Return a list of (start, stop) indices from a Range header, or None. Each (start, stop) tuple will be composed of two ints, which are suitable for use in a slicing operation. That is, the header "Range: bytes=3-6", if applied against a Python string, is requesting resource[3:7]. This function will ...
[ "Return", "a", "list", "of", "(", "start", "stop", ")", "indices", "from", "a", "Range", "header", "or", "None", ".", "Each", "(", "start", "stop", ")", "tuple", "will", "be", "composed", "of", "two", "ints", "which", "are", "suitable", "for", "use", ...
def get_ranges(headervalue, content_length): """Return a list of (start, stop) indices from a Range header, or None. Each (start, stop) tuple will be composed of two ints, which are suitable for use in a slicing operation. That is, the header "Range: bytes=3-6", if applied against a Python string, ...
[ "def", "get_ranges", "(", "headervalue", ",", "content_length", ")", ":", "if", "not", "headervalue", ":", "return", "None", "result", "=", "[", "]", "bytesunit", ",", "byteranges", "=", "headervalue", ".", "split", "(", "\"=\"", ",", "1", ")", "for", "b...
https://github.com/sdhash/sdhash/blob/b9eff63e4e5867e910f41fd69032bbb1c94a2a5e/sdhash-ui/cherrypy/lib/httputil.py#L57-L105
ricardoquesada/Spidermonkey
4a75ea2543408bd1b2c515aa95901523eeef7858
python/mach/mach/logging.py
python
LoggingManager.enable_unstructured
(self)
Enable logging of unstructured messages.
Enable logging of unstructured messages.
[ "Enable", "logging", "of", "unstructured", "messages", "." ]
def enable_unstructured(self): """Enable logging of unstructured messages.""" if self.terminal_handler: self.terminal_handler.addFilter(self.structured_filter) self.root_logger.addHandler(self.terminal_handler)
[ "def", "enable_unstructured", "(", "self", ")", ":", "if", "self", ".", "terminal_handler", ":", "self", ".", "terminal_handler", ".", "addFilter", "(", "self", ".", "structured_filter", ")", "self", ".", "root_logger", ".", "addHandler", "(", "self", ".", "...
https://github.com/ricardoquesada/Spidermonkey/blob/4a75ea2543408bd1b2c515aa95901523eeef7858/python/mach/mach/logging.py#L238-L242
root-project/root
fcd3583bb14852bf2e8cd2415717cbaac0e75896
main/python/cmdLineUtils.py
python
_createDirectories
(rootFile,pathSplit,parents)
return retcode
Same behaviour as createDirectory but allows the possibility to build an whole path recursively with the option \"parents\"
Same behaviour as createDirectory but allows the possibility to build an whole path recursively with the option \"parents\"
[ "Same", "behaviour", "as", "createDirectory", "but", "allows", "the", "possibility", "to", "build", "an", "whole", "path", "recursively", "with", "the", "option", "\\", "parents", "\\" ]
def _createDirectories(rootFile,pathSplit,parents): """Same behaviour as createDirectory but allows the possibility to build an whole path recursively with the option \"parents\" """ retcode = 0 lenPathSplit = len(pathSplit) if lenPathSplit == 0: pass elif parents: for i in range...
[ "def", "_createDirectories", "(", "rootFile", ",", "pathSplit", ",", "parents", ")", ":", "retcode", "=", "0", "lenPathSplit", "=", "len", "(", "pathSplit", ")", "if", "lenPathSplit", "==", "0", ":", "pass", "elif", "parents", ":", "for", "i", "in", "ran...
https://github.com/root-project/root/blob/fcd3583bb14852bf2e8cd2415717cbaac0e75896/main/python/cmdLineUtils.py#L1289-L1315
ChromiumWebApps/chromium
c7361d39be8abd1574e6ce8957c8dbddd4c6ccf7
tools/telemetry/third_party/pyserial/serial/sermsdos.py
python
Serial.setRTS
(self,level=1)
Set terminal status line
Set terminal status line
[ "Set", "terminal", "status", "line" ]
def setRTS(self,level=1): """Set terminal status line""" raise NotImplementedError
[ "def", "setRTS", "(", "self", ",", "level", "=", "1", ")", ":", "raise", "NotImplementedError" ]
https://github.com/ChromiumWebApps/chromium/blob/c7361d39be8abd1574e6ce8957c8dbddd4c6ccf7/tools/telemetry/third_party/pyserial/serial/sermsdos.py#L169-L171
wxWidgets/wxPython-Classic
19571e1ae65f1ac445f5491474121998c97a1bf0
src/msw/aui.py
python
AuiManager._AddPane2
(*args, **kwargs)
return _aui.AuiManager__AddPane2(*args, **kwargs)
_AddPane2(self, Window window, int direction=LEFT, String caption=wxEmptyString) -> bool
_AddPane2(self, Window window, int direction=LEFT, String caption=wxEmptyString) -> bool
[ "_AddPane2", "(", "self", "Window", "window", "int", "direction", "=", "LEFT", "String", "caption", "=", "wxEmptyString", ")", "-", ">", "bool" ]
def _AddPane2(*args, **kwargs): """_AddPane2(self, Window window, int direction=LEFT, String caption=wxEmptyString) -> bool""" return _aui.AuiManager__AddPane2(*args, **kwargs)
[ "def", "_AddPane2", "(", "*", "args", ",", "*", "*", "kwargs", ")", ":", "return", "_aui", ".", "AuiManager__AddPane2", "(", "*", "args", ",", "*", "*", "kwargs", ")" ]
https://github.com/wxWidgets/wxPython-Classic/blob/19571e1ae65f1ac445f5491474121998c97a1bf0/src/msw/aui.py#L647-L649
leela-zero/leela-zero
e3ed6310d33d75078ba74c3adf887d18439fc2e3
scripts/cpplint.py
python
CheckRedundantVirtual
(filename, clean_lines, linenum, error)
Check if line contains a redundant "virtual" function-specifier. Args: filename: The name of the current file. clean_lines: A CleansedLines instance containing the file. linenum: The number of the line to check. error: The function to call with any errors found.
Check if line contains a redundant "virtual" function-specifier.
[ "Check", "if", "line", "contains", "a", "redundant", "virtual", "function", "-", "specifier", "." ]
def CheckRedundantVirtual(filename, clean_lines, linenum, error): """Check if line contains a redundant "virtual" function-specifier. Args: filename: The name of the current file. clean_lines: A CleansedLines instance containing the file. linenum: The number of the line to check. error: The functio...
[ "def", "CheckRedundantVirtual", "(", "filename", ",", "clean_lines", ",", "linenum", ",", "error", ")", ":", "# Look for \"virtual\" on current line.", "line", "=", "clean_lines", ".", "elided", "[", "linenum", "]", "virtual", "=", "Match", "(", "r'^(.*)(\\bvirtual\...
https://github.com/leela-zero/leela-zero/blob/e3ed6310d33d75078ba74c3adf887d18439fc2e3/scripts/cpplint.py#L5739-L5800
windystrife/UnrealEngine_NVIDIAGameWorks
b50e6338a7c5b26374d66306ebc7807541ff815e
Engine/Extras/ThirdPartyNotUE/emsdk/Win64/python/2.7.5.3_64bit/Lib/lib-tk/ttk.py
python
Treeview.move
(self, item, parent, index)
Moves item to position index in parent's list of children. It is illegal to move an item under one of its descendants. If index is less than or equal to zero, item is moved to the beginning, if greater than or equal to the number of children, it is moved to the end. If item was detached...
Moves item to position index in parent's list of children.
[ "Moves", "item", "to", "position", "index", "in", "parent", "s", "list", "of", "children", "." ]
def move(self, item, parent, index): """Moves item to position index in parent's list of children. It is illegal to move an item under one of its descendants. If index is less than or equal to zero, item is moved to the beginning, if greater than or equal to the number of children, ...
[ "def", "move", "(", "self", ",", "item", ",", "parent", ",", "index", ")", ":", "self", ".", "tk", ".", "call", "(", "self", ".", "_w", ",", "\"move\"", ",", "item", ",", "parent", ",", "index", ")" ]
https://github.com/windystrife/UnrealEngine_NVIDIAGameWorks/blob/b50e6338a7c5b26374d66306ebc7807541ff815e/Engine/Extras/ThirdPartyNotUE/emsdk/Win64/python/2.7.5.3_64bit/Lib/lib-tk/ttk.py#L1352-L1359
aws/lumberyard
f85344403c1c2e77ec8c75deb2c116e97b713217
dev/Tools/Python/3.7.10/linux_x64/lib/python3.7/site-packages/pip/_vendor/distlib/_backport/shutil.py
python
unpack_archive
(filename, extract_dir=None, format=None)
Unpack an archive. `filename` is the name of the archive. `extract_dir` is the name of the target directory, where the archive is unpacked. If not provided, the current working directory is used. `format` is the archive format: one of "zip", "tar", or "gztar". Or any other registered form...
Unpack an archive.
[ "Unpack", "an", "archive", "." ]
def unpack_archive(filename, extract_dir=None, format=None): """Unpack an archive. `filename` is the name of the archive. `extract_dir` is the name of the target directory, where the archive is unpacked. If not provided, the current working directory is used. `format` is the archive forma...
[ "def", "unpack_archive", "(", "filename", ",", "extract_dir", "=", "None", ",", "format", "=", "None", ")", ":", "if", "extract_dir", "is", "None", ":", "extract_dir", "=", "os", ".", "getcwd", "(", ")", "if", "format", "is", "not", "None", ":", "try",...
https://github.com/aws/lumberyard/blob/f85344403c1c2e77ec8c75deb2c116e97b713217/dev/Tools/Python/3.7.10/linux_x64/lib/python3.7/site-packages/pip/_vendor/distlib/_backport/shutil.py#L1459-L1527
pmq20/node-packer
12c46c6e44fbc14d9ee645ebd17d5296b324f7e0
lts/deps/v8/third_party/jinja2/debug.py
python
make_traceback
(exc_info, source_hint=None)
return translate_exception(exc_info, initial_skip)
Creates a processed traceback object from the exc_info.
Creates a processed traceback object from the exc_info.
[ "Creates", "a", "processed", "traceback", "object", "from", "the", "exc_info", "." ]
def make_traceback(exc_info, source_hint=None): """Creates a processed traceback object from the exc_info.""" exc_type, exc_value, tb = exc_info if isinstance(exc_value, TemplateSyntaxError): exc_info = translate_syntax_error(exc_value, source_hint) initial_skip = 0 else: initial...
[ "def", "make_traceback", "(", "exc_info", ",", "source_hint", "=", "None", ")", ":", "exc_type", ",", "exc_value", ",", "tb", "=", "exc_info", "if", "isinstance", "(", "exc_value", ",", "TemplateSyntaxError", ")", ":", "exc_info", "=", "translate_syntax_error", ...
https://github.com/pmq20/node-packer/blob/12c46c6e44fbc14d9ee645ebd17d5296b324f7e0/lts/deps/v8/third_party/jinja2/debug.py#L132-L140
Genius-x/genius-x
9fc9f194e6d1fb92dd0e33d43db19ddb67cda7b0
cocos2d/tools/bindings-generator/backup/clang-llvm-3.3-pybinding/cindex.py
python
Cursor.objc_type_encoding
(self)
return self._objc_type_encoding
Return the Objective-C type encoding as a str.
Return the Objective-C type encoding as a str.
[ "Return", "the", "Objective", "-", "C", "type", "encoding", "as", "a", "str", "." ]
def objc_type_encoding(self): """Return the Objective-C type encoding as a str.""" if not hasattr(self, '_objc_type_encoding'): self._objc_type_encoding = \ conf.lib.clang_getDeclObjCTypeEncoding(self) return self._objc_type_encoding
[ "def", "objc_type_encoding", "(", "self", ")", ":", "if", "not", "hasattr", "(", "self", ",", "'_objc_type_encoding'", ")", ":", "self", ".", "_objc_type_encoding", "=", "conf", ".", "lib", ".", "clang_getDeclObjCTypeEncoding", "(", "self", ")", "return", "sel...
https://github.com/Genius-x/genius-x/blob/9fc9f194e6d1fb92dd0e33d43db19ddb67cda7b0/cocos2d/tools/bindings-generator/backup/clang-llvm-3.3-pybinding/cindex.py#L1235-L1241
wxWidgets/wxPython-Classic
19571e1ae65f1ac445f5491474121998c97a1bf0
src/osx_cocoa/_windows.py
python
MDIParentFrame.Create
(*args, **kwargs)
return _windows_.MDIParentFrame_Create(*args, **kwargs)
Create(self, Window parent, int id=-1, String title=EmptyString, Point pos=DefaultPosition, Size size=DefaultSize, long style=wxDEFAULT_FRAME_STYLE|wxVSCROLL|wxHSCROLL, String name=FrameNameStr) -> bool
Create(self, Window parent, int id=-1, String title=EmptyString, Point pos=DefaultPosition, Size size=DefaultSize, long style=wxDEFAULT_FRAME_STYLE|wxVSCROLL|wxHSCROLL, String name=FrameNameStr) -> bool
[ "Create", "(", "self", "Window", "parent", "int", "id", "=", "-", "1", "String", "title", "=", "EmptyString", "Point", "pos", "=", "DefaultPosition", "Size", "size", "=", "DefaultSize", "long", "style", "=", "wxDEFAULT_FRAME_STYLE|wxVSCROLL|wxHSCROLL", "String", ...
def Create(*args, **kwargs): """ Create(self, Window parent, int id=-1, String title=EmptyString, Point pos=DefaultPosition, Size size=DefaultSize, long style=wxDEFAULT_FRAME_STYLE|wxVSCROLL|wxHSCROLL, String name=FrameNameStr) -> bool """ return _w...
[ "def", "Create", "(", "*", "args", ",", "*", "*", "kwargs", ")", ":", "return", "_windows_", ".", "MDIParentFrame_Create", "(", "*", "args", ",", "*", "*", "kwargs", ")" ]
https://github.com/wxWidgets/wxPython-Classic/blob/19571e1ae65f1ac445f5491474121998c97a1bf0/src/osx_cocoa/_windows.py#L4025-L4032
wxWidgets/wxPython-Classic
19571e1ae65f1ac445f5491474121998c97a1bf0
src/osx_cocoa/combo.py
python
BitmapComboBox.SetItemBitmap
(*args, **kwargs)
return _combo.BitmapComboBox_SetItemBitmap(*args, **kwargs)
SetItemBitmap(self, int n, Bitmap bitmap) Sets the image for the given item.
SetItemBitmap(self, int n, Bitmap bitmap)
[ "SetItemBitmap", "(", "self", "int", "n", "Bitmap", "bitmap", ")" ]
def SetItemBitmap(*args, **kwargs): """ SetItemBitmap(self, int n, Bitmap bitmap) Sets the image for the given item. """ return _combo.BitmapComboBox_SetItemBitmap(*args, **kwargs)
[ "def", "SetItemBitmap", "(", "*", "args", ",", "*", "*", "kwargs", ")", ":", "return", "_combo", ".", "BitmapComboBox_SetItemBitmap", "(", "*", "args", ",", "*", "*", "kwargs", ")" ]
https://github.com/wxWidgets/wxPython-Classic/blob/19571e1ae65f1ac445f5491474121998c97a1bf0/src/osx_cocoa/combo.py#L998-L1004
martinrotter/textosaurus
4e2ad75abaf5b7e6a823766a2aa8a30f0c965cb8
src/libtextosaurus/3rd-party/scintilla-lt/scripts/Dependencies.py
python
TextFromDependencies
(dependencies)
return text
Convert a list of dependencies to text.
Convert a list of dependencies to text.
[ "Convert", "a", "list", "of", "dependencies", "to", "text", "." ]
def TextFromDependencies(dependencies): """ Convert a list of dependencies to text. """ text = "" indentHeaders = "\t" joinHeaders = continuationLineEnd + os.linesep + indentHeaders for dep in dependencies: object, headers = dep text += object + ":" for header in headers: text += joinHeaders text += he...
[ "def", "TextFromDependencies", "(", "dependencies", ")", ":", "text", "=", "\"\"", "indentHeaders", "=", "\"\\t\"", "joinHeaders", "=", "continuationLineEnd", "+", "os", ".", "linesep", "+", "indentHeaders", "for", "dep", "in", "dependencies", ":", "object", ","...
https://github.com/martinrotter/textosaurus/blob/4e2ad75abaf5b7e6a823766a2aa8a30f0c965cb8/src/libtextosaurus/3rd-party/scintilla-lt/scripts/Dependencies.py#L122-L135
aws/lumberyard
f85344403c1c2e77ec8c75deb2c116e97b713217
dev/Tools/Python/3.7.10/mac/Python.framework/Versions/3.7/lib/python3.7/site-packages/pip/_vendor/distlib/_backport/tarfile.py
python
TarFile.__iter__
(self)
Provide an iterator object.
Provide an iterator object.
[ "Provide", "an", "iterator", "object", "." ]
def __iter__(self): """Provide an iterator object. """ if self._loaded: return iter(self.members) else: return TarIter(self)
[ "def", "__iter__", "(", "self", ")", ":", "if", "self", ".", "_loaded", ":", "return", "iter", "(", "self", ".", "members", ")", "else", ":", "return", "TarIter", "(", "self", ")" ]
https://github.com/aws/lumberyard/blob/f85344403c1c2e77ec8c75deb2c116e97b713217/dev/Tools/Python/3.7.10/mac/Python.framework/Versions/3.7/lib/python3.7/site-packages/pip/_vendor/distlib/_backport/tarfile.py#L2524-L2530
catboost/catboost
167f64f237114a4d10b2b4ee42adb4569137debe
contrib/python/scikit-learn/py2/sklearn/mixture/gaussian_mixture.py
python
_estimate_gaussian_covariances_spherical
(resp, X, nk, means, reg_covar)
return _estimate_gaussian_covariances_diag(resp, X, nk, means, reg_covar).mean(1)
Estimate the spherical variance values. Parameters ---------- responsibilities : array-like, shape (n_samples, n_components) X : array-like, shape (n_samples, n_features) nk : array-like, shape (n_components,) means : array-like, shape (n_components, n_features) reg_covar : float R...
Estimate the spherical variance values.
[ "Estimate", "the", "spherical", "variance", "values", "." ]
def _estimate_gaussian_covariances_spherical(resp, X, nk, means, reg_covar): """Estimate the spherical variance values. Parameters ---------- responsibilities : array-like, shape (n_samples, n_components) X : array-like, shape (n_samples, n_features) nk : array-like, shape (n_components,) ...
[ "def", "_estimate_gaussian_covariances_spherical", "(", "resp", ",", "X", ",", "nk", ",", "means", ",", "reg_covar", ")", ":", "return", "_estimate_gaussian_covariances_diag", "(", "resp", ",", "X", ",", "nk", ",", "means", ",", "reg_covar", ")", ".", "mean", ...
https://github.com/catboost/catboost/blob/167f64f237114a4d10b2b4ee42adb4569137debe/contrib/python/scikit-learn/py2/sklearn/mixture/gaussian_mixture.py#L226-L247
trilinos/Trilinos
6168be6dd51e35e1cd681e9c4b24433e709df140
packages/seacas/scripts/exodus3.in.py
python
exodus.put_element_variable_values
(self, blockId, name, step, values)
return True
store a list of element variable values for a specified element block, element variable name, and time step >>> status = exo.put_element_variable_values(elem_blk_id, ... evar_name, time_step, evar_vals) Parameters ---------- elem_blk_id : int ele...
store a list of element variable values for a specified element block, element variable name, and time step
[ "store", "a", "list", "of", "element", "variable", "values", "for", "a", "specified", "element", "block", "element", "variable", "name", "and", "time", "step" ]
def put_element_variable_values(self, blockId, name, step, values): """ store a list of element variable values for a specified element block, element variable name, and time step >>> status = exo.put_element_variable_values(elem_blk_id, ... evar_name, time_step, eva...
[ "def", "put_element_variable_values", "(", "self", ",", "blockId", ",", "name", ",", "step", ",", "values", ")", ":", "self", ".", "put_variable_values", "(", "'EX_ELEM_BLOCK'", ",", "blockId", ",", "name", ",", "step", ",", "values", ")", "return", "True" ]
https://github.com/trilinos/Trilinos/blob/6168be6dd51e35e1cd681e9c4b24433e709df140/packages/seacas/scripts/exodus3.in.py#L2916-L2938
zhaoweicai/mscnn
534bcac5710a579d60827f192035f7eef6d8c585
scripts/cpp_lint.py
python
CleanseComments
(line)
return _RE_PATTERN_CLEANSE_LINE_C_COMMENTS.sub('', line)
Removes //-comments and single-line C-style /* */ comments. Args: line: A line of C++ source. Returns: The line with single-line comments removed.
Removes //-comments and single-line C-style /* */ comments.
[ "Removes", "//", "-", "comments", "and", "single", "-", "line", "C", "-", "style", "/", "*", "*", "/", "comments", "." ]
def CleanseComments(line): """Removes //-comments and single-line C-style /* */ comments. Args: line: A line of C++ source. Returns: The line with single-line comments removed. """ commentpos = line.find('//') if commentpos != -1 and not IsCppString(line[:commentpos]): line = line[:commentpos]...
[ "def", "CleanseComments", "(", "line", ")", ":", "commentpos", "=", "line", ".", "find", "(", "'//'", ")", "if", "commentpos", "!=", "-", "1", "and", "not", "IsCppString", "(", "line", "[", ":", "commentpos", "]", ")", ":", "line", "=", "line", "[", ...
https://github.com/zhaoweicai/mscnn/blob/534bcac5710a579d60827f192035f7eef6d8c585/scripts/cpp_lint.py#L1167-L1180
google/skia
82d65d0487bd72f5f7332d002429ec2dc61d2463
tools/add_codereview_message.py
python
add_codereview_message
(issue, message)
Add a message to a given codereview. Args: codereview_url: (string) we will extract the issue number from this url, or this could simply be the issue number. message: (string) message to add.
Add a message to a given codereview.
[ "Add", "a", "message", "to", "a", "given", "codereview", "." ]
def add_codereview_message(issue, message): """Add a message to a given codereview. Args: codereview_url: (string) we will extract the issue number from this url, or this could simply be the issue number. message: (string) message to add. """ # Passing None for the email and auth_config w...
[ "def", "add_codereview_message", "(", "issue", ",", "message", ")", ":", "# Passing None for the email and auth_config will result in a prompt or", "# reuse of existing cached credentials.", "my_rietveld", "=", "rietveld", ".", "Rietveld", "(", "RIETVELD_URL", ",", "email", "="...
https://github.com/google/skia/blob/82d65d0487bd72f5f7332d002429ec2dc61d2463/tools/add_codereview_message.py#L34-L46
OAID/Tengine
66b2c22ad129d25e2fc6de3b22a608bb54dd90db
pytengine/tengine/node.py
python
Node.dump
(self, action)
Enable dump function pre-defined on device on a node, Note: the dump buffer will be returned by getDumpBuf :param action: 1: enable, 0: disable :return: None
Enable dump function pre-defined on device on a node, Note: the dump buffer will be returned by getDumpBuf :param action: 1: enable, 0: disable :return: None
[ "Enable", "dump", "function", "pre", "-", "defined", "on", "device", "on", "a", "node", "Note", ":", "the", "dump", "buffer", "will", "be", "returned", "by", "getDumpBuf", ":", "param", "action", ":", "1", ":", "enable", "0", ":", "disable", ":", "retu...
def dump(self, action): """ Enable dump function pre-defined on device on a node, Note: the dump buffer will be returned by getDumpBuf :param action: 1: enable, 0: disable :return: None """ check_call(_LIB.do_node_dump(ctypes.c_void_p(self.node), action))
[ "def", "dump", "(", "self", ",", "action", ")", ":", "check_call", "(", "_LIB", ".", "do_node_dump", "(", "ctypes", ".", "c_void_p", "(", "self", ".", "node", ")", ",", "action", ")", ")" ]
https://github.com/OAID/Tengine/blob/66b2c22ad129d25e2fc6de3b22a608bb54dd90db/pytengine/tengine/node.py#L225-L232
CaoWGG/TensorRT-CenterNet
f949252e37b51e60f873808f46d3683f15735e79
onnx-tensorrt/third_party/onnx/third_party/pybind11/tools/clang/cindex.py
python
File.time
(self)
return conf.lib.clang_getFileTime(self)
Return the last modification time of the file.
Return the last modification time of the file.
[ "Return", "the", "last", "modification", "time", "of", "the", "file", "." ]
def time(self): """Return the last modification time of the file.""" return conf.lib.clang_getFileTime(self)
[ "def", "time", "(", "self", ")", ":", "return", "conf", ".", "lib", ".", "clang_getFileTime", "(", "self", ")" ]
https://github.com/CaoWGG/TensorRT-CenterNet/blob/f949252e37b51e60f873808f46d3683f15735e79/onnx-tensorrt/third_party/onnx/third_party/pybind11/tools/clang/cindex.py#L2812-L2814
strukturag/libheif
0082fea96ee70a20c8906a0373bedec0c01777bc
scripts/cpplint.py
python
NestingState.InTemplateArgumentList
(self, clean_lines, linenum, pos)
return False
Check if current position is inside template argument list. Args: clean_lines: A CleansedLines instance containing the file. linenum: The number of the line to check. pos: position just after the suspected template argument. Returns: True if (linenum, pos) is inside template arguments.
Check if current position is inside template argument list.
[ "Check", "if", "current", "position", "is", "inside", "template", "argument", "list", "." ]
def InTemplateArgumentList(self, clean_lines, linenum, pos): """Check if current position is inside template argument list. Args: clean_lines: A CleansedLines instance containing the file. linenum: The number of the line to check. pos: position just after the suspected template argument. ...
[ "def", "InTemplateArgumentList", "(", "self", ",", "clean_lines", ",", "linenum", ",", "pos", ")", ":", "while", "linenum", "<", "clean_lines", ".", "NumLines", "(", ")", ":", "# Find the earliest character that might indicate a template argument", "line", "=", "clean...
https://github.com/strukturag/libheif/blob/0082fea96ee70a20c8906a0373bedec0c01777bc/scripts/cpplint.py#L2352-L2402
natanielruiz/android-yolo
1ebb54f96a67a20ff83ddfc823ed83a13dc3a47f
jni-build/jni/include/tensorflow/python/platform/gfile.py
python
Open
(name, mode='r')
return GFile(name, mode=mode)
Exact API match to the standard open. Args: name: a file name, either local or a gfile compatible. mode: for example "w" to open the file for writing. Returns: A threadsafe gfile.GFile object.
Exact API match to the standard open.
[ "Exact", "API", "match", "to", "the", "standard", "open", "." ]
def Open(name, mode='r'): """Exact API match to the standard open. Args: name: a file name, either local or a gfile compatible. mode: for example "w" to open the file for writing. Returns: A threadsafe gfile.GFile object. """ return GFile(name, mode=mode)
[ "def", "Open", "(", "name", ",", "mode", "=", "'r'", ")", ":", "return", "GFile", "(", "name", ",", "mode", "=", "mode", ")" ]
https://github.com/natanielruiz/android-yolo/blob/1ebb54f96a67a20ff83ddfc823ed83a13dc3a47f/jni-build/jni/include/tensorflow/python/platform/gfile.py#L447-L457
gem5/gem5
141cc37c2d4b93959d4c249b8f7e6a8b2ef75338
ext/ply/example/BASIC/basparse.py
python
p_expr_number
(p)
expr : INTEGER | FLOAT
expr : INTEGER | FLOAT
[ "expr", ":", "INTEGER", "|", "FLOAT" ]
def p_expr_number(p): '''expr : INTEGER | FLOAT''' p[0] = ('NUM',eval(p[1]))
[ "def", "p_expr_number", "(", "p", ")", ":", "p", "[", "0", "]", "=", "(", "'NUM'", ",", "eval", "(", "p", "[", "1", "]", ")", ")" ]
https://github.com/gem5/gem5/blob/141cc37c2d4b93959d4c249b8f7e6a8b2ef75338/ext/ply/example/BASIC/basparse.py#L291-L294
hanpfei/chromium-net
392cc1fa3a8f92f42e4071ab6e674d8e0482f83f
third_party/catapult/third_party/coverage/ci/download_appveyor.py
python
download_latest_artifacts
(account_project)
Download all the artifacts from the latest build.
Download all the artifacts from the latest build.
[ "Download", "all", "the", "artifacts", "from", "the", "latest", "build", "." ]
def download_latest_artifacts(account_project): """Download all the artifacts from the latest build.""" build = get_project_build(account_project) jobs = build['build']['jobs'] print "Build {0[build][version]}, {1} jobs: {0[build][message]}".format(build, len(jobs)) for job in jobs: name = j...
[ "def", "download_latest_artifacts", "(", "account_project", ")", ":", "build", "=", "get_project_build", "(", "account_project", ")", "jobs", "=", "build", "[", "'build'", "]", "[", "'jobs'", "]", "print", "\"Build {0[build][version]}, {1} jobs: {0[build][message]}\"", ...
https://github.com/hanpfei/chromium-net/blob/392cc1fa3a8f92f42e4071ab6e674d8e0482f83f/third_party/catapult/third_party/coverage/ci/download_appveyor.py#L37-L64
PaddlePaddle/Paddle
1252f4bb3e574df80aa6d18c7ddae1b3a90bd81c
python/paddle/distributed/fleet/utils/http_server.py
python
KVServer.should_stop
(self)
return True
return whether the server should stop. Returns: ret(bool): whether the server should stop
return whether the server should stop.
[ "return", "whether", "the", "server", "should", "stop", "." ]
def should_stop(self): """ return whether the server should stop. Returns: ret(bool): whether the server should stop """ for key in self.size: s = self.http_server.get_deleted_size(key) if s != self.size.get(key, 0): return Fal...
[ "def", "should_stop", "(", "self", ")", ":", "for", "key", "in", "self", ".", "size", ":", "s", "=", "self", ".", "http_server", ".", "get_deleted_size", "(", "key", ")", "if", "s", "!=", "self", ".", "size", ".", "get", "(", "key", ",", "0", ")"...
https://github.com/PaddlePaddle/Paddle/blob/1252f4bb3e574df80aa6d18c7ddae1b3a90bd81c/python/paddle/distributed/fleet/utils/http_server.py#L183-L194
catboost/catboost
167f64f237114a4d10b2b4ee42adb4569137debe
contrib/tools/python3/src/Lib/re.py
python
finditer
(pattern, string, flags=0)
return _compile(pattern, flags).finditer(string)
Return an iterator over all non-overlapping matches in the string. For each match, the iterator returns a Match object. Empty matches are included in the result.
Return an iterator over all non-overlapping matches in the string. For each match, the iterator returns a Match object.
[ "Return", "an", "iterator", "over", "all", "non", "-", "overlapping", "matches", "in", "the", "string", ".", "For", "each", "match", "the", "iterator", "returns", "a", "Match", "object", "." ]
def finditer(pattern, string, flags=0): """Return an iterator over all non-overlapping matches in the string. For each match, the iterator returns a Match object. Empty matches are included in the result.""" return _compile(pattern, flags).finditer(string)
[ "def", "finditer", "(", "pattern", ",", "string", ",", "flags", "=", "0", ")", ":", "return", "_compile", "(", "pattern", ",", "flags", ")", ".", "finditer", "(", "string", ")" ]
https://github.com/catboost/catboost/blob/167f64f237114a4d10b2b4ee42adb4569137debe/contrib/tools/python3/src/Lib/re.py#L243-L248
SoarGroup/Soar
a1c5e249499137a27da60533c72969eef3b8ab6b
scons/scons-local-4.1.0/SCons/cpp.py
python
PreProcessor.do_undef
(self, t)
Default handling of a #undef line.
Default handling of a #undef line.
[ "Default", "handling", "of", "a", "#undef", "line", "." ]
def do_undef(self, t): """ Default handling of a #undef line. """ try: del self.cpp_namespace[t[1]] except KeyError: pass
[ "def", "do_undef", "(", "self", ",", "t", ")", ":", "try", ":", "del", "self", ".", "cpp_namespace", "[", "t", "[", "1", "]", "]", "except", "KeyError", ":", "pass" ]
https://github.com/SoarGroup/Soar/blob/a1c5e249499137a27da60533c72969eef3b8ab6b/scons/scons-local-4.1.0/SCons/cpp.py#L537-L542
krishauser/Klampt
972cc83ea5befac3f653c1ba20f80155768ad519
Python/klampt/model/collide.py
python
WorldCollider.rayCast
(self, s: Vector3, d: Vector3, indices: Optional[List[int]]=None )
return res
Finds the first collision between a ray and objects in the world. Args: s (list of 3 floats): the ray source d (list of 3 floats): the ray direction indices (list of ints, optional): if given, the indices of geometries in geomList to test. Returns: ...
Finds the first collision between a ray and objects in the world.
[ "Finds", "the", "first", "collision", "between", "a", "ray", "and", "objects", "in", "the", "world", "." ]
def rayCast(self, s: Vector3, d: Vector3, indices: Optional[List[int]]=None ) -> Union[None,Tuple[WorldBodyType,Vector3]]: """Finds the first collision between a ray and objects in the world. Args: s (list of 3 floats): the ray source ...
[ "def", "rayCast", "(", "self", ",", "s", ":", "Vector3", ",", "d", ":", "Vector3", ",", "indices", ":", "Optional", "[", "List", "[", "int", "]", "]", "=", "None", ")", "->", "Union", "[", "None", ",", "Tuple", "[", "WorldBodyType", ",", "Vector3",...
https://github.com/krishauser/Klampt/blob/972cc83ea5befac3f653c1ba20f80155768ad519/Python/klampt/model/collide.py#L700-L725
aws/lumberyard
f85344403c1c2e77ec8c75deb2c116e97b713217
dev/Tools/Python/3.7.10/linux_x64/lib/python3.7/logging/handlers.py
python
BufferingHandler.flush
(self)
Override to implement custom flushing behaviour. This version just zaps the buffer to empty.
Override to implement custom flushing behaviour.
[ "Override", "to", "implement", "custom", "flushing", "behaviour", "." ]
def flush(self): """ Override to implement custom flushing behaviour. This version just zaps the buffer to empty. """ self.acquire() try: self.buffer = [] finally: self.release()
[ "def", "flush", "(", "self", ")", ":", "self", ".", "acquire", "(", ")", "try", ":", "self", ".", "buffer", "=", "[", "]", "finally", ":", "self", ".", "release", "(", ")" ]
https://github.com/aws/lumberyard/blob/f85344403c1c2e77ec8c75deb2c116e97b713217/dev/Tools/Python/3.7.10/linux_x64/lib/python3.7/logging/handlers.py#L1237-L1247
TGAC/KAT
e8870331de2b4bb0a1b3b91c6afb8fb9d59e9216
deps/boost/tools/build/src/build/virtual_target.py
python
FileTarget.path
(self)
return os.path.normpath(self.path_)
Returns the directory for this target.
Returns the directory for this target.
[ "Returns", "the", "directory", "for", "this", "target", "." ]
def path (self): """ Returns the directory for this target. """ if not self.path_: if self.action_: p = self.action_.properties () (target_path, relative_to_build_dir) = p.target_path () if relative_to_build_dir: # ...
[ "def", "path", "(", "self", ")", ":", "if", "not", "self", ".", "path_", ":", "if", "self", ".", "action_", ":", "p", "=", "self", ".", "action_", ".", "properties", "(", ")", "(", "target_path", ",", "relative_to_build_dir", ")", "=", "p", ".", "t...
https://github.com/TGAC/KAT/blob/e8870331de2b4bb0a1b3b91c6afb8fb9d59e9216/deps/boost/tools/build/src/build/virtual_target.py#L727-L744
BitMEX/api-connectors
37a3a5b806ad5d0e0fc975ab86d9ed43c3bcd812
auto-generated/python/swagger_client/models/position.py
python
Position.currency
(self)
return self._currency
Gets the currency of this Position. # noqa: E501 :return: The currency of this Position. # noqa: E501 :rtype: str
Gets the currency of this Position. # noqa: E501
[ "Gets", "the", "currency", "of", "this", "Position", ".", "#", "noqa", ":", "E501" ]
def currency(self): """Gets the currency of this Position. # noqa: E501 :return: The currency of this Position. # noqa: E501 :rtype: str """ return self._currency
[ "def", "currency", "(", "self", ")", ":", "return", "self", ".", "_currency" ]
https://github.com/BitMEX/api-connectors/blob/37a3a5b806ad5d0e0fc975ab86d9ed43c3bcd812/auto-generated/python/swagger_client/models/position.py#L544-L551
google/ml-metadata
b60196492d2ea2bcd8e4ddff0f3757e5fd710e4d
ml_metadata/metadata_store/types.py
python
_create_path
(path: metadata_store_pb2.Event.Path)
return [_create_step(x) for x in path.steps]
Convert from Event.Path to _Path.
Convert from Event.Path to _Path.
[ "Convert", "from", "Event", ".", "Path", "to", "_Path", "." ]
def _create_path(path: metadata_store_pb2.Event.Path) -> _Path: """Convert from Event.Path to _Path.""" return [_create_step(x) for x in path.steps]
[ "def", "_create_path", "(", "path", ":", "metadata_store_pb2", ".", "Event", ".", "Path", ")", "->", "_Path", ":", "return", "[", "_create_step", "(", "x", ")", "for", "x", "in", "path", ".", "steps", "]" ]
https://github.com/google/ml-metadata/blob/b60196492d2ea2bcd8e4ddff0f3757e5fd710e4d/ml_metadata/metadata_store/types.py#L1513-L1515
natanielruiz/android-yolo
1ebb54f96a67a20ff83ddfc823ed83a13dc3a47f
jni-build/jni/include/tensorflow/python/ops/io_ops.py
python
WholeFileReader.__init__
(self, name=None)
Create a WholeFileReader. Args: name: A name for the operation (optional).
Create a WholeFileReader.
[ "Create", "a", "WholeFileReader", "." ]
def __init__(self, name=None): """Create a WholeFileReader. Args: name: A name for the operation (optional). """ rr = gen_io_ops._whole_file_reader(name=name) super(WholeFileReader, self).__init__(rr, supports_serialize=True)
[ "def", "__init__", "(", "self", ",", "name", "=", "None", ")", ":", "rr", "=", "gen_io_ops", ".", "_whole_file_reader", "(", "name", "=", "name", ")", "super", "(", "WholeFileReader", ",", "self", ")", ".", "__init__", "(", "rr", ",", "supports_serialize...
https://github.com/natanielruiz/android-yolo/blob/1ebb54f96a67a20ff83ddfc823ed83a13dc3a47f/jni-build/jni/include/tensorflow/python/ops/io_ops.py#L457-L464
catboost/catboost
167f64f237114a4d10b2b4ee42adb4569137debe
contrib/python/scipy/py3/scipy/signal/windows/windows.py
python
parzen
(M, sym=True)
return _truncate(w, needs_trunc)
Return a Parzen window. Parameters ---------- M : int Number of points in the output window. If zero or less, an empty array is returned. sym : bool, optional When True (default), generates a symmetric window, for use in filter design. When False, generates a per...
Return a Parzen window.
[ "Return", "a", "Parzen", "window", "." ]
def parzen(M, sym=True): """Return a Parzen window. Parameters ---------- M : int Number of points in the output window. If zero or less, an empty array is returned. sym : bool, optional When True (default), generates a symmetric window, for use in filter design. ...
[ "def", "parzen", "(", "M", ",", "sym", "=", "True", ")", ":", "if", "_len_guards", "(", "M", ")", ":", "return", "np", ".", "ones", "(", "M", ")", "M", ",", "needs_trunc", "=", "_extend", "(", "M", ",", "sym", ")", "n", "=", "np", ".", "arang...
https://github.com/catboost/catboost/blob/167f64f237114a4d10b2b4ee42adb4569137debe/contrib/python/scipy/py3/scipy/signal/windows/windows.py#L239-L300
miyosuda/TensorFlowAndroidDemo
35903e0221aa5f109ea2dbef27f20b52e317f42d
jni-build/jni/include/tensorflow/python/framework/constant_op.py
python
constant
(value, dtype=None, shape=None, name="Const")
return const_tensor
Creates a constant tensor. The resulting tensor is populated with values of type `dtype`, as specified by arguments `value` and (optionally) `shape` (see examples below). The argument `value` can be a constant value, or a list of values of type `dtype`. If `value` is a list, then the length of the list...
Creates a constant tensor.
[ "Creates", "a", "constant", "tensor", "." ]
def constant(value, dtype=None, shape=None, name="Const"): """Creates a constant tensor. The resulting tensor is populated with values of type `dtype`, as specified by arguments `value` and (optionally) `shape` (see examples below). The argument `value` can be a constant value, or a list of values of ty...
[ "def", "constant", "(", "value", ",", "dtype", "=", "None", ",", "shape", "=", "None", ",", "name", "=", "\"Const\"", ")", ":", "g", "=", "ops", ".", "get_default_graph", "(", ")", "tensor_value", "=", "attr_value_pb2", ".", "AttrValue", "(", ")", "ten...
https://github.com/miyosuda/TensorFlowAndroidDemo/blob/35903e0221aa5f109ea2dbef27f20b52e317f42d/jni-build/jni/include/tensorflow/python/framework/constant_op.py#L117-L168
google/google-api-cpp-client
3df15df632bef43eb320645ac3329d872aabf5ad
prepare_dependencies.py
python
Installer.__init__
(self, config, restricted_package_names)
Set up variables from flags. Exit on failure. Args: config: (ConfigInfo) Configuraton options. restricted_package_names: (Array) Subset of package names to install.
Set up variables from flags. Exit on failure.
[ "Set", "up", "variables", "from", "flags", ".", "Exit", "on", "failure", "." ]
def __init__(self, config, restricted_package_names): """Set up variables from flags. Exit on failure. Args: config: (ConfigInfo) Configuraton options. restricted_package_names: (Array) Subset of package names to install. """ print 'Initializing....' # If non-empty then just prepare th...
[ "def", "__init__", "(", "self", ",", "config", ",", "restricted_package_names", ")", ":", "print", "'Initializing....'", "# If non-empty then just prepare these packages.", "# The entries here are keys in url_map", "self", ".", "_restricted_packages", "=", "restricted_package_nam...
https://github.com/google/google-api-cpp-client/blob/3df15df632bef43eb320645ac3329d872aabf5ad/prepare_dependencies.py#L1031-L1116
kamyu104/LeetCode-Solutions
77605708a927ea3b85aee5a479db733938c7c211
Python/freedom-trail.py
python
Solution.findRotateSteps
(self, ring, key)
return min(dp[len(key)%2]) + len(key)
:type ring: str :type key: str :rtype: int
:type ring: str :type key: str :rtype: int
[ ":", "type", "ring", ":", "str", ":", "type", "key", ":", "str", ":", "rtype", ":", "int" ]
def findRotateSteps(self, ring, key): """ :type ring: str :type key: str :rtype: int """ lookup = collections.defaultdict(list) for i in xrange(len(ring)): lookup[ring[i]].append(i) dp = [[0] * len(ring) for _ in xrange(2)] prev = [0] ...
[ "def", "findRotateSteps", "(", "self", ",", "ring", ",", "key", ")", ":", "lookup", "=", "collections", ".", "defaultdict", "(", "list", ")", "for", "i", "in", "xrange", "(", "len", "(", "ring", ")", ")", ":", "lookup", "[", "ring", "[", "i", "]", ...
https://github.com/kamyu104/LeetCode-Solutions/blob/77605708a927ea3b85aee5a479db733938c7c211/Python/freedom-trail.py#L8-L29
hpi-xnor/BMXNet-v2
af2b1859eafc5c721b1397cef02f946aaf2ce20d
python/mxnet/operator.py
python
_Registry.inc
(self)
return cur
Get index for new entry.
Get index for new entry.
[ "Get", "index", "for", "new", "entry", "." ]
def inc(self): """Get index for new entry.""" self.lock.acquire() cur = self.counter self.counter += 1 self.lock.release() return cur
[ "def", "inc", "(", "self", ")", ":", "self", ".", "lock", ".", "acquire", "(", ")", "cur", "=", "self", ".", "counter", "self", ".", "counter", "+=", "1", "self", ".", "lock", ".", "release", "(", ")", "return", "cur" ]
https://github.com/hpi-xnor/BMXNet-v2/blob/af2b1859eafc5c721b1397cef02f946aaf2ce20d/python/mxnet/operator.py#L682-L688
wlanjie/AndroidFFmpeg
7baf9122f4b8e1c74e7baf4be5c422c7a5ba5aaf
tools/fdk-aac-build/armeabi/toolchain/lib/python2.7/lib2to3/pytree.py
python
convert
(gr, raw_node)
Convert raw node information to a Node or Leaf instance. This is passed to the parser driver which calls it whenever a reduction of a grammar rule produces a new complete node, so that the tree is build strictly bottom-up.
Convert raw node information to a Node or Leaf instance.
[ "Convert", "raw", "node", "information", "to", "a", "Node", "or", "Leaf", "instance", "." ]
def convert(gr, raw_node): """ Convert raw node information to a Node or Leaf instance. This is passed to the parser driver which calls it whenever a reduction of a grammar rule produces a new complete node, so that the tree is build strictly bottom-up. """ type, value, context, children = ...
[ "def", "convert", "(", "gr", ",", "raw_node", ")", ":", "type", ",", "value", ",", "context", ",", "children", "=", "raw_node", "if", "children", "or", "type", "in", "gr", ".", "number2symbol", ":", "# If there's exactly one child, return that child instead of", ...
https://github.com/wlanjie/AndroidFFmpeg/blob/7baf9122f4b8e1c74e7baf4be5c422c7a5ba5aaf/tools/fdk-aac-build/armeabi/toolchain/lib/python2.7/lib2to3/pytree.py#L429-L445
LiquidPlayer/LiquidCore
9405979363f2353ac9a71ad8ab59685dd7f919c9
deps/node-10.15.3/tools/gyp/pylib/gyp/generator/make.py
python
MakefileWriter.WriteSources
(self, configs, deps, sources, extra_outputs, extra_link_deps, part_of_all, precompiled_header)
Write Makefile code for any 'sources' from the gyp input. These are source files necessary to build the current target. configs, deps, sources: input from gyp. extra_outputs: a list of extra outputs this action should be dependent on; used to serialize action/rules before compilation ...
Write Makefile code for any 'sources' from the gyp input. These are source files necessary to build the current target.
[ "Write", "Makefile", "code", "for", "any", "sources", "from", "the", "gyp", "input", ".", "These", "are", "source", "files", "necessary", "to", "build", "the", "current", "target", "." ]
def WriteSources(self, configs, deps, sources, extra_outputs, extra_link_deps, part_of_all, precompiled_header): """Write Makefile code for any 'sources' from the gyp input. These are source files necessary to build the current target. configs, deps, sources: input fro...
[ "def", "WriteSources", "(", "self", ",", "configs", ",", "deps", ",", "sources", ",", "extra_outputs", ",", "extra_link_deps", ",", "part_of_all", ",", "precompiled_header", ")", ":", "# Write configuration-specific variables for CFLAGS, etc.", "for", "configname", "in"...
https://github.com/LiquidPlayer/LiquidCore/blob/9405979363f2353ac9a71ad8ab59685dd7f919c9/deps/node-10.15.3/tools/gyp/pylib/gyp/generator/make.py#L1174-L1296
baidu-research/tensorflow-allreduce
66d5b855e90b0949e9fa5cca5599fd729a70e874
tensorflow/contrib/keras/python/keras/backend.py
python
int_shape
(x)
Returns the shape tensor or variable as a tuple of int or None entries. Arguments: x: Tensor or variable. Returns: A tuple of integers (or None entries). Examples: ```python >>> from keras import backend as K >>> input = K.placeholder(shape=(2, 4, 5)) >>> K.int_shape(input) ...
Returns the shape tensor or variable as a tuple of int or None entries.
[ "Returns", "the", "shape", "tensor", "or", "variable", "as", "a", "tuple", "of", "int", "or", "None", "entries", "." ]
def int_shape(x): """Returns the shape tensor or variable as a tuple of int or None entries. Arguments: x: Tensor or variable. Returns: A tuple of integers (or None entries). Examples: ```python >>> from keras import backend as K >>> input = K.placeholder(shape=(2, 4, 5)) >>> ...
[ "def", "int_shape", "(", "x", ")", ":", "shape", "=", "x", ".", "get_shape", "(", ")", "try", ":", "return", "tuple", "(", "[", "i", ".", "__int__", "(", ")", "for", "i", "in", "shape", "]", ")", "except", "ValueError", ":", "return", "None" ]
https://github.com/baidu-research/tensorflow-allreduce/blob/66d5b855e90b0949e9fa5cca5599fd729a70e874/tensorflow/contrib/keras/python/keras/backend.py#L633-L658
CRYTEK/CRYENGINE
232227c59a220cbbd311576f0fbeba7bb53b2a8c
Code/Tools/waf-1.7.13/waflib/Tools/fc_config.py
python
check_fc
(self, *k, **kw)
return self.check(*k, **kw)
Same as :py:func:`waflib.Tools.c_config.check` but default to the *Fortran* programming language (Overriding the C defaults in :py:func:`waflib.Tools.c_config.validate_c` here)
Same as :py:func:`waflib.Tools.c_config.check` but default to the *Fortran* programming language (Overriding the C defaults in :py:func:`waflib.Tools.c_config.validate_c` here)
[ "Same", "as", ":", "py", ":", "func", ":", "waflib", ".", "Tools", ".", "c_config", ".", "check", "but", "default", "to", "the", "*", "Fortran", "*", "programming", "language", "(", "Overriding", "the", "C", "defaults", "in", ":", "py", ":", "func", ...
def check_fc(self, *k, **kw): """ Same as :py:func:`waflib.Tools.c_config.check` but default to the *Fortran* programming language (Overriding the C defaults in :py:func:`waflib.Tools.c_config.validate_c` here) """ kw['compiler'] = 'fc' if not 'compile_mode' in kw: kw['compile_mode'] = 'fc' if not 'type' in kw...
[ "def", "check_fc", "(", "self", ",", "*", "k", ",", "*", "*", "kw", ")", ":", "kw", "[", "'compiler'", "]", "=", "'fc'", "if", "not", "'compile_mode'", "in", "kw", ":", "kw", "[", "'compile_mode'", "]", "=", "'fc'", "if", "not", "'type'", "in", "...
https://github.com/CRYTEK/CRYENGINE/blob/232227c59a220cbbd311576f0fbeba7bb53b2a8c/Code/Tools/waf-1.7.13/waflib/Tools/fc_config.py#L67-L81
wxWidgets/wxPython-Classic
19571e1ae65f1ac445f5491474121998c97a1bf0
src/osx_carbon/_core.py
python
ScrollWinEvent.GetOrientation
(*args, **kwargs)
return _core_.ScrollWinEvent_GetOrientation(*args, **kwargs)
GetOrientation(self) -> int Returns wx.HORIZONTAL or wx.VERTICAL, depending on the orientation of the scrollbar.
GetOrientation(self) -> int
[ "GetOrientation", "(", "self", ")", "-", ">", "int" ]
def GetOrientation(*args, **kwargs): """ GetOrientation(self) -> int Returns wx.HORIZONTAL or wx.VERTICAL, depending on the orientation of the scrollbar. """ return _core_.ScrollWinEvent_GetOrientation(*args, **kwargs)
[ "def", "GetOrientation", "(", "*", "args", ",", "*", "*", "kwargs", ")", ":", "return", "_core_", ".", "ScrollWinEvent_GetOrientation", "(", "*", "args", ",", "*", "*", "kwargs", ")" ]
https://github.com/wxWidgets/wxPython-Classic/blob/19571e1ae65f1ac445f5491474121998c97a1bf0/src/osx_carbon/_core.py#L5474-L5481
hanpfei/chromium-net
392cc1fa3a8f92f42e4071ab6e674d8e0482f83f
third_party/catapult/third_party/py_vulcanize/third_party/rjsmin/_setup/py3/data.py
python
Data.from_templates
(cls, *templates, **kwargs)
return cls(result, **kwargs)
Initialize from template
Initialize from template
[ "Initialize", "from", "template" ]
def from_templates(cls, *templates, **kwargs): """ Initialize from template """ files = _filelist.FileList() for tpl in templates: for line in tpl.split(';'): files.process_template_line(line.strip()) files.sort() files.remove_duplicates() resu...
[ "def", "from_templates", "(", "cls", ",", "*", "templates", ",", "*", "*", "kwargs", ")", ":", "files", "=", "_filelist", ".", "FileList", "(", ")", "for", "tpl", "in", "templates", ":", "for", "line", "in", "tpl", ".", "split", "(", "';'", ")", ":...
https://github.com/hanpfei/chromium-net/blob/392cc1fa3a8f92f42e4071ab6e674d8e0482f83f/third_party/catapult/third_party/py_vulcanize/third_party/rjsmin/_setup/py3/data.py#L89-L103
aws/lumberyard
f85344403c1c2e77ec8c75deb2c116e97b713217
dev/Tools/build/waf-1.7.13/waflib/Task.py
python
Task.signature
(self)
return ret
Task signatures are stored between build executions, they are use to track the changes made to the input nodes (not to the outputs!). The signature hashes data from various sources: * explicit dependencies: files listed in the inputs (list of node objects) :py:meth:`waflib.Task.Task.sig_explicit_deps` * implicit...
Task signatures are stored between build executions, they are use to track the changes made to the input nodes (not to the outputs!). The signature hashes data from various sources:
[ "Task", "signatures", "are", "stored", "between", "build", "executions", "they", "are", "use", "to", "track", "the", "changes", "made", "to", "the", "input", "nodes", "(", "not", "to", "the", "outputs!", ")", ".", "The", "signature", "hashes", "data", "fro...
def signature(self): """ Task signatures are stored between build executions, they are use to track the changes made to the input nodes (not to the outputs!). The signature hashes data from various sources: * explicit dependencies: files listed in the inputs (list of node objects) :py:meth:`waflib.Task.Task.si...
[ "def", "signature", "(", "self", ")", ":", "try", ":", "return", "self", ".", "cache_sig", "except", "AttributeError", ":", "pass", "self", ".", "m", "=", "Utils", ".", "md5", "(", ")", "self", ".", "m", ".", "update", "(", "self", ".", "hcode", "....
https://github.com/aws/lumberyard/blob/f85344403c1c2e77ec8c75deb2c116e97b713217/dev/Tools/build/waf-1.7.13/waflib/Task.py#L530-L567
mixxxdj/mixxx
b519aba1d967a39c63b5f5c56cf5c3a95addec28
lib/benchmark/tools/gbench/report.py
python
get_difference_report
( json1, json2, utest=False)
return diff_report
Calculate and report the difference between each test of two benchmarks runs specified as 'json1' and 'json2'. Output is another json containing relevant details for each test run.
Calculate and report the difference between each test of two benchmarks runs specified as 'json1' and 'json2'. Output is another json containing relevant details for each test run.
[ "Calculate", "and", "report", "the", "difference", "between", "each", "test", "of", "two", "benchmarks", "runs", "specified", "as", "json1", "and", "json2", ".", "Output", "is", "another", "json", "containing", "relevant", "details", "for", "each", "test", "ru...
def get_difference_report( json1, json2, utest=False): """ Calculate and report the difference between each test of two benchmarks runs specified as 'json1' and 'json2'. Output is another json containing relevant details for each test run. """ assert utest is True or utes...
[ "def", "get_difference_report", "(", "json1", ",", "json2", ",", "utest", "=", "False", ")", ":", "assert", "utest", "is", "True", "or", "utest", "is", "False", "diff_report", "=", "[", "]", "partitions", "=", "partition_benchmarks", "(", "json1", ",", "js...
https://github.com/mixxxdj/mixxx/blob/b519aba1d967a39c63b5f5c56cf5c3a95addec28/lib/benchmark/tools/gbench/report.py#L210-L271
ChromiumWebApps/chromium
c7361d39be8abd1574e6ce8957c8dbddd4c6ccf7
build/android/pylib/utils/emulator.py
python
Emulator.__init__
(self, avd_name, abi, api_level)
Init an Emulator. Args: avd_name: name of the AVD to create abi: target platform for emulator being created, defaults to x86 api_level: the api level of the image
Init an Emulator.
[ "Init", "an", "Emulator", "." ]
def __init__(self, avd_name, abi, api_level): """Init an Emulator. Args: avd_name: name of the AVD to create abi: target platform for emulator being created, defaults to x86 api_level: the api level of the image """ android_sdk_root = os.path.join(constants.EMULATOR_SDK_ROOT, 'sdk') ...
[ "def", "__init__", "(", "self", ",", "avd_name", ",", "abi", ",", "api_level", ")", ":", "android_sdk_root", "=", "os", ".", "path", ".", "join", "(", "constants", ".", "EMULATOR_SDK_ROOT", ",", "'sdk'", ")", "self", ".", "emulator", "=", "os", ".", "p...
https://github.com/ChromiumWebApps/chromium/blob/c7361d39be8abd1574e6ce8957c8dbddd4c6ccf7/build/android/pylib/utils/emulator.py#L214-L230
wxWidgets/wxPython-Classic
19571e1ae65f1ac445f5491474121998c97a1bf0
src/osx_cocoa/grid.py
python
GridEditorCreatedEvent.GetCol
(*args, **kwargs)
return _grid.GridEditorCreatedEvent_GetCol(*args, **kwargs)
GetCol(self) -> int
GetCol(self) -> int
[ "GetCol", "(", "self", ")", "-", ">", "int" ]
def GetCol(*args, **kwargs): """GetCol(self) -> int""" return _grid.GridEditorCreatedEvent_GetCol(*args, **kwargs)
[ "def", "GetCol", "(", "*", "args", ",", "*", "*", "kwargs", ")", ":", "return", "_grid", ".", "GridEditorCreatedEvent_GetCol", "(", "*", "args", ",", "*", "*", "kwargs", ")" ]
https://github.com/wxWidgets/wxPython-Classic/blob/19571e1ae65f1ac445f5491474121998c97a1bf0/src/osx_cocoa/grid.py#L2471-L2473
mantidproject/mantid
03deeb89254ec4289edb8771e0188c2090a02f32
scripts/Inelastic/Direct/PropertiesDescriptors.py
python
list_checker
(val,list_in,mess_base)
Helper function to check the value val (first input) belongs to the set, specified as the second input. If this is not true, raise ValueError indicating what property is wrong. To do indication, mess_base should contain the string, referring to the invalid property.
Helper function to check the value val (first input) belongs to the set, specified as the second input.
[ "Helper", "function", "to", "check", "the", "value", "val", "(", "first", "input", ")", "belongs", "to", "the", "set", "specified", "as", "the", "second", "input", "." ]
def list_checker(val,list_in,mess_base): """ Helper function to check the value val (first input) belongs to the set, specified as the second input. If this is not true, raise ValueError indicating what property is wrong. To do indication, mess_base should contain the string, referring to ...
[ "def", "list_checker", "(", "val", ",", "list_in", ",", "mess_base", ")", ":", "if", "val", "in", "list_in", ":", "return", "val", "else", ":", "raise", "ValueError", "(", "'{0} property can only have values from the set of: {1}'", "# noqa", ".", "format", "(", ...
https://github.com/mantidproject/mantid/blob/03deeb89254ec4289edb8771e0188c2090a02f32/scripts/Inelastic/Direct/PropertiesDescriptors.py#L1802-L1815
brave/brave-core
ceaa3de4735789d355b6fa80c21d4709e2c1d0e8
script/lib/env_util.py
python
get_environment_from_batch_command
(env_cmd, initial=None)
return result
Take a command (either a single command or list of arguments) and return the environment created after running that command. Note that if the command must be a batch file or .cmd file, or the changes to the environment will not be captured. If initial is supplied, it is used as the initial environment ...
Take a command (either a single command or list of arguments) and return the environment created after running that command. Note that if the command must be a batch file or .cmd file, or the changes to the environment will not be captured.
[ "Take", "a", "command", "(", "either", "a", "single", "command", "or", "list", "of", "arguments", ")", "and", "return", "the", "environment", "created", "after", "running", "that", "command", ".", "Note", "that", "if", "the", "command", "must", "be", "a", ...
def get_environment_from_batch_command(env_cmd, initial=None): """ Take a command (either a single command or list of arguments) and return the environment created after running that command. Note that if the command must be a batch file or .cmd file, or the changes to the environment will not be ca...
[ "def", "get_environment_from_batch_command", "(", "env_cmd", ",", "initial", "=", "None", ")", ":", "if", "not", "isinstance", "(", "env_cmd", ",", "(", "list", ",", "tuple", ")", ")", ":", "env_cmd", "=", "[", "env_cmd", "]", "# Construct the command that wil...
https://github.com/brave/brave-core/blob/ceaa3de4735789d355b6fa80c21d4709e2c1d0e8/script/lib/env_util.py#L31-L63
Polidea/SiriusObfuscator
b0e590d8130e97856afe578869b83a209e2b19be
SymbolExtractorAndRenamer/lldb/third_party/Python/module/pexpect-2.4/examples/rippy.py
python
compress_video
( video_source_filename, video_final_filename, video_target_size, audio_id=128, video_bitrate=1000, video_codec='mpeg4', audio_codec='mp3', video_fourcc_override='FMP4', video_gray_flag=0, video_crop_area=None, video_aspect_ratio='1...
return
This compresses the video and audio of the given source video filename to the transcoded filename. This does a two-pass compression (I'm assuming mpeg4, I should probably make this smarter for other formats).
This compresses the video and audio of the given source video filename to the transcoded filename. This does a two-pass compression (I'm assuming mpeg4, I should probably make this smarter for other formats).
[ "This", "compresses", "the", "video", "and", "audio", "of", "the", "given", "source", "video", "filename", "to", "the", "transcoded", "filename", ".", "This", "does", "a", "two", "-", "pass", "compression", "(", "I", "m", "assuming", "mpeg4", "I", "should"...
def compress_video( video_source_filename, video_final_filename, video_target_size, audio_id=128, video_bitrate=1000, video_codec='mpeg4', audio_codec='mp3', video_fourcc_override='FMP4', video_gray_flag=0, video_crop_area=None, vid...
[ "def", "compress_video", "(", "video_source_filename", ",", "video_final_filename", ",", "video_target_size", ",", "audio_id", "=", "128", ",", "video_bitrate", "=", "1000", ",", "video_codec", "=", "'mpeg4'", ",", "audio_codec", "=", "'mp3'", ",", "video_fourcc_ove...
https://github.com/Polidea/SiriusObfuscator/blob/b0e590d8130e97856afe578869b83a209e2b19be/SymbolExtractorAndRenamer/lldb/third_party/Python/module/pexpect-2.4/examples/rippy.py#L854-L935
PX4/PX4-Autopilot
0b9f60a0370be53d683352c63fd92db3d6586e18
Tools/uorb_graph/create.py
python
Graph._process_source_file
(self, file_name)
extract information from a single source file
extract information from a single source file
[ "extract", "information", "from", "a", "single", "source", "file" ]
def _process_source_file(self, file_name): """ extract information from a single source file """ current_scope = self._get_current_scope() log.debug( " >> {:}extracting topics from file: {:}" .format(current_scope.name+": " if current_scope is not None else "", fi...
[ "def", "_process_source_file", "(", "self", ",", "file_name", ")", ":", "current_scope", "=", "self", ".", "_get_current_scope", "(", ")", "log", ".", "debug", "(", "\" >> {:}extracting topics from file: {:}\"", ".", "format", "(", "current_scope", ".", "name...
https://github.com/PX4/PX4-Autopilot/blob/0b9f60a0370be53d683352c63fd92db3d6586e18/Tools/uorb_graph/create.py#L491-L556
catboost/catboost
167f64f237114a4d10b2b4ee42adb4569137debe
contrib/python/scipy/py2/scipy/optimize/_root.py
python
_root_leastsq
(func, x0, args=(), jac=None, col_deriv=0, xtol=1.49012e-08, ftol=1.49012e-08, gtol=0.0, maxiter=0, eps=0.0, factor=100, diag=None, **unknown_options)
return sol
Solve for least squares with Levenberg-Marquardt Options ------- col_deriv : bool non-zero to specify that the Jacobian function computes derivatives down the columns (faster, because there is no transpose operation). ftol : float Relative error desired in the sum of squares. ...
Solve for least squares with Levenberg-Marquardt
[ "Solve", "for", "least", "squares", "with", "Levenberg", "-", "Marquardt" ]
def _root_leastsq(func, x0, args=(), jac=None, col_deriv=0, xtol=1.49012e-08, ftol=1.49012e-08, gtol=0.0, maxiter=0, eps=0.0, factor=100, diag=None, **unknown_options): """ Solve for least squares with Levenberg-Marquardt Options ------- col_der...
[ "def", "_root_leastsq", "(", "func", ",", "x0", ",", "args", "=", "(", ")", ",", "jac", "=", "None", ",", "col_deriv", "=", "0", ",", "xtol", "=", "1.49012e-08", ",", "ftol", "=", "1.49012e-08", ",", "gtol", "=", "0.0", ",", "maxiter", "=", "0", ...
https://github.com/catboost/catboost/blob/167f64f237114a4d10b2b4ee42adb4569137debe/contrib/python/scipy/py2/scipy/optimize/_root.py#L212-L257