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
openai/atari-py
b0117f704919ed4cbbd5addcec5ec1b0fb3bff99
atari_py/ale_python_interface.py
python
ALEInterface.saveState
(self)
return ale_lib.saveState(self.obj)
Saves the state of the system
Saves the state of the system
[ "Saves", "the", "state", "of", "the", "system" ]
def saveState(self): """Saves the state of the system""" return ale_lib.saveState(self.obj)
[ "def", "saveState", "(", "self", ")", ":", "return", "ale_lib", ".", "saveState", "(", "self", ".", "obj", ")" ]
https://github.com/openai/atari-py/blob/b0117f704919ed4cbbd5addcec5ec1b0fb3bff99/atari_py/ale_python_interface.py#L302-L304
google/iree
1224bbdbe65b0d1fdf40e7324f60f68beeaf7c76
llvm-external-projects/iree-dialects/python/iree/compiler/dialects/iree_pydm/importer/util.py
python
ImportContext.create_functional_if_op
(self, results, condition: ir.Value, with_else_region: bool)
Sugar to create a `functional_if`. Returns: (if_op, then_ip, else_ip) if with_else_region, otherwise (if_op, then_ip)
Sugar to create a `functional_if`. Returns: (if_op, then_ip, else_ip) if with_else_region, otherwise (if_op, then_ip)
[ "Sugar", "to", "create", "a", "functional_if", ".", "Returns", ":", "(", "if_op", "then_ip", "else_ip", ")", "if", "with_else_region", "otherwise", "(", "if_op", "then_ip", ")" ]
def create_functional_if_op(self, results, condition: ir.Value, with_else_region: bool): """Sugar to create a `functional_if`. Returns: (if_op, then_ip, else_ip) if with_else_region, otherwise (if_op, then_ip) """ # TODO: ODS for these style of ops with variable regio...
[ "def", "create_functional_if_op", "(", "self", ",", "results", ",", "condition", ":", "ir", ".", "Value", ",", "with_else_region", ":", "bool", ")", ":", "# TODO: ODS for these style of ops with variable regions needs work.", "op", "=", "ir", ".", "Operation", ".", ...
https://github.com/google/iree/blob/1224bbdbe65b0d1fdf40e7324f60f68beeaf7c76/llvm-external-projects/iree-dialects/python/iree/compiler/dialects/iree_pydm/importer/util.py#L159-L179
y123456yz/reading-and-annotate-mongodb-3.6
93280293672ca7586dc24af18132aa61e4ed7fcf
mongo/buildscripts/cpplint.py
python
IsInitializerList
(clean_lines, linenum)
return False
Check if current line is inside constructor initializer list. Args: clean_lines: A CleansedLines instance containing the file. linenum: The number of the line to check. Returns: True if current line appears to be inside constructor initializer list, False otherwise.
Check if current line is inside constructor initializer list.
[ "Check", "if", "current", "line", "is", "inside", "constructor", "initializer", "list", "." ]
def IsInitializerList(clean_lines, linenum): """Check if current line is inside constructor initializer list. Args: clean_lines: A CleansedLines instance containing the file. linenum: The number of the line to check. Returns: True if current line appears to be inside constructor initializer list,...
[ "def", "IsInitializerList", "(", "clean_lines", ",", "linenum", ")", ":", "for", "i", "in", "xrange", "(", "linenum", ",", "1", ",", "-", "1", ")", ":", "line", "=", "clean_lines", ".", "elided", "[", "i", "]", "if", "i", "==", "linenum", ":", "rem...
https://github.com/y123456yz/reading-and-annotate-mongodb-3.6/blob/93280293672ca7586dc24af18132aa61e4ed7fcf/mongo/buildscripts/cpplint.py#L4963-L5002
benoitsteiner/tensorflow-opencl
cb7cb40a57fde5cfd4731bc551e82a1e2fef43a5
tensorflow/python/tools/freeze_graph.py
python
freeze_graph_with_def_protos
(input_graph_def, input_saver_def, input_checkpoint, output_node_names, restore_op_name, filename_tensor_name, output_grap...
return output_graph_def
Converts all variables in a graph and checkpoint into constants.
Converts all variables in a graph and checkpoint into constants.
[ "Converts", "all", "variables", "in", "a", "graph", "and", "checkpoint", "into", "constants", "." ]
def freeze_graph_with_def_protos(input_graph_def, input_saver_def, input_checkpoint, output_node_names, restore_op_name, filename_tensor_name, ...
[ "def", "freeze_graph_with_def_protos", "(", "input_graph_def", ",", "input_saver_def", ",", "input_checkpoint", ",", "output_node_names", ",", "restore_op_name", ",", "filename_tensor_name", ",", "output_graph", ",", "clear_devices", ",", "initializer_nodes", ",", "variable...
https://github.com/benoitsteiner/tensorflow-opencl/blob/cb7cb40a57fde5cfd4731bc551e82a1e2fef43a5/tensorflow/python/tools/freeze_graph.py#L62-L157
ChromiumWebApps/chromium
c7361d39be8abd1574e6ce8957c8dbddd4c6ccf7
tools/deep_memory_profiler/lib/policy.py
python
Policy.find_malloc
(self, bucket)
Finds a matching component name which a given |bucket| belongs to. Args: bucket: A Bucket object to be searched for. Returns: A string representing a component name.
Finds a matching component name which a given |bucket| belongs to.
[ "Finds", "a", "matching", "component", "name", "which", "a", "given", "|bucket|", "belongs", "to", "." ]
def find_malloc(self, bucket): """Finds a matching component name which a given |bucket| belongs to. Args: bucket: A Bucket object to be searched for. Returns: A string representing a component name. """ assert not bucket or bucket.allocator_type == 'malloc' if not bucket: ...
[ "def", "find_malloc", "(", "self", ",", "bucket", ")", ":", "assert", "not", "bucket", "or", "bucket", ".", "allocator_type", "==", "'malloc'", "if", "not", "bucket", ":", "return", "'no-bucket'", "if", "bucket", ".", "component_cache", ":", "return", "bucke...
https://github.com/ChromiumWebApps/chromium/blob/c7361d39be8abd1574e6ce8957c8dbddd4c6ccf7/tools/deep_memory_profiler/lib/policy.py#L135-L167
aws/lumberyard
f85344403c1c2e77ec8c75deb2c116e97b713217
dev/Gems/CloudGemMetric/v1/AWS/common-code/Lib/numba/parfor.py
python
try_fuse
(equiv_set, parfor1, parfor2)
return fuse_parfors_inner(parfor1, parfor2)
try to fuse parfors and return a fused parfor, otherwise return None
try to fuse parfors and return a fused parfor, otherwise return None
[ "try", "to", "fuse", "parfors", "and", "return", "a", "fused", "parfor", "otherwise", "return", "None" ]
def try_fuse(equiv_set, parfor1, parfor2): """try to fuse parfors and return a fused parfor, otherwise return None """ dprint("try_fuse: trying to fuse \n", parfor1, "\n", parfor2) # default report is None report = None # fusion of parfors with different dimensions not supported yet if len...
[ "def", "try_fuse", "(", "equiv_set", ",", "parfor1", ",", "parfor2", ")", ":", "dprint", "(", "\"try_fuse: trying to fuse \\n\"", ",", "parfor1", ",", "\"\\n\"", ",", "parfor2", ")", "# default report is None", "report", "=", "None", "# fusion of parfors with differen...
https://github.com/aws/lumberyard/blob/f85344403c1c2e77ec8c75deb2c116e97b713217/dev/Gems/CloudGemMetric/v1/AWS/common-code/Lib/numba/parfor.py#L3418-L3486
stan-dev/math
5fd79f89933269a4ca4d8dd1fde2a36d53d4768c
lib/boost_1.75.0/tools/build/src/build/project.py
python
ProjectRegistry.add_rule
(self, name, callable_)
Makes rule 'name' available to all subsequently loaded Jamfiles. Calling that rule will relay to 'callable'.
Makes rule 'name' available to all subsequently loaded Jamfiles.
[ "Makes", "rule", "name", "available", "to", "all", "subsequently", "loaded", "Jamfiles", "." ]
def add_rule(self, name, callable_): """Makes rule 'name' available to all subsequently loaded Jamfiles. Calling that rule will relay to 'callable'.""" assert isinstance(name, basestring) assert callable(callable_) self.project_rules_.add_rule(name, callable_)
[ "def", "add_rule", "(", "self", ",", "name", ",", "callable_", ")", ":", "assert", "isinstance", "(", "name", ",", "basestring", ")", "assert", "callable", "(", "callable_", ")", "self", ".", "project_rules_", ".", "add_rule", "(", "name", ",", "callable_"...
https://github.com/stan-dev/math/blob/5fd79f89933269a4ca4d8dd1fde2a36d53d4768c/lib/boost_1.75.0/tools/build/src/build/project.py#L639-L645
aws/lumberyard
f85344403c1c2e77ec8c75deb2c116e97b713217
dev/Gems/CloudGemMetric/v1/AWS/python/windows/Lib/numpy/lib/histograms.py
python
_hist_bin_doane
(x, range)
return 0.0
Doane's histogram bin estimator. Improved version of Sturges' formula which works better for non-normal data. See stats.stackexchange.com/questions/55134/doanes-formula-for-histogram-binning Parameters ---------- x : array_like Input data that is to be histogrammed, trimmed to range. M...
Doane's histogram bin estimator.
[ "Doane", "s", "histogram", "bin", "estimator", "." ]
def _hist_bin_doane(x, range): """ Doane's histogram bin estimator. Improved version of Sturges' formula which works better for non-normal data. See stats.stackexchange.com/questions/55134/doanes-formula-for-histogram-binning Parameters ---------- x : array_like Input data that...
[ "def", "_hist_bin_doane", "(", "x", ",", "range", ")", ":", "del", "range", "# unused", "if", "x", ".", "size", ">", "2", ":", "sg1", "=", "np", ".", "sqrt", "(", "6.0", "*", "(", "x", ".", "size", "-", "2", ")", "/", "(", "(", "x", ".", "s...
https://github.com/aws/lumberyard/blob/f85344403c1c2e77ec8c75deb2c116e97b713217/dev/Gems/CloudGemMetric/v1/AWS/python/windows/Lib/numpy/lib/histograms.py#L167-L199
BlzFans/wke
b0fa21158312e40c5fbd84682d643022b6c34a93
cygwin/lib/python2.6/ftplib.py
python
parse257
(resp)
return dirname
Parse the '257' response for a MKD or PWD request. This is a response to a MKD or PWD request: a directory name. Returns the directoryname in the 257 reply.
Parse the '257' response for a MKD or PWD request. This is a response to a MKD or PWD request: a directory name. Returns the directoryname in the 257 reply.
[ "Parse", "the", "257", "response", "for", "a", "MKD", "or", "PWD", "request", ".", "This", "is", "a", "response", "to", "a", "MKD", "or", "PWD", "request", ":", "a", "directory", "name", ".", "Returns", "the", "directoryname", "in", "the", "257", "repl...
def parse257(resp): '''Parse the '257' response for a MKD or PWD request. This is a response to a MKD or PWD request: a directory name. Returns the directoryname in the 257 reply.''' if resp[:3] != '257': raise error_reply, resp if resp[3:5] != ' "': return '' # Not compliant to RFC...
[ "def", "parse257", "(", "resp", ")", ":", "if", "resp", "[", ":", "3", "]", "!=", "'257'", ":", "raise", "error_reply", ",", "resp", "if", "resp", "[", "3", ":", "5", "]", "!=", "' \"'", ":", "return", "''", "# Not compliant to RFC 959, but UNIX ftpd doe...
https://github.com/BlzFans/wke/blob/b0fa21158312e40c5fbd84682d643022b6c34a93/cygwin/lib/python2.6/ftplib.py#L645-L665
CRYTEK/CRYENGINE
232227c59a220cbbd311576f0fbeba7bb53b2a8c
Tools/CryVersionSelector/release_project.py
python
package_engine_assets
(engine_path, export_path)
Runs the Resource Compiler on the engine assets following the instructions of engine_assets.xml. Outputs the .pak files in the Engine folder of the build.
Runs the Resource Compiler on the engine assets following the instructions of engine_assets.xml. Outputs the .pak files in the Engine folder of the build.
[ "Runs", "the", "Resource", "Compiler", "on", "the", "engine", "assets", "following", "the", "instructions", "of", "engine_assets", ".", "xml", ".", "Outputs", "the", ".", "pak", "files", "in", "the", "Engine", "folder", "of", "the", "build", "." ]
def package_engine_assets(engine_path, export_path): """ Runs the Resource Compiler on the engine assets following the instructions of engine_assets.xml. Outputs the .pak files in the Engine folder of the build. """ rc_path = os.path.join(engine_path, "Tools", "rc", "rc.exe") rc_job_path = ...
[ "def", "package_engine_assets", "(", "engine_path", ",", "export_path", ")", ":", "rc_path", "=", "os", ".", "path", ".", "join", "(", "engine_path", ",", "\"Tools\"", ",", "\"rc\"", ",", "\"rc.exe\"", ")", "rc_job_path", "=", "os", ".", "path", ".", "join...
https://github.com/CRYTEK/CRYENGINE/blob/232227c59a220cbbd311576f0fbeba7bb53b2a8c/Tools/CryVersionSelector/release_project.py#L384-L414
hughperkins/tf-coriander
970d3df6c11400ad68405f22b0c42a52374e94ca
tensorflow/python/debug/cli/debugger_cli_common.py
python
CommandHandlerRegistry.register_command_handler
(self, prefix, handler, help_info, prefix_aliases=None)
Register a callable as a command handler. Args: prefix: Command prefix, i.e., the first word in a command, e.g., "print" as in "print tensor_1". handler: A callable of the following signature: foo_handler(argv, screen_info=None), where argv is the argument vector (excluding th...
Register a callable as a command handler.
[ "Register", "a", "callable", "as", "a", "command", "handler", "." ]
def register_command_handler(self, prefix, handler, help_info, prefix_aliases=None): """Register a callable as a command handler. Args: prefix: Command prefix, i.e., the first word ...
[ "def", "register_command_handler", "(", "self", ",", "prefix", ",", "handler", ",", "help_info", ",", "prefix_aliases", "=", "None", ")", ":", "# TODO(cais): Refactor handler specification so that it returns not only", "# a RichTextLine object, but also an exit token.", "if", ...
https://github.com/hughperkins/tf-coriander/blob/970d3df6c11400ad68405f22b0c42a52374e94ca/tensorflow/python/debug/cli/debugger_cli_common.py#L291-L353
benoitsteiner/tensorflow-opencl
cb7cb40a57fde5cfd4731bc551e82a1e2fef43a5
tensorflow/contrib/graph_editor/select.py
python
check_cios
(control_inputs=False, control_outputs=None, control_ios=None)
return control_inputs, control_outputs
Do various check on control_inputs and control_outputs. Args: control_inputs: A boolean indicating whether control inputs are enabled. control_outputs: An instance of util.ControlOutputs or None. If not None, control outputs are enabled. control_ios: An instance of util.ControlOutputs or None. If ...
Do various check on control_inputs and control_outputs.
[ "Do", "various", "check", "on", "control_inputs", "and", "control_outputs", "." ]
def check_cios(control_inputs=False, control_outputs=None, control_ios=None): """Do various check on control_inputs and control_outputs. Args: control_inputs: A boolean indicating whether control inputs are enabled. control_outputs: An instance of util.ControlOutputs or None. If not None, control out...
[ "def", "check_cios", "(", "control_inputs", "=", "False", ",", "control_outputs", "=", "None", ",", "control_ios", "=", "None", ")", ":", "if", "control_ios", "is", "not", "None", ":", "if", "not", "isinstance", "(", "control_ios", ",", "util", ".", "Contr...
https://github.com/benoitsteiner/tensorflow-opencl/blob/cb7cb40a57fde5cfd4731bc551e82a1e2fef43a5/tensorflow/contrib/graph_editor/select.py#L205-L240
kamyu104/LeetCode-Solutions
77605708a927ea3b85aee5a479db733938c7c211
Python/my-calendar-iii.py
python
MyCalendarThree2.book
(self, start, end)
return result
:type start: int :type end: int :rtype: int
:type start: int :type end: int :rtype: int
[ ":", "type", "start", ":", "int", ":", "type", "end", ":", "int", ":", "rtype", ":", "int" ]
def book(self, start, end): """ :type start: int :type end: int :rtype: int """ i = bisect.bisect_left(self.__books, (start, 1)) if i < len(self.__books) and self.__books[i][0] == start: self.__books[i] = (self.__books[i][0], self.__books[i][1]+1) ...
[ "def", "book", "(", "self", ",", "start", ",", "end", ")", ":", "i", "=", "bisect", ".", "bisect_left", "(", "self", ".", "__books", ",", "(", "start", ",", "1", ")", ")", "if", "i", "<", "len", "(", "self", ".", "__books", ")", "and", "self", ...
https://github.com/kamyu104/LeetCode-Solutions/blob/77605708a927ea3b85aee5a479db733938c7c211/Python/my-calendar-iii.py#L43-L65
facebookincubator/BOLT
88c70afe9d388ad430cc150cc158641701397f70
clang/bindings/python/clang/cindex.py
python
Diagnostic.disable_option
(self)
return _CXString.from_result(disable)
The command-line option that disables this diagnostic.
The command-line option that disables this diagnostic.
[ "The", "command", "-", "line", "option", "that", "disables", "this", "diagnostic", "." ]
def disable_option(self): """The command-line option that disables this diagnostic.""" disable = _CXString() conf.lib.clang_getDiagnosticOption(self, byref(disable)) return _CXString.from_result(disable)
[ "def", "disable_option", "(", "self", ")", ":", "disable", "=", "_CXString", "(", ")", "conf", ".", "lib", ".", "clang_getDiagnosticOption", "(", "self", ",", "byref", "(", "disable", ")", ")", "return", "_CXString", ".", "from_result", "(", "disable", ")"...
https://github.com/facebookincubator/BOLT/blob/88c70afe9d388ad430cc150cc158641701397f70/clang/bindings/python/clang/cindex.py#L475-L479
weolar/miniblink49
1c4678db0594a4abde23d3ebbcc7cd13c3170777
third_party/WebKit/Tools/Scripts/webkitpy/thirdparty/BeautifulSoup.py
python
PageElement.findParent
(self, name=None, attrs={}, **kwargs)
return r
Returns the closest parent of this Tag that matches the given criteria.
Returns the closest parent of this Tag that matches the given criteria.
[ "Returns", "the", "closest", "parent", "of", "this", "Tag", "that", "matches", "the", "given", "criteria", "." ]
def findParent(self, name=None, attrs={}, **kwargs): """Returns the closest parent of this Tag that matches the given criteria.""" # NOTE: We can't use _findOne because findParents takes a different # set of arguments. r = None l = self.findParents(name, attrs, 1) ...
[ "def", "findParent", "(", "self", ",", "name", "=", "None", ",", "attrs", "=", "{", "}", ",", "*", "*", "kwargs", ")", ":", "# NOTE: We can't use _findOne because findParents takes a different", "# set of arguments.", "r", "=", "None", "l", "=", "self", ".", "...
https://github.com/weolar/miniblink49/blob/1c4678db0594a4abde23d3ebbcc7cd13c3170777/third_party/WebKit/Tools/Scripts/webkitpy/thirdparty/BeautifulSoup.py#L305-L314
microsoft/checkedc-clang
a173fefde5d7877b7750e7ce96dd08cf18baebf2
lldb/third_party/Python/module/six/six.py
python
_import_module
(name)
return sys.modules[name]
Import module, returning the module after the last dot.
Import module, returning the module after the last dot.
[ "Import", "module", "returning", "the", "module", "after", "the", "last", "dot", "." ]
def _import_module(name): """Import module, returning the module after the last dot.""" __import__(name) return sys.modules[name]
[ "def", "_import_module", "(", "name", ")", ":", "__import__", "(", "name", ")", "return", "sys", ".", "modules", "[", "name", "]" ]
https://github.com/microsoft/checkedc-clang/blob/a173fefde5d7877b7750e7ce96dd08cf18baebf2/lldb/third_party/Python/module/six/six.py#L80-L83
tensorflow/tensorflow
419e3a6b650ea4bd1b0cba23c4348f8a69f3272e
tensorflow/python/framework/tensor_shape.py
python
disable_v2_tensorshape
()
Disables the V2 TensorShape behavior and reverts to V1 behavior. See docstring for `enable_v2_tensorshape` for details about the new behavior.
Disables the V2 TensorShape behavior and reverts to V1 behavior.
[ "Disables", "the", "V2", "TensorShape", "behavior", "and", "reverts", "to", "V1", "behavior", "." ]
def disable_v2_tensorshape(): """Disables the V2 TensorShape behavior and reverts to V1 behavior. See docstring for `enable_v2_tensorshape` for details about the new behavior. """ global _TENSORSHAPE_V2_OVERRIDE # pylint: disable=invalid-name _TENSORSHAPE_V2_OVERRIDE = False logging.vlog(1, "Disabling v2 ...
[ "def", "disable_v2_tensorshape", "(", ")", ":", "global", "_TENSORSHAPE_V2_OVERRIDE", "# pylint: disable=invalid-name", "_TENSORSHAPE_V2_OVERRIDE", "=", "False", "logging", ".", "vlog", "(", "1", ",", "\"Disabling v2 tensorshape\"", ")", "_api_usage_gauge", ".", "get_cell",...
https://github.com/tensorflow/tensorflow/blob/419e3a6b650ea4bd1b0cba23c4348f8a69f3272e/tensorflow/python/framework/tensor_shape.py#L90-L98
CoolProp/CoolProp
381c8535e5dec3eec27ad430ebbfff8bc9dfc008
wrappers/LibreOffice/src/coolprop.py
python
CoolPropCalcAddin.PhaseSI
(self, name1, prop1, name2, prop2, fluid_name)
Return the phase of a given state from SI inputs
Return the phase of a given state from SI inputs
[ "Return", "the", "phase", "of", "a", "given", "state", "from", "SI", "inputs" ]
def PhaseSI(self, name1, prop1, name2, prop2, fluid_name): """Return the phase of a given state from SI inputs""" try: return CoolProp.PhaseSI(name1, prop1, name2, prop2, fluid_name) except Exception as e: return str(e)
[ "def", "PhaseSI", "(", "self", ",", "name1", ",", "prop1", ",", "name2", ",", "prop2", ",", "fluid_name", ")", ":", "try", ":", "return", "CoolProp", ".", "PhaseSI", "(", "name1", ",", "prop1", ",", "name2", ",", "prop2", ",", "fluid_name", ")", "exc...
https://github.com/CoolProp/CoolProp/blob/381c8535e5dec3eec27ad430ebbfff8bc9dfc008/wrappers/LibreOffice/src/coolprop.py#L36-L41
hanpfei/chromium-net
392cc1fa3a8f92f42e4071ab6e674d8e0482f83f
third_party/catapult/third_party/gsutil/gslib/command_runner.py
python
CommandRunner.MaybeCheckForAndOfferSoftwareUpdate
(self, command_name, debug)
return False
Checks the last time we checked for an update and offers one if needed. Offer is made if the time since the last update check is longer than the configured threshold offers the user to update gsutil. Args: command_name: The name of the command being run. debug: Debug level to pass in to boto c...
Checks the last time we checked for an update and offers one if needed.
[ "Checks", "the", "last", "time", "we", "checked", "for", "an", "update", "and", "offers", "one", "if", "needed", "." ]
def MaybeCheckForAndOfferSoftwareUpdate(self, command_name, debug): """Checks the last time we checked for an update and offers one if needed. Offer is made if the time since the last update check is longer than the configured threshold offers the user to update gsutil. Args: command_name: The n...
[ "def", "MaybeCheckForAndOfferSoftwareUpdate", "(", "self", ",", "command_name", ",", "debug", ")", ":", "# Don't try to interact with user if:", "# - gsutil is not connected to a tty (e.g., if being run from cron);", "# - user is running gsutil -q", "# - user is running the config command ...
https://github.com/hanpfei/chromium-net/blob/392cc1fa3a8f92f42e4071ab6e674d8e0482f83f/third_party/catapult/third_party/gsutil/gslib/command_runner.py#L292-L388
Xilinx/Vitis-AI
fc74d404563d9951b57245443c73bef389f3657f
tools/Vitis-AI-Quantizer/vai_q_tensorflow1.x/tensorflow/python/ops/sparse_ops.py
python
sparse_maximum
(sp_a, sp_b, name=None)
return sparse_tensor.SparseTensor(out_indices, out_values, sp_a.dense_shape)
Returns the element-wise max of two SparseTensors. Assumes the two SparseTensors have the same shape, i.e., no broadcasting. Example: ```python sp_zero = sparse_tensor.SparseTensor([[0]], [0], [7]) sp_one = sparse_tensor.SparseTensor([[1]], [1], [7]) res = tf.sparse.maximum(sp_zero, sp_one).eval() # "re...
Returns the element-wise max of two SparseTensors.
[ "Returns", "the", "element", "-", "wise", "max", "of", "two", "SparseTensors", "." ]
def sparse_maximum(sp_a, sp_b, name=None): """Returns the element-wise max of two SparseTensors. Assumes the two SparseTensors have the same shape, i.e., no broadcasting. Example: ```python sp_zero = sparse_tensor.SparseTensor([[0]], [0], [7]) sp_one = sparse_tensor.SparseTensor([[1]], [1], [7]) res = t...
[ "def", "sparse_maximum", "(", "sp_a", ",", "sp_b", ",", "name", "=", "None", ")", ":", "with", "ops", ".", "name_scope", "(", "name", ",", "\"SparseSparseMaximum\"", ",", "[", "sp_a", ".", "indices", ",", "sp_a", ".", "values", ",", "sp_b", ".", "indic...
https://github.com/Xilinx/Vitis-AI/blob/fc74d404563d9951b57245443c73bef389f3657f/tools/Vitis-AI-Quantizer/vai_q_tensorflow1.x/tensorflow/python/ops/sparse_ops.py#L2466-L2499
apache/arrow
af33dd1157eb8d7d9bfac25ebf61445b793b7943
cpp/build-support/cpplint.py
python
RemoveMultiLineCommentsFromRange
(lines, begin, end)
Clears a range of lines for multi-line comments.
Clears a range of lines for multi-line comments.
[ "Clears", "a", "range", "of", "lines", "for", "multi", "-", "line", "comments", "." ]
def RemoveMultiLineCommentsFromRange(lines, begin, end): """Clears a range of lines for multi-line comments.""" # Having // dummy comments makes the lines non-empty, so we will not get # unnecessary blank line warnings later in the code. for i in range(begin, end): lines[i] = '/**/'
[ "def", "RemoveMultiLineCommentsFromRange", "(", "lines", ",", "begin", ",", "end", ")", ":", "# Having // dummy comments makes the lines non-empty, so we will not get", "# unnecessary blank line warnings later in the code.", "for", "i", "in", "range", "(", "begin", ",", "end", ...
https://github.com/apache/arrow/blob/af33dd1157eb8d7d9bfac25ebf61445b793b7943/cpp/build-support/cpplint.py#L1554-L1559
tensorflow/minigo
6d89c202cdceaf449aefc3149ab2110d44f1a6a4
bigtable_input.py
python
GameQueue.read_wait_cell
(self)
return cbt_intvalue(value)
Read the value of the cell holding the 'wait' value, Returns the int value of whatever it has, or None if the cell doesn't exist.
Read the value of the cell holding the 'wait' value,
[ "Read", "the", "value", "of", "the", "cell", "holding", "the", "wait", "value" ]
def read_wait_cell(self): """Read the value of the cell holding the 'wait' value, Returns the int value of whatever it has, or None if the cell doesn't exist. """ table_state = self.bt_table.read_row( TABLE_STATE, filter_=bigtable_row_filters.ColumnRange...
[ "def", "read_wait_cell", "(", "self", ")", ":", "table_state", "=", "self", ".", "bt_table", ".", "read_row", "(", "TABLE_STATE", ",", "filter_", "=", "bigtable_row_filters", ".", "ColumnRangeFilter", "(", "METADATA", ",", "WAIT_CELL", ",", "WAIT_CELL", ")", "...
https://github.com/tensorflow/minigo/blob/6d89c202cdceaf449aefc3149ab2110d44f1a6a4/bigtable_input.py#L444-L465
wxWidgets/wxPython-Classic
19571e1ae65f1ac445f5491474121998c97a1bf0
src/osx_carbon/_core.py
python
GridSizer.SetRows
(*args, **kwargs)
return _core_.GridSizer_SetRows(*args, **kwargs)
SetRows(self, int rows) Sets the number of rows in the sizer.
SetRows(self, int rows)
[ "SetRows", "(", "self", "int", "rows", ")" ]
def SetRows(*args, **kwargs): """ SetRows(self, int rows) Sets the number of rows in the sizer. """ return _core_.GridSizer_SetRows(*args, **kwargs)
[ "def", "SetRows", "(", "*", "args", ",", "*", "*", "kwargs", ")", ":", "return", "_core_", ".", "GridSizer_SetRows", "(", "*", "args", ",", "*", "*", "kwargs", ")" ]
https://github.com/wxWidgets/wxPython-Classic/blob/19571e1ae65f1ac445f5491474121998c97a1bf0/src/osx_carbon/_core.py#L15213-L15219
apple/turicreate
cce55aa5311300e3ce6af93cb45ba791fd1bdf49
src/python/turicreate/toolkits/graph_analytics/label_propagation.py
python
LabelPropagationModel.__init__
(self, model)
__init__(self)
__init__(self)
[ "__init__", "(", "self", ")" ]
def __init__(self, model): """__init__(self)""" self.__proxy__ = model
[ "def", "__init__", "(", "self", ",", "model", ")", ":", "self", ".", "__proxy__", "=", "model" ]
https://github.com/apple/turicreate/blob/cce55aa5311300e3ce6af93cb45ba791fd1bdf49/src/python/turicreate/toolkits/graph_analytics/label_propagation.py#L92-L94
Netflix/NfWebCrypto
499faf4eb9f9ccf0b21dc728e974970f54bd6c52
plugin/ppapi/ppapi/c/documentation/doxy_cleanup.py
python
main
()
return 0
Main entry for the doxy_cleanup utility doxy_cleanup takes a list of html files and modifies them in place.
Main entry for the doxy_cleanup utility
[ "Main", "entry", "for", "the", "doxy_cleanup", "utility" ]
def main(): '''Main entry for the doxy_cleanup utility doxy_cleanup takes a list of html files and modifies them in place.''' parser = optparse.OptionParser(usage='Usage: %prog [options] files...') parser.add_option('-m', '--move', dest='move', action='store_true', default=False, help='mo...
[ "def", "main", "(", ")", ":", "parser", "=", "optparse", ".", "OptionParser", "(", "usage", "=", "'Usage: %prog [options] files...'", ")", "parser", ".", "add_option", "(", "'-m'", ",", "'--move'", ",", "dest", "=", "'move'", ",", "action", "=", "'store_true...
https://github.com/Netflix/NfWebCrypto/blob/499faf4eb9f9ccf0b21dc728e974970f54bd6c52/plugin/ppapi/ppapi/c/documentation/doxy_cleanup.py#L103-L139
MegEngine/MegEngine
ce9ad07a27ec909fb8db4dd67943d24ba98fb93a
imperative/python/megengine/optimizer/multi_step_lr.py
python
MultiStepLR.state_dict
(self)
return { key: value for key, value in self.__dict__.items() if key in ["milestones", "gamma", "current_epoch"] }
r"""Returns the state of the scheduler as a :class:`dict`. It contains an entry for every variable in self.__dict__ which is not the optimizer.
r"""Returns the state of the scheduler as a :class:`dict`. It contains an entry for every variable in self.__dict__ which is not the optimizer.
[ "r", "Returns", "the", "state", "of", "the", "scheduler", "as", "a", ":", "class", ":", "dict", ".", "It", "contains", "an", "entry", "for", "every", "variable", "in", "self", ".", "__dict__", "which", "is", "not", "the", "optimizer", "." ]
def state_dict(self): r"""Returns the state of the scheduler as a :class:`dict`. It contains an entry for every variable in self.__dict__ which is not the optimizer. """ return { key: value for key, value in self.__dict__.items() if key...
[ "def", "state_dict", "(", "self", ")", ":", "return", "{", "key", ":", "value", "for", "key", ",", "value", "in", "self", ".", "__dict__", ".", "items", "(", ")", "if", "key", "in", "[", "\"milestones\"", ",", "\"gamma\"", ",", "\"current_epoch\"", "]"...
https://github.com/MegEngine/MegEngine/blob/ce9ad07a27ec909fb8db4dd67943d24ba98fb93a/imperative/python/megengine/optimizer/multi_step_lr.py#L45-L54
aws/lumberyard
f85344403c1c2e77ec8c75deb2c116e97b713217
dev/Gems/CloudGemMetric/v1/AWS/common-code/Lib/psutil/_psposix.py
python
get_terminal_map
()
return ret
Get a map of device-id -> path as a dict. Used by Process.terminal()
Get a map of device-id -> path as a dict. Used by Process.terminal()
[ "Get", "a", "map", "of", "device", "-", "id", "-", ">", "path", "as", "a", "dict", ".", "Used", "by", "Process", ".", "terminal", "()" ]
def get_terminal_map(): """Get a map of device-id -> path as a dict. Used by Process.terminal() """ ret = {} ls = glob.glob('/dev/tty*') + glob.glob('/dev/pts/*') for name in ls: assert name not in ret, name try: ret[os.stat(name).st_rdev] = name except FileNo...
[ "def", "get_terminal_map", "(", ")", ":", "ret", "=", "{", "}", "ls", "=", "glob", ".", "glob", "(", "'/dev/tty*'", ")", "+", "glob", ".", "glob", "(", "'/dev/pts/*'", ")", "for", "name", "in", "ls", ":", "assert", "name", "not", "in", "ret", ",", ...
https://github.com/aws/lumberyard/blob/f85344403c1c2e77ec8c75deb2c116e97b713217/dev/Gems/CloudGemMetric/v1/AWS/common-code/Lib/psutil/_psposix.py#L163-L175
TimoSaemann/caffe-segnet-cudnn5
abcf30dca449245e101bf4ced519f716177f0885
python/caffe/io.py
python
Transformer.set_input_scale
(self, in_, scale)
Set the scale of preprocessed inputs s.t. the blob = blob * scale. N.B. input_scale is done AFTER mean subtraction and other preprocessing while raw_scale is done BEFORE. Parameters ---------- in_ : which input to assign this scale factor scale : scale coefficient
Set the scale of preprocessed inputs s.t. the blob = blob * scale. N.B. input_scale is done AFTER mean subtraction and other preprocessing while raw_scale is done BEFORE.
[ "Set", "the", "scale", "of", "preprocessed", "inputs", "s", ".", "t", ".", "the", "blob", "=", "blob", "*", "scale", ".", "N", ".", "B", ".", "input_scale", "is", "done", "AFTER", "mean", "subtraction", "and", "other", "preprocessing", "while", "raw_scal...
def set_input_scale(self, in_, scale): """ Set the scale of preprocessed inputs s.t. the blob = blob * scale. N.B. input_scale is done AFTER mean subtraction and other preprocessing while raw_scale is done BEFORE. Parameters ---------- in_ : which input to assign...
[ "def", "set_input_scale", "(", "self", ",", "in_", ",", "scale", ")", ":", "self", ".", "__check_input", "(", "in_", ")", "self", ".", "input_scale", "[", "in_", "]", "=", "scale" ]
https://github.com/TimoSaemann/caffe-segnet-cudnn5/blob/abcf30dca449245e101bf4ced519f716177f0885/python/caffe/io.py#L262-L274
catboost/catboost
167f64f237114a4d10b2b4ee42adb4569137debe
contrib/tools/python3/src/Lib/asyncio/sslproto.py
python
_SSLProtocolTransport.resume_reading
(self)
Resume the receiving end. Data received will once again be passed to the protocol's data_received() method.
Resume the receiving end.
[ "Resume", "the", "receiving", "end", "." ]
def resume_reading(self): """Resume the receiving end. Data received will once again be passed to the protocol's data_received() method. """ self._ssl_protocol._transport.resume_reading()
[ "def", "resume_reading", "(", "self", ")", ":", "self", ".", "_ssl_protocol", ".", "_transport", ".", "resume_reading", "(", ")" ]
https://github.com/catboost/catboost/blob/167f64f237114a4d10b2b4ee42adb4569137debe/contrib/tools/python3/src/Lib/asyncio/sslproto.py#L337-L343
protocolbuffers/protobuf
b5ab0b7a18b7336c60130f4ddb2d97c51792f896
python/mox.py
python
UnorderedGroup.IsSatisfied
(self)
return len(self._methods) == 0
Return True if there are not any methods in this group.
Return True if there are not any methods in this group.
[ "Return", "True", "if", "there", "are", "not", "any", "methods", "in", "this", "group", "." ]
def IsSatisfied(self): """Return True if there are not any methods in this group.""" return len(self._methods) == 0
[ "def", "IsSatisfied", "(", "self", ")", ":", "return", "len", "(", "self", ".", "_methods", ")", "==", "0" ]
https://github.com/protocolbuffers/protobuf/blob/b5ab0b7a18b7336c60130f4ddb2d97c51792f896/python/mox.py#L1257-L1260
wxWidgets/wxPython-Classic
19571e1ae65f1ac445f5491474121998c97a1bf0
wx/lib/docview.py
python
DocManager.OnPreview
(self, event)
Previews the current document by calling its View's OnCreatePrintout method.
Previews the current document by calling its View's OnCreatePrintout method.
[ "Previews", "the", "current", "document", "by", "calling", "its", "View", "s", "OnCreatePrintout", "method", "." ]
def OnPreview(self, event): """ Previews the current document by calling its View's OnCreatePrintout method. """ view = self.GetCurrentView() if not view: return printout = view.OnCreatePrintout() if printout: if not hasattr(self, ...
[ "def", "OnPreview", "(", "self", ",", "event", ")", ":", "view", "=", "self", ".", "GetCurrentView", "(", ")", "if", "not", "view", ":", "return", "printout", "=", "view", ".", "OnCreatePrintout", "(", ")", "if", "printout", ":", "if", "not", "hasattr"...
https://github.com/wxWidgets/wxPython-Classic/blob/19571e1ae65f1ac445f5491474121998c97a1bf0/wx/lib/docview.py#L1544-L1572
pgRouting/osm2pgrouting
8491929fc4037d308f271e84d59bb96da3c28aa2
tools/cpplint.py
python
GetPreviousNonBlankLine
(clean_lines, linenum)
return ('', -1)
Return the most recent non-blank line and its line number. Args: clean_lines: A CleansedLines instance containing the file contents. linenum: The number of the line to check. Returns: A tuple with two elements. The first element is the contents of the last non-blank line before the current line, ...
Return the most recent non-blank line and its line number.
[ "Return", "the", "most", "recent", "non", "-", "blank", "line", "and", "its", "line", "number", "." ]
def GetPreviousNonBlankLine(clean_lines, linenum): """Return the most recent non-blank line and its line number. Args: clean_lines: A CleansedLines instance containing the file contents. linenum: The number of the line to check. Returns: A tuple with two elements. The first element is the contents ...
[ "def", "GetPreviousNonBlankLine", "(", "clean_lines", ",", "linenum", ")", ":", "prevlinenum", "=", "linenum", "-", "1", "while", "prevlinenum", ">=", "0", ":", "prevline", "=", "clean_lines", ".", "elided", "[", "prevlinenum", "]", "if", "not", "IsBlankLine",...
https://github.com/pgRouting/osm2pgrouting/blob/8491929fc4037d308f271e84d59bb96da3c28aa2/tools/cpplint.py#L3865-L3885
nyuwireless-unipd/ns3-mmwave
4ff9e87e8079764e04cbeccd8e85bff15ae16fb3
bindings/python/rad_util.py
python
pt2str
(point)
return "(%s, %s)" % (str(point[0]), str(point[1]))
Return prettier string version of point tuple. >>> pt2str((1.8, 1.9)) '(1.8, 1.9)'
Return prettier string version of point tuple.
[ "Return", "prettier", "string", "version", "of", "point", "tuple", "." ]
def pt2str(point): """Return prettier string version of point tuple. >>> pt2str((1.8, 1.9)) '(1.8, 1.9)' """ return "(%s, %s)" % (str(point[0]), str(point[1]))
[ "def", "pt2str", "(", "point", ")", ":", "return", "\"(%s, %s)\"", "%", "(", "str", "(", "point", "[", "0", "]", ")", ",", "str", "(", "point", "[", "1", "]", ")", ")" ]
https://github.com/nyuwireless-unipd/ns3-mmwave/blob/4ff9e87e8079764e04cbeccd8e85bff15ae16fb3/bindings/python/rad_util.py#L213-L220
opengauss-mirror/openGauss-server
e383f1b77720a00ddbe4c0655bc85914d9b02a2b
src/gausskernel/dbmind/tools/xtuner/tuner/executor.py
python
SSH.__init__
(self, host, user, pwd, port=22, max_retry_times=5)
Use the paramiko library to establish an SSH connection with the remote server. You can run one or more commands. In addition, the `gsql` password information is not exposed. :param host: String type. :param user: String type. :param pwd: String type. :param port: Int ty...
Use the paramiko library to establish an SSH connection with the remote server. You can run one or more commands. In addition, the `gsql` password information is not exposed.
[ "Use", "the", "paramiko", "library", "to", "establish", "an", "SSH", "connection", "with", "the", "remote", "server", ".", "You", "can", "run", "one", "or", "more", "commands", ".", "In", "addition", "the", "gsql", "password", "information", "is", "not", "...
def __init__(self, host, user, pwd, port=22, max_retry_times=5): """ Use the paramiko library to establish an SSH connection with the remote server. You can run one or more commands. In addition, the `gsql` password information is not exposed. :param host: String type. :...
[ "def", "__init__", "(", "self", ",", "host", ",", "user", ",", "pwd", ",", "port", "=", "22", ",", "max_retry_times", "=", "5", ")", ":", "self", ".", "host", "=", "host", "self", ".", "user", "=", "user", "self", ".", "pwd", "=", "pwd", "self", ...
https://github.com/opengauss-mirror/openGauss-server/blob/e383f1b77720a00ddbe4c0655bc85914d9b02a2b/src/gausskernel/dbmind/tools/xtuner/tuner/executor.py#L122-L144
psi4/psi4
be533f7f426b6ccc263904e55122899b16663395
psi4/driver/p4util/numpy_helper.py
python
_array_conversion
(self)
Provides the array interface to simply classes so that np.array(core.Matrix(5, 5)) works flawlessly.
Provides the array interface to simply classes so that np.array(core.Matrix(5, 5)) works flawlessly.
[ "Provides", "the", "array", "interface", "to", "simply", "classes", "so", "that", "np", ".", "array", "(", "core", ".", "Matrix", "(", "5", "5", "))", "works", "flawlessly", "." ]
def _array_conversion(self): """ Provides the array interface to simply classes so that np.array(core.Matrix(5, 5)) works flawlessly. """ if self.nirrep() > 1: raise ValidationError("__array__interface__ can only be called on Psi4 data object with only one irrep!") else: return self....
[ "def", "_array_conversion", "(", "self", ")", ":", "if", "self", ".", "nirrep", "(", ")", ">", "1", ":", "raise", "ValidationError", "(", "\"__array__interface__ can only be called on Psi4 data object with only one irrep!\"", ")", "else", ":", "return", "self", ".", ...
https://github.com/psi4/psi4/blob/be533f7f426b6ccc263904e55122899b16663395/psi4/driver/p4util/numpy_helper.py#L337-L344
apache/incubator-mxnet
f03fb23f1d103fec9541b5ae59ee06b1734a51d9
ci/build.py
python
load_docker_cache
(platform, tag, docker_registry)
Imports tagged container from the given docker registry
Imports tagged container from the given docker registry
[ "Imports", "tagged", "container", "from", "the", "given", "docker", "registry" ]
def load_docker_cache(platform, tag, docker_registry) -> None: """Imports tagged container from the given docker registry""" if docker_registry: env = os.environ.copy() env["DOCKER_CACHE_REGISTRY"] = docker_registry cmd = ['docker-compose', '-f', 'docker/docker-compose.yml', 'pull', plat...
[ "def", "load_docker_cache", "(", "platform", ",", "tag", ",", "docker_registry", ")", "->", "None", ":", "if", "docker_registry", ":", "env", "=", "os", ".", "environ", ".", "copy", "(", ")", "env", "[", "\"DOCKER_CACHE_REGISTRY\"", "]", "=", "docker_registr...
https://github.com/apache/incubator-mxnet/blob/f03fb23f1d103fec9541b5ae59ee06b1734a51d9/ci/build.py#L185-L194
BSVino/DoubleAction
c550b168a3e919926c198c30240f506538b92e75
mp/src/thirdparty/protobuf-2.3.0/python/mox.py
python
MockMethod.__getattr__
(self, name)
Raise an AttributeError with a helpful message.
Raise an AttributeError with a helpful message.
[ "Raise", "an", "AttributeError", "with", "a", "helpful", "message", "." ]
def __getattr__(self, name): """Raise an AttributeError with a helpful message.""" raise AttributeError('MockMethod has no attribute "%s". ' 'Did you remember to put your mocks in replay mode?' % name)
[ "def", "__getattr__", "(", "self", ",", "name", ")", ":", "raise", "AttributeError", "(", "'MockMethod has no attribute \"%s\". '", "'Did you remember to put your mocks in replay mode?'", "%", "name", ")" ]
https://github.com/BSVino/DoubleAction/blob/c550b168a3e919926c198c30240f506538b92e75/mp/src/thirdparty/protobuf-2.3.0/python/mox.py#L575-L579
jackaudio/jack2
21b293dbc37d42446141a08922cdec0d2550c6a0
waflib/Tools/c_aliases.py
python
program
(bld, *k, **kw)
return bld(*k, **kw)
Alias for creating programs by looking at the file extensions:: def build(bld): bld.program(source='foo.c', target='app') # equivalent to: # bld(features='c cprogram', source='foo.c', target='app')
Alias for creating programs by looking at the file extensions::
[ "Alias", "for", "creating", "programs", "by", "looking", "at", "the", "file", "extensions", "::" ]
def program(bld, *k, **kw): """ Alias for creating programs by looking at the file extensions:: def build(bld): bld.program(source='foo.c', target='app') # equivalent to: # bld(features='c cprogram', source='foo.c', target='app') """ set_features(kw, 'program') return bld(*k, **kw)
[ "def", "program", "(", "bld", ",", "*", "k", ",", "*", "*", "kw", ")", ":", "set_features", "(", "kw", ",", "'program'", ")", "return", "bld", "(", "*", "k", ",", "*", "*", "kw", ")" ]
https://github.com/jackaudio/jack2/blob/21b293dbc37d42446141a08922cdec0d2550c6a0/waflib/Tools/c_aliases.py#L90-L101
wxWidgets/wxPython-Classic
19571e1ae65f1ac445f5491474121998c97a1bf0
src/osx_carbon/wizard.py
python
WizardPage.GetBitmap
(*args, **kwargs)
return _wizard.WizardPage_GetBitmap(*args, **kwargs)
GetBitmap(self) -> Bitmap
GetBitmap(self) -> Bitmap
[ "GetBitmap", "(", "self", ")", "-", ">", "Bitmap" ]
def GetBitmap(*args, **kwargs): """GetBitmap(self) -> Bitmap""" return _wizard.WizardPage_GetBitmap(*args, **kwargs)
[ "def", "GetBitmap", "(", "*", "args", ",", "*", "*", "kwargs", ")", ":", "return", "_wizard", ".", "WizardPage_GetBitmap", "(", "*", "args", ",", "*", "*", "kwargs", ")" ]
https://github.com/wxWidgets/wxPython-Classic/blob/19571e1ae65f1ac445f5491474121998c97a1bf0/src/osx_carbon/wizard.py#L125-L127
opengauss-mirror/openGauss-server
e383f1b77720a00ddbe4c0655bc85914d9b02a2b
src/gausskernel/dbmind/tools/xtuner/tuner/knob.py
python
RecommendedKnobs.dump
(self, fp, dump_report_knobs=True)
Dump the tuning result.
Dump the tuning result.
[ "Dump", "the", "tuning", "result", "." ]
def dump(self, fp, dump_report_knobs=True): """ Dump the tuning result. """ knob_dict = dict() knob_list = list() knob_list.extend(self._need_tune_knobs) if dump_report_knobs: knob_list.extend(self._only_report_knobs) for knob in knob_list: ...
[ "def", "dump", "(", "self", ",", "fp", ",", "dump_report_knobs", "=", "True", ")", ":", "knob_dict", "=", "dict", "(", ")", "knob_list", "=", "list", "(", ")", "knob_list", ".", "extend", "(", "self", ".", "_need_tune_knobs", ")", "if", "dump_report_knob...
https://github.com/opengauss-mirror/openGauss-server/blob/e383f1b77720a00ddbe4c0655bc85914d9b02a2b/src/gausskernel/dbmind/tools/xtuner/tuner/knob.py#L55-L68
zetavm/zetavm
61af9cd317fa5629f570b30b61ea8c7ffc375e59
espresso/e_parser.py
python
parse_expr_prec
(input_handler, min_prec)
return lhs_expr
The first call has min precedence 0 Each call loops to grab everything of the current precedence or greater and builds a left-sided subtree out of it, associating operators to their left operand If an operator has less than the current precedence, the loop breaks, returning us to the previous loop l...
The first call has min precedence 0 Each call loops to grab everything of the current precedence or greater and builds a left-sided subtree out of it, associating operators to their left operand If an operator has less than the current precedence, the loop breaks, returning us to the previous loop l...
[ "The", "first", "call", "has", "min", "precedence", "0", "Each", "call", "loops", "to", "grab", "everything", "of", "the", "current", "precedence", "or", "greater", "and", "builds", "a", "left", "-", "sided", "subtree", "out", "of", "it", "associating", "o...
def parse_expr_prec(input_handler, min_prec): """ The first call has min precedence 0 Each call loops to grab everything of the current precedence or greater and builds a left-sided subtree out of it, associating operators to their left operand If an operator has less than the current precedence...
[ "def", "parse_expr_prec", "(", "input_handler", ",", "min_prec", ")", ":", "lhs_expr", "=", "parse_atom", "(", "input_handler", ")", "while", "True", ":", "input_handler", ".", "eat_ws", "(", ")", "op", "=", "match_op", "(", "input_handler", ",", "min_prec", ...
https://github.com/zetavm/zetavm/blob/61af9cd317fa5629f570b30b61ea8c7ffc375e59/espresso/e_parser.py#L110-L144
PixarAnimationStudios/USD
faed18ce62c8736b02413635b584a2f637156bad
pxr/usdImaging/usdviewq/pythonInterpreter.py
python
Controller.readline
(self)
Simulate stdin, stdout, and stderr.
Simulate stdin, stdout, and stderr.
[ "Simulate", "stdin", "stdout", "and", "stderr", "." ]
def readline(self): """ Simulate stdin, stdout, and stderr. """ # XXX: Prevent more than one interpreter from blocking on a readline() # call. Starting more than one subevent loop does not work, # because they must exit in the order that they were created. ...
[ "def", "readline", "(", "self", ")", ":", "# XXX: Prevent more than one interpreter from blocking on a readline()", "# call. Starting more than one subevent loop does not work,", "# because they must exit in the order that they were created.", "if", "Controller", ".", "_isAnyReadl...
https://github.com/PixarAnimationStudios/USD/blob/faed18ce62c8736b02413635b584a2f637156bad/pxr/usdImaging/usdviewq/pythonInterpreter.py#L356-L399
windystrife/UnrealEngine_NVIDIAGameWorks
b50e6338a7c5b26374d66306ebc7807541ff815e
Engine/Extras/ThirdPartyNotUE/emsdk/Win64/python/2.7.5.3_64bit/Lib/distutils/command/build_py.py
python
build_py.get_package_dir
(self, package)
Return the directory, relative to the top of the source distribution, where package 'package' should be found (at least according to the 'package_dir' option, if any).
Return the directory, relative to the top of the source distribution, where package 'package' should be found (at least according to the 'package_dir' option, if any).
[ "Return", "the", "directory", "relative", "to", "the", "top", "of", "the", "source", "distribution", "where", "package", "package", "should", "be", "found", "(", "at", "least", "according", "to", "the", "package_dir", "option", "if", "any", ")", "." ]
def get_package_dir(self, package): """Return the directory, relative to the top of the source distribution, where package 'package' should be found (at least according to the 'package_dir' option, if any).""" path = package.split('.') if not self.package_dir: ...
[ "def", "get_package_dir", "(", "self", ",", "package", ")", ":", "path", "=", "package", ".", "split", "(", "'.'", ")", "if", "not", "self", ".", "package_dir", ":", "if", "path", ":", "return", "os", ".", "path", ".", "join", "(", "*", "path", ")"...
https://github.com/windystrife/UnrealEngine_NVIDIAGameWorks/blob/b50e6338a7c5b26374d66306ebc7807541ff815e/Engine/Extras/ThirdPartyNotUE/emsdk/Win64/python/2.7.5.3_64bit/Lib/distutils/command/build_py.py#L143-L181
intel/llvm
e6d0547e9d99b5a56430c4749f6c7e328bf221ab
clang/bindings/python/clang/cindex.py
python
TranslationUnit.get_location
(self, filename, position)
return SourceLocation.from_position(self, f, position[0], position[1])
Obtain a SourceLocation for a file in this translation unit. The position can be specified by passing: - Integer file offset. Initial file offset is 0. - 2-tuple of (line number, column number). Initial file position is (0, 0)
Obtain a SourceLocation for a file in this translation unit.
[ "Obtain", "a", "SourceLocation", "for", "a", "file", "in", "this", "translation", "unit", "." ]
def get_location(self, filename, position): """Obtain a SourceLocation for a file in this translation unit. The position can be specified by passing: - Integer file offset. Initial file offset is 0. - 2-tuple of (line number, column number). Initial file position is (0,...
[ "def", "get_location", "(", "self", ",", "filename", ",", "position", ")", ":", "f", "=", "self", ".", "get_file", "(", "filename", ")", "if", "isinstance", "(", "position", ",", "int", ")", ":", "return", "SourceLocation", ".", "from_offset", "(", "self...
https://github.com/intel/llvm/blob/e6d0547e9d99b5a56430c4749f6c7e328bf221ab/clang/bindings/python/clang/cindex.py#L2913-L2927
google/shaka-packager
e1b0c7c45431327fd3ce193514a5407d07b39b22
packager/third_party/protobuf/python/google/protobuf/json_format.py
python
ParseDict
(js_dict, message, ignore_unknown_fields=False)
return message
Parses a JSON dictionary representation into a message. Args: js_dict: Dict representation of a JSON message. message: A protocol buffer message to merge into. ignore_unknown_fields: If True, do not raise errors for unknown fields. Returns: The same message passed as argument.
Parses a JSON dictionary representation into a message.
[ "Parses", "a", "JSON", "dictionary", "representation", "into", "a", "message", "." ]
def ParseDict(js_dict, message, ignore_unknown_fields=False): """Parses a JSON dictionary representation into a message. Args: js_dict: Dict representation of a JSON message. message: A protocol buffer message to merge into. ignore_unknown_fields: If True, do not raise errors for unknown fields. Ret...
[ "def", "ParseDict", "(", "js_dict", ",", "message", ",", "ignore_unknown_fields", "=", "False", ")", ":", "parser", "=", "_Parser", "(", "ignore_unknown_fields", ")", "parser", ".", "ConvertMessage", "(", "js_dict", ",", "message", ")", "return", "message" ]
https://github.com/google/shaka-packager/blob/e1b0c7c45431327fd3ce193514a5407d07b39b22/packager/third_party/protobuf/python/google/protobuf/json_format.py#L372-L385
GJDuck/LowFat
ecf6a0f0fa1b73a27a626cf493cc39e477b6faea
llvm-4.0.0.src/bindings/python/llvm/object.py
python
Section.has_symbol
(self, symbol)
return lib.LLVMGetSectionContainsSymbol(self, symbol)
Returns whether a Symbol instance is present in this Section.
Returns whether a Symbol instance is present in this Section.
[ "Returns", "whether", "a", "Symbol", "instance", "is", "present", "in", "this", "Section", "." ]
def has_symbol(self, symbol): """Returns whether a Symbol instance is present in this Section.""" if self.expired: raise Exception('Section instance has expired.') assert isinstance(symbol, Symbol) return lib.LLVMGetSectionContainsSymbol(self, symbol)
[ "def", "has_symbol", "(", "self", ",", "symbol", ")", ":", "if", "self", ".", "expired", ":", "raise", "Exception", "(", "'Section instance has expired.'", ")", "assert", "isinstance", "(", "symbol", ",", "Symbol", ")", "return", "lib", ".", "LLVMGetSectionCon...
https://github.com/GJDuck/LowFat/blob/ecf6a0f0fa1b73a27a626cf493cc39e477b6faea/llvm-4.0.0.src/bindings/python/llvm/object.py#L232-L238
tensorflow/tensorflow
419e3a6b650ea4bd1b0cba23c4348f8a69f3272e
tensorflow/python/grappler/item.py
python
Item.GetOpProperties
(self)
return properties
Get Op properties.
Get Op properties.
[ "Get", "Op", "properties", "." ]
def GetOpProperties(self): """Get Op properties.""" props = tf_item.TF_GetOpProperties(self.tf_item) properties = {} for key, values in props.items(): prop = [] for value in values: # TODO(petebu): Make this conversion to a dictionary be done in the C++ # wrapper for performa...
[ "def", "GetOpProperties", "(", "self", ")", ":", "props", "=", "tf_item", ".", "TF_GetOpProperties", "(", "self", ".", "tf_item", ")", "properties", "=", "{", "}", "for", "key", ",", "values", "in", "props", ".", "items", "(", ")", ":", "prop", "=", ...
https://github.com/tensorflow/tensorflow/blob/419e3a6b650ea4bd1b0cba23c4348f8a69f3272e/tensorflow/python/grappler/item.py#L51-L63
CRYTEK/CRYENGINE
232227c59a220cbbd311576f0fbeba7bb53b2a8c
Tools/CryVersionSelector/cryselect.py
python
cmd_remove_plugins
(args)
Removes the plugins from the registered engine.
Removes the plugins from the registered engine.
[ "Removes", "the", "plugins", "from", "the", "registered", "engine", "." ]
def cmd_remove_plugins(args): """ Removes the plugins from the registered engine. """ sys.exit(remove_plugins(args.engine_id, args.plugin_files))
[ "def", "cmd_remove_plugins", "(", "args", ")", ":", "sys", ".", "exit", "(", "remove_plugins", "(", "args", ".", "engine_id", ",", "args", ".", "plugin_files", ")", ")" ]
https://github.com/CRYTEK/CRYENGINE/blob/232227c59a220cbbd311576f0fbeba7bb53b2a8c/Tools/CryVersionSelector/cryselect.py#L624-L628
krishauser/Klampt
972cc83ea5befac3f653c1ba20f80155768ad519
Python/python2_version/klampt/vis/visualization.py
python
hidePlotItem
(name,itemname,hidden=True)
Hides an item in the plot. To hide a particular channel of a given item pass a pair (itemname,channelindex). Examples: To hide configurations 0-5 of 'robot', call:: hidePlotItem('plot',('robot',0)) ... hidePlotItem('plot',('robot',5))
Hides an item in the plot. To hide a particular channel of a given item pass a pair (itemname,channelindex).
[ "Hides", "an", "item", "in", "the", "plot", ".", "To", "hide", "a", "particular", "channel", "of", "a", "given", "item", "pass", "a", "pair", "(", "itemname", "channelindex", ")", "." ]
def hidePlotItem(name,itemname,hidden=True): """Hides an item in the plot. To hide a particular channel of a given item pass a pair (itemname,channelindex). Examples: To hide configurations 0-5 of 'robot', call:: hidePlotItem('plot',('robot',0)) ... hidePlotIte...
[ "def", "hidePlotItem", "(", "name", ",", "itemname", ",", "hidden", "=", "True", ")", ":", "global", "_vis", "if", "_vis", "is", "None", ":", "return", "_vis", ".", "hidePlotItem", "(", "name", ",", "itemname", ",", "hidden", ")" ]
https://github.com/krishauser/Klampt/blob/972cc83ea5befac3f653c1ba20f80155768ad519/Python/python2_version/klampt/vis/visualization.py#L1132-L1146
aws/lumberyard
f85344403c1c2e77ec8c75deb2c116e97b713217
dev/Tools/Python/3.7.10/mac/Python.framework/Versions/3.7/lib/python3.7/site-packages/botocore/configprovider.py
python
ConfigValueStore.clear_config_variable
(self, logical_name)
Remove an override config variable from the session. :type logical_name: str :param logical_name: The name of the parameter to clear the override value from.
Remove an override config variable from the session.
[ "Remove", "an", "override", "config", "variable", "from", "the", "session", "." ]
def clear_config_variable(self, logical_name): """Remove an override config variable from the session. :type logical_name: str :param logical_name: The name of the parameter to clear the override value from. """ self._overrides.pop(logical_name, None)
[ "def", "clear_config_variable", "(", "self", ",", "logical_name", ")", ":", "self", ".", "_overrides", ".", "pop", "(", "logical_name", ",", "None", ")" ]
https://github.com/aws/lumberyard/blob/f85344403c1c2e77ec8c75deb2c116e97b713217/dev/Tools/Python/3.7.10/mac/Python.framework/Versions/3.7/lib/python3.7/site-packages/botocore/configprovider.py#L321-L328
aws/lumberyard
f85344403c1c2e77ec8c75deb2c116e97b713217
dev/Gems/CloudGemMetric/v1/AWS/common-code/Lib/pandas/core/arrays/categorical.py
python
Categorical.set_categories
(self, new_categories, ordered=None, rename=False, inplace=False)
Set the categories to the specified new_categories. `new_categories` can include new categories (which will result in unused categories) or remove old categories (which results in values set to NaN). If `rename==True`, the categories will simple be renamed (less or more items than in ol...
Set the categories to the specified new_categories.
[ "Set", "the", "categories", "to", "the", "specified", "new_categories", "." ]
def set_categories(self, new_categories, ordered=None, rename=False, inplace=False): """ Set the categories to the specified new_categories. `new_categories` can include new categories (which will result in unused categories) or remove old categories (which results in values set...
[ "def", "set_categories", "(", "self", ",", "new_categories", ",", "ordered", "=", "None", ",", "rename", "=", "False", ",", "inplace", "=", "False", ")", ":", "inplace", "=", "validate_bool_kwarg", "(", "inplace", ",", "\"inplace\"", ")", "if", "ordered", ...
https://github.com/aws/lumberyard/blob/f85344403c1c2e77ec8c75deb2c116e97b713217/dev/Gems/CloudGemMetric/v1/AWS/common-code/Lib/pandas/core/arrays/categorical.py#L792-L863
tensorflow/tensorflow
419e3a6b650ea4bd1b0cba23c4348f8a69f3272e
tensorflow/python/eager/function.py
python
ConcreteFunction._call_with_flat_signature
(self, args, kwargs, cancellation_manager)
return self._call_flat(args, self.captured_inputs, cancellation_manager)
Executes the wrapped function with the flat signature. Args: args: Positional arguments to the concrete function. kwargs: Keyword arguments to the concrete function. cancellation_manager: A `CancellationManager` that can be used to cancel function invocation. Returns: The resul...
Executes the wrapped function with the flat signature.
[ "Executes", "the", "wrapped", "function", "with", "the", "flat", "signature", "." ]
def _call_with_flat_signature(self, args, kwargs, cancellation_manager): """Executes the wrapped function with the flat signature. Args: args: Positional arguments to the concrete function. kwargs: Keyword arguments to the concrete function. cancellation_manager: A `CancellationManager` that ...
[ "def", "_call_with_flat_signature", "(", "self", ",", "args", ",", "kwargs", ",", "cancellation_manager", ")", ":", "if", "len", "(", "args", ")", ">", "self", ".", "_num_positional_args", ":", "raise", "TypeError", "(", "f\"{self._flat_signature_summary()} takes {s...
https://github.com/tensorflow/tensorflow/blob/419e3a6b650ea4bd1b0cba23c4348f8a69f3272e/tensorflow/python/eager/function.py#L1623-L1670
pmq20/node-packer
12c46c6e44fbc14d9ee645ebd17d5296b324f7e0
lts/deps/v8/third_party/jinja2/compiler.py
python
CodeGenerator.blockvisit
(self, nodes, frame)
Visit a list of nodes as block in a frame. If the current frame is no buffer a dummy ``if 0: yield None`` is written automatically.
Visit a list of nodes as block in a frame. If the current frame is no buffer a dummy ``if 0: yield None`` is written automatically.
[ "Visit", "a", "list", "of", "nodes", "as", "block", "in", "a", "frame", ".", "If", "the", "current", "frame", "is", "no", "buffer", "a", "dummy", "if", "0", ":", "yield", "None", "is", "written", "automatically", "." ]
def blockvisit(self, nodes, frame): """Visit a list of nodes as block in a frame. If the current frame is no buffer a dummy ``if 0: yield None`` is written automatically. """ try: self.writeline('pass') for node in nodes: self.visit(node, frame) ...
[ "def", "blockvisit", "(", "self", ",", "nodes", ",", "frame", ")", ":", "try", ":", "self", ".", "writeline", "(", "'pass'", ")", "for", "node", "in", "nodes", ":", "self", ".", "visit", "(", "node", ",", "frame", ")", "except", "CompilerExit", ":", ...
https://github.com/pmq20/node-packer/blob/12c46c6e44fbc14d9ee645ebd17d5296b324f7e0/lts/deps/v8/third_party/jinja2/compiler.py#L371-L380
krishauser/Klampt
972cc83ea5befac3f653c1ba20f80155768ad519
Python/klampt/robotsim.py
python
RobotModelLink.getAngularVelocity
(self)
return _robotsim.RobotModelLink_getAngularVelocity(self)
r""" Computes the angular velocity of the link given the robot's current joint configuration and velocities. Returns: list of 3 floats: the current angular velocity of the link, in world coordinates
r""" Computes the angular velocity of the link given the robot's current joint configuration and velocities.
[ "r", "Computes", "the", "angular", "velocity", "of", "the", "link", "given", "the", "robot", "s", "current", "joint", "configuration", "and", "velocities", "." ]
def getAngularVelocity(self) ->None: r""" Computes the angular velocity of the link given the robot's current joint configuration and velocities. Returns: list of 3 floats: the current angular velocity of the link, in world coordinates """ ...
[ "def", "getAngularVelocity", "(", "self", ")", "->", "None", ":", "return", "_robotsim", ".", "RobotModelLink_getAngularVelocity", "(", "self", ")" ]
https://github.com/krishauser/Klampt/blob/972cc83ea5befac3f653c1ba20f80155768ad519/Python/klampt/robotsim.py#L4180-L4192
hanpfei/chromium-net
392cc1fa3a8f92f42e4071ab6e674d8e0482f83f
third_party/catapult/perf_insights/third_party/cloudstorage/api_utils.py
python
_RetryWrapper.__init__
(self, retry_params, retriable_exceptions=_RETRIABLE_EXCEPTIONS, should_retry=lambda r: False)
Init. Args: retry_params: an RetryParams instance. retriable_exceptions: a list of exception classes that are retriable. should_retry: a function that takes a result from the tasklet and returns a boolean. True if the result should be retried.
Init.
[ "Init", "." ]
def __init__(self, retry_params, retriable_exceptions=_RETRIABLE_EXCEPTIONS, should_retry=lambda r: False): """Init. Args: retry_params: an RetryParams instance. retriable_exceptions: a list of exception classes that are retriable. should_retry: a ...
[ "def", "__init__", "(", "self", ",", "retry_params", ",", "retriable_exceptions", "=", "_RETRIABLE_EXCEPTIONS", ",", "should_retry", "=", "lambda", "r", ":", "False", ")", ":", "self", ".", "retry_params", "=", "retry_params", "self", ".", "retriable_exceptions", ...
https://github.com/hanpfei/chromium-net/blob/392cc1fa3a8f92f42e4071ab6e674d8e0482f83f/third_party/catapult/perf_insights/third_party/cloudstorage/api_utils.py#L118-L132
MegEngine/MegEngine
ce9ad07a27ec909fb8db4dd67943d24ba98fb93a
imperative/python/megengine/core/tensor/array_method.py
python
ArrayMethodMixin.min
(self, axis=None, keepdims: bool = False)
return _reduce("min")(self, axis, keepdims)
r"""Returns the min value of each row of the input tensor in the given dimension ``axis``. If ``axis`` is a list of axises, reduce over all of them. If ``keepdims`` is ``True``, the shape of output tensor is the same as the input tensor, except in the dimension(s) ``axis`` where it is of size 1...
r"""Returns the min value of each row of the input tensor in the given dimension ``axis``.
[ "r", "Returns", "the", "min", "value", "of", "each", "row", "of", "the", "input", "tensor", "in", "the", "given", "dimension", "axis", "." ]
def min(self, axis=None, keepdims: bool = False): r"""Returns the min value of each row of the input tensor in the given dimension ``axis``. If ``axis`` is a list of axises, reduce over all of them. If ``keepdims`` is ``True``, the shape of output tensor is the same as the input tensor, ...
[ "def", "min", "(", "self", ",", "axis", "=", "None", ",", "keepdims", ":", "bool", "=", "False", ")", ":", "return", "_reduce", "(", "\"min\"", ")", "(", "self", ",", "axis", ",", "keepdims", ")" ]
https://github.com/MegEngine/MegEngine/blob/ce9ad07a27ec909fb8db4dd67943d24ba98fb93a/imperative/python/megengine/core/tensor/array_method.py#L556-L587
ZhouWeikuan/DouDiZhu
0d84ff6c0bc54dba6ae37955de9ae9307513dc99
code/frameworks/cocos2d-x/tools/bindings-generator/clang/cindex.py
python
Cursor.is_definition
(self)
return conf.lib.clang_isCursorDefinition(self)
Returns true if the declaration pointed at by the cursor is also a definition of that entity.
Returns true if the declaration pointed at by the cursor is also a definition of that entity.
[ "Returns", "true", "if", "the", "declaration", "pointed", "at", "by", "the", "cursor", "is", "also", "a", "definition", "of", "that", "entity", "." ]
def is_definition(self): """ Returns true if the declaration pointed at by the cursor is also a definition of that entity. """ return conf.lib.clang_isCursorDefinition(self) """ Determine the availability of the entity that this cursor refers to, taking t...
[ "def", "is_definition", "(", "self", ")", ":", "return", "conf", ".", "lib", ".", "clang_isCursorDefinition", "(", "self", ")", "\"\"\"\n Determine the availability of the entity that this cursor refers to,\n taking the current target platform into account.\n retur...
https://github.com/ZhouWeikuan/DouDiZhu/blob/0d84ff6c0bc54dba6ae37955de9ae9307513dc99/code/frameworks/cocos2d-x/tools/bindings-generator/clang/cindex.py#L1203-L1214
microsoft/TSS.MSR
0f2516fca2cd9929c31d5450e39301c9bde43688
TSS.Py/src/TpmTypes.py
python
TPMS_SM4_SYM_DETAILS.__init__
(self)
Custom data structure representing an empty element (i.e. the one with no data to marshal) for selector algorithm TPM_ALG_SM4 for the union TPMU_SYM_DETAILS
Custom data structure representing an empty element (i.e. the one with no data to marshal) for selector algorithm TPM_ALG_SM4 for the union TPMU_SYM_DETAILS
[ "Custom", "data", "structure", "representing", "an", "empty", "element", "(", "i", ".", "e", ".", "the", "one", "with", "no", "data", "to", "marshal", ")", "for", "selector", "algorithm", "TPM_ALG_SM4", "for", "the", "union", "TPMU_SYM_DETAILS" ]
def __init__(self): """ Custom data structure representing an empty element (i.e. the one with no data to marshal) for selector algorithm TPM_ALG_SM4 for the union TPMU_SYM_DETAILS """ pass
[ "def", "__init__", "(", "self", ")", ":", "pass" ]
https://github.com/microsoft/TSS.MSR/blob/0f2516fca2cd9929c31d5450e39301c9bde43688/TSS.Py/src/TpmTypes.py#L5656-L5662
hanpfei/chromium-net
392cc1fa3a8f92f42e4071ab6e674d8e0482f83f
third_party/catapult/third_party/gsutil/third_party/boto/boto/swf/layer1.py
python
Layer1.list_activity_types
(self, domain, registration_status, name=None, maximum_page_size=None, next_page_token=None, reverse_order=None)
return self.json_request('ListActivityTypes', { 'domain': domain, 'name': name, 'registrationStatus': registration_status, 'maximumPageSize': maximum_page_size, 'nextPageToken': next_page_token, 'reverseOrder': reverse_order, })
Returns information about all activities registered in the specified domain that match the specified name and registration status. The result includes information like creation date, current status of the activity, etc. The results may be split into multiple pages. To retrieve su...
Returns information about all activities registered in the specified domain that match the specified name and registration status. The result includes information like creation date, current status of the activity, etc. The results may be split into multiple pages. To retrieve su...
[ "Returns", "information", "about", "all", "activities", "registered", "in", "the", "specified", "domain", "that", "match", "the", "specified", "name", "and", "registration", "status", ".", "The", "result", "includes", "information", "like", "creation", "date", "cu...
def list_activity_types(self, domain, registration_status, name=None, maximum_page_size=None, next_page_token=None, reverse_order=None): """ Returns information about all activities registered in the specified do...
[ "def", "list_activity_types", "(", "self", ",", "domain", ",", "registration_status", ",", "name", "=", "None", ",", "maximum_page_size", "=", "None", ",", "next_page_token", "=", "None", ",", "reverse_order", "=", "None", ")", ":", "return", "self", ".", "j...
https://github.com/hanpfei/chromium-net/blob/392cc1fa3a8f92f42e4071ab6e674d8e0482f83f/third_party/catapult/third_party/gsutil/third_party/boto/boto/swf/layer1.py#L851-L907
Xilinx/Vitis-AI
fc74d404563d9951b57245443c73bef389f3657f
demo/DPU-for-RNN/rnn_u25_u50lv/apps/imdb_sentiment_detection/utils/hdf5_format.py
python
save_attributes_to_hdf5_group
(group, name, data)
Saves attributes (data) of the specified name into the HDF5 group. This method deals with an inherent problem of HDF5 file which is not able to store data larger than HDF5_OBJECT_HEADER_LIMIT bytes. Arguments: group: A pointer to a HDF5 group. name: A name of the attributes to save. data: Attr...
Saves attributes (data) of the specified name into the HDF5 group.
[ "Saves", "attributes", "(", "data", ")", "of", "the", "specified", "name", "into", "the", "HDF5", "group", "." ]
def save_attributes_to_hdf5_group(group, name, data): """Saves attributes (data) of the specified name into the HDF5 group. This method deals with an inherent problem of HDF5 file which is not able to store data larger than HDF5_OBJECT_HEADER_LIMIT bytes. Arguments: group: A pointer to a HDF5 group. ...
[ "def", "save_attributes_to_hdf5_group", "(", "group", ",", "name", ",", "data", ")", ":", "# Check that no item in `data` is larger than `HDF5_OBJECT_HEADER_LIMIT`", "# because in that case even chunking the array would not make the saving", "# possible.", "bad_attributes", "=", "[", ...
https://github.com/Xilinx/Vitis-AI/blob/fc74d404563d9951b57245443c73bef389f3657f/demo/DPU-for-RNN/rnn_u25_u50lv/apps/imdb_sentiment_detection/utils/hdf5_format.py#L781-L821
kamyu104/LeetCode-Solutions
77605708a927ea3b85aee5a479db733938c7c211
Python/convert-binary-number-in-a-linked-list-to-integer.py
python
Solution.getDecimalValue
(self, head)
return result
:type head: ListNode :rtype: int
:type head: ListNode :rtype: int
[ ":", "type", "head", ":", "ListNode", ":", "rtype", ":", "int" ]
def getDecimalValue(self, head): """ :type head: ListNode :rtype: int """ result = 0 while head: result = result*2 + head.val head = head.next return result
[ "def", "getDecimalValue", "(", "self", ",", "head", ")", ":", "result", "=", "0", "while", "head", ":", "result", "=", "result", "*", "2", "+", "head", ".", "val", "head", "=", "head", ".", "next", "return", "result" ]
https://github.com/kamyu104/LeetCode-Solutions/blob/77605708a927ea3b85aee5a479db733938c7c211/Python/convert-binary-number-in-a-linked-list-to-integer.py#L12-L21
catboost/catboost
167f64f237114a4d10b2b4ee42adb4569137debe
contrib/python/scikit-learn/py2/sklearn/cluster/k_means_.py
python
KMeans.fit_transform
(self, X, y=None)
return self.fit(X)._transform(X)
Compute clustering and transform X to cluster-distance space. Equivalent to fit(X).transform(X), but more efficiently implemented.
Compute clustering and transform X to cluster-distance space.
[ "Compute", "clustering", "and", "transform", "X", "to", "cluster", "-", "distance", "space", "." ]
def fit_transform(self, X, y=None): """Compute clustering and transform X to cluster-distance space. Equivalent to fit(X).transform(X), but more efficiently implemented. """ # Currently, this just skips a copy of the data if it is not in # np.array or CSR format already. ...
[ "def", "fit_transform", "(", "self", ",", "X", ",", "y", "=", "None", ")", ":", "# Currently, this just skips a copy of the data if it is not in", "# np.array or CSR format already.", "# XXX This skips _check_test_data, which may change the dtype;", "# we should refactor the input vali...
https://github.com/catboost/catboost/blob/167f64f237114a4d10b2b4ee42adb4569137debe/contrib/python/scikit-learn/py2/sklearn/cluster/k_means_.py#L900-L910
catboost/catboost
167f64f237114a4d10b2b4ee42adb4569137debe
contrib/tools/python/src/Lib/lib-tk/tkMessageBox.py
python
showinfo
(title=None, message=None, **options)
return _show(title, message, INFO, OK, **options)
Show an info message
Show an info message
[ "Show", "an", "info", "message" ]
def showinfo(title=None, message=None, **options): "Show an info message" return _show(title, message, INFO, OK, **options)
[ "def", "showinfo", "(", "title", "=", "None", ",", "message", "=", "None", ",", "*", "*", "options", ")", ":", "return", "_show", "(", "title", ",", "message", ",", "INFO", ",", "OK", ",", "*", "*", "options", ")" ]
https://github.com/catboost/catboost/blob/167f64f237114a4d10b2b4ee42adb4569137debe/contrib/tools/python/src/Lib/lib-tk/tkMessageBox.py#L81-L83
wxWidgets/wxPython-Classic
19571e1ae65f1ac445f5491474121998c97a1bf0
src/gtk/_controls.py
python
FileCtrl.GetFilename
(*args, **kwargs)
return _controls_.FileCtrl_GetFilename(*args, **kwargs)
GetFilename(self) -> String
GetFilename(self) -> String
[ "GetFilename", "(", "self", ")", "-", ">", "String" ]
def GetFilename(*args, **kwargs): """GetFilename(self) -> String""" return _controls_.FileCtrl_GetFilename(*args, **kwargs)
[ "def", "GetFilename", "(", "*", "args", ",", "*", "*", "kwargs", ")", ":", "return", "_controls_", ".", "FileCtrl_GetFilename", "(", "*", "args", ",", "*", "*", "kwargs", ")" ]
https://github.com/wxWidgets/wxPython-Classic/blob/19571e1ae65f1ac445f5491474121998c97a1bf0/src/gtk/_controls.py#L7584-L7586
catboost/catboost
167f64f237114a4d10b2b4ee42adb4569137debe
contrib/python/scipy/py2/scipy/sparse/linalg/interface.py
python
LinearOperator.matmat
(self, X)
return Y
Matrix-matrix multiplication. Performs the operation y=A*X where A is an MxN linear operator and X dense N*K matrix or ndarray. Parameters ---------- X : {matrix, ndarray} An array with shape (N,K). Returns ------- Y : {matrix, ndarray} ...
Matrix-matrix multiplication.
[ "Matrix", "-", "matrix", "multiplication", "." ]
def matmat(self, X): """Matrix-matrix multiplication. Performs the operation y=A*X where A is an MxN linear operator and X dense N*K matrix or ndarray. Parameters ---------- X : {matrix, ndarray} An array with shape (N,K). Returns ------- ...
[ "def", "matmat", "(", "self", ",", "X", ")", ":", "X", "=", "np", ".", "asanyarray", "(", "X", ")", "if", "X", ".", "ndim", "!=", "2", ":", "raise", "ValueError", "(", "'expected 2-d ndarray or matrix, not %d-d'", "%", "X", ".", "ndim", ")", "M", ","...
https://github.com/catboost/catboost/blob/167f64f237114a4d10b2b4ee42adb4569137debe/contrib/python/scipy/py2/scipy/sparse/linalg/interface.py#L293-L334
tensorflow/tensorflow
419e3a6b650ea4bd1b0cba23c4348f8a69f3272e
tensorflow/python/keras/saving/saved_model/save_impl.py
python
_wrap_activity_regularizer
(layer)
return def_function.Function( layer._activity_regularizer, '{}_activity_regularizer'.format(layer.name), input_signature=[ tensor_spec.TensorSpec(None, layer._compute_dtype or K.floatx()) ])
Wraps the activity regularizer.
Wraps the activity regularizer.
[ "Wraps", "the", "activity", "regularizer", "." ]
def _wrap_activity_regularizer(layer): """Wraps the activity regularizer.""" # pylint: disable=protected-access if isinstance(layer._activity_regularizer, def_function.Function): return layer._activity_regularizer return def_function.Function( layer._activity_regularizer, '{}_activity_regularize...
[ "def", "_wrap_activity_regularizer", "(", "layer", ")", ":", "# pylint: disable=protected-access", "if", "isinstance", "(", "layer", ".", "_activity_regularizer", ",", "def_function", ".", "Function", ")", ":", "return", "layer", ".", "_activity_regularizer", "return", ...
https://github.com/tensorflow/tensorflow/blob/419e3a6b650ea4bd1b0cba23c4348f8a69f3272e/tensorflow/python/keras/saving/saved_model/save_impl.py#L717-L727
giuspen/cherrytree
84712f206478fcf9acf30174009ad28c648c6344
pygtk2/modules/tablez.py
python
TablesHandler.table_row_copy
(self, *args)
Copy a Table Row
Copy a Table Row
[ "Copy", "a", "Table", "Row" ]
def table_row_copy(self, *args): """Copy a Table Row""" self.table_row_action("copy")
[ "def", "table_row_copy", "(", "self", ",", "*", "args", ")", ":", "self", ".", "table_row_action", "(", "\"copy\"", ")" ]
https://github.com/giuspen/cherrytree/blob/84712f206478fcf9acf30174009ad28c648c6344/pygtk2/modules/tablez.py#L584-L586
wlanjie/AndroidFFmpeg
7baf9122f4b8e1c74e7baf4be5c422c7a5ba5aaf
tools/fdk-aac-build/armeabi/toolchain/lib/python2.7/pickletools.py
python
read_unicodestringnl
(f)
return unicode(data, 'raw-unicode-escape')
r""" >>> import StringIO >>> read_unicodestringnl(StringIO.StringIO("abc\uabcd\njunk")) u'abc\uabcd'
r""" >>> import StringIO >>> read_unicodestringnl(StringIO.StringIO("abc\uabcd\njunk")) u'abc\uabcd'
[ "r", ">>>", "import", "StringIO", ">>>", "read_unicodestringnl", "(", "StringIO", ".", "StringIO", "(", "abc", "\\", "uabcd", "\\", "njunk", "))", "u", "abc", "\\", "uabcd" ]
def read_unicodestringnl(f): r""" >>> import StringIO >>> read_unicodestringnl(StringIO.StringIO("abc\uabcd\njunk")) u'abc\uabcd' """ data = f.readline() if not data.endswith('\n'): raise ValueError("no newline found when trying to read " "unicodestringnl") ...
[ "def", "read_unicodestringnl", "(", "f", ")", ":", "data", "=", "f", ".", "readline", "(", ")", "if", "not", "data", ".", "endswith", "(", "'\\n'", ")", ":", "raise", "ValueError", "(", "\"no newline found when trying to read \"", "\"unicodestringnl\"", ")", "...
https://github.com/wlanjie/AndroidFFmpeg/blob/7baf9122f4b8e1c74e7baf4be5c422c7a5ba5aaf/tools/fdk-aac-build/armeabi/toolchain/lib/python2.7/pickletools.py#L420-L432
catboost/catboost
167f64f237114a4d10b2b4ee42adb4569137debe
contrib/python/ipython/py2/IPython/core/completer.py
python
Completer.complete
(self, text, state)
Return the next possible completion for 'text'. This is called successively with state == 0, 1, 2, ... until it returns None. The completion should begin with 'text'.
Return the next possible completion for 'text'.
[ "Return", "the", "next", "possible", "completion", "for", "text", "." ]
def complete(self, text, state): """Return the next possible completion for 'text'. This is called successively with state == 0, 1, 2, ... until it returns None. The completion should begin with 'text'. """ if self.use_main_ns: self.namespace = __main__.__dict__ ...
[ "def", "complete", "(", "self", ",", "text", ",", "state", ")", ":", "if", "self", ".", "use_main_ns", ":", "self", ".", "namespace", "=", "__main__", ".", "__dict__", "if", "state", "==", "0", ":", "if", "\".\"", "in", "text", ":", "self", ".", "m...
https://github.com/catboost/catboost/blob/167f64f237114a4d10b2b4ee42adb4569137debe/contrib/python/ipython/py2/IPython/core/completer.py#L287-L305
wxWidgets/wxPython-Classic
19571e1ae65f1ac445f5491474121998c97a1bf0
src/msw/_windows.py
python
VarHScrollHelper.GetVisibleColumnsBegin
(*args, **kwargs)
return _windows_.VarHScrollHelper_GetVisibleColumnsBegin(*args, **kwargs)
GetVisibleColumnsBegin(self) -> size_t
GetVisibleColumnsBegin(self) -> size_t
[ "GetVisibleColumnsBegin", "(", "self", ")", "-", ">", "size_t" ]
def GetVisibleColumnsBegin(*args, **kwargs): """GetVisibleColumnsBegin(self) -> size_t""" return _windows_.VarHScrollHelper_GetVisibleColumnsBegin(*args, **kwargs)
[ "def", "GetVisibleColumnsBegin", "(", "*", "args", ",", "*", "*", "kwargs", ")", ":", "return", "_windows_", ".", "VarHScrollHelper_GetVisibleColumnsBegin", "(", "*", "args", ",", "*", "*", "kwargs", ")" ]
https://github.com/wxWidgets/wxPython-Classic/blob/19571e1ae65f1ac445f5491474121998c97a1bf0/src/msw/_windows.py#L2348-L2350
Xilinx/Vitis-AI
fc74d404563d9951b57245443c73bef389f3657f
tools/Vitis-AI-Quantizer/vai_q_tensorflow1.x/tensorflow/lite/python/optimize/calibrator.py
python
Calibrator.__init__
(self, model_content)
Constructor. Args: model_content: Content of a TF-Lite Flatbuffer file. Raises: ValueError: If the calibrator was unable to open the model.
Constructor.
[ "Constructor", "." ]
def __init__(self, model_content): """Constructor. Args: model_content: Content of a TF-Lite Flatbuffer file. Raises: ValueError: If the calibrator was unable to open the model. """ if not model_content: raise ValueError("`model_content` must be specified.") try: self._...
[ "def", "__init__", "(", "self", ",", "model_content", ")", ":", "if", "not", "model_content", ":", "raise", "ValueError", "(", "\"`model_content` must be specified.\"", ")", "try", ":", "self", ".", "_calibrator", "=", "(", "_calibration_wrapper", ".", "Calibratio...
https://github.com/Xilinx/Vitis-AI/blob/fc74d404563d9951b57245443c73bef389f3657f/tools/Vitis-AI-Quantizer/vai_q_tensorflow1.x/tensorflow/lite/python/optimize/calibrator.py#L38-L55
hanpfei/chromium-net
392cc1fa3a8f92f42e4071ab6e674d8e0482f83f
tools/nocompile_driver.py
python
ProcessTestResult
(resultfile, test)
Interprets and logs the result of a test started by StartTest() Args: resultfile: File object for .cc file that results are written to. test: The dictionary from StartTest() to process.
Interprets and logs the result of a test started by StartTest()
[ "Interprets", "and", "logs", "the", "result", "of", "a", "test", "started", "by", "StartTest", "()" ]
def ProcessTestResult(resultfile, test): """Interprets and logs the result of a test started by StartTest() Args: resultfile: File object for .cc file that results are written to. test: The dictionary from StartTest() to process. """ # Snap a copy of stdout and stderr into the test dictionary immediate...
[ "def", "ProcessTestResult", "(", "resultfile", ",", "test", ")", ":", "# Snap a copy of stdout and stderr into the test dictionary immediately", "# cause we can only call this once on the Popen object, and lots of stuff", "# below will want access to it.", "proc", "=", "test", "[", "'p...
https://github.com/hanpfei/chromium-net/blob/392cc1fa3a8f92f42e4071ab6e674d8e0482f83f/tools/nocompile_driver.py#L308-L350
catboost/catboost
167f64f237114a4d10b2b4ee42adb4569137debe
contrib/tools/python3/src/Lib/typing.py
python
Optional
(self, parameters)
return Union[arg, type(None)]
Optional type. Optional[X] is equivalent to Union[X, None].
Optional type.
[ "Optional", "type", "." ]
def Optional(self, parameters): """Optional type. Optional[X] is equivalent to Union[X, None]. """ arg = _type_check(parameters, f"{self} requires a single type.") return Union[arg, type(None)]
[ "def", "Optional", "(", "self", ",", "parameters", ")", ":", "arg", "=", "_type_check", "(", "parameters", ",", "f\"{self} requires a single type.\"", ")", "return", "Union", "[", "arg", ",", "type", "(", "None", ")", "]" ]
https://github.com/catboost/catboost/blob/167f64f237114a4d10b2b4ee42adb4569137debe/contrib/tools/python3/src/Lib/typing.py#L473-L479
catboost/catboost
167f64f237114a4d10b2b4ee42adb4569137debe
contrib/python/scipy/scipy/optimize/_lsq/dogbox.py
python
lsmr_operator
(Jop, d, active_set)
return LinearOperator((m, n), matvec=matvec, rmatvec=rmatvec, dtype=float)
Compute LinearOperator to use in LSMR by dogbox algorithm. `active_set` mask is used to excluded active variables from computations of matrix-vector products.
Compute LinearOperator to use in LSMR by dogbox algorithm.
[ "Compute", "LinearOperator", "to", "use", "in", "LSMR", "by", "dogbox", "algorithm", "." ]
def lsmr_operator(Jop, d, active_set): """Compute LinearOperator to use in LSMR by dogbox algorithm. `active_set` mask is used to excluded active variables from computations of matrix-vector products. """ m, n = Jop.shape def matvec(x): x_free = x.ravel().copy() x_free[active_s...
[ "def", "lsmr_operator", "(", "Jop", ",", "d", ",", "active_set", ")", ":", "m", ",", "n", "=", "Jop", ".", "shape", "def", "matvec", "(", "x", ")", ":", "x_free", "=", "x", ".", "ravel", "(", ")", ".", "copy", "(", ")", "x_free", "[", "active_s...
https://github.com/catboost/catboost/blob/167f64f237114a4d10b2b4ee42adb4569137debe/contrib/python/scipy/scipy/optimize/_lsq/dogbox.py#L59-L77
shedskin/shedskin
ae88dbca7b1d9671cd8be448cb0b497122758936
shedskin/lib/itertools.py
python
izip
(*iterables)
Known limitations: iterables must all be of the same type if they are more than two
Known limitations: iterables must all be of the same type if they are more than two
[ "Known", "limitations", ":", "iterables", "must", "all", "be", "of", "the", "same", "type", "if", "they", "are", "more", "than", "two" ]
def izip(*iterables): 'Known limitations: iterables must all be of the same type if they are more than two' yield iter(iterables).next(),
[ "def", "izip", "(", "*", "iterables", ")", ":", "yield", "iter", "(", "iterables", ")", ".", "next", "(", ")", "," ]
https://github.com/shedskin/shedskin/blob/ae88dbca7b1d9671cd8be448cb0b497122758936/shedskin/lib/itertools.py#L67-L69
Xilinx/Vitis-AI
fc74d404563d9951b57245443c73bef389f3657f
tools/Vitis-AI-Quantizer/vai_q_tensorflow1.x/tensorflow/python/framework/importer.py
python
_ProcessInputMapParam
(input_map)
return input_map
Type-checks and possibly canonicalizes `input_map`.
Type-checks and possibly canonicalizes `input_map`.
[ "Type", "-", "checks", "and", "possibly", "canonicalizes", "input_map", "." ]
def _ProcessInputMapParam(input_map): """Type-checks and possibly canonicalizes `input_map`.""" if input_map is None: input_map = {} else: if not (isinstance(input_map, dict) and all( isinstance(k, compat.bytes_or_text_types) for k in input_map.keys())): raise TypeError('input_map must be a ...
[ "def", "_ProcessInputMapParam", "(", "input_map", ")", ":", "if", "input_map", "is", "None", ":", "input_map", "=", "{", "}", "else", ":", "if", "not", "(", "isinstance", "(", "input_map", ",", "dict", ")", "and", "all", "(", "isinstance", "(", "k", ",...
https://github.com/Xilinx/Vitis-AI/blob/fc74d404563d9951b57245443c73bef389f3657f/tools/Vitis-AI-Quantizer/vai_q_tensorflow1.x/tensorflow/python/framework/importer.py#L116-L125
catboost/catboost
167f64f237114a4d10b2b4ee42adb4569137debe
contrib/python/pandas/py3/pandas/core/internals/managers.py
python
_fast_count_smallints
(arr: np.ndarray)
return np.c_[nz, counts[nz]]
Faster version of set(arr) for sequences of small numbers.
Faster version of set(arr) for sequences of small numbers.
[ "Faster", "version", "of", "set", "(", "arr", ")", "for", "sequences", "of", "small", "numbers", "." ]
def _fast_count_smallints(arr: np.ndarray) -> np.ndarray: """Faster version of set(arr) for sequences of small numbers.""" counts = np.bincount(arr.astype(np.int_)) nz = counts.nonzero()[0] return np.c_[nz, counts[nz]]
[ "def", "_fast_count_smallints", "(", "arr", ":", "np", ".", "ndarray", ")", "->", "np", ".", "ndarray", ":", "counts", "=", "np", ".", "bincount", "(", "arr", ".", "astype", "(", "np", ".", "int_", ")", ")", "nz", "=", "counts", ".", "nonzero", "("...
https://github.com/catboost/catboost/blob/167f64f237114a4d10b2b4ee42adb4569137debe/contrib/python/pandas/py3/pandas/core/internals/managers.py#L2018-L2022
GNOME/gjs
ccbfa21e2be3ebe700050f85e93bfcbc18cc676d
tools/heapgraph.py
python
parse_graph
(fobj)
return [edges, edge_labels, node_labels, annotations]
Parse the node and edges of a garbage collector heap.
Parse the node and edges of a garbage collector heap.
[ "Parse", "the", "node", "and", "edges", "of", "a", "garbage", "collector", "heap", "." ]
def parse_graph(fobj): """Parse the node and edges of a garbage collector heap.""" edges = {} edge_labels = {} node_labels = {} annotations = {} def addNode (addr, node_label): edges[addr] = {} edge_labels[addr] = {} if node_label != '': node_labels[addr] =...
[ "def", "parse_graph", "(", "fobj", ")", ":", "edges", "=", "{", "}", "edge_labels", "=", "{", "}", "node_labels", "=", "{", "}", "annotations", "=", "{", "}", "def", "addNode", "(", "addr", ",", "node_label", ")", ":", "edges", "[", "addr", "]", "=...
https://github.com/GNOME/gjs/blob/ccbfa21e2be3ebe700050f85e93bfcbc18cc676d/tools/heapgraph.py#L174-L232
trilinos/Trilinos
6168be6dd51e35e1cd681e9c4b24433e709df140
packages/seacas/scripts/exodus3.in.py
python
exodus.get_node_set_variable_values
(self, object_id, name, step)
return values
get list of node set variable values for a specified node set, node set variable name, and time step; the list has one variable value per node in the set >>> nsvar_vals = ... exo.get_node_set_variable_values(node_set_id, ... nsvar_name, time_step) Parameters ...
get list of node set variable values for a specified node set, node set variable name, and time step; the list has one variable value per node in the set
[ "get", "list", "of", "node", "set", "variable", "values", "for", "a", "specified", "node", "set", "node", "set", "variable", "name", "and", "time", "step", ";", "the", "list", "has", "one", "variable", "value", "per", "node", "in", "the", "set" ]
def get_node_set_variable_values(self, object_id, name, step): """ get list of node set variable values for a specified node set, node set variable name, and time step; the list has one variable value per node in the set >>> nsvar_vals = ... exo.get_node_set_variable_v...
[ "def", "get_node_set_variable_values", "(", "self", ",", "object_id", ",", "name", ",", "step", ")", ":", "values", "=", "self", ".", "get_variable_values", "(", "'EX_NODE_SET'", ",", "object_id", ",", "name", ",", "step", ")", "return", "values" ]
https://github.com/trilinos/Trilinos/blob/6168be6dd51e35e1cd681e9c4b24433e709df140/packages/seacas/scripts/exodus3.in.py#L3463-L3489
wxWidgets/wxPython-Classic
19571e1ae65f1ac445f5491474121998c97a1bf0
wx/tools/Editra/src/autocomp/autocomp.py
python
CompleterFactory.__new__
(cls, base, buff)
return self
Return an instance of the passed in class type
Return an instance of the passed in class type
[ "Return", "an", "instance", "of", "the", "passed", "in", "class", "type" ]
def __new__(cls, base, buff): """Return an instance of the passed in class type""" self = base(buff) return self
[ "def", "__new__", "(", "cls", ",", "base", ",", "buff", ")", ":", "self", "=", "base", "(", "buff", ")", "return", "self" ]
https://github.com/wxWidgets/wxPython-Classic/blob/19571e1ae65f1ac445f5491474121998c97a1bf0/wx/tools/Editra/src/autocomp/autocomp.py#L109-L112
rampageX/firmware-mod-kit
c94cd6aeee50d92ec5280a6dba6d74828fd3606b
src/binwalk-2.1.1/src/binwalk/modules/binvis.py
python
Plotter._generate_3d_data_point
(self, data)
return (ord(data[0]), ord(data[1]), ord(data[2]))
Plot data points within a 3D cube.
Plot data points within a 3D cube.
[ "Plot", "data", "points", "within", "a", "3D", "cube", "." ]
def _generate_3d_data_point(self, data): ''' Plot data points within a 3D cube. ''' return (ord(data[0]), ord(data[1]), ord(data[2]))
[ "def", "_generate_3d_data_point", "(", "self", ",", "data", ")", ":", "return", "(", "ord", "(", "data", "[", "0", "]", ")", ",", "ord", "(", "data", "[", "1", "]", ")", ",", "ord", "(", "data", "[", "2", "]", ")", ")" ]
https://github.com/rampageX/firmware-mod-kit/blob/c94cd6aeee50d92ec5280a6dba6d74828fd3606b/src/binwalk-2.1.1/src/binwalk/modules/binvis.py#L280-L284
wxWidgets/wxPython-Classic
19571e1ae65f1ac445f5491474121998c97a1bf0
wx/tools/Editra/src/eclib/auinavi.py
python
AuiPaneNavigator.__init__
(self, parent, auiMgr, icon=None, title='')
Initialize the navigator window @param parent: parent window @param auiMgr: wx.aui.AuiManager @keyword icon: wx.Bitmap or None @keyword title: string (dialog title)
Initialize the navigator window @param parent: parent window @param auiMgr: wx.aui.AuiManager @keyword icon: wx.Bitmap or None @keyword title: string (dialog title)
[ "Initialize", "the", "navigator", "window", "@param", "parent", ":", "parent", "window", "@param", "auiMgr", ":", "wx", ".", "aui", ".", "AuiManager", "@keyword", "icon", ":", "wx", ".", "Bitmap", "or", "None", "@keyword", "title", ":", "string", "(", "dia...
def __init__(self, parent, auiMgr, icon=None, title=''): """Initialize the navigator window @param parent: parent window @param auiMgr: wx.aui.AuiManager @keyword icon: wx.Bitmap or None @keyword title: string (dialog title) """ super(AuiPaneNavigator, self).__in...
[ "def", "__init__", "(", "self", ",", "parent", ",", "auiMgr", ",", "icon", "=", "None", ",", "title", "=", "''", ")", ":", "super", "(", "AuiPaneNavigator", ",", "self", ")", ".", "__init__", "(", "parent", ",", "wx", ".", "ID_ANY", ",", "\"\"", ",...
https://github.com/wxWidgets/wxPython-Classic/blob/19571e1ae65f1ac445f5491474121998c97a1bf0/wx/tools/Editra/src/eclib/auinavi.py#L49-L81
aws/lumberyard
f85344403c1c2e77ec8c75deb2c116e97b713217
dev/Gems/CloudGemMetric/v1/AWS/common-code/Lib/numpy/polynomial/chebyshev.py
python
chebcompanion
(c)
return mat
Return the scaled companion matrix of c. The basis polynomials are scaled so that the companion matrix is symmetric when `c` is a Chebyshev basis polynomial. This provides better eigenvalue estimates than the unscaled case and for basis polynomials the eigenvalues are guaranteed to be real if `nump...
Return the scaled companion matrix of c.
[ "Return", "the", "scaled", "companion", "matrix", "of", "c", "." ]
def chebcompanion(c): """Return the scaled companion matrix of c. The basis polynomials are scaled so that the companion matrix is symmetric when `c` is a Chebyshev basis polynomial. This provides better eigenvalue estimates than the unscaled case and for basis polynomials the eigenvalues are guara...
[ "def", "chebcompanion", "(", "c", ")", ":", "# c is a trimmed copy", "[", "c", "]", "=", "pu", ".", "as_series", "(", "[", "c", "]", ")", "if", "len", "(", "c", ")", "<", "2", ":", "raise", "ValueError", "(", "'Series must have maximum degree of at least 1...
https://github.com/aws/lumberyard/blob/f85344403c1c2e77ec8c75deb2c116e97b713217/dev/Gems/CloudGemMetric/v1/AWS/common-code/Lib/numpy/polynomial/chebyshev.py#L1650-L1692
aws/lumberyard
f85344403c1c2e77ec8c75deb2c116e97b713217
dev/Tools/Python/3.7.10/mac/Python.framework/Versions/3.7/lib/python3.7/idlelib/searchbase.py
python
SearchDialogBase.create_other_buttons
(self)
return frame, others
Return (frame, others) for testing. Others is a list of value, label pairs. A gridded frame from make_frame is filled with radio buttons.
Return (frame, others) for testing.
[ "Return", "(", "frame", "others", ")", "for", "testing", "." ]
def create_other_buttons(self): '''Return (frame, others) for testing. Others is a list of value, label pairs. A gridded frame from make_frame is filled with radio buttons. ''' frame = self.make_frame("Direction")[0] var = self.engine.backvar others = [(1, 'Up'),...
[ "def", "create_other_buttons", "(", "self", ")", ":", "frame", "=", "self", ".", "make_frame", "(", "\"Direction\"", ")", "[", "0", "]", "var", "=", "self", ".", "engine", ".", "backvar", "others", "=", "[", "(", "1", ",", "'Up'", ")", ",", "(", "0...
https://github.com/aws/lumberyard/blob/f85344403c1c2e77ec8c75deb2c116e97b713217/dev/Tools/Python/3.7.10/mac/Python.framework/Versions/3.7/lib/python3.7/idlelib/searchbase.py#L148-L160
SFTtech/openage
d6a08c53c48dc1e157807471df92197f6ca9e04d
openage/nyan/nyan_structs.py
python
NyanObject.get_nested_objects
(self)
return self._nested_objects
Returns all nested NyanObjects of this object.
Returns all nested NyanObjects of this object.
[ "Returns", "all", "nested", "NyanObjects", "of", "this", "object", "." ]
def get_nested_objects(self): """ Returns all nested NyanObjects of this object. """ return self._nested_objects
[ "def", "get_nested_objects", "(", "self", ")", ":", "return", "self", ".", "_nested_objects" ]
https://github.com/SFTtech/openage/blob/d6a08c53c48dc1e157807471df92197f6ca9e04d/openage/nyan/nyan_structs.py#L215-L219
sdhash/sdhash
b9eff63e4e5867e910f41fd69032bbb1c94a2a5e
sdhash-ui/cherrypy/_cperror.py
python
format_exc
(exc=None)
Return exc (or sys.exc_info if None), formatted.
Return exc (or sys.exc_info if None), formatted.
[ "Return", "exc", "(", "or", "sys", ".", "exc_info", "if", "None", ")", "formatted", "." ]
def format_exc(exc=None): """Return exc (or sys.exc_info if None), formatted.""" try: if exc is None: exc = _exc_info() if exc == (None, None, None): return "" import traceback return "".join(traceback.format_exception(*exc)) finally: del exc
[ "def", "format_exc", "(", "exc", "=", "None", ")", ":", "try", ":", "if", "exc", "is", "None", ":", "exc", "=", "_exc_info", "(", ")", "if", "exc", "==", "(", "None", ",", "None", ",", "None", ")", ":", "return", "\"\"", "import", "traceback", "r...
https://github.com/sdhash/sdhash/blob/b9eff63e4e5867e910f41fd69032bbb1c94a2a5e/sdhash-ui/cherrypy/_cperror.py#L516-L526
catboost/catboost
167f64f237114a4d10b2b4ee42adb4569137debe
contrib/python/setuptools/py3/setuptools/_vendor/pyparsing.py
python
Regex.__init__
( self, pattern, flags=0)
The parameters C{pattern} and C{flags} are passed to the C{re.compile()} function as-is. See the Python C{re} module for an explanation of the acceptable patterns and flags.
The parameters C{pattern} and C{flags} are passed to the C{re.compile()} function as-is. See the Python C{re} module for an explanation of the acceptable patterns and flags.
[ "The", "parameters", "C", "{", "pattern", "}", "and", "C", "{", "flags", "}", "are", "passed", "to", "the", "C", "{", "re", ".", "compile", "()", "}", "function", "as", "-", "is", ".", "See", "the", "Python", "C", "{", "re", "}", "module", "for",...
def __init__( self, pattern, flags=0): """The parameters C{pattern} and C{flags} are passed to the C{re.compile()} function as-is. See the Python C{re} module for an explanation of the acceptable patterns and flags.""" super(Regex,self).__init__() if isinstance(pattern, basestring): ...
[ "def", "__init__", "(", "self", ",", "pattern", ",", "flags", "=", "0", ")", ":", "super", "(", "Regex", ",", "self", ")", ".", "__init__", "(", ")", "if", "isinstance", "(", "pattern", ",", "basestring", ")", ":", "if", "not", "pattern", ":", "war...
https://github.com/catboost/catboost/blob/167f64f237114a4d10b2b4ee42adb4569137debe/contrib/python/setuptools/py3/setuptools/_vendor/pyparsing.py#L2779-L2811
arangodb/arangodb
0d658689c7d1b721b314fa3ca27d38303e1570c8
3rdParty/V8/v7.9.317/third_party/jinja2/environment.py
python
Environment.add_extension
(self, extension)
Adds an extension after the environment was created. .. versionadded:: 2.5
Adds an extension after the environment was created.
[ "Adds", "an", "extension", "after", "the", "environment", "was", "created", "." ]
def add_extension(self, extension): """Adds an extension after the environment was created. .. versionadded:: 2.5 """ self.extensions.update(load_extensions(self, [extension]))
[ "def", "add_extension", "(", "self", ",", "extension", ")", ":", "self", ".", "extensions", ".", "update", "(", "load_extensions", "(", "self", ",", "[", "extension", "]", ")", ")" ]
https://github.com/arangodb/arangodb/blob/0d658689c7d1b721b314fa3ca27d38303e1570c8/3rdParty/V8/v7.9.317/third_party/jinja2/environment.py#L340-L345
ArduPilot/ardupilot
6e684b3496122b8158ac412b609d00004b7ac306
Tools/scripts/tempcal_IMU.py
python
IMUData.moving_average
(self, data, w)
return ret[w - 1:] / w
apply a moving average filter over a window of width w
apply a moving average filter over a window of width w
[ "apply", "a", "moving", "average", "filter", "over", "a", "window", "of", "width", "w" ]
def moving_average(self, data, w): '''apply a moving average filter over a window of width w''' ret = np.cumsum(data) ret[w:] = ret[w:] - ret[:-w] return ret[w - 1:] / w
[ "def", "moving_average", "(", "self", ",", "data", ",", "w", ")", ":", "ret", "=", "np", ".", "cumsum", "(", "data", ")", "ret", "[", "w", ":", "]", "=", "ret", "[", "w", ":", "]", "-", "ret", "[", ":", "-", "w", "]", "return", "ret", "[", ...
https://github.com/ArduPilot/ardupilot/blob/6e684b3496122b8158ac412b609d00004b7ac306/Tools/scripts/tempcal_IMU.py#L221-L225
rdkit/rdkit
ede860ae316d12d8568daf5ee800921c3389c84e
rdkit/sping/Qt/pidQt4.py
python
QtCanvas.stringBox
(self, s, font=None)
return rect.width(), rect.height()
Return the logical width and height of the string if it were drawn \ in the current font (defaults to self.font).
Return the logical width and height of the string if it were drawn \ in the current font (defaults to self.font).
[ "Return", "the", "logical", "width", "and", "height", "of", "the", "string", "if", "it", "were", "drawn", "\\", "in", "the", "current", "font", "(", "defaults", "to", "self", ".", "font", ")", "." ]
def stringBox(self, s, font=None): "Return the logical width and height of the string if it were drawn \ in the current font (defaults to self.font)." if not font: font = self.defaultFont if font: self._adjustFont(font) t = QtGui.QGraphicsTextItem(s) t.setFont(self._font) rect ...
[ "def", "stringBox", "(", "self", ",", "s", ",", "font", "=", "None", ")", ":", "if", "not", "font", ":", "font", "=", "self", ".", "defaultFont", "if", "font", ":", "self", ".", "_adjustFont", "(", "font", ")", "t", "=", "QtGui", ".", "QGraphicsTex...
https://github.com/rdkit/rdkit/blob/ede860ae316d12d8568daf5ee800921c3389c84e/rdkit/sping/Qt/pidQt4.py#L252-L264
arangodb/arangodb
0d658689c7d1b721b314fa3ca27d38303e1570c8
3rdParty/V8/v7.9.317/tools/grokdump.py
python
InspectionShell.do_print
(self, cmd)
Evaluate an arbitrary python command.
Evaluate an arbitrary python command.
[ "Evaluate", "an", "arbitrary", "python", "command", "." ]
def do_print(self, cmd): """ Evaluate an arbitrary python command. """ try: print(self.EvalExpression(cmd)) except: pass
[ "def", "do_print", "(", "self", ",", "cmd", ")", ":", "try", ":", "print", "(", "self", ".", "EvalExpression", "(", "cmd", ")", ")", "except", ":", "pass" ]
https://github.com/arangodb/arangodb/blob/0d658689c7d1b721b314fa3ca27d38303e1570c8/3rdParty/V8/v7.9.317/tools/grokdump.py#L3482-L3489
larroy/clearskies_core
3574ddf0edc8555454c7044126e786a6c29444dc
tools/gyp/pylib/gyp/generator/cmake.py
python
NormjoinPathForceCMakeSource
(base_path, rel_path)
return os.path.join('${CMAKE_SOURCE_DIR}', os.path.normpath(os.path.join(base_path, rel_path)))
Resolves rel_path against base_path and returns the result. If rel_path is an absolute path it is returned unchanged. Otherwise it is resolved against base_path and normalized. If the result is a relative path, it is forced to be relative to the CMakeLists.txt.
Resolves rel_path against base_path and returns the result.
[ "Resolves", "rel_path", "against", "base_path", "and", "returns", "the", "result", "." ]
def NormjoinPathForceCMakeSource(base_path, rel_path): """Resolves rel_path against base_path and returns the result. If rel_path is an absolute path it is returned unchanged. Otherwise it is resolved against base_path and normalized. If the result is a relative path, it is forced to be relative to the CMake...
[ "def", "NormjoinPathForceCMakeSource", "(", "base_path", ",", "rel_path", ")", ":", "if", "os", ".", "path", ".", "isabs", "(", "rel_path", ")", ":", "return", "rel_path", "if", "any", "(", "[", "rel_path", ".", "startswith", "(", "var", ")", "for", "var...
https://github.com/larroy/clearskies_core/blob/3574ddf0edc8555454c7044126e786a6c29444dc/tools/gyp/pylib/gyp/generator/cmake.py#L93-L107
wxWidgets/wxPython-Classic
19571e1ae65f1ac445f5491474121998c97a1bf0
src/osx_cocoa/_controls.py
python
SpinCtrlDouble.GetMax
(*args, **kwargs)
return _controls_.SpinCtrlDouble_GetMax(*args, **kwargs)
GetMax(self) -> double
GetMax(self) -> double
[ "GetMax", "(", "self", ")", "-", ">", "double" ]
def GetMax(*args, **kwargs): """GetMax(self) -> double""" return _controls_.SpinCtrlDouble_GetMax(*args, **kwargs)
[ "def", "GetMax", "(", "*", "args", ",", "*", "*", "kwargs", ")", ":", "return", "_controls_", ".", "SpinCtrlDouble_GetMax", "(", "*", "args", ",", "*", "*", "kwargs", ")" ]
https://github.com/wxWidgets/wxPython-Classic/blob/19571e1ae65f1ac445f5491474121998c97a1bf0/src/osx_cocoa/_controls.py#L2500-L2502
wxWidgets/wxPython-Classic
19571e1ae65f1ac445f5491474121998c97a1bf0
src/osx_carbon/grid.py
python
GridCellEnumEditor.__init__
(self, *args, **kwargs)
__init__(self, String choices=EmptyString) -> GridCellEnumEditor
__init__(self, String choices=EmptyString) -> GridCellEnumEditor
[ "__init__", "(", "self", "String", "choices", "=", "EmptyString", ")", "-", ">", "GridCellEnumEditor" ]
def __init__(self, *args, **kwargs): """__init__(self, String choices=EmptyString) -> GridCellEnumEditor""" _grid.GridCellEnumEditor_swiginit(self,_grid.new_GridCellEnumEditor(*args, **kwargs)) self._setOORInfo(self)
[ "def", "__init__", "(", "self", ",", "*", "args", ",", "*", "*", "kwargs", ")", ":", "_grid", ".", "GridCellEnumEditor_swiginit", "(", "self", ",", "_grid", ".", "new_GridCellEnumEditor", "(", "*", "args", ",", "*", "*", "kwargs", ")", ")", "self", "."...
https://github.com/wxWidgets/wxPython-Classic/blob/19571e1ae65f1ac445f5491474121998c97a1bf0/src/osx_carbon/grid.py#L496-L499
Polidea/SiriusObfuscator
b0e590d8130e97856afe578869b83a209e2b19be
SymbolExtractorAndRenamer/lldb/scripts/Python/static-binding/lldb.py
python
SBLineEntry.SetLine
(self, *args)
return _lldb.SBLineEntry_SetLine(self, *args)
SetLine(self, uint32_t line)
SetLine(self, uint32_t line)
[ "SetLine", "(", "self", "uint32_t", "line", ")" ]
def SetLine(self, *args): """SetLine(self, uint32_t line)""" return _lldb.SBLineEntry_SetLine(self, *args)
[ "def", "SetLine", "(", "self", ",", "*", "args", ")", ":", "return", "_lldb", ".", "SBLineEntry_SetLine", "(", "self", ",", "*", "args", ")" ]
https://github.com/Polidea/SiriusObfuscator/blob/b0e590d8130e97856afe578869b83a209e2b19be/SymbolExtractorAndRenamer/lldb/scripts/Python/static-binding/lldb.py#L5655-L5657
krishauser/Klampt
972cc83ea5befac3f653c1ba20f80155768ad519
Python/python2_version/klampt/src/robotsim.py
python
Simulator.setGravity
(self, g)
return _robotsim.Simulator_setGravity(self, g)
setGravity(Simulator self, double const [3] g) Sets the overall gravity vector.
setGravity(Simulator self, double const [3] g)
[ "setGravity", "(", "Simulator", "self", "double", "const", "[", "3", "]", "g", ")" ]
def setGravity(self, g): """ setGravity(Simulator self, double const [3] g) Sets the overall gravity vector. """ return _robotsim.Simulator_setGravity(self, g)
[ "def", "setGravity", "(", "self", ",", "g", ")", ":", "return", "_robotsim", ".", "Simulator_setGravity", "(", "self", ",", "g", ")" ]
https://github.com/krishauser/Klampt/blob/972cc83ea5befac3f653c1ba20f80155768ad519/Python/python2_version/klampt/src/robotsim.py#L8544-L8553
thalium/icebox
99d147d5b9269222225443ce171b4fd46d8985d4
third_party/virtualbox/src/VBox/Devices/EFI/Firmware/AppPkg/Applications/Python/PyMod-2.7.2/Lib/pydoc.py
python
gui
()
Graphical interface (starts web server and pops up a control window).
Graphical interface (starts web server and pops up a control window).
[ "Graphical", "interface", "(", "starts", "web", "server", "and", "pops", "up", "a", "control", "window", ")", "." ]
def gui(): """Graphical interface (starts web server and pops up a control window).""" class GUI: def __init__(self, window, port=7464): self.window = window self.server = None self.scanner = None import Tkinter self.server_frm = Tkinter.Frame...
[ "def", "gui", "(", ")", ":", "class", "GUI", ":", "def", "__init__", "(", "self", ",", "window", ",", "port", "=", "7464", ")", ":", "self", ".", "window", "=", "window", "self", ".", "server", "=", "None", "self", ".", "scanner", "=", "None", "i...
https://github.com/thalium/icebox/blob/99d147d5b9269222225443ce171b4fd46d8985d4/third_party/virtualbox/src/VBox/Devices/EFI/Firmware/AppPkg/Applications/Python/PyMod-2.7.2/Lib/pydoc.py#L2072-L2251
ideawu/ssdb-rocks
a3cbb322cafb2f493252829c608e2239df98c9ac
deps/cpy/antlr3/tree.py
python
TreeAdaptor.createWithPayload
(self, payload)
Create a tree node from Token object; for CommonTree type trees, then the token just becomes the payload. This is the most common create call. Override if you want another kind of node to be built.
Create a tree node from Token object; for CommonTree type trees, then the token just becomes the payload. This is the most common create call.
[ "Create", "a", "tree", "node", "from", "Token", "object", ";", "for", "CommonTree", "type", "trees", "then", "the", "token", "just", "becomes", "the", "payload", ".", "This", "is", "the", "most", "common", "create", "call", "." ]
def createWithPayload(self, payload): """ Create a tree node from Token object; for CommonTree type trees, then the token just becomes the payload. This is the most common create call. Override if you want another kind of node to be built. """ raise NotImplemen...
[ "def", "createWithPayload", "(", "self", ",", "payload", ")", ":", "raise", "NotImplementedError" ]
https://github.com/ideawu/ssdb-rocks/blob/a3cbb322cafb2f493252829c608e2239df98c9ac/deps/cpy/antlr3/tree.py#L264-L273
catboost/catboost
167f64f237114a4d10b2b4ee42adb4569137debe
contrib/python/setuptools/py2/setuptools/_vendor/pyparsing.py
python
ParserElement.enablePackrat
(cache_size_limit=128)
Enables "packrat" parsing, which adds memoizing to the parsing logic. Repeated parse attempts at the same string location (which happens often in many complex grammars) can immediately return a cached value, instead of re-executing parsing/validating code. Memoizing is done of ...
Enables "packrat" parsing, which adds memoizing to the parsing logic. Repeated parse attempts at the same string location (which happens often in many complex grammars) can immediately return a cached value, instead of re-executing parsing/validating code. Memoizing is done of ...
[ "Enables", "packrat", "parsing", "which", "adds", "memoizing", "to", "the", "parsing", "logic", ".", "Repeated", "parse", "attempts", "at", "the", "same", "string", "location", "(", "which", "happens", "often", "in", "many", "complex", "grammars", ")", "can", ...
def enablePackrat(cache_size_limit=128): """Enables "packrat" parsing, which adds memoizing to the parsing logic. Repeated parse attempts at the same string location (which happens often in many complex grammars) can immediately return a cached value, instead of re-executing par...
[ "def", "enablePackrat", "(", "cache_size_limit", "=", "128", ")", ":", "if", "not", "ParserElement", ".", "_packratEnabled", ":", "ParserElement", ".", "_packratEnabled", "=", "True", "if", "cache_size_limit", "is", "None", ":", "ParserElement", ".", "packrat_cach...
https://github.com/catboost/catboost/blob/167f64f237114a4d10b2b4ee42adb4569137debe/contrib/python/setuptools/py2/setuptools/_vendor/pyparsing.py#L1574-L1606
microsoft/CNTK
e9396480025b9ca457d26b6f33dd07c474c6aa04
bindings/python/cntk/contrib/deeprl/agent/shared/models.py
python
Models.feedforward_network
(shape_of_inputs, number_of_outputs, model_hidden_layers, loss_function=None, use_placeholder_for_input=False)
return { 'inputs': inputs, 'outputs': outputs, 'f': f, 'loss': loss }
Feedforward network to approximate Q or log of pi. Args: shape_of_inputs: tuple of array (input) dimensions. number_of_outputs: dimension of output, equals the number of possible actions. model_hidden_layers: string representing a list of integers ...
Feedforward network to approximate Q or log of pi.
[ "Feedforward", "network", "to", "approximate", "Q", "or", "log", "of", "pi", "." ]
def feedforward_network(shape_of_inputs, number_of_outputs, model_hidden_layers, loss_function=None, use_placeholder_for_input=False): """Feedforward network to approximate Q or log of pi. Ar...
[ "def", "feedforward_network", "(", "shape_of_inputs", ",", "number_of_outputs", ",", "model_hidden_layers", ",", "loss_function", "=", "None", ",", "use_placeholder_for_input", "=", "False", ")", ":", "# input/output", "inputs", "=", "C", ".", "ops", ".", "placehold...
https://github.com/microsoft/CNTK/blob/e9396480025b9ca457d26b6f33dd07c474c6aa04/bindings/python/cntk/contrib/deeprl/agent/shared/models.py#L22-L66